aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy@twine-s.com>2020-12-30 15:11:34 +0000
committerRoy Ben Shabat <Roy@twine-s.com>2020-12-30 15:11:34 +0000
commitd33c19b3ac6803de4b5c8d475832efef131c1a45 (patch)
treeea725abc39def99a755b041c13cba1fe0d594ddc /Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs
parent1bdcaa9f51303bbff682507f31fb3b4414692ca4 (diff)
downloadTango-d33c19b3ac6803de4b5c8d475832efef131c1a45.tar.gz
Tango-d33c19b3ac6803de4b5c8d475832efef131c1a45.zip
Revert "Hope it is fine"
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs')
-rw-r--r--Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs80
1 files changed, 80 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs
new file mode 100644
index 000000000..c465292cb
--- /dev/null
+++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Basic/Script.cs
@@ -0,0 +1,80 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Scripting.Core;
+
+namespace Tango.Scripting.Basic
+{
+ public class Script : ExtendedObject, IScriptSource
+ {
+ private String _name;
+ public String Name
+ {
+ get { return _name; }
+ set { _name = value; RaisePropertyChangedAuto(); }
+ }
+
+ public bool IsEntryPoint { get; set; }
+
+ private String _code;
+ public String Code
+ {
+ get { return _code; }
+ set
+ {
+ if (_code != null && _code != value)
+ {
+ IsChanged = true;
+ }
+
+ _code = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private bool _isChanged;
+ [JsonIgnore]
+ public bool IsChanged
+ {
+ get { return _isChanged; }
+ set { _isChanged = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isSelected;
+ [JsonIgnore]
+ public bool IsSelected
+ {
+ get { return _isSelected; }
+ set { _isSelected = value; RaisePropertyChangedAuto(); }
+ }
+
+ [JsonIgnore]
+ public int LoadCount { get; internal set; }
+ [JsonIgnore]
+ public int LoadCharCount { get; set; }
+
+ public static Script New(String file)
+ {
+ return new Script()
+ {
+ Name = Path.GetFileName(file),
+ Code = System.IO.File.ReadAllText(file),
+ };
+ }
+
+ public static Script New(String name, String code, bool isEntryPoint = false)
+ {
+ return new Script()
+ {
+ Name = name,
+ Code = code,
+ IsEntryPoint = isEntryPoint,
+ };
+ }
+ }
+}