private void showMeshDetails() { string meshName = ""; // Translate selection back into af am etc switch (cmbSimAge.Text) { case "Baby": meshName += "b"; break; case "Toddler": meshName += "p"; break; case "Child": meshName += "c"; break; case "Teen": meshName += "t"; break; case "Young Adult": meshName += "y"; break; case "Adult": meshName += "a"; break; case "Elder": meshName += "e"; break; case "All Ages": meshName += "u"; break; } switch (cmbSimGender.Text) { case "Female": meshName += "f"; break; case "Male": meshName += "m"; break; case "Unisex": meshName += "u"; break; } if (cmbMeshName.Text == "* Custom") { //if (this.isNew == false) //{ //meshName += casPartSrc.meshName; //} txtCasPartName.Text = casPartSrc.meshName; txtMeshName.Text = casPartSrc.meshName; txtCasPartInstance.Text = "0x" + MadScience.StringHelpers.HashFNV64(meshName).ToString("X16"); picMeshPreview.Image = null; picMeshPreview.Invalidate(); } else { if (cmbPartTypes.Text == "(none)") { meshName += cmbMeshName.Text; } else { meshName += cmbPartTypes.Text + cmbMeshName.Text; } txtCasPartName.Text = meshName; txtMeshName.Text = meshName; scrollPanelToThumb(meshName); for (int i = 0; i < this.lookupList.Items.Length; i++) { filesFile f = lookupList.Items[i]; if (f.fullCasPartname == meshName) { txtCasPartInstance.Text = f.instanceid; break; } } picMeshPreview.Image = null; picMeshPreview.Invalidate(); // Find thumbnail if (File.Exists(Path.Combine(Application.StartupPath, Path.Combine("cache", meshName + ".png")))) { Stream picMeshPreviewStream = File.OpenRead(Path.Combine(Application.StartupPath, Path.Combine("cache", meshName + ".png"))); picMeshPreview.Image = Image.FromStream(picMeshPreviewStream); picMeshPreviewStream.Close(); } else { extractCASThumbnail(meshName); } } if (this.isNew == true) { // Attempt to load the existing caspart into memory so we can extract data later. Stream casPartFile = File.Open(Path.Combine(Application.StartupPath, Path.Combine("casparts", txtCasPartName.Text + ".caspart")), FileMode.Open, FileAccess.Read, FileShare.Read); casPartFile cPartFile = new casPartFile(); this.casPartSrc = cPartFile.Load(casPartFile); casPartFile.Close(); } for (int i = 0; i < checkedListAge.Items.Count; i++) { checkedListAge.SetItemChecked(i, false); } for (int i = 0; i < checkedListCategory.Items.Count; i++) { checkedListCategory.SetItemChecked(i, false); } for (int i = 0; i < checkedListCategoryExtended.Items.Count; i++) { checkedListCategoryExtended.SetItemChecked(i, false); } for (int i = 0; i < checkedListGender.Items.Count; i++) { checkedListGender.SetItemChecked(i, false); } for (int i = 0; i < checkedListOther.Items.Count; i++) { checkedListOther.SetItemChecked(i, false); } for (int i = 0; i < checkedListType.Items.Count; i++) { checkedListType.SetItemChecked(i, false); } // Get the Mesh links for the first LOD Stream meshStream = Stream.Null; // Use the VPXY to get the mesh lod Stream vpxyStream = KeyUtils.findKey(casPartSrc.tgi64list[casPartSrc.tgiIndexVPXY], 0); if (StreamHelpers.isValidStream(vpxyStream)) { VPXYFile vpxyFile = new VPXYFile(vpxyStream); // Get the first VPXY internal link if (vpxyFile.vpxy.linkEntries.Count >= 1 && vpxyFile.vpxy.linkEntries[0].tgiList.Count >= 1) { meshStream = KeyUtils.findKey(vpxyFile.vpxy.linkEntries[0].tgiList[0], 0); } vpxyStream.Close(); } if (StreamHelpers.isValidStream(meshStream)) { lstMeshTGILinks.Items.Clear(); SimGeomFile simgeomfile = new SimGeomFile(meshStream); // Always put the bumpmap in the first position and get it from the MTNF //int bumpmapPos = -1; //int tgiAddNo = 0; for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++) { if (simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash == (uint)FieldTypes.NormalMap) { ListViewItem item = new ListViewItem(); item.SubItems.Add(Enum.GetName(typeof(FieldTypes), simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash)); item.Text = simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].ToString(); if (simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } //bumpmapPos = (int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]; lstMeshTGILinks.Items.Add(item); break; } } for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++) { if (simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash != (uint)FieldTypes.NormalMap) { foreach (uint fieldHash in Enum.GetValues(typeof(FieldTypes))) { if (fieldHash == simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash) { if (simgeomfile.simgeom.mtnfChunk.entries[i].dwords.Count > 0) { ListViewItem item = new ListViewItem(); item.SubItems.Add(Enum.GetName(typeof(FieldTypes), fieldHash)); item.Text = simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].ToString(); if (simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } lstMeshTGILinks.Items.Add(item); } break; } } } } /* if (bumpmapPos > -1) { ListViewItem item = new ListViewItem(); item.SubItems.Add("Bump Map"); item.Text = simgeomfile.simgeom.keytable.keys[bumpmapPos].ToString(); if (simgeomfile.simgeom.keytable.keys[bumpmapPos].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } lstMeshTGILinks.Items.Add(item); tgiAddNo++; } for (int i = 0; i < simgeomfile.simgeom.keytable.keys.Count; i++) { if (i != bumpmapPos) { ListViewItem item = new ListViewItem(); tgiAddNo++; //item.SubItems.Add("TGI #" + tgiAddNo); //item.SubItems.Add("TGI #" + (i + 1)); item.Text = simgeomfile.simgeom.keytable.keys[i].ToString(); if (simgeomfile.simgeom.keytable.keys[i].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } lstMeshTGILinks.Items.Add(item); } } */ } lstCasPartDetails.Items.Clear(); // Populate the CAS Part Details addCasPartItem("Mesh Name", casPartSrc.meshName); toolStripStatusLabel2.Text = casPartSrc.meshName; addCasPartItem("Clothing Order", casPartSrc.clothingOrder.ToString()); addCasPartItem("CAS Part Type", casPartSrc.clothingType.ToString() + " (0x" + casPartSrc.clothingType.ToString("X8") + ")"); addCasPartItem("Type", casPartSrc.typeFlag.ToString() + " (0x" + casPartSrc.typeFlag.ToString("X8") + ")"); addCasPartItem("Age/Gender", casPartSrc.ageGenderFlag.ToString() + " (0x" + casPartSrc.ageGenderFlag.ToString("X8") + ")"); addCasPartItem("Clothing Category", casPartSrc.clothingCategory.ToString() + " (0x" + casPartSrc.clothingCategory.ToString("X8") + ")"); addCasPartItem("Unk String", casPartSrc.unkString); addCasPartItem("Unk2", casPartSrc.unk2.ToString()); addCasPartItem("TGI Index Body Part 1", casPartSrc.tgiIndexBodyPart1.ToString()); addCasPartItem("TGI Index Body Part 2", casPartSrc.tgiIndexBodyPart2.ToString()); addCasPartItem("TGI Index Blend Info Fat", casPartSrc.tgiIndexBlendInfoFat.ToString()); addCasPartItem("TGI Index Blend Info Fit", casPartSrc.tgiIndexBlendInfoFit.ToString()); addCasPartItem("TGI Index Blend Info Thin", casPartSrc.tgiIndexBlendInfoThin.ToString()); addCasPartItem("TGI Index Blend Info Special", casPartSrc.tgiIndexBlendInfoSpecial.ToString()); addCasPartItem("Unk5", casPartSrc.unk5.ToString()); addCasPartItem("VPXY", casPartSrc.tgiIndexVPXY.ToString()); //tgi64 tempvpxy = (tgi64)casPartSrc.tgi64list[casPartSrc.tgiIndexVPXY]; //txtVPXYPrimary.Text = "key:" + tempvpxy.typeid.ToString("X8") + ":" + tempvpxy.groupid.ToString("X8") + ":" + tempvpxy.instanceid.ToString("X16"); addCasPartItem("Count 2", casPartSrc.count2.ToString()); for (int i = 0; i < casPartSrc.count2; i++) { unkRepeat unk = (unkRepeat)casPartSrc.count2repeat[i]; addCasPartItem("#" + i.ToString() + ": unkNum ", unk.unkNum.ToString()); addCasPartItem("#" + i.ToString() + ": unk2", unk.unk2.ToString()); addCasPartItem("#" + i.ToString() + ": unkRepeatInner", unk.unkRepeatInnerCount.ToString()); for (int j = 0; j < unk.unkRepeatInnerCount; j++) { intTriple iT = (intTriple)unk.unkRepeatInnerLoop[j]; addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": One", iT.one.ToString()); addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": Two", iT.two.ToString()); addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": Three", iT.three.ToString()); } } addCasPartItem("TGI Index Diffuse", casPartSrc.tgiIndexDiffuse.ToString()); addCasPartItem("TGI Index Specular", casPartSrc.tgiIndexSpecular.ToString()); addCasPartItem("Diffuse Links", casPartSrc.count3.ToString()); for (int i = 0; i < casPartSrc.count3; i++) { byte cRepeat = (byte)casPartSrc.count3repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } addCasPartItem("Specular Links", casPartSrc.count4.ToString()); for (int i = 0; i < casPartSrc.count4; i++) { byte cRepeat = (byte)casPartSrc.count4repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } addCasPartItem("Count 5", casPartSrc.count5.ToString()); for (int i = 0; i < casPartSrc.count5; i++) { byte cRepeat = (byte)casPartSrc.count5repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } for (int i = 0; i < chkDesignType.Items.Count; i++) { chkDesignType.SetItemChecked(i, false); } for (int i = 0; i < casPartSrc.count6; i++) { MadScience.Wrappers.ResourceKey tgi = casPartSrc.tgi64list[i]; string tgiType = MadScience.Helpers.findMetaEntry(tgi.typeId).shortName; Console.WriteLine(tgi.typeId.ToString() + " " + tgiType); if (tgi.typeId == 0x0333406C) { if (tgi.instanceId == 0x52E8BE209C703561) { chkDesignType.SetItemChecked(0, true); } if (tgi.instanceId == 0xE37696463F6B2D6E) { chkDesignType.SetItemChecked(1, true); } if (tgi.instanceId == 0x01625DDC220C08C6) { chkDesignType.SetItemChecked(2, true); } } addCasPartItem("TGI #" + i.ToString() + " " + tgiType, tgi.ToString()); } // Category flags if ((casPartSrc.typeFlag & 0x1) == 0x1) checkedListType.SetItemChecked(0, true); // Hair if ((casPartSrc.typeFlag & 0x2) == 0x2) checkedListType.SetItemChecked(1, true); // Scalp if ((casPartSrc.typeFlag & 0x4) == 0x4) checkedListType.SetItemChecked(2, true); // Face Overlay if ((casPartSrc.typeFlag & 0x8) == 0x8) checkedListType.SetItemChecked(3, true); // Body if ((casPartSrc.typeFlag & 0x10) == 0x10) checkedListType.SetItemChecked(4, true); // Accessory switch (casPartSrc.clothingType) { case 1: checkedListClothingType.SetItemChecked(0, true); break; case 2: checkedListClothingType.SetItemChecked(1, true); break; case 3: checkedListClothingType.SetItemChecked(2, true); break; case 4: checkedListClothingType.SetItemChecked(3, true); break; case 5: checkedListClothingType.SetItemChecked(4, true); break; case 6: checkedListClothingType.SetItemChecked(5, true); break; case 7: checkedListClothingType.SetItemChecked(6, true); break; case 11: checkedListClothingType.SetItemChecked(7, true); break; case 12: checkedListClothingType.SetItemChecked(8, true); break; case 13: checkedListClothingType.SetItemChecked(9, true); break; case 14: checkedListClothingType.SetItemChecked(10, true); break; case 15: checkedListClothingType.SetItemChecked(11, true); break; case 16: checkedListClothingType.SetItemChecked(12, true); break; case 17: checkedListClothingType.SetItemChecked(13, true); break; case 18: checkedListClothingType.SetItemChecked(14, true); break; case 19: checkedListClothingType.SetItemChecked(15, true); break; case 20: checkedListClothingType.SetItemChecked(16, true); break; case 21: checkedListClothingType.SetItemChecked(17, true); break; case 22: checkedListClothingType.SetItemChecked(18, true); break; case 24: checkedListClothingType.SetItemChecked(19, true); break; case 25: checkedListClothingType.SetItemChecked(20, true); break; case 26: checkedListClothingType.SetItemChecked(21, true); break; case 29: checkedListClothingType.SetItemChecked(22, true); break; case 30: checkedListClothingType.SetItemChecked(23, true); break; case 31: checkedListClothingType.SetItemChecked(24, true); break; } if ((casPartSrc.ageGenderFlag & 0x1) == 0x1) checkedListAge.SetItemChecked(0, true); // Baby if ((casPartSrc.ageGenderFlag & 0x2) == 0x2) checkedListAge.SetItemChecked(1, true); // Toddler if ((casPartSrc.ageGenderFlag & 0x4) == 0x4) checkedListAge.SetItemChecked(2, true); // Child if ((casPartSrc.ageGenderFlag & 0x8) == 0x8) checkedListAge.SetItemChecked(3, true); // Teen if ((casPartSrc.ageGenderFlag & 0x10) == 0x10) checkedListAge.SetItemChecked(4, true); // YoungAdult if ((casPartSrc.ageGenderFlag & 0x20) == 0x20) checkedListAge.SetItemChecked(5, true); // Adult if ((casPartSrc.ageGenderFlag & 0x40) == 0x40) checkedListAge.SetItemChecked(6, true); // Elder if ((casPartSrc.ageGenderFlag & 0x1000) == 0x1000) checkedListGender.SetItemChecked(0, true); // Male if ((casPartSrc.ageGenderFlag & 0x2000) == 0x2000) checkedListGender.SetItemChecked(1, true); // Female if ((casPartSrc.ageGenderFlag & 0x100000) == 0x100000) checkedListOther.SetItemChecked(0, true); // LeftHanded if ((casPartSrc.ageGenderFlag & 0x200000) == 0x200000) checkedListOther.SetItemChecked(1, true); // RightHanded if ((casPartSrc.ageGenderFlag & 0x10000) == 0x10000) checkedListOther.SetItemChecked(2, true); // Human if ((casPartSrc.clothingCategory & 0x1) == 0x1) checkedListCategory.SetItemChecked(0, true); // Naked if ((casPartSrc.clothingCategory & 0x2) == 0x2) checkedListCategory.SetItemChecked(1, true); // Everyday if ((casPartSrc.clothingCategory & 0x4) == 0x4) checkedListCategory.SetItemChecked(2, true); // Formalwear if ((casPartSrc.clothingCategory & 0x8) == 0x8) checkedListCategory.SetItemChecked(3, true); // Sleepwear if ((casPartSrc.clothingCategory & 0x10) == 0x10) checkedListCategory.SetItemChecked(4, true); // Swimwear if ((casPartSrc.clothingCategory & 0x20) == 0x20) checkedListCategory.SetItemChecked(5, true); // Athletic if ((casPartSrc.clothingCategory & 0x40) == 0x40) checkedListCategory.SetItemChecked(6, true); // Singed if ((casPartSrc.clothingCategory & 0x100) == 0x100) checkedListCategory.SetItemChecked(7, true); // Career if ((casPartSrc.clothingCategory & 0xFFFF) == 0xFFFF) checkedListCategory.SetItemChecked(8, true); // All if ((casPartSrc.clothingCategory & 0x100000) == 0x100000) checkedListCategoryExtended.SetItemChecked(0, true); // ValidForMaternity if ((casPartSrc.clothingCategory & 0x200000) == 0x200000) checkedListCategoryExtended.SetItemChecked(1, true); // ValidForRandom if ((casPartSrc.clothingCategory & 0x400000) == 0x400000) checkedListCategoryExtended.SetItemChecked(2, true); // IsHat if ((casPartSrc.clothingCategory & 0x800000) == 0x800000) checkedListCategoryExtended.SetItemChecked(3, true); // IsRevealing if ((casPartSrc.clothingCategory & 0x1000000) == 0x1000000) checkedListCategoryExtended.SetItemChecked(4, true); // IsHiddenInCas saveAsToolStripMenuItem.Enabled = true; btnDumpFromFullbuild2.Enabled = true; lstStencilPool.Items.Clear(); // Default all stencil boxes to blank for (int i = 1; i <= 15; i++) { if (stencilPool.Count < i) { stencilPool.Add(new stencilDetails()); } //updateStencilBoxes(i, new stencilDetails()); } // Calculate all the stencils so we can build up the stencil pool int curStencilNum = 1; for (int i = 0; i < casPartSrc.xmlChunk.Count; i++) { if (debugModeToolStripMenuItem.Checked) { Helpers.logMessageToFile(casPartSrc.xmlChunkRaw[i].ToString().Replace("/><", "/>" + Environment.NewLine + "<")); } xmlChunkDetails chunk = (xmlChunkDetails)casPartSrc.xmlChunk[i]; if (!inStencilList(chunk.stencil.A)) { updateStencilBoxes(curStencilNum, chunk.stencil.A); curStencilNum++; } if (!inStencilList(chunk.stencil.B)) { updateStencilBoxes(curStencilNum, chunk.stencil.B); curStencilNum++; } if (!inStencilList(chunk.stencil.C)) { updateStencilBoxes(curStencilNum, chunk.stencil.C); curStencilNum++; } if (!inStencilList(chunk.stencil.D)) { updateStencilBoxes(curStencilNum, chunk.stencil.D); curStencilNum++; } if (!inStencilList(chunk.stencil.E)) { updateStencilBoxes(curStencilNum, chunk.stencil.E); curStencilNum++; } if (!inStencilList(chunk.stencil.F)) { updateStencilBoxes(curStencilNum, chunk.stencil.F); curStencilNum++; } } for (int i = curStencilNum; i <= 15; i++) { //if (stencilPool.Count < i) { stencilPool.Add(new stencilDetails()); } updateStencilBoxes(i, new stencilDetails()); } if (this.casPartSrc.xmlChunkRaw.Count == 0) { label8.Visible = true; listView1.Enabled = false; //btnDumpFromFullbuild2.Enabled = false; btnAddNewDesign.Enabled = false; btnDeleteDesign.Enabled = false; } else { label8.Visible = false; listView1.Enabled = true; //btnDumpFromFullbuild2.Enabled = true; btnAddNewDesign.Enabled = true; btnDeleteDesign.Enabled = true; this.casPartNew = (casPart)OX.Copyable.ObjectExtensions.Copy(casPartSrc); //this.casPartNew = (casPart)casPartSrc.Copy(); if (this.isNew) { this.casPartNew.xmlChunk.Clear(); this.casPartNew.xmlChunkRaw.Clear(); lastSelected = -1; listView1.Items.Clear(); lstTextureDetails.Items.Clear(); lstOtherDetails.Items.Clear(); //btnAddNewDesign_Click(this, null); } } }
public void loadFile(string filename) { //reset initNewFile(); toolStripStatusLabel1.Text = filename; if (debugModeToolStripMenuItem.Checked) { Helpers.logMessageToFile("Opening file " + filename); } casPartFile cPartFile; Stream inputCasPart = new MemoryStream(); ; FileInfo f = new FileInfo(filename); if (f.Extension.ToLower() == ".caspart") { inputCasPart = File.Open(f.FullName, FileMode.Open, FileAccess.Read, FileShare.Read); cPartFile = new casPartFile(); this.casPartSrc = cPartFile.Load(inputCasPart); inputCasPart.Close(); this.isNew = false; this.fromPackage = false; this.stencilPool.Clear(); //this.stencilPool.TrimExcess(); displayCasPartFile(); } else if (f.Extension.ToLower() == ".package") { this.loadedCasPart = MadScience.Package.Search.getKey(f.FullName, (int)0x034AEECB, -1, -1); //inputCasPart = searchInPackage(f.FullName, (int)0x034AEECB, -1, -1); if (this.loadedCasPart.ToString() != "00000000:00000000:0000000000000000") { inputCasPart = MadScience.Package.Search.getStream(f.FullName, "key:" + this.loadedCasPart.ToString()); cPartFile = new casPartFile(); this.casPartSrc = cPartFile.Load(inputCasPart); inputCasPart.Close(); this.isNew = false; this.fromPackage = true; for (int i = 0; i < this.casPartSrc.numParts; i++) { //ResourceKey keyPNG = new ResourceKey(0x626F60CE, thumbGroup, instanceId, (uint)ResourceKeyOrder.ITG); if (MadScience.Package.Search.getKey(f.FullName, 0x626F60CE, 0x0, (long)loadedCasPart.instanceId).ToString() != "00000000:00000000:0000000000000000") { xmlChunkDetails chunk = (xmlChunkDetails)this.casPartSrc.xmlChunk[i]; chunk.hasCustomThumbnail = true; } } Helpers.currentPackageFile = f.FullName; this.stencilPool.Clear(); //this.stencilPool.TrimExcess(); saveToolStripMenuItem.Enabled = true; copyDefaultsToolStripMenuItem.Enabled = false; displayCasPartFile(); reloadTextures(); } else { MessageBox.Show("No CAS Part file can be found in this package!"); } } this.filename = f.Name; makeTitleBar(); saveAsToolStripMenuItem.Enabled = true; }
public PackageType getType(Database db, bool loopAll) { // Do some quick sanity checks switch (db.dbpf.packageType) { case PackageTypes.genericPackage: break; case PackageTypes.corruptBadDownload: case PackageTypes.corruptChaavik: case PackageTypes.corruptIndex: case PackageTypes.corruptPeggy: case PackageTypes.corruptNotADBPF: case PackageTypes.corruptTXTC: this.isCorrupt = true; this.pType.SubType = ""; this.pType.MainType = db.dbpf.packageType; return(this.pType); case PackageTypes.sims3Store: case PackageTypes.sims2Package: case PackageTypes.pngThumbnail: this.pType.SubType = ""; this.pType.MainType = db.dbpf.packageType; return(this.pType); } rc.Clear(); this.pType = new PackageType(); //print(db.dbpf.Entries.Count + " entries found"); for (int i = 0; i < db.dbpf.Entries.Count; i++) { DatabasePackedFile.Entry entry = db.dbpf.Entries[i]; if ((entry.Key.typeId == (uint)ResourceTypes.NULL) && (entry.Key.groupId == (uint)ResourceTypes.NULL) && (entry.Key.instanceId == (uint)ResourceTypes.NULL)) { // Check the first 4 bytes of the stream Stream checkDbpf = db.GetResourceStream(entry.Key); string magic = MadScience.StreamHelpers.ReadStringASCII(checkDbpf, 4); if (magic == "DBPF" || magic == "DBBF") // DBPF & DBBF { this.isCorrupt = true; this.pType.MainType = PackageTypes.corruptRecursive; this.pType.SubType = "This package contains another package inside it."; if (!loopAll) { return(this.pType); } } checkDbpf.Close(); } if (entry.Key.typeId == (uint)ResourceTypes.TXTC) { int isValid = checkValidEntry(entry, db); if (isValid > 0) { if (isValid == 2) { this.isCorrupt = true; this.pType.MainType = PackageTypes.corruptTXTC; if (!loopAll) { return(this.pType); } } } } if (entry.Key.typeId == (uint)ResourceTypes.PTRN) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.patternGeneric; } if (!loopAll) { return(this.pType); } } if (Enum.IsDefined(typeof(ResourceTypes), entry.Key.typeId)) { if (rc.ContainsKey(Enum.GetName(typeof(ResourceTypes), entry.Key.typeId))) { rc[Enum.GetName(typeof(ResourceTypes), entry.Key.typeId)]++; } else { rc.Add(Enum.GetName(typeof(ResourceTypes), entry.Key.typeId), 1); } } } //print("Done"); if (rc.ContainsKey("WLOT") && rc.ContainsKey("UNKW1")) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.neighbourhood; } this.isCorrupt = true; return(this.pType); } if (rc.ContainsKey("WLTL") && rc.ContainsKey("ARY2")) { this.pType.MainType = PackageTypes.lot; return(this.pType); } if (rc.ContainsKey("SIMO") && rc.ContainsKey("SIME") && rc.ContainsKey("SNAP") && rc.ContainsKey("SNAPL")) { this.pType.MainType = PackageTypes.sim; return(this.pType); } //this.pType.MainType = PackageTypes.genericPackage; // Check Objects if (rc.ContainsKey("OBJD")) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.objectGeneric; } Stream objStream = MadScience.Package.Search.getStream(db, 0x319E4F1D, -1, -1); if (StreamHelpers.isValidStream(objStream)) { OBJD objd = new OBJD(objStream); this.pType.SubType = objd.ToString(); objd = null; } return(this.pType); } if (rc.ContainsKey("S3SA")) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.coremod; } } if (rc.ContainsKey("CASP")) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.casPartGeneric; } Stream casStream = MadScience.Package.Search.getStream(db, 0x034AEECB, -1, -1); if (StreamHelpers.isValidStream(casStream)) { casPartFile cFile = new casPartFile(); cFile.Load(casStream); this.pType.SubType = cFile.clothingType(); switch (cFile.casType()) { case "Hair": this.pType.MainType = PackageTypes.casPartHair; break; case "Scalp": break; case "Face Overlay": switch (cFile.clothingType()) { case "Lipstick": case "Eyeshadow": case "Eyeliner": case "Blush": case "Makeup": case "Mascara": this.pType.MainType = PackageTypes.casPartMakeup; break; default: this.pType.MainType = PackageTypes.casPartFaceOverlay; break; } break; case "Body": this.pType.MainType = PackageTypes.casPartClothing; this.pType.SubType = cFile.clothingCategory(); // Check the TYPE of clothing we have switch (cFile.clothingType()) { case "Body": case "Top": case "Bottom": case "Shoes": // Check the age too // If we have Toddler OR Child OR Teen, plus other ages bool ageCorrupt = false; //if ((cFile.cFile.ageGender.baby || cFile.cFile.ageGender.toddler || cFile.cFile.ageGender.child || cFile.cFile.ageGender.teen) && (cFile.cFile.ageGender.youngAdult || cFile.cFile.ageGender.adult || cFile.cFile.ageGender.elder)) //{ // ageCorrupt = true; //} // If we have Baby AND any other age... if (cFile.cFile.ageGender.baby && (cFile.cFile.ageGender.toddler || cFile.cFile.ageGender.child || cFile.cFile.ageGender.teen || cFile.cFile.ageGender.youngAdult || cFile.cFile.ageGender.adult || cFile.cFile.ageGender.elder)) { ageCorrupt = true; } // If we have Toddler AND any other age... if (cFile.cFile.ageGender.toddler && (cFile.cFile.ageGender.child || cFile.cFile.ageGender.teen || cFile.cFile.ageGender.youngAdult || cFile.cFile.ageGender.adult || cFile.cFile.ageGender.elder)) { ageCorrupt = true; } // If we have Child AND any other age if (cFile.cFile.ageGender.child && (cFile.cFile.ageGender.teen || cFile.cFile.ageGender.youngAdult || cFile.cFile.ageGender.adult || cFile.cFile.ageGender.elder)) { ageCorrupt = true; } // If we have Teen AND any other age if (cFile.cFile.ageGender.teen && (cFile.cFile.ageGender.youngAdult || cFile.cFile.ageGender.adult || cFile.cFile.ageGender.elder)) { ageCorrupt = true; } if (ageCorrupt) { this.isCorrupt = true; this.pType.MainType = PackageTypes.corruptBadAges; if (!loopAll) { return(this.pType); } } break; default: break; } break; case "Accessory": this.pType.MainType = PackageTypes.casPartAccessory; break; } this.pType.SubType += " (" + cFile.ageGender() + ")"; } return(this.pType); } if (rc.ContainsKey("FBLN") && rc.ContainsKey("FACE") && rc.ContainsKey("BOND")) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.casSlider; } return(this.pType); } if (rc.ContainsKey("_IMG") && rc.Count == 1) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.textureReplacement; } } if (rc.Count == 1 && (rc.ContainsKey("_XML") || rc.ContainsKey("_XML2"))) { if (this.pType.MainType == PackageTypes.genericPackage) { this.pType.MainType = PackageTypes.xmltuningmod; } } return(this.pType); }
private void button1_Click_1(object sender, EventArgs e) { toolStripProgressBar1.Visible = true; toolStripProgressBar1.Value = 0; toolStripProgressBar1.Minimum = 0; toolStripProgressBar1.Maximum = this.lookupList.Items.Length; for (int i = 0; i < this.lookupList.Items.Length; i++) { toolStripProgressBar1.Value = i; toolStripStatusLabel1.Text = "Generating CAS Part, please wait..." + (i + 1).ToString() + " of " + toolStripProgressBar1.Maximum; statusStrip1.Refresh(); filesFile temp = lookupList.Items[i]; casPartFile cFile = new casPartFile(); Stream cFileOrig = File.OpenRead(Path.Combine(Application.StartupPath, Path.Combine("casparts", temp.fullCasPartname + ".caspart"))); cFile.Load(cFileOrig); cFileOrig.Close(); if (cFile.cFile.xmlChunkRaw.Count == 0) { // Find complate preset XML and load it in String complate = File.ReadAllText(@"P:\Stuart\Desktop\FullBuild0\config\xml\root\" + temp.fullCasPartname + ".xml", System.Text.Encoding.ASCII); cFile.cFile.xmlChunkRaw.Add(complate); cFile.parseRawXML(1); File.Delete(Path.Combine(Application.StartupPath, Path.Combine("casparts", temp.fullCasPartname + ".caspart"))); Stream casPartSave = File.OpenWrite(Path.Combine(Application.StartupPath, Path.Combine("casparts", temp.fullCasPartname + ".caspart"))); cFile.Save(casPartSave, cFile.cFile, false); casPartSave.Close(); Console.WriteLine("Finished writing " + cFile.cFile.meshName + ".caspart"); } } toolStripProgressBar1.Visible = false; }
private void showMeshDetails() { string meshName = ""; // Translate selection back into af am etc switch (cmbSimAge.Text) { case "Baby": meshName += "b"; break; case "Toddler": meshName += "p"; break; case "Child": meshName += "c"; break; case "Teen": meshName += "t"; break; case "Young Adult": meshName += "y"; break; case "Adult": meshName += "a"; break; case "Elder": meshName += "e"; break; case "All Ages": meshName += "u"; break; } switch (cmbSimGender.Text) { case "Female": meshName += "f"; break; case "Male": meshName += "m"; break; case "Unisex": meshName += "u"; break; } if (cmbMeshName.Text == "* Custom") { //if (this.isNew == false) //{ //meshName += casPartSrc.meshName; //} txtCasPartName.Text = casPartSrc.meshName; txtMeshName.Text = casPartSrc.meshName; txtCasPartInstance.Text = "0x" + MadScience.StringHelpers.HashFNV64(meshName).ToString("X16"); picMeshPreview.Image = null; picMeshPreview.Invalidate(); } else { if (cmbPartTypes.Text == "(none)") { meshName += cmbMeshName.Text; } else { meshName += cmbPartTypes.Text + cmbMeshName.Text; } txtCasPartName.Text = meshName; txtMeshName.Text = meshName; scrollPanelToThumb(meshName); for (int i = 0; i < this.lookupList.Items.Length; i++) { filesFile f = lookupList.Items[i]; if (f.fullCasPartname == meshName) { txtCasPartInstance.Text = f.instanceid; break; } } picMeshPreview.Image = null; picMeshPreview.Invalidate(); // Find thumbnail if (File.Exists(Path.Combine(Application.StartupPath, Path.Combine("cache", meshName + ".png")))) { Stream picMeshPreviewStream = File.OpenRead(Path.Combine(Application.StartupPath, Path.Combine("cache", meshName + ".png"))); picMeshPreview.Image = Image.FromStream(picMeshPreviewStream); picMeshPreviewStream.Close(); } else { extractCASThumbnail(meshName); } } if (this.isNew == true) { // Attempt to load the existing caspart into memory so we can extract data later. Stream casPartFile = File.Open(Path.Combine(Application.StartupPath, Path.Combine("casparts", txtCasPartName.Text + ".caspart")), FileMode.Open, FileAccess.Read, FileShare.Read); casPartFile cPartFile = new casPartFile(); this.casPartSrc = cPartFile.Load(casPartFile); casPartFile.Close(); } for (int i = 0; i < checkedListAge.Items.Count; i++) { checkedListAge.SetItemChecked(i, false); } for (int i = 0; i < checkedListCategory.Items.Count; i++) { checkedListCategory.SetItemChecked(i, false); } for (int i = 0; i < checkedListCategoryExtended.Items.Count; i++) { checkedListCategoryExtended.SetItemChecked(i, false); } for (int i = 0; i < checkedListGender.Items.Count; i++) { checkedListGender.SetItemChecked(i, false); } for (int i = 0; i < checkedListOther.Items.Count; i++) { checkedListOther.SetItemChecked(i, false); } for (int i = 0; i < checkedListType.Items.Count; i++) { checkedListType.SetItemChecked(i, false); } // Get the Mesh links for the first LOD Stream meshStream = Stream.Null; // Use the VPXY to get the mesh lod Stream vpxyStream = KeyUtils.findKey(casPartSrc.tgi64list[casPartSrc.tgiIndexVPXY], 0); if (StreamHelpers.isValidStream(vpxyStream)) { VPXYFile vpxyFile = new VPXYFile(vpxyStream); // Get the first VPXY internal link if (vpxyFile.vpxy.linkEntries.Count >= 1 && vpxyFile.vpxy.linkEntries[0].tgiList.Count >= 1) { meshStream = KeyUtils.findKey(vpxyFile.vpxy.linkEntries[0].tgiList[0], 0); } vpxyStream.Close(); } if (StreamHelpers.isValidStream(meshStream)) { lstMeshTGILinks.Items.Clear(); SimGeomFile simgeomfile = new SimGeomFile(meshStream); // Always put the bumpmap in the first position and get it from the MTNF //int bumpmapPos = -1; //int tgiAddNo = 0; for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++) { if (simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash == (uint)FieldTypes.NormalMap) { ListViewItem item = new ListViewItem(); item.SubItems.Add(Enum.GetName(typeof(FieldTypes), simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash)); item.Text = simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].ToString(); if (simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } //bumpmapPos = (int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]; lstMeshTGILinks.Items.Add(item); break; } } for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++) { if (simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash != (uint)FieldTypes.NormalMap) { foreach (uint fieldHash in Enum.GetValues(typeof(FieldTypes))) { if (fieldHash == simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash) { if (simgeomfile.simgeom.mtnfChunk.entries[i].dwords.Count > 0) { ListViewItem item = new ListViewItem(); item.SubItems.Add(Enum.GetName(typeof(FieldTypes), fieldHash)); item.Text = simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].ToString(); if (simgeomfile.simgeom.keytable.keys[(int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]].typeId == 0x00B2D882) { item.Tag = "texture"; } else { item.Tag = ""; } lstMeshTGILinks.Items.Add(item); } break; } } } } /* * if (bumpmapPos > -1) * { * ListViewItem item = new ListViewItem(); * item.SubItems.Add("Bump Map"); * item.Text = simgeomfile.simgeom.keytable.keys[bumpmapPos].ToString(); * if (simgeomfile.simgeom.keytable.keys[bumpmapPos].typeId == 0x00B2D882) * { * item.Tag = "texture"; * } * else * { * item.Tag = ""; * } * lstMeshTGILinks.Items.Add(item); * tgiAddNo++; * } * * for (int i = 0; i < simgeomfile.simgeom.keytable.keys.Count; i++) * { * if (i != bumpmapPos) * { * ListViewItem item = new ListViewItem(); * tgiAddNo++; * //item.SubItems.Add("TGI #" + tgiAddNo); * //item.SubItems.Add("TGI #" + (i + 1)); * item.Text = simgeomfile.simgeom.keytable.keys[i].ToString(); * if (simgeomfile.simgeom.keytable.keys[i].typeId == 0x00B2D882) * { * item.Tag = "texture"; * } * else * { * item.Tag = ""; * } * lstMeshTGILinks.Items.Add(item); * } * } */ } lstCasPartDetails.Items.Clear(); // Populate the CAS Part Details addCasPartItem("Mesh Name", casPartSrc.meshName); toolStripStatusLabel2.Text = casPartSrc.meshName; addCasPartItem("Clothing Order", casPartSrc.clothingOrder.ToString()); addCasPartItem("CAS Part Type", casPartSrc.clothingType.ToString() + " (0x" + casPartSrc.clothingType.ToString("X8") + ")"); addCasPartItem("Type", casPartSrc.typeFlag.ToString() + " (0x" + casPartSrc.typeFlag.ToString("X8") + ")"); addCasPartItem("Age/Gender", casPartSrc.ageGenderFlag.ToString() + " (0x" + casPartSrc.ageGenderFlag.ToString("X8") + ")"); addCasPartItem("Clothing Category", casPartSrc.clothingCategory.ToString() + " (0x" + casPartSrc.clothingCategory.ToString("X8") + ")"); addCasPartItem("Unk String", casPartSrc.unkString); addCasPartItem("Unk2", casPartSrc.unk2.ToString()); addCasPartItem("TGI Index Body Part 1", casPartSrc.tgiIndexBodyPart1.ToString()); addCasPartItem("TGI Index Body Part 2", casPartSrc.tgiIndexBodyPart2.ToString()); addCasPartItem("TGI Index Blend Info Fat", casPartSrc.tgiIndexBlendInfoFat.ToString()); addCasPartItem("TGI Index Blend Info Fit", casPartSrc.tgiIndexBlendInfoFit.ToString()); addCasPartItem("TGI Index Blend Info Thin", casPartSrc.tgiIndexBlendInfoThin.ToString()); addCasPartItem("TGI Index Blend Info Special", casPartSrc.tgiIndexBlendInfoSpecial.ToString()); addCasPartItem("Unk5", casPartSrc.unk5.ToString()); addCasPartItem("VPXY", casPartSrc.tgiIndexVPXY.ToString()); //tgi64 tempvpxy = (tgi64)casPartSrc.tgi64list[casPartSrc.tgiIndexVPXY]; //txtVPXYPrimary.Text = "key:" + tempvpxy.typeid.ToString("X8") + ":" + tempvpxy.groupid.ToString("X8") + ":" + tempvpxy.instanceid.ToString("X16"); addCasPartItem("Count 2", casPartSrc.count2.ToString()); for (int i = 0; i < casPartSrc.count2; i++) { unkRepeat unk = (unkRepeat)casPartSrc.count2repeat[i]; addCasPartItem("#" + i.ToString() + ": unkNum ", unk.unkNum.ToString()); addCasPartItem("#" + i.ToString() + ": unk2", unk.unk2.ToString()); addCasPartItem("#" + i.ToString() + ": unkRepeatInner", unk.unkRepeatInnerCount.ToString()); for (int j = 0; j < unk.unkRepeatInnerCount; j++) { intTriple iT = (intTriple)unk.unkRepeatInnerLoop[j]; addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": One", iT.one.ToString()); addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": Two", iT.two.ToString()); addCasPartItem("#" + i.ToString() + "." + j.ToString() + ": Three", iT.three.ToString()); } } addCasPartItem("TGI Index Diffuse", casPartSrc.tgiIndexDiffuse.ToString()); addCasPartItem("TGI Index Specular", casPartSrc.tgiIndexSpecular.ToString()); addCasPartItem("Diffuse Links", casPartSrc.count3.ToString()); for (int i = 0; i < casPartSrc.count3; i++) { byte cRepeat = (byte)casPartSrc.count3repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } addCasPartItem("Specular Links", casPartSrc.count4.ToString()); for (int i = 0; i < casPartSrc.count4; i++) { byte cRepeat = (byte)casPartSrc.count4repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } addCasPartItem("Count 5", casPartSrc.count5.ToString()); for (int i = 0; i < casPartSrc.count5; i++) { byte cRepeat = (byte)casPartSrc.count5repeat[i]; addCasPartItem("#" + i.ToString(), cRepeat.ToString()); } for (int i = 0; i < chkDesignType.Items.Count; i++) { chkDesignType.SetItemChecked(i, false); } for (int i = 0; i < casPartSrc.count6; i++) { MadScience.Wrappers.ResourceKey tgi = casPartSrc.tgi64list[i]; string tgiType = MadScience.Helpers.findMetaEntry(tgi.typeId).shortName; Console.WriteLine(tgi.typeId.ToString() + " " + tgiType); if (tgi.typeId == 0x0333406C) { if (tgi.instanceId == 0x52E8BE209C703561) { chkDesignType.SetItemChecked(0, true); } if (tgi.instanceId == 0xE37696463F6B2D6E) { chkDesignType.SetItemChecked(1, true); } if (tgi.instanceId == 0x01625DDC220C08C6) { chkDesignType.SetItemChecked(2, true); } } addCasPartItem("TGI #" + i.ToString() + " " + tgiType, tgi.ToString()); } // Category flags if ((casPartSrc.typeFlag & 0x1) == 0x1) { checkedListType.SetItemChecked(0, true); // Hair } if ((casPartSrc.typeFlag & 0x2) == 0x2) { checkedListType.SetItemChecked(1, true); // Scalp } if ((casPartSrc.typeFlag & 0x4) == 0x4) { checkedListType.SetItemChecked(2, true); // Face Overlay } if ((casPartSrc.typeFlag & 0x8) == 0x8) { checkedListType.SetItemChecked(3, true); // Body } if ((casPartSrc.typeFlag & 0x10) == 0x10) { checkedListType.SetItemChecked(4, true); // Accessory } switch (casPartSrc.clothingType) { case 1: checkedListClothingType.SetItemChecked(0, true); break; case 2: checkedListClothingType.SetItemChecked(1, true); break; case 3: checkedListClothingType.SetItemChecked(2, true); break; case 4: checkedListClothingType.SetItemChecked(3, true); break; case 5: checkedListClothingType.SetItemChecked(4, true); break; case 6: checkedListClothingType.SetItemChecked(5, true); break; case 7: checkedListClothingType.SetItemChecked(6, true); break; case 11: checkedListClothingType.SetItemChecked(7, true); break; case 12: checkedListClothingType.SetItemChecked(8, true); break; case 13: checkedListClothingType.SetItemChecked(9, true); break; case 14: checkedListClothingType.SetItemChecked(10, true); break; case 15: checkedListClothingType.SetItemChecked(11, true); break; case 16: checkedListClothingType.SetItemChecked(12, true); break; case 17: checkedListClothingType.SetItemChecked(13, true); break; case 18: checkedListClothingType.SetItemChecked(14, true); break; case 19: checkedListClothingType.SetItemChecked(15, true); break; case 20: checkedListClothingType.SetItemChecked(16, true); break; case 21: checkedListClothingType.SetItemChecked(17, true); break; case 22: checkedListClothingType.SetItemChecked(18, true); break; case 24: checkedListClothingType.SetItemChecked(19, true); break; case 25: checkedListClothingType.SetItemChecked(20, true); break; case 26: checkedListClothingType.SetItemChecked(21, true); break; case 29: checkedListClothingType.SetItemChecked(22, true); break; case 30: checkedListClothingType.SetItemChecked(23, true); break; case 31: checkedListClothingType.SetItemChecked(24, true); break; } if ((casPartSrc.ageGenderFlag & 0x1) == 0x1) { checkedListAge.SetItemChecked(0, true); // Baby } if ((casPartSrc.ageGenderFlag & 0x2) == 0x2) { checkedListAge.SetItemChecked(1, true); // Toddler } if ((casPartSrc.ageGenderFlag & 0x4) == 0x4) { checkedListAge.SetItemChecked(2, true); // Child } if ((casPartSrc.ageGenderFlag & 0x8) == 0x8) { checkedListAge.SetItemChecked(3, true); // Teen } if ((casPartSrc.ageGenderFlag & 0x10) == 0x10) { checkedListAge.SetItemChecked(4, true); // YoungAdult } if ((casPartSrc.ageGenderFlag & 0x20) == 0x20) { checkedListAge.SetItemChecked(5, true); // Adult } if ((casPartSrc.ageGenderFlag & 0x40) == 0x40) { checkedListAge.SetItemChecked(6, true); // Elder } if ((casPartSrc.ageGenderFlag & 0x1000) == 0x1000) { checkedListGender.SetItemChecked(0, true); // Male } if ((casPartSrc.ageGenderFlag & 0x2000) == 0x2000) { checkedListGender.SetItemChecked(1, true); // Female } if ((casPartSrc.ageGenderFlag & 0x100000) == 0x100000) { checkedListOther.SetItemChecked(0, true); // LeftHanded } if ((casPartSrc.ageGenderFlag & 0x200000) == 0x200000) { checkedListOther.SetItemChecked(1, true); // RightHanded } if ((casPartSrc.ageGenderFlag & 0x10000) == 0x10000) { checkedListOther.SetItemChecked(2, true); // Human } if ((casPartSrc.clothingCategory & 0x1) == 0x1) { checkedListCategory.SetItemChecked(0, true); // Naked } if ((casPartSrc.clothingCategory & 0x2) == 0x2) { checkedListCategory.SetItemChecked(1, true); // Everyday } if ((casPartSrc.clothingCategory & 0x4) == 0x4) { checkedListCategory.SetItemChecked(2, true); // Formalwear } if ((casPartSrc.clothingCategory & 0x8) == 0x8) { checkedListCategory.SetItemChecked(3, true); // Sleepwear } if ((casPartSrc.clothingCategory & 0x10) == 0x10) { checkedListCategory.SetItemChecked(4, true); // Swimwear } if ((casPartSrc.clothingCategory & 0x20) == 0x20) { checkedListCategory.SetItemChecked(5, true); // Athletic } if ((casPartSrc.clothingCategory & 0x40) == 0x40) { checkedListCategory.SetItemChecked(6, true); // Singed } if ((casPartSrc.clothingCategory & 0x100) == 0x100) { checkedListCategory.SetItemChecked(7, true); // Career } if ((casPartSrc.clothingCategory & 0xFFFF) == 0xFFFF) { checkedListCategory.SetItemChecked(8, true); // All } if ((casPartSrc.clothingCategory & 0x100000) == 0x100000) { checkedListCategoryExtended.SetItemChecked(0, true); // ValidForMaternity } if ((casPartSrc.clothingCategory & 0x200000) == 0x200000) { checkedListCategoryExtended.SetItemChecked(1, true); // ValidForRandom } if ((casPartSrc.clothingCategory & 0x400000) == 0x400000) { checkedListCategoryExtended.SetItemChecked(2, true); // IsHat } if ((casPartSrc.clothingCategory & 0x800000) == 0x800000) { checkedListCategoryExtended.SetItemChecked(3, true); // IsRevealing } if ((casPartSrc.clothingCategory & 0x1000000) == 0x1000000) { checkedListCategoryExtended.SetItemChecked(4, true); // IsHiddenInCas } saveAsToolStripMenuItem.Enabled = true; btnDumpFromFullbuild2.Enabled = true; lstStencilPool.Items.Clear(); // Default all stencil boxes to blank for (int i = 1; i <= 15; i++) { if (stencilPool.Count < i) { stencilPool.Add(new stencilDetails()); } //updateStencilBoxes(i, new stencilDetails()); } // Calculate all the stencils so we can build up the stencil pool int curStencilNum = 1; for (int i = 0; i < casPartSrc.xmlChunk.Count; i++) { if (debugModeToolStripMenuItem.Checked) { Helpers.logMessageToFile(casPartSrc.xmlChunkRaw[i].ToString().Replace("/><", "/>" + Environment.NewLine + "<")); } xmlChunkDetails chunk = (xmlChunkDetails)casPartSrc.xmlChunk[i]; if (!inStencilList(chunk.stencil.A)) { updateStencilBoxes(curStencilNum, chunk.stencil.A); curStencilNum++; } if (!inStencilList(chunk.stencil.B)) { updateStencilBoxes(curStencilNum, chunk.stencil.B); curStencilNum++; } if (!inStencilList(chunk.stencil.C)) { updateStencilBoxes(curStencilNum, chunk.stencil.C); curStencilNum++; } if (!inStencilList(chunk.stencil.D)) { updateStencilBoxes(curStencilNum, chunk.stencil.D); curStencilNum++; } if (!inStencilList(chunk.stencil.E)) { updateStencilBoxes(curStencilNum, chunk.stencil.E); curStencilNum++; } if (!inStencilList(chunk.stencil.F)) { updateStencilBoxes(curStencilNum, chunk.stencil.F); curStencilNum++; } } for (int i = curStencilNum; i <= 15; i++) { //if (stencilPool.Count < i) { stencilPool.Add(new stencilDetails()); } updateStencilBoxes(i, new stencilDetails()); } if (this.casPartSrc.xmlChunkRaw.Count == 0) { label8.Visible = true; listView1.Enabled = false; //btnDumpFromFullbuild2.Enabled = false; btnAddNewDesign.Enabled = false; btnDeleteDesign.Enabled = false; } else { label8.Visible = false; listView1.Enabled = true; //btnDumpFromFullbuild2.Enabled = true; btnAddNewDesign.Enabled = true; btnDeleteDesign.Enabled = true; this.casPartNew = (casPart)OX.Copyable.ObjectExtensions.Copy(casPartSrc); //this.casPartNew = (casPart)casPartSrc.Copy(); if (this.isNew) { this.casPartNew.xmlChunk.Clear(); this.casPartNew.xmlChunkRaw.Clear(); lastSelected = -1; listView1.Items.Clear(); lstTextureDetails.Items.Clear(); lstOtherDetails.Items.Clear(); //btnAddNewDesign_Click(this, null); } } }