Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
KSPUtil Class Reference

Classes

class  DefaultDateTimeFormatter
 
class  StringReplacement
 
class  SystemDateTime
 Use this instead of System.DateTime.Now function as it deals with invalid Time Zones. More...
 

Public Member Functions

delegate T ObjectActivator< T > (params object[] args)
 

Static Public Member Functions

static Matrix4x4 Add (Matrix4x4 left, Matrix4x4 right)
 Strips out nas More...
 
static void Add (ref Matrix4x4 left, Matrix4x4 right)
 Add a 4x4 Matrix into another one (does not allocate) More...
 
static void Add (ref Matrix4x4 left, ref Matrix4x4 right)
 Add a 4x4 Matrix into another one (does not allocate) More...
 
static string AppendValueToString (string s0, string val, char separator)
 Appends a new string to the given source string if source string does not already contain it. Does not modify input values. More...
 
static float BearingDegrees (Vector3 v1, Vector3 v2, Vector3 upAxis)
 Returns an angle from -180° to 180° between the two vectors, based on the up axis to tell left from right More...
 
static float BearingRadians (Vector3 v1, Vector3 v2, Vector3 upAxis)
 Returns an angle from -PI to PI between the two vectors, based on the up axis to tell left from right More...
 
static float CalculateFolderSize (string folderPath, out int totalFiles)
 Calculates the size of data and number of files in a folder (and sub-folders) More...
 
static bool CheckDOSName (string originalString)
 Checks if the string is a reserved DOS name More...
 
static VersionCompareResult CheckVersion (string versionString, int lastMajor, int lastMinor, int lastRev)
 
static VersionCompareResult CheckVersion (int version_major, int version_minor, int version_revision, int lastMajor, int lastMinor, int lastRev)
 
static Rect ClampRectToScreen (Rect r)
 Takes a Rect r and moves it inside the screen space More...
 
static bool DeepCompare< T > (this HashSet< T > a, HashSet< T > b)
 
static Vector3d Diag (Matrix4x4 m)
 Returns the diagonal 3-vector from the 4x4 matrix (simulating 3x3 matrix) More...
 
static List< T > FindComponentsImplementing< T > (GameObject go, bool returnInactive)
 
static Transform FindInPartModel (Transform part, string childName)
 
static void FindTagsInChildren (List< string > tags, Transform trf)
 Find all tags contained in the sub-object hierarchy More...
 
static Transform FindTransformAtIndexPath (string indexPath, Transform root)
 
static string GenerateFilePathWithDate (string filePath)
 
static int GenerateSuperSeed (Guid guid, int seed)
 Creates an excessively unique and unpredictable seed for an object GUID is super unique. Super Seed crushes up the GUID and salts it with the passed seed. More...
 
static Texture2DArray GenerateTexture2DArray (List< Texture2D > textureList, TextureFormat format, bool createMipMaps)
 Generates a Texture2DArray from a list of textures. More...
 
static ObjectActivator< T > GetActivator< T > (ConstructorInfo ctor)
 
static bool GetAttachNodeInfo (string configAttnID, ref string nodeID, ref string attnPartID, ref Vector3 attnPos)
 Parses a string into attach node properties More...
 
static bool GetAttachNodeInfo (string configAttnID, ref string nodeID, ref string attnPartID, ref Vector3 attnPos, ref string attachMeshName)
 Parses a string into attach node properties More...
 
static bool GetAttachNodeInfo (string configAttnID, ref string nodeID, ref string attnPartID, ref Vector3 attnPos, ref string attachMeshName, ref Vector3 attnRot, ref Vector3 secAxis)
 Parses a string into attach node properties More...
 
static bool GetAttachNodeInfo (string configAttnID, ref string nodeID, ref string attnPartID, ref Vector3 attnPos, ref Vector3 attnRot, ref Vector3 attnActualPos, ref Vector3 attnActualRot)
 Parses a string into attach node properties More...
 
static string GetLinkID (string configAttnID)
 
static string GetOrCreatePath (string relPath)
 Returns a filepath that points to the given folders inside the game's root folder (will create it if one isn't found) More...
 
static Part GetPartByCraftID (this List< Part > parts, uint id)
 
static void GetPartInfo (string configPartID, ref string partName, ref string craftID)
 
static string GetPartName (string configPartID)
 
static string GetRelativePath (string fullPath, string basePath)
 Returns a relative path string from a full path based on a base path provided. More...
 
static string GetTransformIndexPathToRoot (Transform t, Transform root)
 
static string GetTransformPathToRoot (Transform t, Transform root)
 
static bool HasAncestorTransform (Transform src, Transform ancestor)
 Returns true if the src transform is a hierarchical descendant of the ancestor transform More...
 
static bool HasDescendantTransform (Transform src, Transform child)
 Returns true if the src transform has the child transform as a descendant on its hierarchy More...
 
static float HeadingDegrees (Vector3 v1, Vector3 v2, Vector3 upAxis)
 Returns an angle from 0 to 360° between the two vectors, based on the up axis to tell left from right More...
 
static float HeadingRadians (Vector3 v1, Vector3 v2, Vector3 upAxis)
 Returns an angle from 0 to 2PI between the two vectors, based on the up axis to tell left from right More...
 
static string LocalizeNumber (double value, string format)
 Converts a number to a string localizing the numeric punctuation More...
 
static string LocalizeNumber (float value, string format)
 Converts a number to a string localizing the numeric punctuation More...
 
static bool MoveFile (string filePath, string destinationPath, bool overwrite=false)
 
static Matrix4x4 OuterProduct (Vector3 left, Vector3 right)
 Construct the outer product of two 3-vectors as a 4x4 matrix More...
 
static void OuterProduct (Vector3 left, Vector3 right, ref Matrix4x4 m)
 Construct the outer product of two 3-vectors as a 4x4 matrix More...
 
static void OuterProduct2 (Vector3 left, Vector3 right, ref Matrix4x4 m)
 Construct the outer product of two 3-vectors as a 4x4 matrix DOES NOT ZERO ANY THINGS WOT ARE ZERO OR IDENTITY INNIT More...
 
static T[] ParseArray< T > (string arrayString, ParserMethod< T > parser)
 
static Quaternion ParseQuaternion (string quaternionString)
 
static Quaternion ParseQuaternion (string quaternionString, char separator)
 
static Quaternion ParseQuaternion (string x, string y, string z, string w)
 
static QuaternionD ParseQuaternionD (string quaternionString)
 Parses a QuaternionD from a comma-separated string of XYZW values More...
 
static QuaternionD ParseQuaternionD (string x, string y, string z, string w)
 
static QuaternionD ParseQuaternionD (string quaternionString, char separator)
 Parses a QuaternionD from a comma-separated string of XYZW values More...
 
static Vector2 ParseVector2 (string vectorString)
 Parses a Vector2 from a comma-separated string of XYZ values More...
 
static Vector2 ParseVector2 (string vectorString, char separator)
 Parses a Vector2 from a delimited string of XYZ values More...
 
static Vector2 ParseVector2 (string x, string y)
 
static Vector3 ParseVector3 (string vectorString)
 Parses a Vector3 from a comma-separated string of XYZ values More...
 
static Vector3 ParseVector3 (string vectorString, char separator)
 Parses a Vector3 from a delimited string of XYZ values More...
 
static Vector3 ParseVector3 (string x, string y, string z)
 
static Vector3d ParseVector3d (string vectorString)
 Parses a Vector3 from a comma-separated string of XYZ values More...
 
static Vector3d ParseVector3d (string vectorString, char separator)
 Parses a Vector3 from a delimited string of XYZ values More...
 
static Vector3d ParseVector3d (string x, string y, string z)
 
static Vector4 ParseVector4 (string vectorString)
 Parses a Vector4 from a comma-separated string of XYZ values More...
 
static Vector4 ParseVector4 (string x, string y, string z, string w)
 
static Vector4 ParseVector4 (string vectorString, char separator)
 Parses a Vector4 from a delimited string of XYZ values More...
 
static string PrintCollection< T > (IEnumerable< T > collection, string separator=", ")
 Produces a string combining the string values (given by .ToString()) of all the elements in a collection More...
 
static string PrintCollection< T > (IEnumerable< T > collection, string separator, Func< T, string > stringAccessor)
 Produces a string combining the string values (given by stringAccessor) of all the elements in a collection More...
 
static string PrintCoordinates (double latitude, double longitude, bool singleLine, bool includeMinutes=true, bool includeSeconds=true)
 
static string PrintDate (double time, bool includeTime, bool includeSeconds=false)
 
static string PrintDateCompact (double time, bool includeTime, bool includeSeconds=false)
 
static string PrintDateDelta (double time, bool includeTime, bool includeSeconds=false, bool useAbs=false)
 
static string PrintDateDeltaCompact (double time, bool includeTime, bool includeSeconds, bool useAbs=false)
 
static string PrintDateDeltaCompact (double time, bool includeTime, bool includeSeconds, int interestedPlaces, bool useAbs=false)
 
static string PrintDateNew (double time, bool includeTime)
 
static string PrintLatitude (double latitude, bool includeMinutes=true, bool includeSeconds=true)
 
static string PrintLocalizedModuleName (string moduleName)
 
static string PrintLongitude (double longitude, bool includeMinutes=true, bool includeSeconds=true)
 
static string PrintModuleName (string moduleName)
 returns a string with an auto-generated pretty name for a module, given its class name- More...
 
static string PrintSI (double amount, string unitName, int sigFigs=3, bool longPrefix=false)
 
static string PrintSpacedStringFromCamelcase (this string s)
 
static string PrintTime (double time, int valuesOfInterest, bool explicitPositive)
 
static string PrintTime (double time, int valuesOfInterest, bool explicitPositive, bool logEnglish)
 
static string PrintTimeCompact (double time, bool explicitPositive)
 
static string PrintTimeLong (double time)
 
static string PrintTimeStamp (double time, bool days=false, bool years=false)
 
static string PrintTimeStampCompact (double time, bool days=false, bool years=false)
 
static void RemoveNonHighlightableRenderers (this List< Renderer > rends)
 
static string ReplaceString (string src, params StringReplacement[] replacements)
 
static string SanitizeFilename (string originalFilename)
 Strips out nasty characters for mac/pc filename creation More...
 
static string SanitizeInstanceName (string originalString)
 Strips out the parenthesis and whatever is in them from an instance name More...
 
static string SanitizeString (string originalString, char replacementChar, bool replaceEmpty)
 Strips out nasty characters for mac/pc filename creation More...
 
static string StripFileExtension (FileInfo file)
 
static Matrix4x4 ToDiagonalMatrix (float v)
 Constructs diagonal matrix from a float (Identity * val) More...
 
static void ToDiagonalMatrix (float v, ref Matrix4x4 m)
 Constructs diagonal matrix from a float (Identity * val) More...
 
static Matrix4x4 ToDiagonalMatrix (Vector3 v)
 Constructs diagonal matrix from a 3-vector (simulating 3x3 matrix) More...
 
static void ToDiagonalMatrix2 (float v, ref Matrix4x4 m)
 Constructs diagonal matrix from a float (Identity * val) DOES NOT ZERO ANY THINGS WOT ARE ZERO More...
 
static Matrix4x4 ToDiagonalMatrix2 (Vector3 v, ref Matrix4x4 m)
 Constructs diagonal matrix from a 3-vector (simulating 3x3 matrix) DOES NOT ZERO ANY THINGS WOT ARE ZERO OR IDENTITY INNIT More...
 
static string WriteArray< T > (T[] array)
 
static string WriteQuaternion (Quaternion quaternion)
 Returns a comma-separated string for the given quaternion More...
 
static string WriteQuaternion (Quaternion quaternion, string separator)
 Returns a delimited string for the given quaternion More...
 
static string WriteQuaternion (QuaternionD quaternion)
 Returns a comma-separated string for the given quaternion More...
 
static string WriteQuaternion (QuaternionD quaternion, string separator)
 Returns a delimited string for the given quaternion More...
 
static string WriteVector (Vector2 vector)
 Returns a comma-separated string for the given vector More...
 
static string WriteVector (Vector2 vector, string separator)
 Returns a delimited string for the given vector More...
 
static string WriteVector (Vector3 vector)
 Returns a comma-separated string for the given vector More...
 
static string WriteVector (Vector3 vector, string separator)
 Returns a delimited string for the given vector More...
 
static string WriteVector (Vector3d vector)
 Returns a comma-separated string for the given vector More...
 
static string WriteVector (Vector3d vector, string separator)
 Returns a delimited string for the given vector More...
 
static string WriteVector (Vector4 vector)
 Returns a comma-separated string for the given vector More...
 
static string WriteVector (Vector4 vector, string separator)
 Returns a delimited string for the given vector More...
 

Static Public Attributes

static double[] digitsScale = { 1e0, 1e1, 1e2 }
 
static string[] longSIprefixes = { "yocto", "zepto", "atto", "femto", "pico", "nano", "micro", "milli", "", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta" }
 
static double[] prefixMults = { 1e-24, 1e-21, 1e-18, 1e-15, 1e-12, 1e-9, 1e-6, 1e-3, 1.0, 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24 }
 
static string[] shortSIprefixes = { "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" }
 
static int unitIndex = 8
 

Properties

static string ApplicationFileProtocol [get]
 Returns the correct file protocol for the platform More...
 
static string ApplicationRootPath [get]
 Returns a filepath string that points to the game's root folder (regardless of platform) More...
 
static IDateTimeFormatter dateTimeFormatter [get, set]
 

Member Function Documentation

static Matrix4x4 KSPUtil.Add ( Matrix4x4  left,
Matrix4x4  right 
)
inlinestatic

Strips out nas

Add a 4x4 Matrix into another one (does not allocate)

static void KSPUtil.Add ( ref Matrix4x4  left,
Matrix4x4  right 
)
inlinestatic

Add a 4x4 Matrix into another one (does not allocate)

static void KSPUtil.Add ( ref Matrix4x4  left,
ref Matrix4x4  right 
)
inlinestatic

Add a 4x4 Matrix into another one (does not allocate)

static string KSPUtil.AppendValueToString ( string  s0,
string  val,
char  separator 
)
inlinestatic

Appends a new string to the given source string if source string does not already contain it. Does not modify input values.

Parameters
s0The source string
valThe new string to append
separatorA separator char to separate the appended section from the src string
Returns
The resulting string
static float KSPUtil.BearingDegrees ( Vector3  v1,
Vector3  v2,
Vector3  upAxis 
)
inlinestatic

Returns an angle from -180° to 180° between the two vectors, based on the up axis to tell left from right

Parameters
v1
v2
upAxis
Returns
static float KSPUtil.BearingRadians ( Vector3  v1,
Vector3  v2,
Vector3  upAxis 
)
inlinestatic

Returns an angle from -PI to PI between the two vectors, based on the up axis to tell left from right

Parameters
v1
v2
upAxis
Returns
static float KSPUtil.CalculateFolderSize ( string  folderPath,
out int  totalFiles 
)
inlinestatic

Calculates the size of data and number of files in a folder (and sub-folders)

Parameters
folderPaththe folder path
totalFilesWill contain the number of files in the folder and it's sub-folders
Returns
The size of the data in the folder in bytes.
static bool KSPUtil.CheckDOSName ( string  originalString)
inlinestatic

Checks if the string is a reserved DOS name

Parameters
originalString
Returns
static VersionCompareResult KSPUtil.CheckVersion ( string  versionString,
int  lastMajor,
int  lastMinor,
int  lastRev 
)
inlinestatic
static VersionCompareResult KSPUtil.CheckVersion ( int  version_major,
int  version_minor,
int  version_revision,
int  lastMajor,
int  lastMinor,
int  lastRev 
)
inlinestatic

< allow for backward compatibility up to the last backward-compatible version

static Rect KSPUtil.ClampRectToScreen ( Rect  r)
inlinestatic

Takes a Rect r and moves it inside the screen space

static bool KSPUtil.DeepCompare< T > ( this HashSet< T >  a,
HashSet< T >  b 
)
inlinestatic
static Vector3d KSPUtil.Diag ( Matrix4x4  m)
inlinestatic

Returns the diagonal 3-vector from the 4x4 matrix (simulating 3x3 matrix)

static List<T> KSPUtil.FindComponentsImplementing< T > ( GameObject  go,
bool  returnInactive 
)
inlinestatic
Type Constraints
T :class 
static Transform KSPUtil.FindInPartModel ( Transform  part,
string  childName 
)
inlinestatic
static void KSPUtil.FindTagsInChildren ( List< string >  tags,
Transform  trf 
)
inlinestatic

Find all tags contained in the sub-object hierarchy

Parameters
tagsA non-null list of strings to hold the tags
trfThe transform to start recursing from
static Transform KSPUtil.FindTransformAtIndexPath ( string  indexPath,
Transform  root 
)
inlinestatic
static string KSPUtil.GenerateFilePathWithDate ( string  filePath)
inlinestatic
static int KSPUtil.GenerateSuperSeed ( Guid  guid,
int  seed 
)
inlinestatic

Creates an excessively unique and unpredictable seed for an object GUID is super unique. Super Seed crushes up the GUID and salts it with the passed seed.

Parameters
guidGUID of object.
seedseed for salting the result.
Returns
A very unique seed.
static Texture2DArray KSPUtil.GenerateTexture2DArray ( List< Texture2D >  textureList,
TextureFormat  format,
bool  createMipMaps 
)
inlinestatic

Generates a Texture2DArray from a list of textures.

Parameters
textureListList of the textures to use to generate the Texture2DArray. All textures must have the same size!
formatTexture format of the textures. Use RGBA32 for default textures and RGB24 for normal maps.
createMipMapsWhether to create mip maps or not.
Returns
Returns Texture2DArray created from all of the different textures passed in.
static ObjectActivator<T> KSPUtil.GetActivator< T > ( ConstructorInfo  ctor)
inlinestatic
static bool KSPUtil.GetAttachNodeInfo ( string  configAttnID,
ref string  nodeID,
ref string  attnPartID,
ref Vector3  attnPos 
)
inlinestatic

Parses a string into attach node properties

Parameters
configAttnIDThe string for the attach node, has the following format: NodeID,AttachedPartName_AttachedPartID_X|Y|Z
nodeIDThe ID of the node
attnPartIDThe id of the part
attnPosThe new attach node position
Returns
Returns true if the attach node position changed
static bool KSPUtil.GetAttachNodeInfo ( string  configAttnID,
ref string  nodeID,
ref string  attnPartID,
ref Vector3  attnPos,
ref string  attachMeshName 
)
inlinestatic

Parses a string into attach node properties

Parameters
configAttnIDThe string for the attach node, has the following format: NodeID,AttachedPartName_AttachedPartID_X|Y|Z
nodeIDThe ID of the node
attnPartIDThe id of the part
attnPosThe new attach node position
attachMeshNameThe mesh transform name for surface attachment node
Returns
Returns true if the attach node position changed
static bool KSPUtil.GetAttachNodeInfo ( string  configAttnID,
ref string  nodeID,
ref string  attnPartID,
ref Vector3  attnPos,
ref string  attachMeshName,
ref Vector3  attnRot,
ref Vector3  secAxis 
)
inlinestatic

Parses a string into attach node properties

Parameters
configAttnIDThe string for the attach node, has the following format: NodeID,AttachedPartName_AttachedPartID_X|Y|Z
nodeIDThe ID of the node
attnPartIDThe id of the part
attnPosThe new attach node position
attachMeshNameThe mesh transform name for surface attachment node
attnRotThe new attach node rotation
secAxisThe new attach nod secondary position
Returns
Returns true if the attach node position changed
static bool KSPUtil.GetAttachNodeInfo ( string  configAttnID,
ref string  nodeID,
ref string  attnPartID,
ref Vector3  attnPos,
ref Vector3  attnRot,
ref Vector3  attnActualPos,
ref Vector3  attnActualRot 
)
inlinestatic

Parses a string into attach node properties

Parameters
configAttnIDThe string for the attach node, has the following format: NodeID,AttachedPartName_AttachedPartID_X|Y|Z
nodeIDThe ID of the node
attnPartIDThe id of the part
attnPosThe new attach node original position
attnRotThe new attach node original rotation
attnActualPosThe new attach node actual position
attnActualRotThe new attach node actual rotation
Returns
Returns true if the attach node position changed
static string KSPUtil.GetLinkID ( string  configAttnID)
inlinestatic
static string KSPUtil.GetOrCreatePath ( string  relPath)
inlinestatic

Returns a filepath that points to the given folders inside the game's root folder (will create it if one isn't found)

Parameters
relPaththe path, relative to the game's .exe location
Returns
the full filepath
static Part KSPUtil.GetPartByCraftID ( this List< Part parts,
uint  id 
)
inlinestatic
static void KSPUtil.GetPartInfo ( string  configPartID,
ref string  partName,
ref string  craftID 
)
inlinestatic
static string KSPUtil.GetPartName ( string  configPartID)
inlinestatic
static string KSPUtil.GetRelativePath ( string  fullPath,
string  basePath 
)
inlinestatic

Returns a relative path string from a full path based on a base path provided.

Parameters
fullPathThe path to convert. Can be either a file or a directory
basePathThe base path on which relative processing is based. Should be a directory.
Returns
String of the relative path.
static string KSPUtil.GetTransformIndexPathToRoot ( Transform  t,
Transform  root 
)
inlinestatic

< the first parent

< go through each parent up the tree until we reach the specified root

static string KSPUtil.GetTransformPathToRoot ( Transform  t,
Transform  root 
)
inlinestatic

< the first parent

< go through each parent up the tree until we reach the specified root

static bool KSPUtil.HasAncestorTransform ( Transform  src,
Transform  ancestor 
)
inlinestatic

Returns true if the src transform is a hierarchical descendant of the ancestor transform

static bool KSPUtil.HasDescendantTransform ( Transform  src,
Transform  child 
)
inlinestatic

Returns true if the src transform has the child transform as a descendant on its hierarchy

static float KSPUtil.HeadingDegrees ( Vector3  v1,
Vector3  v2,
Vector3  upAxis 
)
inlinestatic

Returns an angle from 0 to 360° between the two vectors, based on the up axis to tell left from right

Parameters
v1
v2
upAxis
Returns
static float KSPUtil.HeadingRadians ( Vector3  v1,
Vector3  v2,
Vector3  upAxis 
)
inlinestatic

Returns an angle from 0 to 2PI between the two vectors, based on the up axis to tell left from right

Parameters
v1
v2
upAxis
Returns
static string KSPUtil.LocalizeNumber ( double  value,
string  format 
)
inlinestatic

Converts a number to a string localizing the numeric punctuation

Parameters
value
format
Returns
static string KSPUtil.LocalizeNumber ( float  value,
string  format 
)
inlinestatic

Converts a number to a string localizing the numeric punctuation

Parameters
value
format
Returns
static bool KSPUtil.MoveFile ( string  filePath,
string  destinationPath,
bool  overwrite = false 
)
inlinestatic
delegate T KSPUtil.ObjectActivator< T > ( params object[]  args)
static Matrix4x4 KSPUtil.OuterProduct ( Vector3  left,
Vector3  right 
)
inlinestatic

Construct the outer product of two 3-vectors as a 4x4 matrix

static void KSPUtil.OuterProduct ( Vector3  left,
Vector3  right,
ref Matrix4x4  m 
)
inlinestatic

Construct the outer product of two 3-vectors as a 4x4 matrix

static void KSPUtil.OuterProduct2 ( Vector3  left,
Vector3  right,
ref Matrix4x4  m 
)
inlinestatic

Construct the outer product of two 3-vectors as a 4x4 matrix DOES NOT ZERO ANY THINGS WOT ARE ZERO OR IDENTITY INNIT

static T [] KSPUtil.ParseArray< T > ( string  arrayString,
ParserMethod< T >  parser 
)
inlinestatic
static Quaternion KSPUtil.ParseQuaternion ( string  quaternionString)
inlinestatic
static Quaternion KSPUtil.ParseQuaternion ( string  quaternionString,
char  separator 
)
inlinestatic
static Quaternion KSPUtil.ParseQuaternion ( string  x,
string  y,
string  z,
string  w 
)
inlinestatic
static QuaternionD KSPUtil.ParseQuaternionD ( string  quaternionString)
inlinestatic

Parses a QuaternionD from a comma-separated string of XYZW values

static QuaternionD KSPUtil.ParseQuaternionD ( string  x,
string  y,
string  z,
string  w 
)
inlinestatic
static QuaternionD KSPUtil.ParseQuaternionD ( string  quaternionString,
char  separator 
)
inlinestatic

Parses a QuaternionD from a comma-separated string of XYZW values

static Vector2 KSPUtil.ParseVector2 ( string  vectorString)
inlinestatic

Parses a Vector2 from a comma-separated string of XYZ values

static Vector2 KSPUtil.ParseVector2 ( string  vectorString,
char  separator 
)
inlinestatic

Parses a Vector2 from a delimited string of XYZ values

static Vector2 KSPUtil.ParseVector2 ( string  x,
string  y 
)
inlinestatic
static Vector3 KSPUtil.ParseVector3 ( string  vectorString)
inlinestatic

Parses a Vector3 from a comma-separated string of XYZ values

static Vector3 KSPUtil.ParseVector3 ( string  vectorString,
char  separator 
)
inlinestatic

Parses a Vector3 from a delimited string of XYZ values

static Vector3 KSPUtil.ParseVector3 ( string  x,
string  y,
string  z 
)
inlinestatic
static Vector3d KSPUtil.ParseVector3d ( string  vectorString)
inlinestatic

Parses a Vector3 from a comma-separated string of XYZ values

static Vector3d KSPUtil.ParseVector3d ( string  vectorString,
char  separator 
)
inlinestatic

Parses a Vector3 from a delimited string of XYZ values

static Vector3d KSPUtil.ParseVector3d ( string  x,
string  y,
string  z 
)
inlinestatic
static Vector4 KSPUtil.ParseVector4 ( string  vectorString)
inlinestatic

Parses a Vector4 from a comma-separated string of XYZ values

static Vector4 KSPUtil.ParseVector4 ( string  x,
string  y,
string  z,
string  w 
)
inlinestatic
static Vector4 KSPUtil.ParseVector4 ( string  vectorString,
char  separator 
)
inlinestatic

Parses a Vector4 from a delimited string of XYZ values

static string KSPUtil.PrintCollection< T > ( IEnumerable< T >  collection,
string  separator = ", " 
)
inlinestatic

Produces a string combining the string values (given by .ToString()) of all the elements in a collection

static string KSPUtil.PrintCollection< T > ( IEnumerable< T >  collection,
string  separator,
Func< T, string >  stringAccessor 
)
inlinestatic

Produces a string combining the string values (given by stringAccessor) of all the elements in a collection

static string KSPUtil.PrintCoordinates ( double  latitude,
double  longitude,
bool  singleLine,
bool  includeMinutes = true,
bool  includeSeconds = true 
)
inlinestatic
static string KSPUtil.PrintDate ( double  time,
bool  includeTime,
bool  includeSeconds = false 
)
inlinestatic
static string KSPUtil.PrintDateCompact ( double  time,
bool  includeTime,
bool  includeSeconds = false 
)
inlinestatic
static string KSPUtil.PrintDateDelta ( double  time,
bool  includeTime,
bool  includeSeconds = false,
bool  useAbs = false 
)
inlinestatic
static string KSPUtil.PrintDateDeltaCompact ( double  time,
bool  includeTime,
bool  includeSeconds,
bool  useAbs = false 
)
inlinestatic
static string KSPUtil.PrintDateDeltaCompact ( double  time,
bool  includeTime,
bool  includeSeconds,
int  interestedPlaces,
bool  useAbs = false 
)
inlinestatic
static string KSPUtil.PrintDateNew ( double  time,
bool  includeTime 
)
inlinestatic
static string KSPUtil.PrintLatitude ( double  latitude,
bool  includeMinutes = true,
bool  includeSeconds = true 
)
inlinestatic
static string KSPUtil.PrintLocalizedModuleName ( string  moduleName)
inlinestatic
static string KSPUtil.PrintLongitude ( double  longitude,
bool  includeMinutes = true,
bool  includeSeconds = true 
)
inlinestatic
static string KSPUtil.PrintModuleName ( string  moduleName)
inlinestatic

returns a string with an auto-generated pretty name for a module, given its class name-

Returns
static string KSPUtil.PrintSI ( double  amount,
string  unitName,
int  sigFigs = 3,
bool  longPrefix = false 
)
inlinestatic
static string KSPUtil.PrintSpacedStringFromCamelcase ( this string  s)
inlinestatic
static string KSPUtil.PrintTime ( double  time,
int  valuesOfInterest,
bool  explicitPositive 
)
inlinestatic
static string KSPUtil.PrintTime ( double  time,
int  valuesOfInterest,
bool  explicitPositive,
bool  logEnglish 
)
inlinestatic
static string KSPUtil.PrintTimeCompact ( double  time,
bool  explicitPositive 
)
inlinestatic
static string KSPUtil.PrintTimeLong ( double  time)
inlinestatic
static string KSPUtil.PrintTimeStamp ( double  time,
bool  days = false,
bool  years = false 
)
inlinestatic
static string KSPUtil.PrintTimeStampCompact ( double  time,
bool  days = false,
bool  years = false 
)
inlinestatic
static void KSPUtil.RemoveNonHighlightableRenderers ( this List< Renderer >  rends)
inlinestatic
static string KSPUtil.ReplaceString ( string  src,
params StringReplacement[]  replacements 
)
inlinestatic
static string KSPUtil.SanitizeFilename ( string  originalFilename)
inlinestatic

Strips out nasty characters for mac/pc filename creation

Parameters
originalFilename
Returns
static string KSPUtil.SanitizeInstanceName ( string  originalString)
inlinestatic

Strips out the parenthesis and whatever is in them from an instance name

Parameters
originalThe original instance name
replacementCharThe character to use to replace nasty ones
Returns
static string KSPUtil.SanitizeString ( string  originalString,
char  replacementChar,
bool  replaceEmpty 
)
inlinestatic

Strips out nasty characters for mac/pc filename creation

Parameters
originalThe original string
replacementCharThe character to use to replace nasty ones
Returns
static string KSPUtil.StripFileExtension ( FileInfo  file)
inlinestatic
static Matrix4x4 KSPUtil.ToDiagonalMatrix ( float  v)
inlinestatic

Constructs diagonal matrix from a float (Identity * val)

static void KSPUtil.ToDiagonalMatrix ( float  v,
ref Matrix4x4  m 
)
inlinestatic

Constructs diagonal matrix from a float (Identity * val)

static Matrix4x4 KSPUtil.ToDiagonalMatrix ( Vector3  v)
inlinestatic

Constructs diagonal matrix from a 3-vector (simulating 3x3 matrix)

static void KSPUtil.ToDiagonalMatrix2 ( float  v,
ref Matrix4x4  m 
)
inlinestatic

Constructs diagonal matrix from a float (Identity * val) DOES NOT ZERO ANY THINGS WOT ARE ZERO

static Matrix4x4 KSPUtil.ToDiagonalMatrix2 ( Vector3  v,
ref Matrix4x4  m 
)
inlinestatic

Constructs diagonal matrix from a 3-vector (simulating 3x3 matrix) DOES NOT ZERO ANY THINGS WOT ARE ZERO OR IDENTITY INNIT

static string KSPUtil.WriteArray< T > ( T[]  array)
inlinestatic
Type Constraints
T :IConvertible 
static string KSPUtil.WriteQuaternion ( Quaternion  quaternion)
inlinestatic

Returns a comma-separated string for the given quaternion

static string KSPUtil.WriteQuaternion ( Quaternion  quaternion,
string  separator 
)
inlinestatic

Returns a delimited string for the given quaternion

static string KSPUtil.WriteQuaternion ( QuaternionD  quaternion)
inlinestatic

Returns a comma-separated string for the given quaternion

static string KSPUtil.WriteQuaternion ( QuaternionD  quaternion,
string  separator 
)
inlinestatic

Returns a delimited string for the given quaternion

static string KSPUtil.WriteVector ( Vector2  vector)
inlinestatic

Returns a comma-separated string for the given vector

static string KSPUtil.WriteVector ( Vector2  vector,
string  separator 
)
inlinestatic

Returns a delimited string for the given vector

static string KSPUtil.WriteVector ( Vector3  vector)
inlinestatic

Returns a comma-separated string for the given vector

static string KSPUtil.WriteVector ( Vector3  vector,
string  separator 
)
inlinestatic

Returns a delimited string for the given vector

static string KSPUtil.WriteVector ( Vector3d  vector)
inlinestatic

Returns a comma-separated string for the given vector

static string KSPUtil.WriteVector ( Vector3d  vector,
string  separator 
)
inlinestatic

Returns a delimited string for the given vector

static string KSPUtil.WriteVector ( Vector4  vector)
inlinestatic

Returns a comma-separated string for the given vector

static string KSPUtil.WriteVector ( Vector4  vector,
string  separator 
)
inlinestatic

Returns a delimited string for the given vector

Member Data Documentation

double [] KSPUtil.digitsScale = { 1e0, 1e1, 1e2 }
static
string [] KSPUtil.longSIprefixes = { "yocto", "zepto", "atto", "femto", "pico", "nano", "micro", "milli", "", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta" }
static
double [] KSPUtil.prefixMults = { 1e-24, 1e-21, 1e-18, 1e-15, 1e-12, 1e-9, 1e-6, 1e-3, 1.0, 1e3, 1e6, 1e9, 1e12, 1e15, 1e18, 1e21, 1e24 }
static
string [] KSPUtil.shortSIprefixes = { "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" }
static
int KSPUtil.unitIndex = 8
static

Property Documentation

string KSPUtil.ApplicationFileProtocol
staticget

Returns the correct file protocol for the platform

string KSPUtil.ApplicationRootPath
staticget

Returns a filepath string that points to the game's root folder (regardless of platform)

IDateTimeFormatter KSPUtil.dateTimeFormatter
staticgetset

The documentation for this class was generated from the following file: