예제 #1
0
파일: Utils.cs 프로젝트: wwkkww1983/WMS
 public static void Serial(string FilePath, LicObj obj)
 {
     using (FileStream fileStream = new FileStream(FilePath, FileMode.Create))
     {
         byte[] inputByteArray = SerializeObject(obj);
         inputByteArray = Encry.EncryptDES(inputByteArray, keys);
         fileStream.Write(inputByteArray, 0, inputByteArray.Length);
     }
 }
예제 #2
0
파일: Utils.cs 프로젝트: wwkkww1983/WMS
 public static LicObj DeserializeObject(string Filepath)
 {
     using (FileStream fileStream = new FileStream(Filepath, FileMode.Open))
     {
         fileStream.Seek(0L, SeekOrigin.Begin);
         byte[] array = new byte[fileStream.Length];
         fileStream.Read(array, 0, array.Length);
         array = Encry.DecryptDES(array, "C.I.t.ks");
         LicObj result = null;
         if (array != null)
         {
             using (MemoryStream memoryStream = new MemoryStream(array))
             {
                 memoryStream.Position = 0L;
                 BinaryFormatter binaryFormatter = new BinaryFormatter();
                 result = (binaryFormatter.Deserialize(memoryStream) as LicObj);
                 memoryStream.Close();
                 return(result);
             }
         }
         return(result);
     }
 }