//private void PreviewProps(int n) //{ // PCCObject.ExportEntry ent = pcc.Exports[n]; // List<SaltPropertyReader.Property> props = SaltPropertyReader.getPropList(pcc, ent.Data); // rtb1.Visible = true; // string s = ""; // s += "ObjectName : " + ent.ObjectName + "\n"; // s += "Class : " + ent.ClassName + "\n"; // s += "Data size : 0x" + ent.DataSize.ToString("X8") + "\n"; // s += "Data offset : 0x" + ent.DataOffset.ToString("X8") + "\n\nProperties: \n"; // foreach (SaltPropertyReader.Property p in props) // s += SaltPropertyReader.PropertyToText(p, pcc) + "\n"; // if (ent.ClassName == "Texture2D" || ent.ClassName == "LightMapTexture2D" || ent.ClassName == "TextureFlipBook") // { // s += "\nImage Info: \n"; // try // { // Texture2D tex2D = new Texture2D(pcc, n, Path.Combine(ME2Directory.gamePath, "BIOGame")); // for (int i = 0; i < tex2D.imgList.Count; i++) // { // s += i + ": Location: " + tex2D.imgList[i].storageType + ", Offset: " + tex2D.imgList[i].offset + ", ImgSize: " + tex2D.imgList[i].imgSize.ToString() + ", CprSize = " + tex2D.imgList[i].cprSize + ", UncSize = " + tex2D.imgList[i].uncSize + "\n"; // } // } // catch { } // } // rtb1.Text = s; // Status.Text = ent.ClassName + " Offset: " + ent.DataOffset + " - " + (ent.DataOffset + ent.DataSize); //} public void PreviewProps() { int n = GetSelected(); if (n == -1 || !(CurrentView == 2 || CurrentView == 3)) { return; } List <SaltPropertyReader.Property> p; //propGrid.Visible = true; //hb1.Visible = false; //rtb1.Visible = false; //treeView1.Visible = false; switch (pcc.Exports[n].ClassName) { default: byte[] buff = pcc.Exports[n].Data; p = SaltPropertyReader.getPropList(pcc, buff); break; } pg = new PropGrid(); propGrid.SelectedObject = pg; pg.Add(new CustomProperty("Name", "_Meta", pcc.Exports[n].ObjectName, typeof(string), true, true)); pg.Add(new CustomProperty("Class", "_Meta", pcc.Exports[n].ClassName, typeof(string), true, true)); pg.Add(new CustomProperty("Data Offset", "_Meta", pcc.Exports[n].DataOffset, typeof(int), true, true)); pg.Add(new CustomProperty("Data Size", "_Meta", pcc.Exports[n].DataSize, typeof(int), true, true)); for (int l = 0; l < p.Count; l++) { pg.Add(SaltPropertyReader.PropertyToGrid(p[l], pcc)); } propGrid.Refresh(); propGrid.ExpandAllGridItems(); //UpdateStatusEx(n); }
void ILanguageSwitcher.RefreshLanguage() { string format = LocalizationHelper.GetString("PropertyDetails") + "({0})..."; int length = (_objs == null) ? 0 : _objs.Length; EditButton.Content = string.Format(format, length); PropGrid.Refresh(); }
public MainWindow() { InitializeComponent(); pg = ttt; ss.Add("A"); ss.Add("B"); ss.Add("C"); EObjectType e = (EObjectType)Enum.Parse(typeof(EObjectType), "1"); }
private void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue) { // Remove handler for oldValue.CollectionChanged if (oldValue != null) { ((ObservableCollection <object>)oldValue).CollectionChanged -= new NotifyCollectionChangedEventHandler(newValueINotifyCollectionChanged_CollectionChanged); } // Add handler for newValue.CollectionChanged (if possible) if (null != newValue) { ((ObservableCollection <object>)newValue).CollectionChanged += new NotifyCollectionChangedEventHandler(newValueINotifyCollectionChanged_CollectionChanged); foreach (object o in newValue) { if (PropertyHasValue(o, "Properties") != null) { ObservableCollection <Tuple <String, object, Control> > obs = (ObservableCollection <Tuple <String, object, Control> >)PropertyHasValue(o, "Properties"); PropertyGridEditor.PropGrid pgrid = new PropGrid() { HorizontalAlignment = HorizontalAlignment.Stretch, Width = PGrid_TreeView.ActualWidth - 50 }; foreach (Tuple <String, object, Control> t in obs) { pgrid.AddProperty(t.Item1, t.Item3, t.Item2); } pgrid.ItemsSource = obs; String s = "NameNotSet"; if (PropertyHasValue(o, "Name") != null) { s = PropertyHasValue(o, "Name").ToString(); } TreeViewItem tvi = new TreeViewItem() { Header = s, Foreground = Brushes.White }; if (StartCollapsed) { tvi.IsExpanded = false; } else { tvi.IsExpanded = true; } tvi.Items.Add(pgrid); PGrid_TreeView.Items.Add(tvi); } } } }
public void SwitchBuildingParcel() { if (_objs != null) { foreach (var o in _objs) { ComputationUnit unit = o as ComputationUnit; unit.UpdateResult(); unit.UpdateFeature(); } PropGrid.Refresh(); } }
public void RefreshComputation() { if (_objs != null) { foreach (var o in _objs) { ComputationUnit unit = o as ComputationUnit; unit.UpdatePopulation(); unit.UpdateResult(); unit.UpdateFeature(); } PropGrid.Refresh(); } }
public void SetObjects(params object[] objs) { _objs = objs; string format = LocalizationHelper.GetString("PropertyDetails") + "({0})..."; EditButton.Content = string.Format(format, _objs.Length); switch (_objs.Length) { case 0: PropGrid.SelectedObject = null; break; case 1: PropGrid.SelectedObject = _objs[0]; break; default: PropGrid.SelectedObjects = _objs; break; } PropGrid.Refresh(); }
public void GetProperties(int n) { List <PropertyReader.Property> p; switch (pcc.Exports[n].ClassName) { default: p = PropertyReader.getPropList(pcc, pcc.Exports[n]); break; } pg = new PropGrid(); pg1.SelectedObject = pg; pg.Add(new CustomProperty("Name", "_Meta", pcc.Exports[n].ObjectName, typeof(string), true, true)); pg.Add(new CustomProperty("Class", "_Meta", pcc.Exports[n].ClassName, typeof(string), true, true)); pg.Add(new CustomProperty("Data Offset", "_Meta", pcc.Exports[n].DataOffset, typeof(int), true, true)); pg.Add(new CustomProperty("Data Size", "_Meta", pcc.Exports[n].DataSize, typeof(int), true, true)); for (int l = 0; l < p.Count; l++) { pg.Add(PropertyReader.PropertyToGrid(p[l], pcc)); } pg1.Refresh(); }
void newValueINotifyCollectionChanged_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (object o in e.NewItems) { if (PropertyHasValue(o, "Properties") != null) { ObservableCollection <Tuple <String, object, Control> > obs = (ObservableCollection <Tuple <String, object, Control> >)PropertyHasValue(o, "Properties"); PropertyGridEditor.PropGrid pgrid = new PropGrid() { HorizontalAlignment = HorizontalAlignment.Stretch, Width = PGrid_TreeView.ActualWidth - 50 }; foreach (Tuple <String, object, Control> t in obs) { pgrid.AddProperty(t.Item1, t.Item3, t.Item2); } pgrid.ItemsSource = obs; String s = "NameNotSet"; if (PropertyHasValue(o, "Name") != null) { s = PropertyHasValue(o, "Name").ToString(); } TreeViewItem tvi = new TreeViewItem() { Header = s, Foreground = Brushes.White }; tvi.Items.Add(pgrid); if (StartCollapsed) { tvi.IsExpanded = false; } else { tvi.IsExpanded = true; } PGrid_TreeView.Items.Add(tvi); } } } else if (e.Action == NotifyCollectionChangedAction.Remove) { PGrid_TreeView.Items.RemoveAt(e.OldStartingIndex); } else if (e.Action == NotifyCollectionChangedAction.Replace) { (((PropertyGridEditor.PropGrid)((TreeViewItem)PGrid_TreeView.Items[e.OldStartingIndex]).Items[0])).ItemsSource = null; (((PropertyGridEditor.PropGrid)((TreeViewItem)PGrid_TreeView.Items[e.OldStartingIndex]).Items[0])).ClearProperties(); PGrid_TreeView.Items.RemoveAt(e.OldStartingIndex); foreach (object o in e.NewItems) { if (PropertyHasValue(o, "Properties") != null) { ObservableCollection <Tuple <String, object, Control> > obs = (ObservableCollection <Tuple <String, object, Control> >)PropertyHasValue(o, "Properties"); PropertyGridEditor.PropGrid pgrid = new PropGrid() { HorizontalAlignment = HorizontalAlignment.Stretch, Width = PGrid_TreeView.ActualWidth - 50 }; foreach (Tuple <String, object, Control> t in obs) { pgrid.AddProperty(t.Item1, t.Item3, t.Item2); } pgrid.ItemsSource = obs; String s = "NameNotSet"; if (PropertyHasValue(o, "Name") != null) { s = PropertyHasValue(o, "Name").ToString(); } TreeViewItem tvi = new TreeViewItem() { Header = s, Foreground = Brushes.White }; tvi.Items.Add(pgrid); PGrid_TreeView.Items.Insert(e.OldStartingIndex, tvi); } } } else if (e.Action == NotifyCollectionChangedAction.Reset) { PGrid_TreeView.Items.Clear(); } }