Ejemplo n.º 1
0
        private void exportJsonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog sav = new SaveFileDialog()
            {
                Filter = TextFilter
            };

            sav.FileName   = Path.GetFileNameWithoutExtension(FileName);
            sav.DefaultExt = ".yaml";
            if (sav.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string ext = Utils.GetExtension(sav.FileName);

            if (ext == ".xml")
            {
                File.WriteAllText(sav.FileName, XmlByamlConverter.ToXML(FileFormat.BymlData));
            }
            else
            {
                File.WriteAllText(sav.FileName, YamlByamlConverter.ToYaml(FileFormat.BymlData));
            }

            MessageBox.Show("Byaml converted successfully!");
        }
Ejemplo n.º 2
0
 public string ConvertToString()
 {
     if (TextFileType == TextFileType.Xml)
     {
         return(XmlByamlConverter.ToXML(BymlData));
     }
     else
     {
         return(YamlByamlConverter.ToYaml(BymlData));
     }
 }
Ejemplo n.º 3
0
        private void UpdateTextEditor()
        {
            textEditor.IsXML  = false;
            textEditor.IsYAML = false;

            if (IsXML)
            {
                textEditor.FillEditor(XmlByamlConverter.ToXML(FileFormat.BymlData));
                textEditor.IsXML = true;
            }
            else if (IsOldXML)
            {
                textEditor.FillEditor(XmlConverter.ToXml(FileFormat.BymlData));
                textEditor.IsXML = true;
            }
            else
            {
                textEditor.FillEditor(YamlByamlConverter.ToYaml(FileFormat.BymlData));
                textEditor.IsYAML = true;
            }
        }