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); }
void AddUniversityFields(SimPe.PackedFiles.Wrapper.Cpf cpf) { if (cpf.GetItem("product") == null) { SimPe.PackedFiles.Wrapper.CpfItem i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "product"; i.UIntegerValue = 1; cpf.AddItem(i); } if (cpf.GetItem("version") == null) { SimPe.PackedFiles.Wrapper.CpfItem i = new SimPe.PackedFiles.Wrapper.CpfItem(); i.Name = "version"; i.UIntegerValue = 2; cpf.AddItem(i); } }
/// <summary> /// Searches BHAV Files /// </summary> /// <param name="pfd"></param> /// <param name="package"></param> /// <param name="prov"></param> /// <returns>Null if no match or a valid SearchItem Object</returns> public SearchItem GzpsSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov) { ushort opcode = Convert.ToUInt16(this.tbOpcode.Text, 16); SimPe.PackedFiles.Wrapper.Cpf cpf = new SimPe.PackedFiles.Wrapper.Cpf(); cpf.ProcessData(pfd, package); //foreach (SimPe.PackedFiles.Wrapper.CpfItem i in cpf.Items) { bool check = false; string s1 = cpf.GetSaveItem(tbpropname.Text).StringValue.Trim().ToLower(); //i.StringValue.Trim().ToLower(); string s2 = tbpropval.Text.Trim().ToLower(); if (rbfull.Checked) { check = (s1 == s2); } if (rbstart.Checked) { check = (s1.StartsWith(s2)); } if (rbend.Checked) { check = (s1.EndsWith(s2)); } if (rbcont.Checked) { check = (s1.IndexOf(s2) != -1); } if (check) { return(new SearchItem(cpf.FileDescriptor.ToString(), pfd)); } } return(null); }
internal Gene(Cpf dna, uint b) { this.dna = dna; this.b = b; }