Exemple #1
0
        public async override Task<bool> InitializeAsync(Framework.Interfaces.ICore core)
        {
            var p = new PluginSettings(core);

            //AddAction(ACTION_SETTINGS);
            AddAction(ACTION_REFRESH);
            AddAction(ACTION_SEP);

            _context = SynchronizationContext.Current;
            if (_context == null)
            {
                _context = new SynchronizationContext();
            }

            try
            {
                //copy the scripts to scripts folder
                string srcFolder = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "Scripts");
                string destFolder = core.CSScriptsPath;
                if (!Directory.Exists(destFolder))
                {
                    Directory.CreateDirectory(destFolder);
                }
                if (Directory.Exists(srcFolder))
                {
                    string[] files = Directory.GetFiles(srcFolder, "*.cs");
                    foreach (string f in files)
                    {
                        if (!File.Exists(Path.Combine(destFolder, Path.GetFileName(f)))
                            && !File.Exists(Path.Combine(destFolder, Path.GetFileName(string.Format("_{0}", f)))))
                        {
                            File.Copy(f, Path.Combine(destFolder, Path.GetFileName(f)), true);
                        }
                    }
                }
                PluginSettings.Instance.UserScriptsFolder = destFolder;
            }
            catch
            {
            }

            CSScriptLibrary.CSScript.ShareHostRefAssemblies = true;
            CSScriptLibrary.CSScript.CacheEnabled = true;

            return await base.InitializeAsync(core);
        }
Exemple #2
0
 public PluginSettings(ICore core)
 {
     _uniqueInstance = this;
     _core = core;
 }
Exemple #3
0
 public PluginSettings(ICore core)
 {
     _uniqueInstance = this;
     _core           = core;
 }