예제 #1
0
        public static ProcessLiteInfo Deserialize(byte[] bytes)
        {
            var r = new ProcessLiteInfo();

            List <object> list    = (List <object>)CraftSynth.BuildingBlocks.IO.Xml.Misc.Deserialize(bytes, false);
            int           version = (int)list[0];

            if (version == 1)
            {
                r.Id              = (int)list[1];
                r.Name            = (string)list[2];
                r.FilePath        = (string)list[3];
                r.MainWindowTitle = (string)list[4];
            }
            else if (version == 2)
            {
                r.Id              = (int)list[1];
                r.Name            = (string)list[2];
                r.FilePath        = (string)list[3];
                r.MainWindowTitle = (string)list[4];
                r.IconBytes       = (byte[])list[5];
            }
            else
            {
                throw new Exception("ProcessLiteInfo.Deserialize: version not recognized. Version=" + version ?? "null");
            }

            return(r);
        }
예제 #2
0
 public static decimal SizeInBytesOfManagedPartOrIfNullZero(this ProcessLiteInfo pli)
 {
     if (pli == null)
     {
         return(0);
     }
     else
     {
         return(pli.SizeInBytesOfManagedpart());
     }
 }
예제 #3
0
 public static ProcessLiteInfo DeserializeOrIfNullReturnNull(this byte[] bytes)
 {
     if (bytes == null)
     {
         return(null);
     }
     else
     {
         return(ProcessLiteInfo.Deserialize(bytes));
     }
 }
예제 #4
0
 public static byte[] SerializeOrIfNullReturnNull(this ProcessLiteInfo pli)
 {
     if (pli == null)
     {
         return(null);
     }
     else
     {
         return(pli.Serialize());
     }
 }