Ejemplo n.º 1
0
 public void decodeAddRequest(Message msg, out string key, out string name, out string descr, out string payload, out List<string> children)
 {
     XElement doc = XElement.Parse(msg.content);
     key = doc.Element("Key").Value.ToString();
     name = doc.Element("name").Value.ToString();
     descr = doc.Element("descr").Value.ToString();
     payload = doc.Element("Payload").Value.ToString();
     IEnumerable<XElement> childrenX = doc.Elements("child");
     children = new List<string>();
     if (childrenX.Count() > 0)
     {
         foreach (XElement child in childrenX)
         {
             children.Add(child.Value.ToString());
         }
     }
 }
Ejemplo n.º 2
0
 private void ProcessTypeResult(Message msg)
 {
     string keytype, valuetype;
     parser.decodeTypeResult(msg, out keytype, out valuetype);
     keyTypeInfo.Text = keytype;
     valueTypeInfo.Text = valuetype;
     keyTypeInfo2.Text = keytype;
     valueTypeInfo2.Text = valuetype;
 }
Ejemplo n.º 3
0
 //----< Process results of Restore Request >-------------------------
 private void ProcessRstrResult(Message msg)
 {
     bool success = false;
     parser.decodeRestoreResult(msg, out success);
     if (success) statusbarItem.Text = "Restored from " + filenameInput.Text + ".xml";
     else statusbarItem.Text = "DB Restore Failed!";
 }
Ejemplo n.º 4
0
 //----< Process results of Remove Request >--------------------------
 private void ProcessRmvResult(Message msg)
 {
     bool success = false;
     parser.decodeRmvResult(msg, out success);
     if (success) statusbarItem.Text = "Key/Value Removed";
     else statusbarItem.Text = "Remove operation Failed!";
 }
Ejemplo n.º 5
0
 //----< Process results of Persist Request >-------------------------
 private void ProcessPrstResult(Message msg)
 {
     bool success = false;
     parser.decodePersistResult(msg, out success);
     if (success) statusbarItem.Text = "Persisted to " + filenameInput.Text + ".xml";
     else statusbarItem.Text = "Persist Failed!";
 }
Ejemplo n.º 6
0
 //----< Process results of Edit Request >----------------------------
 private void ProcessGetValueRes(Message msg)
 {
     string name, descr, children, payload;
     bool success;
     parser.decodeValueResult(msg, out name, out descr, out children, out payload, out success);
     if (success)
     {
         keyInput.IsEnabled = false;
         nameInput.Text = name;
         descInput.Text = descr;
         childInput.Text = children;
         dataInput.Text = payload;
     }
     else
     {
         keyInput.IsEnabled = true;
         keyInput.Text = "";
         statusbarItem.Text = "Key does not exist!";
         nameInput.Text = "";
         descInput.Text = "";
         childInput.Text = "";
         dataInput.Text = "";
     }
 }
Ejemplo n.º 7
0
 //----< Process results of Edit Request >----------------------------
 private void ProcessEditResult(Message msg)
 {
     bool success = false;
     parser.decodeEditResult(msg, out success);
     if (success) statusbarItem.Text = "Edits saved successfully";
     else statusbarItem.Text = "Could not save edits!";
 }
Ejemplo n.º 8
0
 //----< process response messages to sent requests >-----------------
 public void processResponse(Message msg)
 {
     if (msg.type == 3) ProcessGetValueRes(msg);
     else if (msg.type == 1) ProcessAddResult(msg);
     else if (msg.type == 2) ProcessRmvResult(msg);
     else if (msg.type == 4) ProcessEditResult(msg);
     else if (msg.type == 6) ProcessPrstResult(msg);
     else if (msg.type == 7) ProcessRstrResult(msg);
     else if (msg.type == 8) ProcessTypeResult(msg);
 }
Ejemplo n.º 9
0
        //----< indirectly used by child receive thread to post results >----
        public void processRcvMsg(Message msg)
        {
            postRcvMsg( msg.content);

            processResponse(msg);
        }
Ejemplo n.º 10
0
 public void decodeValueRequest(Message msg, out string key)
 {
     XElement doc = XElement.Parse(msg.content);
     key = doc.Element("Key").Value.ToString();
 }
Ejemplo n.º 11
0
 public void decodeTypeResult(Message msg, out string keytype, out string valuetype)
 {
     XElement doc = XElement.Parse(msg.content);
     keytype = doc.Element("KeyType").Value.ToString();
     valuetype = doc.Element("ValueType").Value.ToString();
 }
Ejemplo n.º 12
0
 public void decodeRmvResult(Message msg, out bool success)
 {
     XElement doc = XElement.Parse(msg.content);
     if (doc.Value.ToString() == "Action Completed") success = true;
     else success = false;
 }
Ejemplo n.º 13
0
 public void decodeRestoreRequest(Message msg, out string filename)
 {
     XElement doc = XElement.Parse(msg.content);
     filename = doc.Element("File").Value.ToString();
 }
Ejemplo n.º 14
0
 public void decodeQuery(Message msg, out int type, out string query)
 {
     XElement doc = XElement.Parse(msg.content);
     query = doc.Element("querystring").Value.ToString();
     type = int.Parse(doc.Element("querytype").Value.ToString());
 }
Ejemplo n.º 15
0
 public void decodeValueResult(Message msg, out string name, out string descr, out string children, out string payload, out bool status)
 {
     XElement doc = XElement.Parse(msg.content).Element("Value"); ;
     if (doc == null)
     {
         name = ""; descr = ""; children = ""; payload = "";
         status = false;
     }
     else
     {
         status = true;
         XElement temp = doc.Element("name");
         name = temp.Value.ToString();
         descr = doc.Element("descr").Value.ToString();
         payload = doc.Element("payload").Value.ToString();
         children = "";
         IEnumerable<XElement> childrenX = doc.Element("children").Elements("child");
         bool flag = true;
         if (childrenX.Count() > 0)
         {
             foreach (XElement child in childrenX)
             {
                 if (flag)
                 {
                     children = (child.Value.ToString());
                     flag = false;
                 }
                 else children += ", " + (child.Value.ToString());
             }
         }
     }
 }