当前位置: 首页>>代码示例>>C#>>正文


C# Script类代码示例

本文整理汇总了C#中Script的典型用法代码示例。如果您正苦于以下问题:C# Script类的具体用法?C# Script怎么用?C# Script使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Script类属于命名空间,在下文中一共展示了Script类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Interpret

        internal static int Interpret(Script script, string prefix)
        {
            IEnumerable<Frame> frames = script.CreateFrames();

            double range;
            {
                double maxDist = (script.Config.Width + script.Config.Height) * 10;
                range = maxDist * maxDist;
            }

            IDictionary<IVariable, VariableWithValue> previousState = new Dictionary<IVariable, VariableWithValue>();

            foreach (var f in frames) {
                var bitmap = new Bitmap(script.Config.Width, script.Config.Height);
                Graphics drawingPane = Graphics.FromImage(bitmap);

                // Compute locations for each anchor of each thing.
                Dictionary<string, double> debugExpectedResults;
                script.DebugExpectedResults.TryGetValue(f.FrameNo, out debugExpectedResults);
                IDictionary<string, IDictionary<string, ConstVector>> anchorLocations =
                    f.SolveConstraints(range, ref previousState, debugExpectedResults);
                foreach (var th in script.Things) {
                    th.Draw(drawingPane, anchorLocations[th.Name]);
                }

                bitmap.Save(string.Format("{0}{1:000000}.jpg", prefix, f.FrameNo), ImageFormat.Jpeg);
            }

            return frames.Count();
        }
开发者ID:hmmueller,项目名称:Movimentum,代码行数:30,代码来源:Program.cs

示例2: ScriptInvocation

 public ScriptInvocation(dynamic function = null, WorldObject associate = null, WorldObject invoker = null, Script script = null)
 {
     Function = function;
     Associate = associate;
     Invoker = invoker;
     Script = null;
 }
开发者ID:DomGrieco,项目名称:server,代码行数:7,代码来源:Scripting.cs

示例3: TfsHelper

 public TfsHelper(IContainer container, TextWriter stdout, Script script)
 {
     _container = container;
     _stdout = stdout;
     _script = script;
     _versionControlServer = new FakeVersionControlServer(_script);
 }
开发者ID:davidalpert,项目名称:git-tfs,代码行数:7,代码来源:TfsHelper.VsFake.cs

示例4: ChangeWallToken

        /// <summary>
        /// 
        /// </summary>
        /// <param name="script"></param>
        public ChangeWallToken(Script script)
            : base(script)
        {
            Type = script.ReadByte();
            switch (Type)
            {
                // All sides
                case 0xf7:
                {
                    Target = Location.FromScript(script); // script.ReadPosition();
                    To = script.ReadByte();
                    From = script.ReadByte();
                }
                break;
                // One side
                case 0xe9:
                {
                    Target = Location.FromScript(script); // script.ReadPosition();
                    Side = script.ReadByte();
                    To = script.ReadByte();
                    From = script.ReadByte();
                }
                break;
                // Open door
                case 0xea:
                {
                    Target = Location.FromScript(script); // script.ReadPosition();
                }
                break;

            }
        }
开发者ID:iliak,项目名称:EOB2-Extractor,代码行数:36,代码来源:ChangeWallToken.cs

