• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Script类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddNewScript

        //dodawanie nowego skryptu
        public bool AddNewScript(Script script)
        {
            string query = "INSERT INTO Script VALUES(@UserID, @DateOfCreate, @Path, @NameOfProject, @TypeOfDb, (SELECT Id FROM InstanceOfDb WHERE Name = @name), @UniqueName, @Version)";
            string query2 = "INSERT INTO ListOfScript VALUES(@UserID, (SELECT Id FROM Script WHERE UniqueName = @UniqueName))";
            query += query2;
            SqlCommand cmd = new SqlCommand(query, con);
            script.Path = "C:\\Praca inzynierska\\Projekt\\Pliki\\" + script.UniqueName;
            cmd.Parameters.AddWithValue("@UserID", script.UserID);
            cmd.Parameters.AddWithValue("@DateOfCreate", script.DateOfCreate);
            cmd.Parameters.AddWithValue("@Path", script.Path);
            cmd.Parameters.AddWithValue("@NameOfProject", script.NameOfProject);
            cmd.Parameters.AddWithValue("@TypeOfDb", script.TypeOfDb);
            cmd.Parameters.AddWithValue("@name", script.InstOfDb.Name);
            cmd.Parameters.AddWithValue("@UniqueName", script.UniqueName);
            cmd.Parameters.AddWithValue("@Version", script.Version);

            int rows = cmd.ExecuteNonQuery();
            if (rows == 2)
            {
                File file = new File();
                if (file.CreateFile(script.Path, script.Content))
                    return true;
                else
                    return false;
            }
            else
                return false;
        }
开发者ID:SebaWic,项目名称:MSKS,代码行数:29,代码来源:SQL.cs


示例17: AddApi

 public static void AddApi(Script script)
 {
     UserData.RegisterType<Position>();
     #region Pings
     script.Globals["PING_ASSISTME"] = PingCategory.AssistMe;
     script.Globals["PING_DANGER"] = PingCategory.Danger;
     script.Globals["PING_ENEMYMISSING"] = PingCategory.EnemyMissing;
     script.Globals["PING_FALLBACK"] = PingCategory.Fallback;
     script.Globals["PING_NORMAL"] = PingCategory.Normal;
     script.Globals["PING_ONMYWAY"] = PingCategory.OnMyWay;
     #endregion
     script.Globals["GetTickCount"] = (Func<int>) GetTickCount;
     script.Globals["GetLatency"] = (Func<int>) GetPing;
     script.Globals["GetCursorPos"] = (Func<Position>) GetCursorPosition;
     script.Globals["GetGameTimer"] = (Func<float>) GetGameTime;
     script.Globals["WorldToScreen"] = (Func<GameUnit, Position>) WorldToScreen;
     script.Globals["GetTarget"] = (Func<GameUnit>) GetTarget;
     script.Globals["SetTarget"] = (Action<GameUnit>) SetTarget;
     script.Globals["BuyItem"] = (Action<int>) BuyItem;
     script.Globals["SellItem"] = (Action<SpellSlot>) SellItem;
     script.Globals["IsWallOfGrass"] = (Func<Position, bool>) IsWallOfGrass;
     script.Globals["KillProcess"] = (Action<string>) TaskKill;
     script.Globals["PingSignal"] = (Action<object, float, float, float, PingCategory>) Ping;
     //script.Globals["IsItemPurchasable"] = (Func<int, bool>) IsItemPurchasable;
     script.Globals["GetGameTimer"] = (Func<float>) GetGameTimer;
     script.Globals["GetMyHero"] = (Func<GameUnit>) GetMyHero;
 }
开发者ID:eddy5641,项目名称:LuaSharp,代码行数:27,代码来源:UtilApi.cs


示例18: Room

        public Room(int roomNumber)
            : base(roomNumber)
        {
            _script = new Script("room" + roomNumber + ".asc", "// Room script file", false);

            for (int i = 0; i < MAX_HOTSPOTS; i++)
            {
                RoomHotspot hotspot = new RoomHotspot(this);
                hotspot.ID = i;
                if (i == 0) hotspot.Description = "No hotspot";
                else hotspot.Description = "Hotspot " + i;
                _hotspots.Add(hotspot);
            }

            for (int i = 0; i < MAX_WALKABLE_AREAS; i++)
            {
                RoomWalkableArea area = new RoomWalkableArea();
                area.ID = i;
                _walkableAreas.Add(area);
            }

            for (int i = 0; i < MAX_WALK_BEHINDS; i++)
            {
                RoomWalkBehind area = new RoomWalkBehind();
                area.ID = i;
                _walkBehinds.Add(area);
            }

            for (int i = 0; i < MAX_REGIONS; i++)
            {
                RoomRegion area = new RoomRegion();
                area.ID = i;
                _regions.Add(area);
            }
        }
开发者ID:CisBetter,项目名称:ags,代码行数:35,代码来源:Room.cs


示例19: Execute

 public void Execute(Script script, Regex procedure_pattern) {
     if (!_scriptcontrol.Build(script))
         return;
     var list_procedures = ListProcedures(script, procedure_pattern);
     if (_scriptcontrol.Run(list_procedures.ProcInitialize)) {
         foreach (var procedure in list_procedures) {
             if (_scriptcontrol.Run(list_procedures.ProcSetup)) {
                 if (_scriptcontrol.Run(procedure, true)) {
                     OnSuccess(new ScriptSuccess(script, procedure));
                 } else {
                     var error = _scriptcontrol.Error;
                     if (list_procedures.ProcOnError != null) {
                         list_procedures.ProcOnError.Arguments = new[] { 
                             procedure.Name,
                             _scriptcontrol.Error.ToString() 
                         };
                         if (_scriptcontrol.Run(list_procedures.ProcOnError))
                             error.AddInfo((string)_scriptcontrol.Result);
                     }
                     OnError(error);
                 }
                 _scriptcontrol.Run(list_procedures.ProcTearDown);
             }
         }
         _scriptcontrol.Run(list_procedures.ProcTerminate);
     }
     if (list_procedures.Count == 0 && script.Succeed)
         OnSuccess(new ScriptSuccess(script));
     OnInfo(script, _scriptcontrol.WScriptEcho);
 }
开发者ID:thomb1,项目名称:SeleniumBasic,代码行数:30,代码来源:ScriptRunner.cs


示例20: ScriptImplementsIEnumerable

        public void ScriptImplementsIEnumerable()
        {
            Script script = new Script();

            Assert.IsInstanceOfType(((IEnumerable<Statement>)script).GetEnumerator(), typeof(IEnumerator<Statement>));
            Assert.IsInstanceOfType(((IEnumerable)script).GetEnumerator(), typeof(IEnumerator));
        }
开发者ID:DaveVdE,项目名称:adamjsgenerator,代码行数:7,代码来源:ScriptTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ScriptBundle类代码示例发布时间:2022-05-24
下一篇:
C# ScreenState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap