|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using System.Windows.Forms; |
| 4 | +using GH_IO.Serialization; |
4 | 5 | using Grasshopper.Kernel; |
5 | 6 | using Rhino.Geometry; |
6 | 7 | using Swiftlet.DataModels.Enums; |
@@ -33,6 +34,34 @@ public CreateTextBody() |
33 | 34 | this.IsJsonChecked = true; |
34 | 35 | } |
35 | 36 |
|
| 37 | + public override bool Read(GH_IReader reader) |
| 38 | + { |
| 39 | + this.IsTextChecked = reader.GetBoolean(nameof(this.IsTextChecked)); |
| 40 | + this.IsJavascriptChecked = reader.GetBoolean(nameof(this.IsJavascriptChecked)); |
| 41 | + this.IsJsonChecked = reader.GetBoolean(nameof(this.IsJsonChecked)); |
| 42 | + this.IsHtmlChecked = reader.GetBoolean(nameof(this.IsHtmlChecked)); |
| 43 | + this.IsXmlChecked = reader.GetBoolean(nameof(this.IsXmlChecked)); |
| 44 | + |
| 45 | + if (this.IsTextChecked) _cType = ContentType.Text; |
| 46 | + else if (this.IsJavascriptChecked) _cType = ContentType.JavaScript; |
| 47 | + else if (this.IsJsonChecked) _cType = ContentType.JSON; |
| 48 | + else if (this.IsHtmlChecked) _cType = ContentType.HTML; |
| 49 | + else if (this.IsXmlChecked) _cType = ContentType.XML; |
| 50 | + |
| 51 | + this.Message = this._cType.ToString(); |
| 52 | + return base.Read(reader); |
| 53 | + } |
| 54 | + |
| 55 | + public override bool Write(GH_IWriter writer) |
| 56 | + { |
| 57 | + writer.SetBoolean(nameof(this.IsTextChecked), this.IsTextChecked); |
| 58 | + writer.SetBoolean(nameof(this.IsJavascriptChecked), this.IsJavascriptChecked); |
| 59 | + writer.SetBoolean(nameof(this.IsJsonChecked), this.IsJsonChecked); |
| 60 | + writer.SetBoolean(nameof(this.IsHtmlChecked), this.IsHtmlChecked); |
| 61 | + writer.SetBoolean(nameof(this.IsXmlChecked), this.IsXmlChecked); |
| 62 | + return base.Write(writer); |
| 63 | + } |
| 64 | + |
36 | 65 | /// <summary> |
37 | 66 | /// Registers all the input parameters for this component. |
38 | 67 | /// </summary> |
|
0 commit comments