Пример #1
0
        private void bwLoadPlugins_DoWork(object sender, DoWorkEventArgs e)
        {
            string[] potentialPlugins = e.Argument as string[];

            Assembly          plugin = null;
            IBootloaderPlugin temp   = null;
            Dictionary <string, IBootloaderPlugin> outPut = new Dictionary <string, IBootloaderPlugin>();

            for (int i = 0; i < potentialPlugins.Length; i++)
            {
                try
                {
                    plugin = null;
                    plugin = Assembly.LoadFile(potentialPlugins[i]);
                }
                catch (NotSupportedException)
                {
                    MessageBox.Show("Error loading plugin\n\n" + Path.GetFileName(potentialPlugins[i]) + "\n\n1. Right Click on the plugin\n2. Select Properties\n3. General Tab\n4. Click the 'Unblock' button",
                                    "Plugin Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    continue;
                }
                catch
                {
                    continue;
                }

                if (plugin != null)
                {
                    try
                    {
                        if (typeof(IBootloaderPlugin).IsAssignableFrom(plugin.GetTypes()[0]) && plugin.GetTypes()[0].Namespace != "BootloaderPluginTemplate")
                        {
                            temp = (IBootloaderPlugin)Activator.CreateInstance(plugin.GetTypes()[0]);

                            if (!outPut.ContainsKey(EnumHelper.GetEnumDescription((HTC_DEVICE)temp.DEVICE) + " - " + temp.BOOTLOADER_ORIG_VERSION))
                            {
                                outPut.Add(EnumHelper.GetEnumDescription((HTC_DEVICE)temp.DEVICE) + " - " + temp.BOOTLOADER_ORIG_VERSION, temp);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Error loading plugin\n\n" + Path.GetFileName(plugin.Location) +
                                        "\n\nPlugin not compatable with this version of\nRegawMOD Bootloader Customizer!",
                                        "Plugin Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            e.Result = outPut;
        }
        private void ReLoadPlugins()
        {
            this.loadedPlugins.Clear();

            this.current = null;
            
            this.ResetForm();
            
            string[] potentialPlugins = Directory.GetFiles(Application.StartupPath, "*.dll");

            if (potentialPlugins.Length == 0)
                return;

            this.bwLoadPlugins.RunWorkerAsync(potentialPlugins);
        }
Пример #3
0
        private void ReLoadPlugins()
        {
            this.loadedPlugins.Clear();

            this.current = null;

            this.ResetForm();

            string[] potentialPlugins = Directory.GetFiles(Application.StartupPath, "*.dll");

            if (potentialPlugins.Length == 0)
            {
                return;
            }

            this.bwLoadPlugins.RunWorkerAsync(potentialPlugins);
        }
        internal void UpdateData(IBootloaderPlugin plugin)
        {
            this.Text = "Plugin for " + EnumHelper.GetEnumDescription(plugin.DEVICE) + " - Information";

            this.lblDevice.Text = EnumHelper.GetEnumDescription(plugin.DEVICE);
            this.lblHbootVersion.Text = plugin.BOOTLOADER_ORIG_VERSION;
            this.lblFirmwareZip.Text = plugin.FIRMWARE_ZIP_NAME + ".zip";
            this.lblStockLook.Text = (plugin.ALLOW_CHANGE_BANNER_TEXT && plugin.ALLOW_CHANGE_S_OFF_TEXT && plugin.ALLOW_CHANGE_HTC_DEVELOPMENT_DISCLAIMER) ? "Yes" : "No";
            this.lblChangeBanner.Text = plugin.ALLOW_CHANGE_BANNER_TEXT ? "Yes" : "No";
            this.lblChangeSOFF.Text = plugin.ALLOW_CHANGE_S_OFF_TEXT ? "Yes" : "No";
            this.lblChangeVersion.Text = plugin.ALLOW_CHANGE_MINOR_VERSION_NUMBER_TEXT ? "Yes" : "No";
            this.lblChangeDateTime.Text = plugin.ALLOW_CHANGE_BUILD_DATE_TIME ? "Yes" : "No";
            this.lblChangeDisclaimer.Text = plugin.ALLOW_CHANGE_HTC_DEVELOPMENT_DISCLAIMER ? "Yes" : "No";

            this.txtDescription.Text = plugin.PLUGIN_DESCRIPTION;

            this.lblDeveloper.Text = plugin.DEVELOPER_NAME;
            this.lblHomePage.Links.Clear();
            this.homePage.LinkData = plugin.DEVELOPER_PERSONAL_WEBSITE;
            this.lblHomePage.Links.Add(this.homePage);
            this.lblXdaProfile.Links.Clear();
            this.xdaProfile.LinkData = @"http://forum.xda-developers.com/member.php?u=" + plugin.DEVELOPER_XDA_PROFILE_ID;
            this.lblXdaProfile.Links.Add(this.xdaProfile);
        }
Пример #5
0
        internal void UpdateData(IBootloaderPlugin plugin)
        {
            this.Text = "Plugin for " + EnumHelper.GetEnumDescription(plugin.DEVICE) + " - Information";

            this.lblDevice.Text           = EnumHelper.GetEnumDescription(plugin.DEVICE);
            this.lblHbootVersion.Text     = plugin.BOOTLOADER_ORIG_VERSION;
            this.lblFirmwareZip.Text      = plugin.FIRMWARE_ZIP_NAME + ".zip";
            this.lblStockLook.Text        = (plugin.ALLOW_CHANGE_BANNER_TEXT && plugin.ALLOW_CHANGE_S_OFF_TEXT && plugin.ALLOW_CHANGE_HTC_DEVELOPMENT_DISCLAIMER) ? "Yes" : "No";
            this.lblChangeBanner.Text     = plugin.ALLOW_CHANGE_BANNER_TEXT ? "Yes" : "No";
            this.lblChangeSOFF.Text       = plugin.ALLOW_CHANGE_S_OFF_TEXT ? "Yes" : "No";
            this.lblChangeVersion.Text    = plugin.ALLOW_CHANGE_MINOR_VERSION_NUMBER_TEXT ? "Yes" : "No";
            this.lblChangeDateTime.Text   = plugin.ALLOW_CHANGE_BUILD_DATE_TIME ? "Yes" : "No";
            this.lblChangeDisclaimer.Text = plugin.ALLOW_CHANGE_HTC_DEVELOPMENT_DISCLAIMER ? "Yes" : "No";

            this.txtDescription.Text = plugin.PLUGIN_DESCRIPTION;

            this.lblDeveloper.Text = plugin.DEVELOPER_NAME;
            this.lblHomePage.Links.Clear();
            this.homePage.LinkData = plugin.DEVELOPER_PERSONAL_WEBSITE;
            this.lblHomePage.Links.Add(this.homePage);
            this.lblXdaProfile.Links.Clear();
            this.xdaProfile.LinkData = @"http://forum.xda-developers.com/member.php?u=" + plugin.DEVELOPER_XDA_PROFILE_ID;
            this.lblXdaProfile.Links.Add(this.xdaProfile);
        }