Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathScriptContent.cs
More file actions
Latest commit
42 lines (34 loc) · 1.09 KB
/
Copy pathScriptContent.cs
File metadata and controls
42 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
usingSystem;
usingSystem.IO;
usingSystem.Windows.Forms;
usingSystem.Xml.Linq;
usingReClassNET.Util;
namespacePythonScriptingPlugin
{
publicclassScriptContent
{
publicstringName{get;set;}
publicstringContent{get;set;}
publicKeysHotKey{get;set;}
publicvoidWriteTo(TextWriterwriter)
{
vardocument=newXDocument(
newXElement("script",
XElementSerializer.ToXml(nameof(Name),Name),
XElementSerializer.ToXml(nameof(Content),Content),
XElementSerializer.ToXml(nameof(HotKey),(int)HotKey)
)
);
document.Save(writer);
}
publicstaticScriptContentReadFrom(TextReaderreader)
{
vardocument=XDocument.Load(reader);
varscript=newScriptContent();
XElementSerializer.TryRead(document.Root,nameof(Name), e =>script.Name=XElementSerializer.ToString(e));
XElementSerializer.TryRead(document.Root,nameof(Content), e =>script.Content=XElementSerializer.ToString(e));
XElementSerializer.TryRead(document.Root,nameof(HotKey), e =>script.HotKey=(Keys)XElementSerializer.ToInt(e));
returnscript;
}
}
}