Ejemplo n.º 1
0
        public static void Compiler(DBSchema schema, bool check = true)
        {
            Helper.SetDirectory(Environment.SpecialFolder.LocalApplicationData);

            //var appDir = Tool.GetDirectory();
            Helper.Logs.Add(new StateInfo("Startup", "Cache Sources", "", StatusType.Information));


            var groups = schema.Procedures.Select(DBProcedureProcedureTypeInvoker.Instance,
                                                  CompareType.Equal,
                                                  ProcedureTypes.Source).GroupBy((p) => p.DataName);

            foreach (var group in groups)
            {
                if (check && IsCompiled(group))
                {
                    Assembly TempAssembly = Assembly.LoadFrom(group.Key);
                    foreach (var procedure in group)
                    {
                        procedure.TempAssembly = TempAssembly;
                    }
                }
                else
                {
                    Compile(group.Key, group, out var result, false);
                    if (result.Errors.Count > 0)
                    {
                        throw new Exception(DBProcedure.CompilerError(result));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ParseAssembly(byte[] assemblyData, string fileName)
        {
            Assembly assembly = Assembly.Load(assemblyData);

            if (assembly != null)
            {
                //string name = Path.GetFileName(fileName);
                //Procedure proc = FlowEnvir.Procedures.GetByCode(name) as Procedure;
                //if (proc == null)
                //{
                //    proc = new Procedure();
                //    proc.Code = a.GetName().Name;
                //    proc.ProcedureType = ProcedureTypes.Group;
                //    proc.Name = Localize.Get(a.GetName().Name, a.GetName().Name);
                //    proc.Save();
                //}
                Type[] types = assembly.GetExportedTypes();
                foreach (Type type in types)
                {
                    if (type.GetInterface("IDockContent") != null || TypeHelper.IsInterface(type, typeof(IProjectEditor)))
                    {
                        DBProcedure procedure = Store[TypeHelper.FormatBinary(type)];
                        if (procedure == null)
                        {
                            procedure = new DBProcedure()
                            {
                                ProcedureType = ProcedureTypes.Assembly,
                                Name          = TypeHelper.FormatBinary(type),
                                DisplayName   = Locale.Get(type),
                                Group         = this,
                                DataName      = fileName
                            };
                            Store.Add(procedure);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public DBProcParameterList(DBProcedure procedure)
 {
     this.Procedure = procedure;
 }
Ejemplo n.º 4
0
 public static string Execute(DBProcedure proc, ExecuteArgs param)
 {
     return(Execute(new MemoryStream(proc.Data), proc.DataName, param));
 }