void SetDecompilationObject(int index, DecompilationObjectVM newValue) { Debug.Assert(newValue != null); if (newValue == null) throw new ArgumentNullException(nameof(newValue)); if (decompilationObjectVMs[index] == newValue) return; int otherIndex = Array.IndexOf(decompilationObjectVMs, newValue); Debug.Assert(otherIndex >= 0); if (otherIndex >= 0) { decompilationObjectVMs[otherIndex] = decompilationObjectVMs[index]; decompilationObjectVMs[index] = newValue; OnPropertyChanged($"DecompilationObject{otherIndex}"); } OnPropertyChanged($"DecompilationObject{index}"); }
public CSharpDecompilerSettingsPage(DecompilerSettings decompilerSettings) { _global_decompilerSettings = decompilerSettings; this.decompilerSettings = decompilerSettings.Clone(); var defObjs = typeof(DecompilationObject).GetEnumValues().Cast <DecompilationObject>().ToArray(); decompilationObjectVMs = new DecompilationObjectVM[defObjs.Length]; for (int i = 0; i < defObjs.Length; i++) { decompilationObjectVMs[i] = new DecompilationObjectVM(defObjs[i], ToString(defObjs[i])); } decompilationObjectVMs2 = decompilationObjectVMs.ToArray(); DecompilationObject0 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject0); DecompilationObject1 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject1); DecompilationObject2 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject2); DecompilationObject3 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject3); DecompilationObject4 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject4); }
void SetDecompilationObject(int index, DecompilationObjectVM newValue) { Debug.Assert(newValue != null); if (newValue == null) { throw new ArgumentNullException(nameof(newValue)); } if (decompilationObjectVMs[index] == newValue) { return; } int otherIndex = Array.IndexOf(decompilationObjectVMs, newValue); Debug.Assert(otherIndex >= 0); if (otherIndex >= 0) { decompilationObjectVMs[otherIndex] = decompilationObjectVMs[index]; decompilationObjectVMs[index] = newValue; OnPropertyChanged($"DecompilationObject{otherIndex}"); } OnPropertyChanged($"DecompilationObject{index}"); }
public CSharpDecompilerSettingsPage(DecompilerSettings decompilerSettings) { _global_decompilerSettings = decompilerSettings; this.decompilerSettings = decompilerSettings.Clone(); var defObjs = typeof(DecompilationObject).GetEnumValues().Cast<DecompilationObject>().ToArray(); decompilationObjectVMs = new DecompilationObjectVM[defObjs.Length]; for (int i = 0; i < defObjs.Length; i++) decompilationObjectVMs[i] = new DecompilationObjectVM(defObjs[i], ToString(defObjs[i])); decompilationObjectVMs2 = decompilationObjectVMs.ToArray(); DecompilationObject0 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject0); DecompilationObject1 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject1); DecompilationObject2 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject2); DecompilationObject3 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject3); DecompilationObject4 = decompilationObjectVMs.First(a => a.Object == decompilerSettings.DecompilationObject4); }