bool CutName(string name, FileTableItemType type) { try { if (System.IO.Directory.Exists(name)) { if (!Helper.IsAbsolutePath(name)) { return(false); } } } #if DEBUG catch (Exception ex) { Helper.ExceptionMessage(ex); } #else catch {} #endif string root = GetRoot(type); if (root == null || root == "" || root == Helper.PATH_SEP) { return(false); } root = Helper.CompareableFileName(Helper.ToLongPathName(root)); if (!root.EndsWith(Helper.PATH_SEP)) { root += Helper.PATH_SEP; } string ename = Helper.CompareableFileName(name); name = name.Trim(); if (!ename.EndsWith(Helper.PATH_SEP)) { ename += Helper.PATH_SEP; name += Helper.PATH_SEP; } if (ename.StartsWith(root)) { this.path = name.Substring(root.Length);//ename.Replace(root, ""); if (!this.IsFile) { if (this.path.StartsWith(Helper.PATH_SEP)) { path = path.Substring(1); } } this.Type = type; return(true); } return(false); }
public FileTableItem(string relpath, FileTableItemType type, bool rec, bool fl, int ver, bool ign) { this.recursive = rec; this.file = fl; this.ver = ver; this.type = type; this.SetName(relpath); this.ignore = ign; }
public static string GetRoot(FileTableItemType type) { string ret = null; ret = type.GetRoot(); if (ret != null) { if (!ret.EndsWith(Helper.PATH_SEP)) { ret += Helper.PATH_SEP; } } if (ret == Helper.PATH_SEP) { ret = null; } return(ret); }
public FileTableItem(string path) { recursive = false; file = false; if (path.StartsWith(":")) { path = path.Substring(1, path.Length - 1); recursive = true; } else if (path.StartsWith("*")) { path = path.Substring(1, path.Length - 1); file = true; } this.path = path; this.relpath = path; this.ver = -1; this.type = FileTablePaths.Absolute; this.ignore = false; }
public static int GetEPVersion(FileTableItemType type) { return(type.GetEPVersion()); }