Esempio n. 1
0
        public void Init(IPublicApi api)
        {
            api_ = api;

            PluginInitContext context = new PluginInitContext();
            context.Api = api;

            var PluginFileList = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location))
                .Where(x => Path.GetFileName(x).StartsWith("CozyLauncher.Plugin.") && x.EndsWith(".dll"));
            foreach (var p in PluginFileList)
            {
                IPluginLoader pl = new CSharpPluginLoader(p);
                plugins_.AddRange(pl.GetPlugins(context).AsEnumerable());
            }

            var LuaPluginFileList = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location))
                .Where(x => Path.GetFileName(x).StartsWith("CozyLauncher.Plugin.") && x.EndsWith(".lua"));
            foreach (var p in LuaPluginFileList)
            {
                IPluginLoader pl = new LuaPluginLoader(p);
                plugins_.AddRange(pl.GetPlugins(context).AsEnumerable());
            }

            plugins_.AddRange(CppPluginLoader.Instance.GetPlugins(context).AsEnumerable());
        }
Esempio n. 2
0
File: Main.cs Progetto: xxy1991/cozy
 public override PluginInfo Init(PluginInitContext context)
 {
     context_ = context;
     var info = new PluginInfo();
     info.Keyword = "mryj";
     return info;
 }
Esempio n. 3
0
 public List<IPlugin> GetPlugins(PluginInitContext context)
 {
     List<IPlugin> ps = new List<IPlugin>();
     try
     {
         Assembly asm = Assembly.LoadFile(file_);
         List<Type> types = asm.GetTypes()
             .Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces()
             .Contains(typeof(IPlugin)))
             .ToList();
         foreach (var type in types)
         {
             var plugin = Activator.CreateInstance(type) as IPlugin;
             if (plugin != null)
             {
                 plugin.Init(context);
                 ps.Add(plugin);
             }
         }
     }
     catch (Exception)
     {
     }
     return ps;
 }
Esempio n. 4
0
File: Main.cs Progetto: xxy1991/cozy
        public override PluginInfo Init(PluginInitContext context)
        {
            var types = Assembly.GetExecutingAssembly().GetTypes().Where(x =>
            {
                return x.Namespace == @"CozyLauncher.Plugin.Program.ProgramSource" && x.GetInterface("ISource") != null;
            });

            foreach (var type in types)
            {
                ISource inst = null;
                try
                {
                    inst = (ISource)Activator.CreateInstance(type);
                }
                catch
                {
                    continue;
                }
                if (inst != null)
                {
                    SourceList.Add(inst);
                }
            }

            Update();

            context_ = context;
            var info = new PluginInfo();
            info.Keyword = "*";
            return info;
        }
Esempio n. 5
0
File: Main.cs Progetto: xxy1991/cozy
 public override PluginInfo Init(PluginInitContext context)
 {
     this.context_ = context;
     var info = new PluginInfo();
     info.Keyword = "ydfy";
     return info;
 }
Esempio n. 6
0
File: Main.cs Progetto: xxy1991/cozy
 public override PluginInfo Init(PluginInitContext context)
 {
     context_ = context;
     var info = new PluginInfo();
     info.Keyword = "*";
     LoadActionData();
     return info;
 }
Esempio n. 7
0
File: Main.cs Progetto: xxy1991/cozy
 public override PluginInfo Init(PluginInitContext context)
 {
     context_ = context;
     InitPathList();
     var info = new PluginInfo();
     info.Keyword = "p";
     return info;
 }
Esempio n. 8
0
        public SettingWindow(PluginInitContext context = null)
        {
            InitializeComponent();

            _context = context;

            this.ViewModel.PropertyChanged += ViewModel_PropertyChanged;
        }
Esempio n. 9
0
File: Main.cs Progetto: xxy1991/cozy
 public override PluginInfo Init(PluginInitContext context)
 {
     _context = context;
     var info = new PluginInfo()
     {
         Keyword = "*",
     };
     return info;
 }
Esempio n. 10
0
File: Main.cs Progetto: xxy1991/cozy
        public override PluginInfo Init(PluginInitContext context)
        {
            TaskManager.Initialize(new TaskRegistry());

            context_ = context;
            var info = new PluginInfo();
            info.Keyword = "xiuxi";
            return info;
        }
Esempio n. 11
0
 public override PluginInfo Init(PluginInitContext context)
 {
     context_ = context;
     yampContext = Parser.PrimaryContext;
     Parser.InteractiveMode = false;
     Parser.UseScripting = false;
     var info = new PluginInfo();
     info.Keyword = "*";
     return info;
 }
Esempio n. 12
0
 public List<IPlugin> GetPlugins(PluginInitContext context)
 {
     for (int a = 0; a < CppPluginInterop.GetPluginCount(); a++)
     {
         var p = new CppPluginWrapper(this, a);
         p.Init(context);
         plugins_.Add(p);
     }
     return plugins_;
 }
Esempio n. 13
0
 public List<IPlugin> GetPlugins(PluginInitContext context)
 {
     List<IPlugin> ps = new List<IPlugin>();
     try
     {
         var plugin = new LuaPluginWrapper();
         if (plugin.Load(file_))
         {
             plugin.Init(context);
             ps.Add(plugin);
         }
     }
     catch (Exception)
     {
     }
     return ps;
 }
Esempio n. 14
0
File: Main.cs Progetto: xxy1991/cozy
        public override PluginInfo Init(PluginInitContext context)
        {
            this.context_ = context;
            var info = new PluginInfo();
            info.Keyword = __KEYWORD;

            // init Info
            string _filePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/Resources/ExpressInfo.json";

            if (File.Exists(_filePath))
            {
                string _txtStr = File.ReadAllText(_filePath);
                object _object = JsonConvert.DeserializeObject<List<ExpressDataInfo>>(_txtStr);
                m_listInfo = _object as List<ExpressDataInfo>;
            }

            return info;
        }
Esempio n. 15
0
 public PluginInfo Init(PluginInitContext context)
 {
     return null;
 }
Esempio n. 16
0
 public PluginInfo Init(PluginInitContext context)
 {
     return plugins_.Init(id_, context);
 }
Esempio n. 17
0
 public PluginInfo Init(int id, PluginInitContext context)
 {
     PluginInfo pi = new PluginInfo();
     CppPluginInterop.Init(id);
     return pi;
 }
Esempio n. 18
0
 public virtual PluginInfo Init(PluginInitContext context)
 {
     throw new NotImplementedException();
 }