void ReadNames() { while (names.Count > 0) { NamedPackedFileDescriptor pfd = null; lock (names) { if (names.Count == 0) { break; } pfd = names.Pop(); if (Helper.WindowsRegistry.AsynchronSort) { SimPe.Wait.Progress = counter++; } } pfd.GetRealName(); } lock (names) { started--; if (started == 0) { parent.SignalFinishedSort(handle, ticket); } } }
internal ResourceListItemExt(NamedPackedFileDescriptor pfd, ResourceViewManager manager, bool visible) : base() { this.vis = visible; if (regular == null) { regular = new System.Drawing.Font(Font.FontFamily, Font.Size, System.Drawing.FontStyle.Regular, Font.Unit); strike = new System.Drawing.Font(Font.FontFamily, Font.Size, System.Drawing.FontStyle.Strikeout, Font.Unit); } this.manager = manager; this.pfd = pfd; string[] subitems = new string[7]; subitems[0] = visible ? pfd.GetRealName() : pfd.Descriptor.ToResListString(); // Name subitems[1] = GetExtText(); // Type subitems[2] = "0x" + Helper.HexString(pfd.Descriptor.Group); // Group subitems[3] = "0x" + Helper.HexString(pfd.Descriptor.SubType); // InstHi // Inst if (Helper.WindowsRegistry.ResourceListInstanceFormatHexOnly) { subitems[4] = "0x" + Helper.HexString(pfd.Descriptor.Instance); } else if (Helper.WindowsRegistry.ResourceListInstanceFormatDecOnly) { subitems[4] = ((int)pfd.Descriptor.Instance).ToString(); } else { subitems[4] = "0x" + Helper.HexString(pfd.Descriptor.Instance) + " (" + ((int)pfd.Descriptor.Instance).ToString() + ")"; } subitems[5] = "0x" + Helper.HexString(pfd.Descriptor.Offset); subitems[6] = "0x" + Helper.HexString(pfd.Descriptor.Size); this.SubItems.Clear(); this.Text = (string)subitems[0]; for (int i = 1; i < subitems.Length; i++) { SubItems.Add(subitems[i]); } this.ImageIndex = ResourceViewManager.GetIndexForResourceType(pfd.Descriptor.Type); /*pfd.Descriptor.ChangedData += new SimPe.Events.PackedFileChanged(Descriptor_ChangedData); * pfd.Descriptor.ChangedUserData += new SimPe.Events.PackedFileChanged(Descriptor_ChangedUserData); * pfd.Descriptor.DescriptionChanged += new EventHandler(Descriptor_DescriptionChanged);*/ ChangeDescription(true); }
protected void OnChangedPackage(SimPe.Interfaces.Files.IPackageFile oldpkg, SimPe.Interfaces.Files.IPackageFile newpkg, bool lettreeviewselect) { lock (maps) { if (lv != null) { lv.BeginUpdate(); } if (oldpkg != null) { oldpkg.SavedIndex -= new EventHandler(newpkg_SavedIndex); oldpkg.RemovedResource -= new EventHandler(newpkg_RemovedResource); oldpkg.AddedResource -= new EventHandler(newpkg_AddedResource); } maps.Clear(); if (newpkg != null) { if (Helper.WindowsRegistry.ShowProgressWhenPackageLoads || !Helper.WindowsRegistry.AsynchronSort) { Wait.Start(newpkg.Index.Length); } else { Wait.Start(); } Wait.Message = SimPe.Localization.GetString("Loading package..."); int ct = 0; foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in newpkg.Index) { NamedPackedFileDescriptor npfd = new NamedPackedFileDescriptor(pfd, newpkg); if (!Helper.WindowsRegistry.AsynchronSort) { npfd.GetRealName(); } maps.Everything.Add(npfd); AddResourceToMaps(npfd); if (Helper.WindowsRegistry.ShowProgressWhenPackageLoads || !Helper.WindowsRegistry.AsynchronSort) { Wait.Progress = ct++; } } Wait.Stop(); } UpdateContent(lettreeviewselect); if (newpkg != null) { newpkg.AddedResource += new EventHandler(newpkg_AddedResource); newpkg.RemovedResource += new EventHandler(newpkg_RemovedResource); newpkg.SavedIndex += new EventHandler(newpkg_SavedIndex); } if (lv != null) { lv.EndUpdate(); } } }
/// <summary> /// Set the Description for this ListViewItem /// </summary> void ChangeDescription(bool justfont) { if (!justfont) { pfd.ResetRealName(); if (Visible) { this.Text = pfd.GetRealName(); } else { this.Text = pfd.Descriptor.ToResListString(); } if (Helper.WindowsRegistry.ResourceListShowExtensions) { this.SubItems[1].Text = GetExtText(); } this.SubItems[2].Text = "0x" + Helper.HexString(pfd.Descriptor.Group); this.SubItems[3].Text = "0x" + Helper.HexString(pfd.Descriptor.SubType); if (Helper.WindowsRegistry.ResourceListInstanceFormatHexOnly) { this.SubItems[4].Text = "0x" + Helper.HexString(pfd.Descriptor.Instance); } else if (Helper.WindowsRegistry.ResourceListInstanceFormatDecOnly) { this.SubItems[4].Text = ((int)pfd.Descriptor.Instance).ToString(); } else { this.SubItems[4].Text = "0x" + Helper.HexString(pfd.Descriptor.Instance) + " (" + ((int)pfd.Descriptor.Instance).ToString() + ")"; } this.SubItems[5].Text = "0x" + Helper.HexString(pfd.Descriptor.Offset); this.SubItems[6].Text = "0x" + Helper.HexString(pfd.Descriptor.Size); } System.Drawing.Color fg = System.Drawing.SystemColors.WindowText; System.Drawing.Font font = regular; if (pfd.Descriptor.MarkForDelete) { fg = System.Drawing.SystemColors.GrayText; font = strike; } if (pfd.Descriptor.MarkForReCompress || (pfd.Descriptor.WasCompressed && !pfd.Descriptor.HasUserdata)) { fg = System.Drawing.SystemColors.Highlight; //font = new System.Drawing.Font(font.FontFamily, font.Size, font.Style, font.Unit); } if (pfd.Descriptor.MarkForReCompress) { font = new System.Drawing.Font(font.FontFamily, font.Size, font.Style | System.Drawing.FontStyle.Bold, font.Unit); } if (pfd.Descriptor.Changed) { font = new System.Drawing.Font(font.FontFamily, font.Size, font.Style | System.Drawing.FontStyle.Italic, font.Unit); } this.Font = font; this.ForeColor = fg; }