當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。