public FileTag TagFile(FileTag tag, FileInfo file) { return TagFile(tag.TagName, file); }
public int UntagFile(FileTag tag, FileInfo file) { string path = ProfilingLayer.Instance.ConvertPhysicalToLogical(file.FullName, true); return TaggingLayer.Instance.UntagFile(path, tag.TagName); }
public bool SetTagBidirectional(FileTag tag) { return false; }
public CompareResult PreviewSync(FileTag tag) { return null; }
public bool StartManualSync(FileTag tagname) { //For Safety purpose , get the latest from tagging Layer return false; }
public bool MonitorTag(FileTag tag, bool mode) { //may need to return a list of error. List<string> pathList = new List<string>(); foreach (TaggedPath path in tag.PathList) { pathList.Add(path.Path); } List<string> convertedPath = ProfilingLayer.Instance.ConvertAndFilterToPhysical(pathList); if (mode) { foreach (string path in convertedPath) { MonitorLayer.Instance.MonitorPath(path); } } else { foreach (string path in convertedPath) { MonitorLayer.Instance.UnMonitorPath(path); } } return true; }
private bool CheckFileID(FileTag tag, string ID) { foreach (TaggedPath path in tag.PathList) { if (path.LogicalDriveId.Equals(ID)) { return true; } } return false; }
public bool DeleteTag(FileTag tag) { FileTag fileTag = TaggingLayer.Instance.RemoveFileTag(tag.TagName); if (fileTag != null) { return true; } return false; }
private FileTag RetrieveFileTag(string tagname, bool create, long lastupdated) { FileTag tag = GetFileTag(tagname); if (tag == null) { if (create) { tag = new FileTag(tagname, lastupdated); } } return tag; }
private void AddFileTag(FileTag tag) { if (!CheckFileTagExists(tag.TagName)) { _fileTagList.Add(tag); } }
private static XmlElement CreateFileTagElement(XmlDocument TaggingDataDocument, FileTag fileTag) { XmlElement fileTagElement = TaggingDataDocument.CreateElement("fileTag"); fileTagElement.SetAttribute("name", fileTag.TagName); fileTagElement.SetAttribute("created", fileTag.Created.ToString()); fileTagElement.SetAttribute("lastUpdated", fileTag.LastUpdated.ToString()); foreach (TaggedPath path in fileTag.PathList) { fileTagElement.AppendChild(CreatedTaggedFileElement(TaggingDataDocument, path)); } return fileTagElement; }
private static FileTag CreateFileTagFromXml(XmlElement tag) { string tagname = tag.GetAttribute("name"); long created = long.Parse(tag.GetAttribute("created")); long lastupdated = long.Parse(tag.GetAttribute("lastUpdated")); FileTag fileTag = new FileTag(tagname, created); fileTag.LastUpdated = lastupdated; XmlNodeList pathList = tag.ChildNodes; foreach (XmlElement path in pathList) { TaggedPath taggedPath = CreatePath(path); fileTag.PathList.Add(taggedPath); } return fileTag; }
/// <summary> /// Tag a folder with a tagname /// </summary> /// <param name="path">The path to be tagged.</param> /// <param name="tagname">The name of the Tag</param> /// <returns>The FileTag that contains the path, else raise PathAlreadyExistsException</returns> public FileTag TagFile(string path, string tagname) { long lastupdated = DateTime.Now.Ticks; Tag tag = FindTag(tagname); if (tag == null) { tag = new FileTag(tagname, lastupdated); } Debug.Assert(tag != null); if (tag is FolderTag) { throw new TagTypeConflictException(); } else { Debug.Assert(tag is FileTag); if (!tag.Contain(path)) { tag.AddPath(path, lastupdated); AddFileTag((FileTag)tag); UpdateTaggingProfileDate(lastupdated); return (FileTag)tag; } else { throw new PathAlreadyExistsException(); } } }
/// <summary> /// Create a File Tag of tagname /// </summary> /// <param name="tagname">The name of the Tag to be created</param> /// <param name="lastupdated">The last updated time of the Tag to be created</param> /// <returns>The created Tag, else raise TagAlreadyExistsException</returns> public FileTag CreateFileTag(string tagname) { if (!CheckFileTagExists(tagname)) { long created = DateTime.Now.Ticks; FileTag tag = new FileTag(tagname, created); _fileTagList.Add(tag); UpdateTaggingProfileDate(created); return tag; } else { throw new TagAlreadyExistsException(); } }
/// <summary> /// Preview the result of a foldertag synchronization /// </summary> /// <param name="tag">The Folder Tag to preview</param> /// <returns>The list of Compare Result</returns> public List<CompareResult> PreviewFileCompare(FileTag tag) { return null; }