コード例 #1
0
 private static string GetParameters(UdtRunMode mode)
 {
     switch (mode)
     {
         case UdtRunMode.Log:
             return "-log";
         case UdtRunMode.Preview:
             return "-p";
         case UdtRunMode.Normal:
             return "";
         default:
             throw new NotSupportedException("Not supported run mode.");
     }
 }
コード例 #2
0
        private void UdtRun(string path, bool recursive = false, UdtRunMode mode = UdtRunMode.Normal, string lang = null)
        {
            path = new Uri(GetUnrealDocToolLocation()).MakeRelativeUri(new Uri(path)).ToString();

            if (currentUdtLoggingThread != null && currentUdtLoggingThread.IsAlive)
            {
                MessageBox.Show("Conversion in progress. You have to wait until previous finishes to run another.");
                return;
            }

            if (File.Exists(path) || Directory.Exists(path))
            {
                if (Directory.Exists(path) && recursive)
                {
                    path += "*";
                }

                // Relative path to UnrealDocTool, same folder.
                var startInfo = new ProcessStartInfo(GetUnrealDocToolLocation(),
                    String.Format("\"{0}\" " + GetParameters(mode), path) + (lang != null ? (" -lang=" + lang) : ""))
                                    {
                                        UseShellExecute = false,
                                        CreateNoWindow = true,
                                        RedirectStandardOutput = true,
                                        RedirectStandardError = true
                                    };

                var unrealDocToolProcess = Process.Start(startInfo);

                currentUdtLoggingThread = RunLoggingThread(unrealDocToolProcess);
            }
            else
            {
                log.Error(string.Format("Unable to convert, file is missing please translate first: {0}", path));
            }
        }