mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Add IStringEncodable
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace Microsoft.Iris;
|
||||
|
||||
public interface IStringEncodable
|
||||
{
|
||||
string EncodeString();
|
||||
}
|
||||
@@ -4,9 +4,11 @@
|
||||
// MVID: D47658B8-A8EA-43D6-8837-ECE823BFFFC1
|
||||
// Assembly location: C:\Program Files\Zune\UIX.RenderApi.dll
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Iris.Render
|
||||
{
|
||||
public struct Inset
|
||||
public struct Inset : IStringEncodable
|
||||
{
|
||||
private int _left;
|
||||
private int _top;
|
||||
@@ -74,6 +76,14 @@ namespace Microsoft.Iris.Render
|
||||
|
||||
public override string ToString() => base.ToString();
|
||||
|
||||
public string EncodeString()
|
||||
{
|
||||
var values = new int[] { Left, Top, Right, Bottom };
|
||||
if (new HashSet<int>(values).Count == 1)
|
||||
return Top.ToString();
|
||||
return string.Join(", ", values);
|
||||
}
|
||||
|
||||
internal Point TopLeft
|
||||
{
|
||||
get => new Point(this.Left, this.Top);
|
||||
|
||||
@@ -8,7 +8,7 @@ using System;
|
||||
|
||||
namespace Microsoft.Iris.Render
|
||||
{
|
||||
public struct Size
|
||||
public struct Size : IStringEncodable
|
||||
{
|
||||
private int m_width;
|
||||
private int m_height;
|
||||
@@ -106,5 +106,7 @@ namespace Microsoft.Iris.Render
|
||||
size1.Scale(flScale);
|
||||
return size1;
|
||||
}
|
||||
|
||||
public string EncodeString() => $"{Width}, {Height}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Text;
|
||||
namespace Microsoft.Iris.Drawing
|
||||
{
|
||||
[Serializable]
|
||||
public struct Color : ISerializable
|
||||
public struct Color : ISerializable, IStringEncodable
|
||||
{
|
||||
private const int ARGBAlphaShift = 24;
|
||||
private const int ARGBRedShift = 16;
|
||||
@@ -230,6 +230,8 @@ namespace Microsoft.Iris.Drawing
|
||||
info.AddValue(nameof(Value), Value);
|
||||
}
|
||||
|
||||
public string EncodeString() => string.Join(", ", A, R, G, B);
|
||||
|
||||
internal static Color Transparent => new(0U);
|
||||
|
||||
internal static Color Black => new(0xFF00_0000U);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Microsoft.Iris.Drawing
|
||||
{
|
||||
internal sealed class Font
|
||||
internal sealed class Font : IStringEncodable
|
||||
{
|
||||
private string _fontName;
|
||||
private float _fontHeight;
|
||||
@@ -70,6 +70,22 @@ namespace Microsoft.Iris.Drawing
|
||||
set => _fontName = value;
|
||||
}
|
||||
|
||||
public string EncodeString()
|
||||
{
|
||||
System.Collections.Generic.List<object> props = new(4)
|
||||
{
|
||||
FontName,
|
||||
_fontHeight
|
||||
};
|
||||
|
||||
if (_altFontHeight != default)
|
||||
props.Add(_altFontHeight);
|
||||
if (_fontStyle != default)
|
||||
props.Add(_fontStyle);
|
||||
|
||||
return string.Join(", ", props);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) => obj is Font font && _fontName == font._fontName && (_fontHeight == (double)font._fontHeight && _altFontHeight == (double)font._altFontHeight) && _fontStyle == font._fontStyle;
|
||||
|
||||
public override int GetHashCode() => _fontName.GetHashCode() ^ _fontHeight.GetHashCode() ^ _altFontHeight.GetHashCode() ^ _fontStyle.GetHashCode();
|
||||
|
||||
@@ -11,7 +11,7 @@ using System;
|
||||
|
||||
namespace Microsoft.Iris.Layouts
|
||||
{
|
||||
internal struct MajorMinor
|
||||
internal struct MajorMinor : IStringEncodable
|
||||
{
|
||||
private int major;
|
||||
private int minor;
|
||||
@@ -101,5 +101,7 @@ namespace Microsoft.Iris.Layouts
|
||||
public bool IsEmpty => Major == 0 || Minor == 0;
|
||||
|
||||
public override string ToString() => InvariantString.Format("(Major={0}, Minor={1})", Major, Minor);
|
||||
|
||||
public string EncodeString() => $"{Major}, {Minor}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Microsoft.Iris.Markup
|
||||
{
|
||||
internal static class UIXTypeID
|
||||
public static class UIXTypeID
|
||||
{
|
||||
public const short None = -1;
|
||||
public const short Accessible = 0;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Microsoft.Iris.Markup
|
||||
{
|
||||
internal static class UIXTypes
|
||||
public static class UIXTypes
|
||||
{
|
||||
public static TypeSchema MapIDToType(short ID) => ID != -1 ? UIXLoadResultExports.ExportTable[ID] : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user