protected LevelInfo SelectedImageData() { //add a MipMapBlock if it doesnt already exist LevelInfo id = null; if (cbitem.SelectedIndex < 0) { Lifo wrp = (Lifo)wrapper; id = new LevelInfo(wrp); id.NameResource.FileName = "Unknown"; id.Format = (ImageLoader.TxtrFormats)cbformats.SelectedItem; IRcolBlock[] irc = new IRcolBlock[wrp.Blocks.Length + 1]; wrp.Blocks.CopyTo(irc, 0); irc[irc.Length - 1] = id; wrp.Blocks = irc; cbitem.Items.Add(id); cbitem.SelectedIndex = cbitem.Items.Count - 1; } else { id = (LevelInfo)cbitem.Items[cbitem.SelectedIndex]; } return(id); }
protected LevelInfo SelectedLevelInfo() { //add a MipMapBlock if it doesnt already exist LevelInfo li = null; if (cbitem.SelectedIndex < 0) { Lifo wrp = (Lifo)wrapper; li = new LevelInfo(wrp); li.NameResource.FileName = "Unknown"; IRcolBlock[] irc = new IRcolBlock[wrp.Blocks.Length + 1]; wrp.Blocks.CopyTo(irc, 0); irc[irc.Length - 1] = li; wrp.Blocks = irc; cbitem.Items.Add(li); cbitem.SelectedIndex = cbitem.Items.Count - 1; } else { li = (LevelInfo)cbitem.Items[cbitem.SelectedIndex]; } return(li); }
private void btcommit_Click(object sender, System.EventArgs e) { try { Lifo wrp = (Lifo)wrapper; wrp.SynchronizeUserData(); MessageBox.Show(Localization.Manager.GetString("commited")); } catch (Exception ex) { Helper.ExceptionMessage(Localization.Manager.GetString("errwritingfile"), ex); } }
/// <summary> /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so /// you should updatet the Data displayed by the Panel with the Attributes stored in the /// passed Wrapper. /// </summary> /// <param name="wrapper">The Attributes of this Wrapper have to be displayed</param> public void UpdateGUI(IFileWrapper wrapper) { Lifo wrp = (Lifo)wrapper; form.wrapper = wrp; form.cbitem.Items.Clear(); foreach (LevelInfo id in wrp.Blocks) { form.cbitem.Items.Add(id); } if (form.cbitem.Items.Count >= 0) { form.cbitem.SelectedIndex = 0; } }
/// <summary> /// /// </summary> /// <param name="map"></param> /// <param name="rcol"></param> public void FixResource(Hashtable map, Rcol rcol) { switch (rcol.FileDescriptor.Type) { case Data.MetaData.TXMT: //MATD { MaterialDefinition matd = (MaterialDefinition)rcol.Blocks[0]; FixTxtrRef("stdMatBaseTextureName", matd, map, rcol); FixTxtrRef("stdMatNormalMapTextureName", matd, map, rcol); break; } case Data.MetaData.SHPE: //SHPE { Shape shp = (Shape)rcol.Blocks[0]; foreach (ShapeItem item in shp.Items) { string newref = (string)map[Hashes.StripHashFromName(item.FileName.Trim().ToLower())]; if (newref != null) { item.FileName = "##0x" + Helper.HexString(Data.MetaData.CUSTOM_GROUP) + "!" + newref; } } foreach (ShapePart part in shp.Parts) { string newref = (string)map[Hashes.StripHashFromName(part.FileName.Trim().ToLower()) + "_txmt"]; if (newref != null) { part.FileName = "##0x" + Helper.HexString(Data.MetaData.CUSTOM_GROUP) + "!" + newref.Substring(0, newref.Length - 5); } } break; } case Data.MetaData.TXTR: //TXTR { ImageData id = (ImageData)rcol.Blocks[0]; foreach (SimPe.Plugin.MipMapBlock mmb in id.MipMapBlocks) { foreach (MipMap mm in mmb.MipMaps) { //this is a Lifo Reference if (mm.Texture == null) { Interfaces.Files.IPackedFileDescriptor[] pfd = package.FindFile(mm.LifoFile, 0xED534136); if (pfd.Length > 0) { Lifo lifo = new Lifo(null, false); lifo.ProcessData(pfd[0], package); LevelInfo li = (LevelInfo)lifo.Blocks[0]; mm.Texture = null; mm.Data = li.Data; pfd[0].MarkForDelete = true; } else { string newref = Hashes.StripHashFromName((string)map[mm.LifoFile.Trim().ToLower()]); if (newref != null) { mm.LifoFile = "##0x" + Helper.HexString(Data.MetaData.CUSTOM_GROUP) + "!" + newref; } } } } } break; } case Data.MetaData.CRES: //CRES { ResourceNode rn = (ResourceNode)rcol.Blocks[0]; string name = Hashes.StripHashFromName(rcol.FileName); if (ver == FixVersion.UniversityReady2) { rn.GraphNode.FileName = name; } else if (ver == FixVersion.UniversityReady) { rn.GraphNode.FileName = "##0x1c050000!" + name; } break; } case Data.MetaData.GMND: //GMND { GeometryNode gn = (GeometryNode)rcol.Blocks[0]; string name = Hashes.StripHashFromName(rcol.FileName); if (ver == FixVersion.UniversityReady2) { gn.ObjectGraphNode.FileName = name; } else if (ver == FixVersion.UniversityReady) { gn.ObjectGraphNode.FileName = "##0x1c050000!" + name; } break; } case Data.MetaData.LDIR: case Data.MetaData.LAMB: case Data.MetaData.LPNT: case Data.MetaData.LSPT: { DirectionalLight dl = (DirectionalLight)rcol.Blocks[0]; dl.LightT.NameResource.FileName = dl.NameResource.FileName; break; } } }