示例#1
0
        public static bool OpenProject(string path)
        {
            // Is there a project up already?
            if (!string.IsNullOrEmpty(_pszActiveProjectPath))
            {
                CloseProject();
            }

            Properties.Settings.Default.lastProjectPath = Path.GetDirectoryName(path);
            Properties.Settings.Default.Save();

            _pszActiveProjectPath = path;
            CreateEnvironment();

            bool      bLoaded        = false;
            KeyValues pkvProjectFile = new KeyValues();

            if (pkvProjectFile.LoadFromFile(_pszActiveProjectPath))
            {
                bLoaded = true;

                _projectName        = pkvProjectFile.GetName();
                _pszGameInfoPath    = pkvProjectFile.GetString("GameInfoPath");
                _pszStudioModelPath = pkvProjectFile.GetString("StudioModelPath");

                KeyValues pkvFileData = pkvProjectFile.FindSubKey("Files");
                if (pkvFileData != null)
                {
                    _projectFilters = new Filter(_projectName);
                    IterateFileData(_projectFilters, pkvFileData);
                }
            }

            pkvProjectFile.Dispose();
            pkvProjectFile = null;

            SharedEvents.OpenedProject();
            return(bLoaded);
        }
示例#2
0
        public VMTGeneratorToolWizard()
        {
            InitializeComponent();

            comboBoxShaderList.Items.Clear();
            checkListParams.Items.Clear();

            string    filePath = string.Format("{0}\\config\\shader_params.txt", Globals.GetAppPath());
            KeyValues pkvData  = new KeyValues();

            if (pkvData.LoadFromFile(filePath))
            {
                for (int i = 0; i < pkvData.GetItems().Count(); i++)
                {
                    comboBoxShaderList.Items.Add(pkvData.GetItems()[i].value);
                }

                if (comboBoxShaderList.Items.Count > 0)
                {
                    comboBoxShaderList.SelectedIndex = 0;
                }
            }
            pkvData.Dispose();

            filePath = string.Format("{0}\\config\\material_params.txt", Globals.GetAppPath());
            pkvData  = new KeyValues();
            if (pkvData.LoadFromFile(filePath))
            {
                for (int i = 0; i < pkvData.GetItems().Count(); i++)
                {
                    checkListParams.Items.Add(pkvData.GetItems()[i].value);
                }
            }

            pkvData.Dispose();
            pkvData = null;

            AddFrameButtonOffset(0, 0);
        }
示例#3
0
        public void ShowCommandList()
        {
            Visible = true;
            itemList.Items.Clear();
            textSearch.Text = null;

            string commandFile = string.Format("{0}\\config\\commands.txt", Globals.GetAppPath());

            if (!File.Exists(commandFile))
            {
                return;
            }

            _pkvData = new KeyValues();
            if (!_pkvData.LoadFromFile(commandFile))
            {
                CloseCommandList();
            }
            else
            {
                AddCommands();
            }
        }