Exemplo n.º 1
0
 public FileTag TagFile(FileTag tag, FileInfo file)
 {
     return TagFile(tag.TagName, file);
 }
Exemplo n.º 2
0
 public int UntagFile(FileTag tag, FileInfo file)
 {
     string path = ProfilingLayer.Instance.ConvertPhysicalToLogical(file.FullName, true);
     return TaggingLayer.Instance.UntagFile(path, tag.TagName);
 }
Exemplo n.º 3
0
 public bool SetTagBidirectional(FileTag tag)
 {
     return false;
 }
Exemplo n.º 4
0
 public CompareResult PreviewSync(FileTag tag)
 {
     return null;
 }
Exemplo n.º 5
0
 public bool StartManualSync(FileTag tagname)
 {
     //For Safety purpose , get the latest from tagging Layer
     return false;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 private bool CheckFileID(FileTag tag, string ID)
 {
     foreach (TaggedPath path in tag.PathList)
     {
         if (path.LogicalDriveId.Equals(ID))
         {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 8
0
 public bool DeleteTag(FileTag tag)
 {
     FileTag fileTag = TaggingLayer.Instance.RemoveFileTag(tag.TagName);
     if (fileTag != null)
     {
         return true;
     }
     return false;
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
 private void AddFileTag(FileTag tag)
 {
     if (!CheckFileTagExists(tag.TagName))
     {
         _fileTagList.Add(tag);
     }
 }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 /// <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();
         }
     }
 }
Exemplo n.º 14
0
 /// <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();
     }
 }
Exemplo n.º 15
0
 /// <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;
 }