Exemple #1
0
 /// <summary>
 /// 打开加密的文件
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="fileContent"></param>
 /// <returns></returns>
 public static bool OpenEncryptFile(string fileName, out string fileContent)
 {
     if (File.Exists(fileName))
     {
         FileStream fs = null;;
         try
         {
             fs = new FileStream(fileName, FileMode.Open);
             byte[] readBytes = new byte[fs.Length];
             fs.Read(readBytes, 0, (Int32)fs.Length);
             fileContent = DataConvert.BytesToString(DataConvert.ToNormalData(readBytes));
             return(true);
         }
         catch (Exception ex)
         {
             fileContent = "";
             return(false);
         }
         finally
         {
             if (fs != null)
             {
                 fs.Close();
             }
         }
     }
     fileContent = "";
     return(false);
 }