示例5: ConvertToWhileLoop

		static void ConvertToWhileLoop(Script script, DoWhileStatement originalStatement)
		{
			script.Replace(originalStatement, new WhileStatement {
				Condition = originalStatement.Condition.Clone(),
				EmbeddedStatement = originalStatement.EmbeddedStatement.Clone()
			});
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:ConvertDoWhileToWhileLoopAction.cs

示例6: DecorateMessage

		internal void DecorateMessage(Script script)
		{
			if (Token != null)
			{
				DecorateMessage(script, Token.GetSourceRef(false));
			}
		}
开发者ID:abstractmachine,项目名称:Fungus-3D-Template,代码行数:7,代码来源:SyntaxErrorException.cs

示例7: LoadChunk

		internal static int LoadChunk(Script script, SourceCode source, ByteCode bytecode)
		{
			ScriptLoadingContext lcontext = CreateLoadingContext(script, source);
			try
			{
				Statement stat;

				using (script.PerformanceStats.StartStopwatch(Diagnostics.PerformanceCounter.AstCreation))
					stat = new ChunkStatement(lcontext);

				int beginIp = -1;

				//var srcref = new SourceRef(source.SourceID);

				using (script.PerformanceStats.StartStopwatch(Diagnostics.PerformanceCounter.Compilation))
				using (bytecode.EnterSource(null))
				{
					bytecode.Emit_Nop(string.Format("Begin chunk {0}", source.Name));
					beginIp = bytecode.GetJumpPointForLastInstruction();
					stat.Compile(bytecode);
					bytecode.Emit_Nop(string.Format("End chunk {0}", source.Name));
				}

				//Debug_DumpByteCode(bytecode, source.SourceID);

				return beginIp;
			}
			catch (SyntaxErrorException ex)
			{
				ex.DecorateMessage(script);
				throw;
			}
		}
开发者ID:InfectedBytes,项目名称:moonsharp,代码行数:33,代码来源:Loader_Fast.cs

示例8: Execute

 public void Execute(Script script, Regex procedure_pattern) {
     var textwriter = new StringWriter();
     var wscript = new WScript(script.Path, script.Arguments);
     wscript.OnEcho += textwriter.WriteLine;
     if (!_compiler.Compile(wscript, script))
         return;
     var list_procedures = ListProcedures(script, procedure_pattern);
     if (_compiler.Run(list_procedures.ProcInitialize)) {
         foreach (var procedure in list_procedures) {
             if (_compiler.Run(list_procedures.ProcSetup)) {
                 if (_compiler.Run(procedure, true)) {
                     OnSuccess(new ScriptSuccees(script, procedure));
                 } else {
                     var error = _compiler.Error;
                     if (list_procedures.ProcOnError != null) {
                         list_procedures.ProcOnError.Params = new object[] { procedure.Name, _compiler.Error.ToString() };
                         if (_compiler.Run(list_procedures.ProcOnError))
                             error.AddInformation((string)_compiler.Result);
                     }
                     OnError(error);
                 }
                 _compiler.Run(list_procedures.ProcTearDown);
             }
         }
         _compiler.Run(list_procedures.ProcTerminate);
     }
     if (list_procedures.Count == 0 && script.Succeed)
         OnSuccess(new ScriptSuccees(script));
     OnInfo(script, textwriter.ToString().CleanEnd());
 }
开发者ID:ubuetake,项目名称:selenium-vba,代码行数:30,代码来源:ScriptRunner.cs

示例9: ChangeLevelToken

        /// <summary>
        /// 
        /// </summary>
        /// <param name="script"></param>
        public ChangeLevelToken(Script script)
            : base(script)
        {
            Type = script.ReadByte();
            switch (Type)
            {
                // Inter level
                case 0xe5:
                {
                    Level = script.ReadByte();
                    Target = script.ReadPosition();
                    Direction = script.ReadByte();
                    Unknown0 = script.ReadByte();
                }
                break;

                // Intra level
                case 0x00:
                {
                    Target = script.ReadPosition();
                    Direction = script.ReadByte();
                }
                break;
            }
        }
开发者ID:iliak,项目名称:EOB2-Extractor,代码行数:29,代码来源:ChangeLevelToken.cs

示例10: DebugScript

		private void DebugScript(string filename)
		{
			m_Script = new Script(CoreModules.Preset_HardSandbox);
			m_Script.Options.UseLuaErrorLocations = true;
			m_Script.Options.DebugPrint = s => { Console_WriteLine("{0}", s); };

			((ScriptLoaderBase)m_Script.Options.ScriptLoader).ModulePaths = ScriptLoaderBase.UnpackStringPaths("Modules/?;Modules/?.lua");

			try
			{
				m_Script.LoadFile(filename, null, filename.Replace(':', '|'));
			}
			catch (Exception ex)
			{
				txtOutput.Text = "";
				Console_WriteLine("{0}", ex.Message);
				return;
			}

			m_Script.AttachDebugger(this);

			Thread m_Debugger = new Thread(DebugMain);
			m_Debugger.Name = "MoonSharp Execution Thread";
			m_Debugger.IsBackground = true;
			m_Debugger.Start();
		}
开发者ID:cyecp,项目名称:moonsharp,代码行数:26,代码来源:MainForm.cs

示例11: Engine

        public Engine()
        {
            mRenderer = new vRenderer();
            mInput = new Input();
            mNetwork = new Network();
            mScript = new Script();

            mWorld = new cWorld();

            bool other = false;

            for (int y = 0; y < 10; y++)
            {
                for (int x = 0; x < 10; x++)
                {
                    World_Geom geom = new World_Geom(new Vector2(x*64, y*64), "tex_bookshelf.bmp");

                    if (!other)
                    {
                        //geom = new World_Geom(new Vector2(x, y), "tex2.bmp");

                        e_pillar door = new e_pillar(new Vector2(x+0.5f, y+0.5f), "tex_3.bmp");
                        mWorld.AddEntity(door);
                    }

                    mWorld.AddGeometry(geom);
                    other = !other;
                }
                other = !other;
            }
        }
开发者ID:rvIceBreaker,项目名称:Crawler,代码行数:31,代码来源:Engine.cs

示例12: AddScript

        private void AddScript(Script script)
        {
            lock (_padlock)
            {
                if (_scripts.ContainsKey(script))
                {
                    return;
                }

                var files = new string[0];

                if (Directory.Exists(_configuration.ScriptFolder))
                {
                    files = Directory.GetFiles(_configuration.ScriptFolder, script.FileName, SearchOption.AllDirectories);
                }

                if (files.Length == 0)
                {
                    AddEmbeddedScript(script);

                    return;
                }

                if (files.Length > 1)
                {
                    throw new ScriptException(string.Format(SqlResources.ScriptCountException, _configuration.ScriptFolder, script.FileName, files.Length));
                }

                _scripts.Add(script, File.ReadAllText(files[0]));
            }
        }
开发者ID:hopla,项目名称:shuttle-esb,代码行数:31,代码来源:ScriptProvider.cs

示例13: UpdateAutocompleteCacheThread

        private static void UpdateAutocompleteCacheThread()
        {
            while (true)
            {
                Thread.Sleep(50);
                if (_scriptToUpdateInBackground != null)
                {
                    Script scriptToUpdate;
                    lock (_scriptLockObject)
                    {
                        scriptToUpdate = _scriptToUpdateInBackground;
                        _scriptToUpdateInBackground = null;
                    }
                    try
                    {
                        OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Processing, null);

                        ConstructCache(scriptToUpdate, true);

                        OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Finished, null);
                    }
                    catch (Exception ex)
                    {
                        OnBackgroundCacheUpdateStatusChanged(BackgroundAutoCompleteStatus.Error, ex);
                    }
                }
            }
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:28,代码来源:AutoComplete.cs

示例14: RequestBackgroundCacheUpdate

 public static void RequestBackgroundCacheUpdate(Script scriptToUpdate)
 {
     lock (_scriptLockObject)
     {
         _scriptToUpdateInBackground = scriptToUpdate;
     }
 }
开发者ID:Aquilon96,项目名称:ags,代码行数:7,代码来源:AutoComplete.cs

示例15: CheckScriptOwnership

		public static void CheckScriptOwnership(this IScriptPrivateResource resource, Script script)
		{
			if (resource.OwnerScript != null && resource.OwnerScript != script && script != null)
			{
				throw new ScriptRuntimeException("Attempt to access a resource owned by a script, from another script");
			}
		}
开发者ID:cyecp,项目名称:moonsharp,代码行数:7,代码来源:IScriptPrivateResource.cs


注:本文中的Script类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。