public static string GetInstanceDirectory() { string result = Path.Combine(PathUtility.CommonAppDataPath(String.Empty, VersionModifier.None), Server.DefaultInstanceDirectory); Directory.CreateDirectory(result); return(result); }
public FileStreamProvider() : base() { _path = PathUtility.CommonAppDataPath(Schema.Object.NameFromGuid(Guid.NewGuid())); if (!Directory.Exists(_path)) { Directory.CreateDirectory(_path); } }
public ApplicationForm(bool silentModeSetting) { try { // Deserialize the app settings string fileName = PathUtility.CommonAppDataPath() + ConfigurationUtilitySettingsFileName; if (System.IO.File.Exists(fileName)) { using (System.IO.FileStream stream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { new BOP.Deserializer().Deserialize(stream, _configurationUtilitySettings); } } // We need to do this, because if they uninstall and re-install, the box will be checked // but the registry will not have a value. using (Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(MainForm.AppAutoStartRegKeyName, true)) { if (_configurationUtilitySettings.AppAutoStart == true) { regKey.SetValue(MainForm.AppAutoStartRegValueName, Application.ExecutablePath + " " + Program.SilentMode); } else { regKey.DeleteValue(MainForm.AppAutoStartRegValueName, false); } } _trayIcon.Text = TrayDisplayText; _trayIcon.Visible = _configurationUtilitySettings.ShowTrayIcon; _trayIcon.DoubleClick += new System.EventHandler(this.TrayIcon_DoubleClick); // Set up the context pop-up menu _menu.MenuItems.Add(new MenuItem("Open", new System.EventHandler(this.TrayIcon_DoubleClick))); _menu.MenuItems.Add(new MenuItem("Exit", new System.EventHandler(this.TrayIcon_PopupMenu_Exit))); _trayIcon.ContextMenu = _menu; // Check every n second(s) to see if the service status has been changed by some other program _timer.Tick += new System.EventHandler(this.Timer_Tick); _timer.Interval = ServicePollingInterval; _timer.Start(); if (silentModeSetting == false) { ShowMainForm(); } // Run this once so that when the app starts we don't see the controls enabled for the 1/2 second // until the timer fires. Timer_Tick(this, null); } catch (Exception e) { MessageBox.Show(e.Message); } }
public virtual void ResetInstance() { CheckTestConfiguration(); // Delete the instance directory string LInstanceDirectory = Path.Combine(Path.Combine(PathUtility.CommonAppDataPath(string.Empty, VersionModifier.None), Server.DefaultInstanceDirectory), FTestConfiguration.Name); if (Directory.Exists(LInstanceDirectory)) { Directory.Delete(LInstanceDirectory, true); } }
public void Serialize() { try { using (System.IO.FileStream stream = new System.IO.FileStream(PathUtility.CommonAppDataPath() + ConfigurationUtilitySettingsFileName, System.IO.FileMode.Create, System.IO.FileAccess.Write)) { new BOP.Serializer().Serialize(stream, _configurationUtilitySettings); } } catch (Exception exception) { Application.OnThreadException(exception); } }
private static string GetMachineAliasConfigurationFileName() { return(Path.Combine(PathUtility.CommonAppDataPath(String.Empty, VersionModifier.MajorSpecific), AliasConfigurationFileName)); }
public static string GetNodeConfigurationFileName() { return(Path.Combine(PathUtility.CommonAppDataPath("Coordinator", VersionModifier.None), NodeConfigurationFileName)); }