Example #1
0
        public void WriteXML(XmlField xmlParent)
        {
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);

            string s = xml.GetAttrString(c_sID, ID);
            s += xml.GetAttrString(c_sName, Name);

            if (!string.IsNullOrEmpty(FontName))
                s += xml.GetAttrString(c_sFontName, FontName);

            if (0 != FontSize)
                s += xml.GetAttrString(c_sFontSize, FontSize.ToString());

            xml.OneLiner(s, "");
        }
Example #2
0
        public void WriteLanguageData(XmlField xmlParent, LocLanguage lang)
        {
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);

            string s = xml.GetAttrString(c_sID, ID);

            xml.Begin(s);

            foreach (LocItem item in Items)
                item.WriteLanguageData(xml, lang);

            foreach (LocGroup sub in Groups)
                sub.WriteLanguageData(xml, lang);

            xml.End();
        }
Example #3
0
        public void WriteXML(XmlField xmlParent, string sLanguageID)
        {
            // Nothing to write if completely empty
            bool bHasValue = !string.IsNullOrEmpty(Value);
            bool bHasKey = !string.IsNullOrEmpty(ShortcutKey);
            bool bHasTip = !string.IsNullOrEmpty(ToolTip);
            if (!bHasValue && !bHasKey && !bHasTip)
                return;

            // Beginning tag <Item> contains the ID
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);

            // The ID for the language, e.g., "sp", "inz"
            string s = xml.GetAttrString(c_sID, sLanguageID);

            // The value
            if (bHasValue)
                s += xml.GetAttrString(c_sValue, Value);

            // Shortcut if present
            if (bHasKey)
                s += xml.GetAttrString(c_sKey, ShortcutKey);

            // Tooltip if present
            if (bHasTip)
                s += xml.GetAttrString(c_sTip, ToolTip);

            // Write it out
            xml.OneLiner(s, "");
        }
Example #4
0
        public void WriteXML(XmlField xmlParent)
        {
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);

            string s = xml.GetAttrString(c_sID, ID);

            s += xml.GetAttrString(c_sTitle, Title);

            if (!string.IsNullOrEmpty(Description))
                s += xml.GetAttrString(c_sDescription, Description);

            s += xml.GetAttrString(c_sTranslatorAudience,
                                   (TranslatorAudience) ? "true" : "false");

            xml.Begin(s);

            foreach (LocItem item in Items)
                item.WriteXML(xml);

            foreach (LocGroup sub in Groups)
                sub.WriteXML(xml);

            xml.End();
        }
Example #5
0
        public void WriteLanguageData(XmlField xmlParent, LocLanguage lang)
        {
            // Initialize the Item field
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);
            string s = xml.GetAttrString(c_sID, ID);
            xml.Begin(s);

            // Write the languge data
            LocAlternate alt = GetAlternate(lang.Index);
            if (null != alt)
                alt.WriteXML(xml, lang.ID);

            // Done
            xml.End();
        }
Example #6
0
        public void WriteXML(XmlField xmlParent)
        {
            // Beginning tag <Item> contains the ID
            XmlField xml = xmlParent.GetDaughterXmlField(c_sTag, true);
            string s = xml.GetAttrString(c_sID, ID);
            if (CanHaveShortcutKey)
                s += xml.GetAttrString(c_sKey, "true");
            if (CanHaveToolTip)
                s += xml.GetAttrString(c_sTip, "true");
            xml.Begin(s);

            // Add the English
            xml.GetDaughterXmlField(c_sEnglish, true).OneLiner(English);

            // Add the Information, if any
            if (!string.IsNullOrEmpty(Information))
                xml.GetDaughterXmlField(c_sInformation, true).OneLiner(Information);

            // Add the shortcut key, if any
            if (!string.IsNullOrEmpty(ShortcutKey))
                xml.GetDaughterXmlField(c_sKey, true).OneLiner(ShortcutKey);

            // Add the Tooltip, if any
            if (!string.IsNullOrEmpty(ToolTip))
                xml.GetDaughterXmlField(c_sTip, true).OneLiner(ToolTip);

            // End Tag </Item>
            xml.End();
        }
Example #7
0
        void WriteLanguageData(LocLanguage lang)
        {
            // Build the language name
            string sPath = DataFolder + Path.DirectorySeparatorChar + lang.ID + ".xml";

            // Save a backup in the current folder (See Bug0282.)
            JW_Util.CreateBackup(sPath, ".bak");

            // Open the xml writer
            TextWriter w = JW_Util.GetTextWriter(sPath);
            XmlField xml = new XmlField(w, c_sTag);
            xml.Begin();

            // Write out the language information
            lang.WriteXML(xml);

            // Write out the group's data
            foreach (LocGroup group in Groups)
                group.WriteLanguageData(xml, lang);

            // Done
            xml.End();
            w.Close();

            // Make a backup to the remote device if enabled. We have to create a file with the
            // date in it so that the BackupSystem has something to copy; we then delete that
            // file as there's no need to keep filling up the disk. (Bug0282)
            string sRemotePath = Path.GetFileNameWithoutExtension(sPath) + " " + 
                                 DateTime.Today.ToString("yyyy-MM-dd") + ".xml";
            try
            {
                //File.Copy(sPath, sRemotePath, true);
                //(new BackupSystem(sRemotePath)).MakeBackup();
                //File.Delete(sRemotePath);
            }
            catch (Exception)
            {
            }
        }
Example #8
0
        public void WriteXML()
        {
            // Open a Text Writer to save to
            TextWriter writer = JW_Util.GetTextWriter(BasePath);

            XmlField xml = new XmlField(writer, c_sTag);
            xml.Begin();

            foreach (LocGroup group in Groups)
                group.WriteXML(xml);

            xml.End();

            // Done
            writer.Close();

            // Write the language alternatives
            foreach (LocLanguage lang in Languages)
                WriteLanguageData(lang);
        }