Add project files.

This commit is contained in:
Joshua Askharoun
2022-03-03 08:14:05 -06:00
parent cfa6f93211
commit 1198cc8a66
967 changed files with 118389 additions and 0 deletions
@@ -0,0 +1,47 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.AncestorEnumerator
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Collections;
namespace Microsoft.Iris.Library
{
internal struct AncestorEnumerator : IEnumerator, IEnumerable
{
private TreeNode _nodeStart;
private TreeNode _nodeCurrent;
private TreeNode _nodeNext;
internal AncestorEnumerator(TreeNode nodeStart)
{
_nodeStart = nodeStart;
_nodeCurrent = null;
_nodeNext = _nodeStart;
}
object IEnumerator.Current => _nodeCurrent;
public TreeNode Current => _nodeCurrent;
IEnumerator IEnumerable.GetEnumerator() => this;
public AncestorEnumerator GetEnumerator() => this;
public void Reset()
{
_nodeCurrent = null;
_nodeNext = _nodeStart;
}
public bool MoveNext()
{
_nodeCurrent = _nodeNext;
if (_nodeNext == null)
return false;
_nodeNext = _nodeNext.Parent;
return true;
}
}
}
+79
View File
@@ -0,0 +1,79 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.Bits
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Diagnostics;
namespace Microsoft.Iris.Library
{
internal static class Bits
{
public static bool TestFlag(int value, int maskValue) => (value & maskValue) != 0;
public static bool TestFlag(uint value, uint maskValue) => ((int)value & (int)maskValue) != 0;
public static bool TestAnyFlags(int value, int maskValue) => (value & maskValue) != 0;
public static bool TestAnyFlags(uint value, uint maskValue) => ((int)value & (int)maskValue) != 0;
public static bool TestAllFlags(int value, int maskValue) => (value & maskValue) == maskValue;
public static bool TestAllFlags(uint value, uint maskValue) => ((int)value & (int)maskValue) == (int)maskValue;
public static void SetFlag(ref int value, int maskValue) => value |= maskValue;
public static void SetFlag(ref uint value, uint maskValue) => value |= maskValue;
public static void ClearFlag(ref int value, int maskValue) => value &= ~maskValue;
public static void ClearFlag(ref uint value, uint maskValue) => value &= ~maskValue;
public static void ChangeFlags(ref int value, int newValue, int maskValue) => value = newValue & maskValue | value & ~maskValue;
public static void ChangeFlags(ref uint value, uint newValue, uint maskValue) => value = (uint)((int)newValue & (int)maskValue | (int)value & ~(int)maskValue);
public static void ChangeFlag(ref int value, bool flag, int maskValue)
{
int num = flag ? maskValue : 0;
value = num & maskValue | value & ~maskValue;
}
public static void ChangeFlag(ref uint value, bool flag, uint maskValue)
{
uint num = flag ? maskValue : 0U;
value = (uint)((int)num & (int)maskValue | (int)value & ~(int)maskValue);
}
public static void FlipFlags(ref int value, int maskValue) => value ^= maskValue;
public static void FlipFlags(ref uint value, uint maskValue) => value ^= maskValue;
public static int ExtractFlags(int value, int maskValue) => value & maskValue;
public static int ExtractFlags(int value, int maskValue, int shiftBitsCount) => (value & maskValue) >> shiftBitsCount;
public static uint ExtractFlags(uint value, uint maskValue) => value & maskValue;
public static uint ExtractFlags(uint value, uint maskValue, int shiftBitsCount) => (value & maskValue) >> shiftBitsCount;
[Conditional("DEBUG")]
public static void AssertFlags(int testFlagsValue, int validFlagsValue)
{
}
[Conditional("DEBUG")]
public static void AssertFlags(uint testFlagsValue, uint validFlagsValue)
{
}
public static void PromptFlags(int testFlagsValue, int validFlagsValue)
{
}
public static void PromptFlags(uint testFlagsValue, uint validFlagsValue)
{
}
}
}
+41
View File
@@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.DataCookie
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal struct DataCookie
{
public static readonly DataCookie NULL = new DataCookie();
private uint m_value;
private DataCookie(uint value) => m_value = value;
public static bool operator ==(DataCookie hl, DataCookie hr) => (int)hl.m_value == (int)hr.m_value;
public static bool operator !=(DataCookie hl, DataCookie hr) => (int)hl.m_value != (int)hr.m_value;
public override bool Equals(object oCompare)
{
uint num;
if (oCompare is DataCookie dataCookie)
num = dataCookie.m_value;
else if (oCompare is uint value)
num = value;
else
return false;
return (int)m_value == (int)num;
}
public override int GetHashCode() => (int)m_value;
internal static DataCookie FromUInt32(uint value) => new DataCookie(value);
internal static uint ToUInt32(DataCookie handle) => handle.m_value;
public static DataCookie ReserveSlot() => FromUInt32(KeyAllocator.ReserveSlot());
}
}
@@ -0,0 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.DisposableNotifyObjectBase
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.Markup;
namespace Microsoft.Iris.Library
{
internal class DisposableNotifyObjectBase : DisposableObject, INotifyObject
{
private NotifyService _notifier = new NotifyService();
protected DisposableNotifyObjectBase()
{
}
protected void FireNotification(string id) => _notifier.Fire(id);
protected void FireThreadSafeNotification(string id) => _notifier.FireThreadSafe(id);
public void AddListener(Listener listener) => _notifier.AddListener(listener);
}
}
@@ -0,0 +1,38 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.DisposableObject
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Diagnostics;
namespace Microsoft.Iris.Library
{
internal class DisposableObject : IDisposableObject
{
private bool _isDisposed;
protected DisposableObject()
{
}
public bool IsDisposed => _isDisposed;
public void DeclareOwner(object owner) => OnOwnerDeclared(owner);
public void TransferOwnership(object owner) => OnOwnerDeclared(owner);
protected virtual void OnOwnerDeclared(object owner)
{
}
public void Dispose(object owner) => OnDispose();
protected virtual void OnDispose() => _isDisposed = true;
[Conditional("DEBUG")]
public void DEBUG_DeclareDisposeUnnecessary()
{
}
}
}
+45
View File
@@ -0,0 +1,45 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.DynamicData
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System;
namespace Microsoft.Iris.Library
{
internal struct DynamicData
{
private SmartMap _dataMap;
public void Create() => _dataMap = new SmartMap();
public object GetData(DataCookie cookie) => _dataMap[GetKey(cookie)];
public void SetData(DataCookie cookie, object value) => _dataMap[GetKey(cookie)] = value;
public Delegate GetEventHandler(EventCookie cookie) => _dataMap[GetKey(cookie)] as Delegate;
public bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd)
{
uint key = GetKey(cookie);
Delegate data = _dataMap[key] as Delegate;
_dataMap[key] = Delegate.Combine(data, handlerToAdd);
return (object)data == null;
}
public bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove)
{
uint key = GetKey(cookie);
Delegate @delegate = Delegate.Remove(_dataMap[key] as Delegate, handlerToRemove);
_dataMap[key] = @delegate;
return (object)@delegate == null;
}
public void RemoveEventHandlers(EventCookie cookie) => _dataMap[GetKey(cookie)] = null;
private static uint GetKey(DataCookie cookie) => DataCookie.ToUInt32(cookie);
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
}
}
+41
View File
@@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.EventCookie
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal struct EventCookie
{
public static readonly EventCookie NULL = new EventCookie();
private uint m_value;
private EventCookie(uint value) => m_value = value;
public static bool operator ==(EventCookie hl, EventCookie hr) => (int)hl.m_value == (int)hr.m_value;
public static bool operator !=(EventCookie hl, EventCookie hr) => (int)hl.m_value != (int)hr.m_value;
public override bool Equals(object oCompare)
{
uint num;
if (oCompare is EventCookie eventCookie)
num = eventCookie.m_value;
else if (oCompare is uint value)
num = value;
else
return false;
return (int)m_value == (int)num;
}
public override int GetHashCode() => (int)m_value;
internal static EventCookie FromUInt32(uint value) => new EventCookie(value);
internal static uint ToUInt32(EventCookie handle) => handle.m_value;
public static EventCookie ReserveSlot() => FromUInt32(KeyAllocator.ReserveSlot());
}
}
@@ -0,0 +1,161 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.ExpandableArray
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System;
using System.Collections;
using System.Linq;
namespace Microsoft.Iris.Library
{
internal class ExpandableArray
{
private object[] _array;
private int _generation;
private int _lockCount;
public ExpandableArray(int initialSize) => _array = new object[initialSize];
public int Length => _array.Length;
public bool IsFixedSize => false;
public bool IsReadOnly => false;
public object this[int index]
{
get => _array[index];
set => SetItem(index, value);
}
public int Add(object value)
{
int index = 0;
while (index < _array.Length && _array[index] != null)
++index;
SetItem(index, value);
return index;
}
public void Clear()
{
IncrementGeneration();
Array.Clear(_array, 0, _array.Length);
}
public bool Contains(object value) => _array.Contains(value);
public int IndexOf(object value) => Array.IndexOf(_array, value);
public void Insert(int index, object value)
{
}
public void Remove(object value)
{
}
public void RemoveAt(int index)
{
}
public int Count
{
get
{
int num = 0;
for (int index = 0; index < _array.Length; ++index)
{
if (_array[index] != null)
++num;
}
return num;
}
}
public bool IsSynchronized => false;
public object SyncRoot => (object)null;
public void CopyTo(Array array, int index) => _array.CopyTo(array, index);
public ExpandableArray.NullSkippingEnumerator GetEnumerator() => new ExpandableArray.NullSkippingEnumerator(this);
public void LockArray() => ++_lockCount;
public void UnlockArray() => --_lockCount;
private void IncrementGeneration()
{
++_generation;
if (_generation != int.MaxValue)
return;
_generation = 0;
}
private void ExpandArray(int index)
{
int length = _array.Length;
while (index >= length)
length <<= 1;
object[] objArray = new object[length];
for (int index1 = 0; index1 < _array.Length; ++index1)
objArray[index1] = _array[index1];
_array = objArray;
}
private void SetItem(int index, object value)
{
IncrementGeneration();
if (index >= _array.Length)
ExpandArray(index);
_array[index] = value;
}
public struct NullSkippingEnumerator : IEnumerator
{
private ExpandableArray _array;
private int _position;
private int _generation;
public NullSkippingEnumerator(ExpandableArray array)
{
_array = array;
_position = -1;
_generation = array._generation;
}
public object Current
{
get
{
CheckGeneration();
return _array[_position];
}
}
public bool MoveNext()
{
CheckGeneration();
for (++_position; _position < _array.Length; ++_position)
{
if (_array[_position] != null)
return true;
}
return false;
}
public void Reset()
{
CheckGeneration();
_position = -1;
}
private void CheckGeneration()
{
}
}
}
}
@@ -0,0 +1,19 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.IDisposableObject
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal interface IDisposableObject
{
bool IsDisposed { get; }
void DeclareOwner(object owner);
void TransferOwnership(object owner);
void Dispose(object owner);
}
}
@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.IDisposableOwner
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal interface IDisposableOwner
{
void RegisterDisposable(IDisposableObject disposable);
bool UnregisterDisposable(ref IDisposableObject disposable);
}
}
+17
View File
@@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.ITreeNode
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.UI;
namespace Microsoft.Iris.Library
{
internal interface ITreeNode
{
UIZone Zone { get; }
ITreeNode Parent { get; }
}
}
@@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.KeyAllocator
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Threading;
namespace Microsoft.Iris.Library
{
internal class KeyAllocator
{
private static int s_idxKeyGen;
internal static uint ReserveSlot() => (uint)Interlocked.Increment(ref s_idxKeyGen);
}
}
+45
View File
@@ -0,0 +1,45 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.Math2
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal class Math2
{
public static int FindPowerOf2(int value) => FindPowerOf2(value, 1);
public static int FindPowerOf2(int value, int startValue)
{
int num = startValue;
while (num < value)
num *= 2;
return num;
}
public static int RoundUp(float value) => (int)(value + 0.5);
public static int Clamp(int value, int min, int max)
{
if (value < min)
return min;
return value > max ? max : value;
}
public static float Clamp(float value, float min, float max)
{
if (value < (double)min)
return min;
return value > (double)max ? max : value;
}
public static bool WithinEpsilon(float value1, float value2)
{
float num = value1 - value2;
return -9.99999974737875E-06 <= num && num <= 9.99999974737875E-06;
}
public static double Blend(double a, double b, double weight, bool allowOutOfRangeWeights) => (1.0 - weight) * a + weight * b;
}
}
@@ -0,0 +1,25 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.NotifyObjectBase
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.Markup;
namespace Microsoft.Iris.Library
{
internal class NotifyObjectBase : INotifyObject
{
private NotifyService _notifier = new NotifyService();
protected NotifyObjectBase()
{
}
protected void FireNotification(string id) => _notifier.Fire(id);
protected void FireThreadSafeNotification(string id) => _notifier.FireThreadSafe(id);
public void AddListener(Listener listener) => _notifier.AddListener(listener);
}
}
+30
View File
@@ -0,0 +1,30 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.Result
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal struct Result
{
public static Result Success = new Result(null);
private string _error;
public static Result Fail(string error) => new Result(error);
public static Result Fail(string format, object param) => new Result(string.Format(format, param));
public static Result Fail(string format, object param1, object param2) => new Result(string.Format(format, param1, param2));
public static Result Fail(string format, object param1, object param2, object param3) => new Result(string.Format(format, param1, param2, param3));
public bool Failed => _error != null;
public string Error => _error;
public override string ToString() => _error;
private Result(string error) => _error = error;
}
}
@@ -0,0 +1,27 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.SharedDisposableObject
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
namespace Microsoft.Iris.Library
{
internal class SharedDisposableObject : DisposableObject
{
private int _usageCount;
public SharedDisposableObject() => DeclareOwner(this);
protected override void OnDispose() => base.OnDispose();
public virtual void RegisterUsage(object consumer) => ++_usageCount;
public virtual void UnregisterUsage(object consumer)
{
--_usageCount;
if (_usageCount != 0)
return;
Dispose(this);
}
}
}
+179
View File
@@ -0,0 +1,179 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.SmartMap
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System;
namespace Microsoft.Iris.Library
{
internal struct SmartMap
{
private SmartMap.Entry[] _listEntries;
public int Count
{
get
{
int num = 0;
if (_listEntries != null)
num = _listEntries.Length;
return num;
}
}
public bool IsEmpty => Count == 0;
public object this[uint key]
{
get
{
int index = IndexOf(key);
return index < 0 ? null : _listEntries[index].dataObject;
}
set
{
int slotIndex = IndexOf(key);
if (value != null)
{
if (slotIndex >= 0)
_listEntries[slotIndex].dataObject = value;
else
Add(key, value, ~slotIndex);
}
else
{
if (slotIndex < 0)
return;
Remove(key, slotIndex);
}
}
}
public uint[] Keys
{
get
{
uint[] numArray = null;
if (_listEntries != null)
{
numArray = new uint[_listEntries.Length];
for (int index = 0; index < _listEntries.Length; ++index)
numArray[index] = _listEntries[index].key;
}
return numArray;
}
}
public object[] Values
{
get
{
object[] objArray = null;
if (_listEntries != null)
{
objArray = new object[_listEntries.Length];
for (int index = 0; index < _listEntries.Length; ++index)
objArray[index] = _listEntries[index].dataObject;
}
return objArray;
}
}
public bool Lookup(object desired, out uint key)
{
if (_listEntries != null)
{
foreach (SmartMap.Entry listEntry in _listEntries)
{
if (listEntry.dataObject == desired)
{
key = listEntry.key;
return true;
}
}
}
key = 0U;
return false;
}
private int IndexOf(uint key)
{
if (_listEntries == null)
return -1;
uint num1 = uint.MaxValue;
int index1 = 0;
if (_listEntries.Length > 4)
{
int num2 = 0;
int num3 = _listEntries.Length - 1;
while (num2 <= num3)
{
index1 = (num3 + num2) / 2;
num1 = _listEntries[index1].key;
if ((int)key == (int)num1)
return index1;
if (key < num1)
num3 = index1 - 1;
else
num2 = index1 + 1;
}
}
else
{
for (int index2 = 0; index2 < _listEntries.Length; ++index2)
{
index1 = index2;
num1 = _listEntries[index1].key;
if ((int)key == (int)num1)
return index1;
if (key < num1)
break;
}
}
if (key > num1)
++index1;
return ~index1;
}
private void Add(uint key, object dataObject, int slotIndex)
{
SmartMap.Entry[] entryArray;
if (_listEntries == null)
{
entryArray = new SmartMap.Entry[1];
}
else
{
int length = _listEntries.Length;
entryArray = new SmartMap.Entry[length + 1];
Array.Copy(_listEntries, entryArray, slotIndex);
Array.Copy(_listEntries, slotIndex, entryArray, slotIndex + 1, length - slotIndex);
}
_listEntries = entryArray;
_listEntries[slotIndex].key = key;
_listEntries[slotIndex].dataObject = dataObject;
}
private void Remove(uint key, int slotIndex)
{
int length = _listEntries.Length;
if (length > 0)
{
SmartMap.Entry[] entryArray = new SmartMap.Entry[length - 1];
Array.Copy(_listEntries, entryArray, slotIndex);
Array.Copy(_listEntries, slotIndex + 1, entryArray, slotIndex, length - (slotIndex + 1));
_listEntries = entryArray;
}
else
_listEntries = null;
}
private struct Entry
{
internal uint key;
internal object dataObject;
}
}
}
@@ -0,0 +1,31 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.StackIListEnumerator
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Collections;
namespace Microsoft.Iris.Library
{
internal struct StackIListEnumerator : IEnumerator
{
private const int START_INVALID_INDEX = -1;
private IList _list;
private int _currentIndex;
internal StackIListEnumerator(IList list)
{
_list = list;
_currentIndex = -1;
}
public StackIListEnumerator GetEnumerator() => this;
public bool MoveNext() => ++_currentIndex < _list.Count;
public object Current => _list[_currentIndex];
public void Reset() => _currentIndex = -1;
}
}
@@ -0,0 +1,30 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.StackIListReverseEnumerator
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Collections;
namespace Microsoft.Iris.Library
{
internal struct StackIListReverseEnumerator : IEnumerator
{
private IList _list;
private int _currentIndex;
public StackIListReverseEnumerator(IList list)
{
_list = list;
_currentIndex = list.Count;
}
public StackIListReverseEnumerator GetEnumerator() => this;
public bool MoveNext() => --_currentIndex >= 0;
public object Current => _list[_currentIndex];
public void Reset() => _currentIndex = _list.Count;
}
}
+261
View File
@@ -0,0 +1,261 @@
// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.TreeNode
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using Microsoft.Iris.Session;
using Microsoft.Iris.UI;
using System;
namespace Microsoft.Iris.Library
{
internal abstract class TreeNode : DisposableObject, ITreeNode
{
private static readonly DataCookie s_instanceIDProperty = DataCookie.ReserveSlot();
private static readonly EventCookie s_deepParentChangeEvent = EventCookie.ReserveSlot();
private TreeNode _nodeParent;
private TreeNode _nodeFirstChild;
private TreeNode _nodeNext;
private TreeNode _nodePrevious;
private UIZone _zone;
private DynamicData _dataMap;
public TreeNode()
{
_dataMap = new DynamicData();
_dataMap.Create();
}
protected override void OnDispose()
{
base.OnDispose();
ChangeParent(null);
RemoveEventHandlers(s_deepParentChangeEvent);
}
public bool IsZoned => _zone != null;
public void ChangeParent(TreeNode nodeNewParent) => ChangeParent(nodeNewParent, null, LinkType.First);
public void ChangeParent(TreeNode nodeNewParent, TreeNode nodeSibling, TreeNode.LinkType lt)
{
if (_nodeParent == nodeNewParent)
return;
UIZone zone = null;
TreeNode nodeParent = _nodeParent;
if (_nodeParent != null)
{
DoUnlink(this);
nodeParent.OnChildrenChanged();
}
if (nodeNewParent != null)
{
DoLink(nodeNewParent, this, nodeSibling, lt);
zone = nodeNewParent.Zone;
nodeNewParent.OnChildrenChanged();
}
PropagateZone(zone);
FireTreeChangeWorker();
}
public void PropagateZone(UIZone zone)
{
if (_zone == zone)
return;
if (_zone != null)
OnZoneDetached();
_zone = zone;
if (zone != null)
OnZoneAttached();
foreach (TreeNode child in Children)
child.PropagateZone(zone);
}
public void MoveNode(TreeNode nodeSibling, TreeNode.LinkType lt)
{
TreeNode nodeParent = _nodeParent;
DoUnlink(this);
DoLink(nodeParent, this, nodeSibling, lt);
}
public void RemoveAllChildren(bool disposeChildrenFlag)
{
while (_nodeFirstChild != null)
_nodeFirstChild.ChangeParent(null);
}
protected virtual void OnZoneAttached()
{
}
protected virtual void OnZoneDetached()
{
}
protected virtual void OnChildrenChanged()
{
}
public event EventHandler DeepParentChange
{
add => AddEventHandler(s_deepParentChangeEvent, value);
remove => RemoveEventHandler(s_deepParentChangeEvent, value);
}
public UIZone Zone => _zone;
UIZone ITreeNode.Zone => _zone;
public UISession UISession => _zone.Session;
public bool HasChildren => _nodeFirstChild != null;
public abstract bool IsRoot { get; }
ITreeNode ITreeNode.Parent => _nodeParent;
public TreeNode Parent => _nodeParent;
public TreeNode NextSibling => _nodeNext;
public TreeNode PreviousSibling => _nodePrevious;
public TreeNode FirstSibling => _nodeParent == null ? this : _nodeParent._nodeFirstChild;
public TreeNode LastSibling
{
get
{
TreeNode treeNode = this;
while (treeNode._nodeNext != null)
treeNode = treeNode._nodeNext;
return treeNode;
}
}
public TreeNode FirstChild => _nodeFirstChild;
public TreeNode LastChild => _nodeFirstChild != null ? _nodeFirstChild.LastSibling : null;
public TreeNodeCollection Children => new TreeNodeCollection(this);
public AncestorEnumerator Ancestors => new AncestorEnumerator(this);
public bool HasDescendant(TreeNode nodeOther)
{
for (; nodeOther != null; nodeOther = nodeOther._nodeParent)
{
if (nodeOther == this)
return true;
}
return false;
}
public int ChildCount
{
get
{
int num = 0;
for (TreeNode treeNode = _nodeFirstChild; treeNode != null; treeNode = treeNode._nodeNext)
++num;
return num;
}
}
private static void DoLink(
TreeNode nodeParent,
TreeNode nodeChange,
TreeNode nodeSibling,
TreeNode.LinkType lt)
{
nodeChange._nodeParent = nodeParent;
TreeNode nodeFirstChild = nodeParent._nodeFirstChild;
if (nodeFirstChild == null)
{
nodeParent._nodeFirstChild = nodeChange;
}
else
{
switch (lt)
{
case LinkType.Before:
nodeChange._nodeNext = nodeSibling;
nodeChange._nodePrevious = nodeSibling._nodePrevious;
nodeSibling._nodePrevious = nodeChange;
if (nodeChange._nodePrevious != null)
{
nodeChange._nodePrevious._nodeNext = nodeChange;
break;
}
nodeParent._nodeFirstChild = nodeChange;
break;
case LinkType.Behind:
nodeChange._nodePrevious = nodeSibling;
nodeChange._nodeNext = nodeSibling._nodeNext;
nodeSibling._nodeNext = nodeChange;
if (nodeChange._nodeNext == null)
break;
nodeChange._nodeNext._nodePrevious = nodeChange;
break;
case LinkType.First:
nodeParent._nodeFirstChild = nodeChange;
nodeChange._nodeNext = nodeFirstChild;
if (nodeFirstChild == null)
break;
nodeFirstChild._nodePrevious = nodeChange;
break;
case LinkType.Last:
TreeNode lastSibling = nodeFirstChild.LastSibling;
lastSibling._nodeNext = nodeChange;
nodeChange._nodePrevious = lastSibling;
break;
}
}
}
private static void DoUnlink(TreeNode nodeChange)
{
if (nodeChange._nodeParent._nodeFirstChild == nodeChange)
nodeChange._nodeParent._nodeFirstChild = nodeChange._nodeNext;
if (nodeChange._nodeNext != null)
nodeChange._nodeNext._nodePrevious = nodeChange._nodePrevious;
if (nodeChange._nodePrevious != null)
nodeChange._nodePrevious._nodeNext = nodeChange._nodeNext;
nodeChange._nodeParent = null;
nodeChange._nodeNext = null;
nodeChange._nodePrevious = null;
}
private void FireTreeChangeWorker()
{
foreach (TreeNode child in Children)
child.FireTreeChangeWorker();
if (!(GetEventHandler(s_deepParentChangeEvent) is EventHandler eventHandler))
return;
eventHandler(this, EventArgs.Empty);
}
protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie);
protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value);
protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie);
protected bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd);
protected bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove);
protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie);
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
public enum LinkType
{
Before = 1,
Behind = 2,
First = 3,
Last = 4,
}
}
}

Some files were not shown because too many files have changed in this diff Show More