Ejemplo n.º 1
0
        private static async Task <Tuple <int, string> > ExecuteProcess(TextDataConfig.GenerateAssetSetting setting, Mode mode, bool displayConsole)
        {
            var config = TextDataConfig.Instance;

            var arguments = new StringBuilder();

            arguments.AppendFormat("--workspace {0} ", setting.GetTextDataWorkspacePath());

            switch (mode)
            {
            case Mode.Import:
                arguments.Append("--mode import ");
                break;

            case Mode.Export:
                arguments.Append("--mode export ");
                break;
            }

            var processExecute = new ProcessExecute(config.ConverterPath, arguments.ToString())
            {
                Encoding         = Encoding.GetEncoding("Shift_JIS"),
                WorkingDirectory = setting.GetTextDataWorkspacePath(),
                UseShellExecute  = displayConsole,
                Hide             = !displayConsole,
            };

            var result = await processExecute.StartAsync();

            return(Tuple.Create(result.ExitCode, result.Error));
        }
Ejemplo n.º 2
0
        private IEnumerator FindDotnet()
        {
            if (isDotnetInstalled)
            {
                yield break;
            }

            dotnetVersion = string.Empty;

            var processTitle   = "MessagePackConfig";
            var processMessage = "Find .NET Core SDK";

            EditorUtility.DisplayProgressBar(processTitle, processMessage, 0f);

            Tuple <bool, string> result = null;

            var commandLineProcess = new ProcessExecute("dotnet", "--version");

            var findYield = commandLineProcess.StartAsync().ToObservable()
                            .Do(x => result        = Tuple.Create(true, x.Output))
                            .DoOnError(x => result = Tuple.Create(false, (string)null))
                            .Select(_ => result)
                            .ToYieldInstruction();

            while (!findYield.IsDone)
            {
                yield return(null);
            }

            if (findYield.HasResult)
            {
                dotnetVersion = findYield.Result.Item2;

                isDotnetInstalled = findYield.Result.Item1 && !string.IsNullOrEmpty(dotnetVersion);
            }

            if (string.IsNullOrEmpty(dotnetVersion))
            {
                Debug.LogError("Failed get .NET Core SDK version.");
            }

            EditorUtility.DisplayProgressBar(processTitle, processMessage, 1f);

            Repaint();

            EditorApplication.delayCall += EditorUtility.ClearProgressBar;
        }
Ejemplo n.º 3
0
        public static async Task <string> GetCommitHash()
        {
            var masterConfig = MasterConfig.Instance;

            if (string.IsNullOrEmpty(masterConfig.SourceDirectory))
            {
                return(null);
            }

            var processExecute = new ProcessExecute("git", "log --pretty=%H -n 1")
            {
                WorkingDirectory = masterConfig.SourceDirectory,
            };

            var result = await processExecute.StartAsync();

            if (string.IsNullOrEmpty(result.Output))
            {
                return(null);
            }

            // 改行コードを削除.
            return(result.Output.Replace("\r", "").Replace("\n", ""));
        }