Ejemplo n.º 1
0
 public ScriptMethod(string name, Delegate method)
 {
     Name = name;
     Method = method;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 2
0
 public ScriptMethod(string name, Delegate method, ScriptTypes[] types)
 {
     Name = name;
     Method = method;
     Types = types;
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 3
0
 public ScriptMethod(string name, Delegate method, ScriptTypes[] types, ScriptTypes returnType)
 {
     Name = name;
     Method = method;
     Types = types;
     ReturnType = returnType;
 }
Ejemplo n.º 4
0
 public ScriptFunction(string name, Delegate function)
     : base(name, function)
 {
     Name = name;
     Method = function;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 5
0
 public ScriptTypeMethod(ScriptTypes extendType, string name, Delegate method, ScriptTypes[] types, ScriptTypes returnType)
 {
     ExtendType = extendType;
     Name = name;
     Method = method;
     Types = types;
     ReturnType = returnType;
 }
Ejemplo n.º 6
0
 public ScriptCondition(string name, Delegate condition)
     : base(name, condition)
 {
     Name = name;
     Method = condition;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Boolean;
 }
Ejemplo n.º 7
0
 public ScriptTypeMethod(ScriptTypes extendType, string name, Delegate method)
 {
     ExtendType = extendType;
     Name = name;
     Method = method;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 8
0
 public ScriptCondition(string name, Delegate condition, ScriptTypes[] types)
     : base(name, condition, types, ScriptTypes.Void)
 {
     Name = name;
     Method = condition;
     Types = types;
     ReturnType = ScriptTypes.Boolean;
 }
Ejemplo n.º 9
0
 public ScriptFunction(string name, Delegate function, ScriptTypes[] types, ScriptTypes returnType)
     : base(name, function, types, returnType)
 {
     Name = name;
     Method = function;
     Types = types;
     ReturnType = returnType;
 }
Ejemplo n.º 10
0
 public ScriptFunction(string name, Delegate function, ScriptTypes[] types)
     : base(name, function, types)
 {
     Name = name;
     Method = function;
     Types = types;
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 11
0
 public ScriptTypeFunction(ScriptTypes extendType, string name, Delegate function, ScriptTypes[] types, ScriptTypes returnType)
     : base(extendType, name, function, types, returnType)
 {
     ExtendType = extendType;
     Name = name;
     Method = function;
     Types = types;
     ReturnType = returnType;
 }
Ejemplo n.º 12
0
 public ScriptTypeCondition(ScriptTypes extendType, string name, Delegate condition, ScriptTypes[] types)
     : base(extendType, name, condition, types)
 {
     ExtendType = extendType;
     Name = name;
     Method = condition;
     Types = types;
     ReturnType = ScriptTypes.Boolean;
 }
Ejemplo n.º 13
0
 public static bool IsList(ScriptTypes type)
 {
     switch(type)
     {
         case ScriptTypes.ListString:
         case ScriptTypes.ListInteger:
         case ScriptTypes.ListDouble:
         case ScriptTypes.ListBoolean:
             return true;
     }
     return false;
 }
Ejemplo n.º 14
0
        public static IScript CreateScript(ScriptTypes type) {
            IScript newScript;

            switch (type) {
                case ScriptTypes.Roslyn:
                    newScript = new RoslynScript();
                    break;
                case ScriptTypes.Lua:
                default:
                    newScript = new LuaScript();
                    break;
            }

            return newScript;
        }
Ejemplo n.º 15
0
        public static IScript GetScript(byte[] scriptBytes, ScriptTypes scriptType) {
            IScript script = null;
            
            if (scriptBytes != null) {
                switch (scriptType) {
                    case ScriptTypes.Lua:
                        script = new LuaScript(scriptBytes);
                        break;
                    case ScriptTypes.Roslyn:
                        script = new RoslynScript(scriptBytes);
                        break;
                    default:
                        break;
                }
            }

            return script;
        }
Ejemplo n.º 16
0
 internal static void Write(ScriptTypes.Script script, DateTime scriptExecuted, string result)
 {
     if (!HaveAlreadyRunLogTableCreateScript)
     {
         UnitTestUtilities.Sql.SqlHelper.Execute(Global.ConnectionString, SqlToCreateLogTableIfNecessary);
     }
     SqlConnection conn = new SqlConnection(Global.ConnectionString);
     SqlCommand cmd = new SqlCommand(@"INSERT INTO UpdateScriptLog (ToolStarted,ScriptExecuted,ScriptName,ScriptType,ScriptModified,Result) VALUES (@ToolStarted,@ScriptExecuted,@ScriptName,@ScriptType,@ScriptModified,@Result)", conn);
     cmd.Parameters.Add(new SqlParameter("@ToolStarted", Global.ToolStarted));
     cmd.Parameters.Add(new SqlParameter("@ScriptExecuted", scriptExecuted));
     cmd.Parameters.Add(new SqlParameter("@ScriptName", script.File.Name));
     cmd.Parameters.Add(new SqlParameter("@ScriptType", script.ScriptType));
     cmd.Parameters.Add(new SqlParameter("@ScriptModified", script.File.LastWriteTime));
     cmd.Parameters.Add(new SqlParameter("@Result", result));
     try
     {
         conn.Open();
         cmd.ExecuteNonQuery();
     }
     finally
     {
         conn.Close();
     }
 }
        internal CannotFindDependencyScriptException(ScriptTypes.Script executingScript, string dependencyScriptName)
        {
			ExecutingScriptFileName = executingScript.File.FullName;
            message = String.Format("{0} is dependant on script '{1}' which could not be found", executingScript.File.FullName, dependencyScriptName);
        }
Ejemplo n.º 18
0
 public static void SaveScriptToDatabase(string scriptID, string scriptText, ScriptTypes scriptType) { }
Ejemplo n.º 19
0
 public ScriptTypeProperty(ScriptTypes extendType, string name, Delegate function)
 {
     ExtendType = extendType;
     Name = name;
     Function = function;
 }
 public ScriptExecutionException(ScriptTypes.Script script, Exception ex):base("Error in " + script.File.Name + "\n" + ex.Message, ex)
 {
     this.script = script;
 }
Ejemplo n.º 21
0
		public static async void SaveScriptToDatabase(string scriptID, string scriptText, ScriptTypes scriptType) {
			var collection = MongoUtils.MongoData.GetCollection<Script>("Scripts", "Action");

            IScript script = MongoUtils.MongoData.RetrieveObjectAsync<Script>(collection, x => x.ID == scriptID).Result;
           
            if (script == null) {
                script = ScriptFactory.CreateScript(scriptType);
            }

            script.ID = scriptID;
            script.ScriptByteArray = ASCIIEncoding.ASCII.GetBytes(scriptText);

            await MongoUtils.MongoData.SaveAsync<Script>(collection, s => s.ID == scriptID, script as Script);
		}