コード例 #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);
        }
コード例 #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);
 }
コード例 #3
0
ファイル: ImageFile.cs プロジェクト: yuluos/CocoStudio2.0.6
 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));
 }
コード例 #4
0
 public ChangedResourceCollection(ResourceData oldData, ResourceItem resourceFile)
 {
     this.Add(oldData, resourceFile as ResourceFile);
 }
コード例 #5
0
 protected virtual ResourceData CreateResourceData(FilePath filePath)
 {
     return(new ResourceData((string)ResourceItem.GetRelativePath(filePath)));
 }
コード例 #6
0
 private static void Sender_Disposed(ResourceChangedSender obj, ResourceItem e)
 {
     obj.Disposed -= new Action <ResourceChangedSender, ResourceItem>(ResourceChangedFactory.Sender_Disposed);
     ResourceChangedFactory.senderCollection.Remove(e);
 }
コード例 #7
0
 public ResourceChangedSender(ResourceItem resourceFile, bool isDeleted = false, ResourceData oldResourceData = null)
 {
     this.resourceFile    = resourceFile;
     this.oldResourceData = !(oldResourceData == (ResourceData)null) ? oldResourceData : resourceFile.GetResourceData();
     this.isDeleted       = isDeleted;
 }