Esempio n. 1
0
        /// <summary>
        /// Save the specified tag's data over the head revision of the specified tag file.
        /// </summary>
        private void SaveTagToHeadRevision(Tag tag, TagFile tagFile)
        {
            tagFile.SetHeadBinary(tag.Save());
            ILibrary targetLibrary = GetLibrary(tag.TagPath);

            targetLibrary.AddFile(tag.TagPath.Path + "." + tag.TagPath.Extension, tagFile.ToBytes());
        }
Esempio n. 2
0
 public void Decompile(ILibrary library)
 {
     for (int i = 0; i < index.TagCount - 1; i++)
     {
         string qualifiedName = dictionary[tags[i].Identifier];
         if (!library.FileExists(qualifiedName))
         {
             library.AddFile(qualifiedName, GetTag(qualifiedName));
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Restores the specified file to the project.
        /// </summary>
        public bool RestoreFolder(RecycleBinEntry entry)
        {
            if (linkedLibrary.FolderExists(entry.OriginalPath))
            {
                if (OnBeforeOverwriteFolder())
                {
                    return(false); // Return if the operation was cancelled via that event.
                }
            }
            Archive folderArchive = new Archive(recycleFolder.RootPath + "\\" + entry.Filename, Archive.ArchiveMode.Open);
            string[] files        = folderArchive.GetFileList("", "*", true);
            foreach (string file in files)
            {
                byte[] fileData = folderArchive.ReadFile(file);
                linkedLibrary.AddFile(file, fileData);
            }
            folderArchive.Close();

            recycleFolder.DeleteFile(entry.Filename);
            entryTable.Remove(entry);
            SaveEntryTable();
            OnStateChanged();
            return(true);
        }