Exemple #1
0
        public void CCAPIConnect()
        {
            PS3API PS3 = new PS3API(SelectAPI.ControlConsole);
            Dictionary <IPAddress, PhysicalAddress> all = GetAllDevicesOnLAN();

            foreach (KeyValuePair <IPAddress, PhysicalAddress> kvp in all)
            {
                Thread.Sleep(100);
                //"IP : {0}\n MAC {1}" +
                string infos = "IP: " + kvp.Key + Environment.NewLine + "Mac: " + kvp.Value;
                //  MessageBox.Show(infos);
                //   consoleandmacs = new [] { infos };
                //http://pastebin.com/yKLTzdW8
                // MessageBox.Show(infos);
                string fullmacaddress = Convert.ToString(kvp.Value);
                fullmacaddress = fullmacaddress.Substring(0, 6);

/*
 *              if (fullmacaddress.Length >= 6)
 *              {
 *                  fullmacaddress = fullmacaddress.Substring(0, 6);
 *              }
 *              else
 *              {
 *                  try
 *                  {
 *                      fullmacaddress = fullmacaddress.Substring(0, 3);
 *                  }
 *                  catch
 *                  {
 *                      MessageBox.Show("Error getting Macaddresses on the Network!");
 *                      MessageBox.Show(fullmacaddress);
 *                  }
 *              }*/
                if (PS3OUIs.Contains(fullmacaddress))
                {
                    MACIP = kvp.Key.ToString();

                    if (PS3.ConnectTarget(MACIP))
                    {
                        CCAPIConnection = true;
                        PS3.CCAPI.RingBuzzer(CCAPI.BuzzerMode.Double);
                        //   PS3.CCAPI.BaSs_HaXoRwazHere();
                        this.MACIP = kvp.Key.ToString();
                        return;
                    }
                    else
                    {
                        CCAPIConnection = false;
                        //MessageBox.Show("Failed to connect to Console!");
                        // PS3.ConnectTarget("192.168.137.201");
                        //PS3.CCAPI.Notify(CCAPI.NotifyIcon.WRONGWAY, "Failed!");
                    }
                }
                else
                {
                    //   MessageBox.Show("No PS3 Consoles found on your Network!");
                }
            }
        }
Exemple #2
0
            public bool Show()
            {
                bool Result = false;
                int  tNum   = -1;

                // Instance of widgets
                Label         lblInfo       = new Label();
                Button        btnConnect    = new Button();
                Button        btnRefresh    = new Button();
                ListViewGroup listViewGroup = new ListViewGroup("Consoles", HorizontalAlignment.Left);
                ListView      listView      = new ListView();
                Form          formList      = new Form();

                // Create our button connect
                btnConnect.Location = new Point(12, 254);
                btnConnect.Name     = "btnConnect";
                btnConnect.Size     = new Size(198, 23);
                btnConnect.TabIndex = 1;
                btnConnect.Text     = strTraduction("btnConnect");
                btnConnect.UseVisualStyleBackColor = true;
                btnConnect.Enabled = false;
                btnConnect.Click  += (sender, e) =>
                {
                    if (tNum > -1)
                    {
                        if (Api.ConnectTarget(data[tNum].Ip))
                        {
                            Api.setTargetName(data[tNum].Name);
                            Result = true;
                        }
                        else
                        {
                            Result = false;
                        }
                        formList.Close();
                    }
                    else
                    {
                        MessageBox.Show(strTraduction("errorSelect"), strTraduction("errorSelectTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                };

                // Create our button refresh
                btnRefresh.Location = new Point(216, 254);
                btnRefresh.Name     = "btnRefresh";
                btnRefresh.Size     = new Size(86, 23);
                btnRefresh.TabIndex = 1;
                btnRefresh.Text     = strTraduction("btnRefresh");
                btnRefresh.UseVisualStyleBackColor = true;
                btnRefresh.Click += (sender, e) =>
                {
                    tNum = -1;
                    listView.Clear();
                    lblInfo.Text       = strTraduction("selectGrid");
                    btnConnect.Enabled = false;
                    data = Api.CCAPI.GetConsoleList();
                    int sizeD = data.Count();
                    for (int i = 0; i < sizeD; i++)
                    {
                        ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip);
                        item.ImageIndex = 0;
                        listView.Items.Add(item);
                    }
                };

                // Create our list view
                listView.Font        = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                listViewGroup.Header = "Consoles";
                listViewGroup.Name   = "consoleGroup";
                listView.Groups.AddRange(new ListViewGroup[] { listViewGroup });
                listView.HideSelection = false;
                listView.Location      = new Point(12, 12);
                listView.MultiSelect   = false;
                listView.Name          = "ConsoleList";
                listView.ShowGroups    = false;
                listView.Size          = new Size(290, 215);
                listView.TabIndex      = 0;
                listView.UseCompatibleStateImageBehavior = false;
                listView.View = View.List;
                listView.ItemSelectionChanged += (sender, e) =>
                {
                    tNum = e.ItemIndex;
                    btnConnect.Enabled = true;
                    string Name, Ip = "?";
                    if (data[tNum].Name.Length > 18)
                    {
                        Name = data[tNum].Name.Substring(0, 17) + "...";
                    }
                    else
                    {
                        Name = data[tNum].Name;
                    }
                    if (data[tNum].Ip.Length > 16)
                    {
                        Ip = data[tNum].Name.Substring(0, 16) + "...";
                    }
                    else
                    {
                        Ip = data[tNum].Ip;
                    }
                    lblInfo.Text = strTraduction("selectedLbl") + " " + Name + " / " + Ip;
                };

                // Create our label
                lblInfo.AutoSize = true;
                lblInfo.Location = new Point(12, 234);
                lblInfo.Name     = "lblInfo";
                lblInfo.Size     = new Size(158, 13);
                lblInfo.TabIndex = 3;
                lblInfo.Text     = strTraduction("selectGrid");

                // Create our form
                formList.MinimizeBox         = false;
                formList.MaximizeBox         = false;
                formList.ClientSize          = new Size(314, 285);
                formList.AutoScaleDimensions = new SizeF(6F, 13F);
                formList.AutoScaleMode       = AutoScaleMode.Font;
                formList.FormBorderStyle     = FormBorderStyle.FixedSingle;
                formList.StartPosition       = FormStartPosition.CenterScreen;
                formList.Text = strTraduction("formTitle");
                formList.Controls.Add(listView);
                formList.Controls.Add(lblInfo);
                formList.Controls.Add(btnConnect);
                formList.Controls.Add(btnRefresh);

                // Start to update our list
                ImageList imgL = new ImageList();

                imgL.Images.Add(Simple_projet.Properties.Resources._260px_PS3_slim_console);
                listView.SmallImageList = imgL;
                int sizeData = data.Count();

                for (int i = 0; i < sizeData; i++)
                {
                    ListViewItem item = new ListViewItem(" " + data[i].Ip + " - " + data[i].Name);
                    item.ImageIndex = 0;
                    listView.Items.Add(item);
                }

                // If there are more than 0 targets we show the form
                // Else we inform the user to create a console.
                if (sizeData > 0)
                {
                    formList.ShowDialog();
                }
                else
                {
                    Result = false;
                    formList.Close();
                    MessageBox.Show(strTraduction("noConsole"), strTraduction("noConsoleTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return(Result);
            }
Exemple #3
0
            public bool Show()
            {
                bool Result = false;
                int  tNum   = -1;


                //Create Customization
                panel1.BackColor = System.Drawing.Color.FromArgb(0, 162, 255);
                panel1.Dock      = System.Windows.Forms.DockStyle.Left;
                panel1.ForeColor = System.Drawing.Color.Black;
                panel1.Location  = new System.Drawing.Point(0, 0);
                panel1.Name      = "panel1";
                panel1.Size      = new System.Drawing.Size(3, 195);
                panel1.TabIndex  = 0;
                //
                // panel2
                //
                panel2.BackColor = System.Drawing.Color.FromArgb(0, 162, 255);
                panel2.Dock      = System.Windows.Forms.DockStyle.Right;
                panel2.ForeColor = System.Drawing.Color.Black;
                panel2.Location  = new System.Drawing.Point(294, 0);
                panel2.Name      = "panel2";
                panel2.Size      = new System.Drawing.Size(3, 195);
                panel2.TabIndex  = 1;
                //
                // panel3
                //
                panel3.BackColor = System.Drawing.Color.FromArgb(0, 162, 255);
                panel3.Controls.Add(label1);
                panel3.Controls.Add(button1);
                panel3.Controls.Add(panel5);
                panel3.Dock       = System.Windows.Forms.DockStyle.Top;
                panel3.ForeColor  = System.Drawing.Color.Black;
                panel3.Location   = new System.Drawing.Point(3, 0);
                panel3.Name       = "panel3";
                panel3.Size       = new System.Drawing.Size(291, 25);
                panel3.TabIndex   = 2;
                panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(xMouseDown);
                panel3.MouseMove += new System.Windows.Forms.MouseEventHandler(xMouseMove);
                //
                // panel4
                //
                panel4.BackColor = System.Drawing.Color.FromArgb(0, 162, 255);
                panel4.Dock      = System.Windows.Forms.DockStyle.Bottom;
                panel4.ForeColor = System.Drawing.Color.Black;
                panel4.Location  = new System.Drawing.Point(3, 170);
                panel4.Name      = "panel4";
                panel4.Size      = new System.Drawing.Size(291, 3);
                panel4.TabIndex  = 3;
                //
                // button1
                //
                button1.BackColor = System.Drawing.Color.FromArgb(0, 162, 255);
                button1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(24, 62, 77);
                button1.FlatAppearance.BorderSize  = 0;
                button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                button1.Font      = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                button1.ForeColor = System.Drawing.Color.Black;
                button1.Location  = new System.Drawing.Point(262, 0);
                button1.Name      = "button1";
                button1.Size      = new System.Drawing.Size(30, 25);
                button1.TabIndex  = 4;
                button1.Text      = "X";
                button1.UseVisualStyleBackColor = false;
                button1.Click += new System.EventHandler(button1_Click);
                //
                // label1
                //
                label1.AutoSize   = true;
                label1.Font       = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                label1.ForeColor  = System.Drawing.Color.Black;
                label1.Location   = new System.Drawing.Point(32, 6);
                label1.Name       = "label1";
                label1.Size       = new System.Drawing.Size(130, 15);
                label1.TabIndex   = 0;
                label1.Text       = "Ultimate Minecraft RTM";
                label1.MouseDown += new System.Windows.Forms.MouseEventHandler(xMouseDown);
                label1.MouseMove += new System.Windows.Forms.MouseEventHandler(xMouseMove);
                //
                // panel5
                //
                panel5.BackColor             = Color.FromArgb(0, 162, 255);
                panel5.BackgroundImage       = Minecraft_Menu_Base.Properties.Resources.minecraft_diamond;
                panel5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                panel5.ForeColor             = System.Drawing.Color.FromArgb(((int)(((byte)(24)))), ((int)(((byte)(145)))), ((int)(((byte)(227)))));
                panel5.Location = new System.Drawing.Point(3, 1);
                panel5.Name     = "panel5";
                panel5.Size     = new System.Drawing.Size(30, 23);
                panel5.TabIndex = 4;

                // Create our button connect
                btnConnect.Location  = new Point(23, 260);
                btnConnect.Name      = "btnConnect";
                btnConnect.Size      = new Size(250, 33);
                btnConnect.BackColor = Color.FromArgb(0, 162, 255);
                btnConnect.ForeColor = Color.FromArgb(24, 62, 77);
                btnConnect.FlatStyle = FlatStyle.Flat;
                btnConnect.FlatAppearance.BorderColor = btnConnect.ForeColor;
                btnConnect.FlatAppearance.BorderSize  = 2;
                btnConnect.TabIndex = 1;
                btnConnect.Text     = strTraduction("btnConnect");
                btnConnect.UseVisualStyleBackColor = true;
                btnConnect.Enabled = true;
                btnConnect.Click  += (sender, e) =>
                {
                    if (tNum > -1)
                    {
                        if (Api.ConnectTarget(data[tNum].Ip))
                        {
                            Api.setTargetName(data[tNum].Name);
                            Result = true;
                        }
                        else
                        {
                            Result = false;
                        }
                        formList.Close();
                    }
                    else
                    {
                        MessageBox.Show(strTraduction("errorSelect"), "Ultimate Minecraft RTM", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                };

                // Create our button refresh
                btnRefresh.Location  = new Point(23, 297);
                btnRefresh.Name      = "btnRefresh";
                btnRefresh.BackColor = Color.FromArgb(0, 162, 255);
                btnRefresh.ForeColor = Color.FromArgb(24, 62, 77);
                btnRefresh.FlatStyle = FlatStyle.Flat;
                btnRefresh.FlatAppearance.BorderColor = btnRefresh.ForeColor;
                btnRefresh.FlatAppearance.BorderSize  = 2;
                btnRefresh.Size     = new Size(250, 33);
                btnRefresh.TabIndex = 1;
                btnRefresh.Text     = strTraduction("btnRefresh");
                btnRefresh.UseVisualStyleBackColor = true;
                btnRefresh.Click += (sender, e) =>
                {
                    tNum = -1;
                    listView.Clear();
                    btnConnect.Enabled = false;
                    data = Api.CCAPI.GetConsoleList();
                    int sizeD = data.Count();
                    for (int i = 0; i < sizeD; i++)
                    {
                        ListViewItem item = new ListViewItem(data[i].Name + " - " + data[i].Ip);
                        item.ImageIndex = 0;
                        listView.Items.Add(item);
                    }
                };

                // Create our list view
                listView.BackColor   = Color.FromArgb(0, 162, 255);
                listView.ForeColor   = Color.FromArgb(24, 62, 77);
                listView.Font        = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                listViewGroup.Header = "Consoles";
                listViewGroup.Name   = "consoleGroup";
                listView.Groups.AddRange(new ListViewGroup[] { listViewGroup });
                listView.HideSelection = false;
                listView.Location      = new Point(23, 41);
                listView.MultiSelect   = false;
                listView.Name          = "ConsoleList";
                listView.ShowGroups    = false;
                listView.Size          = new Size(250, 215);
                listView.TabIndex      = 0;
                listView.UseCompatibleStateImageBehavior = false;
                listView.View = View.List;
                listView.ItemSelectionChanged += (sender, e) =>
                {
                    tNum = e.ItemIndex;
                    btnConnect.Enabled = true;
                    string Name, Ip = "?";
                    if (data[tNum].Name.Length > 18)
                    {
                        Name = data[tNum].Name.Substring(0, 17) + "...";
                    }
                    else
                    {
                        Name = data[tNum].Name;
                    }
                    if (data[tNum].Ip.Length > 16)
                    {
                        Ip = data[tNum].Name.Substring(0, 16) + "...";
                    }
                    else
                    {
                        Ip = data[tNum].Ip;
                    }
                };

                // Create our form
                formList.MinimizeBox         = false;
                formList.MaximizeBox         = false;
                formList.ClientSize          = new Size(297, 350);
                formList.AutoScaleDimensions = new SizeF(6F, 13F);
                formList.AutoScaleMode       = AutoScaleMode.Font;
                formList.BackColor           = Color.FromArgb(24, 62, 77);
                formList.ForeColor           = Color.FromArgb(0, 162, 255);
                formList.FormBorderStyle     = FormBorderStyle.None;
                formList.StartPosition       = FormStartPosition.CenterScreen;
                formList.Text = "Ultimate Minecraft RTM";
                formList.Controls.Add(listView);
                formList.Controls.Add(btnConnect);
                formList.Controls.Add(btnRefresh);
                formList.Controls.Add(panel4);
                formList.Controls.Add(panel3);
                formList.Controls.Add(panel2);
                formList.Controls.Add(panel1);
                panel1.ResumeLayout(false);
                panel1.PerformLayout();
                panel2.ResumeLayout(false);
                panel2.PerformLayout();
                panel3.ResumeLayout(false);
                panel3.PerformLayout();
                panel4.ResumeLayout(false);
                panel4.PerformLayout();
                formList.ResumeLayout(false);
                formList.PerformLayout();

                //// Start to update our list
                //ImageList imgL = new ImageList();
                ////imgL.Images.Add(Resources.ps3);
                //listView.SmallImageList = imgL;
                int sizeData = data.Count();

                for (int i = 0; i < sizeData; i++)
                {
                    ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip);
                    item.ImageIndex = 0;
                    listView.Items.Add(item);
                }

                // If there are more than 0 targets we show the form
                // Else we inform the user to create a console.
                if (sizeData > 0)
                {
                    formList.ShowDialog();
                }
                else
                {
                    Result = false;
                    formList.Close();
                    MessageBox.Show(strTraduction("noConsole"), strTraduction("noConsoleTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return(Result);
            }
Exemple #4
0
            public bool Show()
            {
                bool Result = false;
                int  tNum   = -1;


                // Instance of widgets
                // Label lblInfo = new Label();
                // Button btnConnect = new Button();
                // Button btnRefresh = new Button();
                // ListViewGroup listViewGroup = new ListViewGroup("Consoles", HorizontalAlignment.Left);
                // ListView listView = new ListView();
                // Form formList = new Form();

                // Create our button connect
                // btnConnect.Location = new Point(12, 254);
                // btnConnect.Name = "btnConnect";
                // btnConnect.Size = new Size(198, 23);
                // btnConnect.TabIndex = 1;
                // btnConnect.Text = strTraduction("btnConnect");
                // btnConnect.UseVisualStyleBackColor = true;
                // btnConnect.Enabled = false;
                // btnConnect.Click += (sender, e) =>
                // {
                //     if(tNum > -1)
                //     {
                //         if (Api.ConnectTarget(data[tNum].Ip))
                //         {
                //             Api.setTargetName(data[tNum].Name);
                //             Result = true;
                //         }
                //         else Result = false;
                //         formList.Close();
                //     }
                //     else
                //         MessageBox.Show(strTraduction("errorSelect"), strTraduction("errorSelectTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                // };

                // Create our button refresh
                // btnRefresh.Location = new Point(216, 254);
                // btnRefresh.Name = "btnRefresh";
                // btnRefresh.Size = new Size(86, 23);
                // btnRefresh.TabIndex = 1;
                // btnRefresh.Text = strTraduction("btnRefresh");
                // btnRefresh.UseVisualStyleBackColor = true;
                // btnRefresh.Click += (sender, e) =>
                // {
                //     tNum = -1;
                //     listView.Clear();
                //     lblInfo.Text = strTraduction("selectGrid");
                //     btnConnect.Enabled = false;
                //     data = Api.CCAPI.GetConsoleList();
                //     int sizeD = data.Count();
                //     for (int i = 0; i < sizeD; i++)
                //     {
                //         ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip);
                //         item.ImageIndex = 0;
                //         listView.Items.Add(item);
                //     }
                // };

                // Create our list view
                // listView.Font = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                // listViewGroup.Header = "Consoles";
                // listViewGroup.Name = "consoleGroup";
                // listView.Groups.AddRange(new ListViewGroup[] {listViewGroup});
                // listView.HideSelection = false;
                // listView.Location = new Point(12, 12);
                // listView.MultiSelect = false;
                // listView.Name = "ConsoleList";
                // listView.ShowGroups = false;
                // listView.Size = new Size(290, 215);
                // listView.TabIndex = 0;
                // listView.UseCompatibleStateImageBehavior = false;
                // listView.View = View.List;
                // listView.ItemSelectionChanged += (sender, e) =>
                // {
                //     tNum = e.ItemIndex;
                //     btnConnect.Enabled = true;
                //     string Name, Ip = "?";
                //     if (data[tNum].Name.Length > 18)
                //         Name = data[tNum].Name.Substring(0, 17) + "...";
                //     else Name = data[tNum].Name;
                //     if (data[tNum].Ip.Length > 16)
                //         Ip = data[tNum].Name.Substring(0, 16) + "...";
                //     else Ip = data[tNum].Ip;
                //     lblInfo.Text = strTraduction("selectedLbl") + " " + Name + " / " + Ip;
                // };

                // Create our label
                // lblInfo.AutoSize = true;
                // lblInfo.Location = new Point(12, 234);
                // lblInfo.Name = "lblInfo";
                // lblInfo.Size = new Size(158, 13);
                // lblInfo.TabIndex = 3;
                // lblInfo.Text = strTraduction("selectGrid");

                // Create our form
                // formList.MinimizeBox = false;
                // formList.MaximizeBox = false;
                // formList.ClientSize = new Size(314, 285);
                // formList.AutoScaleDimensions = new SizeF(6F, 13F);
                // formList.AutoScaleMode = AutoScaleMode.Font;
                // formList.FormBorderStyle = FormBorderStyle.FixedSingle;
                // formList.StartPosition = FormStartPosition.CenterScreen;
                // formList.Text = strTraduction("formTitle");
                // formList.Controls.Add(listView);
                // formList.Controls.Add(lblInfo);
                // formList.Controls.Add(btnConnect);
                // formList.Controls.Add(btnRefresh);

                // Start to update our list
                // ImageList imgL = new ImageList();
                // imgL.Images.Add(Resources.ps3);
                // listView.SmallImageList = imgL;
                // int sizeData = data.Count();

                // for (int i = 0; i < sizeData; i++)
                // {
                //     ListViewItem item = new ListViewItem(" " + data[i].Name + " - " + data[i].Ip);
                //     item.ImageIndex = 0;
                //     listView.Items.Add(item);
                // }

                data = Api.CCAPI.GetConsoleList();

                var menu = new EasyConsole.Menu();

                data.ForEach(
                    console => menu.Add(" " + console.Name + " - " + console.Ip, () =>
                {
                    if (Api.ConnectTarget(console.Ip))
                    {
                        Api.setTargetName(console.Name);
                        Result = true;
                    }
                })
                    );
                menu.Display();

                // If there are more than 0 targets we show the form
                // Else we inform the user to create a console.
                // if (sizeData > 0)
                //     formList.ShowDialog();
                // else
                // {
                //     Result = false;
                //     formList.Close();
                //     throw new Exception(strTraduction("noConsole"));
                //     //MessageBox.Show(), strTraduction("noConsoleTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                // }

                return(Result);
            }