-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Baml2006SchemaContext.cs
781 lines (660 loc) · 27.3 KB
/
Baml2006SchemaContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Diagnostics;
using System.Xaml;
using System.Xaml.Schema;
using System.ComponentModel;
using System.Reflection.Emit;
using System.Windows.Markup;
using System.Windows.Media.Media3D;
using System.Windows.Media;
using System.Runtime.Serialization;
using KnownTypesV3 = System.Windows.Markup.KnownTypes;
using System.Threading;
using MS.Internal.WindowsBase;
namespace System.Windows.Baml2006
{
internal partial class Baml2006SchemaContext : XamlSchemaContext
{
public Baml2006SchemaContext(Assembly localAssembly):
this(localAssembly, System.Windows.Markup.XamlReader.BamlSharedSchemaContext)
{
}
internal Baml2006SchemaContext(Assembly localAssembly, XamlSchemaContext parentSchemaContext)
: base(Array.Empty<Assembly>())
{
_localAssembly = localAssembly;
_parentSchemaContext = parentSchemaContext;
}
#region XamlSchemaContext Overrides
public override bool TryGetCompatibleXamlNamespace(string xamlNamespace, out string compatibleNamespace)
{
return _parentSchemaContext.TryGetCompatibleXamlNamespace(xamlNamespace, out compatibleNamespace);
}
public override XamlDirective GetXamlDirective(string xamlNamespace, string name)
{
return _parentSchemaContext.GetXamlDirective(xamlNamespace, name);
}
public override IEnumerable<string> GetAllXamlNamespaces()
{
return _parentSchemaContext.GetAllXamlNamespaces();
}
public override ICollection<XamlType> GetAllXamlTypes(string xamlNamespace)
{
return _parentSchemaContext.GetAllXamlTypes(xamlNamespace);
}
public override string GetPreferredPrefix(string xmlns)
{
return _parentSchemaContext.GetPreferredPrefix(xmlns);
}
public override XamlType GetXamlType(Type type)
{
return _parentSchemaContext.GetXamlType(type);
}
protected override XamlType GetXamlType(string xamlNamespace, string name, params XamlType[] typeArguments)
{
EnsureXmlnsAssembliesLoaded(xamlNamespace);
XamlTypeName fullTypeName = new XamlTypeName { Namespace = xamlNamespace, Name = name };
if (typeArguments != null)
{
foreach (XamlType typeArg in typeArguments)
{
fullTypeName.TypeArguments.Add(new XamlTypeName(typeArg));
}
}
return _parentSchemaContext.GetXamlType(fullTypeName);
}
#endregion
#region Internal Properties
internal XamlMember StaticExtensionMemberTypeProperty { get { return _xStaticMemberProperty.Value; } }
internal XamlMember TypeExtensionTypeProperty { get { return _xTypeTypeProperty.Value; } }
internal XamlMember ResourceDictionaryDeferredContentProperty { get { return _resourceDictionaryDefContentProperty.Value; } }
internal XamlType ResourceDictionaryType { get { return _resourceDictionaryType.Value; } }
internal XamlType EventSetterType { get { return _eventSetterType.Value; } }
internal XamlMember EventSetterEventProperty { get { return _eventSetterEventProperty.Value; } }
internal XamlMember EventSetterHandlerProperty { get { return _eventSetterHandlerProperty.Value; } }
internal XamlMember FrameworkTemplateTemplateProperty { get { return _frameworkTemplateTemplateProperty.Value; } }
internal XamlType StaticResourceExtensionType { get { return _staticResourceExtensionType.Value; } }
internal Assembly LocalAssembly { get { return _localAssembly; } }
internal Baml2006ReaderSettings Settings { get; set; }
internal const Int16 StaticExtensionTypeId = 602;
internal const Int16 StaticResourceTypeId = 603;
internal const Int16 DynamicResourceTypeId = 189;
internal const Int16 TemplateBindingTypeId = 634;
internal const Int16 TypeExtensionTypeId = 691;
internal const string WpfNamespace = "http://schemas.microsoft.com/winfx/2006/xaml/presentation";
#endregion
#region Internal Methods
internal void Reset()
{
lock (_syncObject)
{
_bamlAssembly.Clear();
_bamlType.Clear();
_bamlProperty.Clear();
_bamlString.Clear();
_bamlXmlnsMappings.Clear();
}
}
internal Assembly GetAssembly(Int16 assemblyId)
{
BamlAssembly bamlAssembly;
if (TryGetBamlAssembly(assemblyId, out bamlAssembly))
{
return ResolveAssembly(bamlAssembly);
}
throw new KeyNotFoundException();
}
internal String GetAssemblyName(Int16 assemblyId)
{
BamlAssembly bamlAssembly;
if (TryGetBamlAssembly(assemblyId, out bamlAssembly))
{
return bamlAssembly.Name;
}
throw new KeyNotFoundException(SR.Format(SR.BamlAssemblyIdNotFound, assemblyId.ToString(System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS)));
}
internal Type GetClrType(Int16 typeId)
{
BamlType bamlType;
XamlType xamlType;
if (TryGetBamlType(typeId, out bamlType, out xamlType))
{
if (xamlType != null)
{
return xamlType.UnderlyingType;
}
return ResolveBamlTypeToType(bamlType);
}
throw new KeyNotFoundException(SR.Format(SR.BamlTypeIdNotFound, typeId.ToString(System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS)));
}
internal XamlType GetXamlType(Int16 typeId)
{
BamlType bamlType;
XamlType xamlType;
if (TryGetBamlType(typeId, out bamlType, out xamlType))
{
if (xamlType != null)
{
return xamlType;
}
return ResolveBamlType(bamlType, typeId);
}
throw new KeyNotFoundException(SR.Format(SR.BamlTypeIdNotFound, typeId.ToString(System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS)));
}
internal DependencyProperty GetDependencyProperty(Int16 propertyId)
{
XamlMember member = GetProperty(propertyId, false);
WpfXamlMember wpfMember = member as WpfXamlMember;
if (wpfMember != null)
{
Debug.Assert(wpfMember.DependencyProperty != null);
return wpfMember.DependencyProperty;
}
throw new KeyNotFoundException();
}
internal XamlMember GetProperty(Int16 propertyId, XamlType parentType)
{
BamlProperty bamlProperty;
XamlMember xamlMember;
if (TryGetBamlProperty(propertyId, out bamlProperty, out xamlMember))
{
if (xamlMember != null)
{
return xamlMember;
}
XamlType declaringType = GetXamlType(bamlProperty.DeclaringTypeId);
// If the parent type & declaring type are assignable, then it could
// be either a regular property or attachable.
if (parentType.CanAssignTo(declaringType))
{
xamlMember = declaringType.GetMember(bamlProperty.Name);
if (xamlMember == null)
{
xamlMember = declaringType.GetAttachableMember(bamlProperty.Name);
}
}
else
{
//If not assignable, it has to be an attachable member
xamlMember = declaringType.GetAttachableMember(bamlProperty.Name);
}
lock (_syncObject)
{
_bamlProperty[propertyId] = xamlMember;
}
return xamlMember;
}
throw new KeyNotFoundException();
}
internal XamlMember GetProperty(Int16 propertyId, bool isAttached)
{
BamlProperty bamlProperty;
XamlMember xamlMember;
if (TryGetBamlProperty(propertyId, out bamlProperty, out xamlMember))
{
XamlType declaringType;
if (xamlMember != null)
{
// If we ask for the Attachable member and we cached the non-Attachable
// member, look for the correct member
if (xamlMember.IsAttachable != isAttached)
{
declaringType = xamlMember.DeclaringType;
if (isAttached)
{
xamlMember = declaringType.GetAttachableMember(xamlMember.Name);
}
else
{
xamlMember = declaringType.GetMember(xamlMember.Name);
}
}
return xamlMember;
}
declaringType = GetXamlType(bamlProperty.DeclaringTypeId);
if (isAttached)
{
xamlMember = declaringType.GetAttachableMember(bamlProperty.Name);
}
else
{
xamlMember = declaringType.GetMember(bamlProperty.Name);
}
lock (_syncObject)
{
_bamlProperty[propertyId] = xamlMember;
}
return xamlMember;
}
throw new KeyNotFoundException();
}
internal XamlType GetPropertyDeclaringType(Int16 propertyId)
{
BamlProperty bamlProperty;
XamlMember xamlMember;
// IsAttachable doesn't matter since we're only looking for the DeclaringType
if (TryGetBamlProperty(propertyId, out bamlProperty, out xamlMember))
{
if (xamlMember != null)
{
return xamlMember.DeclaringType;
}
return GetXamlType(bamlProperty.DeclaringTypeId);
}
throw new KeyNotFoundException();
}
internal String GetPropertyName(Int16 propertyId, bool fullName)
{
BamlProperty bamlProperty = null;
XamlMember xamlMember;
// IsAttachable doesn't matter since we're only looking for the name
if (TryGetBamlProperty(propertyId, out bamlProperty, out xamlMember))
{
if (xamlMember != null)
{
return xamlMember.Name;
}
return bamlProperty.Name;
}
throw new KeyNotFoundException();
}
internal string GetString(Int16 stringId)
{
string result;
lock (_syncObject)
{
if (stringId >= 0 && stringId < _bamlString.Count)
{
result = _bamlString[stringId];
}
else
{
result = KnownTypes.GetKnownString(stringId);
}
}
if (result == null)
{
throw new KeyNotFoundException();
}
return result;
}
internal void AddAssembly(Int16 assemblyId, string assemblyName)
{
if (assemblyId < 0)
{
throw new ArgumentOutOfRangeException("assemblyId");
}
ArgumentNullException.ThrowIfNull(assemblyName);
lock (_bamlAssembly)
{
if (assemblyId == _bamlAssembly.Count)
{
BamlAssembly assembly = new BamlAssembly(assemblyName);
_bamlAssembly.Add(assembly);
}
else if (assemblyId > _bamlAssembly.Count)
{
throw new ArgumentOutOfRangeException("assemblyId", SR.Format(SR.AssemblyIdOutOfSequence, assemblyId));
}
}
// Duplicate IDs (assemblyId < _bamlAssembly.Count) are ignored
}
internal void AddXamlType(Int16 typeId, Int16 assemblyId, string typeName, TypeInfoFlags flags)
{
if (typeId < 0)
{
throw new ArgumentOutOfRangeException("typeId");
}
ArgumentNullException.ThrowIfNull(typeName);
lock (_syncObject)
{
if (typeId == _bamlType.Count)
{
BamlType type = new BamlType(assemblyId, typeName);
type.Flags = flags;
_bamlType.Add(type);
}
else if (typeId > _bamlType.Count)
{
throw new ArgumentOutOfRangeException("typeId", SR.Format(SR.TypeIdOutOfSequence, typeId));
}
}
// Duplicate IDs (typeID < _bamlType.Count) are ignored
}
internal void AddProperty(Int16 propertyId, Int16 declaringTypeId, string propertyName)
{
if (propertyId < 0)
{
throw new ArgumentOutOfRangeException("propertyId");
}
ArgumentNullException.ThrowIfNull(propertyName);
lock (_syncObject)
{
if (propertyId == _bamlProperty.Count)
{
BamlProperty property = new BamlProperty(declaringTypeId, propertyName);
_bamlProperty.Add(property);
}
else if (propertyId > _bamlProperty.Count)
{
throw new ArgumentOutOfRangeException("propertyId", SR.Format(SR.PropertyIdOutOfSequence, propertyId));
}
}
// Duplicate IDs (propertyId < _bamlProperty.Count) are ignored
}
internal void AddString(Int16 stringId, string value)
{
ArgumentNullException.ThrowIfNull(value);
lock (_syncObject)
{
if (stringId == _bamlString.Count)
{
_bamlString.Add(value);
}
else if (stringId > _bamlString.Count)
{
throw new ArgumentOutOfRangeException("stringId", SR.Format(SR.StringIdOutOfSequence, stringId));
}
}
// Duplicate IDs (stringId < _bamlString.Count) are ignored
}
internal void AddXmlnsMapping(string xmlns, short[] assemblies)
{
lock (_syncObject)
{
// If there are duplicate records for the same namespace, we overwrite
_bamlXmlnsMappings[xmlns] = assemblies;
}
}
#endregion
#region Private Methods
private void EnsureXmlnsAssembliesLoaded(string xamlNamespace)
{
short[] assemblies;
lock (_syncObject)
{
_bamlXmlnsMappings.TryGetValue(xamlNamespace, out assemblies);
}
if (assemblies != null)
{
foreach (short assembly in assemblies)
{
// Ensure that the assembly is loaded
GetAssembly(assembly);
}
}
}
private Assembly ResolveAssembly(BamlAssembly bamlAssembly)
{
if (bamlAssembly.Assembly != null)
{
return bamlAssembly.Assembly;
}
AssemblyName assemblyName = new AssemblyName(bamlAssembly.Name);
bamlAssembly.Assembly = MS.Internal.WindowsBase.SafeSecurityHelper.GetLoadedAssembly(assemblyName);
if (bamlAssembly.Assembly == null)
{
byte[] publicKeyToken = assemblyName.GetPublicKeyToken();
if (assemblyName.Version != null || assemblyName.CultureInfo != null || publicKeyToken != null)
{
try
{
bamlAssembly.Assembly = Assembly.Load(assemblyName.FullName);
}
catch
{
// Fall back to short name match.
if (bamlAssembly.Assembly == null)
{
// First try to match the local assembly (which may be in the LoadFrom/LoadFile context)
if (MatchesLocalAssembly(assemblyName.Name, publicKeyToken))
{
bamlAssembly.Assembly = _localAssembly;
}
// Otherwise try Assembly.Load
else
{
AssemblyName shortName = new AssemblyName(assemblyName.Name);
if (publicKeyToken != null)
{
shortName.SetPublicKeyToken(publicKeyToken);
}
bamlAssembly.Assembly = Assembly.Load(shortName);
}
}
}
}
else
{
// Only a short name was provided.
// Don't need to check for local assembly match, because if it matched the local
// assembly, we would have caught it in GetLoadedAssembly up above.
bamlAssembly.Assembly = Assembly.LoadWithPartialName(assemblyName.Name);
}
}
return bamlAssembly.Assembly;
}
private bool MatchesLocalAssembly(string shortName, byte[] publicKeyToken)
{
if (_localAssembly == null)
{
return false;
}
AssemblyName localAssemblyName = new AssemblyName(_localAssembly.FullName);
if (shortName != localAssemblyName.Name)
{
return false;
}
if (publicKeyToken == null)
{
return true;
}
return MS.Internal.PresentationFramework.SafeSecurityHelper.IsSameKeyToken(
publicKeyToken, localAssemblyName.GetPublicKeyToken());
}
private Type ResolveBamlTypeToType(BamlType bamlType)
{
BamlAssembly bamlAssembly;
if (TryGetBamlAssembly(bamlType.AssemblyId, out bamlAssembly))
{
Assembly assembly = ResolveAssembly(bamlAssembly);
if (assembly != null)
{
return assembly.GetType(bamlType.Name, false);
}
}
return null;
}
private XamlType ResolveBamlType(BamlType bamlType, Int16 typeId)
{
Type type = ResolveBamlTypeToType(bamlType);
if (type != null)
{
bamlType.ClrNamespace = type.Namespace;
XamlType xType = _parentSchemaContext.GetXamlType(type);
lock (_syncObject)
{
_bamlType[typeId] = xType;
}
return xType;
}
// NOTE: If XamlSchemaContext to can provide an UnknownType of name bamlType.Name
// return a new UnknownType instead of throwing NotImplemented.
// return bamlType.XamlType = new UnknownType(new XamlTypeName(bamlType.Name), this, null);
throw new NotImplementedException();
}
private bool TryGetBamlAssembly(Int16 assemblyId, out BamlAssembly bamlAssembly)
{
lock (_syncObject)
{
if (assemblyId >= 0 && assemblyId < _bamlAssembly.Count)
{
bamlAssembly = _bamlAssembly[assemblyId];
return true;
}
}
Assembly assembly = KnownTypes.GetKnownAssembly(assemblyId);
if (assembly != null)
{
bamlAssembly = new BamlAssembly(assembly);
return true;
}
bamlAssembly = null;
return false;
}
private bool TryGetBamlType(Int16 typeId, out BamlType bamlType, out XamlType xamlType)
{
bamlType = null;
xamlType = null;
lock (_syncObject)
{
if (typeId >= 0 && typeId < _bamlType.Count)
{
object type = _bamlType[typeId];
bamlType = type as BamlType;
xamlType = type as XamlType;
return (type != null);
}
}
if (typeId < 0)
{
if (_parentSchemaContext == System.Windows.Markup.XamlReader.BamlSharedSchemaContext)
{
xamlType = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetKnownBamlType(typeId);
}
else
{
xamlType = _parentSchemaContext.GetXamlType(KnownTypes.GetKnownType(typeId));
}
return true;
}
return (bamlType != null);
}
private bool TryGetBamlProperty(Int16 propertyId, out BamlProperty bamlProperty, out XamlMember xamlMember)
{
lock (_syncObject)
{
if (propertyId >= 0 && propertyId < _bamlProperty.Count)
{
Object property = _bamlProperty[propertyId];
xamlMember = property as XamlMember;
bamlProperty = property as BamlProperty;
return true;
}
}
if (propertyId < 0)
{
if (_parentSchemaContext == System.Windows.Markup.XamlReader.BamlSharedSchemaContext)
{
xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetKnownBamlMember(propertyId);
}
else
{
Int16 typeId;
string propertyName;
KnownTypes.GetKnownProperty(propertyId, out typeId, out propertyName);
xamlMember = GetXamlType(typeId).GetMember(propertyName);
}
bamlProperty = null;
return true;
}
xamlMember = null;
bamlProperty = null;
return false;
}
#endregion
#region Private Data
// Assignments to these collections are idempotent, thus threadsafe
private readonly List<BamlAssembly> _bamlAssembly = new List<BamlAssembly>();
private readonly List<object> _bamlType = new List<object>();
private readonly List<Object> _bamlProperty = new List<Object>();
private readonly List<string> _bamlString = new List<string>();
private readonly Dictionary<string, short[]> _bamlXmlnsMappings = new Dictionary<string, short[]>();
private static readonly Lazy<XamlMember> _xStaticMemberProperty
= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("MemberType"));
private static readonly Lazy<XamlMember> _xTypeTypeProperty
= new Lazy<XamlMember>(() => XamlLanguage.Static.GetMember("Type"));
private static readonly Lazy<XamlMember> _resourceDictionaryDefContentProperty
= new Lazy<XamlMember>(() => _resourceDictionaryType.Value.GetMember("DeferrableContent"));
private static readonly Lazy<XamlType> _resourceDictionaryType
= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(ResourceDictionary)));
private static readonly Lazy<XamlType> _eventSetterType
= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(EventSetter)));
private static readonly Lazy<XamlMember> _eventSetterEventProperty
= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Event"));
private static readonly Lazy<XamlMember> _eventSetterHandlerProperty
= new Lazy<XamlMember>(() => _eventSetterType.Value.GetMember("Handler"));
private static readonly Lazy<XamlMember> _frameworkTemplateTemplateProperty
= new Lazy<XamlMember>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(FrameworkTemplate)).GetMember("Template"));
private static readonly Lazy<XamlType> _staticResourceExtensionType
= new Lazy<XamlType>(() => System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetXamlType(typeof(StaticResourceExtension)));
private readonly object _syncObject = new object();
private Assembly _localAssembly;
private XamlSchemaContext _parentSchemaContext;
#endregion
#region Private Types and Enums
sealed class BamlAssembly
{
/// <summary>
/// </summary>
/// <param name="name">A fully qualified assembly name</param>
public BamlAssembly(string name)
{
ArgumentNullException.ThrowIfNull(name);
Name = name;
Assembly = null;
}
public BamlAssembly(Assembly assembly)
{
ArgumentNullException.ThrowIfNull(assembly);
Name = null;
Assembly = assembly;
}
// Information needed to resolve a BamlAssembly to a CLR Assembly
public readonly string Name;
// Resolved BamlAssembly information
internal Assembly Assembly;
}
sealed class BamlType
{
public BamlType(Int16 assemblyId, string name)
{
ArgumentNullException.ThrowIfNull(name);
AssemblyId = assemblyId;
Name = name;
}
// Information needed to resolve a BamlType to a XamlType
public Int16 AssemblyId;
public string Name;
public TypeInfoFlags Flags;
// Resolved BamlType information
public string ClrNamespace;
}
sealed class BamlProperty
{
public BamlProperty(Int16 declaringTypeId, string name)
{
ArgumentNullException.ThrowIfNull(name);
DeclaringTypeId = declaringTypeId;
Name = name;
}
// Information needed to resolve a BamlProperty to a XamlMember
public readonly Int16 DeclaringTypeId;
public readonly string Name;
}
#endregion
[Flags]
internal enum TypeInfoFlags : byte
{
Internal = 0x1,
UnusedTwo = 0x2,
UnusedThree = 0x4,
}
}
}