Provides line-based read/write access to a file. The file can be read into memory, changed, then written back to disk. When the file is persisted back to disk, an optimistic concurrency check is performed to make sure the file hasn't changed since it was originally read. This class is not threadsafe.
コード例 #1
0
 /// <summary>
 /// Construct a new IniFile.
 /// </summary>
 /// <param name="filePath">path of the IniFile</param>
 public IniFile(string filePath)
 {
     logger   = Logger.GetLogger(GetType());
     textFile = new OptimisticLockedTextFile(filePath);
     Validate();
 }
コード例 #2
0
 /// <summary>
 /// Construct a new IniFile.
 /// </summary>
 /// <param name="filePath">path of the IniFile</param>
 public IniFile(string filePath)
 {
     textFile = new OptimisticLockedTextFile(filePath);
     Validate();
 }
コード例 #3
0
 public OptimisticLockedTextFileTester(string fileContents)
 {
     FilePath = Path.GetTempFileName();
     File.WriteAllText(FilePath, fileContents);
     TextFile = new OptimisticLockedTextFile(FilePath);
 }
コード例 #4
0
 public OptimisticLockedTextFileTester(bool createFile = false)
 {
     if (createFile)
     {
         FilePath = Path.GetTempFileName();
     }
     else
     {
         FilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
     }
     TextFile = new OptimisticLockedTextFile(FilePath);
 }
コード例 #5
0
ファイル: IniFile.cs プロジェクト: aws/aws-sdk-net
 /// <summary>
 /// Construct a new IniFile.
 /// </summary>
 /// <param name="filePath">path of the IniFile</param>
 public IniFile(string filePath)
 {
     textFile = new OptimisticLockedTextFile(filePath);
     Validate();
 }