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


C# Promise.IgnoreFault方法代码示例

本文整理汇总了C#中Promise.IgnoreFault方法的典型用法代码示例。如果您正苦于以下问题:C# Promise.IgnoreFault方法的具体用法?C# Promise.IgnoreFault怎么用?C# Promise.IgnoreFault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Promise的用法示例。


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

示例1: LoadEditor

        private static IEnumerable LoadEditor(string gameDataPath, string reference, Promise waitTask)
        {
            if (waitTask != null)
                yield return waitTask.IgnoreFault();

            var title = Path.GetFileName(gameDataPath);
            if (EditorUtility.DisplayCancelableProgressBar(title, Resources.UI_UNITYPLUGIN_WINDOWEDITORCHECKINGRUNTIME, 0.05f))
                throw new InvalidOperationException("Interrupted by user.");

            switch (ToolsRunner.CheckCharon())
            {
                case CharonCheckResult.MissingRuntime:
                    yield return UpdateRuntimeWindow.ShowAsync();
                    break;
                case CharonCheckResult.MissingExecutable:
                    yield return ToolsRunner.UpdateCharonExecutable(ProgressUtils.ReportToLog(Resources.UI_UNITYPLUGIN_MENUCHECKUPDATES));
                    break;
                case CharonCheckResult.Ok:
                    break;
                default:
                    throw new InvalidOperationException("Unknown Tools check result.");
            }

            // EditorUtility.DisplayProgressBar(title, Resources.UI_UNITYPLUGIN_WINDOWEDITORCHECKINGLICENSE, 0.10f);
            //var license = default(LicenseInfo);
            //while (license == null)
            //{
            //	var getLicense = Licenses.GetLicense(scheduleCoroutine: true);
            //	yield return getLicense;
            //	license = getLicense.GetResult();
            //	if (license == null)
            //		yield return LicenseActivationWindow.ShowAsync();
            //}

            var toolsPath = Settings.Current.ToolsPath;
            var port = Settings.Current.ToolsPort;
            var gameDataEditorUrl = "http://localhost:" + port + "/";

            if (string.IsNullOrEmpty(toolsPath) || File.Exists(toolsPath) == false)
                throw new InvalidOperationException("Unable to launch Charon.exe tool because path to it is null or empty.");

            toolsPath = Path.GetFullPath(toolsPath);

            GameDataEditorProcess.EndGracefully();

            if (Settings.Current.Verbose)
                Debug.Log("Starting gamedata editor at " + gameDataEditorUrl + "...");

            if (EditorUtility.DisplayCancelableProgressBar(title, Resources.UI_UNITYPLUGIN_WINDOWEDITORCOPYINGEXECUTABLE, 0.30f))
                throw new InvalidOperationException("Interrupted by user.");
            if (EditorApplication.isCompiling)
                throw new InvalidOperationException("Interrupted by script compiler.");

            // ReSharper disable once AssignNullToNotNullAttribute
            var shadowCopyOfTools = Path.GetFullPath(Path.Combine(ToolsRunner.ToolShadowCopyPath, Path.GetFileName(toolsPath)));
            if (File.Exists(shadowCopyOfTools) == false)
            {
                if (Directory.Exists(ToolsRunner.ToolShadowCopyPath) == false)
                    Directory.CreateDirectory(ToolsRunner.ToolShadowCopyPath);

                if (Settings.Current.Verbose)
                    Debug.Log("Shadow copying tools to " + shadowCopyOfTools + ".");

                File.Copy(toolsPath, shadowCopyOfTools, overwrite: true);

                var configPath = toolsPath + ".config";
                var configShadowPath = shadowCopyOfTools + ".config";
                if (File.Exists(configPath))
                {
                    if (Settings.Current.Verbose)
                        Debug.Log("Shadow copying tools configuration to " + configShadowPath + ".");
                    File.Copy(configPath, configShadowPath);
                }
                else
                {
                    Debug.LogWarning("Missing required configuration file at '" + configPath + "'.");
                }
            }

            if (EditorUtility.DisplayCancelableProgressBar(title, Resources.UI_UNITYPLUGIN_WINDOWEDITORLAUNCHINGEXECUTABLE, 0.60f))
                throw new InvalidOperationException("Interrupted by user.");
            if (EditorApplication.isCompiling)
                throw new InvalidOperationException("Interrupted by script compiler.");

            var toolsProcessTask = ToolsRunner.Run(
                new ToolExecutionOptions
                (
                    shadowCopyOfTools,

                    "LISTEN", Path.GetFullPath(gameDataPath),
                    "--port", port.ToString(),
                    "--parentPid", Process.GetCurrentProcess().Id.ToString(),
                    Settings.Current.Verbose ? "--verbose" : ""
                )
                {
                    RequireDotNetRuntime = true,
                    CaptureStandartError = false,
                    CaptureStandartOutput = false,
                    ExecutionTimeout = TimeSpan.Zero,
                    WaitForExit = false,
//.........这里部分代码省略.........
开发者ID:deniszykov,项目名称:charon-unity3d,代码行数:101,代码来源:GameDataEditorWindow.cs


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