public static Process Run(string exeName, string args) { Process p = new Process(); p.StartInfo.FileName = IO.InnerFilePath(exeName); p.StartInfo.Arguments = args; p.Start(); return(p); }
public static DirEntry[] EnumDir(string dirName) { List <DirEntry> list = new List <DirEntry>(); string tmp = IO.InnerFilePath(dirName); string[] dirs = Directory.GetDirectories(tmp); foreach (string name in dirs) { string fullPath = name; DirectoryInfo info = new DirectoryInfo(fullPath); DirEntry e = new DirEntry(); e.fileName = Path.GetFileName(name); e.fileSize = 0; e.createDate = info.CreationTimeUtc; e.folder = true; e.updateDate = info.LastWriteTimeUtc; e.fullPath = fullPath; e.relativePath = GetRelativeFileName(fullPath, dirName); list.Add(e); } string[] files = Directory.GetFiles(tmp); foreach (string name in files) { string fullPath = name; FileInfo info = new FileInfo(fullPath); DirEntry e = new DirEntry(); e.fileName = Path.GetFileName(name); e.fileSize = info.Length; e.createDate = info.CreationTimeUtc; e.folder = false; e.updateDate = info.LastWriteTimeUtc; e.fullPath = fullPath; e.relativePath = GetRelativeFileName(fullPath, dirName); list.Add(e); } list.Sort(); return(list.ToArray()); }
static void enumDirEx(string dirName, string baseDirName, List <DirEntry> list) { string tmp = IO.InnerFilePath(dirName); string[] dirs = Directory.GetDirectories(tmp); foreach (string name in dirs) { string fullPath = name; DirectoryInfo info = new DirectoryInfo(fullPath); DirEntry e = new DirEntry(); e.fileName = Path.GetFileName(name); e.fileSize = 0; e.createDate = info.CreationTimeUtc; e.folder = true; e.updateDate = info.LastWriteTimeUtc; e.fullPath = fullPath; e.relativePath = GetRelativeFileName(fullPath, baseDirName); list.Add(e); enumDirEx(fullPath, baseDirName, list); } string[] files = Directory.GetFiles(tmp); foreach (string name in files) { string fullPath = name; FileInfo info = new FileInfo(fullPath); DirEntry e = new DirEntry(); e.fileName = Path.GetFileName(name); e.fileSize = info.Length; e.createDate = info.CreationTimeUtc; e.folder = false; e.updateDate = info.LastWriteTimeUtc; e.fullPath = fullPath; e.relativePath = GetRelativeFileName(fullPath, baseDirName); list.Add(e); } }
void init(string filename) { filename = IO.InnerFilePath(filename); string filenameOnly = Path.GetFileName(filename); string filenameAlt = Path.Combine(Path.GetDirectoryName(filename), "_" + filenameOnly); try { IO.FileReplaceRename(filenameAlt, filename); } catch { } list = new Dictionary <string, HamCoreEntry>(); try { hamcore_io = IO.FileOpen(filename); } catch { return; } try { byte[] header = hamcore_io.Read(HamcoreHeaderSize); byte[] header2 = Str.AsciiEncoding.GetBytes(HamcoreHeaderData); if (header == null || Util.CompareByte(header, header2) == false) { throw new SystemException(); } uint num = 0; byte[] buf = hamcore_io.Read(Util.SizeOfInt32); num = Util.ByteToUInt(buf); uint i; for (i = 0; i < num; i++) { uint str_size; buf = hamcore_io.Read(Util.SizeOfInt32); str_size = Util.ByteToUInt(buf); if (str_size >= 1) { str_size--; } byte[] str_data = hamcore_io.Read((int)str_size); string tmp = Str.ShiftJisEncoding.GetString(str_data); HamCoreEntry c = new HamCoreEntry(); c.FileName = tmp; buf = hamcore_io.Read(Util.SizeOfInt32); c.Size = Util.ByteToUInt(buf); buf = hamcore_io.Read(Util.SizeOfInt32); c.SizeCompressed = Util.ByteToUInt(buf); buf = hamcore_io.Read(Util.SizeOfInt32); c.Offset = Util.ByteToUInt(buf); list.Add(c.FileName.ToUpper(), c); } } catch { hamcore_io.Close(); } }