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"); }
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); }
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"); } }
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"); } }
public static string Encode(object instance) { Encoder c = new Encoder(); return(c.Encode(instance)); }
public static string Encode(object instance) { Encoder c = new Encoder(); return c.Encode(instance); }
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"); } }