public TranslationsResponse Post(Translations request)
        {
            if (request.Translation.Id > 0)
              {
            Bm2s.Data.Common.BLL.Parameter.Translation item = Datas.Instance.DataStorage.Translations[request.Translation.Id];
            item.Application = request.Translation.Application;
            item.Key = request.Translation.Key;
            item.LanguageId = request.Translation.Language.Id;
            item.Screen = request.Translation.Screen;
            item.Value = request.Translation.Value;
            Datas.Instance.DataStorage.Translations[request.Translation.Id] = item;
              }
              else
              {
            Bm2s.Data.Common.BLL.Parameter.Translation item = new Data.Common.BLL.Parameter.Translation()
            {
              Application = request.Translation.Application,
              Key = request.Translation.Key,
              LanguageId = request.Translation.Language.Id,
              Screen = request.Translation.Screen,
              Value = request.Translation.Value
            };

            Datas.Instance.DataStorage.Translations.Add(item);
            request.Translation.Id = item.Id;
              }

              TranslationsResponse response = new TranslationsResponse();
              response.Translations.Add(request.Translation);
              return response;
        }
        public TranslationsResponse Delete(Translations request)
        {
            Bm2s.Data.Common.BLL.Parameter.Translation item = Datas.Instance.DataStorage.Translations[request.Translation.Id];
              Datas.Instance.DataStorage.Translations.Remove(item);

              TranslationsResponse response = new TranslationsResponse();
              response.Translations.Add(request.Translation);
              return response;
        }
Ejemplo n.º 3
0
 public HelpCenterApi(string yourZendeskUrl, string user, string password, string apiToken, string locale, string p_OAuthToken)
 {
     Categories = new Categories(yourZendeskUrl, user, password, apiToken, locale, p_OAuthToken);
     Sections = new Sections(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Articles = new Articles(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Translations = new Translations(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Votes = new Votes(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Comments = new Comments(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     AccessPolicies = new AccessPolicies(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Topics = new Topics(yourZendeskUrl, user, password, apiToken, p_OAuthToken);
     Locale = locale;
 }
        public TranslationsResponse Get(Translations request)
        {
            TranslationsResponse response = new TranslationsResponse();
              List<Bm2s.Data.Common.BLL.Parameter.Translation> items = new List<Data.Common.BLL.Parameter.Translation>();
              if (!request.Ids.Any())
              {
            items.AddRange(Datas.Instance.DataStorage.Translations.Where(item =>
              (string.IsNullOrWhiteSpace(request.Application) || item.Application.ToLower() == request.Application.ToLower()) &&
              (string.IsNullOrWhiteSpace(request.Key) || item.Key.ToLower() == request.Key.ToLower()) &&
              (string.IsNullOrWhiteSpace(request.Screen) || item.Screen.ToLower() == request.Screen.ToLower()) &&
              (request.LanguageId == 0 || item.LanguageId == request.LanguageId)
              ));
              }
              else
              {
            items.AddRange(Datas.Instance.DataStorage.Translations.Where(item => request.Ids.Contains(item.Id)));
              }

              var collection = (from item in items
                        select new Bm2s.Poco.Common.Parameter.Translation()
                     {
                       Application = item.Application,
                       Id = item.Id,
                       Key = item.Key,
                       Language = new LanguagesService().Get(new Languages() { Ids = new List<int>() { item.LanguageId } }).Languages.FirstOrDefault(),
                       Screen = item.Screen,
                       Value = item.Value
                     }).AsQueryable().OrderBy(request.Order, !request.DescendingOrder);

              response.ItemsCount = collection.Count();
              if (request.PageSize > 0)
              {
            response.Translations.AddRange(collection.Skip((request.CurrentPage - 1) * request.PageSize).Take(request.PageSize));
              }
              else
              {
            response.Translations.AddRange(collection);
              }

              try
              {
            response.PagesCount = collection.Count() / response.Translations.Count + (collection.Count() % response.Translations.Count > 0 ? 1 : 0);
              }
              catch
              {
            response.PagesCount = 1;
              }

              return response;
        }
Ejemplo n.º 5
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblHeader.Text = stringTable.RetrieveTranslation(Translations.MessageType.UninstallWelcomeHeader);
     lblWelcome.Text = stringTable.RetrieveTranslation(Translations.MessageType.UninstallMessage);
     if (VistaSecurity.IsAdmin() == false) {
         if (!VistaSecurity.IsVistaOrHigher()) {
             btnNext.Enabled = false;
             lblError.Text = stringTable.RetrieveTranslation(Translations.MessageType.WelcomeNoAdmin);
             lblError.Show();
         } else {
             VistaSecurity.AddShieldToButton(btnNext);
             btnNext.Enabled = true;
         }
     } else {
         btnNext.Enabled = true;
     }
 }
Ejemplo n.º 6
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblHeader.Text = stringTable.RetrieveTranslation(Translations.MessageType.WelcomeHeader);
     lblWelcome.Text = stringTable.RetrieveTranslation(Translations.MessageType.WelcomeMessage);
     //if (VistaSecurity.IsAdmin() == false) {
     //    chkPortableMode.Enabled = false;
     //    chkPortableMode.Checked = true;
     //    if (!VistaSecurity.IsVistaOrHigher()) {
     //        //btnNext.Enabled = false;
     //        lblError.Text = stringTable.RetrieveTranslation(Translations.MessageType.WelcomeNoAdmin);
     //        lblError.Show();
     //        exclamationImage.Show();
     //    } else {
     //        btnRestartAsAdmin.Show();
     //        VistaSecurity.AddShieldToButton(btnRestartAsAdmin);
     //        lblError.Text = "To fully install this program, you will need to run this installer as an Administrator. To do so, you may click the button below. However, you may still continue installing by installing PMU as a portable application.";
     //        lblError.Show();
     //        exclamationImage.Show();
     //    }
     //}
 }
Ejemplo n.º 7
0
        private string GetSubCommandHelp(string cmd)
        {
            switch (cmd)
            {
            case "list":
                return(Translations.Get("cmd.inventory.help.list") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> list");

            case "close":
                return(Translations.Get("cmd.inventory.help.close") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> close");

            case "click":
                return(Translations.Get("cmd.inventory.help.click") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> click <slot> [left|right|middle]. \nDefault is left click");

            case "drop":
                return(Translations.Get("cmd.inventory.help.drop") + Translations.Get("cmd.inventory.help.usage") + ": /inventory <player|container|<id>> drop <slot> [all]. \nAll means drop full stack");

            case "help":
                return(GetHelp());

            default:
                return(Translations.Get("cmd.inventory.help.unknown") + GetAvailableActions());
            }
        }
Ejemplo n.º 8
0
        protected override void Initialize()
        {
            switch (random.Next(3))
            {
            case 0:
                ques1          = Translations.GetString("5th");
                ques2          = Translations.GetString("19th");
                Answer.Correct = "28";
                break;

            case 1:
                ques1          = Translations.GetString("4th");
                ques2          = Translations.GetString("12th");
                Answer.Correct = "16";
                break;

            case 2:
                ques1          = Translations.GetString("9th");
                ques2          = Translations.GetString("22nd");
                Answer.Correct = "26";
                break;
            }
        }
Ejemplo n.º 9
0
        // black box export
        private void buttonBlackBoxExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog {
                OverwritePrompt = true
            };

            if (comboboxBlackBoxFormat.SelectedIndex == 0)
            {
                Dialog.Filter = Translations.GetInterfaceString("dialog_csvfiles") + @"|*.txt|" + Translations.GetInterfaceString("dialog_allfiles") + @"|*";
            }
            else
            {
                Dialog.Filter = Translations.GetInterfaceString("dialog_textfiles") + @"|*.txt|" + Translations.GetInterfaceString("dialog_allfiles") + @"|*";
            }
            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                try {
                    Interface.ExportBlackBox(Dialog.FileName, (Interface.BlackBoxFormat)comboboxBlackBoxFormat.SelectedIndex);
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
Ejemplo n.º 10
0
        public void TestPowerplay()
        {
            var ship    = ShipDefinitions.FromEliteID(128049363);
            var speaker = SpeechService.Instance;

            string[] powerNames =
            {
                "Aisling Duval",
                "Archon Delaine",
                "Arissa Lavigny-Duval",
                "Denton Patreus",
                "Edmund Mahon",
                "Felicia Winters",
                "Pranav Antal",
                "Zachary Hudson",
                "Zemina Torval",
                "Li Yong-Rui"
            };
            foreach (string powerName in powerNames)
            {
                speaker.Say(ship, Translations.Power(powerName) + ".", true);
            }
        }
Ejemplo n.º 11
0
 /// <inheritdoc />
 public formRaildriverCalibration()
 {
     InitializeComponent();
     main = (Bitmap)ImageExtensions.FromFile(OpenBveApi.Path.CombineFile(Program.FileSystem.DataFolder, "Menu\\raildriver.png"));
     pictureBox1.Image = main;
     buttonCalibrationPrevious.Enabled = false;
     labelCalibrationText.Text         = Translations.GetInterfaceString("raildriver_calibration_start");
     if (JoystickManager.devices.Length == 0)
     {
         MessageBox.Show(Translations.GetInterfaceString("raildriver_notdetected"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Load += (s, e) => Close();
         return;
     }
     for (int i = 0; i < JoystickManager.AttachedJoysticks.Length; i++)
     {
         if (JoystickManager.AttachedJoysticks[i] is JoystickManager.Raildriver)
         {
             joystickIDX = i;
         }
     }
     buttonCalibrationNext.Text     = Translations.GetInterfaceString("packages_button_next");
     buttonCalibrationPrevious.Text = Translations.GetInterfaceString("packages_button_back");
 }
        public CudaComputeDevice(CudaDevice cudaDevice, DeviceGroupType group, int gpuCount,
                                 NvPhysicalGpuHandle nvHandle, nvmlDevice nvmlHandle)
            : base((int)cudaDevice.DeviceID,
                   cudaDevice.GetName(),
                   true,
                   group,
                   cudaDevice.IsEtherumCapable(),
                   DeviceType.NVIDIA,
                   string.Format(Translations.Tr("GPU#{0}"), gpuCount),
                   cudaDevice.DeviceGlobalMemory)
        {
            BusID             = cudaDevice.pciBusID;
            SMMajor           = cudaDevice.SM_major;
            SMMinor           = cudaDevice.SM_minor;
            Uuid              = cudaDevice.UUID;
            AlgorithmSettings = GroupAlgorithms.CreateForDeviceList(this);
            Index             = ID + ComputeDeviceManager.Available.AvailCpus; // increment by CPU count

            _nvHandle   = nvHandle;
            _nvmlDevice = nvmlHandle;

            ShouldRunEthlargement = cudaDevice.DeviceName.Contains("1080") || cudaDevice.DeviceName.Contains("Titan Xp");
        }
Ejemplo n.º 13
0
        private void initTranslation()
        {
            _TranslatesSortCommand = new Command((prp) =>
            {
                ICollection <IMapValueRecord> lst = Translations.ToArray();
                switch ((string)prp)
                {
                case "Count":
                    lst = lst.OrderBy(e => e.Data.Count).ToArray();
                    break;

                case "Value":
                    lst = lst.OrderBy(e => e.Value).ToArray();
                    break;

                case "Translation":
                    lst = lst.OrderBy(e => e.Translation).ToArray();
                    break;
                }
                Translations.Reset(lst);
            });
            InitLangs();
        }
Ejemplo n.º 14
0
        private void SendPassWithMail(User user)
        {
            try
            {
                var from = new MailAddress("*****@*****.**"); // make custom mail adress
                var to   = new MailAddress(user.Email);

                var newPas = AESEncryptor.encryptPassword(RandomNumberGenerator.RandomPassword());
                user.Password = newPas;

                UserServiceClient.AddOrUpdateUser(user);

                var message = new MailMessage(from, to);
                message.Subject = "Password restore";
                message.Body    = "Your pass - " + AESEncryptor.decryptPassword(newPas);

                var smtp = new SmtpClient("smtp.gmail.com", 587);
                smtp.Credentials = new NetworkCredential("*****@*****.**", "messageApp1");
                smtp.EnableSsl   = true;
                smtp.SendMailAsync(message);

                Application.Current.Dispatcher.Invoke(new Action((() =>
                {
                    try
                    {
                        CustomMessageBox.Show(Translations.GetTranslation()["RestorePass"].ToString(), Application.Current.Resources.MergedDictionaries[4]["EmailSend"].ToString());
                        IsSending = false;
                    }
                    finally
                    {
                    }
                })));
            }
            finally
            {
            }
        }
Ejemplo n.º 15
0
        public JpegCompressionDialog(int defaultQuality, Gtk.Window parent)
            : base(Translations.GetString("JPEG Quality"), parent, DialogFlags.Modal | DialogFlags.DestroyWithParent,
                   Core.GtkExtensions.DialogButtonsCancelOk())
        {
            this.BorderWidth         = 6;
            this.ContentArea.Spacing = 3;
            VBox content = new VBox();

            content.Spacing = 5;

            DefaultResponse = ResponseType.Ok;

            Label label = new Label(Translations.GetString("Quality: "));

            label.Xalign = 0;
            content.PackStart(label, false, false, 0);

            compressionLevel       = new HScale(1, 100, 1);
            compressionLevel.Value = defaultQuality;
            content.PackStart(compressionLevel, false, false, 0);

            content.ShowAll();
            this.ContentArea.Add(content);
        }
Ejemplo n.º 16
0
        protected void LoadConfiguration()
        {
            // Initialize main configuration file
            mainConfiguration = FileManager.LoadConfig("Main");

            // Initialize buildings
            Configuration buildingConfiguration = mainConfiguration.GetPropertySection("building");

            BuildingRegistry.InitBuildings(buildingConfiguration);

            Building.LoadFromConfig(buildingConfiguration);

            // Initialize units
            Configuration unitConfiguration = mainConfiguration.GetPropertySection("unit");

            SoldierRegistry.Init(unitConfiguration);


            // Initialize language file
            Translations.LoadLanguage("en_US");

            // Initialize keys
            InitializeKeys(FileManager.LoadConfig("Keys").GetPropertySection("key"));
        }
Ejemplo n.º 17
0
        private static void setCommanderValues(Commander cmdr, ref dynamic vaProxy)
        {
            try
            {
                vaProxy.SetText("Name", cmdr == null ? null : cmdr.name);
                vaProxy.SetInt("Combat rating", cmdr == null || cmdr.combatrating == null ? (int?)null : cmdr.combatrating.rank);
                vaProxy.SetText("Combat rank", cmdr == null || cmdr.combatrating == null ? null : cmdr.combatrating.name);
                vaProxy.SetInt("Trade rating", cmdr == null || cmdr.traderating == null ? (int?)null : cmdr.traderating.rank);
                vaProxy.SetText("Trade rank", cmdr == null || cmdr.traderating == null ? null : cmdr.traderating.name);
                vaProxy.SetInt("Explore rating", cmdr == null || cmdr.explorationrating == null ? (int?)null : cmdr.explorationrating.rank);
                vaProxy.SetText("Explore rank", cmdr == null || cmdr.explorationrating == null ? null : cmdr.explorationrating.name);
                vaProxy.SetInt("Empire rating", cmdr == null || cmdr.empirerating == null ? (int?)null : cmdr.empirerating.rank);
                vaProxy.SetText("Empire rank", cmdr == null || cmdr.empirerating == null ? null : cmdr.empirerating.name);
                vaProxy.SetInt("Federation rating", cmdr == null || cmdr.federationrating == null ? (int?)null : cmdr.federationrating.rank);
                vaProxy.SetText("Federation rank", cmdr == null || cmdr.federationrating == null ? null : cmdr.federationrating.name);
                vaProxy.SetDecimal("Credits", cmdr == null ? (decimal?)null : cmdr.credits);
                vaProxy.SetText("Credits (spoken)", cmdr == null ? null : Translations.Humanize(cmdr.credits));
                vaProxy.SetDecimal("Debt", cmdr == null ? (decimal?)null : cmdr.debt);
                vaProxy.SetText("Debt (spoken)", cmdr == null ? null : Translations.Humanize(cmdr.debt));

                vaProxy.SetText("Title", cmdr == null ? null : cmdr.title);

                vaProxy.SetDecimal("Insurance", cmdr == null ? null : cmdr.insurance);

                // Backwards-compatibility with 1.x
                vaProxy.SetText("System rank", cmdr == null ? null : cmdr.title);

                setStatus(ref vaProxy, "Operational");
            }
            catch (Exception e)
            {
                setStatus(ref vaProxy, "Failed to set commander information", e);
            }

            Logging.Debug("Set commander information");
        }
        private async Task BtnClickTask()
        {
            try
            {
                using (var client = new HttpClient())
                {
                    var resp = await client.GetAsync($"https://api2.nicehash.com/api/v2/organization/nhmqr/{_uuid}");

                    if (resp.IsSuccessStatusCode)
                    {
                        var contentString = await resp.Content.ReadAsStringAsync();

                        if (!string.IsNullOrEmpty(contentString))
                        {
                            var btcResp = JsonConvert.DeserializeObject <BtcResponse>(contentString);
                            if (btcResp.btc != null)
                            {
                                var ret = await ApplicationStateManager.SetBTCIfValidOrDifferent(btcResp.btc);

                                if (ret == ApplicationStateManager.SetResult.CHANGED)
                                {
                                    lbl_qr_status.Visibility = Visibility.Visible;
                                    btn_gen_qr.Visibility    = Visibility.Visible;
                                    lbl_qr_status.Content    = Translations.Tr("BTC Address was changed - this code is already used.");
                                }
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 19
0
        public static string _(string textToTranslate)
        {
            var show = string.Empty;

            if (string.IsNullOrEmpty(textToTranslate))
            {
                return("");
            }
            var textToTranslateToLower = textToTranslate.ToLower();

            if (Translations.ContainsKey(textToTranslateToLower))
            {
                show = Translations[textToTranslateToLower];
            }
            else if (Translations.ContainsKey(textToTranslate))
            {
                show = Translations[textToTranslate];
            }
            else
            {
                show = textToTranslate;
            }
            return(show);
        }
        private void RelhaxWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Logging.Debug("loading supported_clients from zip file");

            //parse each online folder to list type string
            VersionInfosList.Clear();
            string      xmlString        = FileUtils.GetStringFromZip(((App)Application.Current).ManagerInfoZipfile, ApplicationConstants.SupportedClients);
            XmlNodeList supportedClients = XmlUtils.GetXmlNodesFromXPath(xmlString, "//versions/version", ApplicationConstants.SupportedClients);

            VersionInfosList = new List <VersionInfos>();
            foreach (XmlNode node in supportedClients)
            {
                VersionInfos newVersionInfo = new VersionInfos()
                {
                    WoTOnlineFolderVersion = node.Attributes["folder"].Value,
                    WoTClientVersion       = node.InnerText
                };
                VersionInfosList.Add(newVersionInfo);
            }

            //load them into the list with tag holding info
            ExportSelectVersionPanel.Children.Clear();
            foreach (VersionInfos versionInfo in VersionInfosList)
            {
                RadioButton button = new RadioButton()
                {
                    Tag     = versionInfo,
                    Content = string.Format("{0} = {1}, {2} = {3}", Translations.GetTranslatedString("ExportModeMajorVersion"), versionInfo.WoTOnlineFolderVersion,
                                            Translations.GetTranslatedString("ExportModeMinorVersion"), versionInfo.WoTClientVersion)
                };
                ExportSelectVersionPanel.Children.Add(button);
            }

            //select the first one
            (ExportSelectVersionPanel.Children[0] as RadioButton).IsChecked = true;
        }
Ejemplo n.º 21
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX, y = 0.05;

            base.Draw(gr, area_width, area_height, rtl);

            gr.MoveTo(0.05, y);
            gr.SetPangoLargeFontSize();
            gr.ShowPangoText(Translations.GetString("Numbers"));
            y += 0.08;

            for (int n = 0; n < numbers.Length; n++)
            {
                gr.MoveTo(x, y);
                gr.ShowPangoText(numbers[n].ToString());
                gr.Stroke();
                x += 0.17;
            }

            y += 0.16;

            gr.MoveTo(0.05, y);
            gr.ShowPangoText(Translations.GetString("Possible divisors"));
        }
Ejemplo n.º 22
0
    public void setKey(Translations.Key newKey)
    {
        key = newKey;
        string txt = Translations.translateKey(key);
        if (upperCase) {
            txt = txt.ToUpper();
        }
        string text = Translations.wrapText(txt, lineLength);
        float bgscalex = (Translations.estimateLength(text) + 3) * (GetComponent<TextMesh>().characterSize + 0.5f);
        GetComponent<TextMesh>().text = text;
        if (background != null) {
            background.localScale = new Vector3(bgscalex, background.localScale.y, background.localScale.z);
        }

        Vector3 offset = new Vector3();

        if (horizontalAnchorPoint == HorizontalAlignment.LEFT) {
            offset.x = -bgscalex/2;
        } else if (horizontalAnchorPoint == HorizontalAlignment.RIGHT) {
            offset.x = bgscalex/2;
        }

        transform.position += offset;
    }
Ejemplo n.º 23
0
 /// <summary>
 /// Reset all sound events to the specified system sound sheme
 /// </summary>
 private void loadSystemScheme(bool warning, SoundScheme scheme)
 {
     if (!warning || MessageBox.Show(
             Translations.Get("reset_warn_text"),
             Translations.Get("reset_warn_title"),
             MessageBoxButtons.OKCancel,
             MessageBoxIcon.Warning
             ) == DialogResult.OK)
     {
         foreach (SoundEvent soundEvent in SoundEvent.GetAll())
         {
             SoundScheme.CopyDefault(soundEvent, scheme);
         }
         SchemeMeta.ResetAll();
         if (scheme != null)
         {
             SchemeMeta.Name   = scheme.ToString();
             SchemeMeta.Author = "";
             SchemeMeta.About  = "";
         }
         RefreshSchemeMetadata();
         imageContextMenu_Remove_Click(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Unlock Imageres and perform a backup
        /// </summary>
        public static void Backup()
        {
            if (SystemIsWindowsVista7)
            {
                if (File.Exists(Imageres))
                {
                    if (FileSystemAdmin.IsAdmin())
                    {
                        FileSystemAdmin.GrantAll(System32);
                        FileSystemAdmin.GrantAll(Imageres);

                        if (File.Exists(ImageresBak))
                        {
                            FileSystemAdmin.GrantAll(ImageresBak);
                        }
                        else
                        {
                            File.Move(Imageres, ImageresBak);
                            File.Copy(ImageresBak, Imageres);
                        }
                    }
                    else
                    {
                        throw new UnauthorizedAccessException(Translations.Get("startup_patch_not_admin"));
                    }
                }
                else
                {
                    throw new FileNotFoundException(Translations.Get("startup_patch_no_imageres_dll"));
                }
            }
            else
            {
                throw new InvalidOperationException(Translations.Get("startup_patch_not_windows7"));
            }
        }
Ejemplo n.º 25
0
 private void TestLoadImageLibrariesButton_Click(object sender, RoutedEventArgs e)
 {
     Logging.Info("Diagnostics: Test load image libraries");
     DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("loadingAtlasImageLibraries");
     Utils.AllowUIToUpdate();
     if (Utils.TestLoadAtlasLibraries(true))
     {
         DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("loadingAtlasImageLibrariesSuccess");
         Logging.Info("Diagnostics: Test load image libraries pass");
     }
     else
     {
         DiagnosticsStatusTextBox.Text = Translations.GetTranslatedString("loadingAtlasImageLibrariesFail");
         if (MessageBox.Show(string.Format("{0}\n{1}", Translations.GetTranslatedString("missingMSVCPLibraries"), Translations.GetTranslatedString("openLinkToMSVCP")),
                             Translations.GetTranslatedString("missingMSVCPLibrariesHeader"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             if (!Utils.StartProcess(Utils.MSVCPLink))
             {
                 Logging.Error("failed to open url to MSVCP: {0}", Utils.MSVCPLink);
             }
         }
         Logging.Info("Diagnostics: Test load image libraries fail");
     }
 }
Ejemplo n.º 26
0
        protected async override Task <BuildResult> OnClean(ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext)
        {
            isDirty = true;
            monitor.Log.WriteLine(GettextCatalog.GetString("Removing all .mo files."));
            string outputDirectory = GetOutputDirectory(configuration);

            if (string.IsNullOrEmpty(outputDirectory))
            {
                return(BuildResult.CreateSuccess());
            }

            var toClean = Translations.Select(t => t.GetOutFile(configuration)).ToArray();
            await Task.Run(delegate {
                foreach (string moFileName in toClean)
                {
                    if (File.Exists(moFileName))
                    {
                        File.Delete(moFileName);
                    }
                }
            });

            return(BuildResult.CreateSuccess());
        }
Ejemplo n.º 27
0
 public System.Collections.IEnumerator Parse(System.Collections.IEnumerator e)
 {
     while (e.MoveNext())
     {
         string a = (string)e.Current;
         if (Translations.TryGetValue(a, out var a2))
         {
             a = a2;
         }
         if (Handlers.TryGetValue(a, out var action))
         {
             action(e);
             if (NoMoreArg)
             {
                 return(null);
             }
         }
         else
         {
             return(e);
         }
     }
     return(null);
 }
Ejemplo n.º 28
0
 public lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation GetTranslation(Int32 idUserLanguage, Int32 idDefaultLanguage, Boolean firstIsMulti, Boolean useFirstOccurence)
 {
     lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation translation = null;
     if (Translations != null && Translations.Any(t => t.IdLanguage == idUserLanguage))
     {
         translation = Translations.Where(t => t.IdLanguage == idUserLanguage).FirstOrDefault().Translation;
     }
     if (translation == null && DefaultTranslation.IsValid() && firstIsMulti)
     {
         translation = DefaultTranslation;
     }
     if (translation == null && Translations.Any())
     {
         translation = Translations.Where(t => t.IdLanguage == idDefaultLanguage).FirstOrDefault().Translation;
     }
     if (translation == null && Translations.Any() && useFirstOccurence)
     {
         translation = Translations.FirstOrDefault().Translation;
     }
     return((translation == null) ? new lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation()
     {
         Name = Id.ToString()
     } : translation);
 }
Ejemplo n.º 29
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // Configure log4net from the info in Web.config
            log4net.Config.XmlConfigurator.Configure();
            _log.Info("Initializing GeositeFramework, version " + _geositeFrameworkVersion);

            // Load geosite configuration data (which loads and validates all config files)
            GeositeData = LoadGeositeData();

            // Create a logger for each plugin
            foreach (string pluginName in GeositeData.PluginFolderNames)
            {
                CreateLogger(pluginName);
            }

            // Prepare Languages for Internationalization
            Languages = PrepareLanguages(GeositeData);
        }
Ejemplo n.º 30
0
 public void SetNoDeviceAction()
 {
     ApplicationStateManager.NoDeviceAction = () =>
     {
         this.Dispatcher.Invoke(() =>
         {
             var nhmNoDeviceDialog = new CustomDialog()
             {
                 Title            = Translations.Tr("No Supported Devices"),
                 Description      = Translations.Tr("No supported devices are found. Select the OK button for help or cancel to continue."),
                 OkText           = Translations.Tr("OK"),
                 CancelText       = Translations.Tr("Cancel"),
                 AnimationVisible = Visibility.Collapsed
             };
             nhmNoDeviceDialog.OKClick += (s, e) => {
                 Process.Start(Links.NhmNoDevHelp);
             };
             nhmNoDeviceDialog.OnExit += (s, e) => {
                 ApplicationStateManager.ExecuteApplicationExit();
             };
             ShowContentAsModalDialog(nhmNoDeviceDialog);
         });
     };
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Translates the current step, according to the translation dictionary
 /// </summary>
 /// <param name="translationDictionary"></param>
 public void Translate(Translations.TranslationDictionary translationDictionary)
 {
     foreach (Step step in Steps)
     {
         step.Translate(translationDictionary);
     }
 }
Ejemplo n.º 32
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
 }
Ejemplo n.º 33
0
        protected override void Initialize()
        {
            string            variables;
            bool              variants;
            LocalizableString localizable_question, localizable_rationale;

            xml_drawing.CreateDrawingObjects(game.DrawingObjects);              // Draw objects shared by all variants

            if (game.Variants.Count > 0)
            {
                xml_drawing.CreateDrawingObjects(game.Variants[current.Variant].DrawingObjects);                  // Draw variant specific objects
            }
            compiler = ServiceLocator.Instance.GetService <ICSharpCompiler> ();

            variants = game.Variants.Count > 0;
            SetCheckAttributes();

            if (variants && game.Variants[current.Variant].Variables != null)
            {
                variables = game.Variants[current.Variant].Variables;
            }
            else
            {
                variables = game.Variables;
            }

            if (variants && game.Variants[current.Variant].Question != null)
            {
                localizable_question = game.Variants[current.Variant].Question;
            }
            else
            {
                localizable_question = game.Question;
            }

            if (variants && game.Variants[current.Variant].Rationale != null)
            {
                localizable_rationale = game.Variants[current.Variant].Rationale;
            }
            else
            {
                localizable_rationale = game.Rationale;
            }

            if (String.IsNullOrEmpty(variables) == false)
            {
                compiler.EvaluateCode(variables);

                try {
                    if (String.IsNullOrEmpty(localizable_question.Value) == false)
                    {
                        localizable_question.ValueComputed = Int32.Parse(ReplaceVariables(localizable_question.Value));
                    }

                    if (localizable_rationale != null && String.IsNullOrEmpty(localizable_rationale.Value) == false)
                    {
                        localizable_rationale.ValueComputed = Int32.Parse(ReplaceVariables(localizable_rationale.Value));
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("GameXml.Initialize. Error {0}", e);
                }
            }

            if (variants && game.Variants[current.Variant].Question != null)
            {
                question = CatalogGetString(game.Variants[current.Variant].Question);
            }
            else
            {
                question = CatalogGetString(game.Question);
            }

            if (variants && game.Variants[current.Variant].AnswerText != null)
            {
                answer = CatalogGetString(game.Variants[current.Variant].AnswerText);
            }
            else
            {
                answer = CatalogGetString(game.AnswerText);
            }

            if (variants && game.Variants[current.Variant].Rationale != null)
            {
                rationale = CatalogGetString(game.Variants[current.Variant].Rationale);
            }
            else
            {
                rationale = CatalogGetString(game.Rationale);
            }

            if (variants && game.Variants[current.Variant].AnswerShow != null)
            {
                answer_show = CatalogGetString(game.Variants[current.Variant].AnswerShow);
            }
            else
            {
                answer_show = CatalogGetString(game.AnswerShow);
            }

            if (String.IsNullOrEmpty(variables) == false)
            {
                question    = ReplaceVariables(question);
                rationale   = ReplaceVariables(rationale);
                answer      = ReplaceVariables(answer);
                answer_show = ReplaceVariables(answer_show);
            }

            int option_answer = xml_drawing.GetOptionCorrectAnswerIndex();

            if (option_answer != -1)
            {
                Answer.SetMultiOptionAnswer(option_answer, answer);

                // Translators {0}: list of options (A, B, C)
                string answers = String.Format(Translations.GetString("Answer {0}."),
                                               Answer.GetMultiOptionsPossibleAnswers(xml_drawing.Options.Count));
                question = question.Replace(option_answers, answers);
            }
            else
            {
                Answer.Correct = answer;
            }

            SetCheckExpression();
            SetAnswerCorrectShow();
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Handle Forge plugin messages (Forge Protocol version 1: FML)
        /// </summary>
        /// <param name="channel">Plugin message channel</param>
        /// <param name="packetData">Plugin message data</param>
        /// <param name="currentDimension">Current world dimension</param>
        /// <returns>TRUE if the plugin message was recognized and handled</returns>
        public bool HandlePluginMessage(string channel, Queue <byte> packetData, ref int currentDimension)
        {
            if (ForgeEnabled() && forgeInfo.Version == FMLVersion.FML && fmlHandshakeState != FMLHandshakeClientState.DONE)
            {
                if (channel == "FML|HS")
                {
                    FMLHandshakeDiscriminator discriminator = (FMLHandshakeDiscriminator)dataTypes.ReadNextByte(packetData);

                    if (discriminator == FMLHandshakeDiscriminator.HandshakeReset)
                    {
                        fmlHandshakeState = FMLHandshakeClientState.START;
                        return(true);
                    }

                    switch (fmlHandshakeState)
                    {
                    case FMLHandshakeClientState.START:
                        if (discriminator != FMLHandshakeDiscriminator.ServerHello)
                        {
                            return(false);
                        }

                        // Send the plugin channel registration.
                        // REGISTER is somewhat special in that it doesn't actually include length information,
                        // and is also \0-separated.
                        // Also, yes, "FML" is there twice.  Don't ask me why, but that's the way forge does it.
                        string[] channels = { "FML|HS", "FML", "FML|MP", "FML", "FORGE" };
                        protocol18.SendPluginChannelPacket("REGISTER", Encoding.UTF8.GetBytes(string.Join("\0", channels)));

                        byte fmlProtocolVersion = dataTypes.ReadNextByte(packetData);

                        if (Settings.DebugMessages)
                        {
                            ConsoleIO.WriteLineFormatted(Translations.Get("forge.version", fmlProtocolVersion));
                        }

                        if (fmlProtocolVersion >= 1)
                        {
                            currentDimension = dataTypes.ReadNextInt(packetData);
                        }

                        // Tell the server we're running the same version.
                        SendForgeHandshakePacket(FMLHandshakeDiscriminator.ClientHello, new byte[] { fmlProtocolVersion });

                        // Then tell the server that we're running the same mods.
                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLineFormatted("forge.send_mod");
                        }
                        byte[][] mods = new byte[forgeInfo.Mods.Count][];
                        for (int i = 0; i < forgeInfo.Mods.Count; i++)
                        {
                            ForgeInfo.ForgeMod mod = forgeInfo.Mods[i];
                            mods[i] = dataTypes.ConcatBytes(dataTypes.GetString(mod.ModID), dataTypes.GetString(mod.Version));
                        }
                        SendForgeHandshakePacket(FMLHandshakeDiscriminator.ModList,
                                                 dataTypes.ConcatBytes(dataTypes.GetVarInt(forgeInfo.Mods.Count), dataTypes.ConcatBytes(mods)));

                        fmlHandshakeState = FMLHandshakeClientState.WAITINGSERVERDATA;

                        return(true);

                    case FMLHandshakeClientState.WAITINGSERVERDATA:
                        if (discriminator != FMLHandshakeDiscriminator.ModList)
                        {
                            return(false);
                        }

                        Thread.Sleep(2000);

                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLineFormatted("forge.accept");
                        }
                        // Tell the server that yes, we are OK with the mods it has
                        // even though we don't actually care what mods it has.

                        SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
                                                 new byte[] { (byte)FMLHandshakeClientState.WAITINGSERVERDATA });

                        fmlHandshakeState = FMLHandshakeClientState.WAITINGSERVERCOMPLETE;
                        return(false);

                    case FMLHandshakeClientState.WAITINGSERVERCOMPLETE:
                        // The server now will tell us a bunch of registry information.
                        // We need to read it all, though, until it says that there is no more.
                        if (discriminator != FMLHandshakeDiscriminator.RegistryData)
                        {
                            return(false);
                        }

                        if (protocolversion < Protocol18Handler.MC18Version)
                        {
                            // 1.7.10 and below have one registry
                            // with blocks and items.
                            int registrySize = dataTypes.ReadNextVarInt(packetData);

                            if (Settings.DebugMessages)
                            {
                                ConsoleIO.WriteLineFormatted(Translations.Get("forge.registry", registrySize));
                            }

                            fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
                        }
                        else
                        {
                            // 1.8+ has more than one registry.

                            bool   hasNextRegistry = dataTypes.ReadNextBool(packetData);
                            string registryName    = dataTypes.ReadNextString(packetData);
                            int    registrySize    = dataTypes.ReadNextVarInt(packetData);
                            if (Settings.DebugMessages)
                            {
                                ConsoleIO.WriteLineFormatted(Translations.Get("forge.registry_2", registryName, registrySize));
                            }
                            if (!hasNextRegistry)
                            {
                                fmlHandshakeState = FMLHandshakeClientState.PENDINGCOMPLETE;
                            }
                        }

                        return(false);

                    case FMLHandshakeClientState.PENDINGCOMPLETE:
                        // The server will ask us to accept the registries.
                        // Just say yes.
                        if (discriminator != FMLHandshakeDiscriminator.HandshakeAck)
                        {
                            return(false);
                        }
                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLineFormatted("forge.accept_registry");
                        }
                        SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
                                                 new byte[] { (byte)FMLHandshakeClientState.PENDINGCOMPLETE });
                        fmlHandshakeState = FMLHandshakeClientState.COMPLETE;

                        return(true);

                    case FMLHandshakeClientState.COMPLETE:
                        // One final "OK".  On the actual forge source, a packet is sent from
                        // the client to the client saying that the connection was complete, but
                        // we don't need to do that.

                        SendForgeHandshakePacket(FMLHandshakeDiscriminator.HandshakeAck,
                                                 new byte[] { (byte)FMLHandshakeClientState.COMPLETE });
                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLine("forge.complete");
                        }
                        fmlHandshakeState = FMLHandshakeClientState.DONE;
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 35
0
 public static void Reset()
 {
     _translationsList = null;
     _inited = false;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Translates the frame according to the translation dictionary provided
 /// </summary>
 /// <param name="translationDictionary"></param>
 public void Translate(Translations.TranslationDictionary translationDictionary)
 {
     foreach (SubSequence subSequence in SubSequences)
     {
         subSequence.Translate(translationDictionary);
     }
 }
Ejemplo n.º 37
0
 public void TranslateAndSizeButton(Button btn, Text txt, Translate translateComponent, Translations tr)
 {
     txt.text = tr.Get(translateComponent.key);
     btn.image.rectTransform.sizeDelta = new Vector2(btn.GetComponentInChildren<Text>().preferredWidth + spaceWidth, spaceHeight);
 }
Ejemplo n.º 38
0
    public void ShowEndButton()
    {
        //treści - Liczba punktów/skuteczność/liczba żyć       
        //LiveTxt.rectTransform.sizeDelta = new Vector2(LiveTxt.GetComponent<Text>().preferredWidth + 80, 70);
        //SuccesTxt.rectTransform.sizeDelta = new Vector2(LiveTxt.GetComponent<Text>().preferredWidth + 80, 70);
        //ScoreTxt.rectTransform.sizeDelta = new Vector2(LiveTxt.GetComponent<Text>().preferredWidth + 80, 70);
        // przyciski                
        translateComponentLeft = LeftButtonText.gameObject.AddComponent<Translate>();
        translateComponentRight = RightButtonText.gameObject.AddComponent<Translate>();
        trLeft = gameObject.AddComponent<Translations>();
        trRight = gameObject.AddComponent<Translations>();

        if (isTraining == IsTraining.NoTraining)
        {
            // ***** komentarze potrzebne do starej wersji treningów *****
            if (currentLevelStatus == LevelStatus.Fail)
            {
                if (failCount >= 3 && level > 1)
                {
                    LeftButton.gameObject.SetActive(true);
                    RightButton.gameObject.SetActive(true);
                    // again                    
                    translateComponentLeft.key = "statsRestart";
                    TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                    //prev
                    translateComponentRight.key = "statsPreviousLevel";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                }

                if (failCount < 3)
                {
                    //again
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "statsRestart";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                }
                if (level == 1)
                {
                    //again
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "statsRestart";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                }
            }
            if (currentLevelStatus == LevelStatus.Success)
            {
                if (level < 10)
                {
                    //again
                    LeftButton.gameObject.SetActive(true);
                    translateComponentLeft.key = "statsRestart";
                    TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                    //next
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "statsNextLevel";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                }
                else
                {
                    LeftButton.gameObject.SetActive(false);

                    //again
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "statsRestart";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                }
            }
        }
        if (isTraining == IsTraining.Inside)
        {
            
            if (currentLevelStatus == LevelStatus.Success)
            {
                if (level < 10)
                {
                    //next
                    //LeftButton.gameObject.SetActive(true);
                    //translateComponentLeft.key = "statsNextLevel";
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);

                    //continue
                    LeftButton.gameObject.SetActive(false);
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "continueTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                }
                else
                { 
                    //continue
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "continueTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                    // again
                    //LeftButton.gameObject.SetActive(true);
                    //translateComponentLeft.key = "statsRestart";
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }
            }
            if (currentLevelStatus == LevelStatus.Fail)
            {
                if (failCount >= 3 && level > 1)
                {
                    LeftButton.gameObject.SetActive(false);
                    RightButton.gameObject.SetActive(true);

                    //continue
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "continueTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                    //prev
                    //translateComponentLeft.key = "statsPreviousLevel";
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }

                if (failCount < 3)
                {
                    //continue
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "continueTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                   
                    // again
                    //translateComponentLeft.key = "statsRestart";                  
                   // TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }
                if (level == 1)
                {
                    //continue
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "continueTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);

                    // again
                    //translateComponentLeft.key = "statsRestart";                    
                  //  TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);

                }
            }
        }
        else if (isTraining == IsTraining.Last)
        {
            
            if (currentLevelStatus == LevelStatus.Success)
            {
                if (level < 10)
                {
                    //next
                    //LeftButton.gameObject.SetActive(true);
                    //translateComponentLeft.key = "statsNextLevel";                    
                   // TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                    LeftButton.gameObject.SetActive(false);

                    //end
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "endTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                }
                else
                {                    
                    //end
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "endTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                    // again
                    //LeftButton.gameObject.SetActive(true);
                    //translateComponentLeft.key = "statsRestart";                   
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }
            }
            if (currentLevelStatus == LevelStatus.Fail)
            {
                if (failCount >= 3 && level > 1)
                {   
                    //end
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "endTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);

                    LeftButton.gameObject.SetActive(false);
                    //prev
                    //translateComponentLeft.key = "statsPreviousLevel";
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }

                if (failCount < 3)
                {
                    //end
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "endTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);
                   
                    // again
                    //translateComponentLeft.key = "statsRestart";
                    //TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);
                }
                if (level == 1)
                {
                    //end
                    RightButton.gameObject.SetActive(true);
                    translateComponentRight.key = "endTraining";
                    TranslateAndSizeButton(RightButton, RightButtonText, translateComponentRight, trRight);
                    LeftButton.gameObject.SetActive(false);

                    

                    // again
                    //translateComponentLeft.key = "statsRestart";
                   // TranslateAndSizeButton(LeftButton, LeftButtonText, translateComponentLeft, trLeft);

                }
            }
        }
    }
 public PublicInternational()
 {
     Translation = new Translations();
 }
Ejemplo n.º 40
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblHeader.Text = stringTable.RetrieveTranslation(Translations.MessageType.RulesHeader);
     rtbRules.Text = stringTable.RetrieveTranslation(Translations.MessageType.RulesLoading);
 }
Ejemplo n.º 41
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblHeader.Text = stringTable.RetrieveTranslation(Translations.MessageType.LicenseHeader);
     rtbLicense.Text = stringTable.RetrieveTranslation(Translations.MessageType.LicenseLoading);
 }
Ejemplo n.º 42
0
        private void PopulateGrid()
        {
            ((GridView)gridControl1.MainView).Columns.Clear();
            Translations tr = new Translations(_file);
            _dt = tr.GetData();
            foreach (DataColumn item in _dt.Columns)
            {
                GridColumn column = ((GridView)gridControl1.MainView).Columns.Add();
                column.Caption = item.Caption;
                column.FieldName = item.ColumnName;
                column.Visible = true;

            #if DEBUG
            #else
                if (column.FieldName == "Key" || column.FieldName == "ENG")
                {
                    column.OptionsColumn.AllowEdit = false;
                    column.OptionsColumn.AllowShowHide = false;
                    column.OptionsColumn.ReadOnly = true;
                }
            #endif
            }

            gridControl1.DataSource = _dt;
        }
Ejemplo n.º 43
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblHeader.Text = stringTable.RetrieveTranslation(Translations.MessageType.InstallCompleteHeader);
     lblMessage.Text = stringTable.RetrieveTranslation(Translations.MessageType.InstallCompleteMessage);
 }
Ejemplo n.º 44
0
        /// <summary>Loads a custom plugin for the specified train.</summary>
        /// <param name="trainFolder">The absolute path to the train folder.</param>
        /// <param name="encoding">The encoding to be used.</param>
        /// <returns>Whether the plugin was loaded successfully.</returns>
        public bool LoadCustomPlugin(string trainFolder, System.Text.Encoding encoding)
        {
            string config = OpenBveApi.Path.CombineFile(trainFolder, "ats.cfg");

            if (!System.IO.File.Exists(config))
            {
                return(false);
            }

            string Text = System.IO.File.ReadAllText(config, encoding);

            Text = Text.Replace("\r", "").Replace("\n", "");
            if (Text.Length > 260)
            {
                /*
                 * String length is over max Windows path length, so
                 * comments or ATS plugin docs have been included in here
                 * e.g dlg70v40
                 */
                string[] fileLines = System.IO.File.ReadAllLines(config);
                for (int i = 0; i < fileLines.Length; i++)
                {
                    int commentStart = fileLines[i].IndexOf(';');
                    if (commentStart != -1)
                    {
                        fileLines[i] = fileLines[i].Substring(0, commentStart);
                    }

                    fileLines[i] = fileLines[i].Trim();
                    if (fileLines[i].Length != 0)
                    {
                        Text = fileLines[i];
                        break;
                    }
                }
            }

            string file;

            try
            {
                file = OpenBveApi.Path.CombineFile(trainFolder, Text);
            }
            catch
            {
                TrainManagerBase.currentHost.AddMessage(MessageType.Error, true, "The train plugin path was malformed in " + config);
                return(false);
            }

            string title = System.IO.Path.GetFileName(file);

            if (!System.IO.File.Exists(file))
            {
                if (Text.EndsWith(".dll") && encoding.Equals(System.Text.Encoding.Unicode))
                {
                    // Our filename ends with .dll so probably is not mangled Unicode
                    TrainManagerBase.currentHost.AddMessage(MessageType.Error, true, "The train plugin " + title + " could not be found in " + config);
                    return(false);
                }

                // Try again with ASCII encoding
                Text = System.IO.File.ReadAllText(config, System.Text.Encoding.GetEncoding(1252));
                Text = Text.Replace("\r", "").Replace("\n", "");
                try
                {
                    file = OpenBveApi.Path.CombineFile(trainFolder, Text);
                }
                catch
                {
                    TrainManagerBase.currentHost.AddMessage(MessageType.Error, true, "The train plugin path was malformed in " + config);
                    return(false);
                }

                title = System.IO.Path.GetFileName(file);
                if (!System.IO.File.Exists(file))
                {
                    // Nope, still not found
                    TrainManagerBase.currentHost.AddMessage(MessageType.Error, true, "The train plugin " + title + " could not be found in " + config);
                    return(false);
                }
            }

            TrainManagerBase.currentHost.AddMessage(MessageType.Information, false, "Loading train plugin: " + file);
            bool success = LoadPlugin(file, trainFolder);

            if (success == false)
            {
                TrainManagerBase.PluginError = Translations.GetInterfaceString("errors_plugin_failure1").Replace("[plugin]", file);
            }
            else
            {
                TrainManagerBase.currentHost.AddMessage(MessageType.Information, false, "Train plugin loaded successfully.");
            }

            return(success);
        }
Ejemplo n.º 45
0
        private void Build()
        {
            WindowPosition = WindowPosition.CenterOnParent;
            Resizable      = false;

            const int spacing = 6;
            var       hbox1   = new HBox()
            {
                Spacing = spacing
            };

            hbox1.PackStart(new Label(Translations.GetString("Transfer Map")), false, false, 0);
            hbox1.PackStart(new HSeparator(), true, true, 0);
            ContentArea.PackStart(hbox1, false, false, 0);

            var hbox2 = new HBox()
            {
                Spacing = spacing
            };

            comboMap = new ComboBoxText();
            comboMap.AppendText(Translations.GetString("RGB"));
            comboMap.AppendText(Translations.GetString("Luminosity"));
            comboMap.Active = 1;
            hbox2.PackStart(comboMap, false, false, 0);

            labelPoint = new Label("(256, 256)");
            var labelAlign = new Alignment(1, 0.5f, 1, 0);

            labelAlign.Add(labelPoint);
            hbox2.PackEnd(labelAlign, false, false, 0);
            ContentArea.PackStart(hbox2, false, false, 0);

            drawing = new DrawingArea()
            {
                WidthRequest  = 256,
                HeightRequest = 256,
                Events        = (Gdk.EventMask) 795646,
                CanFocus      = true
            };
            ContentArea.PackStart(drawing, false, false, 8);

            var hbox3 = new HBox();

            checkRed = new CheckButton(Translations.GetString("Red  "))
            {
                Active = true
            };
            checkGreen = new CheckButton(Translations.GetString("Green"))
            {
                Active = true
            };
            checkBlue = new CheckButton(Translations.GetString("Blue "))
            {
                Active = true
            };
            hbox3.PackStart(checkRed, false, false, 0);
            hbox3.PackStart(checkGreen, false, false, 0);
            hbox3.PackStart(checkBlue, false, false, 0);

            buttonReset = new Button()
            {
                WidthRequest  = 81,
                HeightRequest = 30,
                Label         = Translations.GetString("Reset")
            };
            hbox3.PackEnd(buttonReset, false, false, 0);
            ContentArea.PackStart(hbox3, false, false, 0);

            labelTip = new Label(Translations.GetString("Tip: Right-click to remove control points."));
            ContentArea.PackStart(labelTip, false, false, 0);

            ContentArea.ShowAll();
            checkRed.Hide();
            checkGreen.Hide();
            checkBlue.Hide();
        }
Ejemplo n.º 46
0
        /// <summary>
        /// Handle Forge plugin messages during login phase (Forge Protocol version 2: FML2)
        /// </summary>
        /// <param name="channel">Plugin message channel</param>
        /// <param name="packetData">Plugin message data</param>
        /// <param name="responseData">Response data to return to server</param>
        /// <returns>TRUE/FALSE depending on whether the packet was understood or not</returns>
        public bool HandleLoginPluginRequest(string channel, Queue <byte> packetData, ref List <byte> responseData)
        {
            if (ForgeEnabled() && forgeInfo.Version == FMLVersion.FML2 && channel == "fml:loginwrapper")
            {
                // Forge Handshake handler source code used to implement the FML2 packets:
                // https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/network/FMLNetworkConstants.java
                // https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/network/FMLHandshakeHandler.java
                // https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/network/NetworkInitialization.java
                // https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/network/FMLLoginWrapper.java
                // https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/network/FMLHandshakeMessages.java
                //
                // During Login, Forge will send a set of LoginPluginRequest packets and we need to respond accordingly.
                // Each login plugin message contains in its payload field an inner packet created by FMLLoginWrapper.java:
                //
                // [ ResourceLocation ][ String ] // FML Channel name
                // [   Inner Packet   ][ Packet ] // Minecraft-Like packet
                //
                // The channel name allows identifying which handler in Forge will process the packet
                // For instance, the handshake channel is fml:handshake as per FMLNetworkConstants.java
                //
                // The inner packet has the same layout as a Minecraft packet.
                // Forge uses Minecraft's PacketBuffer class to decode the packet.
                // We assume no network compression is active at this point.
                //
                // [  Length  ][ VarInt ]
                // [ PacketID ][ VarInt ]
                // [   Data   ][  ....  ]
                //
                // Once decoded, the packet ID for fml:handshake is mapped in NetworkInitialization.java:
                //
                // 99 = Client to Server - Client ACK
                // 1 = Server to Client - Mod List
                // 2 = Client to Server - Mod List
                // 3 = Server to Client - Registry
                // 4 = Server to Client - Config
                //
                // The content of each message is mapped into a class inside FMLHandshakeMessages.java
                // FMLHandshakeHandler will then process the packet, e.g. handleServerModListOnClient() for Server Mod List.

                string fmlChannel = dataTypes.ReadNextString(packetData);
                dataTypes.ReadNextVarInt(packetData); // Packet length
                int packetID = dataTypes.ReadNextVarInt(packetData);

                if (fmlChannel == "fml:handshake")
                {
                    bool        fmlResponseReady  = false;
                    List <byte> fmlResponsePacket = new List <byte>();

                    switch (packetID)
                    {
                    case 1:
                        // Server Mod List: FMLHandshakeMessages.java > S2CModList > decode()
                        //
                        // [      Mod Count ][ VarInt ]
                        //      [  Mod Name ][ String ]  // Amount of entries according to Mod Count
                        // [  Channel Count ][ VarInt ]
                        //      [ Chan Name ][ String ]  // Amount of entries according to Channel Count
                        //      [   Version ][ String ]  // Each entry is a pair of Channel Name + Version (1)
                        // [ Registry Count ][ VarInt ]
                        //      [  Registry ][ String ]  // Amount of entries according to Registry Count
                        //
                        // [1]: Version is usually set to "FML2" for FML stuff and "1" for mods

                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLineFormatted("forge.fml2.mod");
                        }

                        List <string> mods     = new List <string>();
                        int           modCount = dataTypes.ReadNextVarInt(packetData);
                        for (int i = 0; i < modCount; i++)
                        {
                            mods.Add(dataTypes.ReadNextString(packetData));
                        }

                        Dictionary <string, string> channels = new Dictionary <string, string>();
                        int channelCount = dataTypes.ReadNextVarInt(packetData);
                        for (int i = 0; i < channelCount; i++)
                        {
                            channels.Add(dataTypes.ReadNextString(packetData), dataTypes.ReadNextString(packetData));
                        }

                        List <string> registries    = new List <string>();
                        int           registryCount = dataTypes.ReadNextVarInt(packetData);
                        for (int i = 0; i < registryCount; i++)
                        {
                            registries.Add(dataTypes.ReadNextString(packetData));
                        }

                        // Server Mod List Reply: FMLHandshakeMessages.java > C2SModListReply > encode()
                        //
                        // [      Mod Count ][ VarInt ]
                        //      [  Mod Name ][ String ]  // Amount of entries according to Mod Count
                        // [  Channel Count ][ VarInt ]
                        //      [ Chan Name ][ String ]  // Amount of entries according to Channel Count
                        //      [   Version ][ String ]  // Each entry is a pair of Channel Name + Version
                        // [ Registry Count ][ VarInt ]
                        //      [  Registry ][ String ]  // Amount of entries according to Registry Count
                        //      [   Version ][ String ]  // Each entry is a pair of Registry Name + Version
                        //
                        // We are supposed to validate server info against our set of installed mods, then reply with our list
                        // In MCC, we just want to send a valid response so we'll reply back with data collected from the server.

                        if (Settings.DebugMessages)
                        {
                            Translations.WriteLineFormatted("forge.fml2.mod_send");
                        }

                        // Packet ID 2: Client to Server Mod List
                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(2));
                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(mods.Count));
                        foreach (string mod in mods)
                        {
                            fmlResponsePacket.AddRange(dataTypes.GetString(mod));
                        }

                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(channels.Count));
                        foreach (KeyValuePair <string, string> item in channels)
                        {
                            fmlResponsePacket.AddRange(dataTypes.GetString(item.Key));
                            fmlResponsePacket.AddRange(dataTypes.GetString(item.Value));
                        }

                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(registries.Count));
                        foreach (string registry in registries)
                        {
                            fmlResponsePacket.AddRange(dataTypes.GetString(registry));
                            // We don't have Registry mapping from server, leave it empty
                            fmlResponsePacket.AddRange(dataTypes.GetString(""));
                        }
                        fmlResponseReady = true;
                        break;

                    case 3:
                        // Server Registry: FMLHandshakeMessages.java > S2CRegistry > decode()
                        //
                        // [    Registry Name ][ String ]
                        // [ Snapshot Present ][  Bool  ]
                        //    [ Snapshot data ][  ....  ] // Only if "Snapshot Present" is True
                        //
                        // Registry Snapshot: ForgeRegistry.java > Snapshot > read(PacketBuffer)
                        // Not documented yet. We're ignoring this packet in MCC

                        if (Settings.DebugMessages)
                        {
                            string registryName = dataTypes.ReadNextString(packetData);
                            ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.registry", registryName));
                        }

                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
                        fmlResponseReady = true;
                        break;

                    case 4:
                        // Server Config: FMLHandshakeMessages.java > S2CConfigData > decode()
                        //
                        // [ Config Name ][ String ]
                        // [ Config Data ][  ....  ] // Remaining packet data (1)
                        //
                        // [1] Config data may containt a standard Minecraft string readable with dataTypes.readNextString()
                        // We're ignoring this packet in MCC

                        if (Settings.DebugMessages)
                        {
                            string configName = dataTypes.ReadNextString(packetData);
                            ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.config", configName));
                        }

                        fmlResponsePacket.AddRange(dataTypes.GetVarInt(99));
                        fmlResponseReady = true;
                        break;

                    default:
                        if (Settings.DebugMessages)
                        {
                            ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.unknown", packetID));
                        }
                        break;
                    }

                    if (fmlResponseReady)
                    {
                        // Wrap our FML packet into a LoginPluginResponse payload
                        responseData.Clear();
                        responseData.AddRange(dataTypes.GetString(fmlChannel));
                        responseData.AddRange(dataTypes.GetVarInt(fmlResponsePacket.Count));
                        responseData.AddRange(fmlResponsePacket);
                        return(true);
                    }
                }
                else if (Settings.DebugMessages)
                {
                    ConsoleIO.WriteLineFormatted(Translations.Get("forge.fml2.unknown_channel", fmlChannel));
                }
            }
            return(false);
        }
Ejemplo n.º 47
0
        /// <summary>
        /// Translates the current step according to the translation dictionary
        /// Removes all preconditions, actions and expectations
        /// </summary>
        /// <param name="translationDictionary"></param>
        public void Translate(Translations.TranslationDictionary translationDictionary)
        {
            if (getTranslationRequired())
            {
                SubSteps.Clear();

                Translations.Translation translation = translationDictionary.findTranslation(getDescription());
                if (translation != null)
                {
                    translation.UpdateStep(this);
                    setTranslated(true);
                }
            }
        }
Ejemplo n.º 48
0
        protected override void Initialize()
        {
            double pos_x = 0, sel_width;

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
            gametype = (GameType)random.Next((int)GameType.Last + 1);

            switch (gametype)
            {
            case GameType.Equations:
                pos_x     = 0.1;
                sel_width = 0.5;
                equations = equations_a;
                break;

            case GameType.Numbers:
            {
                int    num, evens;
                int [] seeds = { 25, 26, 28, 30, 18, 21, 22 };
                ArrayListIndicesRandom random_seeds = new ArrayListIndicesRandom(seeds.Length);

                pos_x     = 0.2;
                sel_width = 0.32;
                // Make sure that one of the numbers only is not even or odd to avoid
                // this rationale as valid answer too
                do
                {
                    evens = 0;
                    random_seeds.Initialize();

                    equations = new string [max_equations];
                    for (int i = 0; i < max_equations - 1; i++)
                    {
                        num           = seeds [random_seeds [i]];
                        equations [i] = num.ToString() + (num * num).ToString();
                        if (num % 2 == 0)
                        {
                            evens++;
                        }
                    }
                    num = seeds [random_seeds [max_equations - 1]];
                    equations [max_equations - 1] = num.ToString() + ((num * num) - 20).ToString();

                    if (num % 2 == 0)
                    {
                        evens++;
                    }
                } while (evens <= 1 || max_equations - evens <= 1 /* odds */);
                break;
            }

            default:
                throw new InvalidOperationException();
            }

            random_indices = new ArrayListIndicesRandom(equations.Length);
            random_indices.Initialize();

            for (int i = 0; i < random_indices.Count; i++)
            {
                if (random_indices[i] == wrong_answer)
                {
                    Answer.SetMultiOptionAnswer(i, Answer.GetFigureName(i));
                    break;
                }
            }

            Container container = new Container(DrawAreaX + pos_x, DrawAreaY + 0.2, 0.5, random_indices.Count * 0.1);

            AddWidget(container);

            for (int i = 0; i < random_indices.Count; i++)
            {
                DrawableArea drawable_area = new DrawableArea(sel_width, 0.1);
                drawable_area.X = DrawAreaX + pos_x;
                drawable_area.Y = DrawAreaY + 0.2 + i * 0.1;
                container.AddChild(drawable_area);
                drawable_area.Data   = i;
                drawable_area.DataEx = Answer.GetMultiOption(i);

                drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e)
                {
                    int n = (int)e.Data;

                    e.Context.SetPangoLargeFontSize();
                    e.Context.MoveTo(0.05, 0.02);
                    // Translators: this "option) answer" for example "a) "21 x 60 = 1260". This should not be changed for most of the languages
                    e.Context.ShowPangoText(String.Format(Translations.GetString("{0}) {1}"), Answer.GetMultiOption(n), equations [random_indices[n]]));
                };
            }
        }
Ejemplo n.º 49
0
 public void UpdateText(Translations.IStringTable stringTable)
 {
     lblInstallReady.Text = "The installer is now ready to start installation. Click 'Next' to install the selected components.";//stringTable.RetrieveTranslation(Translations.MessageType.WelcomeMessage);
 }
Ejemplo n.º 50
0
 private void OnGetTranslation(Translations translation, Dictionary <string, object> customData)
 {
     Log.Debug("ExampleLanguageTranslator.OnGetTranslation()", "Langauge Translator - Translate Response: {0}", customData["json"].ToString());
     _getTranslationTested = true;
 }
Ejemplo n.º 51
0
 public void Add(Translations translations)
 {
     _translations.Add(translations);
     _items.AddRange(translations.Select(kv => new Tuple<string, string, string>(translations.Language, kv.Key, kv.Value)));
 }