public CommandHistoryManager(SystemConfig1 config) { _config = config; _itemsFolder = SbmqSystem.AppDataPath + @"\savedCommands\"; _itemsFile = SbmqSystem.AppDataPath + "savedCommands.dat"; if( !Directory.Exists(_itemsFolder) ) Directory.CreateDirectory(_itemsFolder); }
public static SystemConfig1 Load() { SystemConfig1 cfg = null; bool loaded = false; if( File.Exists(_configFileV1) ) { try { cfg = JsonFile.Read<SystemConfig1>(_configFileV1); loaded = cfg.Servers != null; } catch { } } if( !loaded ) { // Old ConfigFile + Defaults fallback var appSett = ConfigurationManager.AppSettings; SystemConfig1 c = new SystemConfig1(); c.MonitorServer = !string.IsNullOrEmpty(appSett["server"]) ? appSett["server"] : Environment.MachineName; c.Servers = new List<ServerConfig>(); c.Servers.Add(new ServerConfig() { Name = c.MonitorServer }); c.CurrentServer.MessageBus = appSett["messageBus"] ?? "NServiceBus"; c.CurrentServer.MessageBusQueueType = appSett["messageBusQueueType"] ?? "MSMQ (XML)"; c.CurrentServer.WatchEventQueues = ParseStringList("event.queues"); c.CurrentServer.WatchCommandQueues = ParseStringList("command.queues"); c.CurrentServer.WatchMessageQueues = ParseStringList("message.queues"); c.CurrentServer.WatchErrorQueues = ParseStringList("error.queues"); c.CurrentServer.MonitorInterval = Convert.ToInt32(appSett["interval"] ?? "750"); c.ShowOnNewMessages = Convert.ToBoolean(appSett["showOnNewMessages"] ?? "true"); c.CommandsAssemblyPaths = ParseStringList("commandsAssemblyPath"); cfg = c; } cfg.FillDefaulValues(); return cfg; }
public ConfigWindow(SbmqSystem system, bool showSendCommand = false) { InitializeComponent(); Topmost = SbmqSystem.UIState.AlwaysOnTop; _sys = system; _config = system.Config; _managerTypes = MessageBusFactory.AvailableServiceBusManagers(); cbServiceBus.ItemsSource = _managerTypes; cbServiceBus.DisplayMemberPath = "Name"; cbServiceBus.SelectedValuePath = "Name"; cbTransport.ItemsSource = _managerTypes[0].QueueTypes; cShowOnNewMessages.IsChecked = _config.ShowOnNewMessages; cCheckForNewVer.IsChecked = _config.VersionCheck.Enabled; asmPaths.BindItems(_config.CommandsAssemblyPaths); BindServers(_config.Servers); tbInterval.Init(750, typeof(int), false); SelectServer(_config.MonitorServer); tbServer.Init(string.Empty, typeof(string), false); tbServer.Visibility = System.Windows.Visibility.Hidden; tbNamespace.Init(_config.CommandDefinition.NamespaceContains, typeof(string), true); tbCmdInherits.Text = _config.CommandDefinition.InheritsType; UpdateSendCommandInfo(false); UpdateQueueuInfo(false); if( showSendCommand ) scroller.ScrollToBottom(); }