示例#1
0
        public void LoadFrom(string path)
        {
            if (!Loaded.Add(path))
            {
                return;
            }

            var name = Path.GetFileName(path);

            Log.Info($"Loading {name}...");

            Assembly assembly;

            try
            {
                assembly = this.LoadAssembly(path);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return;
            }

            ProcessAssembly(assembly);

            SdkSetup.SetScriptsCount(Loaded.Count);
            Notification.Send($"SparkTech.SDK: Loaded {name}!");
        }
示例#2
0
        public void Load()
        {
            var files = Array.FindAll(Directory.GetFiles(Folder.Scripts), p => Path.GetExtension(p) == ".dll" && !Loaded.Contains(p));

            if (files.Length > 0)
            {
                Parallel.ForEach(files, this.LoadFrom);
            }
            else if (canWarn)
            {
                var content = SdkSetup.GetString("loaderContent");
                var header  = SdkSetup.GetString("loaderHeader");

                Notification.Send(content, header);
            }

            canWarn = true;
        }
示例#3
0
        public void Execute()
        {
            Compiler compiler = new Compiler();

            compiler.Options.Dependencies.Add("System.dll");
            compiler.Options.Dependencies.Add("System.Core.dll");
            compiler.Options.Dependencies.Add("System.Data.dll");
            compiler.Options.Dependencies.Add("System.XML.dll");
            compiler.Options.Dependencies.Add("Microsoft.CSharp.dll");

            compiler.Options.TargetFile = Path.Combine(SdkSetup.SdkPath, ForgePath);
            SdkSetup.SetFiles(compiler.Options, ForgeSource, ".cs", ".Build.cs", ".Setup.cs");

            foreach (string module in ForgeModules)
            {
                SdkSetup.SetFiles(compiler.Options, Path.Combine(SdkSetup.SdkPath, module), ".cs", ".Build.cs", ".Setup.cs");
            }

            compiler.Options.OutputType = CompilerOutputType.Console;
            compiler.Options.Debug      = false;

            compiler.Execute();
        }