private static void docscript(Assembly myAssembly, List <string> myNames) { AtReflection.docscript.Clear(); using (SqlDataReader dataReader = dbconn._db.GetDataReader2("select * from docscript where deleted is null and activescript = 1")) { while (dataReader.Read()) { if (dataReader["dll"] != DBNull.Value) { AtScript atScript = new AtScript(); atScript.Name = dataReader["name"].ToString(); atScript.NumPos = Useful.GetInt32(dataReader["numpos"]); atScript.iddocscript = Useful.GetInt32(dataReader["iddocscript"]); // string typeFullName = Script.GetFullTypeName("docscript", atScript.Name); if (myNames.Contains(typeFullName)) { atScript.scriptclass = myAssembly.CreateInstance(typeFullName); } else { Assembly assembly = Assembly.Load(Atechnology.Components.ZipArchiver.UnZip((byte[])dataReader["dll"])); atScript.scriptclass = assembly.CreateInstance("Atechnology.ecad.Calc.RunCalc"); } System.Type type = atScript.scriptclass.GetType(); atScript.start = type.GetMethod("Run"); AtReflection.docscript.Add(atScript); } } } }
private static void modelscript(Assembly myAssembly, List <string> myNames) { AtReflection.script.Clear(); using (SqlDataReader dataReader = dbconn._db.GetDataReader2("select numpos, name, modelpart_name, dll, typ, idversion from view_modelscript order by modelpart_numpos, numpos")) { while (dataReader.Read()) { AtScript atScript = new AtScript(); atScript.Name = dataReader["name"].ToString(); atScript.NumPos = Useful.GetInt32(dataReader["numpos"]); atScript.ModelPart = dataReader["modelpart_name"].ToString(); atScript.ScriptType = Convert.ToInt32(dataReader["typ"]); atScript.idversion = (int)dataReader["idversion"]; // string typeFullName = Script.GetFullTypeName("modelscript", atScript.Name); if (myNames.Contains(typeFullName)) { atScript.scriptclass = myAssembly.CreateInstance(typeFullName); } else { Assembly assembly = Assembly.Load(Atechnology.Components.ZipArchiver.UnZip((byte[])dataReader["dll"])); atScript.scriptclass = assembly.CreateInstance("Atechnology.ecad.Calc.RunCalc"); } Type type = atScript.scriptclass.GetType(); atScript.start = type.GetMethod("Run"); AtReflection.script.Add(atScript); } } }