mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Add decompiled projects for UIX and UIXControls
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.INotifyList
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal interface INotifyList : IList, ICollection, IEnumerable
|
||||
{
|
||||
void Move(int oldIndex, int newIndex);
|
||||
|
||||
event UIListContentsChangedHandler ContentsChanged;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.IResourceProvider
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal interface IResourceProvider
|
||||
{
|
||||
Resource GetResource(string hierarchicalPart, string uri, bool forceSynchronous);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.IVirtualList
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.ViewItems;
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal interface IVirtualList : INotifyList, IList, ICollection, IEnumerable
|
||||
{
|
||||
void RequestItem(int idx, ItemRequestCallback callback);
|
||||
|
||||
bool IsItemAvailable(int idx);
|
||||
|
||||
void NotifyVisualsCreated(int idx);
|
||||
|
||||
void NotifyVisualsReleased(int idx);
|
||||
|
||||
Repeater RepeaterHost { get; set; }
|
||||
|
||||
bool SlowDataRequestsEnabled { get; }
|
||||
|
||||
void NotifyRequestSlowData(int index);
|
||||
|
||||
SlowDataAcquireCompleteHandler SlowDataAcquireCompleteHandler { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.IntListUtility
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal static class IntListUtility
|
||||
{
|
||||
public static int IndexOf(List<int> list, int item)
|
||||
{
|
||||
for (int index = 0; index < list.Count; ++index)
|
||||
{
|
||||
if (list[index] == item)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int IndexOf(Vector<int> list, int item)
|
||||
{
|
||||
for (int index = 0; index < list.Count; ++index)
|
||||
{
|
||||
if (list[index] == item)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static bool Contains(List<int> list, int item) => IntListUtility.IndexOf(list, item) != -1;
|
||||
|
||||
public static bool Contains(Vector<int> list, int item) => IntListUtility.IndexOf(list, item) != -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.ItemRequestCallback
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal delegate void ItemRequestCallback(object sender, int index, object item);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.ListUtility
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal static class ListUtility
|
||||
{
|
||||
public static bool IsNullOrEmpty(IList list) => list == null || list.Count <= 0;
|
||||
|
||||
public static bool IsNullOrEmpty(IVector list) => list == null || list.Count <= 0;
|
||||
|
||||
public static bool IsValidIndex(IList list, int idx) => ListUtility.IsValidIndex(idx, list.Count);
|
||||
|
||||
public static bool IsValidIndex(IVector list, int idx) => ListUtility.IsValidIndex(idx, list.Count);
|
||||
|
||||
public static bool IsValidIndex(int idx, int itemsCount)
|
||||
{
|
||||
int num = itemsCount - 1;
|
||||
return idx >= 0 && idx <= num;
|
||||
}
|
||||
|
||||
public static bool AreContentsEqual(IVector a, IVector b)
|
||||
{
|
||||
int num1 = 0;
|
||||
if (a != null)
|
||||
num1 = a.Count;
|
||||
int num2 = 0;
|
||||
if (b != null)
|
||||
num2 = b.Count;
|
||||
if (num1 != num2)
|
||||
return false;
|
||||
for (int index = 0; index < num1; ++index)
|
||||
{
|
||||
if (!ListUtility.IsEqual(a[index], b[index]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsEqual(object a, object b) => a == null ? b == null : a.Equals(b);
|
||||
|
||||
public static void GetWrappedIndex(
|
||||
int idx,
|
||||
int itemsCount,
|
||||
out int dataIndex,
|
||||
out int generationValue)
|
||||
{
|
||||
if (itemsCount == 0)
|
||||
{
|
||||
dataIndex = 0;
|
||||
generationValue = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dataIndex = idx % itemsCount;
|
||||
if (dataIndex < 0)
|
||||
dataIndex = itemsCount + dataIndex;
|
||||
generationValue = idx / itemsCount;
|
||||
if (idx >= 0 || dataIndex == 0)
|
||||
return;
|
||||
--generationValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetUnwrappedIndex(int dataIndex, int generationValue, int itemsCount)
|
||||
{
|
||||
int num = dataIndex + generationValue * itemsCount;
|
||||
if (num < 0 && generationValue > 0)
|
||||
num = int.MaxValue;
|
||||
else if (num > 0 && generationValue < 0)
|
||||
num = int.MinValue;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.Resource
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.OS;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal abstract class Resource
|
||||
{
|
||||
protected string _uri;
|
||||
private bool _forceSynchronous;
|
||||
private IntPtr _buffer;
|
||||
private uint _length;
|
||||
private bool _requiresMemoryFree;
|
||||
private ResourceStatus _status;
|
||||
private string _errorDetails;
|
||||
private int _acquisitions;
|
||||
private ResourceAcquisitionCompleteHandler _completeHandlers;
|
||||
|
||||
public Resource(string uri, bool forceSynchronous)
|
||||
{
|
||||
this._uri = uri;
|
||||
this._forceSynchronous = forceSynchronous;
|
||||
this._status = ResourceStatus.NeedsAcquire;
|
||||
}
|
||||
|
||||
public string Uri => this._uri;
|
||||
|
||||
public abstract string Identifier { get; }
|
||||
|
||||
public void Acquire() => this.Acquire((ResourceAcquisitionCompleteHandler)null);
|
||||
|
||||
public void Acquire(ResourceAcquisitionCompleteHandler completeHandler)
|
||||
{
|
||||
++this._acquisitions;
|
||||
if (completeHandler != null)
|
||||
this._completeHandlers += completeHandler;
|
||||
if (this._status == ResourceStatus.Acquiring)
|
||||
return;
|
||||
if (this._status != ResourceStatus.Available)
|
||||
{
|
||||
this._status = ResourceStatus.Acquiring;
|
||||
this._errorDetails = (string)null;
|
||||
this.StartAcquisition(this._forceSynchronous);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (completeHandler == null)
|
||||
return;
|
||||
completeHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void Free() => this.Free((ResourceAcquisitionCompleteHandler)null);
|
||||
|
||||
public void Free(ResourceAcquisitionCompleteHandler completeHandler)
|
||||
{
|
||||
--this._acquisitions;
|
||||
if (completeHandler != null)
|
||||
this._completeHandlers -= completeHandler;
|
||||
if (this._acquisitions != 0)
|
||||
return;
|
||||
if (this._status == ResourceStatus.Acquiring)
|
||||
this.CancelAcquisition();
|
||||
else if (this._buffer != IntPtr.Zero)
|
||||
{
|
||||
if (this._requiresMemoryFree)
|
||||
Resource.FreeNativeBuffer(this._buffer);
|
||||
this._buffer = IntPtr.Zero;
|
||||
}
|
||||
this._status = ResourceStatus.NeedsAcquire;
|
||||
}
|
||||
|
||||
public ResourceStatus Status
|
||||
{
|
||||
get => this._status;
|
||||
set => this._status = value;
|
||||
}
|
||||
|
||||
public string ErrorDetails => this._errorDetails;
|
||||
|
||||
public IntPtr Buffer => this._buffer;
|
||||
|
||||
public uint Length => this._length;
|
||||
|
||||
public bool ForceSynchronous => this._forceSynchronous;
|
||||
|
||||
protected abstract void StartAcquisition(bool forceSynchronous);
|
||||
|
||||
protected abstract void CancelAcquisition();
|
||||
|
||||
protected void NotifyAcquisitionComplete(
|
||||
IntPtr buffer,
|
||||
uint length,
|
||||
bool requiresMemoryFree,
|
||||
string errorDetails)
|
||||
{
|
||||
this._buffer = buffer;
|
||||
this._length = length;
|
||||
this._requiresMemoryFree = requiresMemoryFree;
|
||||
if (buffer != IntPtr.Zero)
|
||||
{
|
||||
this._status = ResourceStatus.Available;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._status = ResourceStatus.Error;
|
||||
if (errorDetails == null)
|
||||
errorDetails = string.Format("Failed to acquire resource '{0}'", (object)this.Identifier);
|
||||
this._errorDetails = errorDetails;
|
||||
}
|
||||
if (this._completeHandlers == null)
|
||||
return;
|
||||
this._completeHandlers(this);
|
||||
}
|
||||
|
||||
protected static IntPtr AllocNativeBuffer(uint length) => NativeApi.MemAlloc(length, false);
|
||||
|
||||
protected static void FreeNativeBuffer(IntPtr buffer) => NativeApi.MemFree(buffer);
|
||||
|
||||
private void FireAcquisitionCompleteHandlers()
|
||||
{
|
||||
if (this._completeHandlers == null)
|
||||
return;
|
||||
this._completeHandlers(this);
|
||||
this._completeHandlers = (ResourceAcquisitionCompleteHandler)null;
|
||||
}
|
||||
|
||||
public override string ToString() => this._uri;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.ResourceAcquisitionCompleteHandler
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal delegate void ResourceAcquisitionCompleteHandler(Resource resource);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.ResourceManager
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Session;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal sealed class ResourceManager
|
||||
{
|
||||
internal const string ProtocolSeparator = "://";
|
||||
private Vector<ResourceManager.UriRedirect> _redirects;
|
||||
private Map<string, IResourceProvider> _sourcesTable;
|
||||
private static ResourceManager s_instance = new ResourceManager();
|
||||
|
||||
private ResourceManager() => this._sourcesTable = new Map<string, IResourceProvider>();
|
||||
|
||||
public static ResourceManager Instance => ResourceManager.s_instance;
|
||||
|
||||
public void RegisterSource(string scheme, IResourceProvider source) => this._sourcesTable[scheme] = source;
|
||||
|
||||
public void UnregisterSource(string scheme) => this._sourcesTable.Remove(scheme);
|
||||
|
||||
public bool IsRegisteredSource(string scheme) => this._sourcesTable.ContainsKey(scheme);
|
||||
|
||||
public Resource GetResource(string uri) => this.GetResource(uri, false);
|
||||
|
||||
public Resource GetResource(string uri, bool forceSynchronous)
|
||||
{
|
||||
Resource resource = (Resource)null;
|
||||
if (this._redirects != null)
|
||||
{
|
||||
foreach (ResourceManager.UriRedirect redirect in this._redirects)
|
||||
{
|
||||
if (uri.StartsWith(redirect.fromPrefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (redirect.toPrefix.Equals("{ERROR}", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ErrorManager.ReportError("Resource {0} not found, but should have been located by a markup redirect", (object)uri);
|
||||
return (Resource)null;
|
||||
}
|
||||
resource = this.GetResourceWorker(redirect.toPrefix + uri.Substring(redirect.fromPrefix.Length), true);
|
||||
if (resource != null)
|
||||
{
|
||||
resource.Acquire();
|
||||
bool flag = resource.Status == ResourceStatus.Available;
|
||||
resource.Free();
|
||||
if (!flag)
|
||||
resource = (Resource)null;
|
||||
}
|
||||
}
|
||||
if (resource != null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resource == null)
|
||||
resource = this.GetResourceWorker(uri, forceSynchronous);
|
||||
return resource;
|
||||
}
|
||||
|
||||
private Resource GetResourceWorker(string uri, bool forceSynchronous)
|
||||
{
|
||||
Resource resource = (Resource)null;
|
||||
string scheme;
|
||||
string hierarchicalPart;
|
||||
ResourceManager.ParseUri(uri, out scheme, out hierarchicalPart);
|
||||
if (string.IsNullOrEmpty(scheme) || string.IsNullOrEmpty(hierarchicalPart))
|
||||
{
|
||||
ErrorManager.ReportWarning("Invalid resource uri: '{0}'", (object)uri);
|
||||
return (Resource)null;
|
||||
}
|
||||
IResourceProvider resourceProvider;
|
||||
if (this._sourcesTable.TryGetValue(scheme, out resourceProvider))
|
||||
resource = resourceProvider.GetResource(hierarchicalPart, uri, forceSynchronous);
|
||||
else
|
||||
ErrorManager.ReportWarning("Invalid resource protocol: '{0}'", (object)scheme);
|
||||
return resource;
|
||||
}
|
||||
|
||||
public static void ParseUri(string uri, out string scheme, out string hierarchicalPart)
|
||||
{
|
||||
int length = uri.IndexOf("://", StringComparison.Ordinal);
|
||||
if (length > 0)
|
||||
{
|
||||
scheme = uri.Substring(0, length);
|
||||
hierarchicalPart = uri.Substring(length + "://".Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
scheme = (string)null;
|
||||
hierarchicalPart = uri;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddUriRedirect(string fromPrefix, string toPrefix)
|
||||
{
|
||||
ResourceManager.UriRedirect uriRedirect = new ResourceManager.UriRedirect();
|
||||
uriRedirect.fromPrefix = fromPrefix;
|
||||
uriRedirect.toPrefix = toPrefix;
|
||||
if (this._redirects == null)
|
||||
this._redirects = new Vector<ResourceManager.UriRedirect>();
|
||||
this._redirects.Add(uriRedirect);
|
||||
}
|
||||
|
||||
public static Resource AcquireResource(string uri)
|
||||
{
|
||||
ErrorWatermark watermark = ErrorManager.Watermark;
|
||||
Resource resource = ResourceManager.Instance.GetResource(uri, true);
|
||||
if (resource == null)
|
||||
return (Resource)null;
|
||||
resource.Acquire();
|
||||
if (resource.Status == ResourceStatus.Error)
|
||||
{
|
||||
if (resource.ErrorDetails != null)
|
||||
ErrorManager.ReportError(resource.ErrorDetails);
|
||||
else
|
||||
ErrorManager.ReportError("Failed to acquire resource '{0}'", (object)uri);
|
||||
}
|
||||
else if (resource.Status != ResourceStatus.Available)
|
||||
ErrorManager.ReportError("Failed to acquire resource '{0}'. Resources that cannot be fetched synchronously are not valid in this context", (object)uri);
|
||||
if (watermark.ErrorsDetected)
|
||||
{
|
||||
resource.Free();
|
||||
resource = (Resource)null;
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
internal struct UriRedirect
|
||||
{
|
||||
public string fromPrefix;
|
||||
public string toPrefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.ResourceStatus
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal enum ResourceStatus
|
||||
{
|
||||
NeedsAcquire,
|
||||
Acquiring,
|
||||
Available,
|
||||
Error,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.SingleArrayListCache
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal struct SingleArrayListCache
|
||||
{
|
||||
private ArrayList _list;
|
||||
|
||||
public ArrayList Acquire()
|
||||
{
|
||||
ArrayList arrayList = this._list;
|
||||
this._list = (ArrayList)null;
|
||||
if (arrayList == null)
|
||||
arrayList = new ArrayList();
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void Release(ArrayList list)
|
||||
{
|
||||
list.Clear();
|
||||
this._list = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.SlowDataAcquireCompleteHandler
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal delegate bool SlowDataAcquireCompleteHandler(IVirtualList list, int index);
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.StringUtility
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal static class StringUtility
|
||||
{
|
||||
public static string[] SplitAndTrim(char separator, string splitee)
|
||||
{
|
||||
string[] strArray = splitee.Split(separator);
|
||||
for (int index = 0; index < strArray.Length; ++index)
|
||||
strArray[index] = strArray[index].Trim();
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string Unescape(string source, out int errorIndex, out string invalidSequence)
|
||||
{
|
||||
invalidSequence = (string)null;
|
||||
errorIndex = -1;
|
||||
if (source.IndexOf('\\') == -1)
|
||||
return source;
|
||||
StringBuilder stringBuilder = new StringBuilder(source.Length);
|
||||
int index = 0;
|
||||
int startIndex = 0;
|
||||
int length = source.Length;
|
||||
bool flag = true;
|
||||
while (flag && index < length)
|
||||
{
|
||||
startIndex = index;
|
||||
char ch1 = source[index++];
|
||||
if (ch1 != '\\')
|
||||
{
|
||||
stringBuilder.Append(ch1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index == length)
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
char mode = source[index++];
|
||||
char ch2 = char.MinValue;
|
||||
char ch3 = char.MinValue;
|
||||
switch (mode)
|
||||
{
|
||||
case '"':
|
||||
ch2 = '"';
|
||||
break;
|
||||
case '\'':
|
||||
ch2 = '\'';
|
||||
break;
|
||||
case '0':
|
||||
ch2 = char.MinValue;
|
||||
break;
|
||||
case 'U':
|
||||
case 'u':
|
||||
case 'x':
|
||||
uint result;
|
||||
flag = StringUtility.ReadHexSequence(mode, source, ref index, length, out result);
|
||||
if (flag)
|
||||
{
|
||||
if (result <= (uint)ushort.MaxValue)
|
||||
{
|
||||
ch2 = (char)result;
|
||||
break;
|
||||
}
|
||||
if (result <= 1114111U)
|
||||
{
|
||||
ch2 = (char)((result - 65536U) / 1024U + 55296U);
|
||||
ch3 = (char)((result - 65536U) % 1024U + 56320U);
|
||||
break;
|
||||
}
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\\':
|
||||
ch2 = '\\';
|
||||
break;
|
||||
case 'a':
|
||||
ch2 = '\a';
|
||||
break;
|
||||
case 'b':
|
||||
ch2 = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
ch2 = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
ch2 = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
ch2 = '\r';
|
||||
break;
|
||||
case 't':
|
||||
ch2 = '\t';
|
||||
break;
|
||||
case 'v':
|
||||
ch2 = '\v';
|
||||
break;
|
||||
default:
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
stringBuilder.Append(ch2);
|
||||
if (ch3 != char.MinValue)
|
||||
stringBuilder.Append(ch3);
|
||||
}
|
||||
}
|
||||
}
|
||||
string str;
|
||||
if (!flag)
|
||||
{
|
||||
str = (string)null;
|
||||
errorIndex = startIndex;
|
||||
invalidSequence = source.Substring(startIndex, index - startIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
str = stringBuilder.ToString();
|
||||
errorIndex = -1;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private static bool ReadHexSequence(
|
||||
char mode,
|
||||
string source,
|
||||
ref int index,
|
||||
int indexLast,
|
||||
out uint result)
|
||||
{
|
||||
int num1;
|
||||
int num2;
|
||||
switch (mode)
|
||||
{
|
||||
case 'u':
|
||||
num1 = 4;
|
||||
num2 = 4;
|
||||
break;
|
||||
case 'x':
|
||||
num1 = 1;
|
||||
num2 = 4;
|
||||
break;
|
||||
default:
|
||||
num1 = 8;
|
||||
num2 = 8;
|
||||
break;
|
||||
}
|
||||
int num3 = 0;
|
||||
uint num4 = 0;
|
||||
for (; index < indexLast && num3 < num2; ++num3)
|
||||
{
|
||||
char ch = source[index];
|
||||
uint num5;
|
||||
if (ch >= '0' && ch <= '9')
|
||||
num5 = (uint)ch - 48U;
|
||||
else if (ch >= 'a' && ch <= 'f')
|
||||
num5 = (uint)(10 + ((int)ch - 97));
|
||||
else if (ch >= 'A' && ch <= 'F')
|
||||
num5 = (uint)(10 + ((int)ch - 65));
|
||||
else
|
||||
break;
|
||||
num4 = (num4 << 4) + num5;
|
||||
++index;
|
||||
}
|
||||
bool flag = num3 >= num1;
|
||||
result = flag ? num4 : 0U;
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.UIListContentsChangeType
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal enum UIListContentsChangeType
|
||||
{
|
||||
Add,
|
||||
AddRange,
|
||||
Remove,
|
||||
Move,
|
||||
Insert,
|
||||
InsertRange,
|
||||
Clear,
|
||||
Modified,
|
||||
Reset,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.UIListContentsChangedArgs
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal class UIListContentsChangedArgs : EventArgs
|
||||
{
|
||||
private UIListContentsChangeType _type;
|
||||
private int _oldIndex;
|
||||
private int _newIndex;
|
||||
private int _count;
|
||||
|
||||
public UIListContentsChangedArgs(
|
||||
UIListContentsChangeType type,
|
||||
int oldIndex,
|
||||
int newIndex,
|
||||
int count)
|
||||
{
|
||||
this._count = count;
|
||||
this._type = type;
|
||||
this._oldIndex = oldIndex;
|
||||
this._newIndex = newIndex;
|
||||
}
|
||||
|
||||
public UIListContentsChangedArgs(UIListContentsChangeType type, int oldIndex, int newIndex)
|
||||
: this(type, oldIndex, newIndex, 1)
|
||||
{
|
||||
}
|
||||
|
||||
public UIListContentsChangeType Type => this._type;
|
||||
|
||||
public int OldIndex => this._oldIndex;
|
||||
|
||||
public int NewIndex => this._newIndex;
|
||||
|
||||
public int Count => this._count;
|
||||
|
||||
public override string ToString() => string.Format("{0} type: {1}, old: {2}, new: {3}, count: {4}", (object)base.ToString(), (object)this.Type, (object)this.OldIndex, (object)this.NewIndex, (object)this.Count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.UIListContentsChangedHandler
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal delegate void UIListContentsChangedHandler(
|
||||
IList senderList,
|
||||
UIListContentsChangedArgs args);
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Data.UpdateHelper
|
||||
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
|
||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||
|
||||
using Microsoft.Iris.Session;
|
||||
using Microsoft.Iris.ViewItems;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.Data
|
||||
{
|
||||
internal class UpdateHelper
|
||||
{
|
||||
private const int c_millisecondsBetweenUpdates = 100;
|
||||
private const int c_millisecondsAllowedPerUpdate = 10;
|
||||
private UpdateHelper.ItemDistanceComparer _itemDistanceComparer;
|
||||
private IVirtualList _virtualList;
|
||||
private List<int> _itemsToUpdate;
|
||||
private int _lastInterestIndex;
|
||||
private DispatcherTimer _timer;
|
||||
private bool _listIsDirty;
|
||||
private List<int> _outstandingUpdates;
|
||||
private int _throttle;
|
||||
|
||||
public UpdateHelper(IVirtualList virtualList)
|
||||
{
|
||||
this._virtualList = virtualList;
|
||||
this._itemsToUpdate = new List<int>();
|
||||
this._throttle = Environment.ProcessorCount * 2;
|
||||
this._outstandingUpdates = new List<int>();
|
||||
}
|
||||
|
||||
public void AddIndex(int index)
|
||||
{
|
||||
this._itemsToUpdate.Add(index);
|
||||
this._listIsDirty = true;
|
||||
this.TriggerNextUpdate();
|
||||
}
|
||||
|
||||
public void AdjustIndices(int lowThreshold, int amount) => this.AdjustIndices(lowThreshold, int.MaxValue, amount);
|
||||
|
||||
public void AdjustIndices(int lowThreshold, int highThreshold, int amt)
|
||||
{
|
||||
for (int index = 0; index < this._itemsToUpdate.Count; ++index)
|
||||
{
|
||||
int num = this._itemsToUpdate[index];
|
||||
if (num >= lowThreshold && num <= highThreshold)
|
||||
this._itemsToUpdate[index] = num + amt;
|
||||
}
|
||||
if (this._lastInterestIndex < lowThreshold || this._lastInterestIndex > highThreshold)
|
||||
return;
|
||||
this._lastInterestIndex += amt;
|
||||
}
|
||||
|
||||
public void Clear() => this._itemsToUpdate.Clear();
|
||||
|
||||
public void RemoveIndex(int index)
|
||||
{
|
||||
int count = this._itemsToUpdate.Count;
|
||||
int index1 = 0;
|
||||
while (index1 < count && this._itemsToUpdate[index1] != index)
|
||||
++index1;
|
||||
if (index1 >= count)
|
||||
return;
|
||||
int index2 = index1;
|
||||
for (int index3 = index1 + 1; index3 < count; ++index3)
|
||||
{
|
||||
int num = this._itemsToUpdate[index3];
|
||||
if (num != index)
|
||||
{
|
||||
this._itemsToUpdate[index2] = num;
|
||||
++index2;
|
||||
}
|
||||
}
|
||||
this._itemsToUpdate.RemoveRange(index2, count - index2);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (this._timer == null)
|
||||
return;
|
||||
this._timer.Enabled = false;
|
||||
}
|
||||
|
||||
private void TriggerNextUpdate()
|
||||
{
|
||||
this.EnsureTimer();
|
||||
this._timer.Enabled = true;
|
||||
}
|
||||
|
||||
private void DeliverNextUpdate(object senderObject, EventArgs unusedArgs)
|
||||
{
|
||||
if (this._itemsToUpdate.Count == 0)
|
||||
return;
|
||||
if (this._outstandingUpdates.Count == this._throttle)
|
||||
{
|
||||
this.TriggerNextUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
Repeater repeaterHost = this._virtualList.RepeaterHost;
|
||||
if (repeaterHost == null)
|
||||
return;
|
||||
int index1 = -1;
|
||||
repeaterHost.GetFocusedIndex(ref index1);
|
||||
if (repeaterHost.GetExtendedLayoutOutput(VisibleIndexRangeLayoutOutput.DataCookie) is VisibleIndexRangeLayoutOutput extendedLayoutOutput)
|
||||
{
|
||||
if (index1 != -1 && (index1 < extendedLayoutOutput.BeginVisible || index1 > extendedLayoutOutput.EndVisible))
|
||||
index1 = -1;
|
||||
if (index1 == -1)
|
||||
index1 = extendedLayoutOutput.BeginVisible;
|
||||
}
|
||||
if (index1 != -1)
|
||||
{
|
||||
int dataIndex;
|
||||
ListUtility.GetWrappedIndex(index1, this._virtualList.Count, out dataIndex, out int _);
|
||||
if (this._lastInterestIndex != dataIndex)
|
||||
this._listIsDirty = true;
|
||||
this._lastInterestIndex = dataIndex;
|
||||
}
|
||||
if (this._listIsDirty)
|
||||
{
|
||||
if (this._itemDistanceComparer == null)
|
||||
this._itemDistanceComparer = new UpdateHelper.ItemDistanceComparer();
|
||||
this._itemDistanceComparer.Initialize(this._lastInterestIndex, this._virtualList.Count);
|
||||
this._itemsToUpdate.Sort((IComparer<int>)this._itemDistanceComparer);
|
||||
this._listIsDirty = false;
|
||||
}
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
int count = 0;
|
||||
do
|
||||
{
|
||||
++count;
|
||||
int index2 = this._itemsToUpdate[this._itemsToUpdate.Count - count];
|
||||
this._outstandingUpdates.Add(index2);
|
||||
this._virtualList.NotifyRequestSlowData(index2);
|
||||
}
|
||||
while (stopwatch.ElapsedMilliseconds < 10L && this._itemsToUpdate.Count != count && this._outstandingUpdates.Count < this._throttle);
|
||||
this._itemsToUpdate.RemoveRange(this._itemsToUpdate.Count - count, count);
|
||||
if (this._itemsToUpdate.Count == 0)
|
||||
return;
|
||||
this.TriggerNextUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public int Throttle
|
||||
{
|
||||
get => this._throttle;
|
||||
set => this._throttle = value;
|
||||
}
|
||||
|
||||
public bool NotifySlowDataAcquireComplete(int index) => this._outstandingUpdates.Remove(index);
|
||||
|
||||
private void EnsureTimer()
|
||||
{
|
||||
if (this._timer != null)
|
||||
return;
|
||||
this._timer = new DispatcherTimer();
|
||||
this._timer.AutoRepeat = false;
|
||||
this._timer.Interval = 100;
|
||||
this._timer.Tick += new EventHandler(this.DeliverNextUpdate);
|
||||
}
|
||||
|
||||
private class ItemDistanceComparer : IComparer<int>
|
||||
{
|
||||
private int _focusedIndex;
|
||||
private int _totalCount;
|
||||
private int _midPoint;
|
||||
|
||||
public void Initialize(int focusedIndex, int totalCount)
|
||||
{
|
||||
this._focusedIndex = focusedIndex;
|
||||
this._totalCount = totalCount;
|
||||
this._midPoint = totalCount / 2;
|
||||
}
|
||||
|
||||
public int Compare(int left, int right) => this.GetDistance(right) - this.GetDistance(left);
|
||||
|
||||
private int GetDistance(int potential)
|
||||
{
|
||||
int num = Math.Abs(potential - this._focusedIndex);
|
||||
if (num > this._midPoint)
|
||||
num = this._totalCount - num + 1;
|
||||
return num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user