public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { ps.Data = new uint[1]; ps.Data[0] = (uint)SimPe.PackedFiles.Wrapper.ShelveDimension.Indetermined; ps.State = TriState.True; if (si.PackageCacheItem.Type == PackageType.Object || si.PackageCacheItem.Type == PackageType.MaxisObject) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.OBJD_FILE); if (pfds.Length > 1) { ps.Data[0] = (uint)SimPe.PackedFiles.Wrapper.ShelveDimension.Multitile; } else if (pfds.Length > 0) { SimPe.PackedFiles.Wrapper.ExtObjd objd = new ExtObjd(); objd.ProcessData(pfds[0], si.Package); SimPe.PackedFiles.Wrapper.ShelveDimension sd = objd.ShelveDimension; if (sd == SimPe.PackedFiles.Wrapper.ShelveDimension.Unknown1 || sd == SimPe.PackedFiles.Wrapper.ShelveDimension.Indetermined || sd == SimPe.PackedFiles.Wrapper.ShelveDimension.Unknown2) { ps.State = TriState.False; } ps.Data[0] = (uint)sd; } } UpdateState(si, ps, lvi); }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { if (ps.State != TriState.Null) { SimPe.PackedFiles.Wrapper.ShelveDimension cs = (SimPe.PackedFiles.Wrapper.ShelveDimension)ps.Data[0]; AbstractScanner.SetSubItem(lvi, this.StartColum, cs.ToString(), ps); } }
/// <summary> /// this Operation is fixing selected Packages that wer marked as problematic /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Set(SimPe.PackedFiles.Wrapper.ShelveDimension sd) { if (selection == null) { return; } WaitingScreen.Wait(); bool chg = false; try { foreach (ScannerItem si in selection) { if (si.PackageCacheItem.Thumbnail != null) { WaitingScreen.Update(si.PackageCacheItem.Thumbnail, si.FileName); } else { WaitingScreen.UpdateMessage(si.FileName); } SimPe.Cache.PackageState ps = si.PackageCacheItem.FindState(this.Uid, true); if (ps.Data.Length < 1) { continue; } if (ps.State == TriState.True && selection.Length > 1) { continue; } ps.State = TriState.Null; try { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.OBJD_FILE); foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.PackedFiles.Wrapper.ExtObjd objd = new ExtObjd(); objd.ProcessData(pfd, si.Package); objd.ShelveDimension = sd; objd.SynchronizeUserData(); } si.Package.Save(); } catch (Exception ex) { Helper.ExceptionMessage("", ex); } } if (chg && this.CallbackFinish != null) { this.CallbackFinish(false, false); } } catch (Exception ex) { Helper.ExceptionMessage("", ex); } finally { WaitingScreen.Stop(); } }