Ejemplo n.º 1
0
 public ScriptFunction(string name, Delegate function) : base(name, function)
 {
     Name       = name;
     Method     = function;
     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, ScriptTypes[] types, ScriptTypes returnType) : base(name, function, types, returnType)
 {
     Name       = name;
     Method     = function;
     Types      = types;
     ReturnType = returnType;
 }
Ejemplo n.º 5
0
 public ScriptMethod(string name, Delegate method)
 {
     Name = name;
     Method = method;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 6
0
 public ScriptMethod(string name, Delegate method, ScriptTypes[] types)
 {
     Name       = name;
     Method     = method;
     Types      = types;
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the specified <see cref="IScriptType"/>.
        /// </summary>
        /// <param name="p_strScriptTypeId">The id of the <see cref="IScriptType"/> to retrieve.</param>
        /// <returns>The <see cref="IScriptType"/> whose id matches the given id. <c>null</c> is returned
        /// if no <see cref="IScriptType"/> with the given id is in the registry.</returns>
        public IScriptType GetType(string p_strScriptTypeId)
        {
            IScriptType stpType = null;

            ScriptTypes.TryGetValue(p_strScriptTypeId, out stpType);
            return(stpType);
        }
Ejemplo n.º 8
0
 public ScriptMethod(string name, Delegate method, ScriptTypes[] types, ScriptTypes returnType)
 {
     Name       = name;
     Method     = method;
     Types      = types;
     ReturnType = returnType;
 }
Ejemplo n.º 9
0
        public static object GetObject(ScriptTypes luaType, ScriptState luaState, int index)
        {
            switch (luaType)
            {
            case ScriptTypes.Boolean:
                return(LuaCore.ToBool(luaState, index));

            case ScriptTypes.Number:
                return(LuaCore.ToNumber(luaState, index));

            case ScriptTypes.String:
                return(LuaCore.ToString(luaState, index));

            case ScriptTypes.Table:
                return(new Table(luaState, index));

            case ScriptTypes.Function:
                return(new ScriptFunction(luaState, index));

            case ScriptTypes.UserData:
                var runtime = LuaRuntimePool.GetRuntime(luaState);
                return(runtime.ObjectMgr.GetObject(luaState, index));
            }
            return(null);
        }
Ejemplo n.º 10
0
 public BlockChainAddress(ScriptTypes type, Networks network, Key key)
 {
     Type          = type;
     Network       = network;
     _key          = key;
     PublicKeyHash = key.GetPublicKeyHashed();
 }
Ejemplo n.º 11
0
        private double ExecuteScripts(IndigoInfo targetIndigo, ScriptTypes scriptType, bool useTransaction)
        {
            var    scripts = targetIndigo.IndigoVersion.GetScripts(scriptType);
            double total   = ExecuteNonQuery(targetIndigo, null, useTransaction, scripts);

            return(total);
        }
Ejemplo n.º 12
0
 public ScriptMethod(string name, Delegate method)
 {
     Name       = name;
     Method     = method;
     Types      = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 13
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.º 14
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.º 15
0
 public ScriptCondition(string name, Delegate condition)
     : base(name, condition)
 {
     Name       = name;
     Method     = condition;
     Types      = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Boolean;
 }
Ejemplo n.º 16
0
 public ScriptCondition(string name, Delegate condition)
     : base(name, condition)
 {
     Name = name;
     Method = condition;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Boolean;
 }
Ejemplo n.º 17
0
 public ScriptTypeMethod(ScriptTypes extendType, string name, Delegate method)
 {
     ExtendType = extendType;
     Name = name;
     Method = method;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 18
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.º 19
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.º 20
0
 public ScriptFunction(string name, Delegate function, ScriptTypes[] types)
     : base(name, function, types)
 {
     Name = name;
     Method = function;
     Types = types;
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 21
0
 public ScriptFunction(string name, Delegate function)
     : base(name, function)
 {
     Name = name;
     Method = function;
     Types = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 22
0
 public ScriptTypeMethod(ScriptTypes extendType, string name, Delegate method)
 {
     ExtendType = extendType;
     Name       = name;
     Method     = method;
     Types      = new ScriptTypes[] { };
     ReturnType = ScriptTypes.Void;
 }
Ejemplo n.º 23
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.º 24
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.º 25
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.º 26
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.º 27
0
 /// <summary>Gets the default script from the document based on whether the contained SAW item is a group, or an escape item, or neither</summary>
 public Script GetDefaultScript(ScriptTypes which, Document doc)
 {
     if ((Element as Item)?.IsGroup ?? false)
     {
         return(doc.DefaultGroupScripts.GetScript(which));
     }
     if ((Element as Item)?.IsEscape ?? false)
     {
         return(doc.DefaultEscapeScripts.GetScript(which));
     }
     return(doc.DefaultItemScripts.GetScript(which));
 }
Ejemplo n.º 28
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.º 29
0
        private static void SaveFile(string data, ScriptTypes scriptType, FileExtensions extension)
        {
            string savePath = Path.Combine(projectPath, FolderTypes.Scripts.ToString(), $"{scriptType.ToString()}.{extension.ToString().ToLower()}");

            using (FileStream fileStrem = new FileStream(savePath, FileMode.Create))
                using (StreamWriter streamWriter = new StreamWriter(fileStrem))
                {
                    streamWriter.Write(data, 0, data.Length);
                    streamWriter.Close();
                    fileStrem.Close();
                }
        }
Ejemplo n.º 30
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.º 31
0
        /// <summary>
        /// Yrittää kääntää assemblyn, jos virheitä ilmenee, logger
        /// näyttää errorit userille.
        /// </summary>
        /// <param name="fullname">Scriptin koko nimi (path + filename + extension)</param>
        /// <returns>Käännetty assembly tai null jos kääntäminen ei onnistu.</returns>
        public ScriptAssembly CompileScript(string fullname, string scriptName)
        {
            CompilerResults compilerResults = null;

            using (CSharpCodeProvider csharpCompiler = new CSharpCodeProvider())
            {
                compilerResults = csharpCompiler.CompileAssemblyFromFile(GenerateCompilerOptions(), fullname);

                // Jos kääntämisen yhteydessä ilmenee virheitä, annetaan loggerin handlata errorit
                // ja asetetaan resultit nulliksi.
                if (compilerResults.Errors.HasErrors)
                {
                    compilerErrorLogger.ShowErrors(compilerResults.Errors, fullname);

                    compilerResults = null;
                }
                else
                {
                    List <Type> scripts = compilerResults.CompiledAssembly
                                          .GetTypes()
                                          .Where(c => c.GetInterface("IScript", true) != null)
                                          .ToList();

                    for (int i = 0; i < scripts.Count; i++)
                    {
                        ScriptAttribute attribute = scripts[i].GetCustomAttributes(false)
                                                    .FirstOrDefault(a => a.GetType() == typeof(ScriptAttribute))
                                                    as ScriptAttribute;

                        if (attribute != null && !attribute.IsHidden)
                        {
                            string[] methods = scripts[i].GetMethods().Select <MethodInfo, string>(m => m.Name).ToArray();
                            string[] members = scripts[i].GetMembers().Select <MemberInfo, string>(m => m.Name).ToArray();

                            for (int j = 0; j < ScriptTypes.Count; j++)
                            {
                                string[] myMethods = ScriptTypes[j].GetMethods().Select <MethodInfo, string>(m => m.Name).ToArray();
                                string[] myMembers = ScriptTypes[j].GetMembers().Select <MemberInfo, string>(m => m.Name).ToArray();

                                if (Array.TrueForAll(methods, m => myMethods.Contains(m)) && Array.TrueForAll(members, m => myMembers.Contains(m)))
                                {
                                    return(new ScriptAssembly(ScriptTypes.Find(t => t.Name == scriptName), scriptName, fullname));
                                }
                            }
                        }
                    }
                }
            }

            return(compilerResults == null ? null : new ScriptAssembly(compilerResults.CompiledAssembly, scriptName, fullname));
        }
Ejemplo n.º 32
0
        public Dictionary <int, Tuple <ScriptFunction, FileInfo> > GetScripts(ScriptTypes scriptType, IndigoVersionInfo migrateFrom = null)
        {
            Dictionary <int, Tuple <ScriptFunction, FileInfo> > scripts = new Dictionary <int, Tuple <ScriptFunction, FileInfo> >();

            DirectoryInfo scriptsDir;


            switch (scriptType)
            {
            case ScriptTypes.Create:
            case ScriptTypes.LoadLookup:
            case ScriptTypes.CreateEnterprise:
                scriptsDir = RootScriptsPath.GetDirectories(scriptType.ToString(), SearchOption.TopDirectoryOnly).FirstOrDefault();
                break;

            case ScriptTypes.MigrationSetup:
                scriptsDir = new DirectoryInfo(Path.Combine(_rootScriptsPath.FullName, MIGRATION_FOLDER, migrateFrom.FolderName, MigrationSetup_FOLDER));
                break;

            //case ScriptTypes.PreMigration:
            //    break;
            case ScriptTypes.MigrationBulkCopy:
                scriptsDir = new DirectoryInfo(Path.Combine(_rootScriptsPath.FullName, MIGRATION_FOLDER, migrateFrom.FolderName, MigrationBulkCopy_FOLDER));
                break;

            //case ScriptTypes.PostMigration:
            //    break;
            case ScriptTypes.MigrationCleanup:
                scriptsDir = new DirectoryInfo(Path.Combine(_rootScriptsPath.FullName, MIGRATION_FOLDER, migrateFrom.FolderName, MigrationCleanup_FOLDER));
                break;

            default:
                throw new ArgumentException("Not supported: " + scriptType.ToString(), "scriptType");
            }

            scripts = GetScripts(scriptsDir);


            //if (scriptType == ScriptTypes.Create || scriptType == ScriptTypes.LoadLookup)
            //    scriptsDir = RootScriptsPath.GetDirectories(scriptType.ToString(), SearchOption.TopDirectoryOnly).FirstOrDefault();
            //else if (scriptType == ScriptTypes.Migration && migrateFrom != null)
            //    scriptsDir = new DirectoryInfo(Path.Combine(_rootScriptsPath.FullName, MIGRATION_FOLDER, migrateFrom.FolderName, "BulkCopy"));
            //else
            //    throw new ArgumentException("Cannot be null.", "migrateFrom");



            return(scripts);
        }
Ejemplo n.º 33
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.º 34
0
        void setScriptTypeFromCombo()
        {
            try
            {
                if (cmbxScriptType.SelectedItem == null)
                {
                    scriptType = ScriptTypes.IdentityInsert;
                    return;
                }

                scriptType = (ScriptTypes)cmbxScriptType.SelectedItem;
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
Ejemplo n.º 35
0
        public void BeforePluginsLoaded(IAppHost appHost)
        {
            if (ScriptContext == null)
            {
                ScriptContext = appHost.AssertPlugin <SharpPagesFeature>();
            }

            if (!ScriptContext.ScriptLanguages.Contains(ScriptLisp.Language))
            {
                ScriptContext.ScriptLanguages.Add(ScriptLisp.Language);
            }
            if (AllowScriptingOfAllTypes != null)
            {
                ScriptContext.AllowScriptingOfAllTypes = AllowScriptingOfAllTypes.Value;
            }

            if (!ScriptMethods.IsEmpty())
            {
                ScriptContext.ScriptMethods.AddRange(ScriptMethods);
            }
            if (!ScriptBlocks.IsEmpty())
            {
                ScriptContext.ScriptBlocks.AddRange(ScriptBlocks);
            }
            if (!ScanTypes.IsEmpty())
            {
                ScriptContext.ScanTypes.AddRange(ScanTypes);
            }
            if (!ScanAssemblies.IsEmpty())
            {
                ScriptContext.ScanAssemblies.AddRange(ScanAssemblies);
            }

            if (!ScriptAssemblies.IsEmpty())
            {
                ScriptContext.ScriptAssemblies.AddRange(ScriptAssemblies);
            }
            if (!ScriptTypes.IsEmpty())
            {
                ScriptContext.ScriptTypes.AddRange(ScriptTypes);
            }
            if (!ScriptNamespaces.IsEmpty())
            {
                ScriptContext.ScriptNamespaces.AddRange(ScriptNamespaces);
            }
        }
Ejemplo n.º 36
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.º 37
0
        private void UpdateScriptTypes()
        {
            DataTable DT = new DataTable();

            DT.Columns.Add("Type", typeof(string));
            DT.Columns.Add("Interface", typeof(string));

            if (LoadedScripts.SelectedRows.Count > 0)
            {
                string N = LoadedScripts.SelectedRows[0].Cells[0].Value.ToString();

                if (Pinball.Scripts.Any(sc => sc.File.FullName == N))
                {
                    Script S = Pinball.Scripts[N];

                    if (S.Assembly != null)
                    {
                        foreach (Type T in S.Assembly.GetTypes().Where(t => typeof(IEffect).IsAssignableFrom(t) && !t.IsAbstract))
                        {
                            DT.Rows.Add(T.Name, "IEffect");
                        }

                        foreach (Type T in S.Assembly.GetTypes().Where(t => typeof(IToy).IsAssignableFrom(t) && !t.IsAbstract))
                        {
                            DT.Rows.Add(T.Name, "IToy");
                        }
                    }
                }
            }



            ScriptTypes.ClearSelection();
            ScriptTypes.Columns.Clear();
            ScriptTypes.AutoGenerateColumns = true;
            ScriptTypes.DataSource          = DT;
            ScriptTypes.Refresh();
            ScriptTypes.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);

            UpdateTypeXml();
        }
Ejemplo n.º 38
0
        public static string GetScriptTypeString(ScriptTypes type)
        {
            string scriptType;

            switch (type)
            {
            case ScriptTypes.JavaScript:
            {
                scriptType = "text/javascript";

                break;
            }

            default:
            {
                throw new NotImplementedException();
            }
            }

            return(scriptType);
        }
Ejemplo n.º 39
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();
     }
 }
Ejemplo n.º 40
0
 public ScriptTypeProperty(ScriptTypes extendType, string name, Delegate function)
 {
     ExtendType = extendType;
     Name       = name;
     Function   = function;
 }
Ejemplo n.º 41
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.º 43
0
 public BlockChainAddress(ScriptTypes type, Networks network, IEnumerable <byte> publicKeyHash)
 {
     Type          = type;
     Network       = network;
     PublicKeyHash = publicKeyHash;
 }
Ejemplo n.º 44
0
 public ExternalScript(ScriptTypes type, string uri)
     : base(type, null)
 {
     Uri = uri;
 }
        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.º 46
0
        public void Initialize(string scriptLine)
        {
            this.RawScriptLine = scriptLine;

            char firstChar = scriptLine[0];

            switch (firstChar)
            {
            case '@':
                this.ScriptType = ScriptTypes.Command;
                this.Value      = scriptLine.Remove(0, 1);
                break;

            case ':':
                string structureType = scriptLine.Remove(0, 1);

                if (structureType.Contains(":") == true)
                {
                    this.Value    = structureType.Remove(0, structureType.IndexOf(":") + 1);
                    structureType = structureType.Remove(structureType.IndexOf(":"));
                }

                switch (structureType.ToLower())
                {
                case "if":
                    this.ScriptType = ScriptTypes.@if;
                    break;

                case "when":
                    this.ScriptType = ScriptTypes.when;
                    break;

                case "then":
                    this.ScriptType = ScriptTypes.then;
                    break;

                case "else":
                    this.ScriptType = ScriptTypes.@else;
                    break;

                case "endif":
                    this.ScriptType = ScriptTypes.endif;
                    break;

                case "end":
                    this.ScriptType = ScriptTypes.end;
                    break;

                case "select":
                    this.ScriptType = ScriptTypes.@select;
                    break;

                case "endwhen":
                    this.ScriptType = ScriptTypes.endwhen;
                    break;

                case "return":
                    this.ScriptType = ScriptTypes.@return;
                    break;

                case "endscript":
                    this.ScriptType = ScriptTypes.endscript;
                    break;

                case "while":
                    this.ScriptType = ScriptTypes.@while;
                    break;

                case "endwhile":
                    this.ScriptType = ScriptTypes.endwhile;
                    break;

                case "exitwhile":
                    this.ScriptType = ScriptTypes.exitwhile;
                    break;

                default:
                    LogIllegalLine(scriptLine);
                    this.IsReady = true;
                    break;
                }
                this.CanContinue = true;
                break;

            case '#':
                this.ScriptType  = ScriptTypes.Comment;
                this.Value       = scriptLine.Remove(0, 1);
                this.CanContinue = true;
                break;

            default:
                LogIllegalLine(scriptLine);
                this.IsReady     = true;
                this.CanContinue = true;
                break;
            }
        }
Ejemplo n.º 47
0
 public ScriptVariable(object value, ScriptTypes type)
 {
     Value = value;
     Type  = type;
 }
Ejemplo n.º 48
0
        private static List <string> GetScripts(ScriptTypes type, OHDbBaseClient dbClient)
        {
            string ObjectsPrefix           = dbClient.target.DBTablesPrefix;
            string _dbScriptsContainerPath = string.IsNullOrEmpty(dbClient.DbScriptsContainerPath) ? string.Empty : dbClient.DbScriptsContainerPath;

            string filter = string.Empty;

            switch (type)
            {
            case ScriptTypes.Tables:
                filter = "tables-v";
                break;

            case ScriptTypes.Procedures:
                filter = "procedures-v";
                break;

            case ScriptTypes.Views:
                filter = "views-v";
                break;

            case ScriptTypes.Data:
                filter = "data-v";
                break;

            default:
                break;
            }

            Assembly asm = Assembly.GetExecutingAssembly();

            string[] resNames  = asm.GetManifestResourceNames();
            Stream   sqlStream = null;


            List <string> list = new List <string>();

            if (resNames == null || resNames.Length == 0)
            {
                return(list);
            }
            for (int i = 0; i < resNames.Length; i++)
            {
                if (resNames[i].StartsWith(_dbScriptsContainerPath) && resNames[i].ToLower().Contains(filter.ToLower()))
                {
                    list.Add(resNames[i]);
                }
            }


            list.Sort(new ScriptFileNameComparer());

            for (int i = 0; i < list.Count; i++)
            {
                sqlStream = asm.GetManifestResourceStream(list[i]);
                using (StreamReader sr = new StreamReader(sqlStream))
                {
                    string script = sr.ReadToEnd();
                    list[i] = string.Format(script, ObjectsPrefix);
                }
            }

            return(list);
        }
Ejemplo n.º 49
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);
		}
Ejemplo n.º 50
0
 public ScriptVariable(string name, object value, ScriptTypes type)
 {
     Name  = name;
     Value = value;
     Type  = type;
 }
Ejemplo n.º 51
0
 public static void SaveScriptToDatabase(string scriptID, string scriptText, ScriptTypes scriptType) { }