Load() static private method

static private Load ( ) : SettingsContainer,
return SettingsContainer,
Exemplo n.º 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Text = @"RocketBot v" + Application.ProductVersion;

            //User activity tracking, help us get more information to make RocketBot better
            //Everything is anonymous
            Analytics.Initialize("UzL1tnZa9Yw2qcJWRIbcwGFmWGuovXez");
            Analytics.Client.Identify(MachineIdHelper.GetMachineId(), new Traits());
            Analytics.Client.Track(MachineIdHelper.GetMachineId(), "App started");

            speedLable.Parent            = gMapControl1;
            showMoreCheckBox.Parent      = gMapControl1;
            followTrainerCheckBox.Parent = gMapControl1;
            togglePrecalRoute.Parent     = gMapControl1;

            InitializeBot();
            InitializePokemonForm();
            InitializeMap();
            CheckVersion();
            if (BoolNeedsSetup)
            {
                //startStopBotToolStripMenuItem.Enabled = false;
                Logger.Write("First time here? Go to settings to set your basic info.");
                GlobalSettings.Load("");
            }
        }
Exemplo n.º 2
0
        public void Build(BuildOptions options)
        {
            if (IsBuilding)
            {
                return;
            }

            _globalSettings = GlobalSettings.Load(_output);
            var settings = new Settings(_globalSettings, options, _output);

            if (options.CleanCache)
            {
                CacheCleaner.Run(settings);
                return;
            }

            lock (_lock)
            {
                _processLauncher     = new ProcessLauncher(settings);
                _lastBuildWasStopped = false;
                _isBeingStopped      = false;
                _buildThread         = new Thread(() => BuildThread(settings))
                {
                    IsBackground = true
                };
                _buildThread.Start();
            }
        }
Exemplo n.º 3
0
        private int Run(string[] args)
        {
            _output = new ConsoleOutput();

            try
            {
                BuildOptions options = ParseBuildOptions(args);
                if (options == null || options.Solution == null)
                {
                    return(1);
                }

                GlobalSettings globalSettings = GlobalSettings.Load(_output);
                globalSettings.Save();
                var settings = new Settings(globalSettings, options, _output);

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                int exitCode = 0;
                if (options.CleanCache)
                {
                    CacheCleaner.Run(settings);
                }
                else
                {
                    var          solutionReaderWriter = new SolutionReaderWriter(settings);
                    SolutionInfo solutionInfo         = solutionReaderWriter.ReadWrite(options.Solution.FullName);
                    settings.SolutionSettings = SolutionSettings.Load(settings, solutionInfo);
                    var projectReaderWriter = new ProjectReaderWriter(settings);
                    projectReaderWriter.ReadWrite(solutionInfo);
                    settings.SolutionSettings.UpdateAndSave(settings, solutionInfo);

                    if (!options.GenerateOnly)
                    {
                        var processLauncher = new ProcessLauncher(settings);
                        Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs cancelArgs)
                        {
                            _output.WriteLine("Stopping build...");
                            processLauncher.Stop();
                            cancelArgs.Cancel = true;
                        };

                        exitCode = processLauncher.Run(solutionInfo);
                    }
                }

                stopwatch.Stop();
                TimeSpan ts            = stopwatch.Elapsed;
                string   buildTimeText = string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
                _output.WriteLine("Build time: " + buildTimeText);

                return(exitCode);
            }
            catch (Exception e)
            {
                _output.WriteLine("ERROR: " + e.Message);
                return(-1);
            }
        }
Exemplo n.º 4
0
        static void Main()
        {
            //檢查是否有即時更新程式的換版檔案
            if (File.Exists("LiveUpdate.ex_"))
            {
                File.Delete("LiveUpdate.exe");                  //先刪除舊版本
                File.Move("LiveUpdate.ex_", "LiveUpdate.exe");  //再將新的程式更名
            }

            XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("log4net_config.xml"));

            ProductManager.Load("exchanges");
            GlobalSettings.Load("options.set");

            SeriesManager.LoadSettings();
            ScriptManager.LoadSettings();

            OrderManager.Manager.Refresh("plugins\\orders");
            QuoteManager.Manager.Refresh("plugins\\quotes");
            PaintManager.Manager.Refresh("plugins\\charts");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            frmWelcome frmWelcome = new frmWelcome();

            frmWelcome.ShowDialog();
            frmWelcome.Dispose();

            Application.Run(new frmMain());
        }
