예제 #1
0
        public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi)
        {
            this.LoadThumbnail(si, ps);

            if (si.PackageCacheItem.Type == PackageType.Neighborhood)
            {
                Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.IDNO);
                if (pfds.Length > 0)
                {
                    Idno idno = new Idno();
                    idno.ProcessData(pfds[0], si.Package);

                    ps.Data    = new uint[2];
                    ps.Data[0] = (uint)idno.Type;
                    ps.Data[1] = idno.Uid;

                    //check for duplicates
                    if (ids.Contains(idno.Uid))
                    {
                        ps.State = TriState.False;
                    }
                    else
                    {
                        ps.State = TriState.True;
                    }
                }
            }

            if (si.PackageCacheItem.Thumbnail != null && WaitingScreen.Running)
            {
                WaitingScreen.UpdateImage(si.PackageCacheItem.Thumbnail);
            }
            UpdateState(si, ps, lvi);
        }
예제 #2
0
        public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi)
        {
            AbstractScanner.SetSubItem(lvi, this.StartColum + 1, "");
            if (si.PackageCacheItem.Type == PackageType.Neighborhood)
            {
                if (si.PackageCacheItem.Thumbnail == null)
                {
                    this.LoadThumbnail(si, ps);
                }

                //Add the Thumbnail if available
                if (si.PackageCacheItem.Thumbnail != null)
                {
                    ListView.SmallImageList.Images.Add(si.PackageCacheItem.Thumbnail);
                    lvi.ImageIndex = ListView.SmallImageList.Images.Count - 1;
                }

                if (ps.Data.Length > 1)
                {
                    ids.Add(ps.Data[1]);
                    AbstractScanner.SetSubItem(lvi, this.StartColum, ((NeighborhoodType)ps.Data[0]).ToString());
                    AbstractScanner.SetSubItem(lvi, this.StartColum + 1, "0x" + Helper.HexString(ps.Data[1]), ps);
                }
            }
        }
예제 #3
0
 public void LoadThumbnail(ScannerItem si, SimPe.Cache.PackageState ps)
 {
     if (si.PackageCacheItem.Type == PackageType.Neighborhood)
     {
         string name = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(si.FileName), System.IO.Path.GetFileNameWithoutExtension(si.FileName)) + ".png";
         if (System.IO.File.Exists(name))
         {
             Image img = Image.FromFile(name);
             si.PackageCacheItem.Thumbnail = ImageLoader.Preview(img, AbstractScanner.ThumbnailSize);
         }
     }
 }