private void CreateNewSTBLInPackage_Load(object sender, EventArgs e)
        {
            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "TS4_STBL_Editor.LangCodesList.xml";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                using (StreamReader reader = new StreamReader(stream))
                {
                    string result = reader.ReadToEnd();

                    TextReader tr = new StringReader(result);
                    LangCodesDS.ReadXml(tr);

                    string[] allArr = new string[2];
                    allArr[0] = "Add All Langs At Once";
                    allArr[1] = "Add All Langs At Once";

                    DataRow dr = LangCodesDS.Tables[0].NewRow();
                    dr.ItemArray = allArr;

                    LangCodesDS.Tables[0].Rows.InsertAt(dr, 0);

                    comboBox1.DataSource    = LangCodesDS.Tables[0];
                    comboBox1.DisplayMember = "name";
                    comboBox1.ValueMember   = "id";
                }

            if (File.Exists("settings.json"))
            {
                string json = File.ReadAllText("settings.json", Encoding.UTF8);
                Dictionary <string, string> settings = JsonConvert.DeserializeObject <Dictionary <string, string> >(json);
                stblNameFld.Text = settings["stblFileName"];
            }
        }
Example #2
0
        private void LangCodesHelp_Load(object sender, EventArgs e)
        {
            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = "TS4_STBL_Editor.LangCodesList.xml";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                using (StreamReader reader = new StreamReader(stream))
                {
                    string result = reader.ReadToEnd();

                    TextReader tr = new StringReader(result);

                    LangCodesDS.ReadXml(tr);

                    dataGridView1.DataSource = LangCodesDS;
                    dataGridView1.DataMember = "lang";
                }
        }