Axiom.FileSystem.FileSystemArchive.Create C# (CSharp) Méthode

Create() public méthode

public Create ( string filename, bool overwrite ) : Stream
filename string
overwrite bool
Résultat Stream
		public override Stream Create( string filename, bool overwrite )
		{
			if ( IsReadOnly )
			{
				throw new AxiomException( "Cannot create a file in a read-only archive." );
			}

			Stream stream = null;
			string fullPath = _basePath + Path.DirectorySeparatorChar + filename;
			bool exists = File.Exists( fullPath );
			if ( !exists || overwrite )
			{
				try
				{
#if !( XBOX || XBOX360 || ANDROID )
					stream = File.Create( fullPath, 1, FileOptions.RandomAccess );
#else
					stream = File.Create( fullPath, 1 );
#endif
				}
				catch ( Exception ex )
				{
					throw new AxiomException( "Failed to open file : " + filename, ex );
				}
			}
			else
			{
				stream = Open( fullPath, false );
			}

			return stream;
		}