Difference between revisions of "API:FileInfo"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Created page with "<!-- Autogenerated by WRAPTOOL. Yell at N3X15 if it breaks. --> {{Namespace:KSP.IO}} {{Class |name=FileInfo |summary=A surrogate for System.IO.FileInfo. }} {{MethodsStart}} {...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- Autogenerated by WRAPTOOL.  Yell at N3X15 if it breaks. -->
+
<!-- Autogenerated by DOCTOOL.  Yell at N3X15 if it breaks. -->
 
{{Namespace:KSP.IO}}
 
{{Namespace:KSP.IO}}
 
{{Class
 
{{Class
Line 5: Line 5:
 
|summary=A surrogate for System.IO.FileInfo.
 
|summary=A surrogate for System.IO.FileInfo.
 
}}
 
}}
 +
{{PropertiesStart}}
 +
{{Property
 +
|type=long
 +
|name=Length
 +
|desc=Gets the size, in bytes, of the current file.
 +
|hasget=1
 +
|hasset=
 +
}}
 +
{{Property
 +
|type=string
 +
|name=DirectoryName
 +
|desc=Gets a string representing the directory's full path.
 +
|hasget=1
 +
|hasset=
 +
}}
 +
{{Property
 +
|type=string
 +
|name=Name
 +
|desc=Gets the name of the file.
 +
|hasget=1
 +
|hasset=
 +
}}
 +
{{Property
 +
|type=bool
 +
|name=Exists
 +
|desc=Gets a value indicating whether a file exists.
 +
|hasget=1
 +
|hasset=
 +
}}
 +
{{Property
 +
|type=bool
 +
|name=IsReadOnly
 +
|desc=Gets or sets a value that determines if the current file is read only.
 +
|hasget=1
 +
|hasset=1
 +
}}
 +
{{PropertiesEnd}}
 
{{MethodsStart}}
 
{{MethodsStart}}
 
{{StaticMethod
 
{{StaticMethod
Line 10: Line 47:
 
|returndesc=
 
|returndesc=
 
|name=CreateForType<T>
 
|name=CreateForType<T>
|args=string filename, Vessel flight = null
+
|args={{arg|string|filename}}, {{arg|Vessel|flight|default=null}}
 
|desc=Create a text reader stream.
 
|desc=Create a text reader stream.
 
}}
 
}}
Line 17: Line 54:
 
|returndesc=
 
|returndesc=
 
|name=Replace
 
|name=Replace
|args=string destinationFileName, string destinationBackupFileName
+
|args={{arg|string|destinationFileName}}, {{arg|string|destinationBackupFileName}}
 
|desc=Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file.
 
|desc=Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file.
 
}}
 
}}
Line 45: Line 82:
 
|returndesc=
 
|returndesc=
 
|name=CopyTo
 
|name=CopyTo
|args=string destFileName, bool overwrite
+
|args={{arg|string|destFileName}}, {{arg|bool|overwrite}}
 
|desc=Copies an existing file to a new file, allowing the overwriting of an existing file.
 
|desc=Copies an existing file to a new file, allowing the overwriting of an existing file.
 
}}
 
}}
Line 52: Line 89:
 
|returndesc=
 
|returndesc=
 
|name=Open
 
|name=Open
|args=FileMode mode, FileAccess access
+
|args={{arg|FileMode|mode}}, {{arg|FileAccess|access}}
 
|desc=Opens a file in the specified mode with read, write, or read/write access.
 
|desc=Opens a file in the specified mode with read, write, or read/write access.
 
}}
 
}}
Line 66: Line 103:
 
|returndesc=
 
|returndesc=
 
|name=MoveTo
 
|name=MoveTo
|args=string destFileName
+
|args={{arg|string|destFileName}}
 
|desc=Moves a specified file to a new location, providing the option to specify a new file name.
 
|desc=Moves a specified file to a new location, providing the option to specify a new file name.
 
}}
 
}}
Line 80: Line 117:
 
