Résolu Mon code est-il bon ?

UEFALONA

UEFALONA IS BACK !
Premium
Inscription
17 Juin 2013
Messages
3 426
Réactions
1 088
Points
7 143
RGCoins
25
Voilà je voulais savoir si mon code ne comporte pas de code "inutile" car je veut que mon code soit propre :) !
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PS3Lib;

namespace Black_Ops_1_Platinum_Project_v1
{
    public partial class Form2 : Form
    {
        private PS3API PS3 = new PS3API();

        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            PS3.ChangeAPI(SelectAPI.ControlConsole);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            PS3.ChangeAPI(SelectAPI.TargetManager);
        }
      
        private void button1_Click(object sender, EventArgs e)
        {
            PS3.ConnectTarget();

            if (PS3.ConnectTarget())
            {
                MessageBox.Show("You are now connected", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Connected !");
            }
            else
            {
                MessageBox.Show("Connection failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            PS3.AttachProcess();

            if (PS3.AttachProcess())
            {
                MessageBox.Show("You are now attached", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Attached !");
            }
            else
            {
                MessageBox.Show("Attach failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}

Sachant que le code fonctionne nikel et qu'il n'y a pas d'erreurs ...​
 
Voilà je voulais savoir si mon code ne comporte pas de code "inutile" car je veut que mon code soit propre :) !
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PS3Lib;

namespace Black_Ops_1_Platinum_Project_v1
{
    public partial class Form2 : Form
    {
        private PS3API PS3 = new PS3API();

        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            PS3.ChangeAPI(SelectAPI.ControlConsole);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            PS3.ChangeAPI(SelectAPI.TargetManager);
        }
     
        private void button1_Click(object sender, EventArgs e)
        {
            PS3.ConnectTarget();

            if (PS3.ConnectTarget())
            {
                MessageBox.Show("You are now connected", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Connected !");
            }
            else
            {
                MessageBox.Show("Connection failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            PS3.AttachProcess();

            if (PS3.AttachProcess())
            {
                MessageBox.Show("You are now attached", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Attached !");
            }
            else
            {
                MessageBox.Show("Attach failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}

Salut,

Pour le moment ta partie connexion est bonne :)

edit : si le attach process et le connect target pas besoin qu'il soit en double ^^
 
Il n'y a pas de code inutile ? :)
si en faite regarde :

Code:
private void button1_Click(object sender, EventArgs e)
        {
            // PS3.ConnectTarget();

            if (PS3.ConnectTarget())
            {
                MessageBox.Show("You are now connected", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Connected !");
            }
            else
            {
                MessageBox.Show("Connection failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // PS3.AttachProcess();

            if (PS3.AttachProcess())
            {
                MessageBox.Show("You are now attached", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Attached !");
            }
            else
            {
                MessageBox.Show("Attach failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

à l'endroit ou j'ai mis des " // " :)
 
Cette réponse a aidé l'auteur de cette discussion !
si en faite regarde :

Code:
private void button1_Click(object sender, EventArgs e)
        {
            // PS3.ConnectTarget();

            if (PS3.ConnectTarget())
            {
                MessageBox.Show("You are now connected", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Connected !");
            }
            else
            {
                MessageBox.Show("Connection failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // PS3.AttachProcess();

            if (PS3.AttachProcess())
            {
                MessageBox.Show("You are now attached", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PS3.CCAPI.Notify(CCAPI.NotifyIcon.TROPHY4, "Attached !");
            }
            else
            {
                MessageBox.Show("Attach failed ...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

à l'endroit ou j'ai mis des " // " :)
Ok merci :)
 
Retour
Haut