Пример #1
0
 /** 
  * Process Buffer
  * Takes byte list as input and appends the byte stream to the response string
  * if the footer of the message is not read, continue to read
  */
 private void ProcessBuffer(List<byte> bBuffer) {
     lastSerialResponse += System.Text.Encoding.ASCII.GetString(bBuffer.ToArray());
     if (lastSerialResponse.Length > 10) {
         if (lastSerialResponse.Contains("Complete") || lastSerialResponse.Contains("COMPLETE")) {
             //Console.Beep();
             System.Diagnostics.Debug.WriteLine(String.Format("Received Complete: {0}", lastSerialResponse));
             STATUS = DEVICE_STATE_READ_COMPLETE;
             STATUSMESSAGE = lastSerialResponse;
             Console.Beep();
         } else {
             //Not yet complete, allow to buffer
             //Console.Beep();
             System.Diagnostics.Debug.WriteLine(String.Format("Received Not Complete: {0}", lastSerialResponse));
         }
     } else {
         //Not yet complete, allow to buffer
         //Console.Beep();
         System.Diagnostics.Debug.WriteLine(String.Format("Received Short: {0}", lastSerialResponse));
     }
 }
Пример #2
0
 public string[] listAllUsers() {
     List<String> userList = new List<String>();
     DataTable temp = queryTable("UserTable", new string[]{"username"}, "1");
     foreach (DataRow row in temp.Rows) {
         userList.Add(row["username"].ToString());
     }
     return userList.ToArray();
 }