Override ToString on more UIX classes

This commit is contained in:
Yoshi Askharoun
2023-05-26 00:00:51 -05:00
parent ea08399992
commit 2a8f203df5
15 changed files with 41 additions and 34 deletions
+2
View File
@@ -59,5 +59,7 @@ namespace Microsoft.Iris.Audio
sound.Play();
sound.UnregisterUsage(this);
}
public override string ToString() => $"{{Sound {SystemSoundEvent} '{Source}'}}";
}
}
+1 -14
View File
@@ -4,8 +4,6 @@
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System.Text;
namespace Microsoft.Iris.Drawing
{
internal sealed class Font
@@ -76,17 +74,6 @@ namespace Microsoft.Iris.Drawing
public override int GetHashCode() => _fontName.GetHashCode() ^ _fontHeight.GetHashCode() ^ _altFontHeight.GetHashCode() ^ _fontStyle.GetHashCode();
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{Font \"");
stringBuilder.Append(_fontName);
stringBuilder.Append("\" ");
stringBuilder.Append(_fontHeight);
stringBuilder.Append("pt ");
stringBuilder.Append(_fontStyle);
stringBuilder.Append("}");
return stringBuilder.ToString();
}
public override string ToString() => $"{{Font \"{_fontName}\" {_fontHeight}pt {_fontStyle}}}";
}
}
+2
View File
@@ -190,5 +190,7 @@ namespace Microsoft.Iris.Drawing
}
public event ContentLoadCompleteHandler LoadComplete;
public override string ToString() => $"{{UIImage {RenderImage?.ToString() ?? "null"}}}";
}
}
+2
View File
@@ -119,5 +119,7 @@ namespace Microsoft.Iris.Drawing
{
ScavengeImageCache.Instance.RemoveData(new ImageCacheKey(source, maximumSize, flippable, antialiasEdges));
}
public override string ToString() => $"{{UriImage '{Source}' {RenderImage?.ToString() ?? "null"}}}";
}
}
+4 -2
View File
@@ -10,8 +10,8 @@ namespace Microsoft.Iris.Markup
{
public abstract class EventSchema : DisposableObject
{
private TypeSchema _owner;
public static EventSchema[] EmptyList = new EventSchema[0];
private readonly TypeSchema _owner;
public readonly static EventSchema[] EmptyList = System.Array.Empty<EventSchema>();
public EventSchema(TypeSchema owner)
{
@@ -22,5 +22,7 @@ namespace Microsoft.Iris.Markup
public TypeSchema Owner => _owner;
public abstract string Name { get; }
public override string ToString() => $"{_owner.Name}.{Name}";
}
}
+4 -2
View File
@@ -10,8 +10,8 @@ namespace Microsoft.Iris.Markup
{
public abstract class PropertySchema : DisposableObject
{
public static PropertySchema[] EmptyList = new PropertySchema[0];
private TypeSchema _owner;
public readonly static PropertySchema[] EmptyList = System.Array.Empty<PropertySchema>();
private readonly TypeSchema _owner;
public PropertySchema(TypeSchema owner)
{
@@ -44,5 +44,7 @@ namespace Microsoft.Iris.Markup
public abstract object GetValue(object instance);
public abstract void SetValue(ref object instance, object value);
public override string ToString() => $"{Owner.Name}.{Name}";
}
}
+3 -1
View File
@@ -11,6 +11,8 @@ namespace Microsoft.Iris.Markup
public string Name;
public TypeSchema Type;
public SymbolOrigin SymbolOrigin;
public static SymbolRecord[] EmptyList = new SymbolRecord[0];
public readonly static SymbolRecord[] EmptyList = System.Array.Empty<SymbolRecord>();
public override string ToString() => $"{Type} {Name}";
}
}
@@ -20,5 +20,7 @@ namespace Microsoft.Iris.Markup
public string Symbol => _symbol;
public SymbolOrigin Origin => _origin;
public override string ToString() => Symbol;
}
}
+7 -5
View File
@@ -12,12 +12,12 @@ namespace Microsoft.Iris.Markup
{
public abstract class TypeSchema : DisposableObject
{
private LoadResult _owner;
private ulong _id;
private readonly LoadResult _owner;
private readonly ulong _id;
private Vector<TypeSchema> _equivalents;
private static ulong s_uniqueId;
private static Map<ulong, TypeSchema> s_idToTypeSchema = new Map<ulong, TypeSchema>();
public static TypeSchema[] EmptyList = new TypeSchema[0];
private readonly static Map<ulong, TypeSchema> s_idToTypeSchema = new();
public readonly static TypeSchema[] EmptyList = Array.Empty<TypeSchema>();
public TypeSchema(LoadResult owner)
{
@@ -232,7 +232,7 @@ namespace Microsoft.Iris.Markup
public void ShareEquivalents(Vector<TypeSchema> equivalents) => _equivalents = equivalents;
public virtual string ErrorContextDescription => string.Format("{0} (Owner='{1}')", Name, Owner.Uri ?? "Unavailable");
public virtual string ErrorContextDescription => $"{Name} (Owner='{Owner.Uri ?? "Unavailable"}')";
public static string NameFromInstance(object instance) => !(instance is ISchemaInfo schemaInfo) ? instance.GetType().Name : schemaInfo.TypeSchema.Name;
@@ -244,5 +244,7 @@ namespace Microsoft.Iris.Markup
s_idToTypeSchema.TryGetValue(id, out typeSchema);
return typeSchema;
}
public override string ToString() => $"typeof({Name})";
}
}
+7 -7
View File
@@ -11,10 +11,10 @@ namespace Microsoft.Iris.Markup
{
internal class UIXTypeSchema : TypeSchema
{
private short _typeID;
private short _baseTypeID;
private string _name;
private string _alternateName;
private readonly short _typeID;
private readonly short _baseTypeID;
private readonly string _name;
private readonly string _alternateName;
private TypeSchema _baseType;
private DefaultConstructHandler _defaultConstructor;
private ConstructorSchema[] _constructors;
@@ -28,9 +28,9 @@ namespace Microsoft.Iris.Markup
private PerformOperationHandler _performOperation;
private SupportsOperationHandler _supportsOperation;
private FindCanonicalInstanceHandler _findCanonicalInstance;
private Type _instanceType;
private UIXTypeFlags _flags;
private static object[] EmptyParameterList = new object[0];
private readonly Type _instanceType;
private readonly UIXTypeFlags _flags;
private static readonly object[] EmptyParameterList = Array.Empty<object>();
public UIXTypeSchema(
short typeID,
@@ -107,5 +107,7 @@ namespace Microsoft.Iris.ModelItems
return;
ContentsChanged(this, new UIListContentsChangedArgs(type, oldIndex, newIndex));
}
public override string ToString() => $"{{NotifyList Source=[{string.Join(", ", _source)}]}}";
}
}
+1 -1
View File
@@ -74,6 +74,6 @@ namespace Microsoft.Iris.ModelItems
return intList;
}
public override string ToString() => string.Format("{{{0} to {1}}}", _begin, _end);
public override string ToString() => $"{{{_begin} to {_end}}}";
}
}
+1 -1
View File
@@ -1378,7 +1378,7 @@ namespace Microsoft.Iris.UI
internal void SetEventContext(EventContext eventContext) => _eventContext = eventContext;
public override string ToString() => _typeSchema.ToString();
public override string ToString() => $"UI[{_typeSchema.Name}]";
private class SavedFocusState
{