Logo
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Yukar.Common.FileUtil Class Reference

Utility class for file operations More...

Classes

struct  AssetEntry
 

Public Types

enum  FileFuncFlags : uint {
  FO_MOVE = 0x1 , FO_COPY = 0x2 , FO_DELETE = 0x3 , FO_RENAME = 0x4 ,
  FO_MOVE = 0x1 , FO_COPY = 0x2 , FO_DELETE = 0x3 , FO_RENAME = 0x4
}
 
enum  FILEOP_FLAGS : ushort {
  FOF_MULTIDESTFILES = 0x1 , FOF_CONFIRMMOUSE = 0x2 , FOF_SILENT = 0x4 , FOF_RENAMEONCOLLISION = 0x8 ,
  FOF_NOCONFIRMATION = 0x10 , FOF_WANTMAPPINGHANDLE = 0x20 , FOF_ALLOWUNDO = 0x40 , FOF_FILESONLY = 0x80 ,
  FOF_SIMPLEPROGRESS = 0x100 , FOF_NOCONFIRMMKDIR = 0x200 , FOF_NOERRORUI = 0x400 , FOF_NOCOPYSECURITYATTRIBS = 0x800 ,
  FOF_NORECURSION = 0x1000 , FOF_NO_CONNECTED_ELEMENTS = 0x2000 , FOF_WANTNUKEWARNING = 0x4000 , FOF_NORECURSEREPARSE = 0x8000 ,
  FOF_MULTIDESTFILES = 0x1 , FOF_CONFIRMMOUSE = 0x2 , FOF_SILENT = 0x4 , FOF_RENAMEONCOLLISION = 0x8 ,
  FOF_NOCONFIRMATION = 0x10 , FOF_WANTMAPPINGHANDLE = 0x20 , FOF_ALLOWUNDO = 0x40 , FOF_FILESONLY = 0x80 ,
  FOF_SIMPLEPROGRESS = 0x100 , FOF_NOCONFIRMMKDIR = 0x200 , FOF_NOERRORUI = 0x400 , FOF_NOCOPYSECURITYATTRIBS = 0x800 ,
  FOF_NORECURSION = 0x1000 , FOF_NO_CONNECTED_ELEMENTS = 0x2000 , FOF_WANTNUKEWARNING = 0x4000 , FOF_NORECURSEREPARSE = 0x8000
}
 
enum  FileFuncFlags : uint {
  FO_MOVE = 0x1 , FO_COPY = 0x2 , FO_DELETE = 0x3 , FO_RENAME = 0x4 ,
  FO_MOVE = 0x1 , FO_COPY = 0x2 , FO_DELETE = 0x3 , FO_RENAME = 0x4
}
 File operation type More...
 
enum  FILEOP_FLAGS : ushort {
  FOF_MULTIDESTFILES = 0x1 , FOF_CONFIRMMOUSE = 0x2 , FOF_SILENT = 0x4 , FOF_RENAMEONCOLLISION = 0x8 ,
  FOF_NOCONFIRMATION = 0x10 , FOF_WANTMAPPINGHANDLE = 0x20 , FOF_ALLOWUNDO = 0x40 , FOF_FILESONLY = 0x80 ,
  FOF_SIMPLEPROGRESS = 0x100 , FOF_NOCONFIRMMKDIR = 0x200 , FOF_NOERRORUI = 0x400 , FOF_NOCOPYSECURITYATTRIBS = 0x800 ,
  FOF_NORECURSION = 0x1000 , FOF_NO_CONNECTED_ELEMENTS = 0x2000 , FOF_WANTNUKEWARNING = 0x4000 , FOF_NORECURSEREPARSE = 0x8000 ,
  FOF_MULTIDESTFILES = 0x1 , FOF_CONFIRMMOUSE = 0x2 , FOF_SILENT = 0x4 , FOF_RENAMEONCOLLISION = 0x8 ,
  FOF_NOCONFIRMATION = 0x10 , FOF_WANTMAPPINGHANDLE = 0x20 , FOF_ALLOWUNDO = 0x40 , FOF_FILESONLY = 0x80 ,
  FOF_SIMPLEPROGRESS = 0x100 , FOF_NOCONFIRMMKDIR = 0x200 , FOF_NOERRORUI = 0x400 , FOF_NOCOPYSECURITYATTRIBS = 0x800 ,
  FOF_NORECURSION = 0x1000 , FOF_NO_CONNECTED_ELEMENTS = 0x2000 , FOF_WANTNUKEWARNING = 0x4000 , FOF_NORECURSEREPARSE = 0x8000
}
 File operation flag More...
 

Public Member Functions

string getFileName (string path)
 
string getFileNameWithoutExtension (string path)
 
virtual bool exists (string path)
 
virtual StreamReader getStreamReader (string path, Encoding encoding=null)
 
virtual string[] getDirectories (string path)
 
virtual string[] getDirectories (string path, string pattern, SearchOption searchOption)
 
virtual bool dirExists (string path)
 
virtual string getDirName (string path)
 
virtual string[] getFiles (string path)
 
virtual string[] getFiles (string path, string pattern, SearchOption searchOption=SearchOption.TopDirectoryOnly)
 
virtual Stream getFileStream (string path)
 
string getFileName (string path)
 
string getFileNameWithoutExtension (string path)
 
virtual bool exists (string path)
 
virtual StreamReader getStreamReader (string path, Encoding encoding=null)
 
virtual string[] getDirectories (string path)
 
virtual string[] getDirectories (string path, string pattern, SearchOption searchOption)
 
virtual bool dirExists (string path)
 
virtual string getDirName (string path)
 
virtual string[] getFiles (string path)
 
virtual string[] getFiles (string path, string pattern, SearchOption searchOption=SearchOption.TopDirectoryOnly)
 
virtual Stream getFileStream (string path)
 

Static Public Member Functions

static void copyFile (IntPtr handle, List< string > srcList, List< string > destList)
 
static void copyFile (IntPtr handle, string src, string dest)
 
static void initialize ()
 
static string GetFullPath (string path)
 
static void copyFile (IntPtr handle, List< string > srcList, List< string > destList)
 
static void copyFile (IntPtr handle, string src, string dest)
 
static void deleteFile (IntPtr handle, List< string > deleteList, bool isConfirm)
 
static void initialize ()
 
static bool IsDefaultCheckFile (string path)
 
static MemoryStream getMemoryStream (string path)
 
static string GetFullPath (string path, bool inReturnCurrentFolderOnError=true)
 get full path of path More...
 
static bool Exists (string inPath)
 File existence confirmation (engine playback supported) More...
 
static string CreateNewFilePath (string inFolderName, string inFileName)
 Create new file name More...
 
static string CreateTempDir ()
 Create temporary folder More...
 
static string getValidFileName (string name)
 Convert the specified string to a valid string as a file name More...
 

Public Attributes

bool skipUnexistedFiles
 

Detailed Description

Utility class for file operations

Member Enumeration Documentation

◆ FileFuncFlags [1/2]

Enumerator
FO_MOVE 
FO_COPY 
FO_DELETE 
FO_RENAME 
FO_MOVE 
FO_COPY 
FO_DELETE 
FO_RENAME 

◆ FileFuncFlags [2/2]

File operation type

Enumerator
FO_MOVE 
FO_COPY 
FO_DELETE 
FO_RENAME 
FO_MOVE 
FO_COPY 
FO_DELETE 
FO_RENAME 

◆ FILEOP_FLAGS [1/2]

Enumerator
FOF_MULTIDESTFILES 
FOF_CONFIRMMOUSE 
FOF_SILENT 

Don't create progress/report

FOF_RENAMEONCOLLISION 
FOF_NOCONFIRMATION 

Don't prompt the user.

FOF_WANTMAPPINGHANDLE 

Fill in SHFILEOPSTRUCT.hNameMappings. Must be freed using SHFreeNameMappings

FOF_ALLOWUNDO 
FOF_FILESONLY 

On *.*, do only files

FOF_SIMPLEPROGRESS 

Don't show names of files

FOF_NOCONFIRMMKDIR 

Don't confirm making any needed dirs

FOF_NOERRORUI 

Don't put up error UI

FOF_NOCOPYSECURITYATTRIBS 

Dont copy NT file Security Attributes

FOF_NORECURSION 

Don't recurse into directories.

FOF_NO_CONNECTED_ELEMENTS 

Don't operate on connected elements.

FOF_WANTNUKEWARNING 

During delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)

FOF_NORECURSEREPARSE 

Treat reparse points as objects, not containers

FOF_MULTIDESTFILES 
FOF_CONFIRMMOUSE 
FOF_SILENT 

Don't create progress/report

FOF_RENAMEONCOLLISION 
FOF_NOCONFIRMATION 

Don't prompt the user.

FOF_WANTMAPPINGHANDLE 

Fill in SHFILEOPSTRUCT.hNameMappings. Must be freed using SHFreeNameMappings

FOF_ALLOWUNDO 
FOF_FILESONLY 

On *.*, do only files

FOF_SIMPLEPROGRESS 

Don't show names of files

FOF_NOCONFIRMMKDIR 

Don't confirm making any needed dirs

FOF_NOERRORUI 

Don't put up error UI

FOF_NOCOPYSECURITYATTRIBS 

Dont copy NT file Security Attributes

FOF_NORECURSION 

Don't recurse into directories.

FOF_NO_CONNECTED_ELEMENTS 

Don't operate on connected elements.

FOF_WANTNUKEWARNING 

During delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)

FOF_NORECURSEREPARSE 

Treat reparse points as objects, not containers

◆ FILEOP_FLAGS [2/2]

File operation flag

Enumerator
FOF_MULTIDESTFILES 
FOF_CONFIRMMOUSE 
FOF_SILENT 

Don't create progress/report

FOF_RENAMEONCOLLISION 
FOF_NOCONFIRMATION 

Don't prompt the user.

FOF_WANTMAPPINGHANDLE 

Fill in SHFILEOPSTRUCT.hNameMappings. Must be freed using SHFreeNameMappings

FOF_ALLOWUNDO 
FOF_FILESONLY 

On *.*, do only files

FOF_SIMPLEPROGRESS 

Don't show names of files

FOF_NOCONFIRMMKDIR 

Don't confirm making any needed dirs

FOF_NOERRORUI 

Don't put up error UI

FOF_NOCOPYSECURITYATTRIBS 

Dont copy NT file Security Attributes

FOF_NORECURSION 

Don't recurse into directories.

FOF_NO_CONNECTED_ELEMENTS 

Don't operate on connected elements.

FOF_WANTNUKEWARNING 

During delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)

FOF_NORECURSEREPARSE 

Treat reparse points as objects, not containers

FOF_MULTIDESTFILES 
FOF_CONFIRMMOUSE 
FOF_SILENT 

Don't create progress/report

FOF_RENAMEONCOLLISION 
FOF_NOCONFIRMATION 

Don't prompt the user.

FOF_WANTMAPPINGHANDLE 

Fill in SHFILEOPSTRUCT.hNameMappings. Must be freed using SHFreeNameMappings

FOF_ALLOWUNDO 
FOF_FILESONLY 

On *.*, do only files

FOF_SIMPLEPROGRESS 

Don't show names of files

FOF_NOCONFIRMMKDIR 

Don't confirm making any needed dirs

FOF_NOERRORUI 

Don't put up error UI

FOF_NOCOPYSECURITYATTRIBS 

Dont copy NT file Security Attributes

FOF_NORECURSION 

Don't recurse into directories.

FOF_NO_CONNECTED_ELEMENTS 

Don't operate on connected elements.

FOF_WANTNUKEWARNING 

During delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)

FOF_NORECURSEREPARSE 

Treat reparse points as objects, not containers

Member Function Documentation

◆ copyFile() [1/4]

static void Yukar.Common.FileUtil.copyFile ( IntPtr  handle,
List< string >  srcList,
List< string >  destList 
)
static

◆ copyFile() [2/4]

static void Yukar.Common.FileUtil.copyFile ( IntPtr  handle,
List< string >  srcList,
List< string >  destList 
)
static

◆ copyFile() [3/4]

static void Yukar.Common.FileUtil.copyFile ( IntPtr  handle,
string  src,
string  dest 
)
static

◆ copyFile() [4/4]

static void Yukar.Common.FileUtil.copyFile ( IntPtr  handle,
string  src,
string  dest 
)
static

◆ CreateNewFilePath()

static string Yukar.Common.FileUtil.CreateNewFilePath ( string  inFolderName,
string  inFileName 
)
static

Create new file name

Parameters
inFolderNameFolder name
inFileNameoriginal file name
Returns
new file name

◆ CreateTempDir()

static string Yukar.Common.FileUtil.CreateTempDir ( )
static

Create temporary folder

Returns
Temporary folder path

◆ deleteFile()

static void Yukar.Common.FileUtil.deleteFile ( IntPtr  handle,
List< string >  deleteList,
bool  isConfirm 
)
static

◆ dirExists() [1/2]

virtual bool Yukar.Common.FileUtil.dirExists ( string  path)
virtual

◆ dirExists() [2/2]

virtual bool Yukar.Common.FileUtil.dirExists ( string  path)
virtual

◆ Exists()

static bool Yukar.Common.FileUtil.Exists ( string  inPath)
static

File existence confirmation (engine playback supported)

Parameters
inPathFile Path
Returns

◆ exists() [1/2]

virtual bool Yukar.Common.FileUtil.exists ( string  path)
virtual

◆ exists() [2/2]

virtual bool Yukar.Common.FileUtil.exists ( string  path)
virtual

◆ getDirectories() [1/4]

virtual string[] Yukar.Common.FileUtil.getDirectories ( string  path)
virtual

◆ getDirectories() [2/4]

virtual string[] Yukar.Common.FileUtil.getDirectories ( string  path)
virtual

◆ getDirectories() [3/4]

virtual string[] Yukar.Common.FileUtil.getDirectories ( string  path,
string  pattern,
SearchOption  searchOption 
)
virtual

◆ getDirectories() [4/4]

virtual string[] Yukar.Common.FileUtil.getDirectories ( string  path,
string  pattern,
SearchOption  searchOption 
)
virtual

◆ getDirName() [1/2]

virtual string Yukar.Common.FileUtil.getDirName ( string  path)
virtual

◆ getDirName() [2/2]

virtual string Yukar.Common.FileUtil.getDirName ( string  path)
virtual

◆ getFileName() [1/2]

string Yukar.Common.FileUtil.getFileName ( string  path)

◆ getFileName() [2/2]

string Yukar.Common.FileUtil.getFileName ( string  path)

◆ getFileNameWithoutExtension() [1/2]

string Yukar.Common.FileUtil.getFileNameWithoutExtension ( string  path)

◆ getFileNameWithoutExtension() [2/2]

string Yukar.Common.FileUtil.getFileNameWithoutExtension ( string  path)

◆ getFiles() [1/4]

virtual string[] Yukar.Common.FileUtil.getFiles ( string  path)
virtual

◆ getFiles() [2/4]

virtual string[] Yukar.Common.FileUtil.getFiles ( string  path)
virtual

◆ getFiles() [3/4]

virtual string[] Yukar.Common.FileUtil.getFiles ( string  path,
string  pattern,
SearchOption  searchOption = SearchOption.TopDirectoryOnly 
)
virtual

◆ getFiles() [4/4]

virtual string[] Yukar.Common.FileUtil.getFiles ( string  path,
string  pattern,
SearchOption  searchOption = SearchOption.TopDirectoryOnly 
)
virtual

◆ getFileStream() [1/2]

virtual Stream Yukar.Common.FileUtil.getFileStream ( string  path)
virtual

◆ getFileStream() [2/2]

virtual Stream Yukar.Common.FileUtil.getFileStream ( string  path)
virtual

◆ GetFullPath() [1/2]

static string Yukar.Common.FileUtil.GetFullPath ( string  path)
static

◆ GetFullPath() [2/2]

static string Yukar.Common.FileUtil.GetFullPath ( string  path,
bool  inReturnCurrentFolderOnError = true 
)
static

get full path of path

Parameters
pathpath
inReturnCurrentFolderOnErrorReturns the current folder when an error occurs (empty string if false is specified)
Returns

◆ getMemoryStream()

static MemoryStream Yukar.Common.FileUtil.getMemoryStream ( string  path)
static

◆ getStreamReader() [1/2]

virtual StreamReader Yukar.Common.FileUtil.getStreamReader ( string  path,
Encoding  encoding = null 
)
virtual

◆ getStreamReader() [2/2]

virtual StreamReader Yukar.Common.FileUtil.getStreamReader ( string  path,
Encoding  encoding = null 
)
virtual

◆ getValidFileName()

static string Yukar.Common.FileUtil.getValidFileName ( string  name)
static

Convert the specified string to a valid string as a file name

Parameters
name
Returns

◆ initialize() [1/2]

static void Yukar.Common.FileUtil.initialize ( )
static

◆ initialize() [2/2]

static void Yukar.Common.FileUtil.initialize ( )
static

◆ IsDefaultCheckFile()

static bool Yukar.Common.FileUtil.IsDefaultCheckFile ( string  path)
static

Member Data Documentation

◆ skipUnexistedFiles

bool Yukar.Common.FileUtil.skipUnexistedFiles