Simplified usages and removed unnecessary casts

This commit is contained in:
Joshua Askharoun
2021-02-21 22:59:09 -06:00
parent c920dff448
commit 91b30a963f
533 changed files with 6257 additions and 6257 deletions
+5 -5
View File
@@ -19,19 +19,19 @@ namespace Microsoft.Zune
IntPtr instanceHandle = IntPtr.Zero;
try
{
instanceHandle = MemoryFonts.LoadLibraryEx(resourceDllName, IntPtr.Zero, 2U);
instanceHandle = LoadLibraryEx(resourceDllName, IntPtr.Zero, 2U);
if (instanceHandle == IntPtr.Zero)
return false;
IntPtr resource = MemoryFonts.FindResource(instanceHandle, fontResourceName, (IntPtr)10);
IntPtr resource = FindResource(instanceHandle, fontResourceName, (IntPtr)10);
if (resource == IntPtr.Zero)
return false;
IntPtr resourceHandle = MemoryFonts.LoadResource(instanceHandle, resource);
return !(resourceHandle == IntPtr.Zero) && !(MemoryFonts.AddFontMemResourceEx(MemoryFonts.LockResource(resourceHandle), MemoryFonts.SizeofResource(instanceHandle, resource), IntPtr.Zero, out uint _) == IntPtr.Zero);
IntPtr resourceHandle = LoadResource(instanceHandle, resource);
return !(resourceHandle == IntPtr.Zero) && !(AddFontMemResourceEx(LockResource(resourceHandle), SizeofResource(instanceHandle, resource), IntPtr.Zero, out uint _) == IntPtr.Zero);
}
finally
{
if (instanceHandle != IntPtr.Zero)
MemoryFonts.FreeLibrary(instanceHandle);
FreeLibrary(instanceHandle);
}
}
+68 -68
View File
@@ -14,7 +14,7 @@ namespace Microsoft.Zune.PerfTrace
internal class EtwTraceProvider
{
private const ushort _version = 0;
private EtwTraceProvider.EtwProc _etwProc;
private EtwProc _etwProc;
private ulong _registrationHandle;
private ulong _traceHandle;
private byte _level;
@@ -23,7 +23,7 @@ namespace Microsoft.Zune.PerfTrace
internal EtwTraceProvider(Guid controlGuid, string regPath)
{
this._level = (byte)0;
this._level = 0;
this._flags = 0U;
this._enabled = false;
this._traceHandle = 0UL;
@@ -46,8 +46,8 @@ namespace Microsoft.Zune.PerfTrace
~EtwTraceProvider()
{
EtwTraceProvider.UnregisterTraceGuids(this._registrationHandle);
GC.KeepAlive((object)this._etwProc);
UnregisterTraceGuids(this._registrationHandle);
GC.KeepAlive(_etwProc);
}
internal uint Flags => this._flags;
@@ -64,24 +64,24 @@ namespace Microsoft.Zune.PerfTrace
{
try
{
EtwTraceProvider.BaseEvent* baseEventPtr = (EtwTraceProvider.BaseEvent*)byteBuffer;
BaseEvent* baseEventPtr = (BaseEvent*)byteBuffer;
switch (requestCode)
{
case 4:
this._traceHandle = baseEventPtr->HistoricalContext;
this._flags = (uint)EtwTraceProvider.GetTraceEnableFlags(baseEventPtr->HistoricalContext);
this._level = EtwTraceProvider.GetTraceEnableLevel(baseEventPtr->HistoricalContext);
if (this._flags == 0U && this._level == (byte)0)
this._flags = (uint)GetTraceEnableFlags(baseEventPtr->HistoricalContext);
this._level = GetTraceEnableLevel(baseEventPtr->HistoricalContext);
if (this._flags == 0U && this._level == 0)
{
this._flags = uint.MaxValue;
this._level = (byte)4;
this._level = 4;
}
this._enabled = true;
break;
case 5:
this._enabled = false;
this._traceHandle = 0UL;
this._level = (byte)0;
this._level = 0;
this._flags = 0U;
break;
default:
@@ -106,17 +106,17 @@ namespace Microsoft.Zune.PerfTrace
private unsafe uint Register(Guid controlGuid)
{
EtwTraceProvider.TraceGuidRegistration guidReg = new EtwTraceProvider.TraceGuidRegistration();
Guid guid = new Guid(3029687280U, (ushort)15089, (ushort)18240, (byte)180, (byte)117, (byte)153, (byte)5, (byte)93, (byte)63, (byte)233, (byte)170);
this._etwProc = new EtwTraceProvider.EtwProc(this.ControllerChangeCallback);
TraceGuidRegistration guidReg = new TraceGuidRegistration();
Guid guid = new Guid(3029687280U, 15089, 18240, 180, 117, 153, 5, 93, 63, 233, 170);
this._etwProc = new EtwProc(this.ControllerChangeCallback);
guidReg.Guid = &guid;
guidReg.RegHandle = (void*)null;
return EtwTraceProvider.RegisterTraceGuids(this._etwProc, (void*)null, ref controlGuid, 1U, ref guidReg, (string)null, (string)null, out this._registrationHandle);
guidReg.RegHandle = null;
return RegisterTraceGuids(this._etwProc, null, ref controlGuid, 1U, ref guidReg, null, null, out this._registrationHandle);
}
internal void TraceEvent(byte level, Guid eventGuid, byte eventType) => this.TraceEvent(level, eventGuid, eventType, (object)null, (object)null);
internal void TraceEvent(byte level, Guid eventGuid, byte eventType) => this.TraceEvent(level, eventGuid, eventType, null, null);
internal void TraceEvent(byte level, Guid eventGuid, byte eventType, object data0) => this.TraceEvent(level, eventGuid, eventType, data0, (object)null);
internal void TraceEvent(byte level, Guid eventGuid, byte eventType, object data0) => this.TraceEvent(level, eventGuid, eventType, data0, null);
internal void TraceEvent(
byte level,
@@ -125,7 +125,7 @@ namespace Microsoft.Zune.PerfTrace
object data0,
object data1)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, (object)null, (object)null, (object)null, (object)null, (object)null, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, null, null, null, null, null, null, null);
}
internal void TraceEvent(
@@ -136,7 +136,7 @@ namespace Microsoft.Zune.PerfTrace
object data1,
object data2)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, (object)null, (object)null, (object)null, (object)null, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, null, null, null, null, null, null);
}
internal void TraceEvent(
@@ -148,7 +148,7 @@ namespace Microsoft.Zune.PerfTrace
object data2,
object data3)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, (object)null, (object)null, (object)null, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, null, null, null, null, null);
}
internal void TraceEvent(
@@ -161,7 +161,7 @@ namespace Microsoft.Zune.PerfTrace
object data3,
object data4)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, (object)null, (object)null, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, null, null, null, null);
}
internal void TraceEvent(
@@ -175,7 +175,7 @@ namespace Microsoft.Zune.PerfTrace
object data4,
object data5)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, (object)null, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, null, null, null);
}
internal void TraceEvent(
@@ -190,7 +190,7 @@ namespace Microsoft.Zune.PerfTrace
object data5,
object data6)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, data6, (object)null, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, data6, null, null);
}
internal void TraceEvent(
@@ -206,7 +206,7 @@ namespace Microsoft.Zune.PerfTrace
object data6,
object data7)
{
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, data6, data7, (object)null);
int num = (int)this.TraceEvent(level, eventGuid, eventType, data0, data1, data2, data3, data4, data5, data6, data7, null);
}
internal unsafe uint TraceEvent(
@@ -239,24 +239,24 @@ namespace Microsoft.Zune.PerfTrace
string str8 = str1;
string str9 = str1;
string str10 = str1;
EtwTraceProvider.BaseEvent baseEvent;
BaseEvent baseEvent;
baseEvent.ClientContext = 0U;
baseEvent.Flags = 1179648U;
baseEvent.Guid = eventGuid;
baseEvent.EventType = evtype;
baseEvent.Level = level;
baseEvent.Version = (ushort)0;
baseEvent.Version = 0;
if (data0 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
if ((str10 = this.ProcessOneObject(data0, mofField, ptr, ref offSet)) != null)
num1 |= 1;
}
if (data1 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str9 = this.ProcessOneObject(data1, mofField, ptr, ref offSet)) != null)
num1 |= 2;
@@ -264,7 +264,7 @@ namespace Microsoft.Zune.PerfTrace
if (data2 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str8 = this.ProcessOneObject(data2, mofField, ptr, ref offSet)) != null)
num1 |= 4;
@@ -272,7 +272,7 @@ namespace Microsoft.Zune.PerfTrace
if (data3 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str7 = this.ProcessOneObject(data3, mofField, ptr, ref offSet)) != null)
num1 |= 8;
@@ -280,7 +280,7 @@ namespace Microsoft.Zune.PerfTrace
if (data4 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str6 = this.ProcessOneObject(data4, mofField, ptr, ref offSet)) != null)
num1 |= 16;
@@ -288,7 +288,7 @@ namespace Microsoft.Zune.PerfTrace
if (data5 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str5 = this.ProcessOneObject(data5, mofField, ptr, ref offSet)) != null)
num1 |= 32;
@@ -296,7 +296,7 @@ namespace Microsoft.Zune.PerfTrace
if (data6 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str4 = this.ProcessOneObject(data6, mofField, ptr, ref offSet)) != null)
num1 |= 64;
@@ -304,7 +304,7 @@ namespace Microsoft.Zune.PerfTrace
if (data7 != null)
{
++num2;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str3 = this.ProcessOneObject(data7, mofField, ptr, ref offSet)) != null)
num1 |= 128;
@@ -312,7 +312,7 @@ namespace Microsoft.Zune.PerfTrace
if (data8 != null)
{
uint num4 = num2 + 1U;
EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField));
MofField* mofField = &baseEvent.UserData + num3++ * sizeof(MofField);
ptr = chPtr1 + offSet;
if ((str2 = this.ProcessOneObject(data8, mofField, ptr, ref offSet)) != null)
num1 |= 256;
@@ -334,65 +334,65 @@ namespace Microsoft.Zune.PerfTrace
if ((num1 & 1) != 0)
{
(&baseEvent.UserData)[index1].DataLength = (uint)((str10.Length + 1) * 2);
(&baseEvent.UserData)[index1].DataPointer = (void*)chPtr2;
(&baseEvent.UserData)[index1].DataPointer = chPtr2;
}
int index2 = index1 + 1;
if ((num1 & 2) != 0)
{
(&baseEvent.UserData)[index2].DataLength = (uint)((str9.Length + 1) * 2);
(&baseEvent.UserData)[index2].DataPointer = (void*)chPtr3;
(&baseEvent.UserData)[index2].DataPointer = chPtr3;
}
int index3 = index2 + 1;
if ((num1 & 4) != 0)
{
(&baseEvent.UserData)[index3].DataLength = (uint)((str8.Length + 1) * 2);
(&baseEvent.UserData)[index3].DataPointer = (void*)chPtr4;
(&baseEvent.UserData)[index3].DataPointer = chPtr4;
}
int index4 = index3 + 1;
if ((num1 & 8) != 0)
{
(&baseEvent.UserData)[index4].DataLength = (uint)((str7.Length + 1) * 2);
(&baseEvent.UserData)[index4].DataPointer = (void*)chPtr5;
(&baseEvent.UserData)[index4].DataPointer = chPtr5;
}
int index5 = index4 + 1;
if ((num1 & 16) != 0)
{
(&baseEvent.UserData)[index5].DataLength = (uint)((str6.Length + 1) * 2);
(&baseEvent.UserData)[index5].DataPointer = (void*)chPtr6;
(&baseEvent.UserData)[index5].DataPointer = chPtr6;
}
int index6 = index5 + 1;
if ((num1 & 32) != 0)
{
(&baseEvent.UserData)[index6].DataLength = (uint)((str5.Length + 1) * 2);
(&baseEvent.UserData)[index6].DataPointer = (void*)chPtr7;
(&baseEvent.UserData)[index6].DataPointer = chPtr7;
}
int index7 = index6 + 1;
if ((num1 & 64) != 0)
{
(&baseEvent.UserData)[index7].DataLength = (uint)((str4.Length + 1) * 2);
(&baseEvent.UserData)[index7].DataPointer = (void*)chPtr8;
(&baseEvent.UserData)[index7].DataPointer = chPtr8;
}
int index8 = index7 + 1;
if ((num1 & 128) != 0)
{
(&baseEvent.UserData)[index8].DataLength = (uint)((str3.Length + 1) * 2);
(&baseEvent.UserData)[index8].DataPointer = (void*)chPtr9;
(&baseEvent.UserData)[index8].DataPointer = chPtr9;
}
int index9 = index8 + 1;
if ((num1 & 256) != 0)
{
(&baseEvent.UserData)[index9].DataLength = (uint)((str2.Length + 1) * 2);
(&baseEvent.UserData)[index9].DataPointer = (void*)chPtr10;
(&baseEvent.UserData)[index9].DataPointer = chPtr10;
}
baseEvent.BufferSize = (uint)(48 + num3 * sizeof(EtwTraceProvider.MofField));
num5 = EtwTraceProvider.TraceEvent(this._traceHandle, (char*)&baseEvent);
baseEvent.BufferSize = (uint)(48 + num3 * sizeof(MofField));
num5 = TraceEvent(this._traceHandle, (char*)&baseEvent);
}
return num5;
}
private unsafe string ProcessOneObject(
object data,
EtwTraceProvider.MofField* mofField,
MofField* mofField,
char* ptr,
ref uint offSet)
{
@@ -401,116 +401,116 @@ namespace Microsoft.Zune.PerfTrace
private unsafe string EncodeObject(
object data,
EtwTraceProvider.MofField* mofField,
MofField* mofField,
char* ptr,
ref uint offSet)
{
if (data == null)
{
mofField->DataLength = 0U;
mofField->DataPointer = (void*)null;
return (string)null;
mofField->DataPointer = null;
return null;
}
Type type = data.GetType();
if (type.IsEnum)
data = Convert.ChangeType(data, Enum.GetUnderlyingType(type), (IFormatProvider)CultureInfo.InvariantCulture);
data = Convert.ChangeType(data, Enum.GetUnderlyingType(type), CultureInfo.InvariantCulture);
switch (data)
{
case sbyte num:
mofField->DataLength = 1U;
sbyte* numPtr1 = (sbyte*)ptr;
*numPtr1 = num;
mofField->DataPointer = (void*)numPtr1;
mofField->DataPointer = numPtr1;
++offSet;
break;
case byte num:
mofField->DataLength = 1U;
byte* numPtr2 = (byte*)ptr;
*numPtr2 = num;
mofField->DataPointer = (void*)numPtr2;
mofField->DataPointer = numPtr2;
++offSet;
break;
case short num:
mofField->DataLength = 2U;
short* numPtr3 = (short*)ptr;
*numPtr3 = num;
mofField->DataPointer = (void*)numPtr3;
mofField->DataPointer = numPtr3;
offSet += 2U;
break;
case ushort num:
mofField->DataLength = 2U;
ushort* numPtr4 = (ushort*)ptr;
*numPtr4 = num;
mofField->DataPointer = (void*)numPtr4;
mofField->DataPointer = numPtr4;
offSet += 2U;
break;
case int num:
mofField->DataLength = 4U;
int* numPtr5 = (int*)ptr;
*numPtr5 = num;
mofField->DataPointer = (void*)numPtr5;
mofField->DataPointer = numPtr5;
offSet += 4U;
break;
case uint num:
mofField->DataLength = 4U;
uint* numPtr6 = (uint*)ptr;
*numPtr6 = num;
mofField->DataPointer = (void*)numPtr6;
mofField->DataPointer = numPtr6;
offSet += 4U;
break;
case long num:
mofField->DataLength = 8U;
long* numPtr7 = (long*)ptr;
*numPtr7 = num;
mofField->DataPointer = (void*)numPtr7;
mofField->DataPointer = numPtr7;
offSet += 8U;
break;
case ulong num:
mofField->DataLength = 8U;
ulong* numPtr8 = (ulong*)ptr;
*numPtr8 = num;
mofField->DataPointer = (void*)numPtr8;
mofField->DataPointer = numPtr8;
offSet += 8U;
break;
case char ch:
mofField->DataLength = 2U;
char* chPtr = ptr;
*chPtr = ch;
mofField->DataPointer = (void*)chPtr;
mofField->DataPointer = chPtr;
offSet += 2U;
break;
case float num:
mofField->DataLength = 4U;
float* numPtr9 = (float*)ptr;
*numPtr9 = num;
mofField->DataPointer = (void*)numPtr9;
mofField->DataPointer = numPtr9;
offSet += 4U;
break;
case double num:
mofField->DataLength = 8U;
double* numPtr10 = (double*)ptr;
*numPtr10 = num;
mofField->DataPointer = (void*)numPtr10;
mofField->DataPointer = numPtr10;
offSet += 8U;
break;
case bool flag:
mofField->DataLength = 1U;
bool* flagPtr = (bool*)ptr;
*flagPtr = flag;
mofField->DataPointer = (void*)flagPtr;
mofField->DataPointer = flagPtr;
++offSet;
break;
case Decimal num:
mofField->DataLength = 16U;
Decimal* numPtr11 = (Decimal*)ptr;
*numPtr11 = num;
mofField->DataPointer = (void*)numPtr11;
mofField->DataPointer = numPtr11;
offSet += 16U;
break;
default:
return data.ToString();
}
return (string)null;
return null;
}
[DllImport("advapi32", CharSet = CharSet.Unicode)]
@@ -521,11 +521,11 @@ namespace Microsoft.Zune.PerfTrace
[DllImport("advapi32", EntryPoint = "RegisterTraceGuidsW", CharSet = CharSet.Unicode)]
internal static extern unsafe uint RegisterTraceGuids(
[In] EtwTraceProvider.EtwProc cbFunc,
[In] EtwProc cbFunc,
[In] void* context,
[In] ref Guid controlGuid,
[In] uint guidCount,
ref EtwTraceProvider.TraceGuidRegistration guidReg,
ref TraceGuidRegistration guidReg,
[In] string mofImagePath,
[In] string mofResourceName,
out ulong regHandle);
@@ -587,7 +587,7 @@ namespace Microsoft.Zune.PerfTrace
[FieldOffset(44)]
internal uint Flags;
[FieldOffset(48)]
internal EtwTraceProvider.MofField UserData;
internal MofField UserData;
}
internal unsafe delegate uint EtwProc(
+15 -15
View File
@@ -11,43 +11,43 @@ namespace Microsoft.Zune.PerfTrace
public sealed class PerfTrace
{
private static readonly EtwTraceProvider _EventProvider;
internal static readonly Guid ZUNE_ETW_CONTROL_GUID = new Guid(1496399467U, (ushort)53017, (ushort)20072, (byte)142, (byte)243, (byte)135, (byte)107, (byte)12, (byte)8, (byte)232, (byte)1);
internal static readonly Guid PERFTRACE_LAUNCHEVENT_GUID = new Guid(1815200785, (short)23272, (short)18087, (byte)190, (byte)166, (byte)76, (byte)236, (byte)117, (byte)51, (byte)196, (byte)218);
internal static readonly Guid PerftraceUICollectionGuid = new Guid(235915657U, (ushort)37778, (ushort)18043, (byte)146, (byte)252, (byte)128, (byte)212, (byte)193, (byte)153, (byte)154, (byte)151);
internal static readonly Guid ZUNE_ETW_CONTROL_GUID = new Guid(1496399467U, 53017, 20072, 142, 243, 135, 107, 12, 8, 232, 1);
internal static readonly Guid PERFTRACE_LAUNCHEVENT_GUID = new Guid(1815200785, 23272, 18087, 190, 166, 76, 236, 117, 51, 196, 218);
internal static readonly Guid PerftraceUICollectionGuid = new Guid(235915657U, 37778, 18043, 146, 252, 128, 212, 193, 153, 154, 151);
private PerfTrace()
{
}
static PerfTrace() => Microsoft.Zune.PerfTrace.PerfTrace._EventProvider = new EtwTraceProvider(Microsoft.Zune.PerfTrace.PerfTrace.ZUNE_ETW_CONTROL_GUID, "SOFTWARE\\Microsoft\\Zune");
static PerfTrace() => _EventProvider = new EtwTraceProvider(ZUNE_ETW_CONTROL_GUID, "SOFTWARE\\Microsoft\\Zune");
internal static bool IsEnabled(
EtwTraceProvider provider,
Microsoft.Zune.PerfTrace.PerfTrace.Flags flag,
Microsoft.Zune.PerfTrace.PerfTrace.Level level)
Flags flag,
Level level)
{
return (uint)level <= (uint)provider.Level && provider.IsEnabled && (flag & (Microsoft.Zune.PerfTrace.PerfTrace.Flags)provider.Flags) > ~Microsoft.Zune.PerfTrace.PerfTrace.Flags.All;
return (uint)level <= provider.Level && provider.IsEnabled && (flag & (Flags)provider.Flags) > ~Flags.All;
}
internal static bool IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace.Flags flags, Microsoft.Zune.PerfTrace.PerfTrace.Level level) => Microsoft.Zune.PerfTrace.PerfTrace.IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace._EventProvider, flags, level);
internal static bool IsEnabled(Flags flags, Level level) => IsEnabled(_EventProvider, flags, level);
internal static bool IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace.Flags flags) => Microsoft.Zune.PerfTrace.PerfTrace.IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace._EventProvider, flags, Microsoft.Zune.PerfTrace.PerfTrace.Level.Normal);
internal static bool IsEnabled(Flags flags) => IsEnabled(_EventProvider, flags, Level.Normal);
public static void PERFTRACE_LAUNCHEVENT(Microsoft.Zune.PerfTrace.PerfTrace.LAUNCH_EVENT launchEvent, uint data)
public static void PERFTRACE_LAUNCHEVENT(LAUNCH_EVENT launchEvent, uint data)
{
if (!Microsoft.Zune.PerfTrace.PerfTrace.IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace.Flags.Launch, Microsoft.Zune.PerfTrace.PerfTrace.Level.Normal))
if (!IsEnabled(Flags.Launch, Level.Normal))
return;
Microsoft.Zune.PerfTrace.PerfTrace._EventProvider.TraceEvent((byte)4, Microsoft.Zune.PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT_GUID, (byte)launchEvent, (object)data);
_EventProvider.TraceEvent(4, PERFTRACE_LAUNCHEVENT_GUID, (byte)launchEvent, data);
}
public static void TraceUICollectionEvent(UICollectionEvent traceEvent, string eventDetail)
{
if (!Microsoft.Zune.PerfTrace.PerfTrace.IsEnabled(Microsoft.Zune.PerfTrace.PerfTrace.Flags.Collection, Microsoft.Zune.PerfTrace.PerfTrace.Level.Normal))
if (!IsEnabled(Flags.Collection, Level.Normal))
return;
Microsoft.Zune.PerfTrace.PerfTrace._EventProvider.TraceEvent((byte)4, Microsoft.Zune.PerfTrace.PerfTrace.PerftraceUICollectionGuid, (byte)traceEvent, (object)eventDetail);
_EventProvider.TraceEvent(4, PerftraceUICollectionGuid, (byte)traceEvent, eventDetail);
}
[System.Flags]
[Flags]
internal enum Flags : uint
{
DB_Mutex = 1,
@@ -15,12 +15,12 @@ namespace Microsoft.Zune.Shell
{
private List<DataProviderQuery> _currentQueries = new List<DataProviderQuery>();
internal static void Register() => Application.RegisterDataProvider("Aggregate", new DataProviderQueryFactory(AggregateDataProviderQuery.ConstructAggregateDataProviderQuery));
internal static void Register() => Application.RegisterDataProvider("Aggregate", new DataProviderQueryFactory(ConstructAggregateDataProviderQuery));
internal static DataProviderQuery ConstructAggregateDataProviderQuery(
object queryTypeCookie)
{
return (DataProviderQuery)new AggregateDataProviderQuery(queryTypeCookie);
return new AggregateDataProviderQuery(queryTypeCookie);
}
protected AggregateDataProviderQuery(object queryTypeCookie)
@@ -36,12 +36,12 @@ namespace Microsoft.Zune.Shell
private void InitializeCurrentQueries()
{
this.Result = (object)null;
this.Result = null;
this.UnsubscribeFromCurrentQueries();
this._currentQueries.Clear();
if (this.GetProperty("Queries") is IList property)
{
foreach (object obj in (IEnumerable)property)
foreach (object obj in property)
{
if (obj is DataProviderQuery dataProviderQuery)
this._currentQueries.Add(dataProviderQuery);
@@ -94,7 +94,7 @@ namespace Microsoft.Zune.Shell
ArrayList arrayList = new ArrayList();
foreach (DataProviderQuery currentQuery in this._currentQueries)
arrayList.Add(currentQuery.Result);
this.Result = (object)arrayList;
this.Result = arrayList;
this.Status = flag ? DataProviderQueryStatus.Error : DataProviderQueryStatus.Complete;
}
else
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Microsoft.Zune.Shell
{
if (string.IsNullOrEmpty(arArg))
throw new ArgumentException(nameof(arArgs));
string str = (string)null;
string str = null;
string name;
if (arArg[0] == '-' || arArg[0] == '/')
name = arArg.Substring(1, arArg.Length - 1);
@@ -25,7 +25,7 @@ namespace Microsoft.Zune.Shell
{
int dueTime = 30000;
this._onCompleteHandler = onCompleteHandler;
this._failsafeTimer = new System.Threading.Timer(new TimerCallback(this.FailsafeCallback), (object)null, dueTime, -1);
this._failsafeTimer = new System.Threading.Timer(new TimerCallback(this.FailsafeCallback), null, dueTime, -1);
}
}
+6 -6
View File
@@ -15,20 +15,20 @@ namespace Microsoft.Zune.Shell
[ComDefaultInterface(typeof(ILaunchZuneShell))]
public sealed class LaunchZuneShell : ILaunchZuneShell
{
private static LaunchZuneShell.LaunchDelegate s_launch;
private static LaunchDelegate s_launch;
private static string s_args;
private static IntPtr s_hWndSplashScreen;
[STAThread]
public IntPtr GetLaunchDelegate(string args, IntPtr hWndSplashScreen)
{
LaunchZuneShell.s_args = args;
LaunchZuneShell.s_hWndSplashScreen = hWndSplashScreen;
LaunchZuneShell.s_launch = new LaunchZuneShell.LaunchDelegate(this.LaunchZuneShellHelper);
return Marshal.GetFunctionPointerForDelegate((Delegate)LaunchZuneShell.s_launch);
s_args = args;
s_hWndSplashScreen = hWndSplashScreen;
s_launch = new LaunchDelegate(this.LaunchZuneShellHelper);
return Marshal.GetFunctionPointerForDelegate(s_launch);
}
private int LaunchZuneShellHelper() => ZuneApplication.Launch(LaunchZuneShell.s_args, LaunchZuneShell.s_hWndSplashScreen);
private int LaunchZuneShellHelper() => ZuneApplication.Launch(s_args, s_hWndSplashScreen);
public IntPtr GetRenderWindow() => ZuneApplication.GetRenderWindow();
+6 -6
View File
@@ -18,7 +18,7 @@ namespace Microsoft.Zune.Shell
public static Hashtable Startup(string[] args, string defaultCommandLineSwitch)
{
WindowSize windowSize = new WindowSize(1012, 693);
string str = (string)null;
string str = null;
bool flag1 = false;
bool flag2 = false;
Hashtable hashtable = new Hashtable();
@@ -43,7 +43,7 @@ namespace Microsoft.Zune.Shell
case "size":
try
{
windowSize = StandAlone.ParseSize(commandLineArgument.Value);
windowSize = ParseSize(commandLineArgument.Value);
break;
}
catch (FormatException ex)
@@ -71,7 +71,7 @@ namespace Microsoft.Zune.Shell
break;
}
default:
hashtable[(object)commandLineArgument.Name] = (object)commandLineArgument.Value;
hashtable[commandLineArgument.Name] = commandLineArgument.Value;
break;
}
}
@@ -96,7 +96,7 @@ namespace Microsoft.Zune.Shell
Application.AnimationsEnabled = ClientConfiguration.GeneralSettings.AnimationsEnabled;
Application.Initialize();
Application.Window.InitialClientSize = windowSize;
object obj = Registry.GetValue(ZuneUI.Shell.SettingsRegistryPath, "WindowPosition", (object)null);
object obj = Registry.GetValue(ZuneUI.Shell.SettingsRegistryPath, "WindowPosition", null);
if (obj != null)
{
if (obj is string)
@@ -118,7 +118,7 @@ namespace Microsoft.Zune.Shell
Application.Window.ShowWindowFrame = flag1;
Application.Window.SetBackgroundColor(ZuneUI.Shell.WindowColorFromRGB(ClientConfiguration.Shell.BackgroundColor));
if (!flag2)
Application.DeferredInvoke((DeferredInvokeHandler)delegate
Application.DeferredInvoke(delegate
{
Windowing.ForceSetForegroundWindow(Application.Window.Handle);
}, DeferredInvokePriority.Low);
@@ -143,7 +143,7 @@ namespace Microsoft.Zune.Shell
Application.Run(initialLoadComplete);
if (TaskbarPlayer.Instance.ToolbarVisible)
return;
Registry.SetValue(ZuneUI.Shell.SettingsRegistryPath, "WindowPosition", (object)Application.Window.GetSavedPosition(true));
Registry.SetValue(ZuneUI.Shell.SettingsRegistryPath, "WindowPosition", Application.Window.GetSavedPosition(true));
}
public static void Shutdown() => Application.Shutdown();
+9 -9
View File
@@ -16,9 +16,9 @@ namespace Microsoft.Zune.Shell
{
get
{
if (TraceSwitches.collectionSwitch == null)
TraceSwitches.collectionSwitch = new ZuneTraceSwitch("Collection", "Collection page traces");
return TraceSwitches.collectionSwitch;
if (collectionSwitch == null)
collectionSwitch = new ZuneTraceSwitch("Collection", "Collection page traces");
return collectionSwitch;
}
}
@@ -26,9 +26,9 @@ namespace Microsoft.Zune.Shell
{
get
{
if (TraceSwitches.shellSwitch == null)
TraceSwitches.shellSwitch = new ZuneTraceSwitch("Shell", "Shell traces");
return TraceSwitches.shellSwitch;
if (shellSwitch == null)
shellSwitch = new ZuneTraceSwitch("Shell", "Shell traces");
return shellSwitch;
}
}
@@ -36,9 +36,9 @@ namespace Microsoft.Zune.Shell
{
get
{
if (TraceSwitches.dataProviderSwitch == null)
TraceSwitches.dataProviderSwitch = new ZuneTraceSwitch("DataProvider", "Data provider traces");
return TraceSwitches.dataProviderSwitch;
if (dataProviderSwitch == null)
dataProviderSwitch = new ZuneTraceSwitch("DataProvider", "Data provider traces");
return dataProviderSwitch;
}
}
}
+8 -8
View File
@@ -13,9 +13,9 @@ namespace Microsoft.Zune.Shell
{
private bool _inCompactMode;
private bool _shutdown;
private ViewTimeLogger.LogHelper _compactModeLog = new ViewTimeLogger.LogHelper(SQMDataId.CompactModeViewTime);
private ViewTimeLogger.LogHelper _mixViewLog = new ViewTimeLogger.LogHelper(SQMDataId.MixViewTime);
private ViewTimeLogger.LogHelper _collectionViewLog;
private LogHelper _compactModeLog = new LogHelper(SQMDataId.CompactModeViewTime);
private LogHelper _mixViewLog = new LogHelper(SQMDataId.MixViewTime);
private LogHelper _collectionViewLog;
private static ViewTimeLogger _viewTimeLogger;
private ViewTimeLogger()
@@ -35,9 +35,9 @@ namespace Microsoft.Zune.Shell
{
get
{
if (ViewTimeLogger._viewTimeLogger == null)
ViewTimeLogger._viewTimeLogger = new ViewTimeLogger();
return ViewTimeLogger._viewTimeLogger;
if (_viewTimeLogger == null)
_viewTimeLogger = new ViewTimeLogger();
return _viewTimeLogger;
}
}
@@ -46,11 +46,11 @@ namespace Microsoft.Zune.Shell
if (this._collectionViewLog != null && viewSQMId != this._collectionViewLog.LogId)
{
this._collectionViewLog.Stop();
this._collectionViewLog = (ViewTimeLogger.LogHelper)null;
this._collectionViewLog = null;
}
if (viewSQMId == SQMDataId.Invalid || this._collectionViewLog != null)
return;
this._collectionViewLog = new ViewTimeLogger.LogHelper(viewSQMId);
this._collectionViewLog = new LogHelper(viewSQMId);
if (this._inCompactMode)
return;
this._collectionViewLog.Start();
+126 -126
View File
@@ -46,15 +46,15 @@ namespace Microsoft.Zune.Shell
public static double ZuneCurrentSettingsVersion => 2.0;
public static void SetDesktopLockState(bool locked) => ZuneApplication._desktopLocked = locked;
public static void SetDesktopLockState(bool locked) => _desktopLocked = locked;
public static bool IsDesktopLocked => ZuneApplication._desktopLocked;
public static bool IsDesktopLocked => _desktopLocked;
public static string DefaultCommandLineParameterSwitch => "PlayMedia";
public static ZuneLibrary ZuneLibrary => ZuneApplication._zuneLibrary;
public static ZuneLibrary ZuneLibrary => _zuneLibrary;
public static Microsoft.Zune.Service.Service Service => Microsoft.Zune.Service.Service.Instance;
public static Service.Service Service => Zune.Service.Service.Instance;
public static event EventHandler Closing;
@@ -78,7 +78,7 @@ namespace Microsoft.Zune.Shell
internal static IntPtr GetRenderWindow() => Application.Window.Handle;
public static void PageLoadComplete() => ZuneApplication._initializationFailsafe.Complete();
public static void PageLoadComplete() => _initializationFailsafe.Complete();
private static void CorePhase3Ready(int hr, bool fSuc)
{
@@ -90,7 +90,7 @@ namespace Microsoft.Zune.Shell
else
{
SingletonModelItem<WindowSnapSimulator>.Instance.Phase3Init();
ZuneApplication.Service.Phase3Initialize();
Service.Phase3Initialize();
SignIn.Instance.Phase3Init();
MetadataNotifications.Instance.Phase2Init();
SingletonModelItem<UIDeviceList>.Instance.Phase2Init();
@@ -98,9 +98,9 @@ namespace Microsoft.Zune.Shell
SingletonModelItem<TransportControls>.Instance.Phase2Init();
SubscriptionEventsListener.Instance.StartListening();
SoftwareUpdates.Instance.StartUp();
ZuneApplication._interopNotifications = new InteropNotifications();
if (ZuneApplication._interopNotifications != null)
ZuneApplication._interopNotifications.ShowErrorDialog += new OnShowErrorDialogHandler(ZuneApplication.OnShowErrorDialog);
_interopNotifications = new InteropNotifications();
if (_interopNotifications != null)
_interopNotifications.ShowErrorDialog += new OnShowErrorDialogHandler(OnShowErrorDialog);
Download.Instance.Phase3Init();
SyncControls.Instance.Phase3Init();
PodcastCredentials.Instance.Phase2Init();
@@ -112,10 +112,10 @@ namespace Microsoft.Zune.Shell
SingletonModelItem<ThumbBarButtons>.Instance.Phase3Init();
SingletonModelItem<JumpListManager>.Instance.JumpListPinUpdateRequested.Invoke();
}
if (!Microsoft.Zune.QuickMix.QuickMix.Instance.IsReady)
if (!QuickMix.QuickMix.Instance.IsReady)
{
ZuneApplication._quickMixProgress = new QuickMixProgress();
ZuneApplication._quickMixProgress.PropertyChanged += new PropertyChangedEventHandler(ZuneApplication.OnQuickMixPropertyChanged);
_quickMixProgress = new QuickMixProgress();
_quickMixProgress.PropertyChanged += new PropertyChangedEventHandler(OnQuickMixPropertyChanged);
}
Telemetry.Instance.StartUpload();
FeaturesChanged.Instance.StartUp();
@@ -126,159 +126,159 @@ namespace Microsoft.Zune.Shell
private static void Phase2InitializationUIStage(object arg)
{
ZuneApplication._initializationFailsafe.Initialize((DeferredInvokeHandler)delegate
_initializationFailsafe.Initialize(delegate
{
ZuneApplication._appInitializationSequencer.UIReady();
_appInitializationSequencer.UIReady();
});
ZuneApplication.ProcessAppArgs();
ProcessAppArgs();
Download.Instance.Phase2Init();
if (!ZuneShell.DefaultInstance.NavigationsPending && ZuneShell.DefaultInstance.CurrentPage is StartupPage)
ZuneUI.Shell.NavigateToHomePage();
if (ZuneApplication._dbRebuilt)
if (_dbRebuilt)
{
string caption = ZuneLibrary.LoadStringFromResource(109U);
string text = ZuneLibrary.LoadStringFromResource(110U);
if (!string.IsNullOrEmpty(caption) && !string.IsNullOrEmpty(text))
Win32MessageBox.Show(text, caption, Win32MessageBoxType.MB_ICONHAND, (DeferredInvokeHandler)null);
Win32MessageBox.Show(text, caption, Win32MessageBoxType.MB_ICONHAND, null);
}
ZuneApplication._phase2InitComplete = true;
_phase2InitComplete = true;
}
private static void Phase2InitializationWorker(object arg)
{
Win32Window.Close(ZuneApplication._hWndSplashScreen);
Win32Window.Close(_hWndSplashScreen);
int hr;
bool flag = ZuneApplication._zuneLibrary.Phase2Initialization(out hr);
Application.DeferredInvoke(new DeferredInvokeHandler(ZuneApplication.Phase2InitializationUIStage), (object)new object[2]
bool flag = _zuneLibrary.Phase2Initialization(out hr);
Application.DeferredInvoke(new DeferredInvokeHandler(Phase2InitializationUIStage), new object[2]
{
(object) hr,
(object) flag
hr,
flag
});
ZuneApplication.ZuneLibrary.CleanupTransientMedia();
ZuneApplication._transientTableCleanupComplete.Set();
ZuneLibrary.CleanupTransientMedia();
_transientTableCleanupComplete.Set();
SQMLog.Log(SQMDataId.GdiMode, Application.RenderingType == RenderingType.GDI ? 1 : 0);
}
private static void Phase2Initialization(object arg) => ThreadPool.QueueUserWorkItem(new WaitCallback(ZuneApplication.Phase2InitializationWorker));
private static void Phase2Initialization(object arg) => ThreadPool.QueueUserWorkItem(new WaitCallback(Phase2InitializationWorker));
public static void ProcessMessageFromCommandLine(string strArgs) => Application.DeferredInvoke(new DeferredInvokeHandler(ZuneApplication.ProcessMessageFromCommandLineDeferred), (object)strArgs, DeferredInvokePriority.Low);
public static void ProcessMessageFromCommandLine(string strArgs) => Application.DeferredInvoke(new DeferredInvokeHandler(ProcessMessageFromCommandLineDeferred), strArgs, DeferredInvokePriority.Low);
private static void ProcessMessageFromCommandLineDeferred(object args)
{
string[] arArgs = ZuneApplication.SplitCommandLineArguments((string)args);
string[] arArgs = SplitCommandLineArguments((string)args);
if (arArgs != null)
{
if (ZuneApplication._unprocessedAppArgs == null)
ZuneApplication._unprocessedAppArgs = new List<Hashtable>();
if (_unprocessedAppArgs == null)
_unprocessedAppArgs = new List<Hashtable>();
Hashtable hashtable = new Hashtable();
foreach (CommandLineArgument commandLineArgument in CommandLineArgument.ParseArgs(arArgs, ZuneApplication.DefaultCommandLineParameterSwitch))
hashtable[(object)commandLineArgument.Name] = (object)commandLineArgument.Value;
ZuneApplication._unprocessedAppArgs.Add(hashtable);
foreach (CommandLineArgument commandLineArgument in CommandLineArgument.ParseArgs(arArgs, DefaultCommandLineParameterSwitch))
hashtable[commandLineArgument.Name] = commandLineArgument.Value;
_unprocessedAppArgs.Add(hashtable);
}
if (!ZuneApplication._phase2InitComplete)
if (!_phase2InitComplete)
return;
ZuneApplication.ProcessAppArgs();
ProcessAppArgs();
}
private static void ProcessAppArgs()
{
if (ZuneApplication._unprocessedAppArgs == null)
if (_unprocessedAppArgs == null)
return;
if (ClientConfiguration.FUE.SettingsVersion < ZuneApplication.ZuneCurrentSettingsVersion || Fue.Instance.IsFirstLaunch)
if (ClientConfiguration.FUE.SettingsVersion < ZuneCurrentSettingsVersion || Fue.Instance.IsFirstLaunch)
{
Fue.FUECompleted += new EventHandler(ZuneApplication.ProcessAppArgsAfterFUE);
Fue.FUECompleted += new EventHandler(ProcessAppArgsAfterFUE);
}
else
{
for (int index = 0; index < ZuneApplication._unprocessedAppArgs.Count; ++index)
ZuneApplication.ProcessAppArgs(ZuneApplication._unprocessedAppArgs[index]);
ZuneApplication._unprocessedAppArgs = (List<Hashtable>)null;
for (int index = 0; index < _unprocessedAppArgs.Count; ++index)
ProcessAppArgs(_unprocessedAppArgs[index]);
_unprocessedAppArgs = null;
}
}
private static void ProcessAppArgs(Hashtable args)
{
if (args[(object)"device"] is string str && !ZuneApplication._phase2InitComplete)
if (args["device"] is string str && !_phase2InitComplete)
{
char[] chArray = new char[1] { '"' };
SyncControls.Instance.SetCurrentDeviceByCanonicalName(str.Trim(chArray));
}
if (args[(object)"link"] is string link && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args["link"] is string link && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
ZuneUI.Shell.ProcessExternalLink(link);
if (args[(object)"ripcd"] is string playCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args["ripcd"] is string playCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
CDAccess.HandleDiskFromAutoplay(playCdPath, CDAction.Rip);
if (args[(object)"playcd"] is string ripCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args["playcd"] is string ripCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
CDAccess.HandleDiskFromAutoplay(ripCdPath, CDAction.Play);
if (args[(object)"playmedia"] is string initialUrl && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
ZuneApplication.RegisterNewFileEnumeration(new LaunchFromShellHelper("play", initialUrl));
if (args[(object)"shellhlp_v2"] is string taskName && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args["playmedia"] is string initialUrl && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
RegisterNewFileEnumeration(new LaunchFromShellHelper("play", initialUrl));
if (args["shellhlp_v2"] is string taskName && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
{
string marshalledDataObject = args[(object)"dataobject"] as string;
string eventName = args[(object)"event"] as string;
string marshalledDataObject = args["dataobject"] as string;
string eventName = args["event"] as string;
if (marshalledDataObject != null && eventName != null)
ZuneApplication.RegisterNewFileEnumeration(new LaunchFromShellHelper(taskName, marshalledDataObject, eventName));
RegisterNewFileEnumeration(new LaunchFromShellHelper(taskName, marshalledDataObject, eventName));
}
if (args.Contains((object)"refreshlicenses"))
ZuneApplication.ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh();
if (args.Contains((object)"update"))
if (args.Contains("refreshlicenses"))
ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh();
if (args.Contains("update"))
SoftwareUpdates.Instance.InstallUpdates();
if (args.Contains((object)"shuffleall") && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args.Contains("shuffleall") && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
SingletonModelItem<TransportControls>.Instance.ShuffleAllRequested = true;
if (args.Contains((object)"resumenowplaying") && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (args.Contains("resumenowplaying") && !ZuneUI.Shell.IgnoreAppNavigationsArgs)
SingletonModelItem<TransportControls>.Instance.ResumeLastNowPlayingHandler();
if (args.Contains((object)"refreshcontentandexit"))
if (args.Contains("refreshcontentandexit"))
{
if (!ZuneApplication._phase2InitComplete)
if (!_phase2InitComplete)
{
HRESULT sOk = HRESULT._S_OK;
HRESULT hr = ContentRefreshTask.Instance.StartContentRefresh(new AsyncCompleteHandler(ZuneApplication.OnContentRefreshTaskComplete));
HRESULT hr = ContentRefreshTask.Instance.StartContentRefresh(new AsyncCompleteHandler(OnContentRefreshTaskComplete));
if (hr.IsError)
ZuneApplication.OnContentRefreshTaskComplete(hr);
OnContentRefreshTaskComplete(hr);
}
else
ZuneApplication.ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh();
ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh();
}
if (!(args[(object)"playpin"] is string pinString) || ZuneUI.Shell.IgnoreAppNavigationsArgs)
if (!(args["playpin"] is string pinString) || ZuneUI.Shell.IgnoreAppNavigationsArgs)
return;
JumpListManager.PlayPin(JumpListPin.Parse(pinString));
}
private static void OnContentRefreshTaskComplete(HRESULT hr) => Application.DeferredInvoke(new DeferredInvokeHandler(ZuneApplication.DeferredClose), DeferredInvokePriority.Normal);
private static void OnContentRefreshTaskComplete(HRESULT hr) => Application.DeferredInvoke(new DeferredInvokeHandler(DeferredClose), DeferredInvokePriority.Normal);
public static void DeferredClose(object arg) => Application.Window.Close();
private static void ProcessAppArgsAfterFUE(object sender, EventArgs unused)
{
Fue.FUECompleted -= new EventHandler(ZuneApplication.ProcessAppArgsAfterFUE);
ZuneApplication.ProcessAppArgs();
Fue.FUECompleted -= new EventHandler(ProcessAppArgsAfterFUE);
ProcessAppArgs();
}
private static void RegisterNewFileEnumeration(LaunchFromShellHelper helper)
{
if (ZuneApplication._currentShellCommand != null)
ZuneApplication._currentShellCommand.Cancel();
ZuneApplication._currentShellCommand = helper;
ZuneApplication._currentShellCommand.Go(new DeferredInvokeHandler(ZuneApplication.DataObjectEnumerationComplete));
if (_currentShellCommand != null)
_currentShellCommand.Cancel();
_currentShellCommand = helper;
_currentShellCommand.Go(new DeferredInvokeHandler(DataObjectEnumerationComplete));
}
private static void DataObjectEnumerationComplete(object args)
{
if (args != ZuneApplication._currentShellCommand)
if (args != _currentShellCommand)
return;
string taskName = ZuneApplication._currentShellCommand.TaskName;
string taskName = _currentShellCommand.TaskName;
if (taskName == "play" || taskName == "playasplaylist")
{
List<FileEntry> files = ZuneApplication._currentShellCommand.Files;
MediaType mediaType = ZuneApplication.FilterFiles(files);
List<FileEntry> files = _currentShellCommand.Files;
MediaType mediaType = FilterFiles(files);
if (files != null && files.Count > 0 && (mediaType == MediaType.Track || mediaType == MediaType.Video))
{
PlaybackContext playbackContext = PlaybackContext.Music;
if (mediaType == MediaType.Video)
playbackContext = PlaybackContext.LibraryVideo;
SingletonModelItem<TransportControls>.Instance.PlayItems((IList)files, playbackContext);
SingletonModelItem<TransportControls>.Instance.PlayItems(files, playbackContext);
}
}
ZuneApplication._currentShellCommand = (LaunchFromShellHelper)null;
_currentShellCommand = null;
}
private static MediaType FilterFiles(List<FileEntry> enumeratedFiles)
@@ -320,8 +320,8 @@ namespace Microsoft.Zune.Shell
private static string[] SplitCommandLineArguments(string arguments)
{
if (string.IsNullOrEmpty(arguments))
return (string[])null;
string[] strArray = (string[])null;
return null;
string[] strArray = null;
MatchCollection matchCollection = new Regex("(\\S*?(\\\")([^\\\"])+(\\\"))|[^\\s\"]+").Matches(arguments);
if (matchCollection.Count > 0)
{
@@ -335,13 +335,13 @@ namespace Microsoft.Zune.Shell
[STAThread]
public static int Launch(string strArgs, IntPtr hWndSplashScreen)
{
Microsoft.Zune.PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(Microsoft.Zune.PerfTrace.PerfTrace.LAUNCH_EVENT.IN_MANAGED_LAUNCH, 0U);
Application.ErrorReport += new Microsoft.Iris.ErrorReportHandler(ZuneApplication.ErrorReportHandler);
Hashtable hashtable = StandAlone.Startup(ZuneApplication.SplitCommandLineArguments(strArgs), ZuneApplication.DefaultCommandLineParameterSwitch);
PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(PerfTrace.PerfTrace.LAUNCH_EVENT.IN_MANAGED_LAUNCH, 0U);
Application.ErrorReport += new ErrorReportHandler(ErrorReportHandler);
Hashtable hashtable = StandAlone.Startup(SplitCommandLineArguments(strArgs), DefaultCommandLineParameterSwitch);
if (hashtable != null)
{
ZuneApplication._unprocessedAppArgs = new List<Hashtable>();
ZuneApplication._unprocessedAppArgs.Add(hashtable);
_unprocessedAppArgs = new List<Hashtable>();
_unprocessedAppArgs.Add(hashtable);
}
DialogHelper.DialogCancel = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_CANCEL);
DialogHelper.DialogYes = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_YES);
@@ -356,7 +356,7 @@ namespace Microsoft.Zune.Shell
Application.Name = "Zune";
Application.Window.Caption = "Zune";
Application.Window.SetIcon("ZuneShellResources.dll", 1);
if (!hashtable.Contains((object)"noshadow"))
if (!hashtable.Contains("noshadow"))
{
Image[] images = new Image[4];
ImageInset imageInset1 = new ImageInset(26, 0, 30, 0);
@@ -375,24 +375,24 @@ namespace Microsoft.Zune.Shell
Application.Window.SetShadowEdgeImages(false, images);
}
Application.Window.CloseRequested += new WindowCloseRequestedHandler(CodeDialogManager.Instance.OnWindowCloseRequested);
CodeDialogManager.Instance.WindowCloseNotBlocked += new EventHandler(ZuneApplication.OnWindowCloseNotBlocked);
Application.Window.SessionConnected += new SessionConnectedHandler(ZuneApplication.OnSessionConnected);
CodeDialogManager.Instance.WindowCloseNotBlocked += new EventHandler(OnWindowCloseNotBlocked);
Application.Window.SessionConnected += new SessionConnectedHandler(OnSessionConnected);
string source = "res://ZuneShellResources!Frame.uix#Frame";
ZuneApplication._hWndSplashScreen = hWndSplashScreen;
ZuneApplication._initializationFailsafe = new InitializationFailsafe();
Microsoft.Zune.PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(Microsoft.Zune.PerfTrace.PerfTrace.LAUNCH_EVENT.REQUEST_UI_LOAD, 0U);
_hWndSplashScreen = hWndSplashScreen;
_initializationFailsafe = new InitializationFailsafe();
PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(PerfTrace.PerfTrace.LAUNCH_EVENT.REQUEST_UI_LOAD, 0U);
Application.Window.RequestLoad(source);
Microsoft.Zune.PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(Microsoft.Zune.PerfTrace.PerfTrace.LAUNCH_EVENT.REQUEST_UI_LOAD_COMPLETE, 0U);
PerfTrace.PerfTrace.PERFTRACE_LAUNCHEVENT(PerfTrace.PerfTrace.LAUNCH_EVENT.REQUEST_UI_LOAD_COMPLETE, 0U);
CallbackOnUIThread callbackOnUiThread = new CallbackOnUIThread();
ZuneApplication._appInitializationSequencer = new AppInitializationSequencer(new CorePhase2ReadyCallback(ZuneApplication.CorePhase3Ready));
ZuneApplication._zuneLibrary = new ZuneLibrary();
int num = ZuneApplication._zuneLibrary.Initialize((string)null, out ZuneApplication._dbRebuilt);
_appInitializationSequencer = new AppInitializationSequencer(new CorePhase2ReadyCallback(CorePhase3Ready));
_zuneLibrary = new ZuneLibrary();
int num = _zuneLibrary.Initialize(null, out _dbRebuilt);
if (num == 0)
{
StandAlone.Run(new DeferredInvokeHandler(ZuneApplication.Phase2Initialization));
StandAlone.Run(new DeferredInvokeHandler(Phase2Initialization));
Application.Window.CloseRequested -= new WindowCloseRequestedHandler(CodeDialogManager.Instance.OnWindowCloseRequested);
CodeDialogManager.Instance.WindowCloseNotBlocked -= new EventHandler(ZuneApplication.OnWindowCloseNotBlocked);
Application.Window.SessionConnected -= new SessionConnectedHandler(ZuneApplication.OnSessionConnected);
CodeDialogManager.Instance.WindowCloseNotBlocked -= new EventHandler(OnWindowCloseNotBlocked);
Application.Window.SessionConnected -= new SessionConnectedHandler(OnSessionConnected);
if (Download.IsCreated)
Download.Instance.Dispose();
ZuneShell.DefaultInstance?.Dispose();
@@ -406,8 +406,8 @@ namespace Microsoft.Zune.Shell
WorkerQueue.ShutdownAll();
if (ContentRefreshTask.HasInstance)
ContentRefreshTask.Instance.Dispose();
if (ZuneApplication.Service != null)
ZuneApplication.Service.Dispose();
if (Service != null)
Service.Dispose();
if (ShellMessagingNotifier.HasInstance)
ShellMessagingNotifier.Instance.Dispose();
if (MessagingService.HasInstance)
@@ -416,14 +416,14 @@ namespace Microsoft.Zune.Shell
FeaturesChangedApi.Instance.Dispose();
CDAccess.Instance.Dispose();
PlaylistManager.Instance.Dispose();
if (ZuneApplication._interopNotifications != null)
if (_interopNotifications != null)
{
ZuneApplication._interopNotifications.ShowErrorDialog -= new OnShowErrorDialogHandler(ZuneApplication.OnShowErrorDialog);
ZuneApplication._interopNotifications.Dispose();
ZuneApplication._interopNotifications = (InteropNotifications)null;
_interopNotifications.ShowErrorDialog -= new OnShowErrorDialogHandler(OnShowErrorDialog);
_interopNotifications.Dispose();
_interopNotifications = null;
}
}
ZuneApplication._zuneLibrary.Dispose();
_zuneLibrary.Dispose();
return num;
}
@@ -440,16 +440,16 @@ namespace Microsoft.Zune.Shell
}
}
if (num > 0)
throw new ZuneShellException("Internal Zune Shell error", string.Format("Scripting errors encountered (Process ID) = {0}\n\n{1}", (object)Process.GetCurrentProcess().Id.ToString((IFormatProvider)CultureInfo.InvariantCulture), (object)str));
throw new ZuneShellException("Internal Zune Shell error", string.Format("Scripting errors encountered (Process ID) = {0}\n\n{1}", Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), str));
}
internal static bool CanAddMedia(IList filenames, MediaType mediaType, CanAddMediaArgs args)
{
foreach (string filename in (IEnumerable)filenames)
foreach (string filename in filenames)
{
if (args.Aborted)
return false;
if (ZuneApplication.CanAddMedia(filename, mediaType, args))
if (CanAddMedia(filename, mediaType, args))
return true;
}
return false;
@@ -459,7 +459,7 @@ namespace Microsoft.Zune.Shell
{
try
{
return Directory.Exists(filename) ? ZuneApplication.ZuneLibrary.CanAddFromFolder(filename) && (ZuneApplication.CanAddMedia((IList)Directory.GetFiles(filename), mediaType, args) || ZuneApplication.CanAddMedia((IList)Directory.GetDirectories(filename), mediaType, args)) : ZuneApplication.ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType);
return Directory.Exists(filename) ? ZuneLibrary.CanAddFromFolder(filename) && (CanAddMedia(Directory.GetFiles(filename), mediaType, args) || CanAddMedia(Directory.GetDirectories(filename), mediaType, args)) : ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType);
}
catch (UnauthorizedAccessException ex)
{
@@ -474,8 +474,8 @@ namespace Microsoft.Zune.Shell
internal static bool AddMedia(IList filenames, MediaType mediaType)
{
bool flag = false;
foreach (string filename in (IEnumerable)filenames)
flag |= ZuneApplication.AddMedia(filename, mediaType);
foreach (string filename in filenames)
flag |= AddMedia(filename, mediaType);
return flag;
}
@@ -486,11 +486,11 @@ namespace Microsoft.Zune.Shell
{
if (Directory.Exists(filename))
{
flag = ZuneApplication.AddMedia((IList)Directory.GetFiles(filename), mediaType);
flag |= ZuneApplication.AddMedia((IList)Directory.GetDirectories(filename), mediaType);
flag = AddMedia(Directory.GetFiles(filename), mediaType);
flag |= AddMedia(Directory.GetDirectories(filename), mediaType);
}
else if (ZuneApplication.ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType))
flag = ZuneApplication.ZuneLibrary.AddMedia(filename) != -1;
else if (ZuneLibrary.CanAddMedia(filename, (EMediaTypes)mediaType))
flag = ZuneLibrary.AddMedia(filename) != -1;
}
catch (UnauthorizedAccessException ex)
{
@@ -507,8 +507,8 @@ namespace Microsoft.Zune.Shell
out int libraryID,
out bool fFileAlreadyExists)
{
ZuneApplication._transientTableCleanupComplete.WaitOne();
return ZuneApplication.ZuneLibrary.AddTransientMedia(filename, (EMediaTypes)mediaType, out libraryID, out fFileAlreadyExists);
_transientTableCleanupComplete.WaitOne();
return ZuneLibrary.AddTransientMedia(filename, (EMediaTypes)mediaType, out libraryID, out fFileAlreadyExists);
}
private static void OnWindowCloseNotBlocked(object sender, EventArgs args)
@@ -524,19 +524,19 @@ namespace Microsoft.Zune.Shell
ui = "res://ZuneShellResources!ConfirmClose.uix#ConfirmFirmwareUpdateCloseContentUI";
else if (flag2)
ui = "res://ZuneShellResources!ConfirmClose.uix#ConfirmFirmwareRestoreCloseContentUI";
ConfirmCloseDialog.Show(ui, (EventHandler)delegate
ConfirmCloseDialog.Show(ui, delegate
{
ZuneApplication.ForceClose(sender, args);
ForceClose(sender, args);
});
}
else
ZuneApplication.ForceClose(sender, args);
ForceClose(sender, args);
}
private static void ForceClose(object sender, EventArgs args)
{
if (ZuneApplication.Closing != null)
ZuneApplication.Closing(sender, args);
if (Closing != null)
Closing(sender, args);
Application.Window.ForceClose();
}
@@ -547,10 +547,10 @@ namespace Microsoft.Zune.Shell
SingletonModelItem<TransportControls>.Instance.CloseCurrentSession();
}
public static void OnShowErrorDialog(int hr, uint uiStringId) => Application.DeferredInvoke(new DeferredInvokeHandler(ZuneApplication.DeferredShowErrorDialog), (object)new object[2]
public static void OnShowErrorDialog(int hr, uint uiStringId) => Application.DeferredInvoke(new DeferredInvokeHandler(DeferredShowErrorDialog), new object[2]
{
(object) hr,
(object) uiStringId
hr,
uiStringId
});
public static void DeferredShowErrorDialog(object arg)
@@ -561,11 +561,11 @@ namespace Microsoft.Zune.Shell
private static void OnQuickMixPropertyChanged(object Sender, PropertyChangedEventArgs e)
{
if (!(e.PropertyName == "Progress") || (double)ZuneApplication._quickMixProgress.Progress < 100.0)
if (!(e.PropertyName == "Progress") || _quickMixProgress.Progress < 100.0)
return;
NotificationArea.Instance.Add((ZuneUI.Notification)new QuickMixNotification(ZuneUI.Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_BOOTSTRAP_READY_TITLE), ZuneUI.Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_BOOTSTRAP_READY_TEXT), NotificationState.Completed, true, 10000));
ZuneApplication._quickMixProgress.PropertyChanged -= new PropertyChangedEventHandler(ZuneApplication.OnQuickMixPropertyChanged);
ZuneApplication._quickMixProgress = (QuickMixProgress)null;
NotificationArea.Instance.Add(new QuickMixNotification(ZuneUI.Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_BOOTSTRAP_READY_TITLE), ZuneUI.Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_BOOTSTRAP_READY_TEXT), NotificationState.Completed, true, 10000));
_quickMixProgress.PropertyChanged -= new PropertyChangedEventHandler(OnQuickMixPropertyChanged);
_quickMixProgress = null;
}
}
}
+2 -2
View File
@@ -15,12 +15,12 @@ namespace Microsoft.Zune.Shell
private string _context;
public ZuneShellException(string message)
: this(message, (string)null)
: this(message, null)
{
}
public ZuneShellException(string message, string context)
: base(ZuneShellException.PrepareMessage(message, context))
: base(PrepareMessage(message, context))
=> this._context = context;
protected ZuneShellException(SerializationInfo info, StreamingContext context)
+25 -25
View File
@@ -27,22 +27,22 @@ namespace Microsoft.Zune.Util
public static void Log(SQMDataId sqmDataId, int nData)
{
SQMDataPoint dataPoint = SQMLog.FindDataPoint(sqmDataId);
SQMDataPoint dataPoint = FindDataPoint(sqmDataId);
if (dataPoint.id == SQMDataId.Invalid)
return;
switch (dataPoint.action)
{
case SQMAction.Add:
SQMLog.SQMAddWrapper(dataPoint.GetName(), nData);
SQMAddWrapper(dataPoint.GetName(), nData);
break;
case SQMAction.Inc:
SQMLog.SQMAddWrapper(dataPoint.GetName(), 1);
SQMAddWrapper(dataPoint.GetName(), 1);
break;
case SQMAction.SetFlag:
SQMLog.SQMSetFlagWrapper(dataPoint.GetName(), nData != 0);
SQMSetFlagWrapper(dataPoint.GetName(), nData != 0);
break;
case SQMAction.SetBits:
SQMLog.SQMSetBitsWrapper(dataPoint.GetName(), (uint)nData);
SQMSetBitsWrapper(dataPoint.GetName(), (uint)nData);
break;
default:
throw new ArgumentException("Datapoint " + dataPoint.GetName() + " is not a simple DWORD-type datapoint. Use LogToStream for stream-type datapoints.");
@@ -52,7 +52,7 @@ namespace Microsoft.Zune.Util
public static void LogToStream(SQMDataId sqmDataId, params string[] args)
{
SQMDataPoint dataPoint = SQMLog.FindDataPoint(sqmDataId);
SQMDataPoint dataPoint = FindDataPoint(sqmDataId);
if (dataPoint.id == SQMDataId.Invalid)
return;
if (dataPoint.action != SQMAction.MixedStream)
@@ -62,34 +62,34 @@ namespace Microsoft.Zune.Util
if (args.Length != dataPoint.argCount)
throw new ArgumentException("Passed-in arg count doesn't match datapoint declaration: " + dataPoint.GetName(), "args.Length");
if (args.Length == 1)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0]);
else if (args.Length == 2)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1]);
else if (args.Length == 3)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2]);
else if (args.Length == 4)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3]);
else if (args.Length == 5)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4]);
else if (args.Length == 6)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5]);
else if (args.Length == 7)
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
else if (args.Length == 8)
{
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
}
else
{
if (args.Length != 9)
return;
SQMLog.SQMAddToStream(dataPoint.GetName(), SQMLog.c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
SQMAddToStream(dataPoint.GetName(), c_rgSPTArrayAllStrings, (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
}
}
public static void LogToStream(SQMDataId sqmDataId, params uint[] args)
{
SQMDataPoint dataPoint = SQMLog.FindDataPoint(sqmDataId);
SQMDataPoint dataPoint = FindDataPoint(sqmDataId);
if (dataPoint.id == SQMDataId.Invalid)
return;
if (dataPoint.action != SQMAction.NumStream)
@@ -99,28 +99,28 @@ namespace Microsoft.Zune.Util
if (args.Length != dataPoint.argCount)
throw new ArgumentException("Passed-in arg count doesn't match datapoint declaration: " + dataPoint.GetName(), "args.Length");
if (args.Length == 1)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0]);
else if (args.Length == 2)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1]);
else if (args.Length == 3)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2]);
else if (args.Length == 4)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3]);
else if (args.Length == 5)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4]);
else if (args.Length == 6)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5]);
else if (args.Length == 7)
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
else if (args.Length == 8)
{
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
}
else
{
if (args.Length != 9)
return;
SQMLog.SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
SQMAddNumbersToStream(dataPoint.GetName(), (uint)args.Length, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ namespace ZuneUI
public WirelessStateResults StartOperation(
UIDevice device,
AsyncOperation.AOComplete completeFunc,
AOComplete completeFunc,
bool fIgnoreErrors)
{
this.ResetState(fIgnoreErrors);
+5 -5
View File
@@ -18,19 +18,19 @@ namespace ZuneUI
private WlanProfileList _computerProfiles;
private WlanProfile _connectedNetwork;
public WlanProfile ConnectedNetwork => this.Finished ? this._connectedNetwork : (WlanProfile)null;
public WlanProfile ConnectedNetwork => this.Finished ? this._connectedNetwork : null;
private void ResetState()
{
if (!this.Idle && !this.Finished)
return;
this._computerProfiles = new WlanProfileList();
this._connectedNetwork = (WlanProfile)null;
this._connectedNetwork = null;
}
public WirelessStateResults StartOperation(
UIDevice device,
AsyncOperation.AOComplete completeFunc)
AOComplete completeFunc)
{
this.ResetState();
return this.StartOperation(device, completeFunc, this._getConnectedNetworkStates);
@@ -47,10 +47,10 @@ namespace ZuneUI
protected override void EndOperation(WirelessStateResults result)
{
this._connectedNetwork = (WlanProfile)null;
this._connectedNetwork = null;
if (this._computerProfiles == null)
return;
foreach (WlanProfile computerProfile in (List<WlanProfile>)this._computerProfiles)
foreach (WlanProfile computerProfile in _computerProfiles)
{
if (computerProfile.Connected)
{
+3 -3
View File
@@ -16,11 +16,11 @@ namespace ZuneUI
};
private WlanProfile _deviceProfile;
public WlanProfile DeviceProfile => this.Finished ? this._deviceProfile : (WlanProfile)null;
public WlanProfile DeviceProfile => this.Finished ? this._deviceProfile : null;
public WirelessStateResults StartOperation(
UIDevice device,
AsyncOperation.AOComplete completeFunc)
AOComplete completeFunc)
{
this.ResetState();
return this.StartOperation(device, completeFunc, this._getDeviceProfileStates);
@@ -39,7 +39,7 @@ namespace ZuneUI
protected override void RemoveListeners() => this._device.WiFiProfilesReceivedEvent -= new FallibleEventHandler(this.Device_GetDeviceWlanProfilesCompleteEvent);
private void ResetState() => this._deviceProfile = (WlanProfile)null;
private void ResetState() => this._deviceProfile = null;
private void Device_GetDeviceWlanProfilesCompleteEvent(object sender, FallibleEventArgs args)
{
+5 -5
View File
@@ -20,7 +20,7 @@ namespace ZuneUI
WirelessStates.SniffNetworks
};
public WlanProfileList NetworkList => this.Finished ? this._networkList : (WlanProfileList)null;
public WlanProfileList NetworkList => this.Finished ? this._networkList : null;
private void ResetState()
{
@@ -33,7 +33,7 @@ namespace ZuneUI
public WirelessStateResults StartOperation(
UIDevice device,
AsyncOperation.AOComplete completeFunc)
AOComplete completeFunc)
{
this.ResetState();
return this.StartOperation(device, completeFunc, this._getNetworkListStates);
@@ -65,12 +65,12 @@ namespace ZuneUI
Dictionary<string, WlanProfile> dictionary = new Dictionary<string, WlanProfile>();
if (this._deviceNetworks != null)
{
foreach (WlanProfile deviceNetwork in (List<WlanProfile>)this._deviceNetworks)
foreach (WlanProfile deviceNetwork in _deviceNetworks)
{
if (!dictionary.ContainsKey(deviceNetwork.SSID))
{
WlanProfile wlanProfile = deviceNetwork;
foreach (WlanProfile computerNetwork in (List<WlanProfile>)this._computerNetworks)
foreach (WlanProfile computerNetwork in _computerNetworks)
{
if (computerNetwork.SSID == deviceNetwork.SSID)
{
@@ -85,7 +85,7 @@ namespace ZuneUI
}
}
}
this._networkList.Sort((IComparer<WlanProfile>)new WlanSignalStrenghComparer());
this._networkList.Sort(new WlanSignalStrenghComparer());
}
protected override void AddListeners()
+8 -8
View File
@@ -34,7 +34,7 @@ namespace ZuneUI
public override void Cancel()
{
base.Cancel();
if (this.Idle || this.Finished || this._setProfileStates[AsyncOperation._iCurrentState] != WirelessStates.TestDeviceProfile)
if (this.Idle || this.Finished || this._setProfileStates[_iCurrentState] != WirelessStates.TestDeviceProfile)
return;
this._device.CancelWiFiTest();
}
@@ -45,16 +45,16 @@ namespace ZuneUI
return;
this._attemptingName = profile.SSID;
this._attemptingProfile = profile;
this._deviceProfile = (WlanProfile)null;
this._deviceProfile = null;
this._fProfileSaved = false;
this._wlanTestResult = (string)null;
this._wlanTestResult = null;
this._wlanTestResultCode = HRESULT._S_OK;
this._restore.Reset();
}
public WirelessStateResults StartOperation(
UIDevice device,
AsyncOperation.AOComplete completeFunc,
AOComplete completeFunc,
WlanProfile newProfile)
{
if (newProfile == null)
@@ -106,17 +106,17 @@ namespace ZuneUI
if (result == WirelessStateResults.Canceled)
{
this._error = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_CANCELED);
this._detailedError = (string)null;
this._detailedError = null;
this._hr = HRESULT._S_OK;
}
else if (this._attemptingProfile != null)
this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED), (object)this._attemptingProfile.SSID);
this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED), _attemptingProfile.SSID);
else
this._error = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED_GENERIC);
}
else if (!string.IsNullOrEmpty(this._wlanTestResult))
{
this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_TEST_FAILED), (object)this._attemptingProfile.SSID);
this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_TEST_FAILED), _attemptingProfile.SSID);
this._detailedError = this._wlanTestResult;
this._hr = this._wlanTestResultCode;
}
@@ -162,7 +162,7 @@ namespace ZuneUI
{
WlanProfileList list = new WlanProfileList();
hr = this._device.GetWiFiProfileList(ref list);
this._deviceProfile = list.Count <= 0 ? (WlanProfile)null : list[0];
this._deviceProfile = list.Count <= 0 ? null : list[0];
}
if (hr.IsSuccess)
this.StepComplete(WirelessStateResults.Success);
+33 -33
View File
@@ -36,26 +36,26 @@ namespace ZuneUI
get
{
this.LoadStateData();
ArrayList arrayList = (ArrayList)null;
ArrayList arrayList = null;
if (this.m_states != null)
{
arrayList = new ArrayList(this.m_states.Values.Count);
arrayList.AddRange((ICollection)this.m_states.Values);
arrayList.Sort((IComparer)StringComparer.CurrentCultureIgnoreCase);
arrayList.Sort(StringComparer.CurrentCultureIgnoreCase);
}
return (IList)arrayList;
return arrayList;
}
}
public CountryFieldValidator GetValidator(CountryFieldValidatorType type)
{
CountryFieldValidator countryFieldValidator = (CountryFieldValidator)null;
if (this.Validators != null && AccountCountry.CountryFieldValidatorLookup.ContainsKey((object)type))
CountryFieldValidator countryFieldValidator = null;
if (this.Validators != null && CountryFieldValidatorLookup.ContainsKey(type))
{
for (int index = 0; index < this.Validators.Length; ++index)
{
CountryFieldValidator validator = this.Validators[index];
if (validator.Name == (string)AccountCountry.CountryFieldValidatorLookup[(object)type])
if (validator.Name == (string)CountryFieldValidatorLookup[type])
{
countryFieldValidator = validator;
break;
@@ -70,25 +70,25 @@ namespace ZuneUI
get
{
this.LoadStateData();
string[] array = (string[])null;
string[] array = null;
if (this.m_states != null)
{
array = new string[this.m_states.Keys.Count];
this.m_states.Keys.CopyTo(array, 0);
}
return (IList)array;
return array;
}
}
public static AccountCountry Create(CountryBaseDetails details)
{
AccountCountry accountCountry = (AccountCountry)null;
AccountCountry accountCountry = null;
if (details != null)
{
string[] languageAbbreviations = details.LanguageAbbreviations;
if (languageAbbreviations != null)
Array.Sort<string>(languageAbbreviations, LanguageNameComparer.Instance);
string localizedStates = (string)null;
Array.Sort(languageAbbreviations, LanguageNameComparer.Instance);
string localizedStates = null;
if (details.Abbreviation.Equals("US", StringComparison.InvariantCultureIgnoreCase))
localizedStates = Shell.LoadString(StringId.IDS_BILLING_USA_STATES);
else if (details.Abbreviation.Equals("CA", StringComparison.InvariantCultureIgnoreCase))
@@ -102,26 +102,26 @@ namespace ZuneUI
{
get
{
if (AccountCountry.m_countryFieldValidatorLookup == null)
if (m_countryFieldValidatorLookup == null)
{
AccountCountry.m_countryFieldValidatorLookup = new Hashtable();
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.FirstName, (object)"firstName");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.LastName, (object)"lastName");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.AccountHolderName, (object)"accountHolderName");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.Street1, (object)"street1");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.Street2, (object)"street2");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.City, (object)"city");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.State, (object)"state");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PostalCode, (object)"postalCode");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.District, (object)"district");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.Country, (object)"country");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PhoneType, (object)"phoneType");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PhonePrefix, (object)"phonePrefix");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PhoneNumber, (object)"phoneNumber");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PhoneCountryCode, (object)"phoneCountryCode");
AccountCountry.m_countryFieldValidatorLookup.Add((object)CountryFieldValidatorType.PhoneExtension, (object)"phoneExtension");
m_countryFieldValidatorLookup = new Hashtable();
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.FirstName, "firstName");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.LastName, "lastName");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.AccountHolderName, "accountHolderName");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.Street1, "street1");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.Street2, "street2");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.City, "city");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.State, "state");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PostalCode, "postalCode");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.District, "district");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.Country, "country");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PhoneType, "phoneType");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PhonePrefix, "phonePrefix");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PhoneNumber, "phoneNumber");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PhoneCountryCode, "phoneCountryCode");
m_countryFieldValidatorLookup.Add(CountryFieldValidatorType.PhoneExtension, "phoneExtension");
}
return AccountCountry.m_countryFieldValidatorLookup;
return m_countryFieldValidatorLookup;
}
}
@@ -134,7 +134,7 @@ namespace ZuneUI
';'
}, StringSplitOptions.RemoveEmptyEntries);
int capacity = strArray.Length / 2;
this.m_states = (IDictionary<string, string>)new Dictionary<string, string>(capacity);
this.m_states = new Dictionary<string, string>(capacity);
int index1 = 0;
int index2 = 1;
for (int index3 = 0; index3 < capacity; ++index3)
@@ -149,10 +149,10 @@ namespace ZuneUI
public string GetStateAbbreviation(string stateName)
{
this.LoadStateData();
string str = (string)null;
string str = null;
if (this.m_states != null && stateName != null)
{
foreach (KeyValuePair<string, string> state in (IEnumerable<KeyValuePair<string, string>>)this.m_states)
foreach (KeyValuePair<string, string> state in m_states)
{
if (state.Value.Equals(stateName, StringComparison.InvariantCultureIgnoreCase))
{
@@ -167,7 +167,7 @@ namespace ZuneUI
public string GetState(string stateAbbreviation)
{
this.LoadStateData();
string str = (string)null;
string str = null;
if (this.m_states != null && stateAbbreviation != null && this.m_states.ContainsKey(stateAbbreviation))
str = this.m_states[stateAbbreviation];
return str;
+10 -10
View File
@@ -25,9 +25,9 @@ namespace ZuneUI
{
get
{
if (AccountCountryList.s_instance == null)
AccountCountryList.s_instance = new AccountCountryList();
return AccountCountryList.s_instance;
if (s_instance == null)
s_instance = new AccountCountryList();
return s_instance;
}
}
@@ -35,13 +35,13 @@ namespace ZuneUI
{
get
{
string[] array = (string[])null;
string[] array = null;
if (this._countries != null)
{
array = new string[this._countries.Keys.Count];
this._countries.Keys.CopyTo(array, 0);
}
return (IList)array;
return array;
}
}
@@ -49,7 +49,7 @@ namespace ZuneUI
public AccountCountry GetCountry(string abbreviation)
{
AccountCountry accountCountry = (AccountCountry)null;
AccountCountry accountCountry = null;
if (this._countries != null && abbreviation != null && this._countries.ContainsKey(abbreviation))
accountCountry = this._countries[abbreviation];
return accountCountry;
@@ -64,8 +64,8 @@ namespace ZuneUI
bool flag = true;
if (this._countries == null)
{
CountryBaseDetails[] countryDetails = Microsoft.Zune.Service.Service.Instance.GetCountryDetails();
SortedDictionary<string, AccountCountry> sortedDictionary = (SortedDictionary<string, AccountCountry>)null;
CountryBaseDetails[] countryDetails = Service.Instance.GetCountryDetails();
SortedDictionary<string, AccountCountry> sortedDictionary = null;
if (countryDetails != null && countryDetails.Length > 0)
{
sortedDictionary = new SortedDictionary<string, AccountCountry>(CountryNameComparer.Instance);
@@ -75,10 +75,10 @@ namespace ZuneUI
if (sortedDictionary == null || sortedDictionary.Count == 0)
flag = false;
else
this._countries = (IDictionary<string, AccountCountry>)sortedDictionary;
this._countries = sortedDictionary;
}
if (flag)
Application.DeferredInvoke(new DeferredInvokeHandler(this.NotifyLoaded), (object)null);
Application.DeferredInvoke(new DeferredInvokeHandler(this.NotifyLoaded), null);
return flag;
}

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