Exemplo n.º 5
0
        public MainForm()
        {
            InitializeComponent();
            GlobalSettings.Load("stfsystem03.etl.boi.rd.adapps.hp.com");

            _dnsDomain = GlobalSettings.Items[Setting.DnsDomain];
        }
Exemplo n.º 6
0
        private void CreateBotFromClone(string path, string login, string auth, string pass, string proxy, string proxyLogin, string proxyPass)
        {
            var dir      = Directory.CreateDirectory(SubPath + "\\" + path);
            var settings = GlobalSettings.Load(dir.FullName) ?? GlobalSettings.Load(dir.FullName);

            if (Bot != null)
            {
                settings = Bot.GlobalSettings.Clone();
            }

            //set new settings
            Enum.TryParse(auth, out settings.Auth.AuthType);
            if (settings.Auth.AuthType == AuthType.Google)
            {
                settings.Auth.GoogleUsername = login;
                settings.Auth.GooglePassword = pass;
            }
            else
            {
                settings.Auth.PtcUsername = login;
                settings.Auth.PtcPassword = pass;
            }
            if (proxy != "")
            {
                settings.Auth.UseProxy   = true;
                settings.Auth.ProxyUri   = proxy;
                settings.Auth.ProxyLogin = proxyLogin;
                settings.Auth.ProxyPass  = proxyPass;
            }
            settings.Device.DeviceId = DeviceSettings.RandomString(16, "0123456789abcdef");
            settings.StoreData(dir.FullName);
            InitBot(settings, path);
        }
Exemplo n.º 7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (STFLoginManager.Login())
            {
                _currentDatabase = STFLoginManager.SystemDatabase;
                //Set whether STF or STB based on the worker type in the database.
                GlobalSettings.IsDistributedSystem = false;
                //string officeWorkerType = VirtualResourceType.OfficeWorker.ToString();
                //using (EnterpriseTestContext dataContext = new EnterpriseTestContext(_currentDatabase))
                //{
                //    GlobalSettings.IsDistributedSystem = dataContext.VirtualResources.Any(r => r.ResourceType == officeWorkerType);
                //}
                LoggedInTextBlock.Text = $"Logged in as: {UserManager.CurrentUserName} to {STFLoginManager.SystemDatabase}";
            }
            else
            {
                Environment.Exit(1);
            }

            _edtAssetSelectionControl?.Initialize(AssetAttributes.None);
            GlobalSettings.Load(_currentDatabase);
            FrameworkServicesInitializer.InitializeConfiguration();


            BuildComboBox.DataContext    = _accessDds.GetBuilds();
            ProductComboBox.DataContext  = _accessDds.GetProducts();
            ScenarioDataGrid.DataContext = _scenarioList;
            GroupComboBox.DataContext    = _groupCollection;
        }
Exemplo n.º 8
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            ViewEngines.Engines.Add(new HelperViewEngine());

            #region Application Settings

            ApplicationMapper.Load();
            GlobalSettings.Load();

            // grid global setting
            GlobalSettings.LoadGirdSettings(25, "No records found.");



            #region Email Settings

            string emailAttachementPath  = ConfigurationManager.AppSettings["EMail:AttachmentPath"].ToString();
            string emailConnectionString = ConfigurationManager.ConnectionStrings[ConfigurationManager.AppSettings["DBConnectionName"]].ConnectionString;
            GlobalSettings.EmailNotificationSettings(emailAttachementPath, emailConnectionString);
            #endregion

            #endregion
        }
Exemplo n.º 9
0
        private bool TransferConfig(string baseDir, ISession session)
        {
            if (!session.LogicSettings.TransferConfigAndAuthOnUpdate)
            {
                return(false);
            }

            var configDir = Path.Combine(baseDir, "Config");

            if (!Directory.Exists(configDir))
            {
                return(false);
            }

            var oldConf = GetJObject(Path.Combine(configDir, "config.json.old"));
            var oldAuth = GetJObject(Path.Combine(configDir, "auth.json.old"));

            GlobalSettings.Load("");

            var newConf = GetJObject(Path.Combine(configDir, "config.json"));
            var newAuth = GetJObject(Path.Combine(configDir, "auth.json"));

            TransferJson(oldConf, newConf);
            TransferJson(oldAuth, newAuth);

            File.WriteAllText(Path.Combine(configDir, "config.json"), newConf.ToString());
            File.WriteAllText(Path.Combine(configDir, "auth.json"), newAuth.ToString());

            return(true);
        }
