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

C# ScriptState类代码示例

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

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



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

示例1: WithScriptState

 internal EvaluationState WithScriptState(ScriptState<object> state)
 {
     return new EvaluationState(
         state,
         ScriptOptions,
         SourceSearchPaths,
         ReferenceSearchPaths,
         WorkingDirectory);
 }
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:9,代码来源:InteractiveHost.Service.cs


示例2: ScriptResult

		public ScriptResult(
			ScriptState state,
			string output,
			TimeSpan elapsed = default(TimeSpan))
		{
			this.State = state;
			this.Output = output;
			this.Elapsed = elapsed;
		}
开发者ID:emoacht,项目名称:CSharpPlay,代码行数:9,代码来源:ScriptResult.cs


示例3: LogPack

		public LogPack(
			ulong tweetId,
			DateTimeOffset tweetTime,
			string scriptContent,
			string resultContent,
			ScriptState state)
		{
			this.TweetId = tweetId;
			this.TweetTime = tweetTime;
			this.ScriptContent = scriptContent;
			this.ResultContent = resultContent;
			this.State = state;
		}
开发者ID:emoacht,项目名称:CSharpPlay,代码行数:13,代码来源:LogPack.cs


示例4: EvaluationState

 internal EvaluationState(
     ScriptState<object> scriptState,
     ScriptOptions scriptOptions,
     ImmutableArray<string> sourceSearchPaths,
     ImmutableArray<string> referenceSearchPaths,
     string workingDirectory)
 {
     ScriptStateOpt = scriptState;
     ScriptOptions = scriptOptions;
     SourceSearchPaths = sourceSearchPaths;
     ReferenceSearchPaths = referenceSearchPaths;
     WorkingDirectory = workingDirectory;
 }
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:13,代码来源:InteractiveHost.Service.cs


示例5: ExecuteScript

        public void ExecuteScript(Script script)
        {
            // wrap the script in our state
            ScriptState scriptState = new ScriptState(script);

            // the script may complete in one go
            scriptState.Execute(null);

            // if not, add it to our list
            if (!scriptState.IsComplete)
            {
                scripts.Add(scriptState);
            }
        }
开发者ID:gbarnes12,项目名称:atlantis-xna,代码行数:14,代码来源:ScriptManager.cs


示例6: EvaluationState

                internal EvaluationState(
                    ScriptState<object> scriptStateOpt,
                    ScriptOptions scriptOptions,
                    ImmutableArray<string> sourceSearchPaths,
                    ImmutableArray<string> referenceSearchPaths,
                    string workingDirectory)
                {
                    Debug.Assert(scriptOptions != null);
                    Debug.Assert(!sourceSearchPaths.IsDefault);
                    Debug.Assert(!referenceSearchPaths.IsDefault);
                    Debug.Assert(workingDirectory != null);

                    ScriptStateOpt = scriptStateOpt;
                    ScriptOptions = scriptOptions;
                    SourceSearchPaths = sourceSearchPaths;
                    ReferenceSearchPaths = referenceSearchPaths;
                    WorkingDirectory = workingDirectory;
                }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:18,代码来源:InteractiveHost.Service.cs


示例7: SetScriptState

 public override void SetScriptState(ScriptState state)
 {
     activeScript.SetScriptState(state);
 }
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:4,代码来源:ActiveXWrappers.cs


示例8: ExecuteOnUIThread

            private async Task<ScriptState<object>> ExecuteOnUIThread(Script<object> script, ScriptState<object> stateOpt)
            {
                return await Task.Factory.StartNew(async () =>
                {
                    try
                    {
                        var task = (stateOpt == null) ?
                            script.RunAsync(_hostObject, CancellationToken.None) :
                            script.ContinueAsync(stateOpt, CancellationToken.None);

                        return await task.ConfigureAwait(false);
                    }
                    catch (Exception e)
                    {
                        // TODO (tomat): format exception
                        Console.Error.WriteLine(e);
                        return null;
                    }
                },
                CancellationToken.None,
                TaskCreationOptions.None,
                s_UIThreadScheduler).Unwrap().ConfigureAwait(false);
            }
开发者ID:MichalStrehovsky,项目名称:roslyn,代码行数:23,代码来源:InteractiveHost.Service.cs


