Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FileStream() [14/15]

System.IO.FileStream.FileStream ( string path,
FileStreamOptions options )
inline

Definition at line 187 of file FileStream.cs.

188 {
189 if (path == null)
190 {
191 throw new ArgumentNullException("path", SR.ArgumentNull_Path);
192 }
193 if (path.Length == 0)
194 {
195 throw new ArgumentException(SR.Argument_EmptyPath, "path");
196 }
197 if (options == null)
198 {
199 throw new ArgumentNullException("options");
200 }
201 if ((options.Access & FileAccess.Read) != 0 && options.Mode == FileMode.Append)
202 {
203 throw new ArgumentException(SR.Argument_InvalidAppendMode, "options");
204 }
205 if ((options.Access & FileAccess.Write) == 0 && (options.Mode == FileMode.Truncate || options.Mode == FileMode.CreateNew || options.Mode == FileMode.Create || options.Mode == FileMode.Append))
206 {
207 throw new ArgumentException(SR.Format(SR.Argument_InvalidFileModeAndAccessCombo, options.Mode, options.Access), "options");
208 }
209 if (options.PreallocationSize > 0)
210 {
212 }
214 _strategy = FileStreamHelpers.ChooseStrategy(this, path, options.Mode, options.Access, options.Share, options.BufferSize, options.Options, options.PreallocationSize);
215 }
readonly FileStreamStrategy _strategy
Definition FileStream.cs:12
static FileStreamStrategy ChooseStrategy(FileStream fileStream, SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
static void SerializationGuard(FileAccess access)
static void ValidateArgumentsForPreallocation(FileMode mode, FileAccess access)

References System.IO.FileStream._strategy, System.SR.Argument_EmptyPath, System.SR.Argument_InvalidAppendMode, System.SR.Argument_InvalidFileModeAndAccessCombo, System.SR.ArgumentNull_Path, System.IO.Strategies.FileStreamHelpers.ChooseStrategy(), System.SR.Format(), System.options, System.IO.Strategies.FileStreamHelpers.SerializationGuard(), and System.IO.Strategies.FileStreamHelpers.ValidateArgumentsForPreallocation().