Exemplo n.º 10
0
        private static int Main(string[] args)
        {
            try
            {
                GlobalSettings.Clear();
                GlobalSettings.Load(args[1]);
                // Console.WriteLine(args[0]);
                // Console.WriteLine(args[1]);

                string sessionid = args[2];

                using (TraceLogContext context = new TraceLogContext())
                {
                    var activity      = ActivityExecution.SelectBySession(context, sessionid);
                    var activityCount = activity.Count(x => x.ActivityType.Equals("ScanToFolder"));

                    if (activityCount > 0)
                    {
                        string[] files = Directory.GetFiles(args[0], sessionid, SearchOption.AllDirectories);

                        if (activityCount <= files.Count())
                        {
                            return(0);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //TraceFactory.Logger.Error(ex.Message);
            }
            return(-1);
        }
Exemplo n.º 11
0
        private void OnClientMessage(NamedPipeConnection <ServerCommand, ServerCommand> connection,
                                     ServerCommand command)
        {
            if (command.Action == ServerAction.RebootServer)
            {
                GlobalSettings.Load();
                _fileServer.Stop();
                Thread.Sleep(3000);
                _fileServer.Start();
            }

            if (command.Action == ServerAction.StopServer)
            {
                _fileServer.Stop();
                Thread.Sleep(3000);
            }

            if (command.Action == ServerAction.StartServer)
            {
                GlobalSettings.Load();
                Thread.Sleep(3000);
                _fileServer.Start();
                Thread.Sleep(3000);
            }
        }
Exemplo n.º 12
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Text = @"NecroBot2 " + Application.ProductVersion;
            speedLable.Parent            = gMapControl1;
            showMoreCheckBox.Parent      = gMapControl1;
            followTrainerCheckBox.Parent = gMapControl1;
            togglePrecalRoute.Parent     = gMapControl1;

            InitializeBot();
            InitializePokemonForm();
            InitializeMap();
            VersionHelper.CheckVersion();
            showMoreCheckBox.Enabled = false;
            btnRefresh.Enabled       = false;
            if (BoolNeedsSetup)
            {
                startStopBotToolStripMenuItem.Text = "■ Exit";
                Logger.Write("First time here? Go to settings to set your basic info.", LogLevel.Error);
            }
            else
            {
                GlobalSettings.Load("");
            }
            if (VersionHelper.CheckKillSwitch())
            {
                startStopBotToolStripMenuItem.Text = "■ Exit";
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Load user settings from the custom file.
        /// </summary>
        private void LoadUserSettings()
        {
            // Load settings
            GlobalSettings.Load(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\" +
                                Properties.Settings.Default.SettingsFilePath);

            // Get current users settings
            userName = System.Windows.Forms.SystemInformation.UserName;
            Hashtable settings = GlobalSettings.GetUsersSettings(userName);

            // Use default settings if non exist for the user
            if (settings == null)
            {
                // Default settings
                Properties.Settings.Default.Reset();
            }
            else
            {
                // Load save settings
                if (settings.ContainsKey("Opacity"))
                {
                    Properties.Settings.Default.Opacity = (float)settings["Opacity"];
                }
                if (settings.ContainsKey("TrailLength"))
                {
                    Properties.Settings.Default.TrailLength = (int)settings["TrailLength"];
                }
                if (settings.ContainsKey("MaximumNumberOfFlakes"))
                {
                    Properties.Settings.Default.MaximumNumberOfFlakes = (int)settings["MaximumNumberOfFlakes"];
                }
            }
        }
Exemplo n.º 14
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            string languageCode = "en";

            var profileConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "config");
            var configFile        = Path.Combine(profileConfigPath, "config.json");
            var translationsDir   = Path.Combine(profileConfigPath, "Translations");
            var subPath           = "";
            var validateJSON      = false; // TODO Need to re-enable validation for GUI.

            if (File.Exists(configFile))
            {
                try {
                    var config = GlobalSettings.Load(subPath, validateJSON);
                    languageCode = config.ConsoleConfig.TranslationLanguageCode;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Config Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    Shutdown();
                }
            }

            if (!Directory.Exists(translationsDir))
            {
                Directory.CreateDirectory(translationsDir);
            }

            var uiTranslation = new UITranslation(languageCode);

            TinyIoCContainer.Current.Register(uiTranslation);

            MainWindow = new MainClientWindow();


            ConsoleHelper.AllocConsole();
            UILogger logger = new UILogger()
            {
                LogToUI = ((MainClientWindow)MainWindow).LogToConsoleTab
            };

            Logger.AddLogger(logger, string.Empty);

            Task.Run(() =>
            {
                NecroBot.CLI.Program.RunBotWithParameters(OnBotStartedEventHandler, new string[] { });
            });

            if (Settings.Default.ConsoleToggled == true)
            {
                ConsoleHelper.ShowConsoleWindow();
            }
            if (Settings.Default.ConsoleToggled == false)
            {
                ConsoleHelper.HideConsoleWindow();
            }

            MainWindow.Show();
        }
Exemplo n.º 15
0
        public async Task Start(IState initialState, Session session,
                                CancellationToken cancellationToken = default(CancellationToken))
        {
            var state             = initialState;
            var profilePath       = Path.Combine(Directory.GetCurrentDirectory(), "");
            var profileConfigPath = Path.Combine(profilePath, "config");

            var configWatcher = new FileSystemWatcher();

            configWatcher.Path                = profileConfigPath;
            configWatcher.Filter              = "config.json";
            configWatcher.NotifyFilter        = NotifyFilters.LastWrite;
            configWatcher.EnableRaisingEvents = true;
            configWatcher.Changed            += (sender, e) =>
            {
                if (e.ChangeType == WatcherChangeTypes.Changed)
                {
                    session.LogicSettings             = new LogicSettings(GlobalSettings.Load(""));
                    configWatcher.EnableRaisingEvents = !configWatcher.EnableRaisingEvents;
                    configWatcher.EnableRaisingEvents = !configWatcher.EnableRaisingEvents;
                    Logger.Write(" ##### config.json ##### ", LogLevel.Info);
                }
            };
            do
            {
                try
                {
                    state = await state.Execute(session, cancellationToken);
                }
                catch (InvalidResponseException)
                {
                    session.EventDispatcher.Send(new ErrorEvent
                    {
                        Message = "Niantic Servers unstable, throttling API Calls."
                    });
                }
                catch (OperationCanceledException)
                {
                    session.EventDispatcher.Send(new ErrorEvent {
                        Message = "Current Operation was canceled."
                    });
                    state = _initialState;
                }
                catch (Exception ex)
                {
                    session.EventDispatcher.Send(new ErrorEvent
                    {
                        Message = "Pokemon Servers might be offline / unstable. Trying again..."
                    });
                    Thread.Sleep(1000);
                    session.EventDispatcher.Send(new ErrorEvent {
                        Message = "Error: " + ex
                    });
                    state = _initialState;
                }
            } while (state != null);
            configWatcher.EnableRaisingEvents = false;
            configWatcher.Dispose();
        }
Exemplo n.º 16
0
 public KellyTest()
 {
     //Load Dev settings
     //Prod: 15.86.232.53
     //STBServer: 15.86.232.90
     GlobalSettings.Load("15.86.232.90");
     GlobalSettings.IsDistributedSystem = false;
     FrameworkServicesInitializer.InitializeExecution();
 }
Exemplo n.º 17
0
        public async void Start()
        {
            var settings = GlobalSettings.Load();

            channel_parser.Init();

            if (settings == null)
            {
                return;
            }

            StartNet(settings.Port);

            PollRarePokemonRepositories(settings);
            DiscordWebReader discordWebReader = null;

            while (true)
            {
                try {
                    discordWebReader = new DiscordWebReader();
                    if (discordWebReader == null || discordWebReader.stream == null)
                    {
                        Thread.Sleep(30 * 1000);
                        continue;
                    }
                }catch (Exception e)
                {
                    Thread.Sleep(30 * 1000);
                    continue;
                }

                while (true)
                {
                    try
                    {
                        pollDiscordFeed(discordWebReader.stream);
                    }
                    catch (WebException e)
                    {
                        Log.Warn($"Experiencing connection issues. Throttling...", e);
                        break;
                        /*discordWebReader.InitializeWebClient();*/
                    }
                    catch (Exception e)
                    {
                        Log.Warn($"Unknown exception", e);
                        break;
                    }
                    finally
                    {
                        Thread.Sleep(5 * 1000);
                    }
                }
            }

            Console.ReadKey(true);
        }
Exemplo n.º 18
0
        private static void LoadGlobalSettings(string database)
        {
            // Load or reload settings from the selected database
            GlobalSettings.Clear();
            GlobalSettings.Load(database);
            SystemDatabase = database;

            STFDispatcherManager.DisconnectFromDispatcher(false);
        }
Exemplo n.º 19
0
        private void AppStartup(object sender, StartupEventArgs args)
        {
            var mainWindow = new MainWindow
            {
                DataContext = new MainWindowViewModel()
            };

            GlobalSettings.Load();
            mainWindow.Show();
        }
Exemplo n.º 20
0
 public SettingsWindow(MetroWindow parent, string filename)
 {
     main     = parent;
     Settings = GlobalSettings.Load(filename);
     BackwardCompitableUpdate(Settings);
     fileName = filename;
     InitializeComponent();
     InitForm();
     WindowState = WindowState.Maximized;
 }
 public void ShowLatLngSettings()
 {
     if (TransitionerIndex != 1)
     {
         TransitionerIndex = 1;
         return;
     }
     GlobalSettings.Load();
     LocationBoundsSettingToSave = GlobalSettings.GeoLocationBounds;
     TransitionerIndex           = 4;
 }
Exemplo n.º 22
0
        internal void InitBots()
        {
            Logger.SetLogger(new WpfLogger(LogLevel.Info), subPath);

            foreach (var item in Directory.GetDirectories(subPath))
            {
                if (item != subPath + "\\Logs")
                {
                    InitBot(GlobalSettings.Load(item), System.IO.Path.GetFileName(item));
                }
            }
        }
Exemplo n.º 23
0
        private void CreateBotFromClone(string path, string login, string auth, string pass, string proxy,
                                        string proxyLogin, string proxyPass, string desiredName, string lat, string lon)
        {
            var dir      = Directory.CreateDirectory(SubPath + "\\" + path);
            var settings = GlobalSettings.Load(dir.FullName) ?? GlobalSettings.Load(dir.FullName);

            if (Bot != null)
            {
                settings = Bot.GlobalSettings.Clone();
                var profilePath       = dir.FullName;
                var profileConfigPath = Path.Combine(profilePath, "config");
                settings.ProfilePath       = profilePath;
                settings.ProfileConfigPath = profileConfigPath;
                settings.GeneralConfigPath = Path.Combine(Directory.GetCurrentDirectory(), "config");
            }

            //set new settings
            Enum.TryParse(auth, out settings.Auth.AuthType);
            if (settings.Auth.AuthType == AuthType.Google)
            {
                settings.Auth.GoogleUsername = login;
                settings.Auth.GooglePassword = pass;
            }
            else
            {
                settings.Auth.PtcUsername = login;
                settings.Auth.PtcPassword = pass;
            }
            if (proxy != "")
            {
                settings.Auth.UseProxy   = true;
                settings.Auth.ProxyUri   = proxy;
                settings.Auth.ProxyLogin = proxyLogin;
                settings.Auth.ProxyPass  = proxyPass;
            }
            if (desiredName != "")
            {
                settings.DesiredNickname = desiredName;
                settings.StartUpSettings.AutoCompleteTutorial = true;
            }
            if (lat != "")
            {
                lat.GetVal(out settings.LocationSettings.DefaultLatitude);
            }
            if (lon != "")
            {
                lon.GetVal(out settings.LocationSettings.DefaultLongitude);
            }
            settings.Device.DeviceId = DeviceSettings.RandomString(16, "0123456789abcdef");
            settings.StoreData(dir.FullName);
            InitBot(settings, path);
        }
Exemplo n.º 24
0
 private void ReloadButton_Click(object sender, RoutedEventArgs e)
 {
     _set = GlobalSettings.Load("");
     if (null == _set)
     {
         _set = GlobalSettings.Load("");
     }
     if (null == _set)
     {
         throw new Exception("There was an error attempting to build default config files - may be a file permissions issue! Cannot proceed.");
     }
     Settings = ObservableSettings.CreateFromGlobalSettings(_set);
 }
Exemplo n.º 25
0
 internal void InitBots()
 {
     Logger.SetLogger(new WpfLogger(LogLevel.Debug), SubPath);
     botsBox.ItemsSource     = BotsCollection;
     grid_pickBot.Visibility = Visibility.Visible;
     foreach (var item in Directory.GetDirectories(SubPath))
     {
         if (item != SubPath + "\\Logs")
         {
             InitBot(GlobalSettings.Load(item), Path.GetFileName(item));
         }
     }
 }
Exemplo n.º 26
0
 public void ShowSettings()
 {
     if (TransitionerIndex != 0)
     {
         TransitionerIndex = 0;
         return;
     }
     GlobalSettings.Load();
     ShowLimit         = GlobalSettings.ShowLimit;
     CustomPort        = GlobalSettings.Port;
     Sniper2Exe        = GlobalSettings.PokeSnipers2Exe;
     ShowLimit         = GlobalSettings.ShowLimit;
     RemoveMinutes     = GlobalSettings.RemoveAfter.ToString();
     TransitionerIndex = 1;
 }
Exemplo n.º 27
0
        private void YesButton_Click(object sender, RoutedEventArgs e)
        {
            // YesButton Clicked! Let's hide our InputBox and handle the input text.
            InputBox.Visibility = Visibility.Collapsed;

            // Do something with the Input
            var input = InputTextBox.Text;

            var dir      = Directory.CreateDirectory(subPath + "\\" + input);
            var settings = GlobalSettings.Load(dir.FullName) ?? GlobalSettings.Load(dir.FullName);

            InitBot(settings, input);
            // Clear InputBox.
            InputTextBox.Text = Empty;
        }
Exemplo n.º 28
0
        public Builder(IOutput output)
        {
            _output    = output;
            _stopwatch = new Stopwatch();

            try
            {
                _globalSettings = GlobalSettings.Load(_output);
                _globalSettings.Save();
            }
            catch (System.Exception ex)
            {
                _output.WriteLine("Error saving global settings: " + ex.Message);
            }
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            var database = args[0];
            _sessionId = args[1];
            var proxyServiceUri = new Uri(args[2]);

            TraceFactory.SetThreadContextProperty("PID", Process.GetCurrentProcess().Id.ToString());
            TraceFactory.SetSessionContext(_sessionId);
            TraceFactory.Logger.Debug(string.Join(", ", args));

            UnhandledExceptionHandler.Attach();

            GlobalSettings.Load(database);
            FrameworkServicesInitializer.InitializeExecution();

            try
            {
                using (var sessionProxy = new SessionProxy(_sessionId))
                {
                    sessionProxy.OnExit += _sessionProxy_OnExit;
                    sessionProxy.StartFrontendService(proxyServiceUri);
                    sessionProxy.StartBackendService();

                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...");
                    Retry.WhileThrowing
                        (
                            () =>
                            {
                                using (var connection = SessionDispatcherConnection.Create("localhost"))
                                {
                                    connection.Channel.NotifyProxyStarted(_sessionId);
                                }
                            },
                            10,
                            TimeSpan.FromSeconds(2),
                            new List<Type>() { typeof(EndpointNotFoundException) }
                        );
                    TraceFactory.Logger.Debug("Notify Dispatcher process is up...Done");

                    _mainThreadBlock.WaitOne();
                }
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error(ex);
            }
        }
Exemplo n.º 30
0
        static HbRelogManager()
        {
            try
            {
                // if in designer mode then return
                if (MainWindow.Instance == null || DesignerProperties.GetIsInDesignMode(MainWindow.Instance))
                {
                    return;
                }
                Settings     = GlobalSettings.Load();
                WorkerThread = new Thread(DoWork)
                {
                    IsBackground = true
                };
                WorkerThread.Start();
                try
                {
                    _host = new ServiceHost(typeof(RemotingApi), new Uri("net.pipe://localhost/HBRelog"));
                    _host.AddServiceEndpoint(typeof(IRemotingApi),
                                             new NetNamedPipeBinding()
                    {
                        ReceiveTimeout = TimeSpan.MaxValue
                    },
                                             "Server");
                    _host.Open();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    Log.Err(ex.ToString());
                }

                WowRealmStatus = new WowRealmStatus();
                // update Wow Realm status
                if (Settings.CheckRealmStatus)
                {
                    WowRealmStatus.Update();
                }
                IsInitialized = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log.Err(ex.ToString());
            }
        }