Пример #1
0
        //static T AddObject<T>(EnvDTE.Expression exp)
        //    where T : Visual3D
        //{
        //    Logger.Log(exp, string.Format("Reading ReadEnumerableMesh. Name: {0}, val: {1}, type: {2}", exp.Name, exp.Value, exp.Type));

        //    string type = "";
        //    Add3DGenericObjectDelegate obj3d = dictType2[type];

        //    MetaObject<T> obj = obj3d(exp) as MetaObject<T>;

        //    T v3d = obj.To3DObject();

        //    obj.VisualizationProperties(v3d);

        //    return v3d;
        //}
        //static ModelVisual3D AddEnumerableObject<T>(EnvDTE.Expression exp)
        //    where T : Visual3D
        //{
        //    Logger.Log(exp, string.Format("Reading ReadEnumerableMesh. Name: {0}, val: {1}, type: {2}", exp.Name, exp.Value, exp.Type));

        //    ModelVisual3D objs = new ModelVisual3D();

        //    foreach (EnvDTE.Expression exp1 in ReaderUtils.ReadEnumerable(exp))
        //    {
        //        if (!exp1.IsValidValue)// LG 170515 .Value == "null"
        //            continue;

        //        T obj = AddObject<T>(exp1);

        //        objs.Children.Add(obj);
        //    }

        //    return objs;
        //}


        internal static void LoadDlls()
        {
            ICollection <MetaObject> objs = GenericPluginLoader <MetaObject> .LoadPlugins(@"C:\Users\" + Environment.UserName + @"\AppData\Local\Dodo\3D VSualizer");

            foreach (MetaObject obj in objs)
            {
                string name = obj.DebuggerTypeName;
                string type = obj.GetType().FullName;
                try
                {
                    dictType_.Add(name, obj);
                    Logger.Log("", "added to dict this type " + type + " linking to: " + name);
                }
                catch (Exception e)
                {
                    Logger.Log("", "dictionary already has this type " + type);
                }

                //_Add3DObject add = Add(obj);

                //Add3DObjectDelegate addDel = new Add3DObjectDelegate((e, hv, dict, b) => Add3D(e, hv, dict, b, add));
                //// add to type dict
                //dictType.Add(name, addDel);
            }
        }
Пример #2
0
        /// <summary>
        /// Produces Exchange Rate Result Among Available Output Types
        /// </summary>
        /// <param name="username">User name for authentication</param>
        /// <param name="password">Pasword for authentication</param>
        public ExchangeRateAPI(string username, string password)
        {
            _username = username;
            _password = password;

            Log.Logger.Instance.Info($"UserName:{_username} created an instance of ExchangeRateAPI");

            Task.Run(() => CheckAuthentication()).Wait();

            if (Authentication.AuthService.IsAuthenticated == false)
            {
                Log.Logger.Instance.Error(new System.Security.Authentication.AuthenticationException($"UserName:{_username} You must authenticate yourself"));
                throw new System.Security.Authentication.AuthenticationException("You must authenticate yourself!");
            }

            string      CultureName = Thread.CurrentThread.CurrentCulture.Name;
            CultureInfo ci          = new CultureInfo(CultureName);

            if (ci.NumberFormat.NumberDecimalSeparator != ".")
            {
                ci.NumberFormat.NumberDecimalSeparator = ".";
                Thread.CurrentThread.CurrentCulture    = ci;
            }

            _plugins = new Dictionary <string, PluginContracts.IPlugin>();

            ICollection <PluginContracts.IPlugin> plugins = GenericPluginLoader <PluginContracts.IPlugin> .LoadPlugins(@"Plugins");

            foreach (var item in plugins)
            {
                _plugins.Add(item.Name, item);
            }

            Log.Logger.Instance.Info($"UserName:{_username} - There are {_plugins.Count.ToString()} plugins found. {string.Join("|", _plugins.Select(p => p.Key))}");
        }
Пример #3
0
        public static ICache Creator()
        {
            var pluginPath = ConfigurationManager.AppSettings["ParsCacheProviderPath"];
            var provider   = ConfigurationManager.AppSettings["ParsCacheProvider"];

            ICollection <ICache> plugins = GenericPluginLoader <ICache> .LoadPlugins(pluginPath);

            var plugin = plugins.FirstOrDefault(q => q.CacheProvider == provider);

            return(plugin);
        }
Пример #4
0
        private void bwDoWork(object sender, DoWorkEventArgs e)
        {
            plugins.Clear();

            DirectoryInfo pluginDirectory = new DirectoryInfo(pluginPath);

            if (!pluginDirectory.Exists)
            {
                pluginDirectory.Create();
            }

            pluginsCollection = GenericPluginLoader <IPlugin> .LoadPlugins(pluginPath);
        }
Пример #5
0
        public static void loadType()
        {
            ICollection <T> _sportExtensionInformation = GenericPluginLoader <T> .LoadPlugins("Plugins");

            // Did we get any results?
            if (_sportExtensionInformation != null)
            {
                foreach (T _isei in _sportExtensionInformation)
                {
                    if (!_plugins.ContainsKey(_isei.Sport))
                    {
                        _plugins.Add(_isei.Sport, _isei);
                    }
                }
            }
        }
        private void LoadPlugins()
        {
            string[] dllFileNames = null;
            if (Directory.Exists(PluginDirectory))
            {
                dllFileNames = Directory.GetFiles(PluginDirectory, "*.dll");
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            LoadedPlugins = GenericPluginLoader <UniversalPluginFramework> .LoadPlugins(PluginDirectory);

            foreach (UniversalPluginFramework plugin in LoadedPlugins)
            {
                plugin.OnLoad(PluginEditDirectory + @"\" + plugin.Name);
            }
        }
Пример #7
0
        private void Painter_Load(object sender, EventArgs e)
        {
            ThiknesscomboBox.SelectedItem = ThiknesscomboBox.Items[0];
            ContourcolorDialog.Color      = Color.Black;
            ContourColorButton.BackColor  = ContourcolorDialog.Color;
            BrushColorDialog.Color        = Color.White;
            BrushColorButton.BackColor    = BrushColorDialog.Color;
            foreach (var tb in tbList)
            {
                tb.ReadOnly = true;
            }
            ICollection <Figure> plugins = GenericPluginLoader <Figure> .LoadPlugins("Plugins");

            if (plugins != null)
            {
                foreach (var p in plugins)
                {
                    FigureList.figures.Add(p);
                    //Figure_comboBox.Items.Add()
                }
            }
            //var house = new UserFigure("house");
            //house.UserFigureList.Add(new CompositFigure(new List<Point> { new Point(0, 100), new Point(100, 0), new Point(200, 100) }) { Figure = new Triangle() });
            //house.UserFigureList.Add(new CompositFigure(new List<Point> { new Point(100, 50), new Point(120, 50) }) { Figure = new Circle() });
            //Picture.Serialize(new List<Figure> { { house } }, "house.dat");

            var list = Picture.Deserialize("CustomFigures.dat");

            if (list != null)
            {
                foreach (var uf in list)
                {
                    Figure_comboBox.Items.Add(uf.GetName());
                    FigureList.figures.Add(uf);
                }
            }
            //Figure_comboBox.Items.Add(house.GetName());
            //FigureList.figures.Add(house);
            if (Figure_comboBox.Items.Count > 0)
            {
                Figure_comboBox.SelectedItem = Figure_comboBox.Items[0];
            }
        }
Пример #8
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (this.pluginChanges)
            {
                _ = MainForm.MessageManager.ShowInfo("A plugin was installed, uninstalled or updated. All plugins are about to be reloaded.", "Info!", Convert.ToBoolean(SettingsFile.SettingsJson.UseNotifications));
                var komloader        = new GenericPluginLoader <IKomPlugin>();
                var callbackloader   = new GenericPluginLoader <ICallbackPlugin>();
                var encryptionloader = new GenericPluginLoader <IEncryptionPlugin>();
#if NET5_0_OR_GREATER
                komloader.UnloadPlugins(MainForm.Contexts);
                MainForm.Contexts.Clear();
#else
                komloader.UnloadPlugins(MainForm.Domains);
                MainForm.Domains.Clear();
#endif
                var komplugins = komloader.LoadPlugins("plugins", out var domains1, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Komplugins.AddRange(komplugins);
                var callbackplugins = callbackloader.LoadPlugins("plugins", out var domains2, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Callbackplugins.AddRange(callbackplugins);
                var encryptionplugins = encryptionloader.LoadPlugins("plugins", out var domains3, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Encryptionplugins.AddRange(encryptionplugins);
#if NET5_0_OR_GREATER
                MainForm.Contexts.AddRange(domains1);
                MainForm.Contexts.AddRange(domains2);
                MainForm.Contexts.AddRange(domains3);
#else
                MainForm.Domains.AddRange(domains1);
                MainForm.Domains.AddRange(domains2);
                MainForm.Domains.AddRange(domains3);
#endif
            }
            else
            {
                this.Close();
            }
        }
Пример #9
0
        /// <summary>
        /// Initializes the MainControl's constants.
        /// </summary>
        public void LoadControl()
        {
            this.MakeTrayIcon();
            var closing = false;

            if (!Directory.Exists(Application.StartupPath + "\\koms"))
            {
                Directory.CreateDirectory(Application.StartupPath + "\\koms");
            }

            if (ExecutionManager.IsElsKomRunning() == true)
            {
                MessageManager.ShowError("Sorry, Only 1 Instance is allowed at a time.", "Error!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                closing = true;
            }
            else
            {
                SettingsFile.Settingsxml = new XmlObject(SettingsFile.Path, "<Settings></Settings>");
                this.elsDir = SettingsFile.Settingsxml?.TryRead("ElsDir");
                if (this.elsDir.Length < 1)
                {
                    MessageManager.ShowInfo("Welcome to Els_kom." + Environment.NewLine + "Now your fist step is to Configure Els_kom to the path that you have installed Elsword to and then you can Use the test Mods and the executing of the Launcher features. It will only take less than 1~3 minutes tops." + Environment.NewLine + "Also if you encounter any bugs or other things take a look at the Issue Tracker.", "Welcome!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                    this.ConfigForm?.Invoke(this, new EventArgs());
                }

                if (!int.TryParse(SettingsFile.Settingsxml?.TryRead("SaveToZip"), out var saveToZip1))
                {
                    // do nothing to silence a compile error.
                }

                if (!int.TryParse(SettingsFile.Settingsxml?.TryRead("LoadPDB"), out var loadPDB1))
                {
                    // do nothing to silence a compile error.
                }

                var komplugins = GenericPluginLoader <IKomPlugin> .LoadPlugins("plugins", Convert.ToBoolean(saveToZip1), Convert.ToBoolean(loadPDB1));

                KOMStream.Komplugins.AddRange(komplugins);
                var callbackplugins = GenericPluginLoader <ICallbackPlugin> .LoadPlugins("plugins", Convert.ToBoolean(saveToZip1), Convert.ToBoolean(loadPDB1));

                ExecutionManager.Callbackplugins.AddRange(callbackplugins);
                if (!Git.IsMaster)
                {
                    MessageManager.ShowInfo("This branch is not the master branch, meaning this is a feature branch to test changes. When finished please pull request them for the possibility of them getting merged into master.", "Info!", Convert.ToBoolean(Convert.ToInt32(SettingsFile.Settingsxml?.TryRead("UseNotifications") != string.Empty ? SettingsFile.Settingsxml?.TryRead("UseNotifications") : "0")));
                }

                if (Git.IsDirty)
                {
                    var resp = MessageBox.Show("This build was compiled with Uncommitted changes. As a result, this build might be unstable. Are you sure you want to run this build to test some changes to the code?", "Info!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (resp == DialogResult.No)
                    {
                        closing = true;
                    }
                }
            }

            if (!closing)
            {
                if (this.components == null)
                {
                    this.components = new Container();
                }

                this.settingsTmr?.Dispose();
                this.settingsTmr = new System.Windows.Forms.Timer(this.components)
                {
                    Enabled  = true,
                    Interval = 1,
                };
                this.settingsTmr.Tick += new EventHandler(this.CheckSettings);
                this.packingTmr?.Dispose();
                this.packingTmr = new System.Windows.Forms.Timer(this.components)
                {
                    Enabled  = false,
                    Interval = 1,
                };
                this.packingTmr.Tick += new EventHandler(this.Packing);
                this.unpackingTmr?.Dispose();
                this.unpackingTmr = new System.Windows.Forms.Timer(this.components)
                {
                    Enabled  = false,
                    Interval = 1,
                };
                this.unpackingTmr.Tick += new EventHandler(this.Unpacking);
                this.testModsTmr?.Dispose();
                this.testModsTmr = new System.Windows.Forms.Timer(this.components)
                {
                    Enabled  = false,
                    Interval = 1,
                };
                this.testModsTmr.Tick += new EventHandler(this.TestMods2);
                this.launcherTmr?.Dispose();
                this.launcherTmr = new System.Windows.Forms.Timer(this.components)
                {
                    Enabled  = false,
                    Interval = 1,
                };
                this.launcherTmr.Tick            += new EventHandler(this.Launcher);
                MessageManager.NotifyIcon.Icon    = this.FindForm().Icon;
                MessageManager.NotifyIcon.Text    = this.FindForm().Text;
                MessageManager.NotifyIcon.Visible = true;
                var pluginTypes = new List <Type>();
                foreach (var callbackplugin in ExecutionManager.Callbackplugins)
                {
                    pluginTypes.Add(callbackplugin.GetType());
                }

                foreach (var komplugin in KOMStream.Komplugins)
                {
                    pluginTypes.Add(komplugin.GetType());
                }

                PluginUpdateChecks = PluginUpdateCheck.CheckForUpdates(
                    SettingsFile.Settingsxml?.TryRead("Sources", "Source", null),
                    pluginTypes);
                foreach (var pluginUpdateCheck in PluginUpdateChecks)
                {
                    // discard result.
                    var result = pluginUpdateCheck.ShowMessage;
                }

                this.FindForm().Show();
            }
            else
            {
                SettingsFile.Settingsxml = null;
                this.CloseForm?.Invoke(this, new EventArgs());
            }
        }