mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Simplified usages
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Microsoft.Iris.Input
|
||||
public static readonly Cursor Arrow = new Cursor(32512, CursorID.Arrow);
|
||||
public static readonly Cursor AppStarting = new Cursor(32550, CursorID.AppStarting);
|
||||
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 Help = new Cursor(32651, CursorID.Help);
|
||||
public static readonly Cursor IBeam = new Cursor(32513, CursorID.IBeam);
|
||||
@@ -48,39 +48,39 @@ namespace Microsoft.Iris.Input
|
||||
switch (cursor)
|
||||
{
|
||||
case CursorID.Arrow:
|
||||
return Cursor.Arrow;
|
||||
return Arrow;
|
||||
case CursorID.Cancel:
|
||||
return Cursor.Cancel;
|
||||
return Cancel;
|
||||
case CursorID.Copy:
|
||||
return Cursor.Copy;
|
||||
return Copy;
|
||||
case CursorID.Crosshair:
|
||||
return Cursor.Crosshair;
|
||||
return Crosshair;
|
||||
case CursorID.IBeam:
|
||||
return Cursor.IBeam;
|
||||
return IBeam;
|
||||
case CursorID.Hand:
|
||||
return Cursor.Hand;
|
||||
return Hand;
|
||||
case CursorID.Move:
|
||||
return Cursor.Move;
|
||||
return Move;
|
||||
case CursorID.No:
|
||||
return Cursor.No;
|
||||
return No;
|
||||
case CursorID.None:
|
||||
return Cursor.NullCursor;
|
||||
return NullCursor;
|
||||
case CursorID.Size:
|
||||
return Cursor.Size;
|
||||
return Size;
|
||||
case CursorID.SizeNS:
|
||||
return Cursor.SizeNS;
|
||||
return SizeNS;
|
||||
case CursorID.SizeWE:
|
||||
return Cursor.SizeWE;
|
||||
return SizeWE;
|
||||
case CursorID.SizeNWSE:
|
||||
return Cursor.SizeNWSE;
|
||||
return SizeNWSE;
|
||||
case CursorID.SizeNESW:
|
||||
return Cursor.SizeNESW;
|
||||
return SizeNESW;
|
||||
case CursorID.UpArrow:
|
||||
return Cursor.UpArrow;
|
||||
return UpArrow;
|
||||
case CursorID.Wait:
|
||||
return Cursor.WaitCursor;
|
||||
return WaitCursor;
|
||||
default:
|
||||
return (Cursor)null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,25 +22,25 @@ namespace Microsoft.Iris.Libraries.OS
|
||||
|
||||
~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)
|
||||
{
|
||||
RegistryKey registryKey = (RegistryKey)null;
|
||||
RegistryKey registryKey = null;
|
||||
IntPtr phkResult;
|
||||
if (Win32Api.RegOpenKeyExW(parentKey, path, 0, 131097, out phkResult) == 0)
|
||||
registryKey = new RegistryKey(phkResult);
|
||||
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)
|
||||
{
|
||||
bool flag = false;
|
||||
value = (byte)0;
|
||||
value = 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;
|
||||
flag = true;
|
||||
@@ -79,17 +79,17 @@ namespace Microsoft.Iris.Libraries.OS
|
||||
public bool ReadString(string valueName, out string value)
|
||||
{
|
||||
bool flag = false;
|
||||
value = (string)null;
|
||||
value = null;
|
||||
int lpcbData = 0;
|
||||
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);
|
||||
return flag;
|
||||
}
|
||||
|
||||
private bool ReadStringValueWorker(string valueName, int dataBytes, out string value)
|
||||
{
|
||||
value = (string)null;
|
||||
value = null;
|
||||
bool flag = false;
|
||||
int length = dataBytes / 2;
|
||||
char[] lpData = new char[length];
|
||||
@@ -108,7 +108,7 @@ namespace Microsoft.Iris.Libraries.OS
|
||||
{
|
||||
Win32Api.RegCloseKey(this._hkey);
|
||||
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 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 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(
|
||||
string format,
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.Iris.Library
|
||||
object param3,
|
||||
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(
|
||||
@@ -38,7 +38,7 @@ namespace Microsoft.Iris.Library
|
||||
object param4,
|
||||
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(
|
||||
@@ -50,7 +50,7 @@ namespace Microsoft.Iris.Library
|
||||
object param5,
|
||||
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(
|
||||
@@ -63,7 +63,7 @@ namespace Microsoft.Iris.Library
|
||||
object param6,
|
||||
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(
|
||||
@@ -77,7 +77,7 @@ namespace Microsoft.Iris.Library
|
||||
object param7,
|
||||
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(
|
||||
@@ -92,7 +92,7 @@ namespace Microsoft.Iris.Library
|
||||
object param8,
|
||||
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(
|
||||
@@ -108,7 +108,7 @@ namespace Microsoft.Iris.Library
|
||||
object param9,
|
||||
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(
|
||||
@@ -125,7 +125,7 @@ namespace Microsoft.Iris.Library
|
||||
object param10,
|
||||
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;
|
||||
@@ -140,11 +140,11 @@ namespace Microsoft.Iris.Library
|
||||
|
||||
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>
|
||||
{
|
||||
@@ -158,9 +158,9 @@ namespace Microsoft.Iris.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InvariantString.OrdinalStringComparer._instance == null)
|
||||
InvariantString.OrdinalStringComparer._instance = new InvariantString.OrdinalStringComparer();
|
||||
return InvariantString.OrdinalStringComparer._instance;
|
||||
if (_instance == null)
|
||||
_instance = new InvariantString.OrdinalStringComparer();
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,9 +183,9 @@ namespace Microsoft.Iris.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (InvariantString.OrdinalIgnoreCaseStringComparer._instance == null)
|
||||
InvariantString.OrdinalIgnoreCaseStringComparer._instance = new InvariantString.OrdinalIgnoreCaseStringComparer();
|
||||
return InvariantString.OrdinalIgnoreCaseStringComparer._instance;
|
||||
if (_instance == null)
|
||||
_instance = new InvariantString.OrdinalIgnoreCaseStringComparer();
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace Microsoft.Iris.Render.Animation
|
||||
{
|
||||
if (inDispose && this.m_remoteObject != null)
|
||||
this.m_remoteObject.Dispose();
|
||||
this.m_remoteObject = (RemoteAnimationInputProvider)null;
|
||||
this.m_externalInput = (ExternalAnimationInput)null;
|
||||
this.m_remoteObject = null;
|
||||
this.m_externalInput = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -50,7 +50,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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(
|
||||
string propertyName,
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
this.m_remoteObject = ownerSession.BuildRemoteAnimationManager(this);
|
||||
this.m_flSpeedAdjustment = 1f;
|
||||
this.m_backCompat = false;
|
||||
this.RegisterUsage((object)ownerSession);
|
||||
this.RegisterUsage(ownerSession);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool inDispose)
|
||||
@@ -35,8 +35,8 @@ namespace Microsoft.Iris.Render.Animation
|
||||
{
|
||||
if (inDispose && this.m_remoteObject != null)
|
||||
this.m_remoteObject.Dispose();
|
||||
this.m_ownerSession = (RenderSession)null;
|
||||
this.m_remoteObject = (RemoteAnimationManager)null;
|
||||
this.m_ownerSession = null;
|
||||
this.m_remoteObject = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
Debug2.Validate(initialValue != null, typeof(ArgumentNullException), nameof(initialValue));
|
||||
KeyframeAnimation keyframeAnimation = new KeyframeAnimation(this, initialValue);
|
||||
keyframeAnimation.RegisterUsage(objUser);
|
||||
return (IKeyframeAnimation)keyframeAnimation;
|
||||
return keyframeAnimation;
|
||||
}
|
||||
|
||||
IAnimationGroup IAnimationSystem.CreateAnimationGroup(
|
||||
@@ -69,7 +69,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser));
|
||||
AnimationGroup animationGroup = new AnimationGroup(this);
|
||||
animationGroup.RegisterUsage(objUser);
|
||||
return (IAnimationGroup)animationGroup;
|
||||
return animationGroup;
|
||||
}
|
||||
|
||||
void IAnimationSystem.PulseTimeAdvance(int nAdvanceMs) => this.PulseTimeAdvance(nAdvanceMs);
|
||||
@@ -102,7 +102,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
object objUser,
|
||||
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);
|
||||
@@ -113,7 +113,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace Microsoft.Iris.Render.Animation
|
||||
internal AnimationTarget(IAnimatableObject targetObject, string targetPropertyName)
|
||||
{
|
||||
int propertyType = (int)targetObject.GetPropertyType(targetPropertyName);
|
||||
targetObject.RegisterUsage((object)this);
|
||||
this.m_targetId = Interlocked.Increment(ref AnimationTarget.s_targetIdSeed);
|
||||
targetObject.RegisterUsage(this);
|
||||
this.m_targetId = Interlocked.Increment(ref s_targetIdSeed);
|
||||
this.m_object = targetObject;
|
||||
this.m_property = targetPropertyName;
|
||||
}
|
||||
@@ -30,8 +30,8 @@ namespace Microsoft.Iris.Render.Animation
|
||||
try
|
||||
{
|
||||
if (fInDispose)
|
||||
this.m_object.UnregisterUsage((object)this);
|
||||
this.m_object = (IAnimatableObject)null;
|
||||
this.m_object.UnregisterUsage(this);
|
||||
this.m_object = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
{
|
||||
Debug2.Validate(objUser != null, typeof(ArgumentNullException), nameof(objUser));
|
||||
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_session = session;
|
||||
this.m_remoteObject = session.BuildRemoteExternalAnimationInput(this, this.m_uniqueId);
|
||||
@@ -46,9 +46,9 @@ namespace Microsoft.Iris.Render.Animation
|
||||
{
|
||||
if (inDispose && this.m_remoteObject != null)
|
||||
this.m_remoteObject.Dispose();
|
||||
this.m_remoteObject = (RemoteExternalAnimationInput)null;
|
||||
this.m_propertyMap = (IAnimationPropertyMap)null;
|
||||
this.m_session = (RenderSession)null;
|
||||
this.m_remoteObject = null;
|
||||
this.m_propertyMap = null;
|
||||
this.m_session = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
void IRenderHandleOwner.OnDisconnect()
|
||||
{
|
||||
this.m_uniqueId = 0U;
|
||||
this.m_remoteObject = (RemoteExternalAnimationInput)null;
|
||||
this.m_remoteObject = null;
|
||||
}
|
||||
|
||||
RENDERHANDLE IAnimatableObject.GetObjectId() => this.m_remoteObject.RenderHandle;
|
||||
@@ -79,7 +79,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
IAnimationInputProvider IExternalAnimationInput.CreateProvider(
|
||||
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)
|
||||
{
|
||||
this.m_animationSystem = owner;
|
||||
this.m_reference = (AnimationInput)null;
|
||||
this.m_scale = (AnimationInput)null;
|
||||
this.m_reference = null;
|
||||
this.m_scale = null;
|
||||
this.m_animationType = initialValue.InputType;
|
||||
this.m_keyframeList = new Vector();
|
||||
this.m_repeatCount = 0;
|
||||
this.m_autoReset = false;
|
||||
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);
|
||||
if (this.m_animationSystem.BackCompat)
|
||||
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)
|
||||
@@ -64,18 +64,18 @@ namespace Microsoft.Iris.Render.Animation
|
||||
if (this.m_keyframeList != null)
|
||||
{
|
||||
foreach (AnimationKeyframe keyframe in this.m_keyframeList)
|
||||
keyframe.Value.UnregisterUsage((object)this);
|
||||
keyframe.Value.UnregisterUsage(this);
|
||||
this.m_keyframeList.Clear();
|
||||
}
|
||||
if (this.m_remoteObject != null)
|
||||
this.m_remoteObject.Dispose();
|
||||
this.m_animationSystem.UnregisterUsage((object)this);
|
||||
this.m_animationSystem.UnregisterUsage(this);
|
||||
}
|
||||
this.m_remoteObject = (RemoteAnimation)null;
|
||||
this.m_reference = (AnimationInput)null;
|
||||
this.m_keyframeList = (Vector)null;
|
||||
this.m_targetList = (Vector)null;
|
||||
this.m_animationSystem = (AnimationSystem)null;
|
||||
this.m_remoteObject = null;
|
||||
this.m_reference = null;
|
||||
this.m_keyframeList = null;
|
||||
this.m_targetList = null;
|
||||
this.m_animationSystem = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -146,7 +146,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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.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(keyframeIndex >= 0 || keyframeIndex < this.m_keyframeList.Count, typeof(ArgumentOutOfRangeException), nameof(keyframeIndex));
|
||||
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);
|
||||
}
|
||||
|
||||
internal void SetKeyframe(int keyframeIndex, AnimationKeyframe keyframe, bool replaceKeyframe)
|
||||
{
|
||||
keyframe.Value.RegisterUsage((object)this);
|
||||
keyframe.Value.RegisterUsage(this);
|
||||
if (replaceKeyframe)
|
||||
{
|
||||
AnimationKeyframe keyframe1 = (AnimationKeyframe)this.m_keyframeList[keyframeIndex];
|
||||
this.m_keyframeList.RemoveAt(keyframeIndex);
|
||||
this.m_keyframeList.Insert(keyframeIndex, (object)keyframe);
|
||||
keyframe1.Value.UnregisterUsage((object)this);
|
||||
this.m_keyframeList.Insert(keyframeIndex, keyframe);
|
||||
keyframe1.Value.UnregisterUsage(this);
|
||||
}
|
||||
this.m_remoteObject.SendSetKeyframeTime(keyframeIndex, keyframe.Time);
|
||||
this.SendInput(keyframeIndex, keyframe.Value);
|
||||
@@ -231,7 +231,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
string targetPropertyName)
|
||||
{
|
||||
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(
|
||||
@@ -254,14 +254,14 @@ namespace Microsoft.Iris.Render.Animation
|
||||
AnimationTarget target = new AnimationTarget(targetObject, targetPropertyName);
|
||||
AnimationTypeMask sourceMask = AnimationTypeMask.FromString(targetMaskSpec);
|
||||
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))
|
||||
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);
|
||||
this.m_remoteObject.SendAddTarget(target.TargetId, target.TargetObject.GetObjectId(), target.TargetObject.GetPropertyId(target.TargetPropertyName), propertyInfo);
|
||||
if (this.m_targetList == null)
|
||||
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(
|
||||
@@ -271,7 +271,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
{
|
||||
Debug2.Validate(targetObject != null, typeof(ArgumentNullException), nameof(targetObject));
|
||||
Debug2.Validate(targetPropertyName != null, typeof(ArgumentNullException), nameof(targetPropertyName));
|
||||
KeyframeAnimation.AnimationTargetInfo animationTargetInfo = (KeyframeAnimation.AnimationTargetInfo)null;
|
||||
KeyframeAnimation.AnimationTargetInfo animationTargetInfo = null;
|
||||
if (this.m_targetList != null)
|
||||
{
|
||||
foreach (KeyframeAnimation.AnimationTargetInfo target in this.m_targetList)
|
||||
@@ -286,7 +286,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
if (animationTargetInfo == null)
|
||||
return;
|
||||
this.m_remoteObject.SendRemoveTarget(animationTargetInfo.Target.TargetId);
|
||||
this.m_targetList.Remove((object)animationTargetInfo);
|
||||
this.m_targetList.Remove(animationTargetInfo);
|
||||
animationTargetInfo.Target.Dispose();
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
AnimationEvent 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;
|
||||
if (!(targetObjectId != RENDERHANDLE.NULL))
|
||||
return;
|
||||
@@ -333,7 +333,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
AnimationEvent 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;
|
||||
if (!(targetObjectId != RENDERHANDLE.NULL))
|
||||
return;
|
||||
@@ -369,18 +369,18 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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;
|
||||
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName);
|
||||
Debug2.Validate(false, typeof(ArgumentException), "Unsupported property: {0}", propertyName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AnimationInputType IAnimatableObject.GetPropertyType(
|
||||
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;
|
||||
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported property: {0}", (object)propertyName);
|
||||
Debug2.Validate(false, typeof(ArgumentException), "Unsupported property: {0}", propertyName);
|
||||
return AnimationInputType.Float;
|
||||
}
|
||||
|
||||
@@ -388,23 +388,23 @@ namespace Microsoft.Iris.Render.Animation
|
||||
|
||||
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;
|
||||
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.PauseMethod, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
if (string.Compare(methodName, PauseMethod, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
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;
|
||||
if (string.Compare(methodName, Microsoft.Iris.Render.Animation.Animation.FinishMethod, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
if (string.Compare(methodName, FinishMethod, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
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;
|
||||
Debug2.Validate(false, typeof(ArgumentException), (object)"Unsupported method: {0}", (object)methodName);
|
||||
Debug2.Validate(false, typeof(ArgumentException), "Unsupported method: {0}", methodName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
Debug2.Validate(sourceAnimation is IAnimatableObject, typeof(ArgumentException), nameof(sourceAnimation));
|
||||
AnimationTypeMask sourceMask = AnimationTypeMask.FromString(sourceMaskSpec);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Microsoft.Iris.Render.Animation
|
||||
bool flag = this.m_object.UsageCount == 1;
|
||||
this.m_object.UnregisterUsage(user);
|
||||
if (flag)
|
||||
this.m_object = (IAnimatableObject)null;
|
||||
this.m_object = null;
|
||||
base.UnregisterUsage(user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ namespace Microsoft.Iris.Render
|
||||
Debug2.Validate(eventTarget != null, typeof(ArgumentNullException), nameof(eventTarget));
|
||||
Debug2.Validate(eventTarget is IActivatableObject, typeof(ArgumentException), nameof(eventTarget));
|
||||
Debug2.Validate(eventMethodName != null, typeof(ArgumentNullException), nameof(eventMethodName));
|
||||
this.m_eventId = AnimationEvent.AllocateEventId();
|
||||
this.m_eventId = AllocateEventId();
|
||||
this.m_eventTarget = (IActivatableObject)eventTarget;
|
||||
this.m_eventMethodName = eventMethodName;
|
||||
this.m_eventMethodArg = eventMethodArg;
|
||||
this.m_allowRepeat = false;
|
||||
}
|
||||
|
||||
~AnimationEvent() => this.m_eventTarget = (IActivatableObject)null;
|
||||
~AnimationEvent() => this.m_eventTarget = null;
|
||||
|
||||
internal uint EventId => this.m_eventId;
|
||||
|
||||
@@ -60,6 +60,6 @@ namespace Microsoft.Iris.Render
|
||||
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(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)
|
||||
{
|
||||
Debug2.Validate(left != null, typeof(ArgumentNullException), nameof(left));
|
||||
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,
|
||||
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(interpolation != null, typeof(ArgumentNullException), nameof(interpolation));
|
||||
this.m_time = time;
|
||||
|
||||
@@ -26,15 +26,15 @@ namespace Microsoft.Iris.Render
|
||||
|
||||
public AnimationTypeMask(AnimationTypeChannel channel0)
|
||||
{
|
||||
this.m_maskCode = (ushort)0;
|
||||
this.m_channelCount = (byte)1;
|
||||
this.m_maskCode = 0;
|
||||
this.m_channelCount = 1;
|
||||
this[0] = channel0;
|
||||
}
|
||||
|
||||
public AnimationTypeMask(AnimationTypeChannel channel0, AnimationTypeChannel channel1)
|
||||
{
|
||||
this.m_maskCode = (ushort)0;
|
||||
this.m_channelCount = (byte)2;
|
||||
this.m_maskCode = 0;
|
||||
this.m_channelCount = 2;
|
||||
this[0] = channel0;
|
||||
this[1] = channel1;
|
||||
}
|
||||
@@ -44,8 +44,8 @@ namespace Microsoft.Iris.Render
|
||||
AnimationTypeChannel channel1,
|
||||
AnimationTypeChannel channel2)
|
||||
{
|
||||
this.m_maskCode = (ushort)0;
|
||||
this.m_channelCount = (byte)3;
|
||||
this.m_maskCode = 0;
|
||||
this.m_channelCount = 3;
|
||||
this[0] = channel0;
|
||||
this[1] = channel1;
|
||||
this[2] = channel2;
|
||||
@@ -57,8 +57,8 @@ namespace Microsoft.Iris.Render
|
||||
AnimationTypeChannel channel2,
|
||||
AnimationTypeChannel channel3)
|
||||
{
|
||||
this.m_maskCode = (ushort)0;
|
||||
this.m_channelCount = (byte)4;
|
||||
this.m_maskCode = 0;
|
||||
this.m_channelCount = 4;
|
||||
this[0] = channel0;
|
||||
this[1] = channel1;
|
||||
this[2] = channel2;
|
||||
@@ -73,14 +73,14 @@ namespace Microsoft.Iris.Render
|
||||
|
||||
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)
|
||||
{
|
||||
AnimationTypeMask animationTypeMask;
|
||||
if (string.IsNullOrEmpty(maskSpec))
|
||||
{
|
||||
animationTypeMask = AnimationTypeMask.Default;
|
||||
animationTypeMask = Default;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -91,42 +91,42 @@ namespace Microsoft.Iris.Render
|
||||
switch (maskSpec[index])
|
||||
{
|
||||
case '0':
|
||||
arrayList.Add((object)AnimationTypeChannel.O);
|
||||
arrayList.Add(AnimationTypeChannel.O);
|
||||
break;
|
||||
case 'A':
|
||||
case 'a':
|
||||
arrayList.Add((object)AnimationTypeChannel.W);
|
||||
arrayList.Add(AnimationTypeChannel.W);
|
||||
break;
|
||||
case 'B':
|
||||
case 'b':
|
||||
arrayList.Add((object)AnimationTypeChannel.Z);
|
||||
arrayList.Add(AnimationTypeChannel.Z);
|
||||
break;
|
||||
case 'G':
|
||||
case 'g':
|
||||
arrayList.Add((object)AnimationTypeChannel.Y);
|
||||
arrayList.Add(AnimationTypeChannel.Y);
|
||||
break;
|
||||
case 'R':
|
||||
case 'r':
|
||||
arrayList.Add((object)AnimationTypeChannel.X);
|
||||
arrayList.Add(AnimationTypeChannel.X);
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
arrayList.Add((object)AnimationTypeChannel.W);
|
||||
arrayList.Add(AnimationTypeChannel.W);
|
||||
break;
|
||||
case 'X':
|
||||
case 'x':
|
||||
arrayList.Add((object)AnimationTypeChannel.X);
|
||||
arrayList.Add(AnimationTypeChannel.X);
|
||||
break;
|
||||
case 'Y':
|
||||
case 'y':
|
||||
arrayList.Add((object)AnimationTypeChannel.Y);
|
||||
arrayList.Add(AnimationTypeChannel.Y);
|
||||
break;
|
||||
case 'Z':
|
||||
case 'z':
|
||||
arrayList.Add((object)AnimationTypeChannel.Z);
|
||||
arrayList.Add(AnimationTypeChannel.Z);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -146,14 +146,14 @@ namespace Microsoft.Iris.Render
|
||||
break;
|
||||
default:
|
||||
Debug2.Throw(false, "Too many channels in mask spec!");
|
||||
animationTypeMask = AnimationTypeMask.Default;
|
||||
animationTypeMask = Default;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Microsoft.Iris.Render
|
||||
}
|
||||
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)
|
||||
flag = false;
|
||||
@@ -222,7 +222,7 @@ namespace Microsoft.Iris.Render
|
||||
private AnimationTypeChannel GetChannel(int channelIndex)
|
||||
{
|
||||
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)
|
||||
@@ -231,7 +231,7 @@ namespace Microsoft.Iris.Render
|
||||
Debug2.Validate(channel >= AnimationTypeChannel.O && channel <= AnimationTypeChannel.W, typeof(ArgumentOutOfRangeException), nameof(channel));
|
||||
int num1 = (int)channel << 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 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);
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ namespace Microsoft.Iris.Render
|
||||
internal override void AddCacheKey(ByteBuilder cacheKey)
|
||||
{
|
||||
base.AddCacheKey(cacheKey);
|
||||
this.GenerateClassCacheKey((byte)2, (byte)this.m_colorOperation, cacheKey);
|
||||
this.GenerateClassCacheKey((byte)2, (byte)this.m_alphaOperation, cacheKey);
|
||||
this.GenerateClassCacheKey(2, (byte)this.m_colorOperation, cacheKey);
|
||||
this.GenerateClassCacheKey(2, (byte)this.m_alphaOperation, cacheKey);
|
||||
this.m_effectInput1.AddCacheKey(cacheKey);
|
||||
this.m_effectInput2.AddCacheKey(cacheKey);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Render
|
||||
: this()
|
||||
{
|
||||
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_stName = stName;
|
||||
}
|
||||
@@ -39,10 +39,10 @@ namespace Microsoft.Iris.Render
|
||||
Map<string, EffectProperty> dictionary,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Microsoft.Iris.Render
|
||||
private bool m_refreshOnRepeat;
|
||||
|
||||
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)
|
||||
: this(sourceAnimation, (string)null)
|
||||
: this(sourceAnimation, null)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ namespace Microsoft.Iris.Render
|
||||
}
|
||||
|
||||
public ColorElement(string stName)
|
||||
: this(stName, ColorElement.DefaultColor)
|
||||
: this(stName, DefaultColor)
|
||||
{
|
||||
}
|
||||
|
||||
public ColorElement()
|
||||
: this("", ColorElement.DefaultColor)
|
||||
: this("", DefaultColor)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -41,16 +41,16 @@ namespace Microsoft.Iris.Render
|
||||
|
||||
internal byte ColorID => this.m_nColorID;
|
||||
|
||||
internal static ColorF DefaultColor => ColorElement.s_defaultColor;
|
||||
internal static ColorF DefaultColor => s_defaultColor;
|
||||
|
||||
internal override int PreProcessProperties(
|
||||
Map<string, EffectProperty> dictionary,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft.Iris.Render
|
||||
private float m_flG;
|
||||
private float m_flB;
|
||||
|
||||
public ColorF(int red, int green, int blue) => this = ColorF.FromArgb((int)byte.MaxValue, red, green, blue);
|
||||
public ColorF(int red, int green, int blue) => this = FromArgb(byte.MaxValue, red, green, blue);
|
||||
|
||||
public ColorF(float red, float green, float blue)
|
||||
{
|
||||
@@ -32,7 +32,7 @@ namespace Microsoft.Iris.Render
|
||||
this.m_flB = blue;
|
||||
}
|
||||
|
||||
public ColorF(int alpha, int red, int green, int blue) => this = ColorF.FromArgb(alpha, red, green, blue);
|
||||
public ColorF(int alpha, int red, int green, int blue) => this = FromArgb(alpha, red, green, blue);
|
||||
|
||||
public ColorF(float alpha, float red, float green, float blue)
|
||||
{
|
||||
@@ -68,46 +68,46 @@ namespace Microsoft.Iris.Render
|
||||
|
||||
public uint PackedInt
|
||||
{
|
||||
get => (uint)((int)ColorF.ChannelToByte(this.m_flA) << 24 | (int)ColorF.ChannelToByte(this.m_flR) << 16 | (int)ColorF.ChannelToByte(this.m_flG) << 8) | (uint)ColorF.ChannelToByte(this.m_flB);
|
||||
set => this = ColorF.FromArgb(value);
|
||||
get => (uint)(ChannelToByte(this.m_flA) << 24 | ChannelToByte(this.m_flR) << 16 | ChannelToByte(this.m_flG) << 8) | ChannelToByte(this.m_flB);
|
||||
set => this = FromArgb(value);
|
||||
}
|
||||
|
||||
private static float CheckByte(int value, string name)
|
||||
{
|
||||
if (value < 0 || value > (int)byte.MaxValue)
|
||||
throw new ArgumentException(string.Format("Invalid value ({0}) for {1} color channel. Expecting a value between 0 and 255.", (object)value, (object)name), name);
|
||||
return (float)value / (float)byte.MaxValue;
|
||||
if (value < 0 || value > byte.MaxValue)
|
||||
throw new ArgumentException(string.Format("Invalid value ({0}) for {1} color channel. Expecting a value between 0 and 255.", value, name), name);
|
||||
return value / (float)byte.MaxValue;
|
||||
}
|
||||
|
||||
private static byte ChannelToByte(float flChannel) => (byte)Math.Round((double)Math.Max(Math.Min(1f, flChannel), 0.0f) * (double)byte.MaxValue);
|
||||
private static byte ChannelToByte(float flChannel) => (byte)Math.Round(Math.Max(Math.Min(1f, flChannel), 0.0f) * (double)byte.MaxValue);
|
||||
|
||||
private static uint MakeArgb(byte alpha, byte red, byte green, byte blue) => (uint)((int)red << 16 | (int)green << 8 | (int)blue | (int)alpha << 24);
|
||||
private static uint MakeArgb(byte alpha, byte red, byte green, byte blue) => (uint)(red << 16 | green << 8 | blue | alpha << 24);
|
||||
|
||||
internal static ColorF FromCOLORREF(Win32Api.COLORREF cr) => ColorF.FromArgb(Win32Api.GetRValue(cr), Win32Api.GetGValue(cr), Win32Api.GetBValue(cr));
|
||||
internal static ColorF FromCOLORREF(Win32Api.COLORREF cr) => FromArgb(Win32Api.GetRValue(cr), Win32Api.GetGValue(cr), Win32Api.GetBValue(cr));
|
||||
|
||||
public static ColorF FromArgb(uint argb) => new ColorF((int)(argb >> 24) & (int)byte.MaxValue, (int)(argb >> 16) & (int)byte.MaxValue, (int)(argb >> 8) & (int)byte.MaxValue, (int)argb & (int)byte.MaxValue);
|
||||
public static ColorF FromArgb(uint argb) => new ColorF((int)(argb >> 24) & byte.MaxValue, (int)(argb >> 16) & byte.MaxValue, (int)(argb >> 8) & byte.MaxValue, (int)argb & byte.MaxValue);
|
||||
|
||||
public static ColorF FromArgb(int alpha, int red, int green, int blue) => new ColorF(ColorF.CheckByte(alpha, nameof(alpha)), ColorF.CheckByte(red, nameof(red)), ColorF.CheckByte(green, nameof(green)), ColorF.CheckByte(blue, nameof(blue)));
|
||||
public static ColorF FromArgb(int alpha, int red, int green, int blue) => new ColorF(CheckByte(alpha, nameof(alpha)), CheckByte(red, nameof(red)), CheckByte(green, nameof(green)), CheckByte(blue, nameof(blue)));
|
||||
|
||||
public static ColorF FromArgb(int red, int green, int blue) => ColorF.FromArgb((int)byte.MaxValue, red, green, blue);
|
||||
public static ColorF FromArgb(int red, int green, int blue) => FromArgb(byte.MaxValue, red, green, blue);
|
||||
|
||||
internal Win32Api.COLORREF ToCOLORREF() => Win32Api.RGB(ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB));
|
||||
internal Win32Api.COLORREF ToCOLORREF() => Win32Api.RGB(ChannelToByte(this.m_flR), ChannelToByte(this.m_flG), ChannelToByte(this.m_flB));
|
||||
|
||||
internal Win32Api.COLORREF ToCOLORREF2() => Win32Api.ARGB(ColorF.ChannelToByte(this.m_flA), ColorF.ChannelToByte(this.m_flR), ColorF.ChannelToByte(this.m_flG), ColorF.ChannelToByte(this.m_flB));
|
||||
internal Win32Api.COLORREF ToCOLORREF2() => Win32Api.ARGB(ChannelToByte(this.m_flA), ChannelToByte(this.m_flR), ChannelToByte(this.m_flG), ChannelToByte(this.m_flB));
|
||||
|
||||
internal float GetValue()
|
||||
{
|
||||
float num1 = this.m_flR;
|
||||
float num2 = this.m_flR;
|
||||
if ((double)this.m_flG > (double)num1)
|
||||
if (m_flG > (double)num1)
|
||||
num1 = this.m_flG;
|
||||
if ((double)this.m_flB > (double)num1)
|
||||
if (m_flB > (double)num1)
|
||||
num1 = this.m_flB;
|
||||
if ((double)this.m_flG < (double)num2)
|
||||
if (m_flG < (double)num2)
|
||||
num2 = this.m_flG;
|
||||
if ((double)this.m_flB < (double)num2)
|
||||
if (m_flB < (double)num2)
|
||||
num2 = this.m_flB;
|
||||
return (float)(((double)num1 + (double)num2) / 2.0);
|
||||
return (float)((num1 + (double)num2) / 2.0);
|
||||
}
|
||||
|
||||
internal float GetHue()
|
||||
@@ -117,23 +117,23 @@ namespace Microsoft.Iris.Render
|
||||
float num1 = 0.0f;
|
||||
float num2 = this.m_flR;
|
||||
float num3 = this.m_flR;
|
||||
if ((double)this.m_flG > (double)num2)
|
||||
if (m_flG > (double)num2)
|
||||
num2 = this.m_flG;
|
||||
if ((double)this.m_flB > (double)num2)
|
||||
if (m_flB > (double)num2)
|
||||
num2 = this.m_flB;
|
||||
if ((double)this.m_flG < (double)num3)
|
||||
if (m_flG < (double)num3)
|
||||
num3 = this.m_flG;
|
||||
if ((double)this.m_flB < (double)num3)
|
||||
if (m_flB < (double)num3)
|
||||
num3 = this.m_flB;
|
||||
float num4 = num2 - num3;
|
||||
if ((double)this.m_flR == (double)num2)
|
||||
if (m_flR == (double)num2)
|
||||
num1 = (this.m_flG - this.m_flB) / num4;
|
||||
else if ((double)this.m_flG == (double)num2)
|
||||
num1 = (float)(2.0 + ((double)this.m_flB - (double)this.m_flR) / (double)num4);
|
||||
else if ((double)this.m_flB == (double)num2)
|
||||
num1 = (float)(4.0 + ((double)this.m_flR - (double)this.m_flG) / (double)num4);
|
||||
else if (m_flG == (double)num2)
|
||||
num1 = (float)(2.0 + (m_flB - (double)this.m_flR) / num4);
|
||||
else if (m_flB == (double)num2)
|
||||
num1 = (float)(4.0 + (m_flR - (double)this.m_flG) / num4);
|
||||
float num5 = num1 * 60f;
|
||||
if ((double)num5 < 0.0)
|
||||
if (num5 < 0.0)
|
||||
num5 += 360f;
|
||||
return num5;
|
||||
}
|
||||
@@ -143,16 +143,16 @@ namespace Microsoft.Iris.Render
|
||||
float num = 0.0f;
|
||||
float flValue1 = this.m_flR;
|
||||
float flValue2 = this.m_flR;
|
||||
if ((double)this.m_flG > (double)flValue1)
|
||||
if (m_flG > (double)flValue1)
|
||||
flValue1 = this.m_flG;
|
||||
if ((double)this.m_flB > (double)flValue1)
|
||||
if (m_flB > (double)flValue1)
|
||||
flValue1 = this.m_flB;
|
||||
if ((double)this.m_flG < (double)flValue2)
|
||||
if (m_flG < (double)flValue2)
|
||||
flValue2 = this.m_flG;
|
||||
if ((double)this.m_flB < (double)flValue2)
|
||||
if (m_flB < (double)flValue2)
|
||||
flValue2 = this.m_flB;
|
||||
if (!Math2.WithinEpsilon(flValue1, flValue2))
|
||||
num = ((double)flValue1 + (double)flValue2) / 2.0 > 0.5 ? (float)(((double)flValue1 - (double)flValue2) / (2.0 - (double)flValue1 - (double)flValue2)) : (float)(((double)flValue1 - (double)flValue2) / ((double)flValue1 + (double)flValue2));
|
||||
num = (flValue1 + (double)flValue2) / 2.0 > 0.5 ? (float)((flValue1 - (double)flValue2) / (2.0 - flValue1 - flValue2)) : (float)((flValue1 - (double)flValue2) / (flValue1 + (double)flValue2));
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -162,17 +162,17 @@ namespace Microsoft.Iris.Render
|
||||
float flSaturation,
|
||||
float flValue)
|
||||
{
|
||||
Debug2.Validate((double)flHue >= 0.0 && (double)flHue < 360.0, typeof(ArgumentOutOfRangeException), nameof(flHue));
|
||||
Debug2.Validate((double)flSaturation >= 0.0 && (double)flSaturation <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flSaturation));
|
||||
Debug2.Validate((double)flValue >= 0.0 && (double)flValue <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flValue));
|
||||
Debug2.Validate(flHue >= 0.0 && flHue < 360.0, typeof(ArgumentOutOfRangeException), nameof(flHue));
|
||||
Debug2.Validate(flSaturation >= 0.0 && flSaturation <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flSaturation));
|
||||
Debug2.Validate(flValue >= 0.0 && flValue <= 1.0, typeof(ArgumentOutOfRangeException), nameof(flValue));
|
||||
if (Math2.WithinEpsilon(flSaturation, 0.0f))
|
||||
return new ColorF(flAlpha, flValue, flValue, flValue);
|
||||
float num1 = flHue / 60f;
|
||||
int num2 = (int)Math.Floor((double)num1) % 6;
|
||||
float num3 = num1 - (float)num2;
|
||||
int num2 = (int)Math.Floor(num1) % 6;
|
||||
float num3 = num1 - num2;
|
||||
float num4 = flValue * (1f - flSaturation);
|
||||
float num5 = flValue * (float)(1.0 - (double)num3 * (double)flSaturation);
|
||||
float num6 = flValue * (float)(1.0 - (1.0 - (double)num3) * (double)flSaturation);
|
||||
float num5 = flValue * (float)(1.0 - num3 * (double)flSaturation);
|
||||
float num6 = flValue * (float)(1.0 - (1.0 - num3) * flSaturation);
|
||||
switch (num2)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Microsoft.Iris.Render.Common
|
||||
{
|
||||
this.m_data = new byte[nMaxSize];
|
||||
this.m_nCurrentIndex = 0;
|
||||
this.m_nHashCode = (byte)0;
|
||||
this.m_nHashCode = 0;
|
||||
}
|
||||
|
||||
internal int Capacity => this.m_data.Length;
|
||||
@@ -34,31 +34,31 @@ namespace Microsoft.Iris.Render.Common
|
||||
|
||||
internal unsafe void AppendInt(int nData)
|
||||
{
|
||||
Marshal.Copy(new IntPtr((void*)&nData), this.m_data, this.m_nCurrentIndex, 4);
|
||||
Marshal.Copy(new IntPtr(&nData), this.m_data, this.m_nCurrentIndex, 4);
|
||||
this.m_nCurrentIndex += 4;
|
||||
}
|
||||
|
||||
internal unsafe void AppendFloat(float fData)
|
||||
{
|
||||
Marshal.Copy(new IntPtr((void*)&fData), this.m_data, this.m_nCurrentIndex, 4);
|
||||
Marshal.Copy(new IntPtr(&fData), this.m_data, this.m_nCurrentIndex, 4);
|
||||
this.m_nCurrentIndex += 4;
|
||||
}
|
||||
|
||||
internal unsafe void AppendVector(Vector2 vData)
|
||||
{
|
||||
Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector2));
|
||||
Marshal.Copy(new IntPtr(&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector2));
|
||||
this.m_nCurrentIndex += 8;
|
||||
}
|
||||
|
||||
internal unsafe void AppendVector(Vector3 vData)
|
||||
{
|
||||
Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector3));
|
||||
Marshal.Copy(new IntPtr(&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector3));
|
||||
this.m_nCurrentIndex += 12;
|
||||
}
|
||||
|
||||
internal unsafe void AppendVector(Vector4 vData)
|
||||
{
|
||||
Marshal.Copy(new IntPtr((void*)&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector4));
|
||||
Marshal.Copy(new IntPtr(&vData), this.m_data, this.m_nCurrentIndex, sizeof(Vector4));
|
||||
this.m_nCurrentIndex += 16;
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace Microsoft.Iris.Render.Common
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (this.m_nHashCode != (byte)0)
|
||||
return (int)this.m_nHashCode;
|
||||
if (this.m_nHashCode != 0)
|
||||
return m_nHashCode;
|
||||
int num = 0;
|
||||
for (int index = 0; index < this.m_nCurrentIndex; ++index)
|
||||
num += (int)this.m_data[index];
|
||||
num += this.m_data[index];
|
||||
this.m_nHashCode = (byte)num;
|
||||
return (int)this.m_nHashCode;
|
||||
return m_nHashCode;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -82,7 +82,7 @@ namespace Microsoft.Iris.Render.Common
|
||||
return false;
|
||||
for (int index = 0; index < this.Size; ++index)
|
||||
{
|
||||
if ((int)this.m_data[index] != (int)byteBuilder.m_data[index])
|
||||
if (this.m_data[index] != byteBuilder.m_data[index])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user