Example #1
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);
        }
Example #2
0
        public CompileThread(string path)
        {
            _path               = path;
            _log                = null;
            _mdlName            = "";
            _directoryStructure = (Path.GetDirectoryName(path).Replace(ProjectUtils.GetProjectDirectory(), ""));

            string   content = "";
            QCParser qcFile  = new QCParser(_path);

            if (qcFile.ParseQCFile())
            {
                content  = qcFile.GetQCContent();
                _mdlName = qcFile.GetQCParamValue("$modelname");
                if (string.IsNullOrEmpty(_mdlName))
                {
                    _mdlName = Path.GetFileName(path);
                }
            }

            _path = string.Format("{0}\\temp\\compile.qc", ProjectUtils.GetProjectDirectory());
            File.WriteAllText(_path, content);
        }