Simplified usages

This commit is contained in:
Yoshi Askharoun
2021-07-11 23:07:04 -05:00
parent f793c0c94f
commit dfb03d2ec5
242 changed files with 2240 additions and 2240 deletions
+12 -12
View File
@@ -39,7 +39,7 @@ public class Map
get get
{ {
int entry = this.FindEntry(key); int entry = this.FindEntry(key);
return entry >= 0 ? this._entries[entry].value : (object)null; return entry >= 0 ? this._entries[entry].value : null;
} }
set => this.Insert(key, value, false); set => this.Insert(key, value, false);
} }
@@ -52,7 +52,7 @@ public class Map
return; return;
for (int index = 0; index < this._buckets.Length; ++index) for (int index = 0; index < this._buckets.Length; ++index)
this._buckets[index] = -1; this._buckets[index] = -1;
Array.Clear((Array)this._entries, 0, this._count); Array.Clear(_entries, 0, this._count);
this._freeList = -1; this._freeList = -1;
this._count = 0; this._count = 0;
this._freeCount = 0; this._freeCount = 0;
@@ -132,7 +132,7 @@ public class Map
for (int index = 0; index < numArray.Length; ++index) for (int index = 0; index < numArray.Length; ++index)
numArray[index] = -1; numArray[index] = -1;
Map.Entry[] entryArray = new Map.Entry[prime]; Map.Entry[] entryArray = new Map.Entry[prime];
Array.Copy((Array)this._entries, 0, (Array)entryArray, 0, this._count); Array.Copy(_entries, 0, entryArray, 0, this._count);
for (int index1 = 0; index1 < this._count; ++index1) for (int index1 = 0; index1 < this._count; ++index1)
{ {
int index2 = entryArray[index1].hashCode % prime; int index2 = entryArray[index1].hashCode % prime;
@@ -160,8 +160,8 @@ public class Map
this._entries[index2].next = this._entries[index3].next; this._entries[index2].next = this._entries[index3].next;
this._entries[index3].hashCode = -1; this._entries[index3].hashCode = -1;
this._entries[index3].next = this._freeList; this._entries[index3].next = this._freeList;
this._entries[index3].key = (object)null; this._entries[index3].key = null;
this._entries[index3].value = (object)null; this._entries[index3].value = null;
this._freeList = index3; this._freeList = index3;
++this._freeCount; ++this._freeCount;
++this._version; ++this._version;
@@ -181,7 +181,7 @@ public class Map
value = this._entries[entry].value; value = this._entries[entry].value;
return true; return true;
} }
value = (object)null; value = null;
return false; return false;
} }
@@ -201,7 +201,7 @@ public class Map
this._dictionary = dictionary; this._dictionary = dictionary;
this._version = this._dictionary._version; this._version = this._dictionary._version;
this._index = 0; this._index = 0;
this._current = new KeyValueEntry<object, object>((object)null, (object)null); this._current = new KeyValueEntry<object, object>(null, null);
} }
public bool MoveNext() public bool MoveNext()
@@ -218,7 +218,7 @@ public class Map
} }
} }
this._index = this._dictionary._count + 1; this._index = this._dictionary._count + 1;
this._current = new KeyValueEntry<object, object>((object)null, (object)null); this._current = new KeyValueEntry<object, object>(null, null);
return false; return false;
} }
@@ -247,7 +247,7 @@ public class Map
this._dictionary = dictionary; this._dictionary = dictionary;
this._version = dictionary._version; this._version = dictionary._version;
this._index = 0; this._index = 0;
this._currentKey = (object)null; this._currentKey = null;
} }
public bool MoveNext() public bool MoveNext()
@@ -264,7 +264,7 @@ public class Map
} }
} }
this._index = this._dictionary._count + 1; this._index = this._dictionary._count + 1;
this._currentKey = (object)null; this._currentKey = null;
return false; return false;
} }
@@ -294,7 +294,7 @@ public class Map
this._dictionary = dictionary; this._dictionary = dictionary;
this._version = dictionary._version; this._version = dictionary._version;
this._index = 0; this._index = 0;
this._currentValue = (object)null; this._currentValue = null;
} }
public bool MoveNext() public bool MoveNext()
@@ -311,7 +311,7 @@ public class Map
} }
} }
this._index = this._dictionary._count + 1; this._index = this._dictionary._count + 1;
this._currentValue = (object)null; this._currentValue = null;
return false; return false;
} }
+3 -3
View File
@@ -52,7 +52,7 @@ public class Map<K, V>
return; return;
for (int index = 0; index < this._buckets.Length; ++index) for (int index = 0; index < this._buckets.Length; ++index)
this._buckets[index] = -1; this._buckets[index] = -1;
Array.Clear((Array)this._entries, 0, this._count); Array.Clear(_entries, 0, this._count);
this._freeList = -1; this._freeList = -1;
this._count = 0; this._count = 0;
this._freeCount = 0; this._freeCount = 0;
@@ -132,7 +132,7 @@ public class Map<K, V>
for (int index = 0; index < numArray.Length; ++index) for (int index = 0; index < numArray.Length; ++index)
numArray[index] = -1; numArray[index] = -1;
Map<K, V>.Entry[] entryArray = new Map<K, V>.Entry[prime]; Map<K, V>.Entry[] entryArray = new Map<K, V>.Entry[prime];
Array.Copy((Array)this._entries, 0, (Array)entryArray, 0, this._count); Array.Copy(_entries, 0, entryArray, 0, this._count);
for (int index1 = 0; index1 < this._count; ++index1) for (int index1 = 0; index1 < this._count; ++index1)
{ {
int index2 = entryArray[index1].hashCode % prime; int index2 = entryArray[index1].hashCode % prime;
@@ -185,7 +185,7 @@ public class Map<K, V>
return false; return false;
} }
private bool KeyEquals(K x, K y) => x.Equals((object)y); private bool KeyEquals(K x, K y) => x.Equals(y);
private int GetKeyHashCode(K obj) => obj.GetHashCode(); private int GetKeyHashCode(K obj) => obj.GetHashCode();
@@ -14,7 +14,7 @@ namespace Microsoft.Iris.Input
public static readonly Cursor Arrow = new Cursor(32512, CursorID.Arrow); public static readonly Cursor Arrow = new Cursor(32512, CursorID.Arrow);
public static readonly Cursor AppStarting = new Cursor(32550, CursorID.AppStarting); public static readonly Cursor AppStarting = new Cursor(32550, CursorID.AppStarting);
public static readonly Cursor Crosshair = new Cursor(32515, CursorID.Crosshair); public static readonly Cursor Crosshair = new Cursor(32515, CursorID.Crosshair);
public static readonly Cursor Default = Cursor.Arrow; public static readonly Cursor Default = Arrow;
public static readonly Cursor Hand = new Cursor(32649, CursorID.Hand); public static readonly Cursor Hand = new Cursor(32649, CursorID.Hand);
public static readonly Cursor Help = new Cursor(32651, CursorID.Help); public static readonly Cursor Help = new Cursor(32651, CursorID.Help);
public static readonly Cursor IBeam = new Cursor(32513, CursorID.IBeam); public static readonly Cursor IBeam = new Cursor(32513, CursorID.IBeam);
@@ -48,39 +48,39 @@ namespace Microsoft.Iris.Input
switch (cursor) switch (cursor)
{ {
case CursorID.Arrow: case CursorID.Arrow:
return Cursor.Arrow; return Arrow;
case CursorID.Cancel: case CursorID.Cancel:
return Cursor.Cancel; return Cancel;
case CursorID.Copy: case CursorID.Copy:
return Cursor.Copy; return Copy;
case CursorID.Crosshair: case CursorID.Crosshair:
return Cursor.Crosshair; return Crosshair;
case CursorID.IBeam: case CursorID.IBeam:
return Cursor.IBeam; return IBeam;
case CursorID.Hand: case CursorID.Hand:
return Cursor.Hand; return Hand;
case CursorID.Move: case CursorID.Move:
return Cursor.Move; return Move;
case CursorID.No: case CursorID.No:
return Cursor.No; return No;
case CursorID.None: case CursorID.None:
return Cursor.NullCursor; return NullCursor;
case CursorID.Size: case CursorID.Size:
return Cursor.Size; return Size;
case CursorID.SizeNS: case CursorID.SizeNS:
return Cursor.SizeNS; return SizeNS;
case CursorID.SizeWE: case CursorID.SizeWE:
return Cursor.SizeWE; return SizeWE;
case CursorID.SizeNWSE: case CursorID.SizeNWSE:
return Cursor.SizeNWSE; return SizeNWSE;
case CursorID.SizeNESW: case CursorID.SizeNESW:
return Cursor.SizeNESW; return SizeNESW;
case CursorID.UpArrow: case CursorID.UpArrow:
return Cursor.UpArrow; return UpArrow;
case CursorID.Wait: case CursorID.Wait:
return Cursor.WaitCursor; return WaitCursor;
default: default:
return (Cursor)null; return null;
} }
} }
} }
@@ -22,25 +22,25 @@ namespace Microsoft.Iris.Libraries.OS
~RegistryKey() => this.Close(); ~RegistryKey() => this.Close();
public static RegistryKey Open(IntPtr hive, string path) => RegistryKey.OpenWorker(hive, path); public static RegistryKey Open(IntPtr hive, string path) => OpenWorker(hive, path);
private static RegistryKey OpenWorker(IntPtr parentKey, string path) private static RegistryKey OpenWorker(IntPtr parentKey, string path)
{ {
RegistryKey registryKey = (RegistryKey)null; RegistryKey registryKey = null;
IntPtr phkResult; IntPtr phkResult;
if (Win32Api.RegOpenKeyExW(parentKey, path, 0, 131097, out phkResult) == 0) if (Win32Api.RegOpenKeyExW(parentKey, path, 0, 131097, out phkResult) == 0)
registryKey = new RegistryKey(phkResult); registryKey = new RegistryKey(phkResult);
return registryKey; return registryKey;
} }
public RegistryKey OpenSubKey(string path) => RegistryKey.OpenWorker(this._hkey, path); public RegistryKey OpenSubKey(string path) => OpenWorker(this._hkey, path);
public bool ReadByte(string valueName, out byte value) public bool ReadByte(string valueName, out byte value)
{ {
bool flag = false; bool flag = false;
value = (byte)0; value = 0;
int num = 0; int num = 0;
if (this.ReadInt(valueName, out num) && num >= 0 && num <= (int)byte.MaxValue) if (this.ReadInt(valueName, out num) && num >= 0 && num <= byte.MaxValue)
{ {
value = (byte)num; value = (byte)num;
flag = true; flag = true;
@@ -79,17 +79,17 @@ namespace Microsoft.Iris.Libraries.OS
public bool ReadString(string valueName, out string value) public bool ReadString(string valueName, out string value)
{ {
bool flag = false; bool flag = false;
value = (string)null; value = null;
int lpcbData = 0; int lpcbData = 0;
int lpType; int lpType;
if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, (char[])null, ref lpcbData) == 0 && lpType == 1) if (Win32Api.RegQueryValueExW(this._hkey, valueName, IntPtr.Zero, out lpType, null, ref lpcbData) == 0 && lpType == 1)
flag = this.ReadStringValueWorker(valueName, lpcbData, out value); flag = this.ReadStringValueWorker(valueName, lpcbData, out value);
return flag; return flag;
} }
private bool ReadStringValueWorker(string valueName, int dataBytes, out string value) private bool ReadStringValueWorker(string valueName, int dataBytes, out string value)
{ {
value = (string)null; value = null;
bool flag = false; bool flag = false;
int length = dataBytes / 2; int length = dataBytes / 2;
char[] lpData = new char[length]; char[] lpData = new char[length];
@@ -108,7 +108,7 @@ namespace Microsoft.Iris.Libraries.OS
{ {
Win32Api.RegCloseKey(this._hkey); Win32Api.RegCloseKey(this._hkey);
this._hkey = IntPtr.Zero; this._hkey = IntPtr.Zero;
GC.SuppressFinalize((object)this); GC.SuppressFinalize(this);
} }
} }
} }
@@ -12,13 +12,13 @@ namespace Microsoft.Iris.Library
{ {
public static class InvariantString public static class InvariantString
{ {
public static string Format(string format, object param) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param); public static string Format(string format, object param) => string.Format(CultureInfo.InvariantCulture, format, param);
public static string Format(string format, object[] param) => throw new Exception("Should never format with object array. Use one of the dedicated format methods"); public static string Format(string format, object[] param) => throw new Exception("Should never format with object array. Use one of the dedicated format methods");
public static string Format(string format, object param1, object param2) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2); public static string Format(string format, object param1, object param2) => string.Format(CultureInfo.InvariantCulture, format, param1, param2);
public static string Format(string format, object param1, object param2, object param3) => string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3); public static string Format(string format, object param1, object param2, object param3) => string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3);
public static string Format( public static string Format(
string format, string format,
@@ -27,7 +27,7 @@ namespace Microsoft.Iris.Library
object param3, object param3,
object param4) object param4)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4);
} }
public static string Format( public static string Format(
@@ -38,7 +38,7 @@ namespace Microsoft.Iris.Library
object param4, object param4,
object param5) object param5)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5);
} }
public static string Format( public static string Format(
@@ -50,7 +50,7 @@ namespace Microsoft.Iris.Library
object param5, object param5,
object param6) object param6)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6);
} }
public static string Format( public static string Format(
@@ -63,7 +63,7 @@ namespace Microsoft.Iris.Library
object param6, object param6,
object param7) object param7)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7);
} }
public static string Format( public static string Format(
@@ -77,7 +77,7 @@ namespace Microsoft.Iris.Library
object param7, object param7,
object param8) object param8)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8);
} }
public static string Format( public static string Format(
@@ -92,7 +92,7 @@ namespace Microsoft.Iris.Library
object param8, object param8,
object param9) object param9)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9);
} }
public static string Format( public static string Format(
@@ -108,7 +108,7 @@ namespace Microsoft.Iris.Library
object param9, object param9,
object param10) object param10)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10);
} }
public static string Format( public static string Format(
@@ -125,7 +125,7 @@ namespace Microsoft.Iris.Library
object param10, object param10,
object param11) object param11)
{ {
return string.Format((IFormatProvider)CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); return string.Format(CultureInfo.InvariantCulture, format, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11);
} }
public static bool Equals(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.Ordinal) == 0; public static bool Equals(string leftName, string rightName) => string.Compare(leftName, rightName, StringComparison.Ordinal) == 0;
@@ -140,11 +140,11 @@ namespace Microsoft.Iris.Library
public static bool EndsWithI(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.OrdinalIgnoreCase); public static bool EndsWithI(string valueName, string suffixName) => valueName.EndsWith(suffixName, StringComparison.OrdinalIgnoreCase);
public static string ValueToString(ushort v, string formatName) => v.ToString(formatName, (IFormatProvider)CultureInfo.InvariantCulture); public static string ValueToString(ushort v, string formatName) => v.ToString(formatName, CultureInfo.InvariantCulture);
public static IEqualityComparer<string> OrdinalIgnoreCaseComparer => (IEqualityComparer<string>)InvariantString.OrdinalIgnoreCaseStringComparer.Instance; public static IEqualityComparer<string> OrdinalIgnoreCaseComparer => OrdinalIgnoreCaseStringComparer.Instance;
public static IEqualityComparer<string> OrdinalComparer => (IEqualityComparer<string>)InvariantString.OrdinalStringComparer.Instance; public static IEqualityComparer<string> OrdinalComparer => OrdinalStringComparer.Instance;
public class OrdinalStringComparer : IEqualityComparer<string> public class OrdinalStringComparer : IEqualityComparer<string>
{ {
@@ -158,9 +158,9 @@ namespace Microsoft.Iris.Library
{ {
get get
{ {
if (InvariantString.OrdinalStringComparer._instance == null) if (_instance == null)
InvariantString.OrdinalStringComparer._instance = new InvariantString.OrdinalStringComparer(); _instance = new InvariantString.OrdinalStringComparer();
return InvariantString.OrdinalStringComparer._instance; return _instance;
} }
} }
@@ -183,9 +183,9 @@ namespace Microsoft.Iris.Library
{ {
get get
{ {
if (InvariantString.OrdinalIgnoreCaseStringComparer._instance == null) if (_instance == null)
InvariantString.OrdinalIgnoreCaseStringComparer._instance = new InvariantString.OrdinalIgnoreCaseStringComparer(); _instance = new InvariantString.OrdinalIgnoreCaseStringComparer();
return InvariantString.OrdinalIgnoreCaseStringComparer._instance; return _instance;
} }
} }
@@ -39,8 +39,8 @@ namespace Microsoft.Iris.Render.Animation
{ {
if (inDispose && this.m_remoteObject != null) if (inDispose && this.m_remoteObject != null)
this.m_remoteObject.Dispose(); this.m_remoteObject.Dispose();
this.m_remoteObject = (RemoteAnimationInputProvider)null; this.m_remoteObject = null;
this.m_externalInput = (ExternalAnimationInput)null; this.m_externalInput = null;
} }
finally finally
{ {
@@ -50,7 +50,7 @@ namespace Microsoft.Iris.Render.Animation
RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle;
void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationInputProvider)null; void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = null;
void IAnimationInputProvider.PublishFloat( void IAnimationInputProvider.PublishFloat(
string propertyName, string propertyName,
@@ -26,7 +26,7 @@ namespace Microsoft.Iris.Render.Animation
this.m_remoteObject = ownerSession.BuildRemoteAnimationManager(this); this.m_remoteObject = ownerSession.BuildRemoteAnimationManager(this);
this.m_flSpeedAdjustment = 1f; this.m_flSpeedAdjustment = 1f;
this.m_backCompat = false; this.m_backCompat = false;
this.RegisterUsage((object)ownerSession); this.RegisterUsage(ownerSession);
} }
protected override void Dispose(bool inDispose) protected override void Dispose(bool inDispose)
@@ -35,8 +35,8 @@ namespace Microsoft.Iris.Render.Animation
{ {
if (inDispose && this.m_remoteObject != null) if (inDispose && this.m_remoteObject != null)
this.m_remoteObject.Dispose(); this.m_remoteObject.Dispose();
this.m_ownerSession = (RenderSession)null; this.m_ownerSession = null;
this.m_remoteObject = (RemoteAnimationManager)null; this.m_remoteObject = null;
} }
finally finally
{ {
@@ -60,7 +60,7 @@ namespace Microsoft.Iris.Render.Animation
Debug2.Validate(initialValue != null, typeof(ArgumentNullException), nameof(initialValue)); Debug2.Validate(initialValue != null, typeof(ArgumentNullException), nameof(initialValue));
KeyframeAnimation keyframeAnimation = new KeyframeAnimation(this, initialValue); KeyframeAnimation keyframeAnimation = new KeyframeAnimation(this, initialValue);
keyframeAnimation.RegisterUsage(objUser); keyframeAnimation.RegisterUsage(objUser);
return (IKeyframeAnimation)keyframeAnimation; return keyframeAnimation;
} }
IAnimationGroup IAnimationSystem.CreateAnimationGroup( IAnimationGroup IAnimationSystem.CreateAnimationGroup(
@@ -69,7 +69,7 @@ namespace Microsoft.Iris.Render.Animation
Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser));
AnimationGroup animationGroup = new AnimationGroup(this); AnimationGroup animationGroup = new AnimationGroup(this);
animationGroup.RegisterUsage(objUser); animationGroup.RegisterUsage(objUser);
return (IAnimationGroup)animationGroup; return animationGroup;
} }
void IAnimationSystem.PulseTimeAdvance(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs); void IAnimationSystem.PulseTimeAdvance(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs);
@@ -102,7 +102,7 @@ namespace Microsoft.Iris.Render.Animation
object objUser, object objUser,
IAnimationPropertyMap propertyMap) IAnimationPropertyMap propertyMap)
{ {
return (IExternalAnimationInput)new ExternalAnimationInput(objUser, this.m_ownerSession, propertyMap); return new ExternalAnimationInput(objUser, this.m_ownerSession, propertyMap);
} }
void IAnimationSystem.PauseAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(0.0f); void IAnimationSystem.PauseAnimations() => this.m_remoteObject.SendSetGlobalSpeedAdjustment(0.0f);
@@ -113,7 +113,7 @@ namespace Microsoft.Iris.Render.Animation
RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle;
void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimationManager)null; void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = null;
protected override void Invariant() protected override void Invariant()
{ {
@@ -19,8 +19,8 @@ namespace Microsoft.Iris.Render.Animation
internal AnimationTarget(IAnimatableObject targetObject, string targetPropertyName) internal AnimationTarget(IAnimatableObject targetObject, string targetPropertyName)
{ {
int propertyType = (int)targetObject.GetPropertyType(targetPropertyName); int propertyType = (int)targetObject.GetPropertyType(targetPropertyName);
targetObject.RegisterUsage((object)this); targetObject.RegisterUsage(this);
this.m_targetId = Interlocked.Increment(ref AnimationTarget.s_targetIdSeed); this.m_targetId = Interlocked.Increment(ref s_targetIdSeed);
this.m_object = targetObject; this.m_object = targetObject;
this.m_property = targetPropertyName; this.m_property = targetPropertyName;
} }
@@ -30,8 +30,8 @@ namespace Microsoft.Iris.Render.Animation
try try
{ {
if (fInDispose) if (fInDispose)
this.m_object.UnregisterUsage((object)this); this.m_object.UnregisterUsage(this);
this.m_object = (IAnimatableObject)null; this.m_object = null;
} }
finally finally
{ {
@@ -33,7 +33,7 @@ namespace Microsoft.Iris.Render.Animation
{ {
Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser)); Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser));
Debug2.Validate(propertyMap != null, typeof(ArgumentNullException), nameof(propertyMap)); Debug2.Validate(propertyMap != null, typeof(ArgumentNullException), nameof(propertyMap));
this.m_uniqueId = ExternalAnimationInput.s_uniqueIdSeed++; this.m_uniqueId = s_uniqueIdSeed++;
this.m_propertyMap = propertyMap; this.m_propertyMap = propertyMap;
this.m_session = session; this.m_session = session;
this.m_remoteObject = session.BuildRemoteExternalAnimationInput(this, this.m_uniqueId); this.m_remoteObject = session.BuildRemoteExternalAnimationInput(this, this.m_uniqueId);
@@ -46,9 +46,9 @@ namespace Microsoft.Iris.Render.Animation
{ {
if (inDispose && this.m_remoteObject != null) if (inDispose && this.m_remoteObject != null)
this.m_remoteObject.Dispose(); this.m_remoteObject.Dispose();
this.m_remoteObject = (RemoteExternalAnimationInput)null; this.m_remoteObject = null;
this.m_propertyMap = (IAnimationPropertyMap)null; this.m_propertyMap = null;
this.m_session = (RenderSession)null; this.m_session = null;
} }
finally finally
{ {
@@ -63,7 +63,7 @@ namespace Microsoft.Iris.Render.Animation
void IRenderHandleOwner.OnDisconnect() void IRenderHandleOwner.OnDisconnect()
{ {
this.m_uniqueId = 0U; this.m_uniqueId = 0U;
this.m_remoteObject = (RemoteExternalAnimationInput)null; this.m_remoteObject = null;
} }
RENDERHANDLE IAnimatableObject.GetObjectId() => this.m_remoteObject.RenderHandle; RENDERHANDLE IAnimatableObject.GetObjectId() => this.m_remoteObject.RenderHandle;
@@ -79,7 +79,7 @@ namespace Microsoft.Iris.Render.Animation
IAnimationInputProvider IExternalAnimationInput.CreateProvider( IAnimationInputProvider IExternalAnimationInput.CreateProvider(
object objUser) object objUser)
{ {
return (IAnimationInputProvider)new AnimationInputProvider(objUser, this.m_session, this); return new AnimationInputProvider(objUser, this.m_session, this);
} }
} }
} }
@@ -39,18 +39,18 @@ namespace Microsoft.Iris.Render.Animation
internal KeyframeAnimation(AnimationSystem owner, AnimationInput initialValue) internal KeyframeAnimation(AnimationSystem owner, AnimationInput initialValue)
{ {
this.m_animationSystem = owner; this.m_animationSystem = owner;
this.m_reference = (AnimationInput)null; this.m_reference = null;
this.m_scale = (AnimationInput)null; this.m_scale = null;
this.m_animationType = initialValue.InputType; this.m_animationType = initialValue.InputType;
this.m_keyframeList = new Vector(); this.m_keyframeList = new Vector();
this.m_repeatCount = 0; this.m_repeatCount = 0;
this.m_autoReset = false; this.m_autoReset = false;
this.m_resetBehavior = AnimationResetBehavior.LeaveCurrent; this.m_resetBehavior = AnimationResetBehavior.LeaveCurrent;
this.m_animationSystem.RegisterUsage((object)this); this.m_animationSystem.RegisterUsage(this);
this.m_remoteObject = owner.Session.BuildRemoteAnimation(this, this.m_animationType); this.m_remoteObject = owner.Session.BuildRemoteAnimation(this, this.m_animationType);
if (this.m_animationSystem.BackCompat) if (this.m_animationSystem.BackCompat)
return; return;
this.AddKeyframe(new AnimationKeyframe(0.0f, initialValue, (AnimationInterpolation)KeyframeAnimation.s_defaultInterpolation)); this.AddKeyframe(new AnimationKeyframe(0.0f, initialValue, s_defaultInterpolation));
} }
protected override void Dispose(bool inDispose) protected override void Dispose(bool inDispose)
@@ -64,18 +64,18 @@ namespace Microsoft.Iris.Render.Animation
if (this.m_keyframeList != null) if (this.m_keyframeList != null)
{ {
foreach (AnimationKeyframe keyframe in this.m_keyframeList) foreach (AnimationKeyframe keyframe in this.m_keyframeList)
keyframe.Value.UnregisterUsage((object)this); keyframe.Value.UnregisterUsage(this);
this.m_keyframeList.Clear(); this.m_keyframeList.Clear();
} }
if (this.m_remoteObject != null) if (this.m_remoteObject != null)
this.m_remoteObject.Dispose(); this.m_remoteObject.Dispose();
this.m_animationSystem.UnregisterUsage((object)this); this.m_animationSystem.UnregisterUsage(this);
} }
this.m_remoteObject = (RemoteAnimation)null; this.m_remoteObject = null;
this.m_reference = (AnimationInput)null; this.m_reference = null;
this.m_keyframeList = (Vector)null; this.m_keyframeList = null;
this.m_targetList = (Vector)null; this.m_targetList = null;
this.m_animationSystem = (AnimationSystem)null; this.m_animationSystem = null;
} }
finally finally
{ {
@@ -146,7 +146,7 @@ namespace Microsoft.Iris.Render.Animation
public override void InstantAdvance(float advanceTime) public override void InstantAdvance(float advanceTime)
{ {
Debug2.Validate((double)advanceTime >= 0.0, typeof(ArgumentOutOfRangeException), nameof(advanceTime)); Debug2.Validate(advanceTime >= 0.0, typeof(ArgumentOutOfRangeException), nameof(advanceTime));
this.m_remoteObject.SendInstantAdvance(advanceTime); this.m_remoteObject.SendInstantAdvance(advanceTime);
} }
@@ -186,7 +186,7 @@ namespace Microsoft.Iris.Render.Animation
internal void AddKeyframe(AnimationKeyframe keyframe) internal void AddKeyframe(AnimationKeyframe keyframe)
{ {
this.m_keyframeList.Add((object)keyframe); this.m_keyframeList.Add(keyframe);
this.m_remoteObject.SendAddKeyframe(this.m_keyframeList.Count - 1, keyframe.Time); this.m_remoteObject.SendAddKeyframe(this.m_keyframeList.Count - 1, keyframe.Time);
this.SetKeyframe(this.m_keyframeList.Count - 1, keyframe, false); this.SetKeyframe(this.m_keyframeList.Count - 1, keyframe, false);
} }
@@ -207,19 +207,19 @@ namespace Microsoft.Iris.Render.Animation
Debug2.Validate(keyframe != null, typeof(ArgumentNullException), nameof(keyframe)); Debug2.Validate(keyframe != null, typeof(ArgumentNullException), nameof(keyframe));
Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof(ArgumentOutOfRangeException), nameof(keyframeIndex)); Debug2.Validate(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof(ArgumentOutOfRangeException), nameof(keyframeIndex));
if (keyframeIndex == 0 && !this.m_animationSystem.BackCompat) if (keyframeIndex == 0 && !this.m_animationSystem.BackCompat)
Debug2.Validate((double)keyframe.Time == 0.0, typeof(ArgumentException), "Cannot change the time for keyframe 0"); Debug2.Validate(keyframe.Time == 0.0, typeof(ArgumentException), "Cannot change the time for keyframe 0");
this.SetKeyframe(keyframeIndex, keyframe, true); this.SetKeyframe(keyframeIndex, keyframe, true);
} }
internal void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe, bool replaceKeyframe) internal void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe, bool replaceKeyframe)
{ {
keyframe.Value.RegisterUsage((object)this); keyframe.Value.RegisterUsage(this);
if (replaceKeyframe) if (replaceKeyframe)
{ {
AnimationKeyframe keyframe1 = (AnimationKeyframe)this.m_keyframeList[keyframeIndex]; AnimationKeyframe keyframe1 = (AnimationKeyframe)this.m_keyframeList[keyframeIndex];
this.m_keyframeList.RemoveAt(keyframeIndex); this.m_keyframeList.RemoveAt(keyframeIndex);
this.m_keyframeList.Insert(keyframeIndex, (object)keyframe); this.m_keyframeList.Insert(keyframeIndex, keyframe);
keyframe1.Value.UnregisterUsage((object)this); keyframe1.Value.UnregisterUsage(this);
} }
this.m_remoteObject.SendSetKeyframeTime(keyframeIndex, keyframe.Time); this.m_remoteObject.SendSetKeyframeTime(keyframeIndex, keyframe.Time);
this.SendInput(keyframeIndex, keyframe.Value); this.SendInput(keyframeIndex, keyframe.Value);
@@ -231,7 +231,7 @@ namespace Microsoft.Iris.Render.Animation
string targetPropertyName) string targetPropertyName)
{ {
Debug2.Validate(targetObject is IAnimatableObject, typeof(ArgumentException), nameof(targetObject)); Debug2.Validate(targetObject is IAnimatableObject, typeof(ArgumentException), nameof(targetObject));
this.AddTarget((IAnimatableObject)targetObject, targetPropertyName, (string)null); this.AddTarget((IAnimatableObject)targetObject, targetPropertyName, null);
} }
void IKeyframeAnimation.AddTarget( void IKeyframeAnimation.AddTarget(
@@ -254,14 +254,14 @@ namespace Microsoft.Iris.Render.Animation
AnimationTarget target = new AnimationTarget(targetObject, targetPropertyName); AnimationTarget target = new AnimationTarget(targetObject, targetPropertyName);
AnimationTypeMask sourceMask = AnimationTypeMask.FromString(targetMaskSpec); AnimationTypeMask sourceMask = AnimationTypeMask.FromString(targetMaskSpec);
if (!sourceMask.CanMapFromType(this.m_animationType)) if (!sourceMask.CanMapFromType(this.m_animationType))
throw new ArgumentException(string.Format("Mask cannot be applied to a {0} animation", (object)this.m_animationType)); throw new ArgumentException(string.Format("Mask cannot be applied to a {0} animation", m_animationType));
if (!sourceMask.CanMapToType(target.TargetPropertyType)) if (!sourceMask.CanMapToType(target.TargetPropertyType))
throw new ArgumentException(string.Format("Mask cannot be applied to a property of type {0}", (object)target.TargetPropertyType)); throw new ArgumentException(string.Format("Mask cannot be applied to a property of type {0}", target.TargetPropertyType));
uint propertyInfo = this.GeneratePropertyInfo(target.TargetPropertyType, sourceMask); uint propertyInfo = this.GeneratePropertyInfo(target.TargetPropertyType, sourceMask);
this.m_remoteObject.SendAddTarget(target.TargetId, target.TargetObject.GetObjectId(), target.TargetObject.GetPropertyId(target.TargetPropertyName), propertyInfo); this.m_remoteObject.SendAddTarget(target.TargetId, target.TargetObject.GetObjectId(), target.TargetObject.GetPropertyId(target.TargetPropertyName), propertyInfo);
if (this.m_targetList == null) if (this.m_targetList == null)
this.m_targetList = new Vector(); this.m_targetList = new Vector();
this.m_targetList.Add((object)new KeyframeAnimation.AnimationTargetInfo(target, targetMaskSpec)); this.m_targetList.Add(new KeyframeAnimation.AnimationTargetInfo(target, targetMaskSpec));
} }
void IKeyframeAnimation.RemoveTarget( void IKeyframeAnimation.RemoveTarget(
@@ -271,7 +271,7 @@ namespace Microsoft.Iris.Render.Animation
{ {
Debug2.Validate(targetObject != null, typeof(ArgumentNullException), nameof(targetObject)); Debug2.Validate(targetObject != null, typeof(ArgumentNullException), nameof(targetObject));
Debug2.Validate(targetPropertyName != null, typeof(ArgumentNullException), nameof(targetPropertyName)); Debug2.Validate(targetPropertyName != null, typeof(ArgumentNullException), nameof(targetPropertyName));
KeyframeAnimation.AnimationTargetInfo animationTargetInfo = (KeyframeAnimation.AnimationTargetInfo)null; KeyframeAnimation.AnimationTargetInfo animationTargetInfo = null;
if (this.m_targetList != null) if (this.m_targetList != null)
{ {
foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList) foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList)
@@ -286,7 +286,7 @@ namespace Microsoft.Iris.Render.Animation
if (animationTargetInfo == null) if (animationTargetInfo == null)
return; return;
this.m_remoteObject.SendRemoveTarget(animationTargetInfo.Target.TargetId); this.m_remoteObject.SendRemoveTarget(animationTargetInfo.Target.TargetId);
this.m_targetList.Remove((object)animationTargetInfo); this.m_targetList.Remove(animationTargetInfo);
animationTargetInfo.Target.Dispose(); animationTargetInfo.Target.Dispose();
} }
@@ -321,7 +321,7 @@ namespace Microsoft.Iris.Render.Animation
AnimationEvent animationEvent) AnimationEvent animationEvent)
{ {
Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent));
Debug2.Validate((double)absoluteTime >= 0.0, typeof(ArgumentException), "absoluteTime value must be >= 0.0f"); Debug2.Validate(absoluteTime >= 0.0, typeof(ArgumentException), "absoluteTime value must be >= 0.0f");
RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; RENDERHANDLE targetObjectId = animationEvent.TargetObjectId;
if (!(targetObjectId != RENDERHANDLE.NULL)) if (!(targetObjectId != RENDERHANDLE.NULL))
return; return;
@@ -333,7 +333,7 @@ namespace Microsoft.Iris.Render.Animation
AnimationEvent animationEvent) AnimationEvent animationEvent)
{ {
Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent)); Debug2.Validate(animationEvent != null, typeof(ArgumentNullException), nameof(animationEvent));
Debug2.Validate((double)progress >= 0.0 && (double)progress <= 1.0, typeof(ArgumentException), "'progress' value must be between 0.0f and 1.0f"); Debug2.Validate(progress >= 0.0 && progress <= 1.0, typeof(ArgumentException), "'progress' value must be between 0.0f and 1.0f");
RENDERHANDLE targetObjectId = animationEvent.TargetObjectId; RENDERHANDLE targetObjectId = animationEvent.TargetObjectId;
if (!(targetObjectId != RENDERHANDLE.NULL)) if (!(targetObjectId != RENDERHANDLE.NULL))
return; return;
@@ -369,18 +369,18 @@ namespace Microsoft.Iris.Render.Animation
uint IAnimatableObject.GetPropertyId(string propertyName) uint IAnimatableObject.GetPropertyId(string propertyName)
{ {
if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(propertyName, OutputProperty, StringComparison.OrdinalIgnoreCase) == 0)
return 1; return 1;
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName); Debug2.Validate(false, typeof(ArgumentException), "Unsupported property: {0}", propertyName);
return 0; return 0;
} }
AnimationInputType IAnimatableObject.GetPropertyType( AnimationInputType IAnimatableObject.GetPropertyType(
string propertyName) string propertyName)
{ {
if (string.Compare(propertyName, Microsoft.Iris.Render.Animation.Animation.OutputProperty, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(propertyName, OutputProperty, StringComparison.OrdinalIgnoreCase) == 0)
return this.Type; return this.Type;
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName); Debug2.Validate(false, typeof(ArgumentException), "Unsupported property: {0}", propertyName);
return AnimationInputType.Float; return AnimationInputType.Float;
} }
@@ -388,23 +388,23 @@ namespace Microsoft.Iris.Render.Animation
uint IActivatableObject.GetMethodId(string methodName) uint IActivatableObject.GetMethodId(string methodName)
{ {
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PlayMethod, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(methodName, PlayMethod, StringComparison.OrdinalIgnoreCase) == 0)
return 1; return 1;
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PauseMethod, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(methodName, PauseMethod, StringComparison.OrdinalIgnoreCase) == 0)
return 2; return 2;
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.ResetMethod, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(methodName, ResetMethod, StringComparison.OrdinalIgnoreCase) == 0)
return 3; return 3;
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.FinishMethod, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(methodName, FinishMethod, StringComparison.OrdinalIgnoreCase) == 0)
return 4; return 4;
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.NotifyMethod, StringComparison.OrdinalIgnoreCase) == 0) if (string.Compare(methodName, NotifyMethod, StringComparison.OrdinalIgnoreCase) == 0)
return 5; return 5;
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported method: {0}", (object)methodName); Debug2.Validate(false, typeof(ArgumentException), "Unsupported method: {0}", methodName);
return 0; return 0;
} }
RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle; RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteObject.RenderHandle;
void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = (RemoteAnimation)null; void IRenderHandleOwner.OnDisconnect() => this.m_remoteObject = null;
private void SendInput(int keyframeIndex, AnimationInput input) private void SendInput(int keyframeIndex, AnimationInput input)
{ {
@@ -542,7 +542,7 @@ namespace Microsoft.Iris.Render.Animation
} }
} }
private uint GeneratePropertyInfo(AnimationInputType sourceType, AnimationTypeMask sourceMask) => (uint)((int)(sourceType & (AnimationInputType.Vector4 | AnimationInputType.Quaternion)) << 19 | ((int)sourceMask.ChannelCount & 7) << 16 | (int)sourceMask.MaskCode & (int)ushort.MaxValue); private uint GeneratePropertyInfo(AnimationInputType sourceType, AnimationTypeMask sourceMask) => (uint)((int)(sourceType & (AnimationInputType.Vector4 | AnimationInputType.Quaternion)) << 19 | ((int)sourceMask.ChannelCount & 7) << 16 | sourceMask.MaskCode & ushort.MaxValue);
private enum KeyframeSlots private enum KeyframeSlots
{ {
@@ -33,7 +33,7 @@ namespace Microsoft.Iris.Render.Animation
Debug2.Validate(sourceAnimation is IAnimatableObject, typeof(ArgumentException), nameof(sourceAnimation)); Debug2.Validate(sourceAnimation is IAnimatableObject, typeof(ArgumentException), nameof(sourceAnimation));
AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec); AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec);
this.m_object = (IAnimatableObject)sourceAnimation; this.m_object = (IAnimatableObject)sourceAnimation;
this.m_propertyName = Microsoft.Iris.Render.Animation.Animation.OutputProperty; this.m_propertyName = Animation.OutputProperty;
this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask); this.CommonCreate(this.m_object.GetPropertyType(this.m_propertyName), sourceMask);
} }
@@ -54,7 +54,7 @@ namespace Microsoft.Iris.Render.Animation
bool flag = this.m_object.UsageCount == 1; bool flag = this.m_object.UsageCount == 1;
this.m_object.UnregisterUsage(user); this.m_object.UnregisterUsage(user);
if (flag) if (flag)
this.m_object = (IAnimatableObject)null; this.m_object = null;
base.UnregisterUsage(user); base.UnregisterUsage(user);
} }
} }
@@ -31,14 +31,14 @@ namespace Microsoft.Iris.Render
Debug2.Validate(eventTarget != null, typeof(ArgumentNullException), nameof(eventTarget)); Debug2.Validate(eventTarget != null, typeof(ArgumentNullException), nameof(eventTarget));
Debug2.Validate(eventTarget is IActivatableObject, typeof(ArgumentException), nameof(eventTarget)); Debug2.Validate(eventTarget is IActivatableObject, typeof(ArgumentException), nameof(eventTarget));
Debug2.Validate(eventMethodName != null, typeof(ArgumentNullException), nameof(eventMethodName)); Debug2.Validate(eventMethodName != null, typeof(ArgumentNullException), nameof(eventMethodName));
this.m_eventId = AnimationEvent.AllocateEventId(); this.m_eventId = AllocateEventId();
this.m_eventTarget = (IActivatableObject)eventTarget; this.m_eventTarget = (IActivatableObject)eventTarget;
this.m_eventMethodName = eventMethodName; this.m_eventMethodName = eventMethodName;
this.m_eventMethodArg = eventMethodArg; this.m_eventMethodArg = eventMethodArg;
this.m_allowRepeat = false; this.m_allowRepeat = false;
} }
~AnimationEvent() => this.m_eventTarget = (IActivatableObject)null; ~AnimationEvent() => this.m_eventTarget = null;
internal uint EventId => this.m_eventId; internal uint EventId => this.m_eventId;
@@ -60,6 +60,6 @@ namespace Microsoft.Iris.Render
set => this.m_initialActivation = value; set => this.m_initialActivation = value;
} }
private static uint AllocateEventId() => (uint)AnimationEvent.s_eventIdSeed++; private static uint AllocateEventId() => (uint)s_eventIdSeed++;
} }
} }
@@ -64,14 +64,14 @@ namespace Microsoft.Iris.Render
{ {
Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left)); Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left));
Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right)); Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right));
return (AnimationInput)new BinaryOperation(BinaryOpCode.Add, left, right); return new BinaryOperation(BinaryOpCode.Add, left, right);
} }
public static AnimationInput operator *(AnimationInput left, AnimationInput right) public static AnimationInput operator *(AnimationInput left, AnimationInput right)
{ {
Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left)); Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left));
Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right)); Debug2.Validate(right != null, typeof(ArgumentNullException), nameof(right));
return (AnimationInput)new BinaryOperation(BinaryOpCode.Multiply, left, right); return new BinaryOperation(BinaryOpCode.Multiply, left, right);
} }
} }
} }
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Render
AnimationInput value, AnimationInput value,
AnimationInterpolation interpolation) AnimationInterpolation interpolation)
{ {
Debug2.Validate((double)time >= 0.0, typeof(ArgumentException), "'time' must not be negative"); Debug2.Validate(time >= 0.0, typeof(ArgumentException), "'time' must not be negative");
Debug2.Validate(value != null, typeof(ArgumentNullException), nameof(value)); Debug2.Validate(value != null, typeof(ArgumentNullException), nameof(value));
Debug2.Validate(interpolation != null, typeof(ArgumentNullException), nameof(interpolation)); Debug2.Validate(interpolation != null, typeof(ArgumentNullException), nameof(interpolation));
this.m_time = time; this.m_time = time;
@@ -26,15 +26,15 @@ namespace Microsoft.Iris.Render
public AnimationTypeMask(AnimationTypeChannel channel0) public AnimationTypeMask(AnimationTypeChannel channel0)
{ {
this.m_maskCode = (ushort)0; this.m_maskCode = 0;
this.m_channelCount = (byte)1; this.m_channelCount = 1;
this[0] = channel0; this[0] = channel0;
} }
public AnimationTypeMask(AnimationTypeChannel channel0, AnimationTypeChannel channel1) public AnimationTypeMask(AnimationTypeChannel channel0, AnimationTypeChannel channel1)
{ {
this.m_maskCode = (ushort)0; this.m_maskCode = 0;
this.m_channelCount = (byte)2; this.m_channelCount = 2;
this[0] = channel0; this[0] = channel0;
this[1] = channel1; this[1] = channel1;
} }
@@ -44,8 +44,8 @@ namespace Microsoft.Iris.Render
AnimationTypeChannel channel1, AnimationTypeChannel channel1,
AnimationTypeChannel channel2) AnimationTypeChannel channel2)
{ {
this.m_maskCode = (ushort)0; this.m_maskCode = 0;
this.m_channelCount = (byte)3; this.m_channelCount = 3;
this[0] = channel0; this[0] = channel0;
this[1] = channel1; this[1] = channel1;
this[2] = channel2; this[2] = channel2;
@@ -57,8 +57,8 @@ namespace Microsoft.Iris.Render
AnimationTypeChannel channel2, AnimationTypeChannel channel2,
AnimationTypeChannel channel3) AnimationTypeChannel channel3)
{ {
this.m_maskCode = (ushort)0; this.m_maskCode = 0;
this.m_channelCount = (byte)4; this.m_channelCount = 4;
this[0] = channel0; this[0] = channel0;
this[1] = channel1; this[1] = channel1;
this[2] = channel2; this[2] = channel2;
@@ -73,14 +73,14 @@ namespace Microsoft.Iris.Render
internal ushort MaskCode => this.m_maskCode; internal ushort MaskCode => this.m_maskCode;
public uint ChannelCount => (uint)this.m_channelCount & 7U; public uint ChannelCount => m_channelCount & 7U;
public static AnimationTypeMask FromString(string maskSpec) public static AnimationTypeMask FromString(string maskSpec)
{ {
AnimationTypeMask animationTypeMask; AnimationTypeMask animationTypeMask;
if (string.IsNullOrEmpty(maskSpec)) if (string.IsNullOrEmpty(maskSpec))
{ {
animationTypeMask = AnimationTypeMask.Default; animationTypeMask = Default;
} }
else else
{ {
@@ -91,42 +91,42 @@ namespace Microsoft.Iris.Render
switch (maskSpec[index]) switch (maskSpec[index])
{ {
case '0': case '0':
arrayList.Add((object)AnimationTypeChannel.O); arrayList.Add(AnimationTypeChannel.O);
break; break;
case 'A': case 'A':
case 'a': case 'a':
arrayList.Add((object)AnimationTypeChannel.W); arrayList.Add(AnimationTypeChannel.W);
break; break;
case 'B': case 'B':
case 'b': case 'b':
arrayList.Add((object)AnimationTypeChannel.Z); arrayList.Add(AnimationTypeChannel.Z);
break; break;
case 'G': case 'G':
case 'g': case 'g':
arrayList.Add((object)AnimationTypeChannel.Y); arrayList.Add(AnimationTypeChannel.Y);
break; break;
case 'R': case 'R':
case 'r': case 'r':
arrayList.Add((object)AnimationTypeChannel.X); arrayList.Add(AnimationTypeChannel.X);
break; break;
case 'W': case 'W':
case 'w': case 'w':
arrayList.Add((object)AnimationTypeChannel.W); arrayList.Add(AnimationTypeChannel.W);
break; break;
case 'X': case 'X':
case 'x': case 'x':
arrayList.Add((object)AnimationTypeChannel.X); arrayList.Add(AnimationTypeChannel.X);
break; break;
case 'Y': case 'Y':
case 'y': case 'y':
arrayList.Add((object)AnimationTypeChannel.Y); arrayList.Add(AnimationTypeChannel.Y);
break; break;
case 'Z': case 'Z':
case 'z': case 'z':
arrayList.Add((object)AnimationTypeChannel.Z); arrayList.Add(AnimationTypeChannel.Z);
break; break;
default: default:
Debug2.Validate(false, typeof(ArgumentException), (object)"Invalid mask spec: {0}", (object)maskSpec[index]); Debug2.Validate(false, typeof(ArgumentException), "Invalid mask spec: {0}", maskSpec[index]);
break; break;
} }
} }
@@ -146,14 +146,14 @@ namespace Microsoft.Iris.Render
break; break;
default: default:
Debug2.Throw(false, "Too many channels in mask spec!"); Debug2.Throw(false, "Too many channels in mask spec!");
animationTypeMask = AnimationTypeMask.Default; animationTypeMask = Default;
break; break;
} }
} }
return animationTypeMask; return animationTypeMask;
} }
public override bool Equals(object obj) => obj is AnimationTypeMask animationTypeMask && (int)animationTypeMask.m_channelCount == (int)this.m_channelCount && (int)animationTypeMask.m_maskCode == (int)this.m_maskCode; public override bool Equals(object obj) => obj is AnimationTypeMask animationTypeMask && animationTypeMask.m_channelCount == m_channelCount && animationTypeMask.m_maskCode == m_maskCode;
public override int GetHashCode() => this.m_channelCount.GetHashCode() ^ this.m_maskCode.GetHashCode(); public override int GetHashCode() => this.m_channelCount.GetHashCode() ^ this.m_maskCode.GetHashCode();
@@ -183,7 +183,7 @@ namespace Microsoft.Iris.Render
} }
if (this.ChannelCount != 0U) if (this.ChannelCount != 0U)
{ {
for (int channelIndex = 0; (long)channelIndex < (long)this.ChannelCount; ++channelIndex) for (int channelIndex = 0; channelIndex < ChannelCount; ++channelIndex)
{ {
if (this[channelIndex] > animationTypeChannel) if (this[channelIndex] > animationTypeChannel)
flag = false; flag = false;
@@ -222,7 +222,7 @@ namespace Microsoft.Iris.Render
private AnimationTypeChannel GetChannel(int channelIndex) private AnimationTypeChannel GetChannel(int channelIndex)
{ {
Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof(ArgumentOutOfRangeException), "Channel index must be between 0 and 3"); Debug2.Validate(channelIndex >= 0 && channelIndex <= 3, typeof(ArgumentOutOfRangeException), "Channel index must be between 0 and 3");
return (AnimationTypeChannel)((int)this.m_maskCode >> channelIndex * 4 & 15); return (AnimationTypeChannel)(m_maskCode >> channelIndex * 4 & 15);
} }
private void SetChannel(int channelIndex, AnimationTypeChannel channel) private void SetChannel(int channelIndex, AnimationTypeChannel channel)
@@ -231,7 +231,7 @@ namespace Microsoft.Iris.Render
Debug2.Validate(channel >= AnimationTypeChannel.O && channel <= AnimationTypeChannel.W, typeof(ArgumentOutOfRangeException), nameof(channel)); Debug2.Validate(channel >= AnimationTypeChannel.O && channel <= AnimationTypeChannel.W, typeof(ArgumentOutOfRangeException), nameof(channel));
int num1 = (int)channel << channelIndex * 4; int num1 = (int)channel << channelIndex * 4;
int num2 = 15 << channelIndex * 4; int num2 = 15 << channelIndex * 4;
this.m_maskCode = (ushort)(((int)this.m_maskCode & ~num2 | num1 & num2) & (int)ushort.MaxValue); this.m_maskCode = (ushort)((m_maskCode & ~num2 | num1 & num2) & ushort.MaxValue);
} }
} }
} }
@@ -40,7 +40,7 @@ namespace Microsoft.Iris.Render
public override bool Equals(object obj) => obj is AxisAngle axisAngle && this == axisAngle; public override bool Equals(object obj) => obj is AxisAngle axisAngle && this == axisAngle;
public static bool operator ==(AxisAngle left, AxisAngle right) => left.Axis == right.Axis && (double)left.Angle == (double)right.Angle; public static bool operator ==(AxisAngle left, AxisAngle right) => left.Axis == right.Axis && left.Angle == (double)right.Angle;
public static bool operator !=(AxisAngle left, AxisAngle right) => !(left == right); public static bool operator !=(AxisAngle left, AxisAngle right) => !(left == right);
@@ -79,8 +79,8 @@ namespace Microsoft.Iris.Render
internal override void AddCacheKey(ByteBuilder cacheKey) internal override void AddCacheKey(ByteBuilder cacheKey)
{ {
base.AddCacheKey(cacheKey); base.AddCacheKey(cacheKey);
this.GenerateClassCacheKey((byte)2, (byte)this.m_colorOperation, cacheKey); this.GenerateClassCacheKey(2, (byte)this.m_colorOperation, cacheKey);
this.GenerateClassCacheKey((byte)2, (byte)this.m_alphaOperation, cacheKey); this.GenerateClassCacheKey(2, (byte)this.m_alphaOperation, cacheKey);
this.m_effectInput1.AddCacheKey(cacheKey); this.m_effectInput1.AddCacheKey(cacheKey);
this.m_effectInput2.AddCacheKey(cacheKey); this.m_effectInput2.AddCacheKey(cacheKey);
} }
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Render
: this() : this()
{ {
Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName)); Debug2.Validate(!string.IsNullOrEmpty(stName), typeof(ArgumentException), nameof(stName));
Debug2.Validate((double)flBrightness >= -1.0 && (double)flBrightness <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Brightness is [-1..1]"); Debug2.Validate(flBrightness >= -1.0 && flBrightness <= 1.0, typeof(ArgumentOutOfRangeException), "Valid range for Brightness is [-1..1]");
this.m_flBrightness = flBrightness; this.m_flBrightness = flBrightness;
this.m_stName = stName; this.m_stName = stName;
} }
@@ -39,10 +39,10 @@ namespace Microsoft.Iris.Render
Map<string, EffectProperty> dictionary, Map<string, EffectProperty> dictionary,
ref byte nNextUniqueID) ref byte nNextUniqueID)
{ {
return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Brightness", (byte)8, ref this.m_nBrightnessID, ref nNextUniqueID); return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Brightness", 8, ref this.m_nBrightnessID, ref nNextUniqueID);
} }
internal override bool Process(Map<string, EffectProperty> dictProperties) => this.GenerateProperty("Brightness", EffectPropertyType.Float, (object)this.m_flBrightness, this.m_nBrightnessID, dictProperties); internal override bool Process(Map<string, EffectProperty> dictProperties) => this.GenerateProperty("Brightness", EffectPropertyType.Float, m_flBrightness, this.m_nBrightnessID, dictProperties);
internal override void AddCacheKey(ByteBuilder cacheKey) internal override void AddCacheKey(ByteBuilder cacheKey)
{ {
@@ -13,7 +13,7 @@ namespace Microsoft.Iris.Render
private bool m_refreshOnRepeat; private bool m_refreshOnRepeat;
public CapturedAnimationInput(IAnimatable sourceObject, string sourcePropertyName) public CapturedAnimationInput(IAnimatable sourceObject, string sourcePropertyName)
: this(sourceObject, sourcePropertyName, (string)null) : this(sourceObject, sourcePropertyName, null)
{ {
} }
@@ -26,7 +26,7 @@ namespace Microsoft.Iris.Render
} }
public CapturedAnimationInput(IAnimation sourceAnimation) public CapturedAnimationInput(IAnimation sourceAnimation)
: this(sourceAnimation, (string)null) : this(sourceAnimation, null)
{ {
} }
@@ -24,12 +24,12 @@ namespace Microsoft.Iris.Render
} }
public ColorElement(string stName) public ColorElement(string stName)
: this(stName, ColorElement.DefaultColor) : this(stName, DefaultColor)
{ {
} }
public ColorElement() public ColorElement()
: this("", ColorElement.DefaultColor) : this("", DefaultColor)
{ {
} }
@@ -41,16 +41,16 @@ namespace Microsoft.Iris.Render
internal byte ColorID => this.m_nColorID; internal byte ColorID => this.m_nColorID;
internal static ColorF DefaultColor => ColorElement.s_defaultColor; internal static ColorF DefaultColor => s_defaultColor;
internal override int PreProcessProperties( internal override int PreProcessProperties(
Map<string, EffectProperty> dictionary, Map<string, EffectProperty> dictionary,
ref byte nNextUniqueID) ref byte nNextUniqueID)
{ {
return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Color", (byte)20, ref this.m_nColorID, ref nNextUniqueID); return base.PreProcessProperties(dictionary, ref nNextUniqueID) + this.PreProcessProperty(dictionary, "Color", 20, ref this.m_nColorID, ref nNextUniqueID);
} }
internal override bool Process(Map<string, EffectProperty> dictProperties) => this.GenerateProperty("Color", EffectPropertyType.Color, (object)this.m_clrColor, this.m_nColorID, dictProperties); internal override bool Process(Map<string, EffectProperty> dictProperties) => this.GenerateProperty("Color", EffectPropertyType.Color, m_clrColor, this.m_nColorID, dictProperties);
internal override void AddCacheKey(ByteBuilder cacheKey) internal override void AddCacheKey(ByteBuilder cacheKey)
{ {

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