private void ctrlBtnEventNew_Click(object sender, RoutedEventArgs e) { ClusterEventWindow Wnd = new ClusterEventWindow(); Wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; Wnd.Owner = this; Wnd.AvailableCategories = GetAvailableCategories(); Wnd.AvailableTypes = GetAvailableTypes(); Wnd.AvailableNames = GetAvailableNames(); bool?RetVal = Wnd.ShowDialog(); if (RetVal.HasValue && RetVal == true) { Dictionary <string, string> ArgMap = new Dictionary <string, string>(); ClusterEvent NewEvt = new ClusterEvent(Wnd.SelectedCategory, Wnd.SelectedType, Wnd.SelectedName, Wnd.GetArgDictionary()); NewEvt.RebuildJsonStringForGui(); ClusterEvents.Add(NewEvt); RegistrySaver.AddRegistryValue(RegistrySaver.RegCategoryClusterEvents, NewEvt.SerializeToString()); AppLogger.Log("New cluster event stored: " + NewEvt.ToString()); } else { // Nothing to do } }
private void InitializeOptions() { try { SelectedRenderApiParam = RenderApiParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.RegParamsList, RegistrySaver.RegRenderApiName)); } catch (Exception) { SelectedRenderApiParam = RenderApiParams.SingleOrDefault(x => x.Key == "OpenGL3"); } try { SelectedRenderModeParam = RenderModeParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.RegParamsList, RegistrySaver.RegRenderModeName)); } catch (Exception) { SelectedRenderApiParam = RenderModeParams.SingleOrDefault(x => x.Key == "Mono"); } CustomCommonParams = RegistrySaver.ReadStringValue(RegistrySaver.RegParamsList, RegistrySaver.RegAdditionalParamsName); IsUseAllCores = RegistrySaver.ReadBoolValue(RegistrySaver.RegParamsList, RegistrySaver.RegIsAllCoresName); IsNotextureStreaming = RegistrySaver.ReadBoolValue(RegistrySaver.RegParamsList, RegistrySaver.RegIsNoTextureStreamingName); AppLogger.Add("Application Options initialized"); }
private void InitializeTabLaunch() { try { SelectedRenderApiParam = RenderApiParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryParamsList, RegistrySaver.RegParamsRenderApiName)); } catch (Exception) { SelectedRenderApiParam = RenderApiParams.SingleOrDefault(x => x.Key == "DirectX 11"); } try { SelectedRenderModeParam = RenderModeParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryParamsList, RegistrySaver.RegParamsRenderModeName)); } catch (Exception) { SelectedRenderApiParam = RenderModeParams.SingleOrDefault(x => x.Key == "Mono"); } CustomCommonParams = RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryParamsList, RegistrySaver.RegParamsAdditionalParamsName); IsUseAllCores = RegistrySaver.ReadBoolValue(RegistrySaver.RegCategoryParamsList, RegistrySaver.RegParamsIsAllCoresName); IsNotextureStreaming = RegistrySaver.ReadBoolValue(RegistrySaver.RegCategoryParamsList, RegistrySaver.RegParamsIsNoTexStreamingName); Applications = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.RegCategoryAppList); SetSelectedApp(); Configs = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.RegCategoryConfigList); SetSelectedConfig(); }
public void DeleteConfig() { configs.Remove(selectedConfig); RegistrySaver.RemoveRegistryValue(RegistrySaver.configList, selectedConfig); AppLogger.Add("Configuration file [" + selectedConfig + "] deleted"); selectedConfig = configs.FirstOrDefault(); }
public void DeleteConfig() { Configs.Remove(SelectedConfig); RegistrySaver.RemoveRegistryValue(RegistrySaver.RegCategoryConfigList, SelectedConfig); AppLogger.Log("Configuration file [" + SelectedConfig + "] deleted"); SelectedConfig = Configs.FirstOrDefault(); }
public void DeleteApplication() { Applications.Remove(SelectedApplication); RegistrySaver.RemoveRegistryValue(RegistrySaver.RegAppList, SelectedApplication); AppLogger.Add("Application [" + SelectedApplication + "] deleted"); SelectedApplication = null; }
public void DeleteApplication() { applications.Remove(selectedApplication); RegistrySaver.RemoveRegistryValue(RegistrySaver.appList, selectedApplication); AppLogger.Add("Application [" + selectedApplication + "] deleted"); selectedApplication = null; }
public void DeleteApplication() { Applications.Remove(SelectedApplication); RegistrySaver.RemoveRegistryValue(RegistrySaver.RegCategoryAppList, SelectedApplication); AppLogger.Log("Application [" + SelectedApplication + "] removed from the list"); SelectedApplication = null; }
public void SetSelectedConfig() { SelectedConfig = string.Empty; string selected = RegistrySaver.FindSelectedRegValue(RegistrySaver.RegCategoryConfigList); if (!string.IsNullOrEmpty(selected)) { SelectedConfig = Configs.Find(x => x == selected); } }
private void SetSelectedApp() { SelectedApplication = string.Empty; string selected = RegistrySaver.FindSelectedRegValue(RegistrySaver.RegCategoryAppList); if (!string.IsNullOrEmpty(selected)) { SelectedApplication = Applications.Find(x => x == selected); } }
//Reloading all config lists private void InitializeConfigLists() { Applications = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.RegAppList); SetSelectedApp(); AppLogger.Add("Applications loaded successfully"); Configs = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.RegConfigList); SetSelectedConfig(); AppLogger.Add("Configs loaded successfully"); AppLogger.Add("List of Active nodes loaded successfully"); }
void CreateConfig() { RegistrySaver.RemoveAllRegistryValues(RegistrySaver.RegConfigName); CurrentConfig = new VRConfig(); this.DataContext = CurrentConfig; //crutch. for refactoring CurrentConfig.selectedSceneNodeView = null; //AppLogger.Add("New config initialized"); UpdateTitle(); }
void CreateConfig() { RegistrySaver.RemoveAllRegistryValues(RegistrySaver.configName); currentConfig = new VRConfig(); this.DataContext = currentConfig; //crutch. for refactoring currentConfig.selectedSceneNodeView = null; AppLogger.Add("New config initialized"); SetTitle(); SetViewportPreview(); }
private static void Main(string[] args) { if (args.Length != 2) { return; } var registrySaver = new RegistrySaver(args[0], args[1]); registrySaver.SaveToRegistry(); }
private void SetDefaultConfig() { string configPath = RegistrySaver.ReadStringFromRegistry(RegistrySaver.RegConfigName); if (string.IsNullOrEmpty(configPath)) { CreateConfig(); } else { ConfigFileParser(configPath); } }
public void AddApplication(string appPath) { if (!Applications.Contains(appPath)) { Applications.Add(appPath); RegistrySaver.AddRegistryValue(RegistrySaver.RegCategoryAppList, appPath); AppLogger.Log("Application [" + appPath + "] added to list"); } else { AppLogger.Log("WARNING! Application [" + appPath + "] is already in the list"); } }
private void Save(bool isSaveAs) { //TEMP: only launcher tab is available return; if (currentConfig.Validate()) { try { string currentFileName = RegistrySaver.ReadStringFromRegistry(RegistrySaver.configName); if (!isSaveAs && File.Exists(currentFileName)) { File.WriteAllText(currentFileName, currentConfig.CreateConfig()); } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = configFileExtention; if (saveFileDialog.ShowDialog() == true) { currentFileName = saveFileDialog.FileName; currentConfig.name = Path.GetFileNameWithoutExtension(currentFileName); RegistrySaver.RemoveAllRegistryValues(RegistrySaver.configName); RegistrySaver.AddRegistryValue(RegistrySaver.configName, currentFileName); File.WriteAllText(currentFileName, currentConfig.CreateConfig()); } } SetTitle(); AppLogger.Add("Config saved to " + currentFileName); } catch (Exception exception) { InfoDialog errorDialog = new InfoDialog("Error! \nCan not save configuration file. \nSee exception message in Log"); errorDialog.Owner = this; errorDialog.Width = 350; errorDialog.Height = 200; errorDialog.Show(); AppLogger.Add("ERROR! Can not save config to file. EXCEPTION: " + exception.Message); } } else { InfoDialog errorDialog = new InfoDialog("Error! \nCan not save configuration file. \nWrong config. See errors in Log"); errorDialog.Owner = this; errorDialog.Width = 350; errorDialog.Height = 200; errorDialog.Show(); AppLogger.Add("ERROR! Can not save config to file. Errors in configuration"); } }
public void AddConfig(string configPath) { try { Configs.Add(configPath); SelectedConfig = Configs.Find(x => x == configPath); RegistrySaver.AddRegistryValue(RegistrySaver.RegCategoryConfigList, configPath); ChangeConfigSelection(configPath); AppLogger.Log("Configuration file [" + configPath + "] added to list"); } catch (Exception) { AppLogger.Log("ERROR! Can not add configuration file [" + configPath + "] to list"); } }
private void ctrlBtnEventDelete_Click(object sender, RoutedEventArgs e) { if (ctrlListClusterEvents.SelectedItems.Count > 0) { List <ClusterEvent> ItemsToDelete = new List <ClusterEvent>(); foreach (ClusterEvent Evt in ctrlListClusterEvents.SelectedItems) { ItemsToDelete.Add(Evt); } foreach (ClusterEvent Evt in ItemsToDelete) { ClusterEvents.Remove(Evt); RegistrySaver.RemoveRegistryValue(RegistrySaver.RegCategoryClusterEvents, Evt.SerializeToString()); } } }
//Reloading all config lists private void InitConfigLists() { applications = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.appList); AppLogger.Add("Applications loaded successfully"); configs = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.configList); SetSelectedConfig(); AppLogger.Add("Configs loaded successfully"); AppLogger.Add("List of Active nodes loaded successfully"); try { selectedCamera = cameras.First(x => x == RegistrySaver.ReadStringValue(RegistrySaver.paramsList, RegistrySaver.curCamera)); } catch (Exception) { selectedCamera = cameras.SingleOrDefault(x => x == "camera_dynamic"); } }
private void InitializeEvents() { List <string> SavedEvents = RegistrySaver.ReadStringsFromRegistry(RegistrySaver.RegCategoryClusterEvents); foreach (string SavedEventStr in SavedEvents) { ClusterEvent RestoredEvent = new ClusterEvent(); RestoredEvent.DeserializeFromString(SavedEventStr); ClusterEvents.Add(RestoredEvent); } ctrlListClusterEvents.ItemsSource = ClusterEvents; CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ctrlListClusterEvents.ItemsSource); view.SortDescriptions.Add(new SortDescription("Category", ListSortDirection.Ascending)); view.SortDescriptions.Add(new SortDescription("Type", ListSortDirection.Ascending)); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); }
private void ctrlBtnEventModify_Click(object sender, RoutedEventArgs e) { if (ctrlListClusterEvents.SelectedItems.Count > 0) { List <ClusterEvent> ItemsToModify = new List <ClusterEvent>(); foreach (ClusterEvent Evt in ctrlListClusterEvents.SelectedItems) { ItemsToModify.Add(Evt); } foreach (ClusterEvent Evt in ItemsToModify) { int Idx = ClusterEvents.IndexOf(Evt); if (Idx >= 0) { ClusterEventWindow Wnd = new ClusterEventWindow(); Wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner; Wnd.Owner = this; Wnd.AvailableCategories = GetAvailableCategories(); Wnd.AvailableTypes = GetAvailableTypes(); Wnd.AvailableNames = GetAvailableNames(); Wnd.SelectedCategory = Evt.Category; Wnd.SelectedType = Evt.Type; Wnd.SelectedName = Evt.Name; Wnd.SetArgDictionary(Evt.Parameters); bool?RetVal = Wnd.ShowDialog(); if (RetVal.HasValue && RetVal == true) { RegistrySaver.RemoveRegistryValue(RegistrySaver.RegCategoryClusterEvents, ClusterEvents[Idx].SerializeToString()); ClusterEvents[Idx] = new ClusterEvent(Wnd.SelectedCategory, Wnd.SelectedType, Wnd.SelectedName, Wnd.GetArgDictionary()); RegistrySaver.AddRegistryValue(RegistrySaver.RegCategoryClusterEvents, ClusterEvents[Idx].SerializeToString()); } } } UpdateJsonInfo(); } }
public void ChangeConfigSelection(string configPath) { try { foreach (string config in Configs) { if (config != configPath) { RegistrySaver.UpdateRegistry(RegistrySaver.RegCategoryConfigList, config, false); } else { RegistrySaver.UpdateRegistry(RegistrySaver.RegCategoryConfigList, config, true); } } } catch (Exception exception) { AppLogger.Log("ERROR while changing config selection. EXCEPTION: " + exception.Message); } }
private void InitializeTabLog() { try { IsCustomLogsUsed = RegistrySaver.ReadBoolValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsUseCustomLogs); SelectedVerbocityPlugin = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityPlugin), UE4LogVerbosity.Log); SelectedVerbocityEngine = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityEngine), UE4LogVerbosity.Log); SelectedVerbocityConfig = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityConfig), UE4LogVerbosity.Log); SelectedVerbocityCluster = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityCluster), UE4LogVerbosity.Log); SelectedVerbocityGame = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityGame), UE4LogVerbosity.Log); SelectedVerbocityGameMode = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityGameMode), UE4LogVerbosity.Log); SelectedVerbocityInput = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityInput), UE4LogVerbosity.Log); SelectedVerbocityVrpn = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityInputVrpn), UE4LogVerbosity.Log); SelectedVerbocityNetwork = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityNetwork), UE4LogVerbosity.Log); SelectedVerbocityNetworkMsg = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityNetworkMsg), UE4LogVerbosity.Log); SelectedVerbocityBlueprint = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityBlueprint), UE4LogVerbosity.Log); SelectedVerbocityRender = UE4LogVerbosity_FromString(RegistrySaver.ReadStringValue(RegistrySaver.RegCategoryLogParams, RegistrySaver.RegLogParamsVerbosityRender), UE4LogVerbosity.Log); } catch (Exception ex) { AppLogger.Log(ex.Message); } }
private void InitOptions() { try { selectedCamera = cameras.First(x => x == RegistrySaver.ReadStringValue(RegistrySaver.paramsList, RegistrySaver.curCamera)); } catch (Exception) { selectedCamera = cameras.SingleOrDefault(x => x == "camera_dynamic"); } try { selectedRenderApiParam = renderApiParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.paramsList, RegistrySaver.renderApiName)); } catch (Exception) { selectedRenderApiParam = renderApiParams.SingleOrDefault(x => x.Key == "OpenGL3"); } try { selectedRenderModeParam = renderModeParams.First(x => x.Key == RegistrySaver.ReadStringValue(RegistrySaver.paramsList, RegistrySaver.renderModeName)); } catch (Exception) { selectedRenderApiParam = renderModeParams.SingleOrDefault(x => x.Key == "Mono"); } additionalParams = RegistrySaver.ReadStringValue(RegistrySaver.paramsList, RegistrySaver.additionalParamsName); isUseAllCores = RegistrySaver.ReadBoolValue(RegistrySaver.paramsList, RegistrySaver.isAllCoresName); isFixedSeed = RegistrySaver.ReadBoolValue(RegistrySaver.paramsList, RegistrySaver.isFixedSeedName); isNotextureStreaming = RegistrySaver.ReadBoolValue(RegistrySaver.paramsList, RegistrySaver.isNoTextureStreamingName); AppLogger.Add("Application Options initialized"); }
//Config file parser public static VRConfig Parse(string filePath, VRConfig currentConfig) { // refactoring needed List <string> inputLines = new List <string>(); List <string> sceneNodeLines = new List <string>(); List <string> screenLines = new List <string>(); List <string> viewportLines = new List <string>(); List <string> clusterNodeLines = new List <string>(); List <string> cameraLines = new List <string>(); List <string> generalLines = new List <string>(); List <string> stereoLines = new List <string>(); List <string> debugLines = new List <string>(); try { foreach (string line in File.ReadLines(filePath)) { if (line == string.Empty || line.First() == '#') { //Do nothing } else { if (line.ToLower().Contains("[input]")) { inputLines.Add(line); } if (line.ToLower().Contains("[scene_node]")) { sceneNodeLines.Add(line); } if (line.ToLower().Contains("[screen]")) { screenLines.Add(line); } if (line.ToLower().Contains("[viewport]")) { viewportLines.Add(line); } if (line.ToLower().Contains("[cluster_node]")) { clusterNodeLines.Add(line); } if (line.ToLower().Contains("[camera]")) { cameraLines.Add(line); } if (line.ToLower().Contains("[general]")) { generalLines.Add(line); } if (line.ToLower().Contains("[stereo]")) { stereoLines.Add(line); } if (line.ToLower().Contains("[debug]")) { debugLines.Add(line); } if (line.ToLower().Contains("[render]")) { //todo } if (line.ToLower().Contains("[custom]")) { //todo } } } foreach (string line in viewportLines) { currentConfig.ViewportParse(line); } foreach (string line in generalLines) { currentConfig.GeneralParse(line); } foreach (string line in stereoLines) { currentConfig.StereoParse(line); } foreach (string line in debugLines) { currentConfig.DebugParse(line); } foreach (string line in inputLines) { currentConfig.InputsParse(line); } foreach (string line in cameraLines) { currentConfig.CameraParse(line); } foreach (string line in sceneNodeLines) { currentConfig.SceneNodeParse(line); } foreach (string line in screenLines) { currentConfig.ScreenParse(line); } foreach (string line in clusterNodeLines) { currentConfig.ClusterNodeParse(line); } currentConfig.sceneNodesView = currentConfig.ConvertSceneNodeList(currentConfig.sceneNodes); currentConfig.name = Path.GetFileNameWithoutExtension(filePath); AppLogger.Add("Config " + currentConfig.name + " loaded"); RegistrySaver.AddRegistryValue(RegistrySaver.configName, filePath); } catch (FileNotFoundException) { AppLogger.Add("ERROR! Config " + currentConfig.name + "not found!"); } catch (System.ArgumentException) { AppLogger.Add("ERROR! Config " + currentConfig.name + "not found!"); } return(currentConfig); }