Esempio n. 1
0
        private void OrderList_Load(object sender, EventArgs e)
        {
            // Utilize the 'LinkCat' function.
            ListCat();

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.OrderListMenuAdder(tsi);
                    }
                }
            }

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.pos_dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.OrderListMenuAdder(tsi);
                    }
                }
            }
        }
        private void CreateOrder_Load(object sender, EventArgs e)
        {
            filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo device in filterInfoCollection)
            {
                comboBox1.Items.Add(device.Name);
            }
            comboBox1.SelectedIndex = 0;

            // Fill the customers combo box using function.
            FillCustomersCombo();
            // Fill the items combo box using function.
            FillItemsCombo();

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.CreateOrderMenuAdder(tsi);
                    }
                }
            }

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.pos_dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.CreateOrderMenuAdder(tsi);
                    }
                }
            }
        }
Esempio n. 3
0
        private void frmMusic_Load(object sender, EventArgs e)
        {
            // ----------------------------
            // --- File/Directory Check ---
            // ----------------------------

            if (!Directory.Exists("settings\\lastsonginfo"))
            {
                // Create the last song info directory.
                Directory.CreateDirectory("settings\\lastsonginfo");
            }

            if (!File.Exists("settings\\lastsonginfo\\artist"))
            {
                // Write the last artist to a file.
                File.WriteAllText(@"settings/lastsonginfo/artist", lbArtists.SelectedIndex.ToString());
            }

            if (!File.Exists("settings\\lastsonginfo\\album"))
            {
                // Write the last album to a file.
                File.WriteAllText(@"settings/lastsonginfo/album", lbAlbums.SelectedIndex.ToString());
            }

            if (!File.Exists("settings\\lastsonginfo\\song"))
            {
                // Write the last song to a file.
                File.WriteAllText(@"settings/lastsonginfo/song", lbSongs.SelectedIndex.ToString());
            }

            if (!File.Exists("settings\\lastsonginfo\\pos"))
            {
                // Write the last position to a file.
                File.WriteAllText(@"settings/lastsonginfo/pos", player.controls.currentPosition.ToString());
            }

            if (!File.Exists("settings\\lastsonginfo\\volume"))
            {
                // Write the last volume to a file.
                File.WriteAllText(@"settings/lastsonginfo/volume", player.settings.volume.ToString());
            }



            // ---------------
            // --- Plugins ---
            // ---------------

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.MenuAdder(tsi);
                    }
                }
            }



            // -----------------
            // --- Playlists ---
            // -----------------

            try
            {
                // Create a new list (with string) called 'dataSource'.
                List <String> dataSource = new List <String>();
                // Set the 'dataSource' to the sub directorys of the music directory.
                dataSource = Directory.GetDirectories(musicRootDirectory).Select(Path.GetFileName).ToList();

                // IF the 'System Volume Information' exists in the 'dataSource'.
                if (dataSource.Contains("System Volume Information"))
                {
                    // Remove it from 'dataSource'.
                    dataSource.RemoveAt(0);
                }

                // Set the DataSource of the artists list to 'dataSource'.
                lbArtists.DataSource = dataSource;

                // Set the 'volume' taskbar to the players volume.
                tbVolume.Value = player.settings.volume;

                // Run the create playlist function.
                CreatePlaylist();

                // Set the selected index of the artists listbox the the last artist played.
                lbArtists.SelectedIndex = Convert.ToInt32(File.ReadAllText(@"settings/lastsonginfo/artist"));
                // Set the selected index of the albums listbox the the last album played.
                lbAlbums.SelectedIndex = Convert.ToInt32(File.ReadAllText(@"settings/lastsonginfo/album"));
                // Set the selected index of the songs listbox the the last song played.
                lbSongs.SelectedIndex = Convert.ToInt32(File.ReadAllText(@"settings/lastsonginfo/song"));
                // Set the players current position to the last SAVED position.
                player.controls.currentPosition = Convert.ToDouble(File.ReadAllText(@"settings/lastsonginfo/pos"));
                // Set the playes volume to the last volume.
                player.settings.volume = Convert.ToInt32(File.ReadAllText(@"settings/lastsonginfo/volume"));
            }
            catch (Exception ex)
            {
                // Create a message box with the error (exception).
                MessageBox.Show("An error occured with this instance.\n\nDetails: \n\n" + ex.Message + "\n\nThis has happened in " + ex.Source, "Sorry :(");
            }
        }
Esempio n. 4
0
        private void frmDashboard_Load(object sender, EventArgs e)
        {
            // Send the passed username and level to the console.
            Console.WriteLine("Username: "******" Level: " + _accessLevel);

            // If the access level is 'admin'.
            if (_accessLevel == "admin")
            {
                // Show the admin tasks button.
                mtAdminTasks.Visible = true;
            }

            LoadJson();

            Console.WriteLine();

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.DashboardMenuAdder(tsi);
                    }
                }
            }

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.pos_dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the menu.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the menu.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new ToolStripMenuItem called 'tsi' with the name of the plugin.
                        ToolStripMenuItem tsi = new ToolStripMenuItem(name);
                        // Add the 'tsi' to the menu.
                        menu.Items.Add(tsi);
                        // Run the menu adder of the plugin.
                        PI.DashboardMenuAdder(tsi);
                    }
                }
            }
        }
        private void frmPlugins_Load(object sender, EventArgs e)
        {
            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the button OR all of the implementers.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the button.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new button called 'btn'.
                        Button btn = new Button();
                        // Set 'btn's height to 180.
                        btn.Height = 180;
                        // Set 'btn's width to 180.
                        btn.Width = 180;
                        // Set 'btn's back color to green.
                        btn.BackColor = Color.SeaGreen;
                        // Set 'btn's fore color to white.
                        btn.ForeColor = Color.White;
                        // Set the 'btn's text to the plugin name.
                        btn.Text = name;
                        // Set the 'btn's name to 'btn' plus the plugin name.
                        btn.Name = "btn" + name;
                        // Set the font of 'btn' to 'Segoe UI'.
                        btn.Font = new Font("Segoe UI", 16);
                        // Add the 'btn' to the plugins list.
                        flpPlugins.Controls.Add(btn);
                        // Run the interfaces button adder function (with 'btn').
                        PI.AdminButtonAdder(btn);
                    }
                }
            }

            // For each of the plugins in the 'Plugins' directory.
            foreach (var files in Directory.GetFiles(@"Plugins", "*.pos_dll"))
            {
                // Create a new variable called 'assembly' and load the files.
                var assembly = Assembly.LoadFrom(files);
                // For each of the types in the assembly types.
                foreach (var type in assembly.GetTypes())
                {
                    // If the type interfaces contains the plugin implementer for the button OR all of the implementers.
                    if (type.GetInterfaces().Contains(typeof(PluginImplementer)))
                    {
                        // Set PI to the new instance of type as the plugin implementer for the button.
                        PI = Activator.CreateInstance(type) as PluginImplementer;
                        // Create a new string called 'name' with the plugin name.
                        string name = PI.PluginName();

                        // Create a new button called 'btn'.
                        Button btn = new Button();
                        // Set 'btn's height to 180.
                        btn.Height = 180;
                        // Set 'btn's width to 180.
                        btn.Width = 180;
                        // Set 'btn's back color to green.
                        btn.BackColor = Color.LightSkyBlue;
                        // Set 'btn's fore color to white.
                        btn.ForeColor = Color.White;
                        // Set the 'btn's text to the plugin name.
                        btn.Text = name;
                        // Set the 'btn's name to 'btn' plus the plugin name.
                        btn.Name = "btn" + name;
                        // Set the font of 'btn' to 'Segoe UI'.
                        btn.Font = new Font("Segoe UI", 16);
                        // Add the 'btn' to the plugins list.
                        flpPlugins.Controls.Add(btn);
                        // Run the interfaces button adder function (with 'btn').
                        PI.AdminButtonAdder(btn);
                    }
                }
            }
        }
Esempio n. 6
0
        private void frmPlugins_Load(object sender, EventArgs e)
        {
            try
            {
                // For each of the plugins in the 'Plugins' directory.
                foreach (var files in Directory.GetFiles(@"Plugins", "*.dll"))
                {
                    // Create a new variable called 'assembly' and load the files.
                    var assembly = Assembly.LoadFrom(files);
                    // For each of the types in the assembly types.
                    foreach (var type in assembly.GetTypes())
                    {
                        // If the type interfaces contains the plugin implementer for the button OR all of the implementers.
                        if (type.GetInterfaces().Contains(typeof(PluginImplementer)) || type.GetInterfaces().Contains(typeof(PluginImplementerButton)) || type.GetInterfaces().Contains(typeof(PluginImplementerAll)))
                        {
                            // Set PI to the new instance of type as the plugin implementer for the button.
                            PI = Activator.CreateInstance(type) as PluginImplementer;
                            // Create a new string called 'name' with the plugin name.
                            string name = PI.PluginName();

                            // Create a new button called 'btn'.
                            Button btn = new Button();
                            // Set 'btn's height to 180.
                            btn.Height = 180;
                            // Set 'btn's width to 180.
                            btn.Width = 180;
                            // Set 'btn's back color to green.
                            btn.BackColor = Color.SeaGreen;
                            // Set 'btn's fore color to white.
                            btn.ForeColor = Color.White;
                            // Set the 'btn's text to the plugin name.
                            btn.Text = name;
                            // Set the 'btn's name to 'btn' plus the plugin name.
                            btn.Name = "btn" + name;
                            // Set the font of 'btn' to 'Segoe UI'.
                            btn.Font = new Font("Segoe UI", 16);
                            // Add the 'btn' to the plugins list.
                            flowLayoutPanel1.Controls.Add(btn);
                            // Run the interfaces button adder function (with 'btn').
                            PI.ButtonAdder(btn);
                        }
                    }
                }


                // For each of the ECMU plugins in the 'Plugins' directory.
                foreach (var files in Directory.GetFiles(@"Plugins", "*.ecmu_dll"))
                {
                    // Create a new variable called 'assembly' and load the files.
                    var assembly = Assembly.LoadFrom(files);
                    // For each of the types in the assembly types.
                    foreach (var type in assembly.GetTypes())
                    {
                        // If the type interfaces contains the plugin implementer for the button OR all of the implementers.
                        if (type.GetInterfaces().Contains(typeof(PluginImplementer)) || type.GetInterfaces().Contains(typeof(PluginImplementer)) || type.GetInterfaces().Contains(typeof(PluginImplementerAll)))
                        {
                            /* if (PI.AuthorSignature() == "JibTdHy1xTYOHo2ah5bXPVp84445psPCspumlw0S34Hv5hi404IZYEStR9ysCTA0FvvwiedADVMYK3PY2VTJDIEWCyXi1vkhue9UWHkF2s2Ys6qX28Wc0j3ipiQd6D0sFyIthmPDl1jcGe6KlnfcLoNh6jbaIN8Wxu0a4lTRBgoRjcEIi06mvYRNEoM1imnNjszIYRZY")
                             * { */
                            // Set PI to the new instance of type as the plugin implementer for the button.
                            PI = Activator.CreateInstance(type) as PluginImplementer;
                            // Create a new string called 'name' with the plugin name.
                            string name = PI.PluginName();

                            // Create a new button called 'btn'.
                            Button btn = new Button();
                            // Set 'btn's height to 180.
                            btn.Height = 180;
                            // Set 'btn's width to 180.
                            btn.Width = 180;
                            // Set 'btn's back color to a nice blue.
                            btn.BackColor = Color.LightSkyBlue;
                            // Set 'btn's fore color to white.
                            btn.ForeColor = Color.White;
                            // Set the 'btn's text to the plugin name.
                            btn.Text = name;
                            // Set the 'btn's name to 'btn' plus the plugin name.
                            btn.Name = "btn" + name;
                            // Set the font of 'btn' to 'Segoe UI'.
                            btn.Font = new Font("Segoe UI", 16);
                            // Add the 'btn' to the plugins list.
                            flowLayoutPanel1.Controls.Add(btn);
                            // Run the interfaces button adder function (with 'btn').
                            PI.ButtonAdder(btn);

                            /* }
                             * else
                             * {
                             *  MessageBox.Show("One or more of your ECMU DLL Files are not authentic, failed to load them.", "ECMU Authenticity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);
                             * } */
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }