Esempio n. 1
0
        public static string GetMatchImageFile(string plistFilePath)
        {
            PlistImageFormat plistFormat = PlistImageFormatFactory.CreatePlistFormat(plistFilePath);

            if (plistFormat != null)
            {
                return(plistFormat.GetImageFilePath(plistFilePath));
            }
            return(string.Empty);
        }
 List <string> ICompositeResourceProcesser.GetMatchedImages(string filePath)
 {
     if (PlistImageFormatFactory.CreatePlistFormat(filePath) == null)
     {
         return((List <string>)null);
     }
     return(new List <string>()
     {
         PlistImageFormatFactory.CreatePlistFormat(filePath).GetImageFilePath(filePath)
     });
 }
 protected override bool OnCanReadFile(FilePath file, Type expectedObjectType)
 {
     try
     {
         if (!FileFormat.CheckFileSuffix(file, ".plist") || !expectedObjectType.Equals(typeof(ResourceItem)))
         {
             return(false);
         }
         return(PlistImageFormatFactory.CreatePlistFormat((string)file) != null);
     }
     catch
     {
     }
     return(false);
 }
Esempio n. 4
0
        public PListImageReader(string plistFilePath)
        {
            PListImageReader.CheckFile(plistFilePath);
            PListRoot listRoot = (PListRoot)null;

            using (FileStream fileStream = File.Open(plistFilePath, FileMode.Open, FileAccess.Read))
                listRoot = PListRoot.Load((Stream)fileStream);
            if (listRoot == null || listRoot.Root == null || !(listRoot.Root is PListDict))
            {
                throw new ArgumentException("给定的PList文件格式不正确.");
            }
            if (!PListImageReader.CheckPList(listRoot))
            {
                throw new ArgumentException("给定的PList文件,不是大图合并的文件.");
            }
            this.rootElement         = listRoot.Root as PListDict;
            this.plistFilePath       = plistFilePath;
            this.plistFormatAnalysis = PlistImageFormatFactory.CreatePlistFormat(this.rootElement);
            this.ImageFilePath       = this.plistFormatAnalysis.GetImageFilePath(plistFilePath);
            if (this.ImageFilePath == null || !File.Exists(this.ImageFilePath))
            {
                throw new ArgumentException("对应的图片文件不存在.");
            }
        }