Example #1
0
        public static string GetStudioMdlPath()
        {
            if (ProjectUtils.IsProjectLoaded())
            {
                return(string.Format("{0}\\studiomdl.exe", ProjectUtils.GetStudioModelPath()));
            }

            return(null);
        }
Example #2
0
        public static string GetVMTPath()
        {
            string path = Properties.Settings.Default.lastVMTPath;

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

            return(path);
        }
Example #3
0
        public static bool CreateCompileLog(string mdlName, string log, string directoryStructure)
        {
            if (!ProjectUtils.IsProjectLoaded())
            {
                return(false);
            }

            string logFile = string.Format("{0}\\logs{1}\\{2}.txt", ProjectUtils.GetProjectDirectory(), directoryStructure, Path.GetFileNameWithoutExtension(mdlName));

            Directory.CreateDirectory(Path.GetDirectoryName(logFile));
            File.WriteAllText(logFile, log);
            return(true);
        }
Example #4
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);
        }