Example #1
0
        private SystemConfig3 MapConfig2ToConfig3(SystemConfig2 cfg2)
        {
            var cfg3 = new SystemConfig3();

            if (cfg2 != null)
            {
                cfg3.Id = cfg2.Id;

                cfg3.Servers = cfg2.Servers.Select(s => new ServerConfig3()
                {
                    Name                = s.Name,
                    ServiceBus          = s.MessageBus,
                    ServiceBusVersion   = "3", // V2 only NServiceBus3 was available
                    ServiceBusQueueType = s.MessageBusQueueType,
                    MonitorInterval     = s.MonitorInterval,
                    ConnectionSettings  = new Dictionary <string, object> {
                        { "server", s.Name }
                    },
                    MonitorQueues = s.MonitorQueues,

                    CommandsAssemblyPaths = cfg2.CommandsAssemblyPaths,
                    CommandDefinition     = cfg2.CommandDefinition,
                    CommandContentType    = cfg2.CommandContentType
                }).ToList();

                cfg3.ShowOnNewMessages = cfg2.ShowOnNewMessages;

                cfg3.VersionCheck = cfg2.VersionCheck;
                cfg3.StartCount   = cfg2.StartCount;

                cfg3.MonitorServerName = cfg2.MonitorServer;
            }

            return(cfg3);
        }
Example #2
0
        private SystemConfig2 MapConfig1ToConfig2(SystemConfig1 cfg1)
        {
            var cfg2 = new SystemConfig2();

            if (cfg1 != null)
            {
                cfg2.Servers = cfg1.Servers.Select(s => new ServerConfig2()
                {
                    MessageBus          = s.MessageBus,
                    MessageBusQueueType = s.MessageBusQueueType,
                    MonitorInterval     = s.MonitorInterval,
                    Name          = s.Name,
                    MonitorQueues = ConvertMultipleQueueConfigToOne(s.WatchCommandQueues, s.WatchEventQueues, s.WatchMessageQueues, s.WatchErrorQueues)
                }).ToList();

                cfg2.ShowOnNewMessages     = cfg1.ShowOnNewMessages;
                cfg2.CommandsAssemblyPaths = cfg1.CommandsAssemblyPaths;
                cfg2.CommandDefinition     = cfg1.CommandDefinition;

                cfg2.VersionCheck = cfg1.VersionCheck;
                cfg2.StartCount   = cfg1.StartCount;

                cfg2.MonitorServer = cfg1.MonitorServer;
            }

            return(cfg2);
        }
        public CommandHistoryManager(SystemConfig2 config)
        {
            _config = config;

              _itemsFolder = SbmqSystem.AppDataPath + @"\savedCommands\";
              _itemsFile = SbmqSystem.AppDataPath + "savedCommands.dat";

              if( !Directory.Exists(_itemsFolder) )
            Directory.CreateDirectory(_itemsFolder);
        }
Example #4
0
        public SystemConfig3 Create()
        {
            SystemConfig3 cfg = null;

            if (File.Exists(_configFileV3))
            {
                try {
                    cfg = JsonFile.Read <SystemConfig3>(_configFileV3);
                } catch { }
            }
            else if (File.Exists(_configFileV2))
            {
                SystemConfig2 cfg2 = null;
                try {
                    cfg2 = JsonFile.Read <SystemConfig2>(_configFileV2);
                } catch { }

                cfg = MapConfig2ToConfig3(cfg2);
            }
            else if (File.Exists(_configFileV1))
            {
                bool          loaded = false;
                SystemConfig1 cfg1   = null;
                try {
                    cfg1   = JsonFile.Read <SystemConfig1>(_configFileV1);
                    loaded = cfg1.Servers != null;
                } catch { }

                if (!loaded) // Old ConfigFile + Defaults fallback
                {
                    cfg1 = LoadConfig0As1();
                }

                var cfg2 = MapConfig1ToConfig2(cfg1);
                cfg = MapConfig2ToConfig3(cfg2);

                Store(cfg);
            }
            else
            {
                var cfg2 = MapConfig1ToConfig2(LoadConfig0As1());
                cfg = MapConfig2ToConfig3(cfg2);
            }

            return(cfg);
        }
        public ConfigWindow(SbmqSystem system, bool showSendCommand = false)
        {
            InitializeComponent();

              Topmost = SbmqSystem.UIState.AlwaysOnTop;

              _sys = system;
              _config = system.Config;

              _managerTypes = ServiceBusFactory.AvailableServiceBusManagers();

              cbServiceBus.ItemsSource = _managerTypes;
              cbServiceBus.DisplayMemberPath = "Name";
              cbServiceBus.SelectedValuePath = "Name";
              cbServiceBus.SelectedIndex = 0;

              cbTransport.ItemsSource = _managerTypes[0].QueueTypes;

              cbContentFormat.ItemsSource = _managerTypes[0].MessageContentTypes;
              cbContentFormat.SelectedItem = _config.CommandContentType;

              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();
        }
    private SystemConfig2 MapConfig1ToConfig2(SystemConfig1 cfg1) {
      var cfg2 = new SystemConfig2();

      if( cfg1 != null ) {

        cfg2.Servers = cfg1.Servers.Select(s => new ServerConfig2() {
          MessageBus = s.MessageBus,
          MessageBusQueueType = s.MessageBusQueueType,
          MonitorInterval = s.MonitorInterval,
          Name = s.Name,
          MonitorQueues = ConvertMultipleQueueConfigToOne(s.WatchCommandQueues, s.WatchEventQueues, s.WatchMessageQueues, s.WatchErrorQueues)
        }).ToList();

        cfg2.ShowOnNewMessages = cfg1.ShowOnNewMessages;
        cfg2.CommandsAssemblyPaths = cfg1.CommandsAssemblyPaths;
        cfg2.CommandDefinition = cfg1.CommandDefinition;

        cfg2.VersionCheck = cfg1.VersionCheck;
        cfg2.StartCount = cfg1.StartCount;

        cfg2.MonitorServer = cfg1.MonitorServer;
      }

      return cfg2;
    }
    private SystemConfig3 MapConfig2ToConfig3(SystemConfig2 cfg2) {
      var cfg3 = new SystemConfig3();

      if( cfg2 != null ) {

        cfg3.Id = cfg2.Id;

        cfg3.Servers = cfg2.Servers.Select(s => new ServerConfig3() {
          Name = s.Name,
          ServiceBus = s.MessageBus, 
          ServiceBusVersion = "3", // V2 only NServiceBus3 was available
          ServiceBusQueueType = s.MessageBusQueueType,
          MonitorInterval = s.MonitorInterval,
          ConnectionSettings = new Dictionary<string, object> { { "server", s.Name } },
          MonitorQueues = s.MonitorQueues,

          CommandsAssemblyPaths = cfg2.CommandsAssemblyPaths,
          CommandDefinition = cfg2.CommandDefinition,
          CommandContentType = cfg2.CommandContentType

        }).ToList();

        cfg3.ShowOnNewMessages = cfg2.ShowOnNewMessages;

        cfg3.VersionCheck = cfg2.VersionCheck;
        cfg3.StartCount = cfg2.StartCount;

        cfg3.MonitorServerName = cfg2.MonitorServer;
      }

      return cfg3;
    }