private bool InternalIsControlledFile(string filePath) { FSConnection conn = (FSConnection)ifc.Conn; string driveAndArc = conn.Config.Drive + "\\" + conn.ArcName; bool succ = filePath.StartsWith(driveAndArc, StringComparison.OrdinalIgnoreCase); return(succ); }
private bool isFileInArchiveFolder(String winPath) { FSConnection fsConn = (FSConnection)Conn; String winPathStart = fsConn.Config.Drive + "\\" + FSFileHelper.EscapeFileName(fsConn.ArcName); String winPath2 = winPath; if (winPath2.Length > winPathStart.Length) { winPath2 = winPath2.Substring(0, winPathStart.Length); } return(String.Compare(winPathStart, winPath2, false) == 0); }
public T[] GetAll() { List <T> models = new List <T>(); string[] files = ModelConnectionHelpers.GetDirectoryFiles(dataDirectory); if (files == null) { return(models.ToArray()); } foreach (string file in files) { models.Add((T)FSConnection.Read(file)); } return(models.ToArray()); }
public T Create(T data) { T[] models = GetAll(); int maxID = 0; if (models != null) { foreach (T model in models) { if (maxID < model.ID) { maxID = model.ID; } } } data.ID = maxID + 1; string fullPath = $"{dataDirectory}//{data.ID}.bin"; return((T)FSConnection.Create(fullPath, data)); }
/// <summary> /// Makes a file system path in ELOFS for the given Sord object. /// </summary> /// <param name="sord">Sord object with valid sord.refPaths</param> /// <returns>File system path</returns> public String GetFileSystemPath(Sord sord, DocVersion dv) { FSConnection fsConn = (FSConnection)Conn; String winPath = fsConn.Config.Drive + "\\" + FSFileHelper.EscapeFileName(fsConn.ArcName); IdName[] arcPathObjs = sord.refPaths[0].path; for (int i = 0; i < arcPathObjs.Length; i++) { winPath += "\\" + FSFileHelper.EscapeFileName(arcPathObjs[i].name); } winPath += "\\" + FSFileHelper.EscapeFileName(sord.name); if (dv != null) { winPath += "."; winPath += dv.ext; } return(winPath); }
/// <summary> /// Return a FWDocument for the given file. /// </summary> /// <param name="file">Controlled file</param> /// <returns>FWDocument object</returns> public override FWDocument GetFWDocumentFromFile(string file) { FWDocument doc = null; try { if (IsControlledFile(file)) { FSConnection conn = (FSConnection)ifc.Conn; string driveAndArc = conn.Config.Drive + "\\" + conn.ArcName; if (file.Length >= driveAndArc.Length) { string arcPath = file.Substring(driveAndArc.Length); string objId = "FSPATH:" + arcPath; try { doc = ifc.Conn.Content.GetDocument(objId); } catch (Exception e) { if (ifc.Conn.Ix.parseException(e.Message).exceptionType != IXExceptionC.NOT_FOUND) { throw e; } String dir = System.IO.Path.GetDirectoryName(file); if (dir.Length >= driveAndArc.Length) { string arcDir = dir.Substring(driveAndArc.Length); doc = ifc.Conn.Content.CreateDocument("FSPATH:" + arcDir, ""); } } } } } catch { } return(doc); }
public T Update(T data) { string fullPath = GetFullPath(data.ID); return((T)FSConnection.Update(fullPath, data)); }
public T Get(int id) { string fullPath = GetFullPath(id); return((T)FSConnection.Read(fullPath)); }
public T Delete(int id) { string fullPath = GetFullPath(id); return((T)FSConnection.Delete(fullPath)); }
public FSCheckoutFolder(FSContentInterface ifc) { this.ifc = ifc; conn = (FSConnection)ifc.Conn; checkoutDir = new DirectoryInfo(conn.Config.Drive + "\\-i-" + conn.ArcName + "\\Chk"); }