示例#1
0
 public static bool samePad(GCPadStatus a, GCPadStatus b)
 {
     string[] asplit = a.ToString().Split(new char[1] {
         ';'
     });
     string[] bsplit = b.ToString().Split(new char[1] {
         ';'
     });
     for (int i = 1; i < asplit.Length; i++)
     {
         if (asplit[i] != bsplit[i])
         {
             return(false);
         }
     }
     return(true);
 }
示例#2
0
        public void run()
        {
            TcpClient tcpclnt = new TcpClient();

            tcpclnt.Connect("127.0.0.1", 27015);
            StreamReader read  = new StreamReader(tcpclnt.GetStream());
            StreamWriter write = new StreamWriter(tcpclnt.GetStream());

            GCPadStatus[] PreviousPads = new GCPadStatus[4];
            bool[]        firsts       = new bool[4] {
                true, true, true, true
            };

            GCPadStatus CurrentPad;
            string      packet;

            while (true)
            {
                packet     = read.ReadLine();
                CurrentPad = new GCPadStatus(packet);
                for (int i = 0; i < 4; i++)
                {
                    if (!firsts[i] && CurrentPad.ID == i && CurrentPad.Frame != PreviousPads[i].Frame)
                    {
                        GCPadCallbacks[i](CurrentPad, PreviousPads[i], write);
                        PreviousPads[i] = CurrentPad;
                    }
                    else if (firsts[i] && CurrentPad.ID == i)
                    {
                        firsts[i]       = false;
                        PreviousPads[i] = CurrentPad;
                    }
                }
            }

            tcpclnt.Close();
        }
示例#3
0
 public static void DefaultGCPadCallback(GCPadStatus cs, GCPadStatus ps, StreamWriter w)
 {
 }