示例#1
0
 private static void Load()
 {
     try
     {
         if (File.Exists(mStoreFileName))
         {
             using (FileStream fs = new FileStream(mStoreFileName, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 RijndaelFormatter <SecurityStore> formatter = new RijndaelFormatter <SecurityStore>(mIV, mKey, new BinarySerializerFormatter <SecurityStore>());
                 mSecurityStore = formatter.Read(fs);
                 if (mSecurityStore == null)
                 {
                     mSecurityStore = new SecurityStore();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (LOGGER.IsErrorEnabled)
         {
             LOGGER.Error("REMOTE_DESKTOP_SERVICE: failed to load security information.", ex);
         }
     }
 }
示例#2
0
 private static void Save()
 {
     try
     {
         using (FileStream fs = new FileStream(mStoreFileName, FileMode.Create, FileAccess.Write, FileShare.Read))
         {
             RijndaelFormatter <SecurityStore> formatter = new RijndaelFormatter <SecurityStore>(mIV, mKey, new BinarySerializerFormatter <SecurityStore>());
             formatter.Write(fs, mSecurityStore);
         }
     }
     catch (Exception ex)
     {
         if (LOGGER.IsErrorEnabled)
         {
             LOGGER.Error("REMOTE_DESKTOP_SERVICE: failed to save security information.", ex);
         }
         throw;
     }
 }