private static void IterateFileData(Filter filter, KeyValues data) { for (int i = 0; i < data.GetItems().Count(); i++) { filter.AddFile(data.GetItems()[i].key, data.GetItems()[i].value); } for (KeyValues sub = data.GetFirstKey(); sub != null; sub = data.GetNextKey()) { Filter newSub = filter.AddSubFilter(sub.GetName()); IterateFileData(newSub, sub); } }
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); }
public void PrintCommandInEditor() { string commandChosen = null; if (itemList.SelectedItem != null) { commandChosen = itemList.SelectedItem.ToString(); } if (!string.IsNullOrEmpty(commandChosen)) { string template = null; for (int i = 0; i < _pkvData.GetItems().Count(); i++) { if (_pkvData.GetItems()[i].key == commandChosen) { template = _pkvData.GetItems()[i].value; break; } } int length = 0; Clipboard.Clear(); if (!string.IsNullOrEmpty(template)) { _qcEditor.SelectedText = template; _qcEditor.Paste(); length = template.Length; } else { _qcEditor.SelectedText = commandChosen; _qcEditor.Paste(); length = commandChosen.Length; } _qcEditor.SelectionStart = _qcEditor.GetLastSelectionStart() + length; } CloseCommandList(); }