Ejemplo n.º 1
0
 public static void Load(string baseDirectory)
 {
     BaseDirectory = baseDirectory;
     GetAssemblies();
     LoadBootstrappers();
     LoadCommands();
     LoadConsumers();
     LoadSources();
     LoadServices();
     CreateBindings();
     Domains.AddRange(newDomains);
     newDomains = new List <AppDomain>();
 }
Ejemplo n.º 2
0
        protected internal virtual Domains GetCurrentDomains()
        {
            var max = this.DomainMaxFetchCount;
            var currentDomains = new Domains();
            string nextToken = null;
            do
            {
                var fetched = this.SimpleDbClient.ListDomains(maxNumberToRetrive: max);
                nextToken = fetched.NextToken;
                currentDomains.AddRange(fetched);

            } while (nextToken != null);

            return currentDomains;
        }
Ejemplo n.º 3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.Hide();
            this.packToolStripMenuItem.Image     = NativeMethods.ConvertSVGTo16x16Image(Properties.Resources.archive, ShareXResources.Theme.TextColor);
            this.unpackToolStripMenuItem.Image   = NativeMethods.ConvertSVGTo16x16Image(Properties.Resources.unarchive, ShareXResources.Theme.TextColor);
            this.testModsToolStripMenuItem.Image = NativeMethods.ConvertSVGTo16x16Image(Properties.Resources.vial_solid, ShareXResources.Theme.TextColor);
            this.launcherToolStripMenuItem.Image = NativeMethods.ConvertSVGTo16x16Image(Properties.Resources.launch, ShareXResources.Theme.TextColor);
            this.exitToolStripMenuItem.Image     = NativeMethods.GetNativeMenuItemImage(new IntPtr(NativeMethods.HBMMENU_POPUP_CLOSE), true);
            var closing = false;

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

            if (ExecutionManager.IsElsKomRunning())
            {
                _       = MessageManager.ShowError("Sorry, Only 1 Instance is allowed at a time.", "Error!", false);
                closing = true;
            }
            else
            {
                this.elsDir = SettingsFile.SettingsJson.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!", false);

                    // avoids an issue where more than 1 settings form can be opened at the same time.
                    if (this.settingsfrm == null && this.aboutfrm == null)
                    {
                        using (this.settingsfrm = new SettingsForm())
                        {
                            _ = this.settingsfrm.ShowDialog();
                        }

                        this.settingsfrm = null;
                    }
                }

                var komplugins = new GenericPluginLoader <IKomPlugin>().LoadPlugins("plugins", out var domains1, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Komplugins.AddRange(komplugins);
                var callbackplugins = new GenericPluginLoader <ICallbackPlugin>().LoadPlugins("plugins", out var domains2, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Callbackplugins.AddRange(callbackplugins);
                var encryptionplugins = new GenericPluginLoader <IEncryptionPlugin>().LoadPlugins("plugins", out var domains3, Convert.ToBoolean(SettingsFile.SettingsJson.SaveToZip));
                KOMManager.Encryptionplugins.AddRange(encryptionplugins);
#if NET5_0_OR_GREATER
                Contexts.AddRange(domains1);
                Contexts.AddRange(domains2);
                Contexts.AddRange(domains3);
#else
                Domains.AddRange(domains1);
                Domains.AddRange(domains2);
                Domains.AddRange(domains3);
#endif
                if (!GitInformation.GetAssemblyInstance(typeof(Els_kom_Main))?.IsMain ?? false)
                {
                    _ = MessageManager.ShowInfo("This branch is not the main branch, meaning this is a feature branch to test changes. When finished please pull request them for the possibility of them getting merged into main.", "Info!", Convert.ToBoolean(SettingsFile.SettingsJson.UseNotifications));
                }

                if (GitInformation.GetAssemblyInstance(typeof(Els_kom_Main))?.IsDirty ?? false)
                {
                    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)
            {
                MessageManager.Icon = this.Icon;
                MessageManager.Text = this.Text;
                var pluginTypes = new List <Type>();
                pluginTypes.AddRange(KOMManager.Callbackplugins.Select((x) => x.GetType()));
                pluginTypes.AddRange(KOMManager.Komplugins.Select((x) => x.GetType()));
                pluginTypes.AddRange(KOMManager.Encryptionplugins.Select((x) => x.GetType()));
                PluginUpdateChecks = PluginUpdateCheck.CheckForUpdates(
                    SettingsFile.SettingsJson.Sources.Source.ToArray(),
                    pluginTypes,
                    Els_kom_Main.ServiceProvider);
                foreach (var pluginUpdateCheck in PluginUpdateChecks)
                {
                    // discard result.
                    _ = pluginUpdateCheck.ShowMessage;
                }

                MessageManager.Visible = true;
                this.Show();
                this.Activate();
            }
            else
            {
                SettingsFile.SettingsJson = null;
                this.aboutfrm?.Close();
                this.settingsfrm?.Close();
                this.Close();
            }
        }