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 ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.OBJD_FILE); ArrayList mylist = new ArrayList(); foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.PackedFiles.Wrapper.ExtObjd objd = new ExtObjd(); objd.ProcessData(pfd, si.Package, false); mylist.Add(objd.Guid); objd.Dispose(); } uint[] guids = new uint[mylist.Count]; mylist.CopyTo(guids); si.PackageCacheItem.Guids = guids; ps.State = TriState.True; UpdateState(si, ps, lvi); }
private static void GetPetBehaviours() { if (objds != null) { return; } objds = new List <ExtObjd>(); FileTable.FileIndex.Load(); SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] objs = FileTable.FileIndex.FindFileDiscardingGroup(Data.MetaData.OBJD_FILE, 0x41a7); Wait.Start(objs.Length); Wait.Message = "Loading Behaviours..."; /*foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem fii in globs) * { * SimPe.Plugin.Glob glb = new SimPe.Plugin.Glob(); * glb.ProcessData(fii); * if (glb.SemiGlobalGroup == 0x7FD90EDB) * { * SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] objs = FileTable.FileIndex.FindFile(Data.MetaData.OBJD_FILE, fii.FileDescriptor.Group);*/ int ct = 0; foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem ofii in objs) { Wait.Progress = ct++; ExtObjd obj = new ExtObjd(); obj.ProcessData(ofii); if (obj.FileName.StartsWith("Learned Behavior")) { objds.Add(obj); //Console.WriteLine(obj.ResourceName); } } Wait.Stop(); /* } * }*/ }
public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { ps.Data = new uint[1]; ps.State = TriState.True; ps.Data[0] = (uint)HealthState.Ok; if (si.Package.Header.Version != 0x100000001) { ps.Data[0] = (uint)HealthState.UnknownVersion; } else { if (si.Package.FileListFile != null) { foreach (SimPe.PackedFiles.Wrapper.ClstItem item in si.Package.FileListFile.Items) { SimPe.Interfaces.Files.IPackedFileDescriptor p = si.Package.FindFile(item.Type, item.SubType, item.Group, item.Instance); if (p == null) { ps.Data[0] = (uint)HealthState.WrongDirectory; break; } } if (ps.Data[0] == (uint)HealthState.Ok) { foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in si.Package.Index) { SimPe.Interfaces.Files.IPackedFile fl = si.Package.Read(pfd); if (pfd.Type == Data.MetaData.OBJD_FILE) { SimPe.PackedFiles.Wrapper.ExtObjd obj = new ExtObjd(); obj.ProcessData(pfd, si.Package); if (obj.Ok != SimPe.PackedFiles.Wrapper.ObjdHealth.Ok) { ps.Data[0] = (uint)HealthState.NonDefaultObjd; } if (obj.Ok == SimPe.PackedFiles.Wrapper.ObjdHealth.UnmatchingFilenames && Helper.WindowsRegistry.HiddenMode) { ps.Data[0] = (uint)HealthState.FaultyNamedObjd; } if (obj.Ok == ObjdHealth.OverLength) { ps.Data[0] = (uint)HealthState.FaultySizedObjd; } } if (pfd.Type == Data.MetaData.GMDC) { SimPe.Plugin.GenericRcol rcol = new GenericRcol(); rcol.ProcessData(pfd, si.Package); SimPe.Plugin.GeometryDataContainer gmdc = (SimPe.Plugin.GeometryDataContainer)rcol.Blocks[0]; foreach (SimPe.Plugin.Gmdc.GmdcGroup g in gmdc.Groups) { if (g.FaceCount > SimPe.Plugin.Gmdc.AbstractGmdcImporter.CRITICAL_FACE_AMOUNT) { ps.Data[0] = (uint)HealthState.BigMeshGeometry; } else if (g.UsedVertexCount > SimPe.Plugin.Gmdc.AbstractGmdcImporter.CRITICAL_VERTEX_AMOUNT) { ps.Data[0] = (uint)HealthState.BigMeshGeometry; } } } if (!fl.IsCompressed) { continue; } int pos = si.Package.FileListFile.FindFile(pfd); if (pos == -1) { ps.Data[0] = (uint)HealthState.IncompleteDirectory; break; } SimPe.PackedFiles.Wrapper.ClstItem item = si.Package.FileListFile.Items[pos]; if (fl.UncompressedSize != item.UncompressedSize) { ps.Data[0] = (uint)HealthState.WrongCompressionSize; break; } } } } if (ps.Data[0] != (uint)HealthState.Ok) { ps.State = TriState.False; } } UpdateState(si, ps, lvi); }
/// <summary> /// this Operation is fixing selected Packages that wer marked as problematic /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FixCompression(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) { 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.State != TriState.Null) && (ps.Data.Length > 0)) { if ((HealthState)ps.Data[0] != HealthState.Ok) { ps.State = TriState.True; ps.Data[0] = (uint)HealthState.Ok; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in si.Package.Index) { SimPe.Interfaces.Files.IPackedFile file = si.Package.Read(pfd); pfd.UserData = file.UncompressedData; pfd.MarkForReCompress = (file.IsCompressed || Data.MetaData.CompressionCandidates.Contains(pfd.Type)); if (pfd.Type == Data.MetaData.OBJD_FILE) { SimPe.PackedFiles.Wrapper.ExtObjd objd = new ExtObjd(); objd.ProcessData(pfd, si.Package); if (objd.Ok != SimPe.PackedFiles.Wrapper.ObjdHealth.Ok) { objd.SynchronizeUserData(); objd.ProcessData(pfd, si.Package); if (objd.Ok != ObjdHealth.Ok) { ps.State = TriState.False; ps.Data[0] = (uint)HealthState.NonDefaultObjd; if (objd.Ok == SimPe.PackedFiles.Wrapper.ObjdHealth.UnmatchingFilenames && Helper.WindowsRegistry.HiddenMode) { ps.Data[0] = (uint)HealthState.FaultyNamedObjd; } if (objd.Ok == ObjdHealth.OverLength) { ps.Data[0] = (uint)HealthState.FaultySizedObjd; } } } } } si.Package.Save(); chg = true; si.ListViewItem.ForeColor = System.Drawing.Color.Black; this.ScanPackage(si, ps, si.ListViewItem); } } } if (chg && this.CallbackFinish != null) { this.CallbackFinish(false, false); } } catch (Exception ex) { Helper.ExceptionMessage("", ex); } finally { WaitingScreen.Stop(); } }
/// <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(); } }
public ContainerItem(ExtObjd objd) { this.objd = objd; }
public ContainerItem(uint guid) { objd = new ExtObjd(); objd.Guid = guid; objd.FileName = "0x" + Helper.HexString(guid); }