示例#1
0
        private void deleteBtn_Click(object sender, RoutedEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            try
            {
                if (File.Exists(LocalConfiguration.Instance.Files.ConfDataFile))
                {
                    File.Delete(LocalConfiguration.Instance.Files.ConfDataFile);
                    Logger.Current.AppendText("Сброс настроек файла конфигурации");
                }

                FancyBalloon balloon = new FancyBalloon();

                balloon.BalloonMessage = resource.Get(TextResource.RESETMSG);

                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);

                DialogResult = true;
            }
            catch (Exception ex)
            {
                FancyBalloon balloon = new FancyBalloon();

                balloon.BalloonMessage = resource.Get(TextResource.RESETMSGERR);

                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);

                Logger.Current.AppendText("Не удалось сбросить настройки");
                Logger.Current.AppendException(ex);
            }
        }
示例#2
0
        private void openGameSetBtn_Click(object sender, RoutedEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            try
            {
                string configFile = Path.Combine(_xmlhelper.GetSettingValue("realm1_client_location"), "NtConfig.exe");

                if (File.Exists(configFile))
                {
                    var process = new Process();
                    process.StartInfo.FileName = configFile;
                    process.Start();
                }
                else
                {
                    FancyBalloon balloon = new FancyBalloon();
                    balloon.BalloonMessage = string.Format(resource.Get(TextResource.EXENOTFOUND),
                                                           configFile);
                    tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                    Logger.Current.AppendText("NtConfig.exe не найден");
                }
            }
            catch (Exception patchingErrorMain)
            {
                FancyBalloon balloon = new FancyBalloon();
                balloon.BalloonMessage = resource.Get(TextResource.ERRORSTARTINGGAME);
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
            }
        }
