API:File

From Kerbal Space Program Wiki
Jump to: navigation, search

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

File Class

summary goes here

Methods

The following are methods included in File.

Signature Description
static bool Exists<T>(string filename, Vessel flight = null) Find out if a file in your IO sandbox exists.
static KSP.IO.FileStream Open<T>(string filename, KSP.IO.FileMode mode, Vessel flight = null) Open a stream that operates on a file.
static KSP.IO.FileStream OpenWrite<T>(string filename, Vessel flight = null) Open a stream that writes to a file.
static void WriteAllText<T>(string data, string filename, Vessel flight = null) Write a string to a file.
static void AppendAllText<T>(string data, string filename, Vessel flight = null) Append a string to a file, or creates it if it doesn't exist.
static KSP.IO.TextWriter AppendText<T>(string filename, Vessel flight = null) Open a stream that appends to a file.
static void Delete<T>(string filename, Vessel flight = null) Delete a file in your IO sandbox.
static string[] ReadAllLines<T>(string filename, Vessel flight = null) Read all lines from a file in your IO sandbox.
static KSP.IO.TextReader OpenText<T>(string filename, Vessel flight = null) Open a stream that operates on a file.
static byte[] ReadAllBytes<T>(string filename, Vessel flight = null) Read all the bytes from a file in your IO sandbox.
static KSP.IO.TextWriter CreateText<T>(string filename, Vessel flight = null) Open a stream that creates a file.
static void WriteAllBytes<T>(byte[] data, string filename, Vessel flight = null) Write a bunch of bytes to a file on disk
static void WriteAllLines<T>(string[] data, string filename, Vessel flight = null) Write an array of strings to a file, with each string becoming a line.
static string ReadAllText<T>(string filename, Vessel flight = null) Read all the text from a file in your IO sandbox.
static KSP.IO.FileStream Create<T>(string filename, Vessel flight = null) Open a stream that creates a file.