Exemple #1
0
 public static bool Deserialize(string orig, Deep deep, out RepairToolV1_0 deserialized)
 {
     string[] rest;
     if (ProtocolV1_0Utils.GetParams(orig, NAME, deep, out rest))
     {
         if (rest.Length == 4)
         {
             int[]    paramsInt;
             string[] zonesString;
             if (Parser.TryParse(new int[] { 0, 1, 2 }, rest, out paramsInt) &&
                 ProtocolV1_0Utils.Deserialize(rest[3], out zonesString, deep.NEXT))
             {
                 ZoneV1_0[] zones = new ZoneV1_0[zonesString.Length];
                 for (int i = 0; i < zones.Length; i++)
                 {
                     if (!ZoneV1_0.Deserialize(zonesString[i], deep.NEXT.NEXT, out zones[i]))
                     {
                         deserialized = null;
                         return(false);
                     }
                 }
                 deserialized = new RepairToolV1_0(paramsInt[0], paramsInt[1], paramsInt[2], zones);
                 return(true);
             }
         }
     }
     deserialized = null;
     return(false);
 }
Exemple #2
0
 public static RepairToolV1_0[] Convert(RepairTool[] repairTools)
 {
     RepairToolV1_0[] output = new RepairToolV1_0[repairTools.Length];
     for (int i = 0; i < repairTools.Length; i++)
     {
         output[i] = new RepairToolV1_0(repairTools[i]);
     }
     return(output);
 }
            public override bool IsTransferable(ACommand c)
            {
                var c2 = c as GetRepairToolsAnswerCommand;

                if (c2 != null)
                {
                    cache.Cached(c, new GetRepairToolsAnswerCommandV10(RepairToolV1_0.Convert(c2.REPAIR_TOOLS)));
                    return(true);
                }
                return(false);
            }
 public override bool IsDeserializeable(string s)
 {
     s = s.Trim();
     string[] rest;
     if (ProtocolV1_0Utils.GetParams(s, NAME, ProtocolV1_0Utils.DEFAULT, out rest))
     {
         if (rest.Length == 1 && ProtocolV1_0Utils.Deserialize(rest[0], out rest, ProtocolV1_0Utils.DEFAULT.NEXT))
         {
             RepairToolV1_0[] repairTools = new RepairToolV1_0[rest.Length];
             for (int i = 0; i < repairTools.Length; i++)
             {
                 if (!RepairToolV1_0.Deserialize(rest[i], ProtocolV1_0Utils.DEFAULT.NEXT.NEXT, out repairTools[i]))
                 {
                     return(false);
                 }
             }
             cache.Cached(s, new GetRepairToolsAnswerCommandV10(repairTools));
             return(true);
         }
     }
     return(false);
 }