public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.GMDC); //ArrayList list = new ArrayList(); ps.State = TriState.True; uint fct = 0; uint vct = 0; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.Plugin.Rcol rcol = new GenericRcol(); rcol.ProcessData(pfd, si.Package, true); SimPe.Plugin.GeometryDataContainer gmdc = rcol.Blocks[0] as SimPe.Plugin.GeometryDataContainer; foreach (SimPe.Plugin.Gmdc.GmdcGroup g in gmdc.Groups) { fct += (uint)g.FaceCount; vct += (uint)g.UsedVertexCount; } rcol.Dispose(); } ps.Data = new uint[] { vct, fct }; UpdateState(si, ps, lvi); }
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) { ps.Data = new uint[1]; ps.Data[0] = (uint)ReadyState.Yes; ps.State = TriState.True; if (si.PackageCacheItem.Type == PackageType.Object || si.PackageCacheItem.Type == PackageType.MaxisObject || si.PackageCacheItem.Type == PackageType.Recolor) { //this package does not contain a File in a Global Group, so it is probably not a Maxis Object! if (si.Package.FindFilesByGroup(Data.MetaData.GLOBAL_GROUP).Length == 0) { //all Files in the Local Group, this is not EP-Ready if (si.Package.FindFilesByGroup(Data.MetaData.LOCAL_GROUP).Length == si.Package.Index.Length) { ps.State = TriState.False; ps.Data[0] = (uint)ReadyState.NotUniversityReady; } //no Files in our Custom Group, so this might be a unready File (but it's not Sure!) if (si.Package.FindFilesByGroup(Data.MetaData.CUSTOM_GROUP).Length == 0) { ps.State = TriState.False; ps.Data[0] = (uint)ReadyState.Indetermined; } } } UpdateState(si, ps, lvi); }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { uint fct = ps.Data[1]; uint vct = ps.Data[0]; AbstractScanner.SetSubItem(lvi, this.StartColum, vct.ToString(), ps); AbstractScanner.SetSubItem(lvi, this.StartColum + 1, fct.ToString(), ps); }
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); } }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { if (ps.State != TriState.Null) { ReadyState cs = (ReadyState)ps.Data[0]; AbstractScanner.SetSubItem(lvi, this.StartColum, cs.ToString(), ps); } }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { //Add the Thumbnail if available if (si.PackageCacheItem.Thumbnail != null) { ListView.SmallImageList.Images.Add(si.PackageCacheItem.Thumbnail); lvi.ImageIndex = ListView.SmallImageList.Images.Count - 1; } }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { AbstractScanner.SetSubItem(lvi, this.StartColum + 1, ""); System.Drawing.Color cl = lvi.ForeColor; if (ps.State == TriState.True) { uint c = 0; uint a = 0; for (int i = 0; i < ps.Data.Length - 1; i += 2) { c |= ps.Data[i + 1]; a |= ps.Data[i]; } string age = ""; Data.Ages[] ages = (Data.Ages[])System.Enum.GetValues(typeof(Data.Ages)); foreach (Data.Ages ag in ages) { if ((a & (uint)ag) != 0) { if (age != "") { age += ", "; } age += ag.ToString(); } } if (a == 0) { cl = System.Drawing.Color.Red; } AbstractScanner.SetSubItem(lvi, this.StartColum, age, cl); if (si.PackageCacheItem.Type != SimPe.Cache.PackageType.Skin) { string category = ""; Data.SkinCategories[] cats = (Data.SkinCategories[])System.Enum.GetValues(typeof(Data.SkinCategories)); foreach (Data.SkinCategories cat in cats) { if ((c & (uint)cat) != 0) { if (category != "") { category += ", "; } category += cat.ToString(); } } if (c == 0) { cl = System.Drawing.Color.Red; } AbstractScanner.SetSubItem(lvi, this.StartColum + 1, category, cl); } } }
public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { ps.State = TriState.False; si.PackageCacheItem.Name = Localization.Manager.GetString("unknown"); SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.CTSS_FILE); if (pfds.Length == 0) { pfds = si.Package.FindFiles(Data.MetaData.STRING_FILE); } //Check for Str compatible Items if (pfds.Length > 0) { SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str(); str.ProcessData(pfds[0], si.Package, false); SimPe.PackedFiles.Wrapper.StrItemList list = str.FallbackedLanguageItems(Helper.WindowsRegistry.LanguageCode); foreach (SimPe.PackedFiles.Wrapper.StrToken item in list) { if (item.Title.Trim() != "") { ps.State = TriState.True; si.PackageCacheItem.Name = item.Title; break; } } } else { pfds = si.Package.FindFiles(Data.MetaData.GZPS); if (pfds.Length == 0) { pfds = si.Package.FindFiles(0xCCA8E925); //Object XML } if (pfds.Length == 0) { pfds = si.Package.FindFiles(Data.MetaData.MMAT); } //Check for Cpf compatible Items if (pfds.Length > 0) { SimPe.PackedFiles.Wrapper.Cpf cpf = new SimPe.PackedFiles.Wrapper.Cpf(); cpf.ProcessData(pfds[0], si.Package, false); si.PackageCacheItem.Name = cpf.GetSaveItem("name").StringValue; if (si.PackageCacheItem.Name.Trim() != "") { ps.State = TriState.True; } } } UpdateState(si, ps, lvi); }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { string text = "yes"; if (ps.State == TriState.False) { text = "no"; } AbstractScanner.SetSubItem(lvi, this.StartColum, text, ps); }
/// <summary> /// Add a Scanner to the report /// </summary> /// <param name="name">Name of the scanner</param> /// <param name="type">Type of the class in the usual format: Fully Qualified Class Name, Assembly</param> /// <param name="parameters">Parameters as pipe separated: key=value|key2=value2</param> public void AddScanner(ScannerItem scanner) { Sitecore.Diagnostics.Assert.ArgumentNotNull(scanner, "scanner"); if (!scanners.ContainsKey(scanner.ID.ToString())) { scanners.Add(scanner.ID.ToString(), scanner); FlushCache(); } }
public void CheckAllItemsInBasket() { foreach (GameObject item in items) { ScannerItem tmpScannerItem = item.GetComponent <ScannerItem>(); if (!tmpScannerItem.in_basket) { return; } } game_manager.LoadPaymentScreen(); }
public void notifyNextMoveItems() { foreach (GameObject item in items) { ScannerItem tmpScannerItem = item.GetComponent <ScannerItem>(); Vector3 newPos = item.transform.position; if (!tmpScannerItem.did_touch_scanner) { newPos.x += 2.25f; tmpScannerItem.newPosToMove = newPos; tmpScannerItem.move_this_item = true; } } }
public void EnableControl(ScannerItem item, bool active) { if (item != null) { ScannerItem[] items = new ScannerItem[1]; items[0] = item; EnableControl(items, active); } else { EnableControl(new ScannerItem[0], active); } }
public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { if (si.PackageCacheItem.Type == SimPe.Cache.PackageType.Cloth || si.PackageCacheItem.Type == SimPe.Cache.PackageType.Skin || ((uint)si.PackageCacheItem.Type & (uint)SimPe.Cache.PackageType.Makeup) == (uint)SimPe.Cache.PackageType.Makeup || ((uint)si.PackageCacheItem.Type & (uint)SimPe.Cache.PackageType.Accessory) == (uint)SimPe.Cache.PackageType.Accessory || si.PackageCacheItem.Type == SimPe.Cache.PackageType.Hair ) { Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.GZPS); if (pfds.Length == 0) { pfds = si.Package.FindFiles(0xCCA8E925); //Object XML } if (pfds.Length == 0) { pfds = si.Package.FindFiles(0x2C1FD8A1); //TextureOverlay XML } if (pfds.Length == 0) { pfds = si.Package.FindFiles(0x8C1580B5); //Hairtone XML } if (pfds.Length == 0) { pfds = si.Package.FindFiles(0x0C1FE246); //Mesh Overlay XML } ArrayList data = new ArrayList(); foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.PackedFiles.Wrapper.Cpf cpf = new Cpf(); cpf.ProcessData(pfd, si.Package, false); data.Add(cpf.GetSaveItem("age").UIntegerValue); data.Add(cpf.GetSaveItem("category").UIntegerValue); } ps.Data = new uint[data.Count]; data.CopyTo(ps.Data); ps.State = TriState.True; } else { ps.State = TriState.False; } UpdateState(si, ps, lvi); }
/// <summary> /// Creates the Map /// </summary> /// <returns>the FileIndex</returns> /// <remarks> /// The Tags of the FileDescriptions contain the MMATCachItem Object, /// the FileNames of the FileDescriptions contain the Name of the package File /// </remarks> public void LoadFiles() { map = new Hashtable(); foreach (CacheContainer cc in Containers) { if (cc.Type == ContainerType.Package && cc.Valid) { foreach (PackageCacheItem item in cc.Items) { ScannerItem si = new ScannerItem(item, cc); si.FileName = cc.FileName; map[si.FileName.Trim().ToLower()] = item; } } } //foreach }
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); }
public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.MMAT); //ArrayList list = new ArrayList(); ps.State = TriState.True; //FileTable.FileIndex.StoreCurrentState(); if (!FileTable.FileIndex.ContainsPath(System.IO.Path.GetDirectoryName(si.FileName))) { FileIndex.AddIndexFromFolder(System.IO.Path.GetDirectoryName(si.FileName)); } FileIndex.AddIndexFromPackage(si.Package); foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds) { SimPe.Plugin.MmatWrapper mmat = new MmatWrapper(); mmat.ProcessData(pfd, si.Package, false); string m = mmat.ModelName.Trim().ToLower(); if (!m.EndsWith("_cres")) { m += "_cres"; } //Add the current package SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item = FileTable.FileIndex.FindFileByName(m, Data.MetaData.CRES, Data.MetaData.LOCAL_GROUP, true); if (item == null) { ps.State = TriState.False; } item = null; mmat.Dispose(); m = null; } //FileTable.FileIndex.RestoreLastState(); UpdateState(si, ps, lvi); }
/// <summary> /// Load/Add a Cache Item for the passed File /// </summary> /// <param name="filename">The Name of the File</param> public ScannerItem LoadItem(string filename) { CacheContainer mycc = this.UseConatiner(ContainerType.Package, filename); if (mycc.Items.Count == 0) { PackageCacheItem pci = new PackageCacheItem(); ScannerItem item = new ScannerItem(pci, mycc); item.FileName = filename; pci.Name = System.IO.Path.GetFileNameWithoutExtension(filename); mycc.Items.Add(pci); return(item); } else { ScannerItem item = new ScannerItem((PackageCacheItem)mycc.Items[0], mycc); item.FileName = filename; return(item); } }
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 will build a SkinTone Replacement for the passed Skintone /// </summary> /// <param name="skintone">the skintone string</param> /// <param name="addtxtr">true, if you want to replace the default TXTR Files</param> /// <param name="addtxmt">true if you want to replace the default TXMT Files</param> /// <param name="sitem"></param> /// <param name="src"></param> /// <returns>the replacement package</returns> public SimPe.Packages.GeneratableFile BuildOverride(ScannerItem sitem, string skintone, string family, SimPe.Interfaces.Files.IPackageFile src, bool addtxmt, bool addtxtr, bool addref) { FileTable.FileIndex.Load(); SimPe.Packages.GeneratableFile pkg = SimPe.Packages.GeneratableFile.LoadFromStream((System.IO.BinaryReader)null); WaitingScreen.Wait(); //Save the old FileTable and the source File FileTable.FileIndex.Load(); FileTable.FileIndex.StoreCurrentState(); FileTable.FileIndex.AddIndexFromPackage(src); bool usefam = (skintone == "00000000-0000-0000-0000-000000000000"); try { //find al description Files that belong to the Skintone that should be replaced ArrayList basecpf = new ArrayList(); SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFile(Data.MetaData.GZPS, true); foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items) { SimPe.PackedFiles.Wrapper.Cpf cpf = new Cpf(); cpf.ProcessData(item); if (cpf.GetSaveItem("skintone").StringValue != skintone) { continue; } //if (usefam) if (cpf.GetSaveItem("family").StringValue != family) { continue; } if (cpf.GetSaveItem("type").StringValue != "skin") { continue; } SimPe.Plugin.SkinChain sc = new SkinChain(cpf); basecpf.Add(sc); WaitingScreen.UpdateMessage(cpf.GetSaveItem("name").StringValue); } ArrayList compare = new ArrayList(); compare.Add("age"); //compare.Add("category"); compare.Add("fitness"); compare.Add("gender"); //compare.Add("outfit"); compare.Add("override0subset"); //compare.Add("override0resourcekeyidx"); //compare.Add("shapekeyidx"); //now select matching Files Interfaces.Files.IPackedFileDescriptor[] pfds = src.FindFiles(Data.MetaData.GZPS); #if DEBUG //we could add Debug Code here to see which cpfs were pulled :) /*SimPe.Packages.GeneratableFile f = SimPe.Packages.GeneratableFile.CreateNew(); * * foreach (SimPe.Plugin.SkinChain sc in basecpf) * { * sc.Cpf.SynchronizeUserData(); * f.Add(sc.Cpf.FileDescriptor); * * RefFile r = sc.ReferenceFile; * if (r!=null) * { * r.SynchronizeUserData(); * f.Add(r.FileDescriptor); * } * * //foreach (GenericRcol rcol in sc.TXTRs) * GenericRcol rcol = sc.TXTR; * if (rcol!=null) * { * rcol.SynchronizeUserData(); * f.Add(rcol.FileDescriptor); * } * * //foreach (GenericRcol rcol in sc.TXMTs) * rcol = sc.TXMT; * if (rcol!=null) * { * rcol.SynchronizeUserData(); * f.Add(rcol.FileDescriptor); * } * } * * f.Save(@"G:\skinbase.package"); * return f;*/ #endif foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { //load a description File for the new Skintone SimPe.PackedFiles.Wrapper.Cpf cpf = new Cpf(); cpf.ProcessData(pfd, src); int index = -1; int maxpoint = 0; //check if File is a match for (int i = 0; i < basecpf.Count; i++) { SimPe.Plugin.SkinChain sc = (SimPe.Plugin.SkinChain)basecpf[i]; int point = compare.Count; //scan for valid CPF Files foreach (string s in compare) { if (s == "age" || s == "category" || s == "outfit") { if ((sc.Cpf.GetSaveItem(s).UIntegerValue & cpf.GetSaveItem(s).UIntegerValue) == 0) { point--; } } else if (s == "override0subset") { string s1 = sc.Cpf.GetSaveItem(s).StringValue.Trim().ToLower(); string s2 = cpf.GetSaveItem(s).StringValue.Trim().ToLower(); if (s1 == "bottom") { s1 = "body"; } else if (s1 == "top") { s1 = "body"; } if (s2 == "bottom") { s2 = "body"; } else if (s2 == "top") { s2 = "body"; } if (s1 != s2) { point--; } } else if (sc.Cpf.GetSaveItem(s).UIntegerValue != cpf.GetSaveItem(s).UIntegerValue) { point--; } } if (point > maxpoint) { index = i; maxpoint = point; } } //yes, yes :D this is a match if (index >= 0 && maxpoint == compare.Count) { SimPe.Plugin.SkinChain sc = (SimPe.Plugin.SkinChain)basecpf[index]; SkinChain newsc = new SkinChain(cpf); if (sc.ReferenceFile != null && newsc.ReferenceFile != null && addref) { RefFile r = newsc.ReferenceFile; r.FileDescriptor = sc.ReferenceFile.FileDescriptor.Clone(); r.SynchronizeUserData(); if (pkg.FindFile(r.FileDescriptor) == null) { pkg.Add(r.FileDescriptor); } } if (sc.TXTR != null && newsc.TXTR != null && addtxtr) { SimPe.Plugin.GenericRcol txtr = newsc.TXTR; txtr.FileDescriptor = sc.TXTR.FileDescriptor.Clone(); #if DEBUG #else txtr.FileDescriptor.MarkForReCompress = true; #endif txtr.FileName = sc.TXTR.FileName; txtr.SynchronizeUserData(); if (pkg.FindFile(txtr.FileDescriptor) == null) { pkg.Add(txtr.FileDescriptor); } } if (sc.TXMT != null && newsc.TXMT != null && addtxmt) { SimPe.Plugin.GenericRcol txmt = newsc.TXMT; txmt.FileDescriptor = sc.TXMT.FileDescriptor.Clone(); #if DEBUG #else txmt.FileDescriptor.MarkForReCompress = true; #endif MaterialDefinition md = (MaterialDefinition)txmt.Blocks[0]; MaterialDefinition mdorg = (MaterialDefinition)sc.TXMT.Blocks[0]; txmt.FileName = sc.TXMT.FileName; md.FileDescription = mdorg.FileDescription; txmt.SynchronizeUserData(); if (pkg.FindFile(txmt.FileDescriptor) == null) { pkg.Add(txmt.FileDescriptor); } } } } SimPe.PackedFiles.Wrapper.Str str = new Str(); str.Add(new StrToken(0, 0, "SimPE Skin Override: " + skintone + " (from " + sitem.PackageCacheItem.Name + ")", "")); str.FileDescriptor = new SimPe.Packages.PackedFileDescriptor(); str.FileDescriptor.Type = Data.MetaData.STRING_FILE; str.FileDescriptor.Group = Data.MetaData.LOCAL_GROUP; str.FileDescriptor.LongInstance = 0; str.SynchronizeUserData(); pkg.Add(str.FileDescriptor); } finally { //restore the Previous FileTable FileTable.FileIndex.RestoreLastState(); WaitingScreen.Stop(); } return(pkg); }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { AbstractScanner.SetSubItem(lvi, this.StartColum, si.PackageCacheItem.Name); }
public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { System.Drawing.Size sz = AbstractScanner.ThumbnailSize; if (si.PackageCacheItem.Type == PackageType.Object || si.PackageCacheItem.Type == PackageType.MaxisObject || si.PackageCacheItem.Type == PackageType.Recolor) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.OBJD_FILE); uint group = 0; if (pfds.Length > 0) { group = pfds[0].Group; } if (group == Data.MetaData.LOCAL_GROUP) { SimPe.Interfaces.Wrapper.IGroupCacheItem gci = FileTable.GroupCache.GetItem(si.FileName); if (gci != null) { group = gci.LocalGroup; } } string[] modelnames = SimPe.Plugin.Scenegraph.FindModelNames(si.Package); foreach (string modelname in modelnames) { System.Drawing.Image img = SimPe.Plugin.Workshop.GetThumbnail(group, modelname); if (img != null) { si.PackageCacheItem.Thumbnail = img; ps.State = TriState.True; break; } } } //no Thumbnail, do we have a Image File? if (ps.State == TriState.Null) { SimPe.PackedFiles.Wrapper.Picture pic = new Picture(); uint[] types = pic.AssignableTypes; foreach (uint type in types) { SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(type); if (pfds.Length > 0) { //get image with smallest Instance SimPe.Interfaces.Files.IPackedFileDescriptor pfd = pfds[0]; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor p in pfds) { if (p.Instance < pfd.Instance) { pfd = p; } } pic.ProcessData(pfd, si.Package, false); si.PackageCacheItem.Thumbnail = pic.Image; if (si.PackageCacheItem.Thumbnail != null) { si.PackageCacheItem.Thumbnail = ImageLoader.Preview(si.PackageCacheItem.Thumbnail, sz); ps.State = TriState.True; } break; } } //foreach } //no Thumbnail generated by the Game? if (ps.State == TriState.Null) { //load the Texture Image SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.TXTR); if (pfds.Length > 0) { SimPe.Plugin.GenericRcol rcol = new GenericRcol(null, false); //get biggest texture SimPe.Interfaces.Files.IPackedFileDescriptor pfd = pfds[0]; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor p in pfds) { if (p.Size > pfd.Size) { pfd = p; } } rcol.ProcessData(pfd, si.Package, false); SimPe.Plugin.ImageData id = (SimPe.Plugin.ImageData)rcol.Blocks[0]; SimPe.Plugin.MipMap mm = id.GetLargestTexture(sz); if (mm.Texture != null) { si.PackageCacheItem.Thumbnail = ImageLoader.Preview(mm.Texture, sz); ps.State = TriState.True; } rcol.Dispose(); } } if (si.PackageCacheItem.Thumbnail != null) { if (WaitingScreen.Running) { WaitingScreen.UpdateImage(si.PackageCacheItem.Thumbnail); } } UpdateState(si, ps, lvi); }
public void UpdateState(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi) { ps.State = TriState.True; string guids = ""; string ff = SimPe.Localization.Manager.GetString("unknown"); foreach (uint guid in si.PackageCacheItem.Guids) { string flname = si.FileName.Trim().ToLower(); if (guids != "") { guids += ", "; } guids += "0x" + Helper.HexString(guid); /*foreach (MemoryCacheItem mci in cachefile.List) * { * if (mci.Guid == guid) * { * if (mci.ParentCacheContainer!=null) * { * if (mci.ParentCacheContainer.FileName.Trim().ToLower() != flname) * { * ps.State = TriState.False; * break; * } * } * } * }*/ string fl = si.Package.FileName.Trim().ToLower(); if (list.ContainsKey(guid)) { string cmp = (string)list[guid]; if (cmp != fl) { ps.State = TriState.False; ff = cmp; } else { ps.State = TriState.True; } } else { list.Add(guid, fl); } } string text = "no"; if (ps.State == TriState.False) { text = "yes"; } AbstractScanner.SetSubItem(lvi, this.StartColum, guids); AbstractScanner.SetSubItem(lvi, this.StartColum + 1, text, ps); AbstractScanner.SetSubItem(lvi, this.StartColum + 2, ff); }