예제 #1
0
        private IProjectItem GetUpdatedItem(IProjectItem item, FileInfo fileInfo, CreationOptions creationOptions)
        {
            IDocumentType documentType = this.GetDocumentType(item.DocumentReference.Path);

            if (item.DocumentType == documentType)
            {
                return(null);
            }
            if (item.DocumentType == base.Services.DocumentTypes()[DocumentTypeNamesHelper.Xml] && documentType == base.Services.DocumentTypes()[DocumentTypeNamesHelper.DeepZoom])
            {
                string[] directoryExtensions = DeepZoomHelper.GetDirectoryExtensions(item.DocumentReference.Path);
                for (int i = 0; i < (int)directoryExtensions.Length; i++)
                {
                    string str = directoryExtensions[i];
                    Microsoft.Expression.Framework.Documents.DocumentReference documentReference = DeepZoomHelper.CreateDeepZoomDirectoryReference(item.DocumentReference, str);
                    IProjectItem projectItem = base.FindItem(documentReference);
                    if (projectItem != null)
                    {
                        this.RemoveProjectItem(projectItem, false);
                    }
                }
            }
            this.RemoveProjectItem(item, false);
            DocumentCreationInfo documentCreationInfo = new DocumentCreationInfo()
            {
                TargetPath      = fileInfo.FullName,
                CreationOptions = creationOptions,
                DocumentType    = documentType
            };

            return(base.AddItem(documentCreationInfo));
        }
예제 #2
0
 private void EnsureDeepZoomProjectItems(IProjectItem deepZoomProjectItem)
 {
     string[] directoryExtensions = DeepZoomHelper.GetDirectoryExtensions(deepZoomProjectItem.DocumentReference.Path);
     if (directoryExtensions != null)
     {
         string[] strArrays = directoryExtensions;
         for (int i = 0; i < (int)strArrays.Length; i++)
         {
             string str = strArrays[i];
             Microsoft.Expression.Framework.Documents.DocumentReference documentReference = DeepZoomHelper.CreateDeepZoomDirectoryReference(deepZoomProjectItem.DocumentReference, str);
             IProjectItem projectItem = base.FindItem(documentReference);
             if (projectItem != null && !deepZoomProjectItem.Children.ToList <IProjectItem>().Contains(projectItem))
             {
                 this.RemoveProjectItem(projectItem, false);
                 projectItem = null;
             }
             if (projectItem == null && Microsoft.Expression.Framework.Documents.PathHelper.FileOrDirectoryExists(documentReference.Path))
             {
                 IProjectItem folderProjectItem = new FolderProjectItem(this, documentReference, base.Services.DocumentTypes()[DocumentTypeNamesHelper.Folder], base.Services, true, Microsoft.Expression.Project.FileTable.GetImageSource("Resources\\Folder_DeepZoom.png"));
                 if (this.AddProjectItem(folderProjectItem, ProjectItemEventOptions.None))
                 {
                     deepZoomProjectItem.AddChild(folderProjectItem);
                 }
             }
         }
     }
 }
예제 #3
0
 public override bool IsDocumentTypeOf(string fileName)
 {
     if (!base.IsDocumentTypeOf(fileName))
     {
         return(false);
     }
     return(DeepZoomHelper.IsDeepZoomDocument(fileName));
 }
예제 #4
0
 public static bool IsDeepZoomDocument(string fileName)
 {
     return(DeepZoomHelper.GetDirectoryExtensions(fileName) != null);
 }
예제 #5
0
 public static string[] GetDirectoryExtensions(string fileName)
 {
     string[] strArrays;
     if (!Microsoft.Expression.Framework.Documents.PathHelper.FileOrDirectoryExists(fileName))
     {
         return(null);
     }
     try
     {
         using (XmlReader xmlReader = XmlReader.Create(fileName))
         {
             if (xmlReader != null && xmlReader.Read() && xmlReader.IsStartElement())
             {
                 string[] strArrays1 = null;
                 if (string.Compare(xmlReader.Name, "Image", StringComparison.OrdinalIgnoreCase) == 0)
                 {
                     strArrays1 = new string[] { "_files" };
                 }
                 else if (string.Compare(xmlReader.Name, "Collection", StringComparison.OrdinalIgnoreCase) == 0)
                 {
                     strArrays1 = new string[] { "_files", "_images" };
                 }
                 if (strArrays1 != null)
                 {
                     Microsoft.Expression.Framework.Documents.PathHelper.GetDirectoryNameOrRoot(fileName);
                     Path.GetFileNameWithoutExtension(fileName);
                     string[] strArrays2 = strArrays1;
                     int      num        = 0;
                     while (num < (int)strArrays2.Length)
                     {
                         string str = strArrays2[num];
                         if (Microsoft.Expression.Framework.Documents.PathHelper.FileOrDirectoryExists(DeepZoomHelper.CreateDeepZoomDirectoryReference(DocumentReference.Create(fileName), str).Path))
                         {
                             num++;
                         }
                         else
                         {
                             strArrays = null;
                             return(strArrays);
                         }
                     }
                     strArrays = strArrays1;
                     return(strArrays);
                 }
             }
         }
         return(null);
     }
     catch (Exception exception)
     {
         return(null);
     }
     return(strArrays);
 }