using System; using System.Runtime.InteropServices; namespace System.IO { /// Specifies how the operating system should open a file. /// 2 // Token: 0x020001B7 RID: 439 [ComVisible(true)] [Serializable] public enum FileMode { /// Specifies that the operating system should create a new file. This requires . If the file already exists, an is thrown. // Token: 0x04000674 RID: 1652 CreateNew = 1, /// Specifies that the operating system should create a new file. If the file already exists, it will be overwritten. This requires . System.IO.FileMode.Create is equivalent to requesting that if the file does not exist, use ; otherwise, use . If the file already exists but is a hidden file, an is thrown. // Token: 0x04000675 RID: 1653 Create, /// Specifies that the operating system should open an existing file. The ability to open the file is dependent on the value specified by . A is thrown if the file does not exist. // Token: 0x04000676 RID: 1654 Open, /// Specifies that the operating system should open a file if it exists; otherwise, a new file should be created. If the file is opened with FileAccess.Read, is required. If the file access is FileAccess.Write then is required. If the file is opened with FileAccess.ReadWrite, both and are required. If the file access is FileAccess.Append, then is required. // Token: 0x04000677 RID: 1655 OpenOrCreate, /// Specifies that the operating system should open an existing file. Once opened, the file should be truncated so that its size is zero bytes. This requires . Attempts to read from a file opened with Truncate cause an exception. // Token: 0x04000678 RID: 1656 Truncate, /// Opens the file if it exists and seeks to the end of the file, or creates a new file. FileMode.Append can only be used in conjunction with FileAccess.Write. Attempting to seek to a position before the end of the file will throw an and any attempt to read fails and throws an . // Token: 0x04000679 RID: 1657 Append } }