예제 #1
0
 /// <summary>
 /// Evaluates the content. Read JSON object create IContent
 /// </summary>
 /// <param name="content">The content.</param>
 /// <returns></returns>
 private static IContent EvaluateContent(JObject content)
 {
     try
     {
         if (FrameBuilder.isVirtualContainer(content["Type"])) //VirtualContainer
         {
             //Create new VC with level from JSON file
             VirtualContainer newVC = new VirtualContainer(FrameBuilder.getVCLevel(content["Level"]));
             newVC.Pointer = content["Pointer"].ToString();
             newVC.POH     = (POH)FrameBuilder.EvaluateContent((JObject)content["POH"]);
             if (FrameBuilder.isJArray(content["Content"]))
             {
                 newVC.Content = FrameBuilder.evaluateContents((JArray)content["Content"]);
             }
             else //There is no value Content of VC is null
             {
                 newVC.Content = null;
             }
             return(newVC);
         }
         else if (FrameBuilder.isContainer(content["Type"]))
         {
             Container newContainer = new Container(content["Content"].ToString());
             return(newContainer);
         }
         else if (FrameBuilder.isHeader(content["Type"]))
         {
             string checksum  = content["Checksum"].ToString();
             string eow       = content["EOW"].ToString();
             string dcc       = content["DCC"].ToString();
             Header newHeader = new Header(checksum, eow, dcc);
             return(newHeader);
         }
         else if (FrameBuilder.isPOH(content["Type"]))
         {
             SignalLabelType signalType = FrameBuilder.getSignalType(content["SignalLabel"]);
             POH             poh        = new POH(signalType);
             return(poh);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(null);
     }
 }
예제 #2
0
파일: POH.cs 프로젝트: JJablon/TSST-2017Z
 public POH(SignalLabelType signalLabel)
 {
     this.SignalLabel = signalLabel;
     this.Type        = ContentType.POH;
 }
예제 #3
0
 public POH(SignalLabelType signalLabel)
 {
     this.SignalLabel = signalLabel;
     this.Type = ContentType.POH;
 }
예제 #4
0
파일: POH.cs 프로젝트: JJablon/TSST-2017Z
 public POH()
 {
     this.Type        = ContentType.POH;
     this.SignalLabel = SignalLabelType.UNDEF;
 }