static DI() { //Apply .NET Network Connection hack O2Kernel_Web.ApplyNetworkConnectionHack(); // all these variables need to be setup appDomainsControledByO2Kernel = new Dictionary <string, O2AppDomainFactory>(); log = new KO2Log(); reflection = new KReflection(); o2MessageQueue = KO2MessageQueue.getO2KernelQueue(); // before we load the O2Config data (which is loaded from the local disk) config = O2ConfigLoader.getKO2Config(); //make sure theses values are set (could be a prob due to changed location of these values) if (config.LocalScriptsFolder == null) { config.LocalScriptsFolder = KO2Config.defaultLocalScriptFolder; config.SvnO2RootFolder = KO2Config.defaultSvnO2RootFolder; config.SvnO2DatabaseRulesFolder = KO2Config.defaultSvnO2DatabaseRulesFolder; } O2KernelProcessName = "Generic O2 Kernel Process";; AppDomainUtils.registerCurrentAppDomain(); }
private void saveMainO2ConfigFile() { Files.WriteFileContent(O2ConfigLoader.defaultLocationOfO2ConfigFile(), (string)tbMainO2ConfigFile.Text); var kO2Config = O2ConfigLoader.getKO2Config(); // get the updated KO2Config object O2ConfigLoader.mergeO2ConfigFiles(kO2Config, DI.config); // and merge it with the current one loadCurrentO2ConfigEnvironment(); }
private void createLocalO2ConfigFile() { var targetFile = tbLocationOfLocalO2ConfigFile.Text; var targetDirectory = Path.GetDirectoryName(targetFile); Files.checkIfDirectoryExistsAndCreateIfNot(targetDirectory); O2ConfigLoader.createOrSetLocalConfigFile(targetFile); loadCurrentO2ConfigEnvironment(); }
private void saveLocalO2ConfigFile(string localO2ConfigFileLocation, string localO2ConfigFileContent) { if (false == doesTextBreaksO2ConfigSchema(localO2ConfigFileContent)) { Files.WriteFileContent(localO2ConfigFileLocation, localO2ConfigFileContent); DI.config.dependenciesInjection.Clear(); // hack to handle reload of new config O2ConfigLoader.mergeO2ConfigFiles(O2ConfigLoader.loadO2Config(localO2ConfigFileLocation, false), DI.config); loadCurrentO2ConfigEnvironment(); } }
private void loadCurrentO2ConfigEnvironment() { try { // load main config file details lbLocationOfLocalConfigFile.Text = O2ConfigLoader.defaultLocationOfO2ConfigFile(); tbMainO2ConfigFile.Text = Files.getFileContents(O2ConfigLoader.defaultLocationOfO2ConfigFile()); webBrowserMainO2ConfigFile.Navigate(O2ConfigLoader.defaultLocationOfO2ConfigFile()); // load local O2 config file details if (false == File.Exists(DI.config.O2ConfigFile)) { DI.log.error("in loadCurrentO2ConfigEnvironment, could not find main O2 Config file: {0}", DI.config.O2ConfigFile); tbLocationOfLocalO2ConfigFile.Text = DI.config.O2ConfigFile; } else { if (DI.config.O2ConfigFile == O2ConfigLoader.defaultLocationOfO2ConfigFile()) { var parentDirectoryOfCurrentO2TempDir = Path.GetFullPath(Path.Combine(DI.config.O2TempDir, "..")); // means there is no Local O2 Config file defined tbLocationOfLocalO2ConfigFile.Text = Path.Combine( (Directory.Exists(parentDirectoryOfCurrentO2TempDir) ? parentDirectoryOfCurrentO2TempDir + "\\_local_O2_data" : DI.config.O2TempDir) , Environment.MachineName + "o2.config"); } else { tbLocationOfLocalO2ConfigFile.Text = DI.config.O2ConfigFile; tbLocalO2ConfigFile.Text = Files.getFileContents(DI.config.O2ConfigFile); btSaveLocalConfigFile.Enabled = true; } } } catch (Exception ex) { DI.log.error("in loadCurrentO2ConfigEnvironment: {0}", ex.Message); } }
private void btRestoreToDefaultValues_Click(object sender, EventArgs e) { O2ConfigLoader.createDefaultO2ConfigFile(); }