本文整理汇总了C#中System.Xaml.XamlXmlReaderSettings类的典型用法代码示例。如果您正苦于以下问题:C# System.Xaml.XamlXmlReaderSettings类的具体用法?C# System.Xaml.XamlXmlReaderSettings怎么用?C# System.Xaml.XamlXmlReaderSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Xaml.XamlXmlReaderSettings类属于命名空间,在下文中一共展示了System.Xaml.XamlXmlReaderSettings类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeComponent
public void InitializeComponent() {
if ((this._contentLoaded == true)) {
return;
}
this._contentLoaded = true;
string resourceName = this.FindResource();
System.IO.Stream initializeXaml = typeof(状态机流程).Assembly.GetManifestResourceStream(resourceName);
System.Xml.XmlReader xmlReader = null;
System.Xaml.XamlReader reader = null;
System.Xaml.XamlObjectWriter objectWriter = null;
try {
System.Xaml.XamlSchemaContext schemaContext = XamlStaticHelperNamespace._XamlStaticHelper.SchemaContext;
xmlReader = System.Xml.XmlReader.Create(initializeXaml);
System.Xaml.XamlXmlReaderSettings readerSettings = new System.Xaml.XamlXmlReaderSettings();
readerSettings.LocalAssembly = System.Reflection.Assembly.GetExecutingAssembly();
readerSettings.AllowProtectedMembersOnRoot = true;
reader = new System.Xaml.XamlXmlReader(xmlReader, schemaContext, readerSettings);
System.Xaml.XamlObjectWriterSettings writerSettings = new System.Xaml.XamlObjectWriterSettings();
writerSettings.RootObjectInstance = this;
writerSettings.AccessLevel = System.Xaml.Permissions.XamlAccessLevel.PrivateAccessTo(typeof(状态机流程));
objectWriter = new System.Xaml.XamlObjectWriter(schemaContext, writerSettings);
System.Xaml.XamlServices.Transform(reader, objectWriter);
}
finally {
if ((xmlReader != null)) {
((System.IDisposable)(xmlReader)).Dispose();
}
if ((reader != null)) {
((System.IDisposable)(reader)).Dispose();
}
if ((objectWriter != null)) {
((System.IDisposable)(objectWriter)).Dispose();
}
}
}
示例2: Load
public void Load(Uri symbolInfoUri)
{
m_drawingMap = new Dictionary<SymbolID, Dictionary<GameColor, Drawing>>();
var resInfo = Application.GetRemoteStream(symbolInfoUri);
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = System.Reflection.Assembly.GetCallingAssembly(),
};
using (var reader = new System.Xaml.XamlXmlReader(resInfo.Stream, settings))
m_symbolSet = (Symbols.SymbolSet)System.Xaml.XamlServices.Load(reader);
if (m_symbolSet.Drawings != null)
m_drawingCache = new DrawingCache(new Uri(m_symbolSet.Drawings, UriKind.Relative));
}
示例3: Workbenches
static Workbenches()
{
var asm = System.Reflection.Assembly.GetExecutingAssembly();
WorkbenchInfo[] workbenchInfos;
using (var stream = asm.GetManifestResourceStream("Dwarrowdelf.Game.Workbenches.xaml"))
{
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = asm,
};
using (var reader = new System.Xaml.XamlXmlReader(stream, settings))
workbenchInfos = (WorkbenchInfo[])System.Xaml.XamlServices.Load(reader);
}
s_workbenchInfos = new Dictionary<ItemID, WorkbenchInfo>(workbenchInfos.Length);
foreach (var workbench in workbenchInfos)
{
if (s_workbenchInfos.ContainsKey(workbench.WorkbenchID))
throw new Exception();
foreach (var bi in workbench.BuildableItems)
{
if (String.IsNullOrEmpty(bi.Key))
bi.Key = bi.ItemID.ToString();
bi.FullKey = String.Format("{0},{1}", workbench.WorkbenchID, bi.Key);
}
// verify BuildableItem key uniqueness
var grouped = workbench.BuildableItems.GroupBy(bi => bi.Key);
foreach (var g in grouped)
if (g.Count() != 1)
throw new Exception();
s_workbenchInfos[workbench.WorkbenchID] = workbench;
}
}
示例4: Terrains
static Terrains()
{
var asm = System.Reflection.Assembly.GetExecutingAssembly();
TerrainInfo[] terrains;
using (var stream = asm.GetManifestResourceStream("Dwarrowdelf.Game.Data.Terrains.xaml"))
{
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = asm,
};
using (var reader = new System.Xaml.XamlXmlReader(stream, settings))
terrains = (TerrainInfo[])System.Xaml.XamlServices.Load(reader);
}
var max = terrains.Max(m => (int)m.ID);
s_terrains = new TerrainInfo[max + 1];
foreach (var item in terrains)
{
if (s_terrains[(int)item.ID] != null)
throw new Exception("Duplicate entry");
if (item.Name == null)
item.Name = item.ID.ToString().ToLowerInvariant();
s_terrains[(int)item.ID] = item;
}
s_terrains[0] = new TerrainInfo()
{
ID = TerrainID.Undefined,
Name = "<undefined>",
};
}
示例5: Materials
static Materials()
{
var asm = System.Reflection.Assembly.GetExecutingAssembly();
MaterialInfo[] materials;
using (var stream = asm.GetManifestResourceStream("Dwarrowdelf.Game.Data.Materials.xaml"))
{
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = asm,
};
using (var reader = new System.Xaml.XamlXmlReader(stream, settings))
materials = (MaterialInfo[])System.Xaml.XamlServices.Load(reader);
}
var max = materials.Max(m => (int)m.ID);
s_materials = new MaterialInfo[max + 1];
foreach (var item in materials)
{
if (s_materials[(int)item.ID] != null)
throw new Exception("Duplicate entry");
if (item.Name == null)
item.Name = item.ID.ToString().ToLowerInvariant();
if (item.Adjective == null)
item.Adjective = item.Name;
s_materials[(int)item.ID] = item;
}
s_materials[0] = new MaterialInfo()
{
ID = MaterialID.Undefined,
Name = "<undefined>",
Category = MaterialCategory.Undefined,
Color = GameColor.None,
};
}
示例6: Livings
static Livings()
{
var asm = System.Reflection.Assembly.GetExecutingAssembly();
LivingInfo[] livings;
using (var stream = asm.GetManifestResourceStream("Dwarrowdelf.Game.Livings.xaml"))
{
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = asm,
};
using (var reader = new System.Xaml.XamlXmlReader(stream, settings))
livings = (LivingInfo[])System.Xaml.XamlServices.Load(reader);
}
var max = livings.Max(i => (int)i.ID);
s_livings = new LivingInfo[max + 1];
foreach (var living in livings)
{
if (s_livings[(int)living.ID] != null)
throw new Exception();
if (living.Name == null)
living.Name = living.ID.ToString().ToLowerInvariant();
s_livings[(int)living.ID] = living;
}
}
示例7: Items
static Items()
{
var asm = System.Reflection.Assembly.GetExecutingAssembly();
ItemInfo[] items;
using (var stream = asm.GetManifestResourceStream("Dwarrowdelf.Game.Data.Items.xaml"))
{
var settings = new System.Xaml.XamlXmlReaderSettings()
{
LocalAssembly = asm,
};
using (var reader = new System.Xaml.XamlXmlReader(stream, settings))
items = (ItemInfo[])System.Xaml.XamlServices.Load(reader);
}
var max = items.Max(i => (int)i.ID);
s_items = new ItemInfo[max + 1];
foreach (var item in items)
{
if (s_items[(int)item.ID] != null)
throw new Exception();
if (item.Name == null)
item.Name = item.ID.ToString().ToLowerInvariant();
s_items[(int)item.ID] = item;
}
}