daily pastebin goal
18%
SHARE
TWEET

RWFile

tolikpunkoff Feb 18th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static class RWFile
  2.     {
  3.         public static int CP = 28605;
  4.  
  5.         public static string ReadFile(string FileName)
  6.         {          
  7.             byte[] TempBuf = File.ReadAllBytes(FileName);
  8.            
  9.             string ReadBuf = "";
  10.             StreamReader sr = new StreamReader(FileName, Encoding.GetEncoding(CP), false);
  11.             ReadBuf=sr.ReadToEnd();
  12.             sr.Close();
  13.             return ReadBuf;
  14.         }
  15.  
  16.         public static void WriteFile(string FileName, string FileData, bool Backup)
  17.         {
  18.             if (Backup)
  19.             {
  20.                 File.Copy(FileName, FileName + ".bak", true);
  21.             }
  22.             StreamWriter sw = new StreamWriter(FileName, false, Encoding.GetEncoding(CP));
  23.             sw.Write(FileData);
  24.             sw.Close();
  25.                        
  26.         }
  27.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top