mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Added UIX library
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.CastMethod
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum CastMethod
|
||||
{
|
||||
Cast,
|
||||
Conversion,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ConstantType
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum ConstantType
|
||||
{
|
||||
String,
|
||||
StringLiteral,
|
||||
Uri,
|
||||
Integer,
|
||||
LongInteger,
|
||||
Float,
|
||||
Boolean,
|
||||
Null,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ExpressionType
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum ExpressionType
|
||||
{
|
||||
Assignment,
|
||||
Symbol,
|
||||
Call,
|
||||
Cast,
|
||||
New,
|
||||
Operation,
|
||||
IsCheck,
|
||||
As,
|
||||
Constant,
|
||||
DeclareTrigger,
|
||||
TypeOf,
|
||||
List,
|
||||
Index,
|
||||
Ternary,
|
||||
NullCoalescing,
|
||||
This,
|
||||
BaseClass,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ExpressionUsage
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum ExpressionUsage
|
||||
{
|
||||
LValue,
|
||||
RValue,
|
||||
DeclareTrigger,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.MethodSpecifier
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum MethodSpecifier
|
||||
{
|
||||
Virtual,
|
||||
Override,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.NameUsage
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum NameUsage
|
||||
{
|
||||
Unknown,
|
||||
Default,
|
||||
Symbols,
|
||||
DictionaryKeys,
|
||||
NamedContent,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.PropertyAttribute
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal class PropertyAttribute
|
||||
{
|
||||
public string Name;
|
||||
public string Value;
|
||||
public PropertyAttribute Next;
|
||||
|
||||
public PropertyAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public PropertyAttribute(string name, string value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.StatementType
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum StatementType
|
||||
{
|
||||
Assignment,
|
||||
Attribute,
|
||||
Expression,
|
||||
ForEach,
|
||||
While,
|
||||
If,
|
||||
IfElse,
|
||||
Return,
|
||||
ScopedLocal,
|
||||
Compound,
|
||||
Break,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.SymbolResolutionDirective
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal enum SymbolResolutionDirective
|
||||
{
|
||||
None,
|
||||
PropertyResolution,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.TriggerRecord
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal class TriggerRecord
|
||||
{
|
||||
public ValidateExpression SourceExpression;
|
||||
public ValidateCode ActionCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.TypeRestriction
|
||||
// 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.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal struct TypeRestriction
|
||||
{
|
||||
private TypeSchema _primary;
|
||||
private TypeSchema _secondary;
|
||||
private bool _allow;
|
||||
public static TypeRestriction None;
|
||||
public static TypeRestriction NotVoid;
|
||||
|
||||
public TypeRestriction(TypeSchema primary)
|
||||
: this(primary, null)
|
||||
{
|
||||
}
|
||||
|
||||
public TypeRestriction(TypeSchema primary, TypeSchema secondary)
|
||||
: this(primary, secondary, true)
|
||||
{
|
||||
}
|
||||
|
||||
private TypeRestriction(TypeSchema primary, TypeSchema secondary, bool allow)
|
||||
{
|
||||
_primary = primary;
|
||||
_secondary = secondary;
|
||||
_allow = allow;
|
||||
}
|
||||
|
||||
public static void InitializeStatics()
|
||||
{
|
||||
None = new TypeRestriction(null, null, true);
|
||||
NotVoid = new TypeRestriction(VoidSchema.Type, null, false);
|
||||
}
|
||||
|
||||
public TypeSchema Primary => _primary;
|
||||
|
||||
public TypeSchema Secondary => _secondary;
|
||||
|
||||
public bool Check(ValidateObject subject, TypeSchema checkType) => Check(subject, "'{0}' cannot be used in this context (expecting types compatible with '{1}')", checkType);
|
||||
|
||||
public bool Check(ValidateObject subject, string errorMessage, TypeSchema checkType)
|
||||
{
|
||||
bool flag = false;
|
||||
if (_primary == null && _secondary == null || _primary.IsAssignableFrom(checkType) || _secondary != null && _secondary.IsAssignableFrom(checkType))
|
||||
flag = true;
|
||||
if (flag == _allow)
|
||||
return true;
|
||||
string str1 = checkType.Name;
|
||||
string str2 = _primary.Name;
|
||||
if (str1 == str2)
|
||||
{
|
||||
str1 = str1 + " (" + checkType.Owner + ")";
|
||||
str2 = str2 + " (" + _primary.Owner + ")";
|
||||
}
|
||||
subject.ReportError(errorMessage, str1, str2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.Validate
|
||||
// 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.Library;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class Validate : DisposableObject
|
||||
{
|
||||
private SourceMarkupLoader _owner;
|
||||
private int _line;
|
||||
private int _column;
|
||||
private ValidateMetadata _metadata;
|
||||
private bool _hasErrors;
|
||||
|
||||
public Validate(SourceMarkupLoader owner, int line, int column)
|
||||
{
|
||||
_owner = owner;
|
||||
_line = line;
|
||||
_column = column;
|
||||
_owner.TrackValidateObject(this);
|
||||
}
|
||||
|
||||
protected Validate()
|
||||
{
|
||||
}
|
||||
|
||||
public SourceMarkupLoader Owner => _owner;
|
||||
|
||||
public int Line => _line;
|
||||
|
||||
public int Column => _column;
|
||||
|
||||
public ValidateMetadata Metadata
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_metadata == null)
|
||||
_metadata = new ValidateMetadata();
|
||||
return _metadata;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasErrors => _hasErrors;
|
||||
|
||||
public void MarkHasErrors()
|
||||
{
|
||||
_owner.MarkHasErrors();
|
||||
_hasErrors = true;
|
||||
}
|
||||
|
||||
public void ReportError(
|
||||
string error,
|
||||
string param0,
|
||||
string param1,
|
||||
string param2,
|
||||
string param3)
|
||||
{
|
||||
ReportError(string.Format(error, param0, param1, param2, param3));
|
||||
}
|
||||
|
||||
public void ReportError(string error, string param0, string param1, string param2) => ReportError(string.Format(error, param0, param1, param2));
|
||||
|
||||
public void ReportError(string error, string param0, string param1) => ReportError(string.Format(error, param0, param1));
|
||||
|
||||
public void ReportError(string error, string param0) => ReportError(string.Format(error, param0));
|
||||
|
||||
public void ReportError(string error)
|
||||
{
|
||||
MarkHasErrors();
|
||||
_owner.ReportError(error, _line, _column);
|
||||
}
|
||||
|
||||
public void ReportErrorWithAdjustedPosition(string error, int lineOffset, int columnOffset)
|
||||
{
|
||||
MarkHasErrors();
|
||||
_owner.ReportError(error, _line + lineOffset, _column + columnOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateAlias
|
||||
// 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.Markup.Validation
|
||||
{
|
||||
internal class ValidateAlias : ValidateObjectTag
|
||||
{
|
||||
private string _aliasName;
|
||||
private ValidateTypeIdentifier _typeIdentifier;
|
||||
private LoadPass _currentValidationPass;
|
||||
|
||||
public ValidateAlias(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
public void Validate(LoadPass currentPass)
|
||||
{
|
||||
if (_currentValidationPass >= currentPass)
|
||||
return;
|
||||
_currentValidationPass = currentPass;
|
||||
if (_currentValidationPass == LoadPass.DeclareTypes)
|
||||
{
|
||||
ValidateContext context = new ValidateContext(null, null, _currentValidationPass);
|
||||
Validate(TypeRestriction.None, context);
|
||||
_aliasName = GetInlinePropertyValueNoValidate("Name");
|
||||
string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Type");
|
||||
if (propertyValueNoValidate != null)
|
||||
{
|
||||
_typeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column);
|
||||
Owner.NotifyTypeIdentifierFound(_typeIdentifier.Prefix, _typeIdentifier.TypeName);
|
||||
string typeName = _typeIdentifier.TypeName;
|
||||
if (_aliasName == null)
|
||||
_aliasName = typeName;
|
||||
LoadResult dependency = Owner.FindDependency(_typeIdentifier.Prefix);
|
||||
if (dependency == null)
|
||||
ReportError("Xmlns prefix '{0}' was not found", _typeIdentifier.Prefix);
|
||||
else if (!ValidateContext.IsValidSymbolName(_aliasName))
|
||||
{
|
||||
ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", _aliasName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Owner.IsTypeNameTaken(_aliasName))
|
||||
ReportError("Type '{0}' was specified more than once", _aliasName);
|
||||
Owner.RegisterAlias(_aliasName, dependency, typeName);
|
||||
}
|
||||
}
|
||||
else
|
||||
ReportError("Alias Type property must be provided");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_currentValidationPass != LoadPass.Full || Owner.LoadResultTarget.FindType(_aliasName) != null)
|
||||
return;
|
||||
ReportError("Target type for alias '{0}' could not be found", _aliasName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateClass
|
||||
// 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.Markup.UIX;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateClass : ValidateObjectTag
|
||||
{
|
||||
private ValidateScripts _scripts;
|
||||
private ValidateTypeIdentifier _baseTypeIdentifier;
|
||||
private ValidateProperty _foundPropertiesValidateProperty;
|
||||
private ValidateProperty _foundScriptsProperty;
|
||||
private ValidateMethodList _foundMethods;
|
||||
private Vector<MarkupMethodSchema> _foundVirtualMethods;
|
||||
private Vector<MarkupMethodSchema> _foundVirtualBaseMethods;
|
||||
protected MarkupTypeSchema _typeExport;
|
||||
private int _typeExportIndex;
|
||||
private MarkupTypeSchema _foundBaseType;
|
||||
private int _foundBaseTypeIndex = -1;
|
||||
private Vector<TriggerRecord> _triggerList;
|
||||
private Vector<ValidateCode> _actionList;
|
||||
private LoadPass _currentValidationPass;
|
||||
private string _previewName;
|
||||
private static Map<string, TypeSchema> s_classReservedSymbols = new Map<string, TypeSchema>(1);
|
||||
|
||||
public static void InitializeStatics() => s_classReservedSymbols["Class"] = ClassStateSchema.Type;
|
||||
|
||||
public ValidateClass(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
public void NotifyFoundMethodList(ValidateMethodList methodList)
|
||||
{
|
||||
if (_foundMethods != null)
|
||||
ReportError("Methods may only be specified once");
|
||||
else
|
||||
_foundMethods = methodList;
|
||||
}
|
||||
|
||||
public override void NotifyParseComplete()
|
||||
{
|
||||
_previewName = GetInlinePropertyValueNoValidate("Name");
|
||||
string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Base");
|
||||
if (propertyValueNoValidate != null && propertyValueNoValidate.IndexOf(':') != -1)
|
||||
_baseTypeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column);
|
||||
Owner.NotifyClassParseComplete(_previewName);
|
||||
}
|
||||
|
||||
public void Validate(LoadPass currentPass)
|
||||
{
|
||||
if (_currentValidationPass >= currentPass)
|
||||
return;
|
||||
_currentValidationPass = currentPass;
|
||||
if (_foundBaseType != null && ((MarkupLoadResult)_foundBaseType.Owner).IsSource)
|
||||
((SourceMarkupLoadResult)_foundBaseType.Owner).ValidateType(_foundBaseType, _currentValidationPass);
|
||||
ValidateContext context = new ValidateContext(this, _foundBaseType, _currentValidationPass);
|
||||
Validate(TypeRestriction.None, context);
|
||||
int num = HasErrors ? 1 : 0;
|
||||
if (_currentValidationPass == LoadPass.DeclareTypes)
|
||||
DeclareTypes(context);
|
||||
else if (_currentValidationPass == LoadPass.PopulatePublicModel)
|
||||
{
|
||||
PopulatePublicModel(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
FullValidation(context);
|
||||
TransferToTypeExport(context);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeclareTypes(ValidateContext context)
|
||||
{
|
||||
RearrangePropertiesForSymbols();
|
||||
_foundScriptsProperty = FindProperty("Scripts", true);
|
||||
if (PreviewName == null)
|
||||
ReportError("'Name' property is required and must be provided");
|
||||
else if (!ValidateContext.IsValidSymbolName(PreviewName))
|
||||
{
|
||||
ReportError("Invalid name \"{0}\". Valid names must begin with either an alphabetic character or an underscore and can otherwise contain only alphabetic, numeric, or underscore characters", PreviewName);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Owner.IsTypeNameTaken(PreviewName))
|
||||
ReportError("Type '{0}' was specified more than once", PreviewName);
|
||||
_typeExport = MarkupTypeSchema.Build(ObjectType, Owner.LoadResultTarget, PreviewName);
|
||||
_typeExportIndex = Owner.RegisterExportedType(_typeExport);
|
||||
_typeExport.LoadData = this;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void PopulatePublicModel(ValidateContext context)
|
||||
{
|
||||
if (_baseTypeIdentifier != null)
|
||||
{
|
||||
_baseTypeIdentifier.Validate();
|
||||
if (_baseTypeIdentifier.HasErrors)
|
||||
MarkHasErrors();
|
||||
else if (!(_baseTypeIdentifier.FoundType is MarkupTypeSchema foundType))
|
||||
{
|
||||
_baseTypeIdentifier.ReportError("Base type must be a markup-defined type");
|
||||
MarkHasErrors();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this is ValidateUI)
|
||||
{
|
||||
if (!(foundType is UIClassTypeSchema))
|
||||
{
|
||||
_baseTypeIdentifier.ReportError("Base type must be a markup-defined UI type");
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
else if (!(foundType is ClassTypeSchema))
|
||||
{
|
||||
_baseTypeIdentifier.ReportError("Base type must be a markup-defined Class type");
|
||||
MarkHasErrors();
|
||||
}
|
||||
if (!HasErrors)
|
||||
{
|
||||
bool flag = false;
|
||||
for (TypeSchema typeSchema = foundType; typeSchema is MarkupTypeSchema; typeSchema = typeSchema.Base)
|
||||
{
|
||||
if (typeSchema == _typeExport)
|
||||
{
|
||||
_baseTypeIdentifier.ReportError("Circular base class dependency involving '{0}' and '{1}'", _typeExport.Name, foundType.Name);
|
||||
MarkHasErrors();
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
_foundBaseType = foundType;
|
||||
_foundBaseTypeIndex = _baseTypeIdentifier.FoundTypeIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ValidateProperty property1 = FindProperty("Base", true);
|
||||
if (property1 != null)
|
||||
{
|
||||
if (property1.IsFromStringValue)
|
||||
{
|
||||
if (_baseTypeIdentifier == null)
|
||||
{
|
||||
property1.ReportError("Base must be a type identifier (prefix:Type)");
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
property1.ReportError("Property '{0}' does not support expanded value syntax", property1.PropertyName);
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
if (_typeExport != null)
|
||||
_typeExport.SetBaseType(_foundBaseType);
|
||||
bool flag1 = false;
|
||||
ValidateProperty property2 = FindProperty("Shared", true);
|
||||
if (property2 != null)
|
||||
{
|
||||
property2.Validate(this, context);
|
||||
if (property2.HasErrors)
|
||||
MarkHasErrors();
|
||||
else if (property2.IsFromStringValue)
|
||||
{
|
||||
flag1 = (bool)((ValidateFromString)property2.Value).FromStringInstance;
|
||||
if (flag1 && this is ValidateUI)
|
||||
{
|
||||
flag1 = false;
|
||||
ReportError("UI cannot be marked as shared");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
property2.ReportError("Property '{0}' does not support expanded value syntax", property2.PropertyName);
|
||||
MarkHasErrors();
|
||||
}
|
||||
if (flag1 && _typeExport != null)
|
||||
((ClassTypeSchema)_typeExport).MarkShareable();
|
||||
}
|
||||
ValidateProperty property3 = FindProperty("Properties");
|
||||
if (property3 != null)
|
||||
{
|
||||
if (property3.Value == null || property3.IsObjectTagValue)
|
||||
{
|
||||
_foundPropertiesValidateProperty = property3;
|
||||
int length1 = 0;
|
||||
for (ValidateObjectTag next = (ValidateObjectTag)property3.Value; next != null; next = next.Next)
|
||||
++length1;
|
||||
PropertySchema[] properties = new PropertySchema[length1];
|
||||
int length2 = 0;
|
||||
for (ValidateObjectTag next = (ValidateObjectTag)property3.Value; next != null; next = next.Next)
|
||||
{
|
||||
next.Validate(TypeRestriction.None, context);
|
||||
if (next.ObjectType != null)
|
||||
{
|
||||
string propertyValueNoValidate = next.GetInlinePropertyValueNoValidate("Name");
|
||||
if (propertyValueNoValidate == null)
|
||||
{
|
||||
if (!next.HasErrors)
|
||||
{
|
||||
next.ReportError("'Name' property is required and must be provided");
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
else if (_typeExport != null)
|
||||
{
|
||||
MarkupPropertySchema propertyExport = MarkupPropertySchema.Build(ObjectType, _typeExport, propertyValueNoValidate, next.ObjectType);
|
||||
properties[length2] = propertyExport;
|
||||
++length2;
|
||||
next.PropertySchemaExport = propertyExport;
|
||||
propertyExport.SetRequiredForCreation(next.PropertyIsRequiredForCreation);
|
||||
AnnotateProperty(next, context, propertyExport);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (length2 != properties.Length)
|
||||
{
|
||||
PropertySchema[] propertySchemaArray = new PropertySchema[length2];
|
||||
Array.Copy(properties, propertySchemaArray, length2);
|
||||
properties = propertySchemaArray;
|
||||
}
|
||||
if (_typeExport != null)
|
||||
_typeExport.SetPropertyList(properties);
|
||||
}
|
||||
else
|
||||
{
|
||||
property3.ReportError("Property '{0}' values must be in expanded form", property3.PropertyName);
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
if (_foundMethods == null)
|
||||
return;
|
||||
_foundMethods.Validate(this, context);
|
||||
if (_foundMethods.FoundMethods == null)
|
||||
return;
|
||||
_typeExport.SetMethodList(_foundMethods.FoundMethods);
|
||||
}
|
||||
|
||||
protected virtual void AnnotateProperty(
|
||||
ValidateObjectTag objectTag,
|
||||
ValidateContext context,
|
||||
MarkupPropertySchema propertyExport)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void FullValidation(ValidateContext context)
|
||||
{
|
||||
if (_foundPropertiesValidateProperty != null)
|
||||
_foundPropertiesValidateProperty.ShouldSkipDictionaryAddIfContains = true;
|
||||
if (_foundBaseType is ClassTypeSchema foundBaseType && foundBaseType.IsShared)
|
||||
ReportError("Base type cannot be a shared Class");
|
||||
ValidateProperty property = FindProperty("Locals");
|
||||
if (property != null)
|
||||
{
|
||||
if (property.Value == null || property.IsObjectTagValue)
|
||||
{
|
||||
for (ValidateObjectTag next = (ValidateObjectTag)property.Value; next != null; next = next.Next)
|
||||
{
|
||||
if (next.Name == null && !next.HasErrors)
|
||||
{
|
||||
next.ReportError("'Name' property is required and must be provided");
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
property.ReportError("Property '{0}' values must be in expanded form", property.PropertyName);
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
if (_foundMethods != null)
|
||||
_foundMethods.Validate(this, context);
|
||||
if (_foundScriptsProperty != null)
|
||||
{
|
||||
_scripts = new ValidateScripts(_foundScriptsProperty);
|
||||
_scripts.Validate(context);
|
||||
if (_scripts.HasErrors)
|
||||
MarkHasErrors();
|
||||
}
|
||||
if (_foundVirtualMethods == null)
|
||||
return;
|
||||
MethodSchema[] virtualMethods = new MethodSchema[_foundVirtualMethods.Count];
|
||||
for (int index = 0; index < virtualMethods.Length; ++index)
|
||||
virtualMethods[index] = _foundVirtualMethods[index];
|
||||
_typeExport.SetVirtualMethodList(virtualMethods);
|
||||
}
|
||||
|
||||
private void TransferToTypeExport(ValidateContext context)
|
||||
{
|
||||
if (_typeExport != null)
|
||||
{
|
||||
_typeExport.SetSymbolReferenceTable(context.SymbolReferenceTable);
|
||||
_typeExport.SetInheritableSymbolsTable(context.InheritableSymbolsTable);
|
||||
_typeExport.SetListenerCount(context.NotifierCount);
|
||||
}
|
||||
_triggerList = context.TriggerList;
|
||||
_actionList = context.ActionList;
|
||||
Map map = new Map();
|
||||
for (MarkupTypeSchema typeExport = TypeExport; typeExport != null; typeExport = typeExport.Base as MarkupTypeSchema)
|
||||
{
|
||||
if (typeExport.InheritableSymbolsTable != null)
|
||||
{
|
||||
foreach (SymbolRecord symbolRecord in typeExport.InheritableSymbolsTable)
|
||||
{
|
||||
if (symbolRecord.SymbolOrigin == SymbolOrigin.Locals || symbolRecord.SymbolOrigin == SymbolOrigin.Properties)
|
||||
map[symbolRecord.Name] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
_typeExport.SetTotalPropertiesAndLocalsCount(map.Count);
|
||||
}
|
||||
|
||||
public virtual void RearrangePropertiesForSymbols()
|
||||
{
|
||||
MovePropertyToFront("Locals");
|
||||
MovePropertyToFront("Properties");
|
||||
}
|
||||
|
||||
public override void Validate(TypeRestriction typeRestriction, ValidateContext context)
|
||||
{
|
||||
if (context.CurrentPass == LoadPass.Full)
|
||||
context.DeclareReservedSymbols(s_classReservedSymbols);
|
||||
base.Validate(typeRestriction, context);
|
||||
}
|
||||
|
||||
public virtual void NotifyDiscoveredObjectTag(ValidateObjectTag objectTag)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void NotifyFoundPropertyAssignment(ValidateExpressionCall call)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void NotifyFoundMethodCall(ValidateExpressionCall call)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddVirtualMethod(
|
||||
MarkupMethodSchema methodSchema,
|
||||
MarkupMethodSchema baseVirtualMethodSchema)
|
||||
{
|
||||
if (_foundVirtualMethods == null)
|
||||
{
|
||||
_foundVirtualMethods = new Vector<MarkupMethodSchema>();
|
||||
_foundVirtualBaseMethods = new Vector<MarkupMethodSchema>();
|
||||
}
|
||||
_foundVirtualMethods.Add(methodSchema);
|
||||
_foundVirtualBaseMethods.Add(baseVirtualMethodSchema);
|
||||
}
|
||||
|
||||
protected override bool ForceAbstractAsConcrete => true;
|
||||
|
||||
public ValidateScripts Scripts => _scripts;
|
||||
|
||||
internal ValidateProperty FoundScripts => _foundScriptsProperty;
|
||||
|
||||
public MarkupTypeSchema TypeExport => _typeExport;
|
||||
|
||||
public int TypeExportIndex => _typeExportIndex;
|
||||
|
||||
public Vector<TriggerRecord> TriggerList => _triggerList;
|
||||
|
||||
public Vector<ValidateCode> ActionList => _actionList;
|
||||
|
||||
public ArrayList MethodList => _foundMethods == null ? null : _foundMethods.Methods;
|
||||
|
||||
public string PreviewName => _previewName;
|
||||
|
||||
public MarkupTypeSchema FoundBaseType => _foundBaseType;
|
||||
|
||||
public int FoundBaseTypeIndex => _foundBaseTypeIndex;
|
||||
|
||||
public ValidateProperty FoundPropertiesValidateProperty => _foundPropertiesValidateProperty;
|
||||
|
||||
public override string ToString() => Name != null ? string.Format("ClassTag : {0}", Name) : "Not validated :" + _previewName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateCode
|
||||
// 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.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateCode : ValidateObject
|
||||
{
|
||||
private ValidateStatementCompound _statementCompound;
|
||||
private Vector<ValidateStatementReturn> _returnStatements = new Vector<ValidateStatementReturn>();
|
||||
private Vector<ValidateExpression> _declaredTriggerExpressions;
|
||||
private TypeSchema _returnType;
|
||||
private uint _encodeStartOffset;
|
||||
private bool _embedded;
|
||||
private bool _allowTriggers = true;
|
||||
private bool _hasDeclaredTriggerStatements;
|
||||
private bool _hasInitialEvaluateStatement;
|
||||
private bool _initialEvaluate;
|
||||
private bool _finalEvaluate;
|
||||
|
||||
public ValidateCode(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateStatementCompound statementCompound,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, line, offset, ObjectSourceType.Code)
|
||||
{
|
||||
_statementCompound = statementCompound;
|
||||
_embedded = true;
|
||||
}
|
||||
|
||||
public ValidateStatementCompound StatementCompound => _statementCompound;
|
||||
|
||||
public bool Embedded => _embedded;
|
||||
|
||||
public override TypeSchema ObjectType => _returnType;
|
||||
|
||||
public override void Validate(TypeRestriction typeRestriction, ValidateContext context)
|
||||
{
|
||||
if (_allowTriggers)
|
||||
context.StartDeclaredTriggerTracking();
|
||||
_statementCompound.Validate(this, context);
|
||||
if (_allowTriggers)
|
||||
_declaredTriggerExpressions = context.StopDeclaredTriggerTracking();
|
||||
if (_statementCompound.HasErrors)
|
||||
MarkHasErrors();
|
||||
if (_returnStatements.Count > 0)
|
||||
{
|
||||
for (int index = 0; index < _returnStatements.Count; ++index)
|
||||
{
|
||||
ValidateStatementReturn returnStatement = _returnStatements[index];
|
||||
if (returnStatement.HasErrors)
|
||||
return;
|
||||
TypeSchema type = VoidSchema.Type;
|
||||
ValidateExpression expression = returnStatement.Expression;
|
||||
if (expression != null)
|
||||
type = expression.ObjectType;
|
||||
ValidateReturnType(type);
|
||||
if (HasErrors)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
_returnType = VoidSchema.Type;
|
||||
string errorMessage = "'{0}' cannot be used in this context (expecting types compatible with '{1}')";
|
||||
if (typeRestriction.Primary == VoidSchema.Type && typeRestriction.Secondary == null)
|
||||
errorMessage = "Return values are not supported for this code block (currently returning '{0}')";
|
||||
else if (_returnStatements.Count == 0)
|
||||
errorMessage = "Code block must have at least one return statement of type '{0}'";
|
||||
if (!typeRestriction.Check(this, errorMessage, _returnType))
|
||||
return;
|
||||
ValidateStatementReturn validateStatementReturn = null;
|
||||
ValidateStatement validateStatement = _statementCompound.StatementList;
|
||||
if (validateStatement != null)
|
||||
{
|
||||
while (validateStatement.Next != null)
|
||||
validateStatement = validateStatement.Next;
|
||||
if (validateStatement.StatementType == StatementType.Return)
|
||||
{
|
||||
validateStatementReturn = (ValidateStatementReturn)validateStatement;
|
||||
validateStatementReturn.MarkAsTrailingReturn();
|
||||
}
|
||||
}
|
||||
if (_returnType == VoidSchema.Type || validateStatementReturn != null)
|
||||
return;
|
||||
ReportError("Code block must end with a return of type '{0}'", _returnType.Name);
|
||||
}
|
||||
|
||||
private void ValidateReturnType(TypeSchema type)
|
||||
{
|
||||
if (_returnType == null)
|
||||
{
|
||||
_returnType = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_returnType == type)
|
||||
return;
|
||||
if (type.IsAssignableFrom(_returnType))
|
||||
{
|
||||
_returnType = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_returnType.IsAssignableFrom(type))
|
||||
return;
|
||||
ReportError("Return type cannot be determined due to inconsistant return type statements (mismatched types are: '{0}' and '{1}')", _returnType.Name, type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkAsNotEmbedded() => _embedded = false;
|
||||
|
||||
public void DisallowTriggers() => _allowTriggers = false;
|
||||
|
||||
public uint EncodeStartOffset => _encodeStartOffset;
|
||||
|
||||
public Vector<ValidateStatementReturn> ReturnStatements => _returnStatements;
|
||||
|
||||
public Vector<ValidateExpression> DeclaredTriggerExpressions => _declaredTriggerExpressions;
|
||||
|
||||
public bool InitialEvaluate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hasInitialEvaluateStatement)
|
||||
return _initialEvaluate;
|
||||
return !_hasDeclaredTriggerStatements && !_finalEvaluate && !_embedded;
|
||||
}
|
||||
}
|
||||
|
||||
public bool FinalEvaluate => _finalEvaluate;
|
||||
|
||||
public void TrackReturnStatement(ValidateStatementReturn returnStatement) => _returnStatements.Add(returnStatement);
|
||||
|
||||
public void TrackEncodingOffset(uint startOffset) => _encodeStartOffset = startOffset;
|
||||
|
||||
public void MarkInitialEvaluate(bool initialEvaluate)
|
||||
{
|
||||
_hasInitialEvaluateStatement = true;
|
||||
_initialEvaluate = initialEvaluate;
|
||||
}
|
||||
|
||||
public void MarkFinalEvaluate(bool finalEvaluate) => _finalEvaluate = finalEvaluate;
|
||||
|
||||
public void MarkDeclaredTriggerStatements() => _hasDeclaredTriggerStatements = true;
|
||||
|
||||
public ValidateCode Next
|
||||
{
|
||||
get => (ValidateCode)base.Next;
|
||||
set => base.Next = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,166 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateDataMapping
|
||||
// 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.Data;
|
||||
using Microsoft.Iris.Library;
|
||||
using Microsoft.Iris.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateDataMapping : ValidateObjectTag
|
||||
{
|
||||
private LoadPass _currentValidationPass;
|
||||
private string _previewName;
|
||||
private ValidateTypeIdentifier _baseTypeIdentifier;
|
||||
private Vector<MarkupDataMapping> _foundDataMappingSet;
|
||||
|
||||
public ValidateDataMapping(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
public void Validate(LoadPass currentPass)
|
||||
{
|
||||
if (_currentValidationPass >= currentPass)
|
||||
return;
|
||||
_currentValidationPass = currentPass;
|
||||
ValidateContext context = new ValidateContext(null, null, _currentValidationPass);
|
||||
Validate(TypeRestriction.None, context);
|
||||
if (_currentValidationPass != LoadPass.Full)
|
||||
return;
|
||||
var markupDataTypeSchema = (MarkupDataTypeSchema)null;
|
||||
TypeSchema typeSchemaProperty = ExtractTypeSchemaProperty("TargetType", context, true);
|
||||
switch (typeSchemaProperty)
|
||||
{
|
||||
case null:
|
||||
case MarkupDataTypeSchema _:
|
||||
markupDataTypeSchema = (MarkupDataTypeSchema)typeSchemaProperty;
|
||||
string stringProperty1 = ExtractStringProperty("Provider", true);
|
||||
MarkupDataMappingEntry[] mappingEntries = null;
|
||||
ValidateProperty property = FindProperty("Mappings");
|
||||
if (property != null && property.IsObjectTagValue)
|
||||
{
|
||||
Map<string, MarkupDataMappingEntry> entries = new Map<string, MarkupDataMappingEntry>();
|
||||
for (ValidateObjectTag next = (ValidateObjectTag)property.Value; next != null; next = next.Next)
|
||||
{
|
||||
string stringProperty2 = next.ExtractStringProperty("Property", true);
|
||||
string stringProperty3 = next.ExtractStringProperty("Source", false);
|
||||
string stringProperty4 = next.ExtractStringProperty("Target", false);
|
||||
string stringProperty5 = next.ExtractStringProperty("DefaultValue", false);
|
||||
if (stringProperty2 != null && markupDataTypeSchema != null)
|
||||
{
|
||||
MarkupDataTypePropertySchema propertyDeep = (MarkupDataTypePropertySchema)markupDataTypeSchema.FindPropertyDeep(stringProperty2);
|
||||
if (propertyDeep != null)
|
||||
{
|
||||
MarkupDataMappingEntry dataMappingEntry = new MarkupDataMappingEntry();
|
||||
dataMappingEntry.Property = propertyDeep;
|
||||
dataMappingEntry.Source = stringProperty3;
|
||||
dataMappingEntry.Target = stringProperty4;
|
||||
dataMappingEntry.DefaultValue = ConvertDefaultValue(this, propertyDeep.PropertyType, stringProperty5);
|
||||
if (!entries.ContainsKey(stringProperty2))
|
||||
entries[stringProperty2] = dataMappingEntry;
|
||||
else
|
||||
ReportError("Mapping for property '{0}' was already specified", stringProperty2);
|
||||
}
|
||||
else
|
||||
ReportError("Could not find property '{0}' on type '{1}' for data mapping with provider '{2}'", stringProperty2, markupDataTypeSchema.Name, stringProperty1);
|
||||
}
|
||||
}
|
||||
mappingEntries = MarkupDataProvider.FillInDefaultMappings(markupDataTypeSchema, entries);
|
||||
foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries)
|
||||
Owner.TrackImportedProperty(dataMappingEntry.Property);
|
||||
}
|
||||
if (stringProperty1 == null || markupDataTypeSchema == null)
|
||||
break;
|
||||
AddDataMappingProviderList(ref _foundDataMappingSet, Owner.LoadResultTarget, Name, markupDataTypeSchema, stringProperty1, mappingEntries);
|
||||
break;
|
||||
default:
|
||||
ReportError("TargetType for DataMapping must be a markup-defined DataType, {0} is not valid", typeSchemaProperty.Name);
|
||||
goto case null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddDataMappingProviderList(
|
||||
ref Vector<MarkupDataMapping> foundDataMappingSet,
|
||||
MarkupLoadResult owner,
|
||||
string name,
|
||||
MarkupDataTypeSchema targetDataType,
|
||||
string provider,
|
||||
MarkupDataMappingEntry[] mappingEntries)
|
||||
{
|
||||
if (provider.IndexOf(',') == -1)
|
||||
{
|
||||
AddDataMappingOneProvider(ref foundDataMappingSet, owner, name, targetDataType, provider, mappingEntries);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string providerName in StringUtility.SplitAndTrim(',', provider))
|
||||
AddDataMappingOneProvider(ref foundDataMappingSet, owner, name, targetDataType, providerName, mappingEntries);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddDataMappingOneProvider(
|
||||
ref Vector<MarkupDataMapping> foundDataMappingSet,
|
||||
MarkupLoadResult owner,
|
||||
string name,
|
||||
MarkupDataTypeSchema targetDataType,
|
||||
string providerName,
|
||||
MarkupDataMappingEntry[] mappingEntries)
|
||||
{
|
||||
if (providerName == null)
|
||||
return;
|
||||
if (foundDataMappingSet == null)
|
||||
foundDataMappingSet = new Vector<MarkupDataMapping>();
|
||||
foundDataMappingSet.Add(new MarkupDataMapping(name)
|
||||
{
|
||||
TargetType = targetDataType,
|
||||
Provider = providerName,
|
||||
Mappings = mappingEntries
|
||||
});
|
||||
}
|
||||
|
||||
public static object ConvertDefaultValue(
|
||||
Microsoft.Iris.Markup.Validation.Validate validate,
|
||||
TypeSchema type,
|
||||
string valueString)
|
||||
{
|
||||
object instance = null;
|
||||
if (valueString != null)
|
||||
{
|
||||
if (type.SupportsTypeConversion(StringSchema.Type))
|
||||
{
|
||||
Result result = type.TypeConverter(valueString, StringSchema.Type, out instance);
|
||||
if (result.Failed)
|
||||
validate.ReportError(result.Error);
|
||||
}
|
||||
else
|
||||
validate.ReportError("String conversion is not available for '{0}'", type.Name);
|
||||
if (!type.SupportsBinaryEncoding)
|
||||
validate.ReportError("DefaultValue can only be on types that support binary encoding; '{0}' does not", type.Name);
|
||||
}
|
||||
else
|
||||
instance = MarkupDataProvider.GetDefaultValueForType(type);
|
||||
return instance;
|
||||
}
|
||||
|
||||
public override void NotifyParseComplete()
|
||||
{
|
||||
_previewName = GetInlinePropertyValueNoValidate("Name");
|
||||
string propertyValueNoValidate = GetInlinePropertyValueNoValidate("Base");
|
||||
if (propertyValueNoValidate != null && propertyValueNoValidate.IndexOf(':') != -1)
|
||||
_baseTypeIdentifier = new ValidateTypeIdentifier(Owner, propertyValueNoValidate, Line, Column);
|
||||
Owner.NotifyClassParseComplete(_previewName);
|
||||
}
|
||||
|
||||
protected override bool ForceAbstractAsConcrete => true;
|
||||
|
||||
public Vector<MarkupDataMapping> FoundDataMappingSet => _foundDataMappingSet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateDataQuery
|
||||
// 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.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateDataQuery : ValidateClass
|
||||
{
|
||||
public ValidateDataQuery(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PopulatePublicModel(ValidateContext context)
|
||||
{
|
||||
base.PopulatePublicModel(context);
|
||||
if (_typeExport == null)
|
||||
return;
|
||||
((MarkupDataQuerySchema)_typeExport).ProviderName = ExtractStringProperty("Provider", true);
|
||||
((MarkupDataQuerySchema)_typeExport).ResultType = ExtractTypeSchemaProperty("ResultType", context, true);
|
||||
}
|
||||
|
||||
protected override void AnnotateProperty(
|
||||
ValidateObjectTag objectTag,
|
||||
ValidateContext context,
|
||||
MarkupPropertySchema propertyExport)
|
||||
{
|
||||
string stringProperty = objectTag.ExtractStringProperty("DefaultValue", false);
|
||||
object obj = ValidateDataMapping.ConvertDefaultValue(this, propertyExport.PropertyType, stringProperty);
|
||||
((MarkupDataQueryPropertySchema)propertyExport).DefaultValue = obj;
|
||||
bool flag;
|
||||
if (objectTag.ExtractBooleanProperty("InvalidatesQuery", context, false, out flag))
|
||||
((MarkupDataQueryPropertySchema)propertyExport).InvalidatesQuery = flag;
|
||||
if (ListSchema.Type.IsAssignableFrom(objectTag.FoundType))
|
||||
{
|
||||
TypeSchema typeSchemaProperty = objectTag.ExtractTypeSchemaProperty("UnderlyingCollectionType", context, false);
|
||||
if (typeSchemaProperty != null)
|
||||
((MarkupDataQueryPropertySchema)propertyExport).SetUnderlyingCollectionType(typeSchemaProperty);
|
||||
}
|
||||
if (!objectTag.HasErrors)
|
||||
return;
|
||||
MarkHasErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateDataType
|
||||
// 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.Markup.UIX;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateDataType : ValidateClass
|
||||
{
|
||||
private string _provider;
|
||||
private Map<string, MarkupDataMappingEntry> _foundInlineMappings;
|
||||
private Vector<MarkupDataMapping> _foundDataMappingSet;
|
||||
|
||||
public ValidateDataType(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PopulatePublicModel(ValidateContext context)
|
||||
{
|
||||
base.PopulatePublicModel(context);
|
||||
_provider = ExtractStringProperty("Provider", false);
|
||||
}
|
||||
|
||||
protected override void AnnotateProperty(
|
||||
ValidateObjectTag objectTag,
|
||||
ValidateContext context,
|
||||
MarkupPropertySchema propertyExport)
|
||||
{
|
||||
if (ListSchema.Type.IsAssignableFrom(objectTag.FoundType))
|
||||
{
|
||||
TypeSchema typeSchemaProperty = objectTag.ExtractTypeSchemaProperty("UnderlyingCollectionType", context, false);
|
||||
if (typeSchemaProperty != null)
|
||||
((MarkupDataTypePropertySchema)propertyExport).SetUnderlyingCollectionType(typeSchemaProperty);
|
||||
}
|
||||
string stringProperty1 = objectTag.ExtractStringProperty("DefaultValue", false);
|
||||
string stringProperty2 = objectTag.ExtractStringProperty("Source", false);
|
||||
string stringProperty3 = objectTag.ExtractStringProperty("Target", false);
|
||||
if (stringProperty1 != null || stringProperty2 != null || stringProperty3 != null)
|
||||
{
|
||||
if (_foundInlineMappings == null)
|
||||
_foundInlineMappings = new Map<string, MarkupDataMappingEntry>();
|
||||
_foundInlineMappings[propertyExport.Name] = new MarkupDataMappingEntry()
|
||||
{
|
||||
DefaultValue = ValidateDataMapping.ConvertDefaultValue(this, propertyExport.PropertyType, stringProperty1),
|
||||
Source = stringProperty2,
|
||||
Target = stringProperty3,
|
||||
Property = (MarkupDataTypePropertySchema)propertyExport
|
||||
};
|
||||
}
|
||||
if (!objectTag.HasErrors)
|
||||
return;
|
||||
MarkHasErrors();
|
||||
}
|
||||
|
||||
protected override void FullValidation(ValidateContext context)
|
||||
{
|
||||
base.FullValidation(context);
|
||||
if (_foundInlineMappings != null && _provider == null)
|
||||
ReportError("Inline mappings are allowed only on provider-specific types. Must specify 'Provider' attribute on '{0}'", Name);
|
||||
if (_provider == null)
|
||||
return;
|
||||
if (_foundInlineMappings == null)
|
||||
_foundInlineMappings = new Map<string, MarkupDataMappingEntry>();
|
||||
MarkupDataTypeSchema typeExport = (MarkupDataTypeSchema)TypeExport;
|
||||
MarkupDataMappingEntry[] mappingEntries = MarkupDataProvider.FillInDefaultMappings(typeExport, _foundInlineMappings);
|
||||
ValidateDataMapping.AddDataMappingProviderList(ref _foundDataMappingSet, Owner.LoadResultTarget, null, typeExport, _provider, mappingEntries);
|
||||
foreach (MarkupDataMappingEntry dataMappingEntry in mappingEntries)
|
||||
Owner.TrackImportedProperty(dataMappingEntry.Property);
|
||||
}
|
||||
|
||||
public Vector<MarkupDataMapping> FoundDataMappingSet => _foundDataMappingSet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Microsoft.Iris.Markup.Validation.ValidateEffect
|
||||
// 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.Markup.UIX;
|
||||
using Microsoft.Iris.UI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.Iris.Markup.Validation
|
||||
{
|
||||
internal class ValidateEffect : ValidateClass
|
||||
{
|
||||
private ValidateProperty _foundTechniquesValidateProperty;
|
||||
private Dictionary<string, object> _foundDynamicElementAssignments;
|
||||
private Map<string, ValidateProperty> _foundInstancePropertyAssignments;
|
||||
private Map<string, int> _foundElementSymbolIndex;
|
||||
private static Map<string, int> s_methodNameMapping;
|
||||
|
||||
public ValidateEffect(
|
||||
SourceMarkupLoader owner,
|
||||
ValidateTypeIdentifier typeIdentifier,
|
||||
int line,
|
||||
int offset)
|
||||
: base(owner, typeIdentifier, line, offset)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RearrangePropertiesForSymbols()
|
||||
{
|
||||
MovePropertyToFront("Techniques");
|
||||
base.RearrangePropertiesForSymbols();
|
||||
}
|
||||
|
||||
protected override void FullValidation(ValidateContext context)
|
||||
{
|
||||
base.FullValidation(context);
|
||||
_foundTechniquesValidateProperty = FindProperty("Techniques");
|
||||
if (_foundTechniquesValidateProperty != null && FoundBaseType != null)
|
||||
{
|
||||
foreach (SymbolRecord symbolRecord in FoundBaseType.InheritableSymbolsTable)
|
||||
{
|
||||
if (symbolRecord.SymbolOrigin == SymbolOrigin.Techniques)
|
||||
{
|
||||
_foundTechniquesValidateProperty.ReportError("Overriding Techniques property is not allowed; base class has already defined techniques");
|
||||
MarkHasErrors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_foundDynamicElementAssignments != null)
|
||||
{
|
||||
string[] dynamicElementAssignments = new string[_foundDynamicElementAssignments.Count];
|
||||
int num = 0;
|
||||
foreach (string key in _foundDynamicElementAssignments.Keys)
|
||||
dynamicElementAssignments[num++] = key;
|
||||
((EffectClassTypeSchema)TypeExport).SetDynamicElementAssignments(dynamicElementAssignments);
|
||||
}
|
||||
string str = "DefaultImage";
|
||||
SymbolOrigin origin;
|
||||
TypeSchema checkSchema = context.ResolveSymbol(str, out origin, out ExpressionRestriction _);
|
||||
if (checkSchema == null || !ImageElementInstanceSchema.Type.IsAssignableFrom(checkSchema) || origin != SymbolOrigin.Techniques)
|
||||
return;
|
||||
((EffectClassTypeSchema)TypeExport).SetDefaultElementSymbolIndex(context.TrackSymbolUsage(str, origin));
|
||||
}
|
||||
|
||||
public override void NotifyFoundPropertyAssignment(ValidateExpressionCall call)
|
||||
{
|
||||
string effectElementName = GetEffectElementName(call);
|
||||
if (effectElementName == null)
|
||||
return;
|
||||
TrackDynamicElementAssignment(effectElementName, call.MemberName);
|
||||
}
|
||||
|
||||
public override void NotifyFoundMethodCall(ValidateExpressionCall call)
|
||||
{
|
||||
string effectElementName = GetEffectElementName(call);
|
||||
if (effectElementName == null)
|
||||
return;
|
||||
if (s_methodNameMapping == null)
|
||||
{
|
||||
s_methodNameMapping = new Map<string, int>();
|
||||
s_methodNameMapping["PlayAttenuationAnimation"] = 2;
|
||||
s_methodNameMapping["PlayBrightnessAnimation"] = 3;
|
||||
s_methodNameMapping["PlayColorAnimation"] = 4;
|
||||
s_methodNameMapping["PlayInnerConeAngleAnimation"] = 14;
|
||||
s_methodNameMapping["PlayOuterConeAngleAnimation"] = 18;
|
||||
s_methodNameMapping["PlayContrastAnimation"] = 5;
|
||||
s_methodNameMapping["PlayDarkColorAnimation"] = 6;
|
||||
s_methodNameMapping["PlayDecayAnimation"] = 7;
|
||||
s_methodNameMapping["PlayDensityAnimation"] = 8;
|
||||
s_methodNameMapping["PlayDesaturateAnimation"] = 9;
|
||||
s_methodNameMapping["PlayDirectionAngleAnimation"] = 10;
|
||||
s_methodNameMapping["PlayDownsampleAnimation"] = 25;
|
||||
s_methodNameMapping["PlayEdgeLimitAnimation"] = 11;
|
||||
s_methodNameMapping["PlayFallOffAnimation"] = 12;
|
||||
s_methodNameMapping["PlayHueAnimation"] = 13;
|
||||
s_methodNameMapping["PlayIntensityAnimation"] = 15;
|
||||
s_methodNameMapping["PlayLightColorAnimation"] = 16;
|
||||
s_methodNameMapping["PlayAmbientColorAnimation"] = 1;
|
||||
s_methodNameMapping["PlayLightnessAnimation"] = 17;
|
||||
s_methodNameMapping["PlayPositionAnimation"] = 19;
|
||||
s_methodNameMapping["PlayRadiusAnimation"] = 20;
|
||||
s_methodNameMapping["PlaySaturationAnimation"] = 21;
|
||||
s_methodNameMapping["PlayToneAnimation"] = 22;
|
||||
s_methodNameMapping["PlayWeightAnimation"] = 23;
|
||||
s_methodNameMapping["PlayValueAnimation"] = 24;
|
||||
}
|
||||
int num;
|
||||
if (!s_methodNameMapping.TryGetValue(call.MemberName, out num))
|
||||
return;
|
||||
TrackDynamicElementAssignment(effectElementName, (EffectProperty)num);
|
||||
}
|
||||
|
||||
private string GetEffectElementName(ValidateExpressionCall call)
|
||||
{
|
||||
ValidateExpression target = call.Target;
|
||||
return EffectElementInstanceSchema.Type.IsAssignableFrom(target.ObjectType) && target.ExpressionType == ExpressionType.Symbol ? ((ValidateExpressionSymbol)target).Symbol : null;
|
||||
}
|
||||
|
||||
private void TrackDynamicElementAssignment(string elementName, string propertyName) => TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, propertyName));
|
||||
|
||||
private void TrackDynamicElementAssignment(string elementName, EffectProperty property) => TrackDynamicElementAssignment(EffectElementWrapper.MakeEffectPropertyName(elementName, property));
|
||||
|
||||
private void TrackDynamicElementAssignment(string dynamicPropertyName)
|
||||
{
|
||||
if (_foundDynamicElementAssignments == null)
|
||||
_foundDynamicElementAssignments = new Dictionary<string, object>();
|
||||
_foundDynamicElementAssignments[dynamicPropertyName] = null;
|
||||
}
|
||||
|
||||
public void TrackInstanceProperty(
|
||||
ValidateContext context,
|
||||
string name,
|
||||
ValidateProperty property)
|
||||
{
|
||||
if (_foundInstancePropertyAssignments == null)
|
||||
{
|
||||
_foundInstancePropertyAssignments = new Map<string, ValidateProperty>();
|
||||
_foundElementSymbolIndex = new Map<string, int>();
|
||||
}
|
||||
ValidateProperty validateProperty;
|
||||
_foundInstancePropertyAssignments.TryGetValue(name, out validateProperty);
|
||||
property.AppendToEnd(validateProperty);
|
||||
_foundInstancePropertyAssignments[name] = property;
|
||||
SymbolOrigin origin;
|
||||
TypeSchema typeSchema = context.ResolveSymbol(name, out origin, out ExpressionRestriction _);
|
||||
if (typeSchema == null)
|
||||
{
|
||||
property.ReportError("Element '{0}' property '{1}' is being assigned a value which requires it to be set dynamically, but the property cannot be changed dynamically", property.FoundProperty.Owner.ToString(), property.FoundProperty.Name);
|
||||
MarkHasErrors();
|
||||
}
|
||||
else
|
||||
{
|
||||
_foundElementSymbolIndex[name] = context.TrackSymbolUsage(name, origin);
|
||||
PropertySchema property1 = typeSchema.FindProperty(property.FoundProperty.Name);
|
||||
if (property1 == null)
|
||||
{
|
||||
property.ReportError("Element '{0}' property '{1}' is being assigned a value which requires it to be set dynamically, but the property cannot be changed dynamically", property.FoundProperty.Owner.ToString(), property.FoundProperty.Name);
|
||||
MarkHasErrors();
|
||||
}
|
||||
else
|
||||
{
|
||||
property.UpdateFoundProperty(property1);
|
||||
TrackDynamicElementAssignment(name, property.FoundProperty.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int GetElementSymbolIndex(string name) => _foundElementSymbolIndex[name];
|
||||
|
||||
public ValidateProperty FoundTechniquesValidateProperty => _foundTechniquesValidateProperty;
|
||||
|
||||
public Map<string, ValidateProperty> FoundInstancePropertyAssignments => _foundInstancePropertyAssignments;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user