Пример #1
0
        public void Compile()
        {
            string _args     = CompilerUtils._compileArgs;
            string arguments = string.Format("-game \"{0}\" \"{1}\"", ProjectUtils.GetGameInfoPath(), _path);

            if (!string.IsNullOrEmpty(_args))
            {
                arguments = string.Format("-game \"{0}\" {1} \"{2}\"", ProjectUtils.GetGameInfoPath(), _args, _path);
            }

            Process procLaunchStudioMdl = new Process();

            procLaunchStudioMdl.StartInfo.Arguments              = arguments;
            procLaunchStudioMdl.StartInfo.CreateNoWindow         = true;
            procLaunchStudioMdl.StartInfo.FileName               = CompilerUtils.GetStudioMdlPath();
            procLaunchStudioMdl.StartInfo.UseShellExecute        = false;
            procLaunchStudioMdl.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            procLaunchStudioMdl.StartInfo.RedirectStandardOutput = true;
            procLaunchStudioMdl.Start();

            while (!procLaunchStudioMdl.StandardOutput.EndOfStream && CompilerUtils.IsCompiling())
            {
                string line = procLaunchStudioMdl.StandardOutput.ReadLine();

                Globals.compileLog.Invoke(new Action(() => Globals.compileLog.Text += (line + Environment.NewLine)));
                _log += (line + Environment.NewLine);
            }

            LoggingUtils.CreateCompileLog(_mdlName, _log, _directoryStructure);
            CompilerUtils.ProcessQCFile();
        }
Пример #2
0
        public static string GetVMTPath()
        {
            string path = Properties.Settings.Default.lastVMTPath;

            if (string.IsNullOrEmpty(path) && ProjectUtils.IsProjectLoaded())
            {
                return(ProjectUtils.GetGameInfoPath());
            }

            return(path);
        }
Пример #3
0
        public static bool OpenModelInHLMV(string path)
        {
            if (string.IsNullOrEmpty(path) || !ProjectUtils.IsProjectLoaded())
            {
                return(false);
            }

            if (!File.Exists(path))
            {
                return(false);
            }

            QCParser qcInfo = new QCParser(path);

            if (qcInfo.ParseQCFile())
            {
                string modelPath = string.Format("{0}\\models\\{1}", ProjectUtils.GetGameInfoPath(), qcInfo.GetQCParamValue("$modelname"));
                if (File.Exists(modelPath))
                {
                    string hlmv = string.Format("{0}\\hlmv.exe", ProjectUtils.GetStudioModelPath());
                    if (File.Exists(hlmv))
                    {
                        using (Process procLaunchHLMV = new Process())
                        {
                            procLaunchHLMV.StartInfo.Arguments              = string.Format("-game \"{0}\" \"{1}\"", ProjectUtils.GetGameInfoPath(), modelPath);
                            procLaunchHLMV.StartInfo.CreateNoWindow         = true;
                            procLaunchHLMV.StartInfo.FileName               = hlmv;
                            procLaunchHLMV.StartInfo.UseShellExecute        = false;
                            procLaunchHLMV.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
                            procLaunchHLMV.StartInfo.RedirectStandardOutput = true;
                            procLaunchHLMV.Start();
                        }
                        return(true);
                    }
                }
            }

            return(false);
        }