예제 #1
0
        static public LocLanguage ReadXML(int iIndex, XmlRead xml)
        {
            string sID = xml.GetValue(c_sID);
            string sName = xml.GetValue(c_sName);

            LocLanguage language = new LocLanguage(sID, sName, iIndex);

            string sFontName = xml.GetValue(c_sFontName);
            if (!string.IsNullOrEmpty(sFontName))
                language.FontName = sFontName;

            string sFontSize = xml.GetValue(c_sFontSize);
            if (!string.IsNullOrEmpty(sFontSize))
            {
                try
                {
                    int n = Convert.ToInt16(sFontSize);
                    if (n != 0)
                        language.FontSize = n;
                }
                catch (Exception)
                {
                }
            }


            return language;
        }
예제 #2
0
        static public LocGroup ReadXML(LocDB db, XmlRead xml)
        {
            string sID = xml.GetValue(c_sID);
            string sTitle = xml.GetValue(c_sTitle);
            string sDescription = xml.GetValue(c_sDescription);
            string sTranslatorAudience = xml.GetValue(c_sTranslatorAudience);

            LocGroup group = new LocGroup(sID, sTitle);
            group.Description = sDescription;
            group.TranslatorAudience = (sTranslatorAudience == "true") ? true : false;

            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {//yesu - stoped here
                if (xml.IsTag(LocItem.c_sTag))
                {
                    LocItem item = LocItem.ReadXML(xml);
                    group.AppendItem(item);
                }

                if (xml.IsTag(LocGroup.c_sTag))
                {
                    LocGroup sub = LocGroup.ReadXML(db, xml);
                    group._AppendGroup(sub);
                }
            }

            return group;
        }
예제 #3
0
        public void ReadLanguageData(XmlRead xml, LocLanguage lang)
        {
            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {
                if (xml.IsTag(LocItem.c_sTag))
                {
                    string sItemID = xml.GetValue(LocItem.c_sID);
                    LocItem item = Find(sItemID);
                    if (null != item)
                        item.ReadLanguageData(xml, lang);
                }

                if (xml.IsTag(LocGroup.c_sTag))
                {
                    string sGroupID = xml.GetValue(LocGroup.c_sID);
                    LocGroup group = FindGroup(sGroupID);
                    if (null != group)
                        group.ReadLanguageData(xml, lang);
                }
            }
        }
예제 #4
0
        public void ReadLanguageData(XmlRead xml, LocLanguage lang)
        {
            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {
                if (xml.IsTag(LocAlternate.c_sTag))
                {
                    string sLanguageID = xml.GetValue(LocAlternate.c_sID);
                    if (sLanguageID != lang.ID)
                        return;

                    LocAlternate alt = LocAlternate.ReadXML(xml);
                    AddAlternate(lang.Index, alt);
                }
            }
        }
예제 #5
0
        static public LocItem ReadXML(XmlRead xml)
        {
            // Collect the ID from the Tag line, and create an item from it
            string sID = xml.GetValue(c_sID);
            LocItem item = new LocItem(sID);

            string sCanHaveKey = xml.GetValue(c_sKey);
            if (!string.IsNullOrEmpty(sCanHaveKey) && sCanHaveKey == "true")
                item.CanHaveShortcutKey = true;

            string sCanHaveTip = xml.GetValue(c_sTip);
            if (!string.IsNullOrEmpty(sCanHaveTip) && sCanHaveTip == "true")
                item.CanHaveToolTip = true;

            // Loop through the other lines for the remaining data
            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {
                if (xml.IsTag(c_sInformation))
                    item.Information = xml.GetOneLinerData();

                if (xml.IsTag(c_sEnglish))
                    item.English = xml.GetOneLinerData();

                if (xml.IsTag(c_sKey))
                    item.ShortcutKey = xml.GetOneLinerData();

                if (xml.IsTag(c_sTip))
                    item.ToolTip = xml.GetOneLinerData();
            }

            return item;
        }
예제 #6
0
        void ReadLanguageData(string sPath)
        {
            StreamReader r = new StreamReader(sPath, Encoding.UTF8);
            TextReader tr = TextReader.Synchronized(r);
            XmlRead xml = new XmlRead(tr);

            LocLanguage language = null;

            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {
                if (xml.IsTag(LocLanguage.c_sTag))
                {
                    language = LocLanguage.ReadXML(Languages.Length, xml);
                    AppendLanguage(language);
                }

                // LocGroup
                if (null != language && xml.IsTag(LocGroup.c_sTag))
                {
                    string sGroupID = xml.GetValue(LocGroup.c_sID);
                    LocGroup group = FindGroup(sGroupID);
                    if (null != group)
                        group.ReadLanguageData(xml, language);
                }

            }
            tr.Close();
        }
예제 #7
0
        public void ReadXML()
        {
            // First, read in the Base data
            string sPathName = BasePath;
            if (!File.Exists(sPathName))
            {
                MessageBox.Show(string.Format("Please Copy the File {0} to the Loc Folder", BaseName));
                return;
            }

            TextReader reader = JW_Util.OpenStreamReader(ref sPathName, "*.xml");
            XmlRead xml = new XmlRead(reader);

            while (xml.ReadNextLineUntilEndTag(c_sTag))
            {
                // LocGroup
                if (xml.IsTag(LocGroup.c_sTag))
                {
                    LocGroup group = LocGroup.ReadXML(this, xml);
                    AppendGroup(group);
                }
            }

            reader.Close();

            // Now, read in the languages in the localization folder
            string[] sPaths = Directory.GetFiles(this.DataFolder, "*.xml", SearchOption.TopDirectoryOnly);
            foreach (string s in sPaths)
            {
                if (s == BasePath)
                    continue;
                ReadLanguageData(s);
            }

        }
예제 #8
0
        static public LocAlternate ReadXML(XmlRead xml)
        {
            // Collect the parts
            string sValue = xml.GetValue(c_sValue);
            string sShortcutKey = xml.GetValue(c_sKey);
            string sToolTip = xml.GetValue(c_sTip);

            // Create and return the class
            LocAlternate alt = new LocAlternate(sValue, sShortcutKey, sToolTip);
            return alt;
        }