示例#3
0
        private void Translate()
        {
            ResourceProvider resource = ResourceProvider.Instance;

            deleteBtn.Content = resource.Get(TextResource.RESETSETT);
            cancelBtn.Content = resource.Get(TextResource.CANCELBTN);
            closeBtn.ToolTip  = resource.Get(TextResource.TOOLCLOSE);
            popupMessage.Text = resource.Get(TextResource.POPUPMSG);
        }
        private void Translate()
        {
            ResourceProvider resource = ResourceProvider.Instance;

            welcomeBlock.Text    = resource.Get(TextResource.WELCBLOCK);
            welcomeDescript.Text = resource.Get(TextResource.WELCDESCR);
            welcomeBtn.Content   = resource.Get(TextResource.WELCBTN);
            settingsBtn.Content  = resource.Get(TextResource.WELCBTNSET);
            change.Content       = resource.Get(TextResource.CHANGEGAMELANG);
        }
        private void Translate()
        {
            ResourceProvider resource = ResourceProvider.Instance;

            closeButton.ToolTip   = resource.Get(TextResource.TOOLCLOSE);
            forgotPassBtn.Content = resource.Get(TextResource.FORGOTPWD);
            remember.Content      = resource.Get(TextResource.REMEMBER);

            regBtn.Content   = resource.Get(TextResource.CREATEACC);
            loginBtn.Content = resource.Get(TextResource.LOGINBTN);
            Logger.Current.AppendText("Завершен метод перевода окна авторизации");
        }
        private void Updater_UpdateInfoChanged(object sender, InfoEventArgs e)
        {
            ResourceProvider resource   = ResourceProvider.Instance;
            float            percentage = (e.Size - e.RemainingSize) / e.Size * 100;

            infoDownload.Content = percentage == 100 ? string.Format(resource.Get(TextResource.CHECKFILE), e.Name) : string.Format(resource.Get(TextResource.DOWNLOAD_STATUS), e.Name, (int)percentage, Math.Round(e.RemainingSize, 1));
        }
        private async void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            ResourceProvider resource      = ResourceProvider.Instance;
            string           rootDirectory = _xmlhelper.GetSettingValue("realm1_client_location");
            string           nosExeFile    = Path.Combine(rootDirectory ?? "", Wow.FileName.NOSTALE_EXE_NAME);

            try
            {
                if (!File.Exists(nosExeFile))
                {
                    byte[] resf;
                    resf = Properties.Resources.NostaleRun;
                    File.WriteAllBytes(nosExeFile, resf);
                    File.SetAttributes(nosExeFile, FileAttributes.Hidden);
                    Logger.Current.AppendText("Создан файл запуска приложения");
                }

                var process = new Process();
                process.StartInfo.FileName       = nosExeFile;
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                process.Start();

                WindowState = WindowState.Minimized;
            }
            catch (Exception)
            {
                FancyBalloon balloon = new FancyBalloon
                {
                    BalloonMessage = resource.Get(TextResource.EXENOTFOUND)
                };
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                Logger.Current.AppendText("Отсутствует файл запуска приложения");
            }
        }
        private void Updater_UpdateStateChanged(object sender, UpdateStateEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            switch (e.NewState)
            {
            case UpdateState.None:
                infoDownload.Visibility = Visibility.Hidden;
                break;

            case UpdateState.Checking:     //checking for update
                playButton.IsEnabled = false;
                break;

            case UpdateState.NotNeeded:     //update not needed
                playButton.IsEnabled = true;
                this.ProgressBar1.NotNeeded();
                ProgressBar1.Visibility = Visibility.Hidden;
                playButton.Content      = resource.Get(TextResource.PLAY);
                break;

            case UpdateState.Started:     //update start
                FancyBalloon updateStart = new FancyBalloon();
                updateStart.BalloonMessage = resource.Get(TextResource.UPDSTART);
                tb.ShowCustomBalloon(updateStart, PopupAnimation.Slide, 5000);

                infoDownload.Visibility      = Visibility.Visible;
                playButton.IsEnabled         = false;
                this.ProgressBar1.Visibility = Visibility.Visible;
                playButton.Content           = resource.Get(TextResource.UPDATING);
                break;

            case UpdateState.Completed:     //update success
                FancyBalloon balloon = new FancyBalloon();
                balloon.BalloonMessage = resource.Get(TextResource.UPDCOMPLETE);
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                infoDownload.Visibility = Visibility.Hidden;
                playButton.IsEnabled    = true;
                this.ProgressBar1.Complete();
                playButton.Content = resource.Get(TextResource.PLAY);
                Logger.Current.AppendText("Mise à jour terminée avec succès");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public ZeroMqResourceProviderFacade(ResourceProvider provider, string serverUri)
            : this(serverUri)
        {
            if (provider == null) throw new ArgumentNullException("provider");

            _work = (request, reply) => { reply(provider.Get(request)); };
            _sendPendingResults = () => { };
        }
示例#10
0
        public void ParseWithZone()
        {
            var resource = ManagedResource.Parse("aws:us-east-1a:host/i-1");

            Assert.Equal(2, ResourceProvider.Get(resource.ProviderId).Id);
            Assert.Equal("host", resource.Type.Name);
            Assert.Equal("i-1", resource.ResourceId);
            Assert.Equal("aws:us-east-1a:host/i-1", resource.ToString());
        }
示例#11
0
        public void ParseHost()
        {
            var resource = ManagedResource.Parse("aws:host/18");

            Assert.Equal("AWS", ResourceProvider.Get(resource.ProviderId).Name);
            Assert.Equal(ResourceTypes.Host, resource.Type);
            Assert.Equal("18", resource.ResourceId);
            Assert.Equal("aws:host/18", resource.ToString());
        }
示例#12
0
        public void ParseUnknown()
        {
            var resource = ManagedResource.Parse("aws/i-1");

            Assert.Equal(2, ResourceProvider.Get(resource.ProviderId).Id);
            Assert.Equal("unknown", resource.Type.Name);
            Assert.Equal("i-1", resource.ResourceId);
            Assert.Equal("aws:unknown/i-1", resource.ToString());
        }
示例#13
0
        private void SaveSettingsButton_Click(object sender, RoutedEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            try
            {
                _xmlhelper.UpdateSettingValue("user_login", textBoxLogin.Text);
                _xmlhelper.UpdateSettingValue("user_password", EncDec.Shifrovka(passwordBox.Password, "private_string"));
                _xmlhelper.UpdateSettingValue("realm1_client_location", location1.Text);

                if (copyApp.IsChecked == true)
                {
                    _xmlhelper.UpdateSettingValue("run_copy_app", "false");
                }
                else
                {
                    _xmlhelper.UpdateSettingValue("run_copy_app", "true");
                }

                FancyBalloon balloon = new FancyBalloon();
                balloon.BalloonMessage = resource.Get(TextResource.SETTINGOK);
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                Logger.Current.AppendText("Пользовательские данные успешно сохранены");
                SetResultText("");

                var popupReset = new PopupDialogReset();
                popupReset.Owner = this;
                ApplyEffect(this);
                bool?dialogResult = popupReset.ShowDialog();
                ClearEffect(this);

                if (dialogResult == true)
                {
                    Close();
                }
            }
            catch
            {
                FancyBalloon balloon = new FancyBalloon();
                balloon.BalloonMessage = resource.Get(TextResource.SETTINGERR);
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                Logger.Current.AppendText("Ошибка сохранения пользовательских данных");
            }
        }
示例#14
0
        public void CloudProviders(string code, string name, int id)
        {
            var provider = ResourceProvider.Parse(code);

            Assert.Equal(id, provider.Id);
            Assert.Equal(name, provider.Name);

            // Ensure we can lookup by id too
            Assert.Equal(id, ResourceProvider.Get(id).Id);
        }
示例#15
0
 private void LoadAllItems()
 {
     Items = new List <MediaTitle>();
     try
     {
         int i = 0;
         using (SqlConnection cn = new SqlConnection(EtlServiceProvider.ConnectionStrings.SqlServer.trilogy))
         //using (SqlConnection cn = SqlConnectionProvider.GetConnection(EtlServiceProvider.ConnectionStrings.SqlServer.trilogy))
         {
             cn.Open();
             using (SqlCommand cmd = cn.CreateCommand())
             {
                 cmd.CommandType = CommandType.Text;
                 //cmd.CommandText = Resources.Trilogy_MediaTitle_Merge;
                 cmd.CommandText    = ResourceProvider.Get().GetString("Source_MediaTitle_Merge");
                 cmd.CommandTimeout = 3600;
                 using (XmlReader reader = cmd.ExecuteXmlReader())
                 {
                     reader.ReadToNextSibling("MediaTitle");
                     bool isRead = true;
                     while (isRead)
                     {
                         string s = reader.ReadOuterXml();
                         if (String.IsNullOrWhiteSpace(s))
                         {
                             isRead = false;
                         }
                         else
                         {
                             i++;
                             //MediaTitle item = GenericSerializer.StringToGenericItem<MediaTitle>(s);
                             MediaTitle item = s.ParseXML <MediaTitle>();
                             item.Index = i;
                             Items.Add(item);
                         }
                     }
                 }
             }
         }
     }
     catch (SqlException sqlEx)
     {
         //var props = eXtensibleConfig.GetProperties();
         //var message = sqlEx.Message;
         //EventWriter.WriteError(message, SeverityType.Critical, "DataAccess", props);
     }
     catch (Exception ex)
     {
         //var props = eXtensibleConfig.GetProperties();
         //var message = ex.Message;
         //EventWriter.WriteError(message, SeverityType.Critical, "DataAccess", props);
     }
 }
        private void Translate()
        {
            ResourceProvider resource     = ResourceProvider.Instance;
            string           hotNewsConst = resource.Get(TextResource.HOTNEWS);
            string           playConst    = resource.Get(TextResource.PLAY);

            gamesBtn.Content       = resource.Get(TextResource.GAMESBTN);
            newsBtn.Content        = resource.Get(TextResource.NEWSBTN);
            minimizeButton.ToolTip = resource.Get(TextResource.TOOLMINI);
            closeButton.ToolTip    = resource.Get(TextResource.TOOLCLOSE);
            settingsBtn.Content    = resource.Get(TextResource.SETTINGSBTN);
            shopBtn.Content        = resource.Get(TextResource.SHOPBTN);
            forumBtn.Content       = resource.Get(TextResource.FORUMBTN);

            playButton.Content   = playConst;
            hotNewsLabel.Content = hotNewsConst;

            Logger.Current.AppendText("Завершен метод перевода главного окна");
        }
示例#17
0
        public void RegisterResourceProvider(ResourceProvider provider, int energy, bool isAuthoritative)
        {
            var providerid = Guid.NewGuid();

            RegisterResourceHandler(providerid, RoutesRequest.Get(providerid).NetResourceLocator,energy, isAuthoritative,  _=>provider.Get(RoutesRequest.GetGlobal()).Guard().Resource);

            _provider.Add(providerid, provider);
            var routeresource = _kernel.Get(RoutesRequest.Get(providerid)).Guard();

            var routelist = MediaFormatter<RoutesInformation>.Parse(routeresource.Resource, RoutesInformation.Mediatype);

            foreach (var routeEntry in routelist.Routes)
            {
                if (!String.IsNullOrEmpty(routeEntry.Identifier)) RegisterResourceForwarder(providerid, IdentifierToRegex(routeEntry.Identifier), provider, routeEntry.DeliveryTime + routeresource.Resource.Energy);
                else RegisterResourceForwarder(providerid, routeEntry.Regex, provider, routeEntry.DeliveryTime + routeresource.Resource.Energy);
            }
        }
示例#18
0
        public async Task <HostInfo> RegisterAsync(RegisterHostRequest request)
        {
            Validate.NotNull(request, nameof(request));

            var provider = ResourceProvider.Get(request.Resource.ProviderId);

            var host = await hostService.FindAsync(provider, request.Resource.ResourceId);;

            if (host == null)
            {
                host = await hostService.RegisterAsync(request);
            }
            else
            {
                await TransitionStateAsync(host, request.Status);;
            }

            return(host);
        }
示例#19
0
        private async void PlayButton_Click(object sender, RoutedEventArgs e)
        {
            ResourceProvider resource   = ResourceProvider.Instance;
            string           nosExeFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Wow.FileName.MAPLESTORY_EXE_NAME);

            try
            {
                if (!File.Exists(nosExeFile))
                {
                    byte[] resf;
                    resf = Properties.Resources.NostaleRun;
                    System.IO.File.WriteAllBytes(nosExeFile, resf);
                    System.IO.File.SetAttributes(nosExeFile, FileAttributes.Hidden);
                    Logger.Current.AppendText("Создан файл запуска приложения");
                }

                var process = new Process();
                process.StartInfo.FileName       = nosExeFile;
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                process.Start();
                //Logger.Current.AppendText("Запуск игрового клиента");
                //string getPass = EncDec.DeShifrovka(_xmlhelper.GetSettingValue("user_password"), "private_string");
                //Thread.Sleep(6000);
                //SendKeys.SendWait(_xmlhelper.GetSettingValue("user_login"));
                //SendKeys.SendWait("{Tab}");
                //Logger.Current.AppendText("Отправляем логин в игру");
                //SendKeys.SendWait(getPass);
                //Logger.Current.AppendText("Отправляем пароль в игру");
                //SendKeys.SendWait("{enter}");


                WindowState = WindowState.Minimized;
            }
            catch (Exception patchingErrorMain)
            {
                FancyBalloon balloon = new FancyBalloon();
                balloon.BalloonMessage = resource.Get(TextResource.EXENOTFOUND);
                tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);
                Logger.Current.AppendText("Отсутствует файл запуска приложения");
            }
        }
        //Вывод новостей реалм 1
        private void Launcher_NewsLoadBanner(object sender, LoadTextEventArgs e)
        {
            ResourceProvider resource = ResourceProvider.Instance;

            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                bannersLoader.Visibility = Visibility.Visible;
                try
                {
                    if (e.Result.Success)
                    {
                        ExpressNewsSet newsSet = ExpressNewsSet.FromXml(e.Result.Data);
                        bannersLoader.NewsItems = newsSet.ExpressNews;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                    FancyBalloon balloon = new FancyBalloon();
                    balloon.BalloonMessage = resource.Get(TextResource.NEWSBANNERERROR);
                    tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000);

                    Logger.Current.AppendException(err);
                }
                StopWaitAnimation();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#21
0
        public NewsTab()
        {
            InitializeComponent();

            var mySqlConfig = new IpPortConfig
            {
                Ip   = Settings.Default.mysql_ip,
                Port = Settings.Default.mysql_port
            };
            var worldConfig = new IpPortConfig
            {
                Ip   = Settings.Default.world_ip,
                Port = Settings.Default.world_port
            };

            var addressSet = new AddressSet
            {
                LoadBannerNews = string.Format(Settings.Default.api_url + "?_key={0}&_url=getNewsTab", Settings.Default.skey_api),
            };

            _addressSet  = addressSet;
            _mySqlConfig = mySqlConfig;
            _worldConfig = worldConfig;

            _launcher = new LauncherLogic(addressSet, mySqlConfig, worldConfig);
            _launcher.NewsLoadBanner += Launcher_NewsLoadBanner;

            _storyboard = FindResource("ChangeItems") as Storyboard;
            Debug.Assert(_storyboard != null, "_storyboard не должна быть null");
            Storyboard.SetTarget(_storyboard, LayoutRoot);

            _newsKeys = new Dictionary <string, string>()
            {
                { AllRealms, resource.Get(TextResource.ALLREALMS) },
                { "realm1", Settings.Default.server_name_wotlk },
            };
        }
示例#22
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            var provider = ResourceProvider.Get(ProviderId);

            sb.Append(provider.Code);
            sb.Append(':');

            if (LocationId != 0)
            {
                var location = Locations.Get(LocationId);

                sb.Append(location.Name);

                sb.Append(':');
            }

            sb.Append(Type.Name);
            sb.Append('/');
            sb.Append(ResourceId);

            return(sb.ToString());
        }
示例#23
0
 public AsyncRequestHandler(ResourceProvider provider, Request request, Action<Response> onresponse)
 {
     _onresponse = onresponse;
     _work = () => Response = provider.Get(request);
 }
示例#24
0
 private void InitializeCommand(SqlCommand cmd)
 {
     cmd.CommandType    = CommandType.Text;
     cmd.CommandText    = ResourceProvider.Get().GetString("Source_Description");
     cmd.CommandTimeout = 3600;
 }