示例9: BuildAndRun

        private void BuildAndRun(Script<object> newScript, InteractiveScriptGlobals globals, ref ScriptState<object> state, ref ScriptOptions options, bool displayResult, CancellationToken cancellationToken)
        {
            var diagnostics = newScript.Compile(cancellationToken);
            DisplayDiagnostics(diagnostics);
            if (diagnostics.HasAnyErrors())
            {
                return;
            }

            var task = (state == null) ?
                newScript.RunAsync(globals, catchException: e => true, cancellationToken: cancellationToken) :
                newScript.RunFromAsync(state, catchException: e => true, cancellationToken: cancellationToken);

            state = task.GetAwaiter().GetResult();
            if (state.Exception != null)
            {
                DisplayException(state.Exception);
            }
            else if (displayResult && newScript.HasReturnValue())
            {
                globals.Print(state.ReturnValue);
            }

            options = UpdateOptions(options, globals);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:25,代码来源:CommandLineRunner.cs


示例10:

 void IActiveScriptSite.OnStateChange(ScriptState scriptState)
 {
     //Trace.WriteLine("OnStateChange scriptState=" + scriptState);
 }
开发者ID:vadimi,项目名称:underscore-templates-msbuild,代码行数:4,代码来源:ScriptEngine.cs


示例11: Execute

        /// <summary>
        /// Executes the specified code.
        /// </summary>
        /// <param name="code">The code.</param>
        private void Execute(string code)
        {
            try
            {
                InteractiveScriptBase.Current = scriptBase;
                scriptBase._ScriptState_ = scriptState;
                scriptState = scriptState.ContinueWithAsync(code).Result;
                importedCode = ExtractImportedCode(scriptState.Script, importedCode);
                UpdateUsings(scriptState.Script, usings);
                UpdateReferences(scriptState.Script, references);
                scriptBase.Dump(scriptState.ReturnValue);

                if (scriptBase._InteractiveScriptBaseType_ != null && scriptBase._InteractiveScriptBaseType_ != scriptBase.GetType())
                {
                    var oldScriptBase = scriptBase;

                    scriptBase = (InteractiveScriptBase)Activator.CreateInstance(scriptBase._InteractiveScriptBaseType_);
                    scriptBase.ObjectWriter = oldScriptBase.ObjectWriter;
                    scriptBase._InternalObjectWriter_ = oldScriptBase._InternalObjectWriter_;

                    // TODO: Changing globals, but we need to store previous variables
                    scriptState = CSharpScript.RunAsync("", scriptState.Script.Options, scriptBase).Result;
                }
            }
            finally
            {
                InteractiveScriptBase.Current = null;
            }
        }
开发者ID:southpolenator,项目名称:WinDbgCs,代码行数:33,代码来源:InteractiveExecution.cs


示例12: ExecuteOnUIThread

            private async Task<ScriptState<object>> ExecuteOnUIThread(Script<object> script, ScriptState<object> stateOpt, bool displayResult)
            {
                return await ((Task<ScriptState<object>>)s_control.Invoke(
                    (Func<Task<ScriptState<object>>>)(async () =>
                    {
                        var task = (stateOpt == null) ?
                            script.RunAsync(_globals, catchException: e => true, cancellationToken: CancellationToken.None) :
                            script.RunFromAsync(stateOpt, catchException: e => true, cancellationToken: CancellationToken.None);

                        var newState = await task.ConfigureAwait(false);

                        if (newState.Exception != null)
                        {
                            DisplayException(newState.Exception);
                        }
                        else if (displayResult && newState.Script.HasReturnValue())
                        {
                            _globals.Print(newState.ReturnValue);
                        }

                        return newState;

                    }))).ConfigureAwait(false);
            }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:24,代码来源:InteractiveHost.Service.cs


示例13: GetScriptState

 public abstract void GetScriptState(out ScriptState state);
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:1,代码来源:ActiveXWrappers.cs


示例14: DisplaySubmissionResult

 private static void DisplaySubmissionResult(ScriptState<object> state)
 {
     // TODO
     //if (state.Script.GetCompilation().HasSubmissionResult())
     if (state.ReturnValue != null)
     {
         state.ReturnValue.Dump();
     }
 }
开发者ID:mjheitland,项目名称:TableTweaker,代码行数:9,代码来源:ExecutionHost.cs


示例15: TryBuildAndRun

        private bool TryBuildAndRun(Script<object> newScript, object globals, ref ScriptState<object> state, CancellationToken cancellationToken)
        {
            var diagnostics = newScript.Build(cancellationToken);
            DisplayDiagnostics(diagnostics);
            if (diagnostics.HasAnyErrors())
            {
                return false;
            }

            try
            {
                var task = (state == null) ?
                    newScript.RunAsync(globals, cancellationToken) :
                    newScript.ContinueAsync(state, cancellationToken);

                state = task.GetAwaiter().GetResult();
            }
            catch (Exception e)
            {
                DisplayException(e);
                return false;
            }

            return true;
        }
开发者ID:KirillMakarov,项目名称:roslyn,代码行数:25,代码来源:CommandLineRunner.cs


示例16: OnStateChange

 public void OnStateChange(ScriptState scriptState)
 {
     GlobalLog.Print("AutoWebProxyScriptWrapper.ScriptHost#" + ValidationHelper.HashString(this) + "::OnStateChange() state:" + ValidationHelper.ToString(scriptState));
     if (scriptState == ScriptState.Closed)
     {
         helper = null;
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:_autowebproxyscriptwrapper.cs


示例17: InitNew

 public void InitNew()
 {
     Debug.WriteLine ("InitNew()");
     DotNet.Enable ();
     CLOS.Init ();
     this.currentScriptState = ScriptState.Disconnected;
     if (this.site != null)
         this.site.OnStateChange (this.currentScriptState);
     CL.Readtable.Case = ReadtableCase.Preserve;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:10,代码来源:LScript.cs


示例18: GetScriptState

 public void GetScriptState(out ScriptState scriptState)
 {
     Debug.WriteLine ("GetScriptState()");
     scriptState = this.currentScriptState;
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:5,代码来源:LScript.cs


示例19: ExecuteOnUIThread

 private async Task<ScriptState<object>> ExecuteOnUIThread(Script<object> script, ScriptState<object> stateOpt)
 {
     return await ((Task<ScriptState<object>>)s_control.Invoke(
         (Func<Task<ScriptState<object>>>)(async () =>
         {
             try
             {
                 var task = (stateOpt == null) ?
                     script.RunAsync(_globals, CancellationToken.None) :
                     script.ContinueAsync(stateOpt, CancellationToken.None);
                 return await task.ConfigureAwait(false);
             }
             catch (FileLoadException e) when (e.InnerException is InteractiveAssemblyLoaderException)
             {
                 Console.Error.WriteLine(e.InnerException.Message);
                 return null;
             }
             catch (Exception e)
             {
                 // TODO (tomat): format exception
                 Console.Error.WriteLine(e);
                 return null;
             }
         }))).ConfigureAwait(false);
 }
开发者ID:peter76111,项目名称:roslyn,代码行数:25,代码来源:InteractiveHost.Service.cs


示例20: TryBuildAndRun

        private bool TryBuildAndRun(Script<object> newScript, InteractiveScriptGlobals globals, ref ScriptState<object> state, ref ScriptOptions options, CancellationToken cancellationToken)
        {
            var diagnostics = newScript.Compile(cancellationToken);
            DisplayDiagnostics(diagnostics);
            if (diagnostics.HasAnyErrors())
            {
                return false;
            }

            try
            {
                var task = (state == null) ?
                    newScript.RunAsync(globals, cancellationToken) :
                    newScript.ContinueAsync(state, cancellationToken);

                state = task.GetAwaiter().GetResult();
            }
            catch (FileLoadException e) when (e.InnerException is InteractiveAssemblyLoaderException)
            {
                var oldColor = _console.ForegroundColor;
                try
                {
                    _console.ForegroundColor = ConsoleColor.Red;
                    _console.Out.WriteLine(e.InnerException.Message);
                }
                finally
                {
                    _console.ForegroundColor = oldColor;
                }

                return false;
            }
            catch (Exception e)
            {
                DisplayException(e);
                return false;
            }

            options = UpdateOptions(options, globals);

            return true;
        }
开发者ID:Ryujose,项目名称:roslyn,代码行数:42,代码来源:CommandLineRunner.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Scriptable类代码示例发布时间:2022-05-24
下一篇:
C# ScriptScope类代码示例发布时间: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