예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            Encoder encoder = new Encoder();
            encoder.Indent = true;
            Test o = new Test();
            string s = encoder.Encode(o);

            Decoder decoder = new Decoder();
            Test o2 = (Test)decoder.Decode(s);
            string s2 = encoder.Encode(o2);

            if (s == s2)
                richTextBox1.AppendText("OK\n");
            else
                richTextBox1.AppendText("FAIL\n");
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Encoder encoder = new Encoder();
            encoder.Indent = true;

            Test o = new Test();
            string s = encoder.Encode(o);

            richTextBox1.Clear();
            richTextBox1.AppendText(s);
        }
예제 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            Encoder encoder = new Encoder();

            encoder.Indent = true;
            Test   o = new Test();
            string s = encoder.Encode(o);

            Decoder decoder = new Decoder();
            Test    o2      = (Test)decoder.Decode(s);
            string  s2      = encoder.Encode(o2);

            if (s == s2)
            {
                richTextBox1.AppendText("OK\n");
            }
            else
            {
                richTextBox1.AppendText("FAIL\n");
            }
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Encoder encoder = new Encoder();

            encoder.Indent = true;

            Test   o = new Test();
            string s = encoder.Encode(o);

            richTextBox1.Clear();
            richTextBox1.AppendText(s);
        }
예제 #5
0
        public void SaveProject(string filename)
        {
            try
            {
                if (filename != null)
                {
                    _projectFilename = filename;
                }

                if (_projectFilename == null)
                {
                    return;
                }

                // Save current item settings for windows.
                _windowManager.GetWindowItems(_project.Windows, _project.Items);
                if (_currentItem != null)
                {
                    _project.ProjectItem = _currentItem.GetID();
                }
                else
                {
                    _project.ProjectItem = string.Empty;
                }

                // Save the favourites and ignores along with the project.
                _windowManager.Favourites.GetAll(_project.Favourites);
                _windowManager.SetCaption(_projectFilename);

                Hwd.Serialization.Encoder encoder = new Hwd.Serialization.Encoder();
                string s = encoder.Encode(_project);
                File.WriteAllText(_projectFilename, s);

                SetCaption();
            }
            catch (SerializationException exc)
            {
                _windowManager.Logger.LogExcStr(exc, "Deserializing project failed");
            }
            catch (IOException exc)
            {
                _windowManager.Logger.LogExcStr(exc, "Save project failed");
            }
        }
예제 #6
0
        public static string Encode(object instance)
        {
            Encoder c = new Encoder();

            return(c.Encode(instance));
        }
예제 #7
0
 public static string Encode(object instance)
 {
     Encoder c = new Encoder();
     return c.Encode(instance);
 }
예제 #8
0
        public void SaveProject(string filename)
        {
            try
            {
                if (filename != null) _projectFilename = filename;

                if (_projectFilename == null) return;

                // Save current item settings for windows.
                _windowManager.GetWindowItems(_project.Windows, _project.Items);
                if (_currentItem != null)
                    _project.ProjectItem = _currentItem.GetID();
                else
                    _project.ProjectItem = string.Empty;

                // Save the favourites and ignores along with the project.
                _windowManager.Favourites.GetAll(_project.Favourites);
                _windowManager.SetCaption(_projectFilename);

                Hwd.Serialization.Encoder encoder = new Hwd.Serialization.Encoder();
                string s = encoder.Encode(_project);
                File.WriteAllText(_projectFilename, s);

                SetCaption();
            }
            catch (SerializationException exc)
            {
                _windowManager.Logger.LogExcStr(exc, "Deserializing project failed");
            }
            catch (IOException exc)
            {
                _windowManager.Logger.LogExcStr(exc, "Save project failed");
            }
        }