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


C# ScriptState类代码示例

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


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


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