|returndesc=
 
|returndesc=
 
|name=Open
 
|name=Open
|args=FileMode mode
+
|args={{arg|FileMode|mode}}
 
|desc=Opens a file in the specified mode.
 
|desc=Opens a file in the specified mode.
 
}}
 
}}
Line 115: Line 152:
 
|returndesc=
 
|returndesc=
 
|name=Open
 
|name=Open
|args=FileMode mode, FileAccess access, FileShare share
+
|args={{arg|FileMode|mode}}, {{arg|FileAccess|access}}, {{arg|FileShare|share}}
 
|desc=Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
 
|desc=Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
 
}}
 
}}
Line 129: Line 166:
 
|returndesc=
 
|returndesc=
 
|name=CopyTo
 
|name=CopyTo
|args=string destFileName
+
|args={{arg|string|destFileName}}
 
|desc=Copies an existing file to a new file, disallowing the overwriting of an existing file.
 
|desc=Copies an existing file to a new file, disallowing the overwriting of an existing file.
 
}}
 
}}
Line 136: Line 173:
 
|returndesc=
 
|returndesc=
 
|name=Replace
 
|name=Replace
|args=string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors
+
|args={{arg|string|destinationFileName}}, {{arg|string|destinationBackupFileName}}, {{arg|bool|ignoreMetadataErrors}}
 
|desc=Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.
 
|desc=Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.
 
}}
 
}}
 
{{MethodsEnd}}
 
{{MethodsEnd}}

Latest revision as of 23:43, 12 October 2012

KSP.IO Namespace
BinaryReader · BinaryWriter · File · FileInfo · FileStream · IOException · IOTools · IOUtils · MemoryStream · PluginConfigNode · PluginConfiguration · TextReader · TextWriter

FileInfo Class

A surrogate for System.IO.FileInfo.

Properties

The following are public properties available in FileInfo.

Signature Description
long Length { get; } Gets the size, in bytes, of the current file.
string DirectoryName { get; } Gets a string representing the directory's full path.
string Name { get; } Gets the name of the file.
bool Exists { get; } Gets a value indicating whether a file exists.
bool IsReadOnly { get; set; } Gets or sets a value that determines if the current file is read only.

Methods

The following are methods included in FileInfo.

Signature Description
static FileInfo CreateForType<T>(string filename, Vessel flight = null) Create a text reader stream.
FileInfo Replace(string destinationFileName, string destinationBackupFileName) Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file.
void Encrypt() Encrypts a file so that only the account used to encrypt the file can decrypt it.
void Delete() Permanently deletes a file.
FileStream Create() Creates a file.
FileInfo CopyTo(string destFileName, bool overwrite) Copies an existing file to a new file, allowing the overwriting of an existing file.
FileStream Open(FileMode mode, FileAccess access) Opens a file in the specified mode with read, write, or read/write access.
FileStream OpenWrite() Creates a write-only System.IO.FileStream.
void MoveTo(string destFileName) Moves a specified file to a new location, providing the option to specify a new file name.
TextWriter AppendText() Creates a System.IO.StreamWriter that appends text to the file represented by this instance of the System.IO.FileInfo.
FileStream Open(FileMode mode) Opens a file in the specified mode.
FileStream OpenRead() Creates a read-only System.IO.FileStream.
TextWriter CreateText() Creates a KSP.IO.TextWriter that writes a new text file.
string ToString() Returns the path as a string.
TextReader OpenText() Creates a System.IO.StreamReader with UTF8 encoding that reads from an existing text file.
FileStream Open(FileMode mode, FileAccess access, FileShare share) Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.
void Decrypt() Decrypts a file that was encrypted by the current account using the System.IO.FileInfo.Encrypt() method.
FileInfo CopyTo(string destFileName) Copies an existing file to a new file, disallowing the overwriting of an existing file.
FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors) Replaces the contents of a specified file with the file described by the current System.IO.FileInfo object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors.