C# 클래스 kOS.Safe.Persistence.PersistenceUtilities

파일 보기 프로젝트 열기: KSP-KOS/KOS 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
GzipHeader byte[]

공개 메소드들

메소드 설명
CharNeedsEncoding ( char character ) : bool

Returns true if the character has to be encoded and cannot be dumped into a persistence file as-is.

CookedFilename ( string fileName, string extensionName, bool trusted = false ) : string

This is both for error checking and blessing of user-created filenames, and to tack on a filename extension if there is none present.


Returns a version of the filename in which it has had the file extension added unless the filename already has any sort of file extension, in which case nothing is changed about it. If every place where the auto- extension-appending is attempted is done via this method, then it will never end up adding an extension when an explicit one exists already.

DecodeBase64ToBinary ( string input ) : byte[]
DecodeLine ( string input ) : string
EncodeBase64 ( byte input ) : string
EncodeLine ( string input ) : string
IdentifyCategory ( byte firstBytes ) : FileCategory

Given the first few bytes of content, decide what the FileCategory should be, based on what's in the Content.
This should be called before deciding how to set the content.

IsBinary ( FileCategory category ) : bool

메소드 상세

CharNeedsEncoding() 공개 정적인 메소드

Returns true if the character has to be encoded and cannot be dumped into a persistence file as-is.
public static CharNeedsEncoding ( char character ) : bool
character char character to test
리턴 bool

CookedFilename() 공개 정적인 메소드

This is both for error checking and blessing of user-created filenames, and to tack on a filename extension if there is none present.


Returns a version of the filename in which it has had the file extension added unless the filename already has any sort of file extension, in which case nothing is changed about it. If every place where the auto- extension-appending is attempted is done via this method, then it will never end up adding an extension when an explicit one exists already.
public static CookedFilename ( string fileName, string extensionName, bool trusted = false ) : string
fileName string Filename to maybe change. Can be full path or just the filename.
extensionName string Extension to add if there is none already.
trusted bool True if the filename is internally generated (and therefore allowed to /// have paths in it). False if the filename is from a user-land string (and therefore allowing /// a name that walks the directory tree is a security hole.)
리턴 string

DecodeBase64ToBinary() 공개 정적인 메소드

public static DecodeBase64ToBinary ( string input ) : byte[]
input string
리턴 byte[]

DecodeLine() 공개 정적인 메소드

public static DecodeLine ( string input ) : string
input string
리턴 string

EncodeBase64() 공개 정적인 메소드

public static EncodeBase64 ( byte input ) : string
input byte
리턴 string

EncodeLine() 공개 정적인 메소드

public static EncodeLine ( string input ) : string
input string
리턴 string

IdentifyCategory() 공개 정적인 메소드

Given the first few bytes of content, decide what the FileCategory should be, based on what's in the Content.
This should be called before deciding how to set the content.
public static IdentifyCategory ( byte firstBytes ) : FileCategory
firstBytes byte At least the first four bytes of the file read in binary form - can be longer if you wish
리턴 FileCategory

IsBinary() 공개 정적인 메소드

public static IsBinary ( FileCategory category ) : bool
category FileCategory
리턴 bool

프로퍼티 상세

GzipHeader 공개적으로 정적으로 프로퍼티

public static byte[] GzipHeader
리턴 byte[]