Ejemplo n.º 1
0
        internal override bool IsNeedRefresh()
        {
            bool     flag           = false;
            DateTime lastWriteTime1 = File.GetLastWriteTime((string)this.plistFileInfo);

            if (!lastWriteTime1.Equals(this.lastPlistWriteTime))
            {
                this.lastPlistWriteTime = lastWriteTime1;
                flag = true;
            }
            if (flag || string.IsNullOrEmpty((string)this.imageFile))
            {
                this.imageFile = (FilePath)PListImageReader.GetMatchImageFile((string)this.plistFileInfo);
            }
            if (!string.IsNullOrEmpty((string)this.imageFile))
            {
                DateTime lastWriteTime2 = File.GetLastWriteTime((string)this.imageFile);
                if (!lastWriteTime2.Equals(this.lastImageWriteTime))
                {
                    this.lastImageWriteTime = lastWriteTime2;
                    flag = true;
                }
            }
            if (this.Items.Count == 0)
            {
                flag = true;
            }
            return(flag);
        }
Ejemplo n.º 2
0
 protected override void OnInitialize(IProgressMonitor monitor)
 {
     this.imageFile = (FilePath)PListImageReader.GetMatchImageFile((string)this.plistFileInfo);
     this.InitializeItems(false);
     if (Directory.Exists((string)this.BaseDirectory))
     {
         return;
     }
     this.ReloadSubResources();
 }
Ejemplo n.º 3
0
        private PListImageReader GetPlistImageReader(FilePath plistInfo)
        {
            PListImageReader plistImageReader = this.AnalyzePlist(plistInfo);

            if (plistImageReader != null)
            {
                return(plistImageReader);
            }
            if (Directory.Exists((string)this.BaseDirectory))
            {
                Directory.Delete((string)this.BaseDirectory, true);
            }
            return((PListImageReader)null);
        }
Ejemplo n.º 4
0
 private PListImageReader AnalyzePlist(FilePath fileInfo)
 {
     try
     {
         lock (this.lockTag)
         {
             PListImageReader local_0 = new PListImageReader((string)this.plistFileInfo);
             local_0.SaveAllSubImage((string)this.BaseDirectory);
             return(local_0);
         }
     }
     catch (Exception ex)
     {
         LogConfig.Output.Error((object)LanguageInfo.MessageBox_Content64, ex);
         return((PListImageReader)null);
     }
 }
Ejemplo n.º 5
0
        protected List <PlistImageFile> CreateItems()
        {
            PListImageReader plistImageReader = this.GetPlistImageReader(this.plistFileInfo);

            if (plistImageReader == null)
            {
                return(new List <PlistImageFile>());
            }
            string baseDirectory = (string)this.BaseDirectory;
            List <PlistImageFile> plistImageFileList = new List <PlistImageFile>();

            foreach (ImageInfo image in plistImageReader.ImageList)
            {
                string str = Path.Combine(baseDirectory, image.FileName);
                plistImageFileList.Add(new PlistImageFile((FilePath)str, image.Name, this));
            }
            return(plistImageFileList);
        }
Ejemplo n.º 6
0
        public void ReloadSubResources()
        {
            PListImageReader plistImageReader = this.GetPlistImageReader(this.plistFileInfo);

            if (plistImageReader == null)
            {
                return;
            }
            string baseDirectory = (string)this.BaseDirectory;

            if (!Directory.Exists((string)this.BaseDirectory))
            {
                return;
            }
            List <ResourceItem> resourceItemList = new List <ResourceItem>();

            foreach (ResourceItem resourceItem in (Collection <ResourceItem>) this.Items)
            {
                bool flag = false;
                foreach (ImageInfo image in plistImageReader.ImageList)
                {
                    string str = Path.Combine(baseDirectory, image.FileName);
                    if (resourceItem.PreviewImagePath == str)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    resourceItemList.Add(resourceItem);
                }
            }
            foreach (ResourceItem resourceItem in resourceItemList)
            {
                resourceItem.Delete();
                this.Items.Remove(resourceItem);
            }
            List <ImageInfo> imageInfoList = new List <ImageInfo>();

            foreach (ImageInfo image in plistImageReader.ImageList)
            {
                bool   flag = false;
                string str  = Path.Combine(baseDirectory, image.FileName);
                foreach (ResourceItem resourceItem in (Collection <ResourceItem>) this.Items)
                {
                    if (resourceItem.PreviewImagePath == str)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    imageInfoList.Add(image);
                }
            }
            foreach (ImageInfo imageInfo in imageInfoList)
            {
                this.Items.Add((ResourceItem) new PlistImageFile((FilePath)Path.Combine(baseDirectory, imageInfo.FileName), imageInfo.Name, this));
            }
        }