Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            globalResourceSet = new ResXResourceSet(Auxiliary.ResxFilePath + "Resources.resx");
            cul = CultureInfo.CreateSpecificCulture(globalResourceSet.GetString("Resource"));
            if (globalResourceSet.GetString("Resource") == "ru")
            {
                lang = Language.ru;
            }
            else if (globalResourceSet.GetString("Resource") == "en")
            {
                lang = Language.en;
            }

            Switch_lang();
            ChangeAllText();

            buttonEng.FlatAppearance.BorderSize = 0;
            buttonEng.FlatStyle = FlatStyle.Flat;
            buttonRus.FlatAppearance.BorderSize = 0;
            buttonRus.FlatStyle = FlatStyle.Flat;

            ParseIniFile();

            colNames = new List <string>();
            colNames.Add("column name");
            colNames.Add("type");
            colNames.Add("is nullable");
            tablesDict = new Dictionary <string, DataTable>();
            comboBoxExpr.Items.AddRange(procedureExpresions.ToArray());
            comboBoxExpr.SelectedIndex = 0;
        }
Пример #2
0
        public ScanUploadToGoogle()
        {
            resxSet = new ResXResourceSet(resxFile);

            InitializeComponent();

            this.Text = resxSet.GetString("app_title");;

            int lngNum;

            dynamicDotNetTwain.OpenSourceManager();
            for (lngNum = 0; lngNum < dynamicDotNetTwain.SourceCount; lngNum++)
            {
                cmbSource.Items.Add(dynamicDotNetTwain.SourceNameItems(Convert.ToInt16(lngNum)));
            }
            if (lngNum > 0)
            {
                cmbSource.SelectedIndex = 0;
            }

            dynamicDotNetTwain.IfThrowException = true;

            IfInsertEnable();

            this.cmdUpload.Text     = resxSet.GetString("button_upload");
            this.progressBar1.Style = ProgressBarStyle.Marquee;
            this.progressBar1.MarqueeAnimationSpeed = 30;
            this.progressBar1.Hide();

            dynamicDotNetTwain.OnPostAllTransfers += dynamicDotNetTwain_OnPostAllTransfers;
        }
Пример #3
0
        public HeadForm()
        {
            InitializeComponent();

            string Language = string.Empty;

            try
            {
                Language = string.Format(@".\Resources\Languages\{0}.resx", ConfigurationManager.AppSettings[WhatLanguageIsActivate.ThisLanguage].ToString());
            }
            catch { }

            try
            {
                if (!string.IsNullOrWhiteSpace(Language))
                {
                    using (ResXResourceSet x = new ResXResourceSet(Language))
                    {
                        DevicesInService   = x.GetString("DevicesInService");
                        DevicesInCompleted = x.GetString("DevicesInCompleted");
                        dataGridView1.Columns["Column1"].HeaderText = x.GetString("Summary");
                        SettingsBox.Text = x.GetString("Setting");
                    }
                }
            }
            catch { }

            mainForm.Show();
            dataGridView1.RowHeadersVisible = false;
            WhatsMyStatus(mainForm.DevicesInService, mainForm.CompletedDevices);
        }
Пример #4
0
        public void CleanupAndRegenerate()
        {
            string path = Combine(Files.GetExecutingPath(), "Resources", "TestResourceResX.resx");
            var    rs   = new ResXResourceSet(path, null);

            // in safe mode, raw value is expected
            rs.SafeMode = true;
            Assert.AreEqual("576, 17", rs.GetString("TestPoint"));

            // in non-safe mode, raw value is cleared once an object is generated
            rs.SafeMode = false;
            Assert.AreEqual(new Point(576, 17), rs.GetObject("TestPoint"));

            // when safe mode is turned on again, raw value is re-generated
            rs.SafeMode = true;
            Assert.AreEqual("576, 17", rs.GetString("TestPoint"));

            // for fileref, in safe mode, path/type is expected
            Assert.IsTrue(rs.GetString("TestBinFile").StartsWith("TestBinFile.bin;System.Byte[], mscorlib", StringComparison.Ordinal));

            // in non-safe mode, raw value is cleared once an object is generated
            rs.SafeMode = false;
            Assert.AreEqual(typeof(byte[]), rs.GetObject("TestBinFile").GetType());

            // when safe mode is turned on again, raw value is re-generated from fileRef
            rs.SafeMode = true;
            Assert.IsTrue(rs.GetString("TestBinFile").StartsWith("TestBinFile.bin;System.Byte[], mscorlib", StringComparison.Ordinal));
        }
Пример #5
0
        private void CategoryForm_Load(object sender, EventArgs e)
        {
            using (ResXResourceSet resxSet = new ResXResourceSet(resxFile))
            {
                acess_token = resxSet.GetString("acess_token");
                var second_name = resxSet.GetString("second_name");


                var response = Person.GetUserInfo(acess_token, second_name);
                Root <List <Discipline> > discipline = JsonConvert.DeserializeObject <Root <List <Discipline> > >
                                                           (response);
                bindingSource1.DataSource     = discipline.data;
                listBoxCategory.DataSource    = discipline.data;
                listBoxCategory.DisplayMember = "name";
                listBoxCategory.ValueMember   = "id";
                listBoxCategory.DataBindings.Add("Text", bindingSource1, "name");
                richTextBox1.DataBindings.Add("Text", bindingSource1, "description");

                //foreach (var x in discipline.data)
                //{
                //    listBoxCategory.Items.Add(x.name);
                //    var name = x.name;
                //    Console.WriteLine(name);
                //}
                //var response = MainClass.Person.GetUserInfo();
                //Console.WriteLine("Статус запроса: {0}", response.StatusCode.ToString());
                //Console.WriteLine("Ответ: {0}", response.Content.ReadAsStringAsync().Result);
                //richTextBox1.Text = response.Headers.ToString();
                ////return response.StatusCode.ToString();
            }
        }
Пример #6
0
        private void LoadProject(string file)
        {
            ResXResourceSet resXresourceSet = new ResXResourceSet(file);

            this.PathWakinside = resXresourceSet.GetString("PathWakinside");
            this.FileAL        = resXresourceSet.GetString("FileAL");
            this.FileResGen    = resXresourceSet.GetString("FileResGen");
            this.PathOutput    = resXresourceSet.GetString("PathOutput");
            this.Language      = resXresourceSet.GetString("Language");
        }
Пример #7
0
        private bool isFileTitleExisted()
        {
            mFileTitle = this.textBox1.Text;
            if (mFileTitle.Equals(""))
            {
                MessageBox.Show(resxSet.GetString("msg_no_file_title"));
                return(false);
            }

            return(true);
        }
Пример #8
0
        public UnitView()
        {
            ResXResourceSet resxSet = new ResXResourceSet(@".\Localisation\Eng.resx");

            InitializeComponent();
            this.Text             = resxSet.GetString("Unit");
            this.lblUnit.Text     = resxSet.GetString("Unit");
            this.lblUnitName.Text = resxSet.GetString("UnitName");
            this.btnSaveUnit.Text = resxSet.GetString("Save");
            unitDtosList          = unitRepo.GetList();
        }
Пример #9
0
Файл: Setting.cs Проект: cd547/-
        private void Setting_Load(object sender, EventArgs e)
        {
            //读取资源文件的值

            using (ResXResourceSet rest = new ResXResourceSet(respath))
            {
                this.textCodeStart.Text = rest.GetString("Ocr_start_text");
                this.textX.Text         = rest.GetString("x");
                this.textY.Text         = rest.GetString("y");
                this.textH.Text         = rest.GetString("h");
                this.textW.Text         = rest.GetString("w");
            }
        }
Пример #10
0
        /// <summary>
        /// Deletes the currently displayed topic and all the tasks associated with
        /// </summary>
        private void cmdDeleteTopic_Click(object sender, EventArgs e)
        {
            // If the app native language is set on French
            if (dbConn.ReadSetting(1) == 2)
            {
                // Use French resxFile
                resxFile = @".\\stringsFR.resx";
            }
            else
            {
                // By default use English resxFile
                resxFile = @".\\stringsEN.resx";
            }

            using (ResXResourceSet resourceManager = new ResXResourceSet(resxFile))
            {
                // Gets the selected topic
                Lists currentTopic = cboTopics.SelectedItem as Lists;

                if (cboTopics.Items.Count != 0)
                {
                    var confirmResult = MessageBox.Show(resourceManager.GetString("delTopicWillRemoveRelTasks"), resourceManager.GetString("confirmTheDeletion"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (confirmResult == DialogResult.Yes)
                    {
                        dbConn.DeleteTopic(currentTopic.Id);

                        // Loads the topics from the database
                        LoadTopics();

                        // Loads all the tasks for the different tabs from the database
                        LoadTasks();

                        // If the drop-down list of topics is empty
                        if (cboTopics.Items.Count == 0)
                        {
                            tabMain.SelectTab(tabDates);
                            cboTopics.Text = resourceManager.GetString("displayByTopic");
                        }
                        else
                        {
                            // Changes current topic since the previous one has been deleted
                            cboTopics.SelectedIndex = 0;
                        }

                        CheckIfPreviousNextTopicArrowButtonsUseful();
                    }
                }
            }
        }
Пример #11
0
        public override void Uninstall(IDictionary savedState)
        {
            try
            {
                string message = "Do you want to delete local data?";
                try
                {
                    string          exePath    = Context.Parameters["assemblypath"];
                    Configuration   config     = ConfigurationManager.OpenExeConfiguration(exePath);
                    string          filename   = config.AppSettings.Settings["LocalizationResourceFileName"].Value;
                    FileInfo        info       = new FileInfo(exePath);
                    string          filepath   = Path.Combine(info.Directory.FullName, "Resources", filename);
                    ResXResourceSet resxSet    = new ResXResourceSet(filepath);
                    string          locMessage = resxSet.GetString("DeleteLocalData");
                    if (!string.IsNullOrEmpty(locMessage))
                    {
                        message = locMessage;
                    }
                }
                catch
                {}
                if (MessageBox.Show(message, "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    deleteLocalContent();
                }
            }catch (Exception e)
            {
                MessageBox.Show(e.StackTrace, e.Message);
            }



            base.Uninstall(savedState);
        }
Пример #12
0
 public static void refrescarGeneros()
 {
     for (int i = 0; i < generos.Length - 1; i++)
     {
         generos[i].traducido = textosLocal.GetString("genero_" + generos[i].Id);
     }
 }
Пример #13
0
   public CarDisplayApp()
   {
      // Instantiate controls.
      PictureBox pictureBox = new PictureBox();
      pictureBox.Location = new Point(10, 10);
      this.Controls.Add(pictureBox);
      DataGridView grid = new DataGridView();
      grid.Location = new Point(10, 60);
      this.Controls.Add(grid);
      
      // Get resources from .resx file.
      using (ResXResourceSet resxSet = new ResXResourceSet(resxFile))
      {
         // Retrieve the string resource for the title.
         this.Text = resxSet.GetString("Title");
         // Retrieve the image.
         Icon image = (Icon) resxSet.GetObject("Information", true);
         if (image != null)
            pictureBox.Image = image.ToBitmap();

         // Retrieve Automobile objects.  
         List<Automobile> carList = new List<Automobile>();
         string resName = "EarlyAuto";
         Automobile auto; 
         int ctr = 1;
         do {
            auto = (Automobile) resxSet.GetObject(resName + ctr.ToString());
            ctr++;
            if (auto != null) 
               carList.Add(auto);
         } while (auto != null);
         cars = carList.ToArray();
         grid.DataSource = cars;
      }
   }
 public static string GetResourceValue(string filePath, string name)
 {
     using (ResXResourceSet resxSet = new ResXResourceSet(filePath))
     {
         return(resxSet.GetString(name));
     }
 }
Пример #15
0
 public static void CargarConfiguracion()
 {
     if (File.Exists("config.cfg"))
     {
         try
         {
             cargador            = new ResXResourceSet("config.cfg");
             Language            = cargador.GetString("Language");
             LastOpenedDirectory = cargador.GetString("LastOpenedDirectory");
             LinkedWithSpotify   = (bool)cargador.GetObject("LinkedWithSpotify");
             Clipboard           = cargador.GetString("Clipboard");
             History             = cargador.GetString("History");
             HistoryEnabled      = (bool)cargador.GetObject("HistoryEnabled");
             StreamString        = cargador.GetString("StreamString");
             StreamEnabled       = (bool)cargador.GetObject("StreamEnabled");
             //Load the colors
             ColorLongSong = Color.FromArgb(int.Parse(cargador.GetString("ColorLongSong"), NumberStyles.HexNumber));
             ColorBonus    = Color.FromArgb(int.Parse(cargador.GetString("ColorBonus"), NumberStyles.HexNumber));
             //Load fonts
             string[] FontViewString   = cargador.GetString("FontView").Split(',');
             string[] FontLyricsString = cargador.GetString("FontLyrics").Split(',');
             FontView            = new Font(FontViewString[0], (float)Convert.ToInt32(FontViewString[1]));
             FontLyrics          = new Font(FontLyricsString[0], (float)Convert.ToInt32(FontLyricsString[1]));
             MainFormSize        = (Size)cargador.GetObject("MainFormSize");
             MainFormViewSidebar = (bool)cargador.GetObject("MainFormViewSidebar");
         }
         catch (NullReferenceException)
         {
             //Load defaults
             MainFormViewSidebar = true;
         }
     }
     else
     {
         Language            = "es";
         LinkedWithSpotify   = false;
         LastOpenedDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
         Clipboard           = "%artist% - %title% (%year%)";
         History             = "#%track_num%. %artist% - %title%";
         StreamString        = "#%track_num%. %artist% - %title%";
         StreamEnabled       = false;
         HistoryEnabled      = true;
         ColorLongSong       = Color.Salmon;
         ColorBonus          = Color.SkyBlue;
         FontLyrics          = new Font("Segoe UI", 10);
         FontView            = new Font("Segoe UI", 10);
         //MainFormSize -> designer
         MainFormViewSidebar = true;
     }
     guardador = new ResXResourceWriter("config.cfg");
 }
Пример #16
0
        public void GetStringSafe()
        {
            var path = Combine(Files.GetExecutingPath(), "Resources", "TestResourceResX.resx");
            var rs   = new ResXResourceSet(path, null)
            {
                SafeMode = true
            };

            // when getting an object, result is always a ResXDataNode regardless of the object is a string
            Assert.IsInstanceOf <ResXDataNode>(rs.GetObject("TestString"));
            Assert.IsInstanceOf <ResXDataNode>(rs.GetObject("TestBytes"));

            // for a string, the string value is returned
            Assert.AreEqual("String invariant ResX", rs.GetString("TestString"));

            // for a non-string, the non-deserialized raw string value is returned
            Assert.AreEqual("576, 17", rs.GetString("TestPoint"));

            // for a file reference, the reference value is returned...
            Assert.IsTrue(rs.GetString("TestBinFile").StartsWith("TestBinFile.bin;System.Byte[], mscorlib", StringComparison.Ordinal));

            // ...even if it refers to a string...
            Assert.IsTrue(rs.GetString("TestTextFile").StartsWith("TestTextFile.txt;System.String, mscorlib", StringComparison.Ordinal));

            rs.SafeMode = false;
            Assert.IsNotNull(rs.GetString("TestTextFile"));
            Assert.IsNotNull(rs.GetObject("TestBinFile"));
            rs.SafeMode = true;

            // ...unless the string value is already obtained and cached
            Assert.IsFalse(rs.GetString("TestTextFile").StartsWith("TestTextFile.txt;System.String, mscorlib", StringComparison.Ordinal));

            // but a non-string file reference will still return the file reference even if the result is cached (with AutoCleanup, this time with full path)
            Assert.IsTrue(rs.GetString("TestBinFile").Contains("TestBinFile.bin;System.Byte[], mscorlib"));
        }
Пример #17
0
 private void RunFailedTestcase_Load(object sender, EventArgs e)
 {
     lbl_IP.Text = MultipleExecution.IPRerunconfig;
     using (ResXResourceSet resxSet = new ResXResourceSet(@"Release\Credential.resx"))
     {
         lbl_enviornment.Text = resxSet.GetString("ENV");
         LoadList(MultipleExecution.IPRerunconfig);
     }
 }
Пример #18
0
        private Global()
        {
            MessageHub = new TinyMessengerHub();

            Texts = new ResXResourceSet(@".\Resources\Texts.resx");

            MessageHub.Subscribe<UserBoatsRetrieved>((m) => {
                UserBoats = m.Content;
#if DEBUG                
                MessageHub.PublishAsync(new LogMessage(this, new LogText(Texts.GetString("UserBoatsRetrieved"))));
#endif
            });

            MessageHub.Subscribe<SelectedBoatRefreshed>((m) => {
                Boat = m.Content;
                Boat.FixTime = DateTime.Now;
                if(Boat.FixQuality == InstrumentsData.FixQualityType.ESTIMATED_DEAD_RECKONING)
                {
                    MessageHub.PublishAsync(new LogMessage(this, new LogText($"{Texts.GetString("BoatDataRefreshedDeadReckoning")} - {Boat.UserName}'s {Boat.BoatName} - {DateTime.Now.ToString("hh:mm:ss")}", Color.Goldenrod)));
                } else
                {
                    MessageHub.PublishAsync(new LogMessage(this, new LogText($"{Texts.GetString("BoatDataRefreshed")} - {Boat.UserName}'s {Boat.BoatName} - {DateTime.Now.ToString("hh:mm:ss")}", Color.DarkGreen)));
                }
                Boat.toInstrumentsData(ref boatData);
                NmeaServer.SendData();
            });

            NmeaServer = new NMEAServer(ref boatData, NmeaTcpPort);
            NmeaServer.OnServerStarted += delegate
            {
                MessageHub.PublishAsync(new LogMessage(this, new LogText($"{Texts.GetString("NMEAServerStarted")} {NmeaTcpPort}")));
            };
            NmeaServer.OnServerStop += delegate
            {
                MessageHub.PublishAsync(new LogMessage(this, new LogText(Texts.GetString("NMEAServerStopped"))));
            };
            NmeaServer.OnNMEASent += NmeaServer_OnNMEASent;
            NmeaServer.OnServerError += NmeaServer_OnServerError;
            NmeaServer.OnClientConnected += NmeaServer_OnClientConnected;

            DeadReckoning.Active = true;
            DeadReckoning.Rate = 1;
            DeadReckoning.StartDeadReckoningTask();
        }
        private async void CreateBatchFile(string folderpath, string[] configFileArr, string batchfilename)
        {
            string env = string.Empty;

            if (treeView1.SelectedNode != null)
            {
                try
                {
                    string rbtntext = string.Empty;
                    if (rbtn_DVT.Checked)
                    {
                        rbtntext = "devtest";
                    }
                    else if (rbtn_STG.Checked)
                    {
                        rbtntext = "staging";
                    }
                    if (rbtn_PRD.Checked)
                    {
                        rbtntext = "Production";
                    }
                    else if (rbtn_QAC.Checked)
                    {
                        rbtntext = "qac";
                    }
                    HealthCheck.ExecuteCS.Utility.ConfigFileCreate(folderpath, rbtntext, configFileArr, batchfilename);
                    await Task.Delay(500);

                    await IOoperation.MoveLocation(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\" + "HealthCheckExec.bat", folderpath + "\\" + "HealthCheckExec.bat");

                    await Task.Delay(300);

                    using (ResXResourceSet resxSet = new ResXResourceSet(@"Release\Credential.resx"))
                    {
                        env = resxSet.GetString("ENV");
                    }

                    if (env == "DVT")
                    {
                        SchedulerOperation.CreateTaskRunOnceHealthCheck("HealthCheckExec.bat", folderpath, batchfilename);
                    }
                    else
                    {
                        SchedulerOperation.CreateTaskRunOnceWithDifferentaccountHealthCheck("HealthCheckExec.bat", folderpath);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Select Component!!!");
            }
        }
Пример #20
0
 private static void Check(string resourceFilePathName, string key, string langDisplayName)
 {
     using (ResXResourceSet set = new ResXResourceSet(resourceFilePathName))
     {
         string result = set.GetString(key);
         if (String.IsNullOrWhiteSpace(result))
         {
             throw new Exception(String.Format("Resource value of {0} in {1} cannot be empty.", key, langDisplayName));
         }
     }
 }
Пример #21
0
        private static void PortFromAgentToMonitorBy(string key)
        {
            string agentResource   = GetEnResource(agentResxFolder);
            string monitorResource = GetEnResource(monitorResxFolder);

            using (ResXResourceSet agentSet = new ResXResourceSet(agentResource))
                using (ResXResourceWriter monitorWriter = new ResXResourceWriter(monitorResource))
                {
                    string agentValue = agentSet.GetString(key);
                    monitorWriter.AddResource(key, agentValue);
                }
        }
Пример #22
0
        public void CloneValuesTest()
        {
            string key  = "TestBinFile";
            var    path = Combine(Files.GetExecutingPath(), "Resources", "TestResourceResX.resx");
            var    rs   = new ResXResourceSet(path);

            Assert.IsFalse(rs.CloneValues);
            Assert.IsTrue(rs.AutoFreeXmlData);

            // if not cloning values, references are the same for subsequent calls
            Assert.AreSame(rs.GetObject(key), rs.GetObject(key));

            // if cloning values, references are different
            rs.CloneValues = true;
            Assert.AreNotSame(rs.GetObject(key), rs.GetObject(key));

            // but strings are always the same reference
            key = "TestString";
            Assert.AreSame(rs.GetObject(key), rs.GetObject(key));
            Assert.AreSame(rs.GetString(key), rs.GetString(key));
        }
        public static string GetString(string name)
        {
            string result = string.Empty;

            using (ResXResourceSet resx = new ResXResourceSet(ConfigHelper.GetString("ResourcePath")))
            {
                // Opens the resource file and grabs the value from the provided key name
                result = resx.GetString(name);
            }

            return(result);
        }
Пример #24
0
 public static void ReloadGenres()
 {
     for (int i = 0; i < Genres.Length - 1; i++)
     {
         Genres[i].Name = LocalTexts.GetString("genero_" + Genres[i].Id);
     }
 }
Пример #25
0
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Translates a description
        /// </summary>
        /// <param name="resSet"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public string TranslatedDescription(ResXResourceSet resSet, string key)
        {
            string text = resSet.GetString("Description_" + key.ToUpper());

            if (text != null)
            {
                return(text);
            }
            else
            {
                return(key);
            }
        }
Пример #26
0
        private void ResXResourceSet_TestFile(string resxFileName, string resourceName, string expected)
        {
            Assert.True(File.Exists(resxFileName), $@"RESX file ""{resxFileName}"" not found, make sure it's in the root folder of the unit test project");

            using (ResXResourceSet resxSet = new ResXResourceSet(resxFileName))
            {
                Assert.NotNull(resxSet);

                string strResXValue = resxSet.GetString(resourceName);

                Assert.Equal(expected, strResXValue);
            }
        }
Пример #27
0
        public void GenerateNodeInfo()
        {
            // in safe mode NodeInfo will be generated from value on GetString
            var rs = new ResXResourceSet {
                SafeMode = true
            };

            // native types (in non-compatible mode)
            rs.SetObject("string", "string");
            rs.SetObject("DateTime", DateTime.Now);
            rs.SetObject("DateTimeOffset", DateTimeOffset.Now);
            rs.SetObject("double", -0d);
            rs.SetObject("float", -0f);
            rs.SetObject("decimal", -0.0m);
            rs.SetObject("char", 'a');
            rs.SetObject("byte", (byte)1);
            rs.SetObject("sbyte", (sbyte)1);
            rs.SetObject("short", (short)1);
            rs.SetObject("ushort", (ushort)1);
            rs.SetObject("int", 1);
            rs.SetObject("uint", 1u);
            rs.SetObject("long", 1L);
            rs.SetObject("ulong", 1ul);
            rs.SetObject("bool", true);
            rs.SetObject("DBNull", DBNull.Value);
            rs.SetObject("Type", GetType());
            rs.SetObject("IntPtr", IntPtr.Zero);
            rs.SetObject("UIntPtr", UIntPtr.Zero);

            // special handlings
            rs.SetObject("byte[]", new byte[] { 1, 2, 3 });
            rs.SetObject("CultureInfo", CultureInfo.CurrentCulture);
            rs.SetObject("null", null);

            // by type converter
            rs.SetObject("TypeConverter/string", Point.Empty);
#if !NETCOREAPP2_0
            rs.SetObject("TypeConverter/byte[]", SystemIcons.Application.ToBitmap());
#endif

            // binary serialization
            rs.SetObject("serialized", new Collection <byte> {
                1, 2, 3
            });

            // getting the elements as string in safe mode will create the NodeInfos in non-compatible mode
            foreach (DictionaryEntry item in rs)
            {
                Console.WriteLine("Key: {0}; Value: {1}", item.Key, rs.GetString(item.Key.ToString()));
            }
        }
Пример #28
0
        private void LessonForm_Load(object sender, EventArgs e)
        {
            using (ResXResourceSet resxSet = new ResXResourceSet(resxFile))
            {
                acess_token = resxSet.GetString("acess_token");
                string id_discipline = resxSet.GetString("id_discipline");
                var    id_exercize   = resxSet.GetString("id_exercize");
                Console.WriteLine(acess_token + "taken");
                //добавить функцию
                var         response_content = File.GetContentInfo(acess_token, id_discipline, id_exercize);
                Root <Data> exercize         = JsonConvert.DeserializeObject <Root <Data> >(response_content);
                string      url = exercize.data.content.file.url;
                Console.WriteLine(APP_PATH + url);

                WebClient webClient = new WebClient();

                var response_file           = File.GetFileInfo(acess_token, id_discipline, id_exercize);
                Root <List <Content> > code = JsonConvert.DeserializeObject <Root <List <Content> > >(response_file);
                Console.WriteLine(code);
                if (code.data.Count == 0)
                {
                    Console.WriteLine(code.data);
                    richTextBox1.Text = "В данном уроке отсутствует код для компиляции";
                }
                else
                {
                    string url_code = code.data[0].file.url;
                    Console.WriteLine(APP_PATH + url_code);
                    richTextBox1.Text = webClient.DownloadString(APP_PATH + url_code);
                }


                byte[] bytes    = Encoding.Default.GetBytes(webClient.DownloadString(APP_PATH + url));
                string myString = Encoding.UTF8.GetString(bytes);
                var    html     = Markdig.Markdown.ToHtml(myString);
                webBrowser1.DocumentText = html;
            }
        }
Пример #29
0
Файл: Form1.cs Проект: cd547/-
        //激活更新
        private void Form1_Activated(object sender, EventArgs e)
        {
            string respath = @".\Resource1.resx";

            //读取资源文件的值
            using (ResXResourceSet rest = new ResXResourceSet(respath))
            {
                codestart        = Convert.ToInt32(rest.GetString("Ocr_start_text"));
                cX               = Convert.ToInt32(rest.GetString("x"));
                cY               = Convert.ToInt32(rest.GetString("y"));
                cH               = Convert.ToInt32(rest.GetString("h"));
                cW               = Convert.ToInt32(rest.GetString("w"));
                this.label7.Text = "(" + codestart.ToString() + "," + cX.ToString() + "," + cY.ToString() + "," + cH.ToString() + "," + cW.ToString() + ")";
            }

            /*
             * cX = Convert.ToInt32(this.textX.Text);
             * cY = Convert.ToInt32(this.textY.Text);
             * cW = Convert.ToInt32(this.textW.Text);
             * cH = Convert.ToInt32(this.textH.Text);
             * codestart = Convert.ToInt32(this.textCodeStart.Text);
             */
        }
Пример #30
0
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Translates a string
        /// </summary>
        /// <param name="resSet"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public string TranslatedEnum(ResXResourceSet resSet, Enum enumValue)
        {
            string key  = EnumConverter.Convert(enumValue);
            string text = resSet.GetString(key);

            if (text != null && text != "")
            {
                return(text);
            }
            else
            {
                return(key);
            }
        }
Пример #31
0
    public static void Main(string[] args)
    {
        try
        {
            string lang = "cs-CZ"; // determine language localization

            //get access to CLR resource file
            var resPath = "Resource." + lang + ".resx"; // path to resource if buildинг from command prompt
            if (!System.IO.File.Exists(resPath))
                Environment.CurrentDirectory = @"..\..\"; // path to resource if buildинг from Visual Studio

            var rs = new ResXResourceSet(resPath);

            //Prepare features

            // binaries
            Feature binaries = new Feature
                                {
                                    Name = rs.GetString("FeatAppName"),
                                    ConfigurableDir = "APPLICATIONROOTDIRECTORY",    // this enables customization of installation folder
                                    Description = rs.GetString("FeatAppDesc")
                                };
            // application data
            Feature datas = new Feature
                             {
                                 Name = rs.GetString("FeatDataName"),
                                 Description = rs.GetString("FeatDataDesc")
                             };

            //documentation
            Feature docs = new Feature
                            {
                                Name = rs.GetString("FeatDocName"),
                                Description = rs.GetString("FeatDocDesc")
                            };
            //shortcuts
            Feature shortcuts = new Feature
                {
                    Name = rs.GetString("FeatShortcutName"),
                    Description = rs.GetString("FeatShortcutDesc")
                };

            // Prepare project
            Project project =
                new Project("LocalizationTest",

                    //Files and Shortcuts
                    new Dir(new Id("APPLICATIONROOTDIRECTORY"), @"%ProgramFiles%\LocalizationTest",

                        // application binaries
                        new File(binaries, @"AppFiles\Bin\MyApp.exe",
                            new WixSharp.Shortcut(shortcuts, @"APPLICATIONROOTDIRECTORY"),
                            new WixSharp.Shortcut(shortcuts, @"%Desktop%")),
                        new File(binaries, @"AppFiles\Bin\MyApp.dll"),
                        new WixSharp.Shortcut(binaries, "Uninstall Localization Test", "[System64Folder]msiexec.exe", "/x [ProductCode]"),

                        // directory with application data
                        new Dir("Data",
                            new File(datas, @"AppFiles\Data\app_data.dat")),

                        // directory with documentation
                        new Dir("Doc",
                            new File(docs, @"AppFiles\Docs\manual.txt"))),

                    //program menu uninstall shortcut
                    new Dir(@"%ProgramMenu%\Kosmii\KosmiiTest",
                        new WixSharp.Shortcut(shortcuts, "Uninstall Kosmii Test", "[System64Folder]msiexec.exe", "/x [ProductCode]")));

            // set project properties
            project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889a");
            project.UpgradeCode = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");
            project.LicenceFile = @"AppFiles\License.rtf";
            project.Language = lang;
            project.Encoding = System.Text.Encoding.UTF8;
            project.Manufacturer = Environment.UserName;
            project.UI = WUI.WixUI_Mondo;
            project.SourceBaseDir = Environment.CurrentDirectory;
            project.MSIFileName = "LocalizationTest";

            Compiler.BuildMsi(project);
        }
        catch (System.Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
Пример #32
0
 protected void Edit()
 {
     if (Request.QueryString["key"] != null && Request.QueryString["file"] != null)
     {
         panelUpdate.Visible = true;
         filename = Request.QueryString["file"];
         filename = Request.PhysicalApplicationPath + "App_GlobalResources\\" + filename;
         string key = Request.QueryString["key"];
         lblKey.Text = key;
         ResXResourceSet rset = new ResXResourceSet(filename);
         txtResourceValue.Text = rset.GetString(key);
     }
 }