Esempio n. 1
0
        public ResourceItem ReadResourceItem(IProgressMonitor monitor, string itemFileName)
        {
            Type typeFromHandle           = typeof(ResourceItem);
            List <FileFormat> fileFormats = this.FormatManager.GetFileFormats(itemFileName, typeof(ResourceItem));
            IFileFormat       format;

            if (fileFormats != null && fileFormats.Count > 0)
            {
                format = fileFormats[0];
            }
            else
            {
                format = this.FormatManager.GetDefaultResourceFormat();
            }
            ResourceItem resourceItem = this.ReadFile(monitor, itemFileName, typeFromHandle, format) as ResourceItem;

            if (resourceItem == null)
            {
                throw new InvalidOperationException("Invalid file format: " + itemFileName);
            }
            return(resourceItem);
        }
Esempio n. 2
0
 public ResourceItem FindResourceItem(ResourceItem parentItem, string fullPath)
 {
     if (parentItem.FullPath.Equals(fullPath, StringComparison.OrdinalIgnoreCase))
     {
         return(parentItem);
     }
     if (parentItem is ResourceFolder)
     {
         ResourceFolder resourceFolder = parentItem as ResourceFolder;
         if (fullPath.StartsWith(resourceFolder.FullPath, StringComparison.OrdinalIgnoreCase))
         {
             foreach (ResourceItem parentItem1 in (Collection <ResourceItem>)resourceFolder.Items)
             {
                 ResourceItem resourceItem = this.FindResourceItem(parentItem1, fullPath);
                 if (resourceItem != null)
                 {
                     return(resourceItem);
                 }
             }
         }
     }
     return((ResourceItem)null);
 }
Esempio n. 3
0
 private ResourceData CreateResourceData(FilePath filePath, string projectFilePath)
 {
     if (projectFilePath != null)
     {
         return(new ResourceData(EnumResourceType.MarkedSubImage, (string)ResourceItem.GetRelativePath(filePath), (string)(FilePath)Path.ChangeExtension((string)ResourceItem.GetRelativePath((FilePath)projectFilePath), ".plist")));
     }
     return(base.CreateResourceData(filePath));
 }
Esempio n. 4
0
 public ChangedResourceCollection(ResourceData oldData, ResourceItem resourceFile)
 {
     this.Add(oldData, resourceFile as ResourceFile);
 }
Esempio n. 5
0
 protected virtual ResourceData CreateResourceData(FilePath filePath)
 {
     return(new ResourceData((string)ResourceItem.GetRelativePath(filePath)));
 }
 private static void Sender_Disposed(ResourceChangedSender obj, ResourceItem e)
 {
     obj.Disposed -= new Action <ResourceChangedSender, ResourceItem>(ResourceChangedFactory.Sender_Disposed);
     ResourceChangedFactory.senderCollection.Remove(e);
 }
 public ResourceChangedSender(ResourceItem resourceFile, bool isDeleted = false, ResourceData oldResourceData = null)
 {
     this.resourceFile    = resourceFile;
     this.oldResourceData = !(oldResourceData == (ResourceData)null) ? oldResourceData : resourceFile.GetResourceData();
     this.isDeleted       = isDeleted;
 }