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

            if (plistFormat != null)
            {
                return(plistFormat.GetImageFilePath(plistFilePath));
            }
            return(string.Empty);
        }
Exemple #2
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("对应的图片文件不存在.");
            }
        }