content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.GoogleNative.Compute.Alpha.Outputs
{
/// <summary>
/// Configuration and status of a managed SSL certificate.
/// </summary>
[OutputType]
public sealed class SslCertificateManagedSslCertificateResponse
{
/// <summary>
/// [Output only] Detailed statuses of the domains specified for managed certificate resource.
/// </summary>
public readonly ImmutableDictionary<string, string> DomainStatus;
/// <summary>
/// The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](/load-balancing/docs/quotas#ssl_certificates).
/// </summary>
public readonly ImmutableArray<string> Domains;
/// <summary>
/// [Output only] Status of the managed certificate resource.
/// </summary>
public readonly string Status;
[OutputConstructor]
private SslCertificateManagedSslCertificateResponse(
ImmutableDictionary<string, string> domainStatus,
ImmutableArray<string> domains,
string status)
{
DomainStatus = domainStatus;
Domains = domains;
Status = status;
}
}
}
| 35.217391 | 243 | 0.667284 | [
"Apache-2.0"
] | AaronFriel/pulumi-google-native | sdk/dotnet/Compute/Alpha/Outputs/SslCertificateManagedSslCertificateResponse.cs | 1,620 | C# |
// 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.
#nullable enable
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax
{
public partial class LockStatementSyntax
{
public LockStatementSyntax Update(SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
=> Update(attributeLists: default, lockKeyword, openParenToken, expression, closeParenToken, statement);
}
}
namespace Microsoft.CodeAnalysis.CSharp
{
public partial class SyntaxFactory
{
public static LockStatementSyntax LockStatement(SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement)
=> LockStatement(attributeLists: default, lockKeyword, openParenToken, expression, closeParenToken, statement);
}
}
| 41.807692 | 193 | 0.785649 | [
"MIT"
] | 06needhamt/roslyn | src/Compilers/CSharp/Portable/Syntax/LockStatementSyntax.cs | 1,089 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generation date: 11/28/2021 8:55:09 PM
namespace Microsoft.Dynamics.DataEntities
{
/// <summary>
/// There are no comments for UnitOfMeasureSystemOfUnits in the schema.
/// </summary>
public enum UnitOfMeasureSystemOfUnits
{
None = 0,
Metric = 1,
US = 2
}
}
| 29.458333 | 81 | 0.489392 | [
"MIT"
] | NathanClouseAX/AAXDataEntityPerfTest | Projects/AAXDataEntityPerfTest/ODataUtility/Connected Services/D365/UnitOfMeasureSystemOfUnits.cs | 709 | C# |
namespace Bridge.Contract
{
public interface ILogger
{
void Warn(string message);
void Error(string message);
void Info(string message);
void Trace(string message);
}
}
| 15.428571 | 35 | 0.606481 | [
"Apache-2.0"
] | LiPingWUhahaha/bridge.lua | Compiler/Contract/ILogger.cs | 216 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.Management.Batch.Fluent
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.ResourceManager.Fluent.Core;
using Microsoft.Rest;
using System;
using Models;
/// <summary>
/// An immutable client-side representation of an Azure Batch application package.
/// </summary>
public interface IApplicationPackage :
IApplicationPackageBeta,
Microsoft.Azure.Management.ResourceManager.Fluent.Core.IExternalChildResource<Microsoft.Azure.Management.Batch.Fluent.IApplicationPackage, Microsoft.Azure.Management.Batch.Fluent.IApplication>,
Microsoft.Azure.Management.ResourceManager.Fluent.Core.IHasInner<ApplicationPackageInner>
{
/// <summary>
/// Deletes the application package.
/// </summary>
void Delete();
/// <summary>
/// Gets the state of the application package.
/// </summary>
PackageState State { get; }
/// <summary>
/// Gets the format of the application package.
/// </summary>
string Format { get; }
/// <summary>
/// Gets the last time this application package was activated.
/// </summary>
System.DateTime LastActivationTime { get; }
/// <summary>
/// Gets the expiry of the storage URL for the application package.
/// </summary>
System.DateTime StorageUrlExpiry { get; }
/// <summary>
/// Gets the storage URL of the application package where teh application should be uploaded.
/// </summary>
string StorageUrl { get; }
}
} | 36.4 | 201 | 0.652747 | [
"MIT"
] | AntoineGa/azure-libraries-for-net | src/ResourceManagement/Batch/Domain/IApplicationPackage.cs | 1,820 | C# |
// Demonstration of RuntimeInitializeOnLoadMethod and the argument it can take.
using UnityEngine;
namespace _Project.Scripts
{
class Initialize
{
// Before first Scene loaded
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void OnBeforeSceneLoadRuntimeMethod()
{
}
// After first Scene loaded
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void OnAfterSceneLoadRuntimeMethod()
{
Object gameObject = Object.Instantiate(Resources.Load("Initialize/Game Manager"));
gameObject.name = "Game Manager";
}
// RuntimeMethodLoad: After first Scene loaded
[RuntimeInitializeOnLoadMethod]
static void OnRuntimeMethodLoad()
{
}
}
} | 27.34375 | 94 | 0.650286 | [
"MIT"
] | wezel/Virtual-Ray-Tracer | Unity/Assets/_Project/Scripts/Initialize.cs | 875 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Wanderer.Adjectives;
namespace Wanderer.Items
{
public class ItemSlot : IItemSlot
{
public string Name { get; set; }
public int NumberRequired { get; set; }
public InjuryRegion[] SensitiveTo { get; set; }
public ItemSlot()
{
}
public ItemSlot(string name,int numberRequired, params InjuryRegion[] sensitiveTo)
{
NumberRequired = numberRequired;
Name = name;
SensitiveTo = sensitiveTo;
}
}
} | 22.111111 | 90 | 0.596315 | [
"MIT"
] | tznind/Wanderer | src/Items/ItemSlot.cs | 599 | C# |
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace StoreData.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Customers",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FName = table.Column<string>(type: "text", nullable: true),
LName = table.Column<string>(type: "text", nullable: true),
Username = table.Column<string>(type: "text", nullable: true),
PasswordHash = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Customers", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Locations",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LocationName = table.Column<string>(type: "text", nullable: true),
Address = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Locations", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProductName = table.Column<string>(type: "text", nullable: true),
ProductDescription = table.Column<string>(type: "text", nullable: true),
ProductPrice = table.Column<decimal>(type: "numeric", nullable: false),
Manufacturer = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.ID);
});
migrationBuilder.CreateTable(
name: "Carts",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CustomerID = table.Column<int>(type: "integer", nullable: false),
LocationID = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Carts", x => x.ID);
table.ForeignKey(
name: "FK_Carts_Customers_CustomerID",
column: x => x.CustomerID,
principalTable: "Customers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Carts_Locations_LocationID",
column: x => x.LocationID,
principalTable: "Locations",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrderDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
CustomerID = table.Column<int>(type: "integer", nullable: false),
LocationID = table.Column<int>(type: "integer", nullable: false),
TotalCost = table.Column<decimal>(type: "numeric", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.ID);
table.ForeignKey(
name: "FK_Orders_Customers_CustomerID",
column: x => x.CustomerID,
principalTable: "Customers",
principalColumn: "ID",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_Orders_Locations_LocationID",
column: x => x.LocationID,
principalTable: "Locations",
principalColumn: "ID",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "LocationProducts",
columns: table => new
{
ProductID = table.Column<int>(type: "integer", nullable: false),
LocationID = table.Column<int>(type: "integer", nullable: false),
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
LocationProductName = table.Column<string>(type: "text", nullable: true),
ProductQuantity = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LocationProducts", x => new { x.LocationID, x.ProductID });
table.ForeignKey(
name: "FK_LocationProducts_Locations_LocationID",
column: x => x.LocationID,
principalTable: "Locations",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LocationProducts_Products_ProductID",
column: x => x.ProductID,
principalTable: "Products",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CartProducts",
columns: table => new
{
CartID = table.Column<int>(type: "integer", nullable: false),
ProductID = table.Column<int>(type: "integer", nullable: false),
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProductCount = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CartProducts", x => new { x.CartID, x.ProductID });
table.ForeignKey(
name: "FK_CartProducts_Carts_CartID",
column: x => x.CartID,
principalTable: "Carts",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CartProducts_Products_ProductID",
column: x => x.ProductID,
principalTable: "Products",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderProducts",
columns: table => new
{
OrderID = table.Column<int>(type: "integer", nullable: false),
ProductID = table.Column<int>(type: "integer", nullable: false),
ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrderItemsQuantity = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderProducts", x => new { x.OrderID, x.ProductID });
table.ForeignKey(
name: "FK_OrderProducts_Orders_OrderID",
column: x => x.OrderID,
principalTable: "Orders",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderProducts_Products_ProductID",
column: x => x.ProductID,
principalTable: "Products",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CartProducts_ProductID",
table: "CartProducts",
column: "ProductID");
migrationBuilder.CreateIndex(
name: "IX_Carts_CustomerID",
table: "Carts",
column: "CustomerID");
migrationBuilder.CreateIndex(
name: "IX_Carts_LocationID",
table: "Carts",
column: "LocationID");
migrationBuilder.CreateIndex(
name: "IX_LocationProducts_ProductID",
table: "LocationProducts",
column: "ProductID");
migrationBuilder.CreateIndex(
name: "IX_OrderProducts_ProductID",
table: "OrderProducts",
column: "ProductID");
migrationBuilder.CreateIndex(
name: "IX_Orders_CustomerID",
table: "Orders",
column: "CustomerID");
migrationBuilder.CreateIndex(
name: "IX_Orders_LocationID",
table: "Orders",
column: "LocationID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CartProducts");
migrationBuilder.DropTable(
name: "LocationProducts");
migrationBuilder.DropTable(
name: "OrderProducts");
migrationBuilder.DropTable(
name: "Carts");
migrationBuilder.DropTable(
name: "Orders");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Customers");
migrationBuilder.DropTable(
name: "Locations");
}
}
}
| 45.373541 | 125 | 0.495155 | [
"MIT"
] | 210215-USF-NET/Weston_Davidson-P1 | StoreData/Migrations/20210305040020_Initial.cs | 11,663 | C# |
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Presentacion.Constantes;
using Presentacion.FormularioBase.DTOs;
namespace Presentacion.FormularioBase
{
public partial class FormularioBase : Form
{
private readonly List<ControlDto> _listaControlesObligatorios;
public FormularioBase()
{
InitializeComponent();
_listaControlesObligatorios = new List<ControlDto>();
}
protected void Control_Enter(object sender, EventArgs e)
{
if (sender is TextBox)
{
((TextBox) sender).BackColor = Color.ColorControlConFoco;
}
if (sender is NumericUpDown)
{
((NumericUpDown)sender).BackColor = Color.ColorControlConFoco;
}
}
protected void Control_Leave(object sender, EventArgs e)
{
if (sender is TextBox)
{
((TextBox) sender).BackColor = Color.ColorControlSinFoco;
return;
}
if (sender is NumericUpDown)
{
((NumericUpDown)sender).BackColor = Color.ColorControlSinFoco;
return;
}
}
public virtual void DesactivarControles(object obj)
{
if (obj is Form)
{
foreach (var ctrolForm in ((Form) obj).Controls)
{
if (ctrolForm is TextBox)
{
((TextBox) ctrolForm).Enabled = false;
}
if (ctrolForm is ComboBox)
{
((ComboBox) ctrolForm).Enabled = false;
}
if (ctrolForm is NumericUpDown)
{
((NumericUpDown) ctrolForm).Enabled = false;
}
if (ctrolForm is DateTimePicker)
{
((DateTimePicker)ctrolForm).Enabled = false;
}
if (ctrolForm is Button)
{
((Button)ctrolForm).Enabled = false;
}
if (ctrolForm is Panel)
{
DesactivarControles(ctrolForm);
}
}
}
else if (obj is Panel)
{
foreach (var ctrolPanel in ((Panel) obj).Controls)
{
if (ctrolPanel is TextBox)
{
((TextBox) ctrolPanel).Enabled = false;
}
if (ctrolPanel is ComboBox)
{
((ComboBox) ctrolPanel).Enabled = false;
}
if (ctrolPanel is NumericUpDown)
{
((NumericUpDown) ctrolPanel).Enabled = false;
}
if (ctrolPanel is DateTimePicker)
{
((DateTimePicker)ctrolPanel).Enabled = false;
}
if (ctrolPanel is Button)
{
((Button)ctrolPanel).Enabled = false;
}
if (ctrolPanel is Panel)
{
DesactivarControles(ctrolPanel);
}
}
}
}
public virtual void Limpiar(object obj)
{
if (obj is Form)
{
foreach (var ctrolForm in ((Form)obj).Controls)
{
if (ctrolForm is TextBox)
{
((TextBox)ctrolForm).Clear();
}
if (ctrolForm is ComboBox)
{
if (((ComboBox) ctrolForm).Items.Count > 0)
{
((ComboBox) ctrolForm).SelectedIndex = 0;
}
}
if (ctrolForm is NumericUpDown)
{
((NumericUpDown)ctrolForm).Value = ((NumericUpDown)ctrolForm).Minimum;
}
if (ctrolForm is DateTimePicker)
{
((DateTimePicker)ctrolForm).Value = DateTime.Now;
}
if (ctrolForm is Panel)
{
Limpiar(ctrolForm);
}
}
}
else if (obj is Panel)
{
foreach (var ctrolPanel in ((Panel)obj).Controls)
{
if (ctrolPanel is TextBox)
{
((TextBox)ctrolPanel).Clear();
}
if (ctrolPanel is ComboBox)
{
if (((ComboBox) ctrolPanel).Items.Count > 0)
{
((ComboBox) ctrolPanel).SelectedIndex = 0;
}
}
if (ctrolPanel is NumericUpDown)
{
((NumericUpDown) ctrolPanel).Value = ((NumericUpDown) ctrolPanel).Minimum;
}
if (ctrolPanel is DateTimePicker)
{
((DateTimePicker) ctrolPanel).Value = DateTime.Now; // fecha Sistema
}
if (ctrolPanel is Panel)
{
Limpiar(ctrolPanel);
}
}
}
}
public virtual void AsignarEventoEnterLeave(object obj)
{
if (obj is Form)
{
foreach (var ctrolForm in ((Form)obj).Controls)
{
if (ctrolForm is TextBox)
{
((TextBox) ctrolForm).Enter += Control_Enter;
((TextBox)ctrolForm).Leave += Control_Leave;
}
if (ctrolForm is NumericUpDown)
{
((NumericUpDown)ctrolForm).Enter += Control_Enter;
((NumericUpDown)ctrolForm).Leave += Control_Leave;
}
if (ctrolForm is Panel)
{
AsignarEventoEnterLeave(ctrolForm);
}
}
}
else if (obj is Panel)
{
foreach (var ctrolPanel in ((Panel)obj).Controls)
{
if (ctrolPanel is TextBox)
{
((TextBox)ctrolPanel).Enter += Control_Enter;
((TextBox)ctrolPanel).Leave += Control_Leave;
}
if (ctrolPanel is NumericUpDown)
{
((NumericUpDown)ctrolPanel).Enter += Control_Enter;
((NumericUpDown)ctrolPanel).Leave += Control_Leave;
}
if (ctrolPanel is Panel)
{
AsignarEventoEnterLeave(ctrolPanel);
}
}
}
}
public virtual void CargarComboBox(ComboBox cmb, object datos, string propiedadMostrar,
string propiedadDevolver)
{
cmb.DataSource = datos;
cmb.DisplayMember = propiedadMostrar;
cmb.ValueMember = propiedadDevolver;
}
public virtual void AgregarControlesObligatorios(object control, string nombreControl)
{
_listaControlesObligatorios.Add(new ControlDto
{
Control = control,
NombreControl = nombreControl
});
AsignarErrorProvider(control);
}
public virtual void AsignarErrorProvider(object control)
{
if (control is TextBox)
{
((TextBox) control).Validated += Control_Validated;
}
if (control is RichTextBox)
{
((RichTextBox)control).Validated += Control_Validated;
}
if (control is ComboBox)
{
((ComboBox)control).Validated += Control_Validated;
}
}
public virtual void Control_Validated(object sender, System.EventArgs e)
{
if (sender is TextBox)
{
error.SetError(((TextBox) sender),
!string.IsNullOrEmpty(((TextBox) sender).Text)
? string.Empty
: $"El campo es Obligatorio.");
return;
}
if (sender is RichTextBox)
{
error.SetError(((RichTextBox)sender),
!string.IsNullOrEmpty(((RichTextBox)sender).Text)
? string.Empty
: $"El campo es Obligatorio.");
return;
}
if (sender is NumericUpDown)
{
error.SetError(((NumericUpDown)sender),
!string.IsNullOrEmpty(((NumericUpDown)sender).Text)
? string.Empty
: $"El campo es Obligatorio.");
return;
}
if (sender is ComboBox)
{
error.SetError(((ComboBox)sender),
!string.IsNullOrEmpty(((ComboBox)sender).Text)
? string.Empty
: $"El campo es Obligatorio.");
}
}
public virtual bool VerificarDatosObligatorios()
{
foreach (var objeto in _listaControlesObligatorios)
{
switch (objeto.Control)
{
case TextBox _:
if (string.IsNullOrEmpty(((TextBox) objeto.Control).Text)) return false;
break;
case RichTextBox _:
if (string.IsNullOrEmpty(((RichTextBox)objeto.Control).Text)) return false;
break;
case NumericUpDown _:
if (string.IsNullOrEmpty(((NumericUpDown)objeto.Control).Text)) return false;
break;
case ComboBox _:
if (((ComboBox)objeto.Control).Items.Count <= 0) return false;
break;
}
}
return true;
}
public virtual void FormatearGrilla(DataGridView dgvGrilla)
{
for (int i = 0; i < dgvGrilla.ColumnCount; i++)
{
dgvGrilla.Columns[i].Visible = false;
dgvGrilla.Columns[i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
}
}
}
}
| 31.954416 | 108 | 0.417261 | [
"MIT"
] | RamonChauqui/SubeCodigo | Presentacion.FormularioBase/FormularioBase.cs | 11,218 | C# |
using System;
namespace SumOf3Numbers
{
class SumOf3Numbers
{
static void Main()
{
//input
short num1 = short.Parse(Console.ReadLine());
short num2 = short.Parse(Console.ReadLine());
short num3 = short.Parse(Console.ReadLine());
//logic
int result = num1 + num2 + num3;
Console.WriteLine(result);
}
}
}
| 21.3 | 57 | 0.516432 | [
"MIT"
] | marianbochev/CSharpFundamentals | HomeworkConsoleInAndOut/SumOf3Numbers/SumOf3Numbers.cs | 428 | C# |
namespace PubSubWorkerStarter.Entity
{
public class User
{
public long Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
| 20.4 | 45 | 0.588235 | [
"MIT"
] | hungnd271090/GCP-Pubsub-example | PubSubWorkerStarter/PubSubWorkerStarter/Data/Entity/User.cs | 206 | C# |
using VrsekDev.Blazor.Mobx.Abstractions;
using VrsekDev.Blazor.Mobx.Abstractions.Components;
using VrsekDev.Blazor.Mobx.Abstractions.Events;
using VrsekDev.Blazor.Mobx.StoreAccessors;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VrsekDev.Blazor.Mobx.PropertyObservers
{
internal class PropertyObserver<T> : ObserverBase<T>
where T : class
{
private readonly IObservableHolder<T> observableHolder;
private IConsumerWrapper consumer;
public T WrappedInstance { get; }
public PropertyObserver(
IObservableHolder<T> observableHolder,
IPropertyProxyFactory propertyProxyFactory,
IPropertyProxyWrapper propertyProxyWrapper) : base(observableHolder)
{
this.observableHolder = observableHolder;
IPropertyProxy propertyProxy = propertyProxyFactory.Create(observableHolder.RootObservableProperty);
WrappedInstance = propertyProxyWrapper.WrapPropertyObservable<T>(propertyProxy);
PlantSubscriber(propertyProxy);
}
public void SetConsumer(IBlazorMobxComponent consumer)
{
Contract.Requires(consumer == null);
this.consumer = new MobxConsumerWrapper(consumer);
}
public void InitializeValues(T instance)
{
observableHolder.RootObservableProperty.OverwriteFrom(instance, false);
}
private void PlantSubscriber(IPropertyProxy propertyProxy)
{
propertyProxy.Subscribe(new PropertyAccessedSubscriber(OnPropertyAccessed));
}
protected override void OnPropertyAccessedEvent(object sender, PropertyAccessedEventArgs e)
{
if (!consumer.IsAlive())
{
return;
}
base.OnPropertyAccessedEvent(sender, e);
}
protected override async ValueTask<bool> TryInvokeAsync(ObservablePropertyStateChangedArgs e)
{
if (!consumer.IsAlive())
{
return true;
}
IObservableProperty observableProperty = e.ObservableProperty;
string propertyName = e.PropertyInfo.Name;
if (observableContainers.TryGetValue(observableProperty, out IObservableContainer container))
{
if (container.IsSubscribed(propertyName))
{
await consumer.ForceUpdate();
return true;
}
}
return false;
}
protected override async ValueTask<bool> TryInvokeAsync(ObservableCollectionItemsChangedArgs e)
{
if (!consumer.IsAlive())
{
return true;
}
if (e.NewCount != e.OldCount || e.ItemsAdded.Any() || e.ItemsRemoved.Any())
{
await consumer.ForceUpdate();
return true;
}
return false;
}
protected override ValueTask<bool> TryInvokeAsync(ComputedValueChangedArgs e)
{
throw new NotImplementedException();
}
}
}
| 30.785047 | 112 | 0.624469 | [
"MIT"
] | vrsekdev/vrsekdev-framework | src/Blazor.Mobx.Core/PropertyObservers/PropertyObserver.cs | 3,296 | C# |
namespace mcswlib.ServerStatus.Event
{
public abstract class EventBase
{
protected EventMessages messages;
internal EventBase(EventMessages msg)
{
messages = msg;
}
/// <summary>
/// This function needs to be overwritten to return the event-specific message
/// </summary>
/// <returns></returns>
public override string ToString() { return GetType().FullName; }
}
} | 26 | 90 | 0.587607 | [
"MIT"
] | Hexxonite/mcswlib | mcswlib/ServerStatus/Event/EventBase.cs | 470 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.Management.Storage.Models;
namespace Azure.Management.Storage
{
internal partial class TableRestOperations
{
private string subscriptionId;
private Uri endpoint;
private string apiVersion;
private ClientDiagnostics _clientDiagnostics;
private HttpPipeline _pipeline;
/// <summary> Initializes a new instance of TableRestOperations. </summary>
/// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
/// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
/// <param name="subscriptionId"> The ID of the target subscription. </param>
/// <param name="endpoint"> server parameter. </param>
/// <param name="apiVersion"> Api Version. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionId"/> or <paramref name="apiVersion"/> is null. </exception>
public TableRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null, string apiVersion = "2019-06-01")
{
if (subscriptionId == null)
{
throw new ArgumentNullException(nameof(subscriptionId));
}
endpoint ??= new Uri("https://management.azure.com");
if (apiVersion == null)
{
throw new ArgumentNullException(nameof(apiVersion));
}
this.subscriptionId = subscriptionId;
this.endpoint = endpoint;
this.apiVersion = apiVersion;
_clientDiagnostics = clientDiagnostics;
_pipeline = pipeline;
}
internal HttpMessage CreateCreateRequest(string resourceGroupName, string accountName, string tableName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Put;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
uri.AppendPath(accountName, true);
uri.AppendPath("/tableServices/default/tables/", false);
uri.AppendPath(tableName, true);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Creates a new table with the specified table name, under the specified account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public async Task<Response<Table>> CreateAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateCreateRequest(resourceGroupName, accountName, tableName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Creates a new table with the specified table name, under the specified account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public Response<Table> Create(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateCreateRequest(resourceGroupName, accountName, tableName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accountName, string tableName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Patch;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
uri.AppendPath(accountName, true);
uri.AppendPath("/tableServices/default/tables/", false);
uri.AppendPath(tableName, true);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Creates a new table with the specified table name, under the specified account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public async Task<Response<Table>> UpdateAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateUpdateRequest(resourceGroupName, accountName, tableName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Creates a new table with the specified table name, under the specified account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public Response<Table> Update(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateUpdateRequest(resourceGroupName, accountName, tableName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string tableName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
uri.AppendPath(accountName, true);
uri.AppendPath("/tableServices/default/tables/", false);
uri.AppendPath(tableName, true);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Gets the table with the specified table name, under the specified account if it exists. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public async Task<Response<Table>> GetAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateGetRequest(resourceGroupName, accountName, tableName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Gets the table with the specified table name, under the specified account if it exists. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public Response<Table> Get(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateGetRequest(resourceGroupName, accountName, tableName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
Table value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = Table.DeserializeTable(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, string tableName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Delete;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
uri.AppendPath(accountName, true);
uri.AppendPath("/tableServices/default/tables/", false);
uri.AppendPath(tableName, true);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Deletes the table with the specified table name, under the specified account if it exists. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateDeleteRequest(resourceGroupName, accountName, tableName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 204:
return message.Response;
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Deletes the table with the specified table name, under the specified account if it exists. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of only alphanumeric characters and it cannot begin with a numeric character. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="accountName"/>, or <paramref name="tableName"/> is null. </exception>
public Response Delete(string resourceGroupName, string accountName, string tableName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
if (tableName == null)
{
throw new ArgumentNullException(nameof(tableName));
}
using var message = CreateDeleteRequest(resourceGroupName, accountName, tableName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 204:
return message.Response;
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
internal HttpMessage CreateListRequest(string resourceGroupName, string accountName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendPath("/subscriptions/", false);
uri.AppendPath(subscriptionId, true);
uri.AppendPath("/resourceGroups/", false);
uri.AppendPath(resourceGroupName, true);
uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
uri.AppendPath(accountName, true);
uri.AppendPath("/tableServices/default/tables", false);
uri.AppendQuery("api-version", apiVersion, true);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Gets a list of all the tables under the specified storage account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="accountName"/> is null. </exception>
public async Task<Response<ListTableResource>> ListAsync(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
using var message = CreateListRequest(resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
ListTableResource value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = ListTableResource.DeserializeListTableResource(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Gets a list of all the tables under the specified storage account. </summary>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="accountName"/> is null. </exception>
public Response<ListTableResource> List(string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
using var message = CreateListRequest(resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
ListTableResource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = ListTableResource.DeserializeListTableResource(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string accountName)
{
var message = _pipeline.CreateMessage();
var request = message.Request;
request.Method = RequestMethod.Get;
var uri = new RawRequestUriBuilder();
uri.Reset(endpoint);
uri.AppendRawNextLink(nextLink, false);
request.Uri = uri;
request.Headers.Add("Accept", "application/json");
return message;
}
/// <summary> Gets a list of all the tables under the specified storage account. </summary>
/// <param name="nextLink"> The URL to the next page of results. </param>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="resourceGroupName"/>, or <paramref name="accountName"/> is null. </exception>
public async Task<Response<ListTableResource>> ListNextPageAsync(string nextLink, string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
if (nextLink == null)
{
throw new ArgumentNullException(nameof(nextLink));
}
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
switch (message.Response.Status)
{
case 200:
{
ListTableResource value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = ListTableResource.DeserializeListTableResource(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false);
}
}
/// <summary> Gets a list of all the tables under the specified storage account. </summary>
/// <param name="nextLink"> The URL to the next page of results. </param>
/// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The name is case insensitive. </param>
/// <param name="accountName"> The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="nextLink"/>, <paramref name="resourceGroupName"/>, or <paramref name="accountName"/> is null. </exception>
public Response<ListTableResource> ListNextPage(string nextLink, string resourceGroupName, string accountName, CancellationToken cancellationToken = default)
{
if (nextLink == null)
{
throw new ArgumentNullException(nameof(nextLink));
}
if (resourceGroupName == null)
{
throw new ArgumentNullException(nameof(resourceGroupName));
}
if (accountName == null)
{
throw new ArgumentNullException(nameof(accountName));
}
using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName);
_pipeline.Send(message, cancellationToken);
switch (message.Response.Status)
{
case 200:
{
ListTableResource value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = ListTableResource.DeserializeListTableResource(document.RootElement);
return Response.FromValue(value, message.Response);
}
default:
throw _clientDiagnostics.CreateRequestFailedException(message.Response);
}
}
}
}
| 57.50084 | 239 | 0.628036 | [
"MIT"
] | Banani-Rath/azure-sdk-for-net | sdk/testcommon/Azure.Management.Storage.2019_06/src/Generated/TableRestOperations.cs | 34,213 | C# |
using Windows.UI.Xaml.Media.Imaging;
namespace Locana.DataModel
{
public class ImageDataSource : ObservableBase
{
private BitmapImage _Image = null;
public BitmapImage Image
{
set
{
_Image = value;
NotifyChanged(nameof(Image));
}
get
{
return _Image;
}
}
public LiveviewScreenViewData ScreenViewData { get; set; }
}
}
| 21.5 | 67 | 0.474806 | [
"MIT"
] | jeremygraziano/locanat1 | Locana/DataModel/ImageDataSource.cs | 518 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Xania.DataAccess
{
public class TransientObjectStore<TModel> : IObjectStore<TModel>
where TModel : new()
{
private static readonly List<TModel> Items;
static TransientObjectStore()
{
Items = new List<TModel>();
}
public void Add(TModel model)
{
Items.Add(model);
}
public IEnumerator<TModel> GetEnumerator()
{
return Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public TModel Create()
{
return new TModel();
}
public Task<TModel> AddAsync(TModel model)
{
Items.Add(model);
return Task.FromResult(model);
}
public Task DeleteAsync(Expression<Func<TModel, bool>> condition)
{
var compiled = condition.Compile();
Items.RemoveAll(m => compiled(m));
return Task.CompletedTask;
}
public Task UpdateAsync(TModel model)
{
return Task.CompletedTask;
}
}
} | 22.824561 | 73 | 0.558032 | [
"MIT"
] | ibrahimbensalah/Xania | Xania.DataAccess/TransientObjectStore.cs | 1,303 | C# |
using Net.Pkcs11Interop.Common;
using RutokenPkcs11Interop.Common;
using RutokenPkcs11Interop.LowLevelAPI81;
namespace RutokenPkcs11Interop.HighLevelAPI81
{
public class VolumeInfoExtended : VolumeInfo
{
public ulong VolumeId { get; }
internal VolumeInfoExtended(CK_VOLUME_INFO_EXTENDED ckVolumeInfoExtended)
{
VolumeId = ckVolumeInfoExtended.VolumeId;
VolumeSize = ckVolumeInfoExtended.VolumeSize;
AccessMode = (FlashAccessMode) ckVolumeInfoExtended.AccessMode;
VolumeOwner = (CKU) ckVolumeInfoExtended.VolumeOwner;
Flags = ckVolumeInfoExtended.Flags;
}
}
}
| 31.714286 | 81 | 0.713213 | [
"Apache-2.0"
] | pavelkhrulev/RutokenPkcs11Interop | src/RutokenPkcs11Interop/RutokenPkcs11Interop/HighLevelAPI81/VolumeInfoExtended.cs | 668 | C# |
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.Numerics;
using Veldrid.Utilities;
using Veldrid.ImageSharp;
using Veldrid;
using Enigma.Graphics.Shaders;
namespace Enigma.Graphics
{
public class Skybox : IRenderable
{
private readonly Image<Rgba32> _front;
private readonly Image<Rgba32> _back;
private readonly Image<Rgba32> _left;
private readonly Image<Rgba32> _right;
private readonly Image<Rgba32> _top;
private readonly Image<Rgba32> _bottom;
// Context objects
private DeviceBuffer _vb;
private DeviceBuffer _ib;
private Pipeline _pipeline;
private Pipeline _reflectionPipeline;
private ResourceSet _resourceSet;
private readonly DisposeCollector _disposeCollector = new DisposeCollector();
public Skybox(
Image<Rgba32> front, Image<Rgba32> back, Image<Rgba32> left,
Image<Rgba32> right, Image<Rgba32> top, Image<Rgba32> bottom)
{
_front = front;
_back = back;
_left = left;
_right = right;
_top = top;
_bottom = bottom;
}
public void CreateDeviceObjects(GraphicsDevice gd, CommandList cl, SceneContext sc)
{
ResourceFactory factory = gd.ResourceFactory;
_vb = factory.CreateBuffer(new BufferDescription(s_vertices.SizeInBytes(), BufferUsage.VertexBuffer));
cl.UpdateBuffer(_vb, 0, s_vertices);
_ib = factory.CreateBuffer(new BufferDescription(s_indices.SizeInBytes(), BufferUsage.IndexBuffer));
cl.UpdateBuffer(_ib, 0, s_indices);
ImageSharpCubemapTexture imageSharpCubemapTexture = new ImageSharpCubemapTexture(_right, _left, _top, _bottom, _back, _front, false);
Texture textureCube = imageSharpCubemapTexture.CreateDeviceTexture(gd, factory);
TextureView textureView = factory.CreateTextureView(new TextureViewDescription(textureCube));
VertexLayoutDescription[] vertexLayouts = new VertexLayoutDescription[]
{
new VertexLayoutDescription(
new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float3))
};
(Shader vs, Shader fs) = StaticResourceCache.GetShaders(gd, gd.ResourceFactory, "Skybox");
_layout = factory.CreateResourceLayout(new ResourceLayoutDescription(
new ResourceLayoutElementDescription("Projection", ResourceKind.UniformBuffer, ShaderStages.Vertex),
new ResourceLayoutElementDescription("View", ResourceKind.UniformBuffer, ShaderStages.Vertex),
new ResourceLayoutElementDescription("CubeTexture", ResourceKind.TextureReadOnly, ShaderStages.Fragment),
new ResourceLayoutElementDescription("CubeSampler", ResourceKind.Sampler, ShaderStages.Fragment)));
GraphicsPipelineDescription pd = new GraphicsPipelineDescription(
BlendStateDescription.SingleAlphaBlend,
gd.IsDepthRangeZeroToOne ? DepthStencilStateDescription.DepthOnlyGreaterEqual : DepthStencilStateDescription.DepthOnlyLessEqual,
new RasterizerStateDescription(FaceCullMode.None, PolygonFillMode.Solid, FrontFace.Clockwise, true, true),
PrimitiveTopology.TriangleList,
new ShaderSetDescription(vertexLayouts, new[] { vs, fs }, ShaderHelper.GetSpecializations(gd)),
new ResourceLayout[] { _layout },
sc.MainSceneFramebuffer.OutputDescription);
_pipeline = factory.CreateGraphicsPipeline(ref pd);
pd.Outputs = sc.ReflectionFramebuffer.OutputDescription;
_reflectionPipeline = factory.CreateGraphicsPipeline(ref pd);
_resourceSet = factory.CreateResourceSet(new ResourceSetDescription(
_layout,
sc.ProjectionMatrixBuffer,
sc.ViewMatrixBuffer,
textureView,
gd.PointSampler));
_disposeCollector.Add(_vb, _ib, textureCube, textureView, _layout, _pipeline, _reflectionPipeline, _resourceSet, vs, fs);
}
public void UpdatePerFrameResources(GraphicsDevice gd, CommandList cl, SceneContext sc)
{
}
public void Dispose()
{
_disposeCollector.DisposeAll();
}
public void Render(GraphicsDevice gd, CommandList cl, SceneContext sc, RenderPasses renderPass)
{
cl.SetVertexBuffer(0, _vb);
cl.SetIndexBuffer(_ib, IndexFormat.UInt16);
cl.SetPipeline(renderPass == RenderPasses.ReflectionMap ? _reflectionPipeline : _pipeline);
cl.SetGraphicsResourceSet(0, _resourceSet);
Texture texture = renderPass == RenderPasses.ReflectionMap ? sc.ReflectionColorTexture : sc.MainSceneColorTexture;
float depth = gd.IsDepthRangeZeroToOne ? 0 : 1;
cl.SetViewport(0, new Viewport(0, 0, texture.Width, texture.Height, depth, depth));
cl.DrawIndexed((uint)s_indices.Length, 1, 0, 0, 0);
cl.SetViewport(0, new Viewport(0, 0, texture.Width, texture.Height, 0, 1));
}
public RenderPasses RenderPasses => RenderPasses.Standard | RenderPasses.ReflectionMap;
public RenderOrderKey GetRenderOrderKey(Vector3 cameraPosition)
{
return new RenderOrderKey(ulong.MaxValue);
}
private static readonly VertexPosition[] s_vertices = new VertexPosition[]
{
// Top
new VertexPosition(new Vector3(-20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(20.0f,20.0f,20.0f)),
new VertexPosition(new Vector3(-20.0f,20.0f,20.0f)),
// Bottom
new VertexPosition(new Vector3(-20.0f,-20.0f,20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,-20.0f)),
new VertexPosition(new Vector3(-20.0f,-20.0f,-20.0f)),
// Left
new VertexPosition(new Vector3(-20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(-20.0f,20.0f,20.0f)),
new VertexPosition(new Vector3(-20.0f,-20.0f,20.0f)),
new VertexPosition(new Vector3(-20.0f,-20.0f,-20.0f)),
// Right
new VertexPosition(new Vector3(20.0f,20.0f,20.0f)),
new VertexPosition(new Vector3(20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,-20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,20.0f)),
// Back
new VertexPosition(new Vector3(20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(-20.0f,20.0f,-20.0f)),
new VertexPosition(new Vector3(-20.0f,-20.0f,-20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,-20.0f)),
// Front
new VertexPosition(new Vector3(-20.0f,20.0f,20.0f)),
new VertexPosition(new Vector3(20.0f,20.0f,20.0f)),
new VertexPosition(new Vector3(20.0f,-20.0f,20.0f)),
new VertexPosition(new Vector3(-20.0f,-20.0f,20.0f)),
};
private static readonly ushort[] s_indices = new ushort[]
{
0,1,2, 0,2,3,
4,5,6, 4,6,7,
8,9,10, 8,10,11,
12,13,14, 12,14,15,
16,17,18, 16,18,19,
20,21,22, 20,22,23,
};
private ResourceLayout _layout;
}
} | 46.03012 | 145 | 0.637875 | [
"MIT"
] | wings-studio/Enigma.Graphics | Enigma.Graphics/Objects/Skybox.cs | 7,643 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public enum Menu { None, Pause, Inv , Death, Screen, Debug, Options, Keypad};
public class SCP_UI : MonoBehaviour
{
public static SCP_UI instance = null;
public Image eyes, eyegraphics, infectiongraphic;
public Canvas PauseM;
public Transform CanvasPos;
public GameObject canvas, SNav, notifprefab;
public Canvas Inventory, Death, Screen, Options;
public Image ScreenText;
public Canvas HUD;
public EventSystem menu;
public AudioClip[] inventory;
public AudioClip menublip;
public Text Info1, Info2, DeathMSG;
public Button save;
public RadioController radio;
public KeypadController keypad;
public
Menu currMenu = Menu.None;
bool canConsole, canTuto, canPause;
public Image Overlay, handEquip, navBar;
public SegmentedSlider blinkBar, runBar;
public GameObject defInv, defPause, hand;
// Start is called before the first frame update
void Awake()
{
if (instance == null)
instance = this;
else if (instance != null)
Destroy(gameObject);
canPause = false;
}
public void EnableMenu()
{
canPause = true;
}
public void ItemSFX(int sfx)
{
GameController.instance.MenuSFX.PlayOneShot(inventory[sfx]);
}
public void TogglePauseMenu()
{
if (currMenu == Menu.Pause)
{
SCPInput.instance.ToGameplay();
GameController.instance.MenuSFX.PlayOneShot(menublip);
PauseM.enabled = false;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
Time.timeScale = 1.0f;
currMenu = Menu.None;
AudioListener.pause = false;
return;
}
if (currMenu == Menu.None&&canPause)
{
Info1.text = string.Format(Localization.GetString("uiStrings", "ui_in_info"), GlobalValues.design, GlobalValues.playername, GlobalValues.mapname, GlobalValues.mapseed);
SCPInput.instance.ToUI();
PauseM.enabled = true;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
Time.timeScale = 0f;
currMenu = Menu.Pause;
AudioListener.pause = true;
return;
}
}
public void ToggleOptionsMenu()
{
if (currMenu == Menu.Options)
{
GameController.instance.MenuSFX.PlayOneShot(menublip);
Options.enabled = false;
PauseM.enabled = true;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
Time.timeScale = 0f;
currMenu = Menu.Pause;
AudioListener.pause = true;
GameController.instance.LoadUserValues();
return;
}
if (currMenu == Menu.None || currMenu == Menu.Pause)
{
GameController.instance.MenuSFX.PlayOneShot(menublip);
PauseM.enabled = false;
Options.enabled = true;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
Time.timeScale = 0f;
currMenu = Menu.Options;
AudioListener.pause = true;
return;
}
}
public void ToggleInventory()
{
if (currMenu == Menu.Inv)
{
SCPInput.instance.ToGameplay();
Inventory.enabled = false;
Time.timeScale = 1.0f;
ItemController.instance.CloseInv();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
currMenu = Menu.None;
AudioListener.pause = false;
return;
}
if (currMenu == Menu.None)
{
SCPInput.instance.ToUI();
ItemController.instance.OpenInv();
Inventory.enabled = true;
Time.timeScale = 0f;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
currMenu = Menu.Inv;
menu.SetSelectedGameObject(defInv);
AudioListener.pause = true;
return;
}
}
public void ToggleDeath()
{
if (currMenu == Menu.Death)
{
SCPInput.instance.ToGameplay();
DeathMSG.text = GameController.instance.deathmsg;
Death.enabled = false;
Time.timeScale = 1.0f;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
currMenu = Menu.None;
return;
}
else
{
SCPInput.instance.ToUI();
if (!GlobalValues.hasSaved)
save.interactable = false;
else
save.interactable = true;
Info2.text = string.Format(Localization.GetString("uiStrings", "ui_in_info"), GlobalValues.design, GlobalValues.playername, GlobalValues.mapname, GlobalValues.mapseed);
DeathMSG.text = GameController.instance.deathmsg;
Death.enabled = true;
Time.timeScale = 1.0f;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
currMenu = Menu.Death;
return;
}
}
public void ToggleScreen()
{
if (currMenu == Menu.Screen)
{
Screen.enabled = false;
GameController.instance.MenuSFX.PlayOneShot(menublip);
/*Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;*/
currMenu = Menu.None;
return;
}
if (currMenu == Menu.None)
{
Screen.enabled = true;
/*Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;*/
currMenu = Menu.Screen;
return;
}
}
public void ToggleKeypad(Object_Keypad keypadObject)
{
if (currMenu == Menu.Keypad)
{
SCPInput.instance.ToGameplay();
GameController.instance.MenuSFX.PlayOneShot(menublip);
keypad.disableKeypad();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
/*GameController.instance.player.GetComponent<Player_Control>().Freeze = false;
GameController.instance.player.GetComponent<Player_Control>().checkObjects = true;
GameController.instance.player.GetComponent<Player_Control>().StopLook();*/
currMenu = Menu.None;
return;
}
if (currMenu == Menu.None)
{
SCPInput.instance.ToUI();
keypad.enableKeypad(keypadObject);
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
currMenu = Menu.Keypad;
//SCP_UI.instance.ToggleScreen();
/*GameController.instance.player.GetComponent<Player_Control>().Freeze = true;
GameController.instance.player.GetComponent<Player_Control>().ForceLook(keypadObject.transform.position, 4f);*/
return;
}
}
public bool ToggleConsole()
{
if (canConsole)
{
if (currMenu == Menu.Debug)
{
SCPInput.instance.ToGameplay();
Time.timeScale = 1.0f;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
currMenu = Menu.None;
return (false);
}
if (currMenu == Menu.None)
{
SCPInput.instance.ToUI();
Time.timeScale = 0f;
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
currMenu = Menu.Debug;
return (true);
}
}
return (false);
}
public void LoadValues()
{
canConsole = (PlayerPrefs.GetInt("Debug", 0) == 1);
canTuto = (PlayerPrefs.GetInt("Tutorials", 1) == 1);
}
public void ShowTutorial(string tuto)
{
if (canTuto)
{
GameObject notif = Instantiate(notifprefab, canvas.transform);
NotifSystem notifval = notif.GetComponent<NotifSystem>();
notifval.image.sprite = Resources.Load<Sprite>("Tutorials/" + tuto);
notifval.body.text = Localization.GetString("tutoStrings", tuto);
}
}
}
| 30.765343 | 180 | 0.562896 | [
"MIT"
] | lf751/Faithful-SCP-Unity | Assets/Scripts/GameSystem/SCP_UI.cs | 8,524 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TempPlayer : MonoBehaviour
{
[SerializeField] private float xSpeed = 2f;
[SerializeField] private float ySpeed = 10f;
private bool enabledInteraction;
private string keyInteract;
private bool showInventory = false;
private Vector3 lastPosition;
private ParticleSystem myParticleSystem;
private Animator animator;
private bool interacting = false;
void Start()
{
myParticleSystem = GetComponent<ParticleSystem>();
animator = GetComponent<Animator>();
myParticleSystem.Stop();
}
private void Update()
{
if (Input.GetButtonDown("Interact") && enabledInteraction) {
interacting = !interacting;
Director.Instance.Interact(keyInteract, this);
}
if (!interacting) {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
var horizontal = moveHorizontal * xSpeed * Time.deltaTime;
var vertical = moveVertical * ySpeed * Time.deltaTime;
this.transform.position = this.transform.position + (new Vector3(horizontal, vertical, 0));
var moveY = lastPosition - this.transform.position;
//this.transform.localScale = this.transform.localScale + (new Vector3(moveY.y, moveY.y, 0));
lastPosition = this.transform.position;
}
}
public void EnableInteract(string key)
{
this.keyInteract = key;
enabledInteraction = true;
}
public void DisableInteract()
{
this.keyInteract = "";
enabledInteraction = false;
}
public void AlowInteracting()
{
interacting = false;
}
public void Possess()
{
myParticleSystem.Play();
animator.SetTrigger("Possess");
}
private void OnTriggerStay2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Interactor") && interacting)
{
var interactor = collision.gameObject.GetComponent<Door>();
collision.enabled = !interactor.NoReointeracting;
}
}
}
| 26.880952 | 105 | 0.627989 | [
"MIT"
] | eldroan/GlobalGameJam2020 | GlobalGameJam2020/Assets/Scripts/TempPlayer.cs | 2,260 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Volpanic.Easing;
namespace Volpanic.UITweening
{
public class MoveRectEffect : IUIEffect
{
private RectTransform rectTransform;
private Vector3 targetPosition;
private TweenData tweenData;
private YieldInstruction wait;
public MoveRectEffect(RectTransform rectTransform, Vector3 targetPosition,bool localPosition, YieldInstruction wait,
TweenData tweenData)
{
this.rectTransform = rectTransform;
this.targetPosition = (localPosition)? targetPosition + rectTransform.position : targetPosition;
this.wait = wait;
this.tweenData = tweenData;
}
public IEnumerator Execute()
{
float timer = 0f;
Vector3 currentPosition = rectTransform.position;
Vector3 startPos = currentPosition;
while (rectTransform.position != targetPosition)
{
timer = Mathf.Clamp(timer + Time.deltaTime,0, tweenData.Duration);
Vector3 position = new Vector3(0,0,0);
position.x = tweenData.EasingFunction(currentPosition.x, targetPosition.x,timer / tweenData.Duration);
position.y = tweenData.EasingFunction(currentPosition.y, targetPosition.y,timer / tweenData.Duration);
position.z = tweenData.EasingFunction(currentPosition.z, targetPosition.z,timer / tweenData.Duration);
rectTransform.position = position;
yield return null;
}
yield return wait;
if (tweenData.ReturnAfter)
{
timer = 0f;
currentPosition = rectTransform.position;
while (rectTransform.position != Vector3.one)
{
timer = Mathf.Clamp(timer + Time.deltaTime, 0, tweenData.Duration);
Vector3 position = new Vector3(0, 0, 0);
position.x = tweenData.EasingFunction(currentPosition.x, startPos.x, timer / tweenData.Duration);
position.y = tweenData.EasingFunction(currentPosition.y, startPos.y, timer / tweenData.Duration);
position.z = tweenData.EasingFunction(currentPosition.z, startPos.z, timer / tweenData.Duration);
rectTransform.position = position;
yield return null;
}
}
tweenData.CompleteEvent?.Invoke();
}
}
} | 38.176471 | 124 | 0.604006 | [
"MIT"
] | Volpanic/UntiyTweenLibrary | Tweening/Scripts/Effects/MoveRectEffect.cs | 2,596 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Azure.Analytics.Synapse.ManagedPrivateEndpoints.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")]
[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Synapse")]
| 79 | 419 | 0.908228 | [
"MIT"
] | 0rland0Wats0n/azure-sdk-for-net | sdk/synapse/Azure.Analytics.Synapse.ManagedPrivateEndpoints/src/Properties/AssemblyInfo.cs | 632 | C# |
using BotEngine;
namespace Sanderling.Interface.MemoryStruct
{
public class WindowAgentBrowser : WindowAgent, IWindowAgent, IWindow, IContainer, IUIElement, IObjectIdInMemory, IObjectIdInt64
{
public WindowAgentBrowser(WindowAgent @base)
: base(@base)
{
}
public WindowAgentBrowser()
{
}
}
}
| 18.352941 | 128 | 0.753205 | [
"Apache-2.0"
] | Fulborg/A-Bot | src/Sanderling.Interface/Sanderling.Interface.MemoryStruct/WindowAgentBrowser.cs | 312 | C# |
using QuickGraph;
using System.Collections.Generic;
namespace KNNonAir.Domain.Entity
{
public class VoronoiCell
{
public Vertex PoI { get; set; }
public RoadGraph Road { get; set; }
public List<Vertex> BorderPoints { get; set; }
public VoronoiCell()
{
PoI = null;
Road = new RoadGraph(false);
BorderPoints = new List<Vertex>();
}
}
}
| 21.65 | 54 | 0.56582 | [
"MIT"
] | lohas1107/knn-on-air | KNNonAir/Domain/Entity/VoronoiCell.cs | 435 | C# |
using System.Web.Optimization;
namespace O365_WebApp_MultiTenant
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
// Set EnableOptimizations to false for debugging. For more information,
// visit http://go.microsoft.com/fwlink/?LinkId=301862
BundleTable.EnableOptimizations = true;
}
}
}
| 41.114286 | 112 | 0.585823 | [
"Apache-2.0"
] | OfficeDev/O365-WebApp-MultiTenant | O365-WebApp-MultiTenant/O365-WebApp-MultiTenant/App_Start/BundleConfig.cs | 1,441 | C# |
////////////////////////////////////////////////////////////////////////////////
//NUnit tests for "EF Core Provider for LCPI OLE DB"
// IBProvider and Contributors. 26.04.2019.
//
// DbMath.Abs(<param>)
//
using System;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using xdbfunc=Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb.DbFunctions;
using xdb=lcpi.data.oledb;
namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Funcs.DbMath.SET_001.STD.Abs.Double{
////////////////////////////////////////////////////////////////////////////////
//using
using T_DATA=System.Double;
////////////////////////////////////////////////////////////////////////////////
//class TestSet___param
public static class TestSet___param
{
private const string c_NameOf__TABLE="TEST_MODIFY_ROW";
private const string c_NameOf__COL_DATA="COL_DOUBLE";
private sealed class MyContext:TestBaseDbContext
{
[Table(c_NameOf__TABLE)]
public sealed class TEST_RECORD
{
[Key]
[Column("TEST_ID")]
public System.Int64? TEST_ID { get; set; }
[Column(c_NameOf__COL_DATA)]
public T_DATA DATA { get; set; }
};//class TEST_RECORD
//----------------------------------------------------------------------
public DbSet<TEST_RECORD> testTable { get; set; }
//----------------------------------------------------------------------
public MyContext(xdb.OleDbTransaction tr)
:base(tr)
{
}//MyContext
};//class MyContext
//-----------------------------------------------------------------------
[Test]
public static void Test___P1___ByEF()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA c_data=123;
System.Int64? testID=Helper__InsertRow(db,c_data);
var vv_src=c_data;
var recs=db.testTable.Where(r => xdbfunc.DbMath.Abs(vv_src)==123 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_data,
r.DATA);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ").N("t","TEST_ID").T(" = ").P_ID("__testID_0");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test___P1___ByEF
//-----------------------------------------------------------------------
[Test]
public static void Test___N1___ByEF()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA c_data=-123;
System.Int64? testID=Helper__InsertRow(db,c_data);
var vv_src=c_data;
var recs=db.testTable.Where(r => xdbfunc.DbMath.Abs(vv_src)==123 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_data,
r.DATA);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ").N("t","TEST_ID").T(" = ").P_ID("__testID_0");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test___N1___ByEF
//-----------------------------------------------------------------------
[Test]
public static void Test___01___ByEF()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA c_data=0;
System.Int64? testID=Helper__InsertRow(db,c_data);
var vv_src=c_data;
var recs=db.testTable.Where(r => xdbfunc.DbMath.Abs(vv_src)==0 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_data,
r.DATA);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ").N("t","TEST_ID").T(" = ").P_ID("__testID_0");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test___01___ByEF
//-----------------------------------------------------------------------
[Test]
public static void Test___02___ByEF()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA c_data=-1234;
System.Int64? testID=Helper__InsertRow(db,c_data);
var vv_src=c_data;
var recs=db.testTable.Where(r => xdbfunc.DbMath.Abs(xdbfunc.DbMath.Abs(vv_src))==1234 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_data,
r.DATA);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ").N("t","TEST_ID").T(" = ").P_ID("__testID_0");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test___02___ByEF
//-----------------------------------------------------------------------
[Test]
public static void Test___03___ByEF()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA c_data=-23;
System.Int64? testID=Helper__InsertRow(db,c_data);
var vv_src=c_data;
var recs=db.testTable.Where(r => xdbfunc.DbMath.Abs(2*xdbfunc.DbMath.Abs(vv_src))==46 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_data,
r.DATA);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ").N("t","TEST_ID").T(" = ").P_ID("__testID_0");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test___03___ByEF
//Helper methods --------------------------------------------------------
private static System.Int64 Helper__InsertRow(MyContext db,
T_DATA valueOfData)
{
var newRecord=new MyContext.TEST_RECORD();
newRecord.DATA=valueOfData;
db.testTable.Add(newRecord);
db.SaveChanges();
var sqlt
=new TestSqlTemplate()
.T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA).T(")").EOL()
.T("VALUES (").P("p0").T(")").EOL()
.T("RETURNING ").N("TEST_ID").EOL()
.T("INTO ").P("p1").T(";");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.IsTrue
(newRecord.TEST_ID.HasValue);
Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value);
return newRecord.TEST_ID.Value;
}//Helper__InsertRow
};//class TestSet___param
////////////////////////////////////////////////////////////////////////////////
}//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Funcs.DbMath.SET_001.STD.Abs.Double
| 22.684211 | 115 | 0.539388 | [
"MIT"
] | ibprovider/Lcpi.EFCore.LcpiOleDb | Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D3/Query/Funcs/DbMath/SET_001/STD/Abs/Double/TestSet___param.cs | 9,053 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class Item : MonoBehaviour
{
public enum Type
{
key,
other
}
public Sprite ItemImage;
public Type ItemType;
public Color ItemColor;
public GameObject ItemObj;
public Material DefaultMat;
public float FloatPeriod = 1;
public float FloatAmp = 0.2f;
public float RotateSpeed = 30f;
private float _time;
private Renderer _renderer;
private Material _keyMat;
private void Start()
{
_renderer = ItemObj.GetComponent<Renderer>();
_keyMat = new Material(DefaultMat);
_renderer.material = _keyMat;
}
private void Update()
{
if (_keyMat.color != ItemColor)
{
_keyMat.color = ItemColor;
}
if (Application.isPlaying)
{
_time += Time.deltaTime;
if (_time > FloatPeriod) _time -= FloatPeriod;
ItemObj.transform.localPosition = new Vector3(0, FloatAmp * Mathf.Sin(_time / FloatPeriod * Mathf.PI * 2), 0);
ItemObj.transform.Rotate(Vector3.up, RotateSpeed * Time.deltaTime);
}
}
public ItemInfo Get()
{
var info = new ItemInfo(ItemImage, ItemType, ItemColor);
gameObject.SetActive(false);
return info;
}
}
public class ItemInfo
{
public Sprite ItemImage;
public Item.Type ItemType;
public Color ItemColor;
public ItemInfo(Sprite img, Item.Type type, Color col)
{
ItemImage = img;
ItemType = type;
ItemColor = col;
}
}
| 23.442857 | 122 | 0.618525 | [
"MIT"
] | TrueCyan/Protospace | Assets/Scripts/Item.cs | 1,643 | C# |
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
namespace AmplifyShaderEditor
{
[Serializable]
[NodeAttributes( "Template Vertex Data", "Vertex Data", "Select and use available vertex data from the template" )]
public class TemplateVertexDataNode : ParentNode
{
private const string ErrorMessageStr = "This node can only be used inside a Template category!";
private const string DataLabelStr = "Data";
private List<TemplateVertexData> m_interpolatorData = null;
[SerializeField]
private int m_currentDataIdx = -1;
[SerializeField]
private string m_dataName = string.Empty;
[SerializeField]
private string m_inVarName = string.Empty;
private string[] m_dataLabels = null;
private bool m_fetchDataId = false;
private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper();
protected override void CommonInit( int uniqueId )
{
base.CommonInit( uniqueId );
AddOutputPort( WirePortDataType.FLOAT, "Out" );
AddOutputPort( WirePortDataType.FLOAT, "X" );
AddOutputPort( WirePortDataType.FLOAT, "Y" );
AddOutputPort( WirePortDataType.FLOAT, "Z" );
AddOutputPort( WirePortDataType.FLOAT, "W" );
m_textLabelWidth = 67;
m_hasLeftDropdown = true;
}
public override void AfterCommonInit()
{
base.AfterCommonInit();
if( PaddingTitleLeft == 0 )
{
PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
if( PaddingTitleRight == 0 )
PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin;
}
}
void ConfigurePorts()
{
switch( m_outputPorts[ 0 ].DataType )
{
default:
{
for( int i = 1; i < 5; i++ )
{
m_outputPorts[ i ].Visible = false;
}
}
break;
case WirePortDataType.FLOAT2:
{
for( int i = 1; i < 5; i++ )
{
m_outputPorts[ i ].Visible = ( i < 3 );
if( m_outputPorts[ i ].Visible )
{
m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ];
}
}
}
break;
case WirePortDataType.FLOAT3:
{
for( int i = 1; i < 5; i++ )
{
m_outputPorts[ i ].Visible = ( i < 4 );
if( m_outputPorts[ i ].Visible )
{
m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ];
}
}
}
break;
case WirePortDataType.FLOAT4:
{
for( int i = 1; i < 5; i++ )
{
m_outputPorts[ i ].Visible = true;
m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ];
}
}
break;
case WirePortDataType.COLOR:
{
for( int i = 1; i < 5; i++ )
{
m_outputPorts[ i ].Visible = true;
m_outputPorts[ i ].Name = Constants.ChannelNamesColor[ i - 1 ];
}
}
break;
}
m_sizeIsDirty = true;
}
void FetchDataId()
{
if( m_interpolatorData != null )
{
m_currentDataIdx = 0;
int count = m_interpolatorData.Count;
m_dataLabels = new string[ count ];
for( int i = 0; i < count; i++ )
{
m_dataLabels[ i ] = m_interpolatorData[ i ].VarName;
if( m_interpolatorData[ i ].VarName.Equals( m_dataName ) )
{
m_currentDataIdx = i;
}
}
UpdateFromId();
}
else
{
m_currentDataIdx = -1;
}
}
void UpdateFromId()
{
if( m_interpolatorData != null )
{
bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_interpolatorData[ m_currentDataIdx ].DataType );
switch( m_interpolatorData[ m_currentDataIdx ].DataType )
{
default:
case WirePortDataType.INT:
case WirePortDataType.FLOAT:
m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_interpolatorData[ m_currentDataIdx ].DataType, false );
break;
case WirePortDataType.FLOAT2:
m_outputPorts[ 0 ].ChangeProperties( "XY", m_interpolatorData[ m_currentDataIdx ].DataType, false );
break;
case WirePortDataType.FLOAT3:
m_outputPorts[ 0 ].ChangeProperties( "XYZ", m_interpolatorData[ m_currentDataIdx ].DataType, false );
break;
case WirePortDataType.FLOAT4:
m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_interpolatorData[ m_currentDataIdx ].DataType, false );
break;
case WirePortDataType.COLOR:
m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_interpolatorData[ m_currentDataIdx ].DataType, false );
break;
}
ConfigurePorts();
if( !areCompatible )
{
m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true );
}
m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName;
m_content.text = m_dataName;
m_sizeIsDirty = true;
CheckWarningState();
}
}
void CheckWarningState()
{
if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader )
{
ShowTab( NodeMessageType.Error, ErrorMessageStr );
}
else
{
m_showErrorMessage = false;
}
}
public override void DrawProperties()
{
base.DrawProperties();
if( m_currentDataIdx > -1 )
{
EditorGUI.BeginChangeCheck();
m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr, m_currentDataIdx, m_dataLabels );
if( EditorGUI.EndChangeCheck() )
{
UpdateFromId();
}
}
}
public override void Draw( DrawInfo drawInfo )
{
base.Draw( drawInfo );
if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader )
return;
if( m_interpolatorData == null || m_interpolatorData.Count == 0 )
{
MasterNode masterNode = m_containerGraph.CurrentMasterNode;
if( masterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template )
{
TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate;
if( currentTemplate != null )
{
m_inVarName = currentTemplate.VertexFunctionData.InVarName + ".";
m_interpolatorData = currentTemplate.VertexDataList;
m_fetchDataId = true;
}
}
}
if( m_fetchDataId )
{
m_fetchDataId = false;
FetchDataId();
}
if( m_currentDataIdx > -1 )
{
EditorGUI.BeginChangeCheck();
m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this, m_currentDataIdx, m_dataLabels );
if( EditorGUI.EndChangeCheck() )
{
UpdateFromId();
}
}
}
public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
{
if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template )
{
UIUtils.ShowMessage( "Template Data node is only intended for templates use only" );
return m_outputPorts[ 0 ].ErrorValue;
}
if( dataCollector.IsFragmentCategory )
{
UIUtils.ShowMessage( "Template Data node node is only intended for vertex use use only" );
return m_outputPorts[ 0 ].ErrorValue;
}
return GetOutputVectorItem( 0, outputId, m_inVarName + m_dataName );
}
public override void ReadFromString( ref string[] nodeParams )
{
base.ReadFromString( ref nodeParams );
m_dataName = GetCurrentParam( ref nodeParams );
m_fetchDataId = true;
}
public override void WriteToString( ref string nodeInfo, ref string connectionsInfo )
{
base.WriteToString( ref nodeInfo, ref connectionsInfo );
IOUtils.AddFieldValueToString( ref nodeInfo, m_dataName );
}
public override void OnMasterNodeReplaced( MasterNode newMasterNode )
{
base.OnMasterNodeReplaced( newMasterNode );
if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template )
{
TemplateData currentTemplate = ( newMasterNode as TemplateMasterNode ).CurrentTemplate;
if( currentTemplate != null )
{
m_inVarName = currentTemplate.VertexFunctionData.InVarName + ".";
m_interpolatorData = currentTemplate.VertexDataList;
FetchDataId();
}
else
{
m_interpolatorData = null;
m_currentDataIdx = -1;
}
}
else
{
m_interpolatorData = null;
m_currentDataIdx = -1;
}
}
public override void Destroy()
{
base.Destroy();
m_dataLabels = null;
m_interpolatorData = null;
m_upperLeftWidgetHelper = null;
}
}
}
| 26.730519 | 148 | 0.673388 | [
"Apache-2.0"
] | Eresia/Harpooneers | Assets/Plugins/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs | 8,233 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace myreact.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
| 26.458333 | 89 | 0.674016 | [
"MIT"
] | CapitanFuture/LockbaseELI | backend/ui/Pages/Error.cshtml.cs | 635 | C# |
namespace BloodDonation.Web.Tests
{
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Xunit;
public class WebTests : IClassFixture<WebApplicationFactory<Startup>>
{
private readonly WebApplicationFactory<Startup> server;
public WebTests(WebApplicationFactory<Startup> server)
{
this.server = server;
}
[Fact(Skip = "Example test. Disabled for CI.")]
public async Task IndexPageShouldReturnStatusCode200WithTitle()
{
var client = this.server.CreateClient();
var response = await client.GetAsync("/");
response.EnsureSuccessStatusCode();
var responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains("<title>", responseContent);
}
[Fact(Skip = "Example test. Disabled for CI.")]
public async Task AccountManagePageRequiresAuthorization()
{
var client = this.server.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false });
var response = await client.GetAsync("Identity/Account/Manage");
Assert.Equal(HttpStatusCode.Redirect, response.StatusCode);
}
}
}
| 33.710526 | 120 | 0.651054 | [
"Apache-2.0"
] | ViktorNikoloov/ASP.NET-Core-Project-Blood-Donation-System | src/Tests/BloodDonation.Web.Tests/WebTests.cs | 1,283 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Configuration;
using EnterpriseLibrary.Common;
using EnterpriseLibrary.Common.Configuration;
using EnterpriseLibrary.Common.Configuration.Design;
using EnterpriseLibrary.PolicyInjection.CallHandlers;
using Unity;
using Unity.Injection;
using Unity.Interception.PolicyInjection.Pipeline;
namespace EnterpriseLibrary.PolicyInjection.Configuration
{
/// <summary>
/// A configuration element that stores information for the <see cref="PerformanceCounterCallHandler"/>.
/// </summary>
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataDisplayName")]
public class PerformanceCounterCallHandlerData : CallHandlerData
{
private const string CategoryNamePropertyName = "categoryName";
private const string InstanceNamePropertyName = "instanceName";
private const string UseTotalCounterPropertyName = "useTotalCounter";
private const string IncrementNumberOfCallsPropertyName = "incrementNumberOfCalls";
private const string IncrementCallsPerSecondPropertyName = "incrementCallsPerSecond";
private const string IncrementAverageCallDurationPropertyName = "incrementAverageCallDuration";
private const string IncrementTotalExceptionsPropertyName = "incrementTotalExceptions";
private const string IncrementExceptionsPerSecondPropertyName = "incrementExceptionsPerSecond";
/// <summary>
/// Construct a new <see cref="PerformanceCounterCallHandlerData"/>.
/// </summary>
public PerformanceCounterCallHandlerData()
{
Type = typeof(PerformanceCounterCallHandler);
}
/// <summary>
/// Construct a new <see cref="PerformanceCounterCallHandlerData"/>.
/// </summary>
/// <param name="instanceName">Name of the handler section.</param>
public PerformanceCounterCallHandlerData(string instanceName)
: base(instanceName, typeof(PerformanceCounterCallHandler))
{
}
/// <summary>
/// Construct a new <see cref="PerformanceCounterCallHandlerData"/>.
/// </summary>
/// <param name="instanceName">Name of the handler section.</param>
/// <param name="handlerOrder">Order of the handler.</param>
public PerformanceCounterCallHandlerData(string instanceName, int handlerOrder)
: base(instanceName, typeof(PerformanceCounterCallHandler))
{
this.Order = handlerOrder;
}
/// <summary>
/// Performance counter category name.
/// </summary>
/// <value>The "categoryName" config attribute.</value>
[ConfigurationProperty(CategoryNamePropertyName, IsRequired = true)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataCategoryNameDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataCategoryNameDisplayName")]
public string CategoryName
{
get { return (string)base[CategoryNamePropertyName]; }
set { base[CategoryNamePropertyName] = value; }
}
/// <summary>
/// Performance counter instance name.
/// </summary>
/// <remarks>This string may include substitution tokens. See <see cref="MethodInvocationFormatter"/>
/// for the list of tokens.</remarks>
/// <value>The "instanceName" config attribute.</value>
[ConfigurationProperty(InstanceNamePropertyName, IsRequired = true)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataInstanceNameDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataInstanceNameDisplayName")]
public string InstanceName
{
get { return (string)base[InstanceNamePropertyName]; }
set { base[InstanceNamePropertyName] = value; }
}
/// <summary>
/// Increment "Total" counter instance.
/// </summary>
/// <value>The "useTotalCounter" config attribute.</value>
[ConfigurationProperty(UseTotalCounterPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.UseTotalCounter)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataUseTotalCounterDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataUseTotalCounterDisplayName")]
public bool UseTotalCounter
{
get { return (bool)base[UseTotalCounterPropertyName]; }
set { base[UseTotalCounterPropertyName] = value; }
}
/// <summary>
/// Increment the "total # of calls" counter?
/// </summary>
/// <value>The "incrementNumberOfCalls" config attribute.</value>
[ConfigurationProperty(IncrementNumberOfCallsPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.IncrementNumberOfCalls)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementNumberOfCallsDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementNumberOfCallsDisplayName")]
public bool IncrementNumberOfCalls
{
get { return (bool)base[IncrementNumberOfCallsPropertyName]; }
set { base[IncrementNumberOfCallsPropertyName] = value; }
}
/// <summary>
/// Increment the "calls / second" counter?
/// </summary>
/// <value>the "incrementCallsPerSecond" config attribute.</value>
[ConfigurationProperty(IncrementCallsPerSecondPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.IncrementCallsPerSecond)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementCallsPerSecondDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementCallsPerSecondDisplayName")]
public bool IncrementCallsPerSecond
{
get { return (bool)base[IncrementCallsPerSecondPropertyName]; }
set { base[IncrementCallsPerSecondPropertyName] = value; }
}
/// <summary>
/// Increment "average seconds / call" counter?
/// </summary>
/// <value>The "incrementAverageCallDuration" config attribute.</value>
[ConfigurationProperty(IncrementAverageCallDurationPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.IncrementAverageCallDuration)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementAverageCallDurationDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementAverageCallDurationDisplayName")]
public bool IncrementAverageCallDuration
{
get { return (bool)base[IncrementAverageCallDurationPropertyName]; }
set { base[IncrementAverageCallDurationPropertyName] = value; }
}
/// <summary>
/// Increment "total # of exceptions" counter?
/// </summary>
/// <value>The "incrementTotalExceptions" config attribute.</value>
[ConfigurationProperty(IncrementTotalExceptionsPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.IncrementTotalExceptions)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementTotalExceptionsDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementTotalExceptionsDisplayName")]
public bool IncrementTotalExceptions
{
get { return (bool)base[IncrementTotalExceptionsPropertyName]; }
set { base[IncrementTotalExceptionsPropertyName] = value; }
}
/// <summary>
/// Increment the "exceptions / second" counter?
/// </summary>
/// <value>The "incrementExceptionsPerSecond" config attribute.</value>
[ConfigurationProperty(IncrementExceptionsPerSecondPropertyName,
IsRequired = false,
DefaultValue = PerformanceCounterCallHandlerDefaults.IncrementExceptionsPerSecond)]
[ResourceDescription(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementExceptionsPerSecondDescription")]
[ResourceDisplayName(typeof(DesignResources), "PerformanceCounterCallHandlerDataIncrementExceptionsPerSecondDisplayName")]
public bool IncrementExceptionsPerSecond
{
get { return (bool)base[IncrementExceptionsPerSecondPropertyName]; }
set { base[IncrementExceptionsPerSecondPropertyName] = value; }
}
/// <summary>
/// Configures an <see cref="IUnityContainer"/> to resolve the represented call handler by using the specified name.
/// </summary>
/// <param name="container">The container to configure.</param>
/// <param name="registrationName">The name of the registration.</param>
protected override void DoConfigureContainer(IUnityContainer container, string registrationName)
{
container.RegisterType<ICallHandler, PerformanceCounterCallHandler>(
registrationName,
new InjectionConstructor(
this.CategoryName,
this.InstanceName,
this.UseTotalCounter,
this.IncrementNumberOfCalls,
this.IncrementCallsPerSecond,
this.IncrementAverageCallDuration,
this.IncrementTotalExceptions,
this.IncrementExceptionsPerSecond),
new InjectionProperty("Order", this.Order));
}
}
}
| 51.555556 | 130 | 0.697002 | [
"Apache-2.0"
] | EnterpriseLibrary/policy-injection-application-block | source/Src/PolicyInjection/Configuration/PerformanceCounterCallHandlerData.cs | 10,210 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the iot-2015-05-28.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Threading;
using System.Threading.Tasks;
using Amazon.Runtime;
namespace Amazon.IoT.Model
{
/// <summary>
/// Base class for ListThingTypes paginators.
/// </summary>
internal sealed partial class ListThingTypesPaginator : IPaginator<ListThingTypesResponse>, IListThingTypesPaginator
{
private readonly IAmazonIoT _client;
private readonly ListThingTypesRequest _request;
private int _isPaginatorInUse = 0;
/// <summary>
/// Enumerable containing all full responses for the operation
/// </summary>
public IPaginatedEnumerable<ListThingTypesResponse> Responses => new PaginatedResponse<ListThingTypesResponse>(this);
/// <summary>
/// Enumerable containing all of the ThingTypes
/// </summary>
public IPaginatedEnumerable<ThingTypeDefinition> ThingTypes =>
new PaginatedResultKeyResponse<ListThingTypesResponse, ThingTypeDefinition>(this, (i) => i.ThingTypes);
internal ListThingTypesPaginator(IAmazonIoT client, ListThingTypesRequest request)
{
this._client = client;
this._request = request;
}
#if BCL
IEnumerable<ListThingTypesResponse> IPaginator<ListThingTypesResponse>.Paginate()
{
if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
{
throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
}
PaginatorUtils.SetUserAgentAdditionOnRequest(_request);
var nextToken = _request.NextToken;
ListThingTypesResponse response;
do
{
_request.NextToken = nextToken;
response = _client.ListThingTypes(_request);
nextToken = response.NextToken;
yield return response;
}
while (!string.IsNullOrEmpty(nextToken));
}
#endif
#if AWS_ASYNC_ENUMERABLES_API
async IAsyncEnumerable<ListThingTypesResponse> IPaginator<ListThingTypesResponse>.PaginateAsync(CancellationToken cancellationToken = default)
{
if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
{
throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
}
PaginatorUtils.SetUserAgentAdditionOnRequest(_request);
var nextToken = _request.NextToken;
ListThingTypesResponse response;
do
{
_request.NextToken = nextToken;
response = await _client.ListThingTypesAsync(_request, cancellationToken).ConfigureAwait(false);
nextToken = response.NextToken;
cancellationToken.ThrowIfCancellationRequested();
yield return response;
}
while (!string.IsNullOrEmpty(nextToken));
}
#endif
}
} | 39.536082 | 150 | 0.662842 | [
"Apache-2.0"
] | ChristopherButtars/aws-sdk-net | sdk/src/Services/IoT/Generated/Model/_bcl45+netstandard/ListThingTypesPaginator.cs | 3,835 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Portions derived from React Native:
// Copyright (c) 2015-present, Facebook, Inc.
// Licensed under the MIT License.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ReactNative.Bridge;
using ReactNative.UIManager;
using ReactNative.UIManager.Annotations;
using ReactNative.Views.Web.Events;
using ReactNativeWebViewBridge;
using System;
using System.Collections.Concurrent;
using Windows.UI.Xaml.Controls;
using Windows.Web.Http;
using static System.FormattableString;
namespace ReactNative.Views.Web
{
/// <summary>
/// A view manager responsible for rendering webview.
/// </summary>
public class ReactWebViewManager : SimpleViewManager<WebView>
{
private const string BLANK_URL = "about:blank";
private const int CommandGoBack = 1;
private const int CommandGoForward = 2;
private const int CommandReload = 3;
private const int CommandStopLoading = 4;
private const int CommandPostMessage = 5;
private const int CommandInjectJavaScript = 6;
private const string BridgeName = "__REACT_WEB_VIEW_BRIDGE";
private readonly ConcurrentDictionary<WebView, WebViewData> _webViewData = new ConcurrentDictionary<WebView, WebViewData>();
private readonly ReactContext _context;
/// <summary>
/// Instantiates the <see cref="ReactWebViewManager"/>.
/// </summary>
/// <param name="context">The React context.</param>
public ReactWebViewManager(ReactContext context)
{
_context = context;
}
/// <summary>
/// The name of the view manager.
/// </summary>
public override string Name
{
get
{
return "RCTWebView";
}
}
/// <summary>
/// The commands map for the webview manager.
/// </summary>
public override JObject ViewCommandsMap
{
get
{
return new JObject
{
{ "goBack", CommandGoBack },
{ "goForward", CommandGoForward },
{ "reload", CommandReload },
{ "stopLoading", CommandStopLoading },
{ "postMessage", CommandPostMessage },
{ "injectJavaScript", CommandInjectJavaScript },
};
}
}
/// <summary>
/// Sets the background color for the <see cref="WebView"/>.
/// </summary>
/// <param name="view">The view instance.</param>
/// <param name="color">The masked color value.</param>
[ReactProp(ViewProps.BackgroundColor, CustomType = "Color")]
public void SetBackgroundColor(WebView view, uint? color)
{
if (color.HasValue)
{
view.DefaultBackgroundColor = ColorHelpers.Parse(color.Value);
}
else
{
view.ClearValue(WebView.DefaultBackgroundColorProperty);
}
}
/// <summary>
/// Sets whether JavaScript is enabled or not.
/// </summary>
/// <param name="view">A webview instance.</param>
/// <param name="enabled">A flag signaling whether JavaScript is enabled.</param>
[ReactProp("javaScriptEnabled")]
public void SetJavaScriptEnabled(WebView view, bool enabled)
{
view.Settings.IsJavaScriptEnabled = enabled;
}
/// <summary>
/// Sets whether Indexed DB is enabled or not.
/// </summary>
/// <param name="view">A webview instance.</param>
/// <param name="enabled">A flag signaling whether Indexed DB is enabled.</param>
[ReactProp("indexedDbEnabled")]
public void SetIndexedDbEnabled(WebView view, bool enabled)
{
view.Settings.IsIndexedDBEnabled = enabled;
}
/// <summary>
/// Sets the JavaScript to be injected when the page loads.
/// </summary>
/// <param name="view">A view instance.</param>
/// <param name="injectedJavaScript">The JavaScript to inject.</param>
[ReactProp("injectedJavaScript")]
public void SetInjectedJavaScript(WebView view, string injectedJavaScript)
{
var webViewData = GetWebViewData(view);
webViewData.InjectedJavaScript = injectedJavaScript;
}
/// <summary>
/// Toggles whether messaging is enabled for the <see cref="WebView"/>.
/// </summary>
/// <param name="view">The view instance.</param>
/// <param name="messagingEnabled">
/// <code>true</code> if messaging is allowed, otherwise <code>false</code>.
/// </param>
[ReactProp("messagingEnabled")]
public void SetMessagingEnabled(WebView view, bool messagingEnabled)
{
var webViewData = GetWebViewData(view);
if (messagingEnabled)
{
var bridge = new WebViewBridge(view.GetTag());
bridge.MessagePosted += OnMessagePosted;
webViewData.Bridge = bridge;
}
else if (webViewData.Bridge != null)
{
webViewData.Bridge.MessagePosted -= OnMessagePosted;
webViewData.Bridge = null;
}
}
/// <summary>
/// Sets webview source.
/// </summary>
/// <param name="view">A webview instance.</param>
/// <param name="source">A source for the webview (either static html or an uri).</param>
[ReactProp("source")]
public void SetSource(WebView view, JObject source)
{
var webViewData = GetWebViewData(view);
webViewData.Source = source;
webViewData.SourceUpdated = true;
}
/// <summary>
/// Receive events/commands directly from JavaScript through the
/// <see cref="UIManagerModule"/>.
/// </summary>
/// <param name="view">
/// The view instance that should receive the command.
/// </param>
/// <param name="commandId">Identifer for the command.</param>
/// <param name="args">Optional arguments for the command.</param>
public override void ReceiveCommand(WebView view, int commandId, JArray args)
{
switch (commandId)
{
case CommandGoBack:
if (view.CanGoBack) view.GoBack();
break;
case CommandGoForward:
if (view.CanGoForward) view.GoForward();
break;
case CommandReload:
view.Refresh();
break;
case CommandStopLoading:
view.Stop();
break;
case CommandPostMessage:
PostMessage(view, args[0].Value<string>());
break;
case CommandInjectJavaScript:
InvokeScript(view, args[0].Value<string>());
break;
default:
throw new InvalidOperationException(
Invariant($"Unsupported command '{commandId}' received by '{typeof(ReactWebViewManager)}'."));
}
}
/// <summary>
/// Called when view is detached from view hierarchy and allows for
/// additional cleanup by the <see cref="ReactWebViewManager"/>.
/// </summary>
/// <param name="reactContext">The React context.</param>
/// <param name="view">The view.</param>
public override void OnDropViewInstance(ThemedReactContext reactContext, WebView view)
{
base.OnDropViewInstance(reactContext, view);
view.NavigationStarting -= OnNavigationStarting;
view.DOMContentLoaded -= OnDOMContentLoaded;
view.NavigationFailed -= OnNavigationFailed;
view.NavigationCompleted -= OnNavigationCompleted;
_webViewData.TryRemove(view, out _);
}
/// <summary>
/// Creates a new view instance of type <see cref="WebView"/>.
/// </summary>
/// <param name="reactContext">The React context.</param>
/// <returns>The view instance.</returns>
protected override WebView CreateViewInstance(ThemedReactContext reactContext)
{
var view = new WebView(WebViewExecutionMode.SeparateThread);
var data = new WebViewData();
_webViewData.AddOrUpdate(view, data, (k, v) => data);
return view;
}
/// <summary>
/// Subclasses can override this method to install custom event
/// emitters on the given view.
/// </summary>
/// <param name="reactContext">The React context.</param>
/// <param name="view">The view instance.</param>
protected override void AddEventEmitters(ThemedReactContext reactContext, WebView view)
{
base.AddEventEmitters(reactContext, view);
view.NavigationStarting += OnNavigationStarting;
view.DOMContentLoaded += OnDOMContentLoaded;
view.NavigationFailed += OnNavigationFailed;
view.NavigationCompleted += OnNavigationCompleted;
}
/// <summary>
/// Callback that will be triggered after all props are updated
/// </summary>
/// <param name="view">The view instance.</param>
protected override void OnAfterUpdateTransaction(WebView view)
{
var webViewData = GetWebViewData(view);
if (webViewData.SourceUpdated)
{
NavigateToSource(view);
webViewData.SourceUpdated = false;
}
}
private void NavigateToSource(WebView view)
{
var webViewData = GetWebViewData(view);
var source = webViewData.Source;
if (source != null)
{
var html = source.Value<string>("html");
if (html != null)
{
var baseUrl = source.Value<string>("baseUrl");
if (baseUrl != null)
{
view.Source = new Uri(baseUrl);
}
view.NavigateToString(html);
return;
}
var uri = source.Value<string>("uri");
if (uri != null)
{
// HTML files need to be loaded with the ms-appx-web schema.
uri = uri.Replace("ms-appx:", "ms-appx-web:");
using (var request = new HttpRequestMessage())
{
request.RequestUri = new Uri(uri);
var method = source.Value<string>("method");
if (method != null)
{
if (method.Equals("GET"))
{
request.Method = HttpMethod.Get;
}
else if (method.Equals("POST"))
{
request.Method = HttpMethod.Post;
}
else
{
throw new InvalidOperationException(
Invariant($"Unsupported method '{method}' received by '{typeof(ReactWebViewManager)}'."));
}
}
else
{
request.Method = HttpMethod.Get;
}
var headers = (JObject)source.GetValue("headers", StringComparison.Ordinal);
if (headers != null)
{
foreach (var header in headers)
{
request.Headers.Append(header.Key, header.Value.Value<string>());
}
}
var body = source.Value<string>("body");
if (body != null)
{
request.Content = new HttpStringContent(body);
}
view.NavigateWithHttpRequestMessage(request);
return;
}
}
}
view.Navigate(new Uri(BLANK_URL));
}
private async void InvokeScript(WebView view, string script)
{
await view.InvokeScriptAsync("eval", new[] { script }).AsTask().ConfigureAwait(false);
}
private void PostMessage(WebView view, string message)
{
var json = new JObject
{
{ "data", message },
};
var script = "(function() {" +
"var event;" +
$"var data = {json.ToString(Formatting.None)};" +
"try {" +
"event = new MessageEvent('message', data);" +
"} catch (e) {" +
"event = document.createEvent('MessageEvent');" +
"event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);" +
"}" +
"document.dispatchEvent(event);" +
"})();";
InvokeScript(view, script);
}
private void OnNavigationStarting(object sender, WebViewNavigationStartingEventArgs e)
{
var webView = (WebView)sender;
var tag = webView.GetTag();
webView.GetReactContext().GetNativeModule<UIManagerModule>()
.EventDispatcher
.DispatchEvent(
new WebViewLoadEvent(
tag,
WebViewLoadEvent.TopLoadingStart,
e.Uri?.ToString(),
true,
webView.DocumentTitle,
webView.CanGoBack,
webView.CanGoForward));
var bridge = GetWebViewData(webView).Bridge;
if (bridge != null)
{
webView.AddWebAllowedObject(BridgeName, bridge);
}
}
private void OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
{
var webViewData = GetWebViewData(sender);
if (webViewData.Bridge != null)
{
InvokeScript(sender, $"window.postMessage = data => {BridgeName}.postMessage(String(data))");
}
}
private void OnNavigationFailed(object sender, WebViewNavigationFailedEventArgs e)
{
var webView = (WebView)sender;
webView.GetReactContext()
.GetNativeModule<UIManagerModule>()
.EventDispatcher
.DispatchEvent(
new WebViewLoadingErrorEvent(
webView.GetTag(),
e.WebErrorStatus));
}
private void OnNavigationCompleted(object sender, WebViewNavigationCompletedEventArgs e)
{
var webView = (WebView)sender;
webView.GetReactContext()
.GetNativeModule<UIManagerModule>()
.EventDispatcher
.DispatchEvent(
new WebViewLoadEvent(
webView.GetTag(),
WebViewLoadEvent.TopLoadingFinish,
e.Uri?.ToString(),
false,
webView.DocumentTitle,
webView.CanGoBack,
webView.CanGoForward));
if (e.IsSuccess)
{
var injectedJavaScript = GetWebViewData(webView).InjectedJavaScript;
if (injectedJavaScript != null)
{
InvokeScript(webView, injectedJavaScript);
}
}
}
private void OnMessagePosted(object sender, MessagePostedEventArgs e)
{
_context.GetNativeModule<UIManagerModule>()
.EventDispatcher
.DispatchEvent(
new MessageEvent(e.Tag, e.Message));
}
private WebViewData GetWebViewData(WebView webView)
{
return _webViewData[webView];
}
class WebViewData
{
public WebViewBridge Bridge { get; set; }
public JObject Source { get; set; }
public bool SourceUpdated { get; set; }
public string InjectedJavaScript { get; set; }
}
}
}
| 37.036876 | 132 | 0.513939 | [
"MIT"
] | AnandMM/react-native-windows | ReactWindows/ReactNative/Views/Web/ReactWebViewManager.cs | 17,074 | C# |
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using RapidField.SolidInstruments.Core;
using RapidField.SolidInstruments.Core.ArgumentValidation;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.Serialization;
using BaseDomainModel = RapidField.SolidInstruments.Core.Domain.GlobalIdentityDomainModel;
namespace RapidField.SolidInstruments.Messaging.InMemory.UnitTests.Models.Product
{
/// <summary>
/// Represents an item of merchandise.
/// </summary>
[DataContract(Name = DataContractName)]
internal sealed class DomainModel : BaseDomainModel, IAggregate
{
/// <summary>
/// Initializes a new instance of the <see cref="DomainModel" /> class.
/// </summary>
[DebuggerHidden]
internal DomainModel()
: base()
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="DomainModel" /> class.
/// </summary>
/// <param name="identifier">
/// A value that uniquely identifies the domain model.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="identifier" /> is equal to <see cref="Guid.Empty" />.
/// </exception>
[DebuggerHidden]
internal DomainModel(Guid identifier)
: this()
{
Identifier = identifier.RejectIf().IsEqualToValue(default, nameof(identifier));
}
/// <summary>
/// Gets or sets the name of the current <see cref="DomainModel" />.
/// </summary>
/// <exception cref="ArgumentEmptyException">
/// <see cref="Name" /> is empty.
/// </exception>
/// <exception cref="ArgumentNullException">
/// <see cref="Name" /> is <see langword="null" />.
/// </exception>
[DataMember]
public String Name
{
get => NameValue;
set => NameValue = value.RejectIf().IsNullOrEmpty(nameof(Name));
}
/// <summary>
/// Gets or sets the price of the current <see cref="DomainModel" />, or <see langword="null" /> if the price is unknown.
/// </summary>
/// <exception cref="ArgumentOutOfRangeException">
/// <see cref="Price" /> is less than zero.
/// </exception>
[DataMember]
public Decimal? Price
{
get => PriceValue;
set => PriceValue = value?.RejectIf().IsLessThan(0, nameof(Price));
}
/// <summary>
/// Represents the name that is used when representing this current type in serialization and transport contexts.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private const String DataContractName = "Product";
/// <summary>
/// Represents the name of the current <see cref="DomainModel" />.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[IgnoreDataMember]
private String NameValue;
/// <summary>
/// Represents the price of the current <see cref="DomainModel" />, or <see langword="null" /> if the price is unknown.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
[IgnoreDataMember]
private Decimal? PriceValue;
/// <summary>
/// Contains a collection of known <see cref="DomainModel" /> instances.
/// </summary>
internal static class Named
{
/// <summary>
/// Returns a collection of all known <see cref="DomainModel" /> instances.
/// </summary>
/// <returns>
/// A collection of all known <see cref="DomainModel" /> instances.
/// </returns>
[DebuggerHidden]
internal static IEnumerable<DomainModel> All() => new DomainModel[]
{
Fidget,
Widget
};
/// <summary>
/// Gets the Fidget product.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal static DomainModel Fidget => new DomainModel(Guid.Parse("dc177df0-2b54-44e6-a166-55c3b4403d5f"))
{
Name = "Fidget",
Price = 1.99m
};
/// <summary>
/// Gets the Widget product.
/// </summary>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal static DomainModel Widget => new DomainModel(Guid.Parse("acec6baf-66e2-49c1-92e5-37f1b9722e73"))
{
Name = "Widget",
Price = 13.69m
};
}
}
} | 37.725926 | 133 | 0.538582 | [
"MIT"
] | RapidField/solid-instruments | test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs | 5,095 | C# |
using NHibernate;
using NHibernate.Event;
using Pizza.Persistence;
namespace Pizza.Framework.Persistence.SoftDelete
{
public class SoftDeleteEventListener : IPreDeleteEventListener
{
public bool OnPreDelete(PreDeleteEvent preDeleteEvent)
{
var softDeletable = preDeleteEvent.Entity as ISoftDeletable;
if (softDeletable != null)
{
// TODO: process all subproperties and delete them if softdeletable?
// should be normal subproperties deleted?
var session = preDeleteEvent.Session.GetSession(EntityMode.Poco);
softDeletable.IsDeleted = true;
session.Update(softDeletable);
session.Flush();
return true;
}
return false;
}
}
} | 28.793103 | 84 | 0.605988 | [
"MIT"
] | dwdkls/pizzamvc | framework/Pizza.Framework/Persistence/SoftDelete/SoftDeleteEventListener.cs | 835 | C# |
//
// RelaxngMergedProvider.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (c) 2004 Novell Inc.
// All rights reserved
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using Commons.Xml.Relaxng.XmlSchema;
using XSchema = System.Xml.Schema.XmlSchema;
namespace Commons.Xml.Relaxng
{
public class RelaxngMergedProvider : RelaxngDatatypeProvider
{
static RelaxngMergedProvider defaultProvider;
static RelaxngMergedProvider ()
{
RelaxngMergedProvider p = new RelaxngMergedProvider ();
#if !PNET
p ["http://www.w3.org/2001/XMLSchema-datatypes"] = XsdDatatypeProvider.Instance;
p [XSchema.Namespace] = XsdDatatypeProvider.Instance;
#endif
p [String.Empty] = RelaxngNamespaceDatatypeProvider.Instance;
defaultProvider = p;
}
public static RelaxngMergedProvider DefaultProvider {
get { return defaultProvider; }
}
Hashtable table = new Hashtable ();
public RelaxngMergedProvider ()
{
}
public RelaxngDatatypeProvider this [string ns] {
get { return table [ns] as RelaxngDatatypeProvider; }
set { table [ns] = value; }
}
public override RelaxngDatatype GetDatatype (string name, string ns, RelaxngParamList parameters) {
// TODO: parameter support (write schema and get type)
RelaxngDatatypeProvider p = table [ns] as RelaxngDatatypeProvider;
if (p == null)
return null;
return p.GetDatatype (name, ns, parameters);
}
}
}
| 32 | 101 | 0.745192 | [
"Apache-2.0"
] | 121468615/mono | mcs/class/Commons.Xml.Relaxng/Commons.Xml.Relaxng/RelaxngMergedProvider.cs | 2,496 | C# |
/*
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the appconfig-2019-10-09.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.AppConfig.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.AppConfig.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for ConflictException Object
/// </summary>
public class ConflictExceptionUnmarshaller : IErrorResponseUnmarshaller<ConflictException, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public ConflictException Unmarshall(JsonUnmarshallerContext context)
{
return this.Unmarshall(context, new ErrorResponse());
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <param name="errorResponse"></param>
/// <returns></returns>
public ConflictException Unmarshall(JsonUnmarshallerContext context, ErrorResponse errorResponse)
{
context.Read();
ConflictException unmarshalledObject = new ConflictException(errorResponse.Message, errorResponse.InnerException,
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
}
return unmarshalledObject;
}
private static ConflictExceptionUnmarshaller _instance = new ConflictExceptionUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static ConflictExceptionUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 34.082353 | 125 | 0.6631 | [
"Apache-2.0"
] | DetlefGolze/aws-sdk-net | sdk/src/Services/AppConfig/Generated/Model/Internal/MarshallTransformations/ConflictExceptionUnmarshaller.cs | 2,897 | C# |
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
//
// OCCAM'S Laser (Materials)
// This file contains shader and material definitions compatible
// with the T3D engine.
//
// Copyright (C) 2015 Faust Logic, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
// Drone
new Material(OL_Drone_MTL)
{
mapTo = "satellite.png";
diffuseMap[0] = "satellite";
translucent = false;
translucentZWrite = true;
translucentBlendOp = LerpAlpha;
doubleSided = false;
castShadows = true;
};
new Material(OL_DroneFlare1_MTL)
{
mapTo = "satellite_flare1";
diffuseMap[0] = "satellite";
emissive[0] = true;
translucent = true;
translucentBlendOp = AddAlpha;
castShadows = false;
};
new Material(OL_DroneFlare2_MTL : OL_DroneFlare1_MTL)
{
mapTo = "satellite_flare2";
};
// Laser Beams
new Material(OL_beamA_MTL)
{
mapTo = "beamA.png";
diffuseMap[0] = "beamA";
emissive[0] = true;
translucent = true;
translucentBlendOp = AddAlpha;
castShadows = false;
};
new Material(OL_beamB_MTL)
{
mapTo = "beamB.png";
diffuseMap[0] = "beamB";
emissive[0] = true;
translucent = true;
translucentBlendOp = AddAlpha;
castShadows = false;
};
new Material(OL_beamC_MTL)
{
mapTo = "beamC.png";
diffuseMap[0] = "beamC";
emissive[0] = true;
translucent = true;
translucentBlendOp = AddAlpha;
castShadows = false;
};
// Flares
new Material(OL_beam_flare_head_MTL)
{
mapTo = "beam_flare_head.png";
diffuseMap[0] = "beam_flare_head";
emissive[0] = true;
translucent = true;
translucentBlendOp = AddAlpha;
castShadows = false;
};
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
| 28.137615 | 92 | 0.622432 | [
"MIT"
] | 7erj1/RPG_Starter | Templates/RPGDemo/game/art/afx/effects/CoreTech/SF_OL/models/materials.cs | 2,959 | C# |
namespace NetSimpleAuth.Backend.Domain.Dto
{
public class AuthUserDto
{
public string Identity { get; set; }
public string Password { get; set; }
public string IpAddress { get; set; }
}
} | 24.888889 | 45 | 0.620536 | [
"MIT"
] | MrDanCoelho/NetSimpleAuth-Backend | NetSimpleAuth.Backend.Domain/Dto/AuthUserDto.cs | 226 | C# |
using System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class Libsodium
{
internal const int crypto_pwhash_argon2id_ALG_ARGON2ID13 = 2;
internal const int crypto_pwhash_argon2id_BYTES_MIN = 16;
internal const long crypto_pwhash_argon2id_MEMLIMIT_MIN = 8192;
internal const long crypto_pwhash_argon2id_OPSLIMIT_MAX = 4294967295;
internal const long crypto_pwhash_argon2id_OPSLIMIT_MIN = 1;
internal const int crypto_pwhash_argon2id_SALTBYTES = 16;
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static unsafe extern int crypto_pwhash_argon2id(
byte* @out,
ulong outlen,
sbyte* passwd,
ulong passwdlen,
byte* salt,
ulong opslimit,
nuint memlimit,
int alg);
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern int crypto_pwhash_argon2id_alg_argon2id13();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_bytes_max();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_bytes_min();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_memlimit_max();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_memlimit_min();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_opslimit_max();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_opslimit_min();
[DllImport(Libraries.Libsodium, CallingConvention = CallingConvention.Cdecl)]
internal static extern nuint crypto_pwhash_argon2id_saltbytes();
}
}
| 43.686275 | 85 | 0.734291 | [
"MIT"
] | danielnachtrub/nsec | src/Interop/Interop.Argon2id.cs | 2,228 | C# |
// Python Tools for Visual Studio
// Copyright(c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the License); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
// IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing
// permissions and limitations under the License.
using Microsoft.VisualStudio.Debugger;
namespace Microsoft.PythonTools.Debugger.Concord.Proxies.Structs {
internal class PyCFunctionObject : PyObject {
private class Fields {
public StructField<PointerProxy<PyMethodDef>> m_ml;
}
private readonly Fields _fields;
public PyCFunctionObject(DkmProcess process, ulong address)
: base(process, address) {
InitializeStruct(this, out _fields);
CheckPyType<PyCFunctionObject>();
}
public PointerProxy<PyMethodDef> m_ml {
get { return GetFieldProxy(_fields.m_ml); }
}
}
}
| 35.789474 | 80 | 0.707353 | [
"Apache-2.0"
] | 113771169/PTVS | Python/Product/Debugger.Concord/Proxies/Structs/PyCFunctionObject.cs | 1,360 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MathNet.Numerics;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
using MathNet.Numerics.Statistics;
using WeatherLab.PredictionSystem.Common;
namespace WeatherLab.PredictionSystem.Utils
{
/// <summary>
/// Static Class Containing static methods used for making predictions via PredictionManager
/// <remarks> Exceptions missing </remarks>
/// </summary>
static class PredictionFunctions
{
/// <summary>
/// Calculates the Standard Deviation of an array of observations
/// </summary>
/// <param name="observations"></param>
/// <param name="daily"></param>
/// <returns></returns>
static double DistanceStandardDeviation(IEnumerable<PredictionCouple> predictionCouples, Vector<double> daily)
{
int i = 0;
var distances = new double[predictionCouples.Count()];
foreach (var item in predictionCouples)
{
distances[i] = Distance.Euclidean(item.Past, daily.ToArray());
i++;
}
return Statistics.PopulationStandardDeviation(distances);
}
/// <summary>
/// Uses the Gaussian Kernel to calculate a similarity Value between 0 and 1 for the two vectors vector1 and vector2
/// the more the similarity tends to 1 the more the two vectors are similar and the more it tends to zero the more they are dissimilar
/// </summary>
/// <param name="vector1"></param>
/// <param name="vector2"></param>
/// <param name="std">Standard deviation of the all distances in the data population used to regulate the function to give meeningfull results</param>
/// <returns>a similarity double mesure between 0 and 1 </returns>
static double RadialBasisFunction(Vector<double> vector1, Vector<double> vector2, double std)
{
if (vector1.Count() == vector2.Count())
{
var dist = Distance.Euclidean(vector1, vector2);
var sim = Math.Exp(-0.5 * Math.Pow(dist / std, 2));
return sim;
}
return 0;
}
public static double SimilarityFunction(IEnumerable<PredictionCouple> predictionCouples, Vector<double> daily)
{
/// cette fonction permet d'avoir des similarité entre 0 et 1 entre l'observation de la journée et celles du dataset
var std = DistanceStandardDeviation(predictionCouples, daily);
foreach (var item in predictionCouples)
{
item.Similarity = RadialBasisFunction(Vector.Build.DenseOfArray(item.Past), daily, std);
}
return std;
}
/// <summary>
///
/// </summary>
/// <remarks> Modify parameters such that no need for index => search based on param key </remarks>
/// <param name="cluster">The cluster that the function will predict Parameters for</param>
/// <param name="paramKey">The parameter Key reprenting the parameter as a string </param>
/// <param name="index">index of the parameter in the array(Future) of each element in the cluster</param>
/// <returns>A parameter Prediction</returns>
static ParamPrediction PredictParamsCluster(Cluster cluster, String paramKey, int index)
{
List<double> inputs = new List<double>();
foreach (var e in cluster.Elements)
{
inputs.Add(e.Future.ElementAt(index));
}
ParamPrediction paramPrediction = new ParamPrediction(paramKey, Statistics.Mean(inputs), Statistics.PopulationStandardDeviation(inputs));
return paramPrediction;
}
/// <summary>
///
/// </summary>
/// <param name="clusters">a list of ordered clusters by probability</param>
/// <returns>a Dictionary of Pairs of Cluster and the list of Parameter Predictions</returns>
public static Dictionary<Cluster, List<ParamPrediction>> Predict(List<Cluster> clusters)
{
Dictionary<Cluster, List<ParamPrediction>> map = new Dictionary<Cluster, List<ParamPrediction>>();
foreach (Cluster cluster in clusters)
{
if (cluster.GetProbability() != 0)
{
List<ParamPrediction> clusterList = new List<ParamPrediction>();
for (int i = 0; i < PredictionCouple.NUMBER_OF_PARAMETERS; i++)
{
clusterList.Add(PredictParamsCluster(cluster, InputKeys.NONE, i)); /// predicts currant parameter
}
map.Add(cluster, clusterList);
}
}
return map;
}
/// <summary>
///
/// </summary>
/// <param name="clusters">List of unordered clusters</param>
/// <returns>ordered list of Clusters by probability in decreasing order</returns>
public static List<Cluster> OrderByProbabiltyDescending(List<Cluster> clusters)
{
if (clusters != null)
{
List<Cluster> sortedClusters = clusters.OrderByDescending(cluster => cluster.GetProbability()).ToList();
return sortedClusters;
}
return null;
}
/// <summary>
///
/// </summary>
/// <param name="cluster">the cluster that we want to calculate the probability</param>
/// <param name="sumSimilarites">the sum of all similarity mesures of the population</param>
/// <returns>the probability Of the cluster</returns>
public static double ProbabiltyOfCluster(Cluster cluster, double sumSimilarites)
{
if (cluster != null && sumSimilarites > 0)
{
return cluster.SumOfSimilarity / sumSimilarites;
}
return 0;/// probabilty of null cluster is 0
}
/// <summary>
///
/// </summary>
/// <param name="rawCouples">unclustered array of PredictionCouples having each a similarity assigned to it</param>
/// <param name="clusterWidth"> the width of the cluster grouping this PredictionCouples ex: 0.1 </param>
/// <returns></returns>
public static List<Cluster> Cluster(IEnumerable<PredictionCouple> rawCouples, double clusterWidth)
{
/// TODO : optimize Function
List<Cluster> finalList = new List<Cluster>();
double startingBound = 0;
var sortedData = from item in rawCouples
orderby item.Similarity descending
select item;
if (clusterWidth > 1)
{
clusterWidth = 1;
}
while (startingBound <= 1 - clusterWidth)
{
Cluster cluster = new Cluster(startingBound, startingBound + clusterWidth);
///TODO : optimize this piece of code to not traverse all sortedData everyTime
foreach (PredictionCouple item in sortedData)
{
/// add element if he had similarity in this cluster
cluster.AddElement(item);
}
finalList.Add(cluster);
startingBound += clusterWidth;
}
return finalList;
}
/// PICKING MOST SIMILAR PREDICTIONS FUNCTIONS
public static List<PredictionCouple> PickMostProbableCouples(IEnumerable<PredictionCouple> couples , double pre)
{
int max = (pre == 0 ) ? 10 : (int) Math.Floor(1 / pre);
List<PredictionCouple> sortedCouples = couples.OrderByDescending(couple => couple.Similarity).ToList();
return sortedCouples.Take(max).ToList();
}
}
}
| 40.348259 | 158 | 0.587176 | [
"MIT"
] | AbdennourBenantar/WeatherLab | WeatherLab/PredictionSystem/Utils/PredictionFunctions.cs | 8,114 | C# |
using System;
namespace _2019_06_19
{
class Serializer
{
public string Serialize(Node node)
{
if (node == null) return string.Empty;
return $"[{node.Value},{Serialize(node.Left)},{Serialize(node.Right)}]";
}
public Node Deserialize(string serializedNode)
{
if (string.IsNullOrEmpty(serializedNode)) return null;
return Deserialize(serializedNode.ToCharArray());
}
static Node Deserialize(char[] serializedNode)
{
var leftBound = 0;
return Deserialize(serializedNode, ref leftBound);
}
static Node Deserialize(char[] serializedNode, ref int leftBound)
{
if (serializedNode[leftBound] != '[') return null;
leftBound += 1;
var value = ReadUntil(serializedNode, ref leftBound, ',');
leftBound += 1;
var leftNode = Deserialize(serializedNode, ref leftBound);
leftBound += 1;
var rightNode = Deserialize(serializedNode, ref leftBound);
leftBound += 1;
return new Node
{
Value = value,
Left = leftNode,
Right = rightNode
};
}
static string ReadUntil(char[] serializedNode, ref int leftBound, char c)
{
var start = leftBound;
var end = Array.IndexOf(serializedNode, c, leftBound, serializedNode.Length - leftBound);
var length = end - start;
leftBound += length;
var res = new char[length];
Array.Copy(serializedNode, start, res, 0, length);
return new string(res);
}
}
} | 31.6 | 101 | 0.544879 | [
"MIT"
] | lAnubisl/DailyCodingProblem | 2019-06-19/2019-06-19/Serializer.cs | 1,740 | C# |
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace Microsoft.Zelig.Debugger.ArmProcessor
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using IR = Microsoft.Zelig.CodeGeneration.IR;
public class AddressVisualItem : BaseTextVisualItem
{
//
// State
//
uint m_address;
//
// Constructor Methods
//
public AddressVisualItem( object context ,
uint address ) : base( context )
{
m_address = address;
}
//
// Helper Methods
//
public override string ToString( GraphicsContext ctx )
{
return String.Format( "[{0,8:X8}]", m_address );
}
}
}
| 20.065217 | 68 | 0.551463 | [
"MIT"
] | NETMF/llilum | Zelig/Zelig/DebugTime/Debugger/VisualTree/VisualItems/AddressVisualItem.cs | 923 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the lakeformation-2017-03-31.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.LakeFormation.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.LakeFormation.Model.Internal.MarshallTransformations
{
/// <summary>
/// RowFilter Marshaller
/// </summary>
public class RowFilterMarshaller : IRequestMarshaller<RowFilter, JsonMarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="requestObject"></param>
/// <param name="context"></param>
/// <returns></returns>
public void Marshall(RowFilter requestObject, JsonMarshallerContext context)
{
if(requestObject.IsSetAllRowsWildcard())
{
context.Writer.WritePropertyName("AllRowsWildcard");
context.Writer.WriteObjectStart();
var marshaller = AllRowsWildcardMarshaller.Instance;
marshaller.Marshall(requestObject.AllRowsWildcard, context);
context.Writer.WriteObjectEnd();
}
if(requestObject.IsSetFilterExpression())
{
context.Writer.WritePropertyName("FilterExpression");
context.Writer.Write(requestObject.FilterExpression);
}
}
/// <summary>
/// Singleton Marshaller.
/// </summary>
public readonly static RowFilterMarshaller Instance = new RowFilterMarshaller();
}
} | 33.39726 | 111 | 0.669401 | [
"Apache-2.0"
] | aws/aws-sdk-net | sdk/src/Services/LakeFormation/Generated/Model/Internal/MarshallTransformations/RowFilterMarshaller.cs | 2,438 | C# |
using System;
using System.Collections.Generic;
namespace TTWork.Abp.AppManagement.Apps
{
[Serializable]
public class AppCacheItem
{
public Dictionary<string, string> Value { get; set; }
public AppCacheItem()
{
}
public AppCacheItem(Dictionary<string, string> value)
{
Value = value;
}
public static string CalculateCacheKey(string name, string providerName, string providerKey)
{
return "pn:" + providerName + ",pk:" + providerKey + ",n:" + name;
}
}
} | 23.12 | 100 | 0.588235 | [
"MIT"
] | jerrytang67/szsj | backend/Modules/TTWork.Abp.AppManagement/Apps/AppCacheItem.cs | 580 | C# |
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Owin.Infrastructure;
using Microsoft.Owin.Logging;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Infrastructure;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Owin.Security.Providers.Salesforce
{
public class SalesforceAuthenticationHandler : AuthenticationHandler<SalesforceAuthenticationOptions>
{
private const string XmlSchemaString = "http://www.w3.org/2001/XMLSchema#string";
private readonly ILogger _logger;
private readonly HttpClient _httpClient;
public SalesforceAuthenticationHandler(HttpClient httpClient, ILogger logger)
{
_httpClient = httpClient;
_logger = logger;
}
protected override async Task<AuthenticationTicket> AuthenticateCoreAsync()
{
var properties = new AuthenticationProperties();
try
{
string code = null;
string state = null;
var query = Request.Query;
var values = query.GetValues("code");
if (values != null && values.Count == 1)
{
code = values[0];
}
values = query.GetValues("state");
if (values != null && values.Count == 1)
{
state = values[0];
}
properties = Options.StateDataFormat.Unprotect(state);
if (properties == null)
{
return null;
}
// OAuth2 10.12 CSRF
if (!ValidateCorrelationId(properties, _logger))
{
return new AuthenticationTicket(null, properties);
}
var requestPrefix = Request.Scheme + "://" + Request.Host;
var redirectUri = requestPrefix + Request.PathBase + Options.CallbackPath;
// Build up the body for the token request
var body = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("code", code),
new KeyValuePair<string, string>("redirect_uri", redirectUri),
new KeyValuePair<string, string>("client_id", Options.ClientId),
new KeyValuePair<string, string>("client_secret", Options.ClientSecret),
new KeyValuePair<string, string>("grant_type", "authorization_code")
};
// Request the token
var requestMessage = new HttpRequestMessage(HttpMethod.Post, Options.Endpoints.TokenEndpoint);
requestMessage.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
requestMessage.Content = new FormUrlEncodedContent(body);
var tokenResponse = await _httpClient.SendAsync(requestMessage);
tokenResponse.EnsureSuccessStatusCode();
var text = await tokenResponse.Content.ReadAsStringAsync();
// Deserializes the token response
dynamic response = JsonConvert.DeserializeObject<dynamic>(text);
var accessToken = (string)response.access_token;
var refreshToken = (string)response.refresh_token;
var instanceUrl = (string)response.instance_url;
// Get the Salesforce user using the user info endpoint, which is part of the token - response.id
var userRequest = new HttpRequestMessage(HttpMethod.Get, (string)response.id + "?access_token=" + Uri.EscapeDataString(accessToken));
userRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var userResponse = await _httpClient.SendAsync(userRequest, Request.CallCancelled);
userResponse.EnsureSuccessStatusCode();
text = await userResponse.Content.ReadAsStringAsync();
var user = JObject.Parse(text);
var context = new SalesforceAuthenticatedContext(Context, user, accessToken, refreshToken, instanceUrl)
{
Identity = new ClaimsIdentity(
Options.AuthenticationType,
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType)
};
if (!string.IsNullOrEmpty(context.UserId))
{
context.Identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, context.UserId, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.UserName))
{
context.Identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, context.UserName, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.Email))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Email, context.Email, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.FirstName))
{
context.Identity.AddClaim(new Claim(ClaimTypes.GivenName, context.FirstName, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.LastName))
{
context.Identity.AddClaim(new Claim(ClaimTypes.Surname, context.LastName, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.DisplayName))
{
context.Identity.AddClaim(new Claim("urn:Salesforce:name", context.DisplayName, XmlSchemaString, Options.AuthenticationType));
}
if (!string.IsNullOrEmpty(context.OrganizationId))
{
context.Identity.AddClaim(new Claim("urn:Salesforce:organization_id", context.OrganizationId, XmlSchemaString, Options.AuthenticationType));
}
context.Properties = properties;
await Options.Provider.Authenticated(context);
return new AuthenticationTicket(context.Identity, context.Properties);
}
catch (Exception ex)
{
_logger.WriteError(ex.Message);
}
return new AuthenticationTicket(null, properties);
}
protected override Task ApplyResponseChallengeAsync()
{
if (Response.StatusCode != 401)
{
return Task.FromResult<object>(null);
}
var challenge = Helper.LookupChallenge(Options.AuthenticationType, Options.AuthenticationMode);
if (challenge == null) return Task.FromResult<object>(null);
var baseUri =
Request.Scheme +
Uri.SchemeDelimiter +
Request.Host +
Request.PathBase;
var currentUri =
baseUri +
Request.Path +
Request.QueryString;
var redirectUri =
baseUri +
Options.CallbackPath;
var properties = challenge.Properties;
if (string.IsNullOrEmpty(properties.RedirectUri))
{
properties.RedirectUri = currentUri;
}
// OAuth2 10.12 CSRF
GenerateCorrelationId(properties);
var state = Options.StateDataFormat.Protect(properties);
var authorizationEndpoint =
$"{Options.Endpoints.AuthorizationEndpoint}?response_type={"code"}&client_id={Options.ClientId}&redirect_uri={HttpUtility.UrlEncode(redirectUri)}&display={"page"}&immediate={false}&state={Uri.EscapeDataString(state)}&scope={""}";
if (Options.Prompt != null)
{
authorizationEndpoint += $"&prompt={Options.Prompt}";
}
Response.Redirect(authorizationEndpoint);
return Task.FromResult<object>(null);
}
public override async Task<bool> InvokeAsync()
{
return await InvokeReplyPathAsync();
}
private async Task<bool> InvokeReplyPathAsync()
{
if (!Options.CallbackPath.HasValue || Options.CallbackPath != Request.Path) return false;
// TODO: error responses
var ticket = await AuthenticateAsync();
if (ticket == null)
{
_logger.WriteWarning("Invalid return state, unable to redirect.");
Response.StatusCode = 500;
return true;
}
var context = new SalesforceReturnEndpointContext(Context, ticket)
{
SignInAsAuthenticationType = Options.SignInAsAuthenticationType,
RedirectUri = ticket.Properties.RedirectUri
};
await Options.Provider.ReturnEndpoint(context);
if (context.SignInAsAuthenticationType != null &&
context.Identity != null)
{
var grantIdentity = context.Identity;
if (!string.Equals(grantIdentity.AuthenticationType, context.SignInAsAuthenticationType, StringComparison.Ordinal))
{
grantIdentity = new ClaimsIdentity(grantIdentity.Claims, context.SignInAsAuthenticationType, grantIdentity.NameClaimType, grantIdentity.RoleClaimType);
}
Context.Authentication.SignIn(context.Properties, grantIdentity);
}
if (context.IsRequestCompleted || context.RedirectUri == null) return context.IsRequestCompleted;
var redirectUri = context.RedirectUri;
if (context.Identity == null)
{
// add a redirect hint that sign-in failed in some way
redirectUri = WebUtilities.AddQueryString(redirectUri, "error", "access_denied");
}
Response.Redirect(redirectUri);
context.RequestCompleted();
return context.IsRequestCompleted;
}
}
}
| 41.474308 | 245 | 0.583246 | [
"MIT"
] | Jacob-Morgan/OwinOAuthProviders | src/Owin.Security.Providers.Salesforce/SalesforceAuthenticationHandler.cs | 10,495 | C# |
namespace Squalr.Engine.Memory
{
using Squalr.Engine.Logging;
using Squalr.Engine.Memory.Windows;
using System;
using System.Threading;
public static class Writer
{
/// <summary>
/// Singleton instance of the <see cref="WindowsMemoryWriter"/> class.
/// </summary>
private static Lazy<IMemoryWriter> windowsMemoryWriterInstance = new Lazy<IMemoryWriter>(
() => { return new WindowsMemoryWriter(); },
LazyThreadSafetyMode.ExecutionAndPublication);
/// <summary>
/// Gets the default memory writer for the current operating system.
/// </summary>
public static IMemoryWriter Default
{
get
{
OperatingSystem os = Environment.OSVersion;
PlatformID platformid = os.Platform;
Exception ex;
switch (platformid)
{
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
case PlatformID.WinCE:
return windowsMemoryWriterInstance.Value;
case PlatformID.Unix:
ex = new Exception("Unix operating system is not supported");
break;
case PlatformID.MacOSX:
ex = new Exception("MacOSX operating system is not supported");
break;
default:
ex = new Exception("Unknown operating system");
break;
}
Logger.Log(LogLevel.Fatal, "Unsupported Operating System", ex);
throw ex;
}
}
}
//// End class
}
//// End namespace | 34.528302 | 97 | 0.513661 | [
"MIT"
] | Xen0byte/Squalr | Squalr.Engine.Memory/Writer.cs | 1,832 | C# |
// 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.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class Globalization
{
[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCase")]
internal static extern unsafe void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseInvariant")]
internal static extern unsafe void ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
[DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseTurkish")]
internal static extern unsafe void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
}
}
| 54.904762 | 141 | 0.771899 | [
"MIT"
] | 06needhamt/runtime | src/libraries/Common/src/Interop/Interop.Casing.cs | 1,153 | C# |
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using LetPortal.Core.Persistences;
using LetPortal.Core.Utils;
using LetPortal.Portal.Entities.Apps;
using LetPortal.Portal.Entities.Menus;
using LetPortal.Portal.Entities.Shared;
using LetPortal.Portal.Models.Shared;
using Microsoft.EntityFrameworkCore;
namespace LetPortal.Portal.Repositories.Apps
{
public class AppEFRepository : EFGenericRepository<App>, IAppRepository
{
private readonly PortalDbContext _context;
public AppEFRepository(PortalDbContext context)
: base(context)
{
_context = context;
}
public async Task<string> CloneAsync(string cloneId, string cloneName)
{
var cloneApp = await _context.Apps.AsNoTracking().FirstAsync(a => a.Id == cloneId);
cloneApp.Id = DataUtil.GenerateUniqueId();
cloneApp.Name = cloneName;
cloneApp.DisplayName += " Clone";
await AddAsync(cloneApp);
return cloneApp.Id;
}
public async Task<IEnumerable<LanguageKey>> CollectAllLanguages(string appId)
{
var app = await GetOneAsync(appId);
var languages = new List<LanguageKey>();
languages.AddRange(GetLanguageKeys(app));
return languages;
}
public async Task<IEnumerable<LanguageKey>> GetLanguageKeys(string appId)
{
var app = await GetOneAsync(appId);
return GetLanguageKeys(app);
}
public async Task<IEnumerable<ShortEntityModel>> GetShortApps(string keyWord = null)
{
if (!string.IsNullOrEmpty(keyWord))
{
var shortApps = await _context.Apps.Where(a => a.DisplayName.Contains(keyWord)).Select(b => new ShortEntityModel { Id = b.Id, DisplayName = b.DisplayName }).ToListAsync();
return shortApps;
}
else
{
var shortApps = await _context.Apps.Select(a => new ShortEntityModel { Id = a.Id, DisplayName = a.DisplayName }).ToListAsync();
return shortApps.AsEnumerable();
}
}
public async Task UpdateMenuAsync(string appId, List<Menu> menus)
{
var app = await _context.Apps.FirstAsync(a => a.Id == appId);
app.Menus = menus;
_context.SaveChanges();
}
public async Task UpdateMenuProfileAsync(string appId, MenuProfile menuProfile)
{
var app = await _context.Apps.FirstAsync(a => a.Id == appId);
if (app.MenuProfiles == null)
{
app.MenuProfiles = new List<MenuProfile>();
}
app.MenuProfiles.Add(menuProfile);
_context.SaveChanges();
}
private IEnumerable<LanguageKey> GetLanguageKeys(App app)
{
var languages = new List<LanguageKey>();
var appName = new LanguageKey
{
Key = $"apps.{app.Name}.displayName",
Value = app.DisplayName
};
languages.Add(appName);
if (app.Menus != null && app.Menus.Count > 0)
{
var index = 0;
foreach (var menu in app.Menus)
{
var menuName = new LanguageKey
{
Key = $"apps.{app.Name}.menus[{index.ToString()}].displayName",
Value = menu.DisplayName
};
languages.Add(menuName);
if (menu.SubMenus != null && menu.SubMenus.Count > 0)
{
var subIndex = 0;
foreach (var subMenu in menu.SubMenus)
{
var subMenuName = new LanguageKey
{
Key = $"apps.{app.Name}.menus[{index.ToString()}][{subIndex.ToString()}].displayName",
Value = subMenu.DisplayName
};
languages.Add(subMenuName);
subIndex++;
}
}
index++;
}
}
return languages;
}
}
}
| 32.382353 | 187 | 0.522934 | [
"MIT"
] | chuxuantinh/let.portal | src/web-apis/LetPortal.Portal/Repositories/Apps/AppEFRepository.cs | 4,406 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: EntityReferenceRequest.cs.tt
namespace Microsoft.Graph
{
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
/// <summary>
/// The type DepMacOSEnrollmentProfileReferenceRequest.
/// </summary>
public partial class DepMacOSEnrollmentProfileReferenceRequest : BaseRequest, IDepMacOSEnrollmentProfileReferenceRequest
{
/// <summary>
/// Constructs a new DepMacOSEnrollmentProfileReferenceRequest.
/// </summary>
/// <param name="requestUrl">The URL for the built request.</param>
/// <param name="client">The <see cref="IBaseClient"/> for handling requests.</param>
/// <param name="options">Query and header option name value pairs for the request.</param>
public DepMacOSEnrollmentProfileReferenceRequest(
string requestUrl,
IBaseClient client,
IEnumerable<Option> options)
: base(requestUrl, client, options)
{
}
/// <summary>
/// Deletes the specified DepMacOSEnrollmentProfile reference.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await.</returns>
public async System.Threading.Tasks.Task DeleteAsync(CancellationToken cancellationToken = default)
{
this.Method = HttpMethods.DELETE;
await this.SendAsync<DepMacOSEnrollmentProfile>(null, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Deletes the specified DepMacOSEnrollmentProfile reference and returns a <see cref="GraphResponse"/> object.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task of <see cref="GraphResponse"/> to await.</returns>
public System.Threading.Tasks.Task<GraphResponse> DeleteResponseAsync(CancellationToken cancellationToken = default)
{
this.Method = HttpMethods.DELETE;
return this.SendAsyncWithGraphResponse(null, cancellationToken);
}
/// <summary>
/// Puts the specified DepMacOSEnrollmentProfile reference.
/// </summary>
/// <param name="id">The DepMacOSEnrollmentProfile reference to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await.</returns>
public System.Threading.Tasks.Task PutAsync(string id, CancellationToken cancellationToken = default)
{
this.Method = HttpMethods.PUT;
this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
var referenceRequestBody = new ReferenceRequestBody()
{
ODataId = string.Format(@"{0}/users/{1}", this.Client.BaseUrl, id)
};
return this.SendAsync(referenceRequestBody, cancellationToken);
}
/// <summary>
/// Puts the specified DepMacOSEnrollmentProfile reference and returns <see cref="GraphResponse"/> object.
/// </summary>
/// <param name="id">The DepMacOSEnrollmentProfile reference to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await of <see cref="GraphResponse"/>.</returns>
public System.Threading.Tasks.Task<GraphResponse> PutResponseAsync(string id, CancellationToken cancellationToken = default)
{
this.Method = HttpMethods.PUT;
this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
var referenceRequestBody = new ReferenceRequestBody()
{
ODataId = string.Format(@"{0}/users/{1}", this.Client.BaseUrl, id)
};
return this.SendAsyncWithGraphResponse(referenceRequestBody, cancellationToken);
}
}
}
| 48.51087 | 153 | 0.632086 | [
"MIT"
] | ScriptBox99/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/DepMacOSEnrollmentProfileReferenceRequest.cs | 4,463 | C# |
/// This code was generated by
/// \ / _ _ _| _ _
/// | (_)\/(_)(_|\/| |(/_ v1.0.0
/// / /
/// <summary>
/// PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you
/// currently do not have developer preview access, please contact help@twilio.com.
///
/// SyncMapPermissionResource
/// </summary>
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Twilio.Base;
using Twilio.Clients;
using Twilio.Converters;
using Twilio.Exceptions;
using Twilio.Http;
namespace Twilio.Rest.Preview.Sync.Service.SyncMap
{
public class SyncMapPermissionResource : Resource
{
private static Request BuildFetchRequest(FetchSyncMapPermissionOptions options, ITwilioRestClient client)
{
return new Request(
HttpMethod.Get,
Rest.Domain.Preview,
"/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Permissions/" + options.PathIdentity + "",
queryParams: options.GetParams(),
headerParams: null
);
}
/// <summary>
/// Fetch a specific Sync Map Permission.
/// </summary>
/// <param name="options"> Fetch SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static SyncMapPermissionResource Fetch(FetchSyncMapPermissionOptions options, ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = client.Request(BuildFetchRequest(options, client));
return FromJson(response.Content);
}
#if !NET35
/// <summary>
/// Fetch a specific Sync Map Permission.
/// </summary>
/// <param name="options"> Fetch SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<SyncMapPermissionResource> FetchAsync(FetchSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = await client.RequestAsync(BuildFetchRequest(options, client));
return FromJson(response.Content);
}
#endif
/// <summary>
/// Fetch a specific Sync Map Permission.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static SyncMapPermissionResource Fetch(string pathServiceSid,
string pathMapSid,
string pathIdentity,
ITwilioRestClient client = null)
{
var options = new FetchSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity);
return Fetch(options, client);
}
#if !NET35
/// <summary>
/// Fetch a specific Sync Map Permission.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<SyncMapPermissionResource> FetchAsync(string pathServiceSid,
string pathMapSid,
string pathIdentity,
ITwilioRestClient client = null)
{
var options = new FetchSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity);
return await FetchAsync(options, client);
}
#endif
private static Request BuildDeleteRequest(DeleteSyncMapPermissionOptions options, ITwilioRestClient client)
{
return new Request(
HttpMethod.Delete,
Rest.Domain.Preview,
"/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Permissions/" + options.PathIdentity + "",
queryParams: options.GetParams(),
headerParams: null
);
}
/// <summary>
/// Delete a specific Sync Map Permission.
/// </summary>
/// <param name="options"> Delete SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static bool Delete(DeleteSyncMapPermissionOptions options, ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = client.Request(BuildDeleteRequest(options, client));
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
}
#if !NET35
/// <summary>
/// Delete a specific Sync Map Permission.
/// </summary>
/// <param name="options"> Delete SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<bool> DeleteAsync(DeleteSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = await client.RequestAsync(BuildDeleteRequest(options, client));
return response.StatusCode == System.Net.HttpStatusCode.NoContent;
}
#endif
/// <summary>
/// Delete a specific Sync Map Permission.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static bool Delete(string pathServiceSid,
string pathMapSid,
string pathIdentity,
ITwilioRestClient client = null)
{
var options = new DeleteSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity);
return Delete(options, client);
}
#if !NET35
/// <summary>
/// Delete a specific Sync Map Permission.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<bool> DeleteAsync(string pathServiceSid,
string pathMapSid,
string pathIdentity,
ITwilioRestClient client = null)
{
var options = new DeleteSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity);
return await DeleteAsync(options, client);
}
#endif
private static Request BuildReadRequest(ReadSyncMapPermissionOptions options, ITwilioRestClient client)
{
return new Request(
HttpMethod.Get,
Rest.Domain.Preview,
"/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Permissions",
queryParams: options.GetParams(),
headerParams: null
);
}
/// <summary>
/// Retrieve a list of all Permissions applying to a Sync Map.
/// </summary>
/// <param name="options"> Read SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static ResourceSet<SyncMapPermissionResource> Read(ReadSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = client.Request(BuildReadRequest(options, client));
var page = Page<SyncMapPermissionResource>.FromJson("permissions", response.Content);
return new ResourceSet<SyncMapPermissionResource>(page, options, client);
}
#if !NET35
/// <summary>
/// Retrieve a list of all Permissions applying to a Sync Map.
/// </summary>
/// <param name="options"> Read SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<ResourceSet<SyncMapPermissionResource>> ReadAsync(ReadSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = await client.RequestAsync(BuildReadRequest(options, client));
var page = Page<SyncMapPermissionResource>.FromJson("permissions", response.Content);
return new ResourceSet<SyncMapPermissionResource>(page, options, client);
}
#endif
/// <summary>
/// Retrieve a list of all Permissions applying to a Sync Map.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pageSize"> Page size </param>
/// <param name="limit"> Record limit </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static ResourceSet<SyncMapPermissionResource> Read(string pathServiceSid,
string pathMapSid,
int? pageSize = null,
long? limit = null,
ITwilioRestClient client = null)
{
var options = new ReadSyncMapPermissionOptions(pathServiceSid, pathMapSid){PageSize = pageSize, Limit = limit};
return Read(options, client);
}
#if !NET35
/// <summary>
/// Retrieve a list of all Permissions applying to a Sync Map.
/// </summary>
/// <param name="pathServiceSid"> The service_sid </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pageSize"> Page size </param>
/// <param name="limit"> Record limit </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<ResourceSet<SyncMapPermissionResource>> ReadAsync(string pathServiceSid,
string pathMapSid,
int? pageSize = null,
long? limit = null,
ITwilioRestClient client = null)
{
var options = new ReadSyncMapPermissionOptions(pathServiceSid, pathMapSid){PageSize = pageSize, Limit = limit};
return await ReadAsync(options, client);
}
#endif
/// <summary>
/// Fetch the target page of records
/// </summary>
/// <param name="targetUrl"> API-generated URL for the requested results page </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> The target page of records </returns>
public static Page<SyncMapPermissionResource> GetPage(string targetUrl, ITwilioRestClient client)
{
client = client ?? TwilioClient.GetRestClient();
var request = new Request(
HttpMethod.Get,
targetUrl
);
var response = client.Request(request);
return Page<SyncMapPermissionResource>.FromJson("permissions", response.Content);
}
/// <summary>
/// Fetch the next page of records
/// </summary>
/// <param name="page"> current page of records </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> The next page of records </returns>
public static Page<SyncMapPermissionResource> NextPage(Page<SyncMapPermissionResource> page,
ITwilioRestClient client)
{
var request = new Request(
HttpMethod.Get,
page.GetNextPageUrl(Rest.Domain.Preview)
);
var response = client.Request(request);
return Page<SyncMapPermissionResource>.FromJson("permissions", response.Content);
}
/// <summary>
/// Fetch the previous page of records
/// </summary>
/// <param name="page"> current page of records </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> The previous page of records </returns>
public static Page<SyncMapPermissionResource> PreviousPage(Page<SyncMapPermissionResource> page,
ITwilioRestClient client)
{
var request = new Request(
HttpMethod.Get,
page.GetPreviousPageUrl(Rest.Domain.Preview)
);
var response = client.Request(request);
return Page<SyncMapPermissionResource>.FromJson("permissions", response.Content);
}
private static Request BuildUpdateRequest(UpdateSyncMapPermissionOptions options, ITwilioRestClient client)
{
return new Request(
HttpMethod.Post,
Rest.Domain.Preview,
"/Sync/Services/" + options.PathServiceSid + "/Maps/" + options.PathMapSid + "/Permissions/" + options.PathIdentity + "",
postParams: options.GetParams(),
headerParams: null
);
}
/// <summary>
/// Update an identity's access to a specific Sync Map.
/// </summary>
/// <param name="options"> Update SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static SyncMapPermissionResource Update(UpdateSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = client.Request(BuildUpdateRequest(options, client));
return FromJson(response.Content);
}
#if !NET35
/// <summary>
/// Update an identity's access to a specific Sync Map.
/// </summary>
/// <param name="options"> Update SyncMapPermission parameters </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<SyncMapPermissionResource> UpdateAsync(UpdateSyncMapPermissionOptions options,
ITwilioRestClient client = null)
{
client = client ?? TwilioClient.GetRestClient();
var response = await client.RequestAsync(BuildUpdateRequest(options, client));
return FromJson(response.Content);
}
#endif
/// <summary>
/// Update an identity's access to a specific Sync Map.
/// </summary>
/// <param name="pathServiceSid"> Sync Service Instance SID. </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="read"> Read access. </param>
/// <param name="write"> Write access. </param>
/// <param name="manage"> Manage access. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> A single instance of SyncMapPermission </returns>
public static SyncMapPermissionResource Update(string pathServiceSid,
string pathMapSid,
string pathIdentity,
bool? read,
bool? write,
bool? manage,
ITwilioRestClient client = null)
{
var options = new UpdateSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity, read, write, manage);
return Update(options, client);
}
#if !NET35
/// <summary>
/// Update an identity's access to a specific Sync Map.
/// </summary>
/// <param name="pathServiceSid"> Sync Service Instance SID. </param>
/// <param name="pathMapSid"> Sync Map SID or unique name. </param>
/// <param name="pathIdentity"> Identity of the user to whom the Sync Map Permission applies. </param>
/// <param name="read"> Read access. </param>
/// <param name="write"> Write access. </param>
/// <param name="manage"> Manage access. </param>
/// <param name="client"> Client to make requests to Twilio </param>
/// <returns> Task that resolves to A single instance of SyncMapPermission </returns>
public static async System.Threading.Tasks.Task<SyncMapPermissionResource> UpdateAsync(string pathServiceSid,
string pathMapSid,
string pathIdentity,
bool? read,
bool? write,
bool? manage,
ITwilioRestClient client = null)
{
var options = new UpdateSyncMapPermissionOptions(pathServiceSid, pathMapSid, pathIdentity, read, write, manage);
return await UpdateAsync(options, client);
}
#endif
/// <summary>
/// Converts a JSON string into a SyncMapPermissionResource object
/// </summary>
/// <param name="json"> Raw JSON string </param>
/// <returns> SyncMapPermissionResource object represented by the provided JSON </returns>
public static SyncMapPermissionResource FromJson(string json)
{
// Convert all checked exceptions to Runtime
try
{
return JsonConvert.DeserializeObject<SyncMapPermissionResource>(json);
}
catch (JsonException e)
{
throw new ApiException(e.Message, e);
}
}
/// <summary>
/// Twilio Account SID.
/// </summary>
[JsonProperty("account_sid")]
public string AccountSid { get; private set; }
/// <summary>
/// Sync Service Instance SID.
/// </summary>
[JsonProperty("service_sid")]
public string ServiceSid { get; private set; }
/// <summary>
/// Sync Map SID.
/// </summary>
[JsonProperty("map_sid")]
public string MapSid { get; private set; }
/// <summary>
/// Identity of the user to whom the Sync Map Permission applies.
/// </summary>
[JsonProperty("identity")]
public string Identity { get; private set; }
/// <summary>
/// Read access.
/// </summary>
[JsonProperty("read")]
public bool? _Read { get; private set; }
/// <summary>
/// Write access.
/// </summary>
[JsonProperty("write")]
public bool? Write { get; private set; }
/// <summary>
/// Manage access.
/// </summary>
[JsonProperty("manage")]
public bool? Manage { get; private set; }
/// <summary>
/// URL of this Sync Map Permission.
/// </summary>
[JsonProperty("url")]
public Uri Url { get; private set; }
private SyncMapPermissionResource()
{
}
}
} | 49.78178 | 143 | 0.543048 | [
"MIT"
] | BrimmingDev/twilio-csharp | src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapPermissionResource.cs | 23,497 | C# |
using StackExchange.Exceptional.Internal;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace StackExchange.Exceptional
{
/// <summary>
/// Utilities for Exceptions!
/// </summary>
public static partial class ExceptionalUtils
{
/// <summary>
/// StackTrace utilities
/// </summary>
public static class StackTrace
{
// Inspired by StackTraceParser by Atif Aziz, project home: https://github.com/atifaziz/StackTraceParser
internal const string Space = @"[\x20\t]",
NoSpace = @"[^\x20\t]";
private static class Groups
{
public const string LeadIn = nameof(LeadIn);
public const string Frame = nameof(Frame);
public const string Type = nameof(Type);
public const string AsyncMethod = nameof(AsyncMethod);
public const string Method = nameof(Method);
public const string Params = nameof(Params);
public const string ParamType = nameof(ParamType);
public const string ParamName = nameof(ParamName);
public const string SourceInfo = nameof(SourceInfo);
public const string Path = nameof(Path);
public const string LinePrefix = nameof(LinePrefix);
public const string Line = nameof(Line);
}
private static readonly char[] NewLine_CarriageReturn = { '\n', '\r' };
private const string EndStack = "--- End of stack trace from previous location where exception was thrown ---";
// TODO: Patterns, or a bunch of these...
private static readonly HashSet<string> _asyncFrames = new HashSet<string>()
{
// 3.1 Stacks
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(Exception exception)",
"System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1.SetException(Exception exception)",
"System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)",
"System.Threading.Tasks.Task.FinishSlow(Boolean userDelegateExecute)",
"System.Threading.Tasks.Task.TrySetException(Object exceptionObject)",
// 3.0 Stacks
"System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)",
"System.Threading.Tasks.Task.RunContinuations(Object continuationObject)",
"System.Threading.Tasks.Task`1.TrySetResult(TResult result)",
"System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining)",
"System.Threading.Tasks.Task.CancellationCleanupLogic()",
"System.Threading.Tasks.Task.TrySetCanceled(CancellationToken tokenToRecord, Object cancellationException)",
"System.Threading.Tasks.Task.FinishContinuations()",
"System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(TResult result)",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)",
"System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()",
"System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1.SetResult(TResult result)",
"System.Runtime.CompilerServices.TaskAwaiter.<>c.<OutputWaitEtwEvents>b__12_0(Action innerContinuation, Task innerTask)",
// < .NET Core 3.0 stacks
"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()",
"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)",
"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)",
"System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)",
"System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()",
"System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()",
"System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()",
"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)",
"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()",
"Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()",
EndStack
};
// TODO: Adjust for URLs instead of files
private static readonly Regex _regex = new Regex($@"
^(?<{Groups.LeadIn}>{Space}*\w+{Space}+)
(?<{Groups.Frame}>
(?<{Groups.Type}>({NoSpace}+(<(?<{Groups.AsyncMethod}>\w+)>d__[0-9]+))|{NoSpace}+)\.
(?<{Groups.Method}>{NoSpace}+?){Space}*
(?<{Groups.Params}>\(({Space}*\)
|(?<{Groups.ParamType}>.+?){Space}+(?<{Groups.ParamName}>.+?)
(,{Space}*(?<{Groups.ParamType}>.+?){Space}+(?<{Groups.ParamName}>.+?))*\))
)
({Space}+
(\w+{Space}+
(?<{Groups.SourceInfo}>
(?<{Groups.Path}>([a-z]\:.+?|(\b(https?|ftp|file)://)?[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]))
(?<{Groups.LinePrefix}>\:\w+{Space}+)
(?<{Groups.Line}>[0-9]+)\p{{P}}?
|\[0x[0-9a-f]+\]{Space}+\w+{Space}+<(?<{Groups.Path}>[^>]+)>(?<{Groups.LinePrefix}>:)(?<{Groups.Line}>[0-9]+))
)
)?
)\s*$",
RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline
| RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace,
TimeSpan.FromSeconds(2));
/// <summary>
/// Converts a stack trace to formatted HTML with styling and linkifiation.
/// </summary>
/// <param name="stackTrace">The stack trace to HTMLify.</param>
/// <param name="settings">The <see cref="StackTraceSettings"/> to use in this render.</param>
/// <returns>An HTML-pretty version of the stack trace.</returns>
public static string HtmlPrettify(string stackTrace, StackTraceSettings settings)
{
string GetBetween(Capture prev, Capture next) =>
stackTrace.Substring(prev.Index + prev.Length, next.Index - (prev.Index + prev.Length));
int pos = 0;
var sb = StringBuilderCache.Get();
var matches = _regex.Matches(stackTrace);
for (var mi = 0; mi < matches.Count; mi++)
{
Match m = matches[mi];
Group leadIn = m.Groups[Groups.LeadIn],
frame = m.Groups[Groups.Frame],
type = m.Groups[Groups.Type],
asyncMethod = m.Groups[Groups.AsyncMethod],
method = m.Groups[Groups.Method],
allParams = m.Groups[Groups.Params],
sourceInfo = m.Groups[Groups.SourceInfo],
path = m.Groups[Groups.Path],
linePrefix = m.Groups[Groups.LinePrefix],
line = m.Groups[Groups.Line];
CaptureCollection paramTypes = m.Groups[Groups.ParamType].Captures,
paramNames = m.Groups[Groups.ParamName].Captures;
bool nextIsAsync = false;
if (mi < matches.Count - 1)
{
Group nextFrame = matches[mi + 1].Groups[Groups.Frame];
nextIsAsync = _asyncFrames.Contains(nextFrame.Value);
}
var isAsync = _asyncFrames.Contains(frame.Value);
// The initial message may be above an async frame
if (sb.Length == 0 && isAsync && leadIn.Index > pos)
{
sb.Append("<span class=\"stack stack-row\">")
.Append("<span class=\"stack misc\">")
.AppendHtmlEncode(stackTrace.Substring(pos, leadIn.Index - pos).Trim(NewLine_CarriageReturn))
.Append("</span>")
.Append("</span>");
pos += sb.Length;
}
sb.Append(isAsync ? "<span class=\"stack stack-row async\">" : "<span class=\"stack stack-row\">");
if (leadIn.Index > pos)
{
var miscContent = stackTrace.Substring(pos, leadIn.Index - pos);
if (miscContent.Contains(EndStack))
{
// Handle end-of-stack removals and redundant multilines remaining
miscContent = miscContent.Replace(EndStack, "")
.Replace("\r\n\r\n", "\r\n")
.Replace("\n\n", "\n\n");
}
sb.Append("<span class=\"stack misc\">")
.AppendHtmlEncode(miscContent)
.Append("</span>");
}
sb.Append("<span class=\"stack leadin\">")
.AppendHtmlEncode(leadIn.Value)
.Append("</span>");
// Check if the next line is the end of an async hand-off
var nextEndStack = stackTrace.IndexOf(EndStack, m.Index + m.Length);
if ((nextEndStack > -1 && nextEndStack < m.Index + m.Length + 3) || (!isAsync && nextIsAsync))
{
sb.Append("<span class=\"stack async-tag\">async</span> ");
}
if (asyncMethod.Success)
{
sb.Append("<span class=\"stack type\">")
.AppendGenerics(GetBetween(leadIn, asyncMethod), settings)
.Append("</span>")
.Append("<span class=\"stack method\">")
.AppendHtmlEncode(asyncMethod.Value)
.Append("</span>")
.Append("<span class=\"stack type\">")
.AppendGenerics(GetBetween(asyncMethod, method), settings);
sb.Append("</span>");
}
else
{
sb.Append("<span class=\"stack type\">")
.AppendGenerics(type.Value, settings)
.Append("<span class=\"stack dot\">")
.AppendHtmlEncode(GetBetween(type, method)) // "."
.Append("</span>")
.Append("</span>");
}
sb.Append("<span class=\"stack method-section\">")
.Append("<span class=\"stack method\">")
.AppendHtmlEncode(NormalizeMethodName(method.Value))
.Append("</span>");
if (paramTypes.Count > 0)
{
sb.Append("<span class=\"stack parens\">")
.Append(GetBetween(method, paramTypes[0]))
.Append("</span>");
for (var i = 0; i < paramTypes.Count; i++)
{
if (i > 0)
{
sb.Append("<span class=\"stack misc\">")
.AppendHtmlEncode(GetBetween(paramNames[i - 1], paramTypes[i])) // ", "
.Append("</span>");
}
sb.Append("<span class=\"stack paramType\">")
.AppendGenerics(paramTypes[i].Value, settings)
.Append("</span>")
.AppendHtmlEncode(GetBetween(paramTypes[i], paramNames[i])) // " "
.Append("<span class=\"stack paramName\">")
.AppendHtmlEncode(paramNames[i].Value)
.Append("</span>");
}
var last = paramNames[paramTypes.Count - 1];
sb.Append("<span class=\"stack parens\">")
.AppendHtmlEncode(allParams.Value.Substring(last.Index + last.Length - allParams.Index))
.Append("</span>");
}
else
{
sb.Append("<span class=\"stack parens\">")
.AppendHtmlEncode(allParams.Value) // "()"
.Append("</span>");
}
sb.Append("</span>"); // method-section for table layout
if (sourceInfo.Value.HasValue())
{
sb.Append("<span class=\"stack source-section\">");
var curPath = sourceInfo.Value;
if (settings.LinkReplacements.Count > 0)
{
foreach (var replacement in settings.LinkReplacements)
{
curPath = replacement.Key.Replace(curPath, replacement.Value);
}
}
if (curPath != sourceInfo.Value)
{
sb.Append("<span class=\"stack misc\">")
.AppendHtmlEncode(GetBetween(allParams, sourceInfo))
.Append("</span>")
.Append(curPath);
}
else if (path.Value.HasValue())
{
var subPath = GetSubPath(path.Value, type.Value);
sb.Append("<span class=\"stack misc\">")
.AppendHtmlEncode(GetBetween(allParams, path))
.Append("</span>")
.Append("<span class=\"stack path\">")
.AppendHtmlEncode(subPath)
.Append("</span>")
.AppendHtmlEncode(GetBetween(path, linePrefix))
.Append("<span class=\"stack line-prefix\">")
.AppendHtmlEncode(linePrefix.Value)
.Append("</span>")
.Append("<span class=\"stack line\">")
.AppendHtmlEncode(line.Value)
.Append("</span>");
}
sb.Append("</span>");
}
sb.Append("</span>");
pos = frame.Index + frame.Length;
}
// append anything left
sb.Append("<span class=\"stack misc\">");
LinkifyRest(sb, stackTrace, pos, settings.LinkReplacements);
sb.Append("</span>");
return sb.ToStringRecycle();
}
private static void LinkifyRest(StringBuilder sb, string stackTrace, int pos, Dictionary<Regex, string> linkReplacements)
{
while (pos < stackTrace.Length)
{
var offset = pos;
var matches = linkReplacements
.Select(x => new
{
pattern = x.Key,
match = x.Key.Match(stackTrace, offset),
replacement = x.Value,
})
.Where(x => x.match.Success)
.OrderBy(x => x.match.Index)
.ThenByDescending(x => x.match.Length)
.ToArray();
if (matches.Length == 0)
{
break;
}
var next = matches[0];
var prefixLength = next.match.Index - pos;
if (prefixLength > 0)
{
sb.AppendHtmlEncode(stackTrace.Substring(pos, prefixLength));
}
var nextPos = next.match.Index + next.match.Length;
// in ambiguous matches, take first one
var overlapping = matches.Skip(1).FirstOrDefault(x => x.match.Index < nextPos);
try
{
var replacement = next.match.Result(next.replacement);
sb.Append("<span class=\"stack source-section\">");
sb.Append(replacement); // allow HTML in the replacement
sb.Append("</span>");
}
catch (Exception ex)
{
Trace.WriteLine($"Error while applying source link pattern replacement for '{next.pattern}': " + ex);
sb.AppendHtmlEncode(next.match.Value);
}
pos = nextPos;
}
var tailLength = stackTrace.Length - pos;
if (tailLength > 0)
{
sb.AppendHtmlEncode(stackTrace.Substring(pos, tailLength));
}
}
private static char[] Backslash { get; } = new[] { '\\' };
private static string GetSubPath(string sourcePath, string type)
{
//C:\git\NickCraver\StackExchange.Exceptional\src\StackExchange.Exceptional.Shared\Utils.Test.cs
int pathPos = 0;
foreach (var path in sourcePath.Split(Backslash))
{
pathPos += (path.Length + 1);
if (type.StartsWith(path))
{
return sourcePath.Substring(pathPos);
}
}
return sourcePath;
}
/// <summary>
/// .NET Core changes methods so generics render as as Method[T], this normalizes it.
/// </summary>
private static string NormalizeMethodName(string method)
{
return method?.Replace("[", "<").Replace("]", ">");
}
}
}
internal static class StackTraceExtensions
{
private static readonly char[] _dot = new char[] { '.' };
private static readonly Regex _genericTypeRegex = new Regex($@"(?<BaseClass>{ExceptionalUtils.StackTrace.NoSpace}+)`(?<ArgCount>\d+)");
private static readonly string[] _singleT = new[] { "T" };
private static readonly Dictionary<string, string[]> _commonGenerics = new Dictionary<string, string[]>
{
["Microsoft.CodeAnalysis.SymbolVisitor`1"] = new[] { "TResult" },
["Microsoft.CodeAnalysis.Diagnostics.CodeBlockStartAnalysisContext`1"] = new[] { "TLanguageKindEnum" },
["Microsoft.CodeAnalysis.Diagnostics.SourceTextValueProvider`1"] = new[] { "TValue" },
["Microsoft.CodeAnalysis.Diagnostics.SyntaxTreeValueProvider`1"] = new[] { "TValue" },
["Microsoft.CodeAnalysis.Semantics.OperationVisitor`2"] = new[] { "TArgument", "TResult" },
["System.Converter`2"] = new[] { "TInput", "TOutput" },
["System.EventHandler`1"] = new[] { "TEventArgs" },
["System.Func`1"] = new[] { "TResult" },
["System.Func`2"] = new[] { "T", "TResult" },
["System.Func`3"] = new[] { "T1", "T2", "TResult" },
["System.Func`4"] = new[] { "T1", "T2", "T3", "TResult" },
["System.Func`5"] = new[] { "T1", "T2", "T3", "T4", "TResult" },
["System.Func`6"] = new[] { "T1", "T2", "T3", "T4", "T5", "TResult" },
["System.Func`7"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "TResult" },
["System.Func`8"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "TResult" },
["System.Func`9"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "TResult" },
["System.Func`10"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "TResult" },
["System.Func`11"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "TResult" },
["System.Func`12"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "TResult" },
["System.Func`13"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "TResult" },
["System.Func`14"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "TResult" },
["System.Func`15"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "T14", "TResult" },
["System.Func`16"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "T14", "T15", "TResult" },
["System.Func`17"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "T8", "T9", "T10", "T11", "T12", "T13", "T14", "T15", "T16", "TWhatTheHellAreYouDoing" },
["System.Tuple`8"] = new[] { "T1", "T2", "T3", "T4", "T5", "T6", "T7", "TRest" },
["System.Collections.Concurrent.ConcurrentDictionary`2"] = new[] { "TKey", "TValue" },
["System.Collections.Concurrent.OrderablePartitioner`1"] = new[] { "TSource" },
["System.Collections.Concurrent.Partitioner`1"] = new[] { "TSource" },
["System.Collections.Generic.Dictionary`2"] = new[] { "TKey", "TValue" },
["System.Collections.Generic.SortedDictionary`2"] = new[] { "TKey", "TValue" },
["System.Collections.Generic.SortedList`2"] = new[] { "TKey", "TValue" },
["System.Collections.Immutable.ImmutableDictionary`2"] = new[] { "TKey", "TValue" },
["System.Collections.Immutable.ImmutableSortedDictionary`2"] = new[] { "TKey", "TValue" },
["System.Collections.ObjectModel.KeyedCollection`2"] = new[] { "TKey", "TItem" },
["System.Collections.ObjectModel.ReadOnlyDictionary`2"] = new[] { "TKey", "TValue" },
["System.Data.Common.CommandTrees.DbExpressionVisitor`1"] = new[] { "TResultType" },
["System.Data.Linq.EntitySet`1"] = new[] { "TEntity" },
["System.Data.Linq.Table`1"] = new[] { "TEntity" },
["System.Data.Linq.Mapping.MetaAccessor`2"] = new[] { "TEntity", "TMember" },
["System.Data.Linq.SqlClient.Implementation.ObjectMaterializer`1"] = new[] { "TDataReader" },
["System.Data.Objects.ObjectSet`1"] = new[] { "TEntity" },
["System.Data.Objects.DataClasses.EntityCollection`1"] = new[] { "TEntity" },
["System.Data.Objects.DataClasses.EntityReference`1"] = new[] { "TEntity" },
["System.Linq.Lookup`2"] = new[] { "TKey", "TElement" },
["System.Linq.OrderedParallelQuery`1"] = new[] { "TSource" },
["System.Linq.ParallelQuery`1"] = new[] { "TSource" },
["System.Linq.Expressions.Expression`1"] = new[] { "TDelegate" },
["System.Runtime.CompilerServices.ConditionalWeakTable`2"] = new[] { "TKey", "TValue" },
["System.Threading.Tasks.Task`1"] = new[] { "TResult" },
["System.Threading.Tasks.TaskCompletionSource`1"] = new[] { "TResult" },
["System.Threading.Tasks.TaskFactory`1"] = new[] { "TResult" },
["System.Web.ModelBinding.ArrayModelBinder`1"] = new[] { "TElement" },
["System.Web.ModelBinding.CollectionModelBinder`1"] = new[] { "TElement" },
["System.Web.ModelBinding.DataAnnotationsModelValidator`1"] = new[] { "TAttribute" },
["System.Web.ModelBinding.DictionaryModelBinder`2"] = new[] { "TKey", "TValue" },
["System.Web.ModelBinding.DictionaryValueProvider`1"] = new[] { "TValue" },
["System.Web.ModelBinding.KeyValuePairModelBinder`2"] = new[] { "TKey", "TValue" },
["System.Windows.WeakEventManager`2"] = new[] { "TEventSource", "TEventArgs" },
["System.Windows.Documents.TextElementCollection`1"] = new[] { "TextElementType" },
["System.Windows.Threading.DispatcherOperation`1"] = new[] { "TResult" },
["System.Xaml.Schema.XamlValueConverter`1"] = new[] { "TConverterBase" },
};
public static StringBuilder AppendGenerics(this StringBuilder sb, string typeOrMethod, StackTraceSettings settings)
{
const string _dotSpan = "<span class=\"stack dot\">.</span>";
if (!settings.EnablePrettyGenerics)
{
return sb.AppendHtmlEncode(typeOrMethod);
}
// Check the common framework list above
_commonGenerics.TryGetValue(typeOrMethod, out string[] args);
// Break each type down by namespace and class (remember, we *could* have nested generic classes)
var classes = typeOrMethod.Split(_dot);
// Loop through each dot component of the type, e.g. "System", "Collections", "Generics"
for (var i = 0; i < classes.Length; i++)
{
if (i > 0)
{
sb.Append(_dotSpan);
}
var match = _genericTypeRegex.Match(classes[i]);
if (match.Success)
{
// If arguments aren't known, get the defaults
if (args == null && int.TryParse(match.Groups["ArgCount"].Value, out int count))
{
if (count == 1)
{
args = _singleT;
}
else
{
args = new string[count];
for (var j = 0; j < count; j++)
{
args[j] = "T" + (j + 1).ToString(); // <T>, or <T1, T2, T3>
}
}
}
// In the known case, BaseClass is "System.Collections.Generic.Dictionary"
// In the unknown case, we're hitting here at "Class" only
sb.AppendHtmlEncode(match.Groups["BaseClass"].Value);
AppendArgs(args);
}
else
{
sb.AppendHtmlEncode(classes[i]);
}
}
return sb;
void AppendArgs(string[] tArgs)
{
switch (settings.Language)
{
case StackTraceSettings.CodeLanguage.VB:
sb.Append("(Of ");
break;
case StackTraceSettings.CodeLanguage.CSharp:
case StackTraceSettings.CodeLanguage.FSharp:
sb.Append("<");
break;
}
// Don't put crazy amounts of arguments in here
if (tArgs.Length > 5)
{
sb.Append("<span class=\"stack generic-type\">").Append(tArgs[0]).Append("</span>")
.Append(",")
.Append("<span class=\"stack generic-type\">").Append(tArgs[1]).Append("</span>")
.Append(",")
.Append("<span class=\"stack generic-type\">").Append(tArgs[2]).Append("</span>")
.Append("…")
.Append("<span class=\"stack generic-type\">").Append(tArgs[tArgs.Length - 1]).Append("</span>");
}
else
{
for (int i = 0; i < tArgs.Length; i++)
{
if (i > 0)
{
sb.Append(",");
}
if (settings.IncludeGenericTypeNames)
{
sb.Append("<span class=\"stack generic-type\">");
if (settings.Language == StackTraceSettings.CodeLanguage.FSharp)
{
sb.Append("'");
}
sb.Append(tArgs[i])
.Append("</span>");
}
}
}
switch (settings.Language)
{
case StackTraceSettings.CodeLanguage.VB:
sb.Append(")");
break;
case StackTraceSettings.CodeLanguage.CSharp:
case StackTraceSettings.CodeLanguage.FSharp:
sb.Append(">");
break;
}
}
}
}
}
// Simple LINQPad script to generate the type mapping above for framework bits
//AppDomain.CurrentDomain
// .GetAssemblies()
// .SelectMany(t => t.GetTypes())
// .Where(t => t.IsClass && t.IsPublic && t.IsGenericType && t.GetGenericArguments().Length > 0
// && (t.Namespace.StartsWith("System") || t.Namespace.StartsWith("Microsoft")))
// .OrderBy(t => t.Namespace).ThenBy(t => t.FullName.Substring(0, t.FullName.LastIndexOf("`")))
// .Select(t => new { t.FullName, Args = t.GetGenericArguments().Select(a => $@"""{a.Name}""").ToList() })
// .Where(t =>
// {
// if (t.Args.Count == 1 && t.Args[0] == @"""T""") return false;
// for (var i = 0; i < t.Args.Count; i++)
// {
// if (t.Args[i] != ($@"""T{(i + 1)}""")) return true;
// }
// return false;
// })
// .Select(t => $" [\"{t.FullName}\"] = new[] {{ {string.Join(", ", t.Args)} }},".Dump())
// .ToList();
| 53.535836 | 172 | 0.479632 | [
"Apache-2.0",
"MIT"
] | CampolongoHospital/StackExchange.Exceptional | src/StackExchange.Exceptional.Shared/ExceptionalUtils.StackTrace.cs | 31,376 | C# |
// The MIT License (MIT)
//
// Copyright (c) 2018 - 2019 Lutando Ngqakaza
// https://github.com/Lutando/EventFly
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Linq.Expressions;
using Akka.Actor;
using Akka.Cluster.Sharding;
using EventFly.Aggregates;
using EventFly.Clustering.Dispatchers;
using EventFly.Core;
using EventFly.Sagas;
using EventFly.Sagas.AggregateSaga;
namespace EventFly.Clustering.Core
{
public static class ClusterFactory<TAggregateManager,TAggregate,TIdentity>
where TAggregateManager : ReceiveActor, IAggregateManager<TAggregate, TIdentity>
where TAggregate : ActorBase, IAggregateRoot<TIdentity>
where TIdentity : IIdentity
{
public static IActorRef StartClusteredAggregate(
ActorSystem actorSystem,
int numberOfShards = 12)
{
var clusterSharding = ClusterSharding.Get(actorSystem);
var clusterShardingSettings = clusterSharding.Settings;
var aggregateManagerProps = Props.Create<TAggregateManager>();
var shardRef = clusterSharding.Start(
typeof(TAggregateManager).Name,
Props.Create(() => new ClusterParentProxy(aggregateManagerProps, true)),
clusterShardingSettings,
new MessageExtractor<TAggregate, TIdentity>(numberOfShards)
);
return shardRef;
}
public static IActorRef StartClusteredAggregate(
ActorSystem actorSystem,
Expression<Func<TAggregateManager>> aggregateManagerFactory,
int numberOfShards = 12)
{
var clusterSharding = ClusterSharding.Get(actorSystem);
var clusterShardingSettings = clusterSharding.Settings;
var aggregateManagerProps = Props.Create(aggregateManagerFactory);
var shardRef = clusterSharding.Start(
typeof(TAggregateManager).Name,
Props.Create(() => new ClusterParentProxy(aggregateManagerProps, false)),
clusterShardingSettings,
new MessageExtractor<TAggregate, TIdentity>(numberOfShards)
);
return shardRef;
}
public static IActorRef StartAggregateClusterProxy(
ActorSystem actorSystem,
string clusterRoleName,
int numberOfShards = 12)
{
var clusterSharding = ClusterSharding.Get(actorSystem);
var shardRef = clusterSharding.StartProxy(
typeof(TAggregateManager).Name,
clusterRoleName,
new MessageExtractor<TAggregate, TIdentity>(numberOfShards)
);
return shardRef;
}
}
public static class ClusterFactory<TAggregateSagaManager, TAggregateSaga, TIdentity, TSagaLocator>
where TAggregateSagaManager : ReceiveActor ,IAggregateSagaManager<TAggregateSaga, TIdentity, TSagaLocator>
where TAggregateSaga : ActorBase, IAggregateSaga<TIdentity>
where TIdentity : SagaId<TIdentity>
where TSagaLocator : class, ISagaLocator<TIdentity>, new()
{
public static IActorRef StartClusteredAggregateSaga(
ActorSystem actorSystem,
Expression<Func<TAggregateSaga>> sagaFactory,
string clusterRoleName,
int numberOfShards = 12)
{
if (sagaFactory == null)
{
throw new ArgumentNullException(nameof(sagaFactory));
}
var clusterSharding = ClusterSharding.Get(actorSystem);
var clusterShardingSettings = clusterSharding.Settings;
var aggregateSagaManagerProps = Props.Create<TAggregateSagaManager>(sagaFactory);
var shardRef = clusterSharding.Start(
typeof(TAggregateSagaManager).Name,
Props.Create(() => new ClusterParentProxy(aggregateSagaManagerProps, true)),
clusterShardingSettings,
new MessageExtractor<TAggregateSagaManager, TAggregateSaga, TIdentity, TSagaLocator>(numberOfShards)
);
actorSystem.ActorOf(Props.Create(() =>
new ShardedAggregateSagaDispatcher<TAggregateSagaManager, TAggregateSaga, TIdentity, TSagaLocator>(
clusterRoleName, numberOfShards)),$"{typeof(TAggregateSaga).Name}Dispatcher");
return shardRef;
}
public static IActorRef StartAggregateSagaClusterProxy(
ActorSystem actorSystem,
string clusterRoleName,
int numberOfShards = 12)
{
var clusterSharding = ClusterSharding.Get(actorSystem);
var shardRef = clusterSharding.StartProxy(
typeof(TAggregateSagaManager).Name,
clusterRoleName,
new MessageExtractor<TAggregateSagaManager, TAggregateSaga, TIdentity, TSagaLocator>(numberOfShards)
);
return shardRef;
}
}
}
| 40.421053 | 116 | 0.656901 | [
"MIT"
] | Sporteco/EventFly | src/EventFly.Clustering/Core/ClusterFactory.cs | 6,146 | C# |
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
namespace WeatherApi.Domain.WeatherForecasts
{
public class WeatherForecast
{
[JsonPropertyName("city")]
public string City { get; set; }
[JsonPropertyName("country")]
public string Country { get; set; }
[JsonPropertyName("dailyForecasts")]
public List<ForecastDetails> DailyForecasts { get; set; }
}
}
| 24.105263 | 65 | 0.672489 | [
"Apache-2.0"
] | lijulat/WeatherForecastApp | backend/WeatherApi.Domain/WeatherForecasts/WeatherForecast.cs | 460 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace Com.Danliris.Service.Packing.Inventory.Application.DTOs
{
public class StorageDto
{
public int? _id { get; set; }
public string code { get; set; }
public string name { get; set; }
}
}
| 21.357143 | 65 | 0.655518 | [
"MIT"
] | AndreaZain/com-danliris-service-packing-inventory | src/Com.Danliris.Service.Packing.Inventory.Application/DTOs/StorageDto.cs | 301 | C# |
using System.Collections.Generic;
using FluentAssertions;
using Xunit;
namespace Useful.Extensions.Tests
{
public class DictionaryExtensionsTests
{
[Fact]
public void test_value_or_default_returns_the_expected_result_with_default_set()
{
// Arrange
var values = new Dictionary<string, int> { { "some text", 1 }, { "more text", 2 } };
// Act
var result = values.ValueOrDefault("some text", 99);
// Assert
result.Should().Be(1);
}
[Fact]
public void test_value_or_default_returns_the_expected_result()
{
// Arrange
var values = new Dictionary<string, int> { { "some text", 1 }, { "more text", 2 } };
// Act
var result = values.ValueOrDefault("some text");
// Assert
result.Should().Be(1);
}
[Fact]
public void test_if_value_not_found_then_value_or_default_returns_the_default_value()
{
// Arrange
var values = new Dictionary<string, int> { { "some text", 1 }, { "more text", 2 } };
// Act
var result = values.ValueOrDefault("something", 99);
// Assert
result.Should().Be(99);
}
[Fact]
public void test_a_null_dictionary_for_value_or_default_returns_the_default_value()
{
// Arrange
// Act
var result = ((Dictionary<string, int>) null).ValueOrDefault("something", 99);
// Assert
result.Should().Be(99);
}
[Fact]
public void test_try_get_value_or_default_returns_the_expected_result()
{
// Arrange
var values = new Dictionary<int, int> { { 1, 100 }, { 2, 102 } };
// Act
var result = values.TryGetValueOrDefault(1, 99);
// Assert
result.Should().Be(100);
}
[Fact]
public void test_if_value_not_found_then_try_get_value_or_default_returns_the_default_value()
{
// Arrange
var values = new Dictionary<int, int> { { 1, 100 }, { 2, 102 } };
// Act
var result = values.TryGetValueOrDefault(9, 99);
// Assert
result.Should().Be(99);
}
[Fact]
public void test_a_null_dictionary_for_try_get_value_or_default_returns_the_default_value()
{
// Arrange
// Act
var result = ((Dictionary<int, int>)null).TryGetValueOrDefault(9, 99);
// Assert
result.Should().Be(99);
}
}
}
| 27.969697 | 101 | 0.518238 | [
"MIT"
] | Tazmainiandevil/Useful.Extensions | Tests/Useful.Extensions.Tests/DictionaryExtensionsTests.cs | 2,771 | C# |
/* Copyright 2020-present MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Net;
using System.Threading;
using MongoDB.Driver.Core.Connections;
using MongoDB.Driver.Core.Misc;
namespace MongoDB.Driver.Core.Servers
{
internal interface IRoundTripTimeMonitor : IDisposable
{
TimeSpan Average { get; }
void AddSample(TimeSpan roundTripTime);
void Reset();
void Start();
}
internal sealed class RoundTripTimeMonitor : IRoundTripTimeMonitor
{
private readonly ExponentiallyWeightedMovingAverage _averageRoundTripTimeCalculator = new ExponentiallyWeightedMovingAverage(0.2);
private readonly CancellationToken _cancellationToken;
private readonly CancellationTokenSource _cancellationTokenSource;
private readonly IConnectionFactory _connectionFactory;
private bool _disposed;
private readonly EndPoint _endPoint;
private readonly TimeSpan _heartbeatInterval;
private readonly object _lock = new object();
private IConnection _roundTripTimeConnection;
private Thread _roundTripTimeMonitorThread;
private readonly ServerApi _serverApi;
private readonly ServerId _serverId;
public RoundTripTimeMonitor(
IConnectionFactory connectionFactory,
ServerId serverId,
EndPoint endpoint,
TimeSpan heartbeatInterval,
ServerApi serverApi)
{
_connectionFactory = Ensure.IsNotNull(connectionFactory, nameof(connectionFactory));
_serverId = Ensure.IsNotNull(serverId, nameof(serverId));
_endPoint = Ensure.IsNotNull(endpoint, nameof(endpoint));
_heartbeatInterval = heartbeatInterval;
_serverApi = serverApi;
_cancellationTokenSource = new CancellationTokenSource();
_cancellationToken = _cancellationTokenSource.Token;
}
public TimeSpan Average
{
get
{
lock (_lock)
{
return _averageRoundTripTimeCalculator.Average;
}
}
}
// public methods
public void Dispose()
{
if (!_disposed)
{
_disposed = true;
_cancellationTokenSource.Cancel();
_cancellationTokenSource.Dispose();
try { _roundTripTimeConnection?.Dispose(); } catch { }
}
}
public void Start()
{
_roundTripTimeMonitorThread = new Thread(ThreadStart) { IsBackground = true };
_roundTripTimeMonitorThread.Start();
void ThreadStart()
{
try
{
MonitorServer();
}
catch (OperationCanceledException)
{
// ignore OperationCanceledException
}
}
}
// private methods
private void MonitorServer()
{
var helloOk = false;
while (!_cancellationToken.IsCancellationRequested)
{
try
{
if (_roundTripTimeConnection == null)
{
InitializeConnection(); // sets _roundTripTimeConnection
}
else
{
var helloCommand = HelloHelper.CreateCommand(_serverApi, helloOk);
var helloProtocol = HelloHelper.CreateProtocol(helloCommand, _serverApi);
var stopwatch = Stopwatch.StartNew();
var helloResult = HelloHelper.GetResult(_roundTripTimeConnection, helloProtocol, _cancellationToken);
stopwatch.Stop();
AddSample(stopwatch.Elapsed);
helloOk = helloResult.HelloOk;
}
}
catch (Exception)
{
IConnection toDispose;
lock (_lock)
{
toDispose = _roundTripTimeConnection;
_roundTripTimeConnection = null;
}
toDispose?.Dispose();
}
ThreadHelper.Sleep(_heartbeatInterval, _cancellationToken);
}
}
private void InitializeConnection()
{
_cancellationToken.ThrowIfCancellationRequested();
var roundTripTimeConnection = _connectionFactory.CreateConnection(_serverId, _endPoint);
var stopwatch = Stopwatch.StartNew();
try
{
// if we are cancelling, it's because the server has
// been shut down and we really don't need to wait.
roundTripTimeConnection.Open(_cancellationToken);
_cancellationToken.ThrowIfCancellationRequested();
}
catch
{
// dispose it here because the _connection is not initialized yet
try { roundTripTimeConnection.Dispose(); } catch { }
throw;
}
stopwatch.Stop();
lock (_lock)
{
_roundTripTimeConnection = roundTripTimeConnection;
}
AddSample(stopwatch.Elapsed);
}
public void AddSample(TimeSpan roundTripTime)
{
lock (_lock)
{
_averageRoundTripTimeCalculator.AddSample(roundTripTime);
}
}
public void Reset()
{
lock (_lock)
{
_averageRoundTripTimeCalculator.Reset();
}
}
}
}
| 33.642105 | 138 | 0.562735 | [
"Apache-2.0"
] | Etherna/mongo-csharp-driver | src/MongoDB.Driver.Core/Core/Servers/RoundTripTimeMonitor.cs | 6,394 | C# |
using Abp.Application.Features;
using Abp.Domain.Repositories;
using Abp.MultiTenancy;
using Foyer.Authorization.Users;
using Foyer.Editions;
namespace Foyer.MultiTenancy
{
public class TenantManager : AbpTenantManager<Tenant, User>
{
public TenantManager(
IRepository<Tenant> tenantRepository,
IRepository<TenantFeatureSetting, long> tenantFeatureRepository,
EditionManager editionManager,
IAbpZeroFeatureValueStore featureValueStore
)
: base(
tenantRepository,
tenantFeatureRepository,
editionManager,
featureValueStore
)
{
}
}
} | 27.769231 | 77 | 0.621884 | [
"MIT"
] | ApplixDev/foyer | src/Foyer.Core/MultiTenancy/TenantManager.cs | 724 | C# |
namespace Tfe.NetClient.Applies
{
using System;
using System.Text.Json.Serialization;
/// <summary>
/// ApplyResponse
/// </summary>
public class ApplyResponse
{
/// <summary>
/// Data
/// </summary>
/// <value></value>
[JsonPropertyName("data")]
public Data Data { get; set; }
}
/// <summary>
/// Data
/// </summary>
public class Data
{
/// <summary>
/// Id
/// </summary>
/// <value></value>
[JsonPropertyName("id")]
public string Id { get; set; }
/// <summary>
/// Type
/// </summary>
/// <value></value>
[JsonPropertyName("type")]
public string Type { get; set; }
/// <summary>
/// Attributes
/// </summary>
/// <value></value>
[JsonPropertyName("attributes")]
public Attributes Attributes { get; set; }
/// <summary>
/// Relationships
/// </summary>
/// <value></value>
[JsonPropertyName("relationships")]
public Relationships Relationships { get; set; }
/// <summary>
/// Links
/// </summary>
/// <value></value>
[JsonPropertyName("links")]
public Links Links { get; set; }
}
/// <summary>
/// Attributes
/// </summary>
public class Attributes
{
/// <summary>
/// Status
/// </summary>
/// <value></value>
[JsonPropertyName("status")]
public string Status { get; set; }
/// <summary>
/// StatusTimestamps
/// </summary>
/// <value></value>
[JsonPropertyName("status-timestamps")]
public StatusTimestamps StatusTimestamps { get; set; }
/// <summary>
/// LogReadUrl
/// </summary>
/// <value></value>
[JsonPropertyName("log-read-url")]
public Uri LogReadUrl { get; set; }
/// <summary>
/// ResourceAdditions
/// </summary>
/// <value></value>
[JsonPropertyName("resource-additions")]
public long ResourceAdditions { get; set; }
/// <summary>
/// ResourceChanges
/// </summary>
/// <value></value>
[JsonPropertyName("resource-changes")]
public long ResourceChanges { get; set; }
/// <summary>
/// ResourceDestructions
/// </summary>
/// <value></value>
[JsonPropertyName("resource-destructions")]
public long ResourceDestructions { get; set; }
}
/// <summary>
/// StatusTimestamps
/// </summary>
public class StatusTimestamps
{
/// <summary>
/// QueuedAt
/// </summary>
/// <value></value>
[JsonPropertyName("queued-at")]
public DateTimeOffset QueuedAt { get; set; }
/// <summary>
/// StartedAt
/// </summary>
/// <value></value>
[JsonPropertyName("started-at")]
public DateTimeOffset StartedAt { get; set; }
/// <summary>
/// FinishedAt
/// </summary>
/// <value></value>
[JsonPropertyName("finished-at")]
public DateTimeOffset FinishedAt { get; set; }
}
/// <summary>
/// Links
/// </summary>
public class Links
{
/// <summary>
/// Self
/// </summary>
/// <value></value>
[JsonPropertyName("self")]
public string Self { get; set; }
}
/// <summary>
/// Relationships
/// </summary>
public class Relationships
{
/// <summary>
/// StateVersions
/// </summary>
/// <value></value>
[JsonPropertyName("state-versions")]
public StateVersions StateVersions { get; set; }
}
/// <summary>
/// StateVersions
/// </summary>
public class StateVersions
{
/// <summary>
/// Data
/// </summary>
/// <value></value>
[JsonPropertyName("data")]
public Datum[] Data { get; set; }
}
/// <summary>
/// Datum
/// </summary>
public class Datum
{
/// <summary>
/// Id
/// </summary>
/// <value></value>
[JsonPropertyName("id")]
public string Id { get; set; }
/// <summary>
/// Type
/// </summary>
/// <value></value>
[JsonPropertyName("type")]
public string Type { get; set; }
}
}
| 23.407216 | 62 | 0.474785 | [
"MIT"
] | Manuss20/Tfe.NetClient | src/Tfe.NetClient/Features/Applies/AppliesResponse.cs | 4,541 | C# |
// 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.
//---------------------------------------------------------------------------
//
// Description:
// Definition of known types in PresentationFramework.dll and
// PresentationCore.dll and WindowsBase.dll
//
// THIS FILE HAS BEEN AUTOMATICALLY GENERATED.
// (See generator code in wcp\tools\KnownTypes\KnownTypesInitializer.cs)
//
// If you are REMOVING or RENAMING an EXISTING TYPE, then a build error has sent
// you here because this file no longer compiles.
// The MINIMAL REQUIRED steps are:
// you have renamed or removed in Framework, Core or Base
// 2) Update BamlWriterVersion in BamlVersionHeader.cs, incrementing the second number
// 3) Build the WCP compiler. To do that; (on FRE) build from wcp\build.
// When it tells you the WCP compiler has changed, install it in the root
// To do that: cd \nt\tools and run UpdateWcpCompiler.
// (Don't forget to check in this compiler updates with your WCP changes)
// 4) Build from wcp. (FRE or CHK) Make certain that wcp builds cleanly.
// 5) Don't forget to check in compiler updates in the root Tools directory
// Note: There is no need to regenerate from the tool in this case.
//
// IF you are ADDING NEW TYPES, or you want the new name of a RENAMED TYPE to showup:
// The OPTIONAL or ADDITIONAL steps (to use perf optimization for your type) are:
// 1) Build the dll(s) that define the new types
// 2) Update BamlWriterVersion in BamlVersionHeader.cs, incrementing the second number
// 3) (On FRE build) Run wcp\tools\buildscripts\UpdateKnownTypes.cmd
// Or more directly you can run: KnownTypesInitializer.exe
// Note: You may see other new types that have been have added since the last time
// this file was generated.
// 4) Build the WCP compiler. To do that; (on FRE) build from wcp\build.
// When it tells you the WCP compiler has changed, install it in the root
// To do that: cd \nt\tools and run UpdateWcpCompiler.
// (Don't forget to check in this compiler updates with your WCP changes)
// 5) (FRE or CHK) Rebuild everything under wcp to pick up the KnownTypes changes
// 6) Don't forget to check in compiler updates in the root Tools directory
//
// This file is shared by PresentationFramework.dll and PresentaionBuildTasks.dll.
//
// The code marked with #if PBTCOMPILER is compiled into PresentationBuildTasks.dll.
// The code marked with #if !PBTCOMPILER is compiled into PresenationFramework.dll
// The code without #if flag will be compiled into both dlls.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel; // TypeConverters
using System.Diagnostics;
using System.Globalization; // CultureInfo KnownType
using System.Reflection;
using MS.Utility;
// Disabling 1634 and 1691:
// In order to avoid generating warnings about unknown message numbers and
// unknown pragmas when compiling C# source code with the C# compiler,
// you need to disable warnings 1634 and 1691. (Presharp Documentation)
#pragma warning disable 1634, 1691
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
// This enum specifies the TypeIds we use for know types in BAML
// The baml files contains the negative of these values
internal enum KnownElements : short
{
UnknownElement = 0,
AccessText,
AdornedElementPlaceholder,
Adorner,
AdornerDecorator,
AdornerLayer,
AffineTransform3D,
AmbientLight,
AnchoredBlock,
Animatable,
AnimationClock,
AnimationTimeline,
Application,
ArcSegment,
ArrayExtension,
AxisAngleRotation3D,
BaseIListConverter,
BeginStoryboard,
BevelBitmapEffect,
BezierSegment,
Binding,
BindingBase,
BindingExpression,
BindingExpressionBase,
BindingListCollectionView,
BitmapDecoder,
BitmapEffect,
BitmapEffectCollection,
BitmapEffectGroup,
BitmapEffectInput,
BitmapEncoder,
BitmapFrame,
BitmapImage,
BitmapMetadata,
BitmapPalette,
BitmapSource,
Block,
BlockUIContainer,
BlurBitmapEffect,
BmpBitmapDecoder,
BmpBitmapEncoder,
Bold,
BoolIListConverter,
Boolean,
BooleanAnimationBase,
BooleanAnimationUsingKeyFrames,
BooleanConverter,
BooleanKeyFrame,
BooleanKeyFrameCollection,
BooleanToVisibilityConverter,
Border,
BorderGapMaskConverter,
Brush,
BrushConverter,
BulletDecorator,
Button,
ButtonBase,
Byte,
ByteAnimation,
ByteAnimationBase,
ByteAnimationUsingKeyFrames,
ByteConverter,
ByteKeyFrame,
ByteKeyFrameCollection,
CachedBitmap,
Camera,
Canvas,
Char,
CharAnimationBase,
CharAnimationUsingKeyFrames,
CharConverter,
CharIListConverter,
CharKeyFrame,
CharKeyFrameCollection,
CheckBox,
Clock,
ClockController,
ClockGroup,
CollectionContainer,
CollectionView,
CollectionViewSource,
Color,
ColorAnimation,
ColorAnimationBase,
ColorAnimationUsingKeyFrames,
ColorConvertedBitmap,
ColorConvertedBitmapExtension,
ColorConverter,
ColorKeyFrame,
ColorKeyFrameCollection,
ColumnDefinition,
CombinedGeometry,
ComboBox,
ComboBoxItem,
CommandConverter,
ComponentResourceKey,
ComponentResourceKeyConverter,
CompositionTarget,
Condition,
ContainerVisual,
ContentControl,
ContentElement,
ContentPresenter,
ContentPropertyAttribute,
ContentWrapperAttribute,
ContextMenu,
ContextMenuService,
Control,
ControlTemplate,
ControllableStoryboardAction,
CornerRadius,
CornerRadiusConverter,
CroppedBitmap,
CultureInfo,
CultureInfoConverter,
CultureInfoIetfLanguageTagConverter,
Cursor,
CursorConverter,
DashStyle,
DataChangedEventManager,
DataTemplate,
DataTemplateKey,
DataTrigger,
DateTime,
DateTimeConverter,
DateTimeConverter2,
Decimal,
DecimalAnimation,
DecimalAnimationBase,
DecimalAnimationUsingKeyFrames,
DecimalConverter,
DecimalKeyFrame,
DecimalKeyFrameCollection,
Decorator,
DefinitionBase,
DependencyObject,
DependencyProperty,
DependencyPropertyConverter,
DialogResultConverter,
DiffuseMaterial,
DirectionalLight,
DiscreteBooleanKeyFrame,
DiscreteByteKeyFrame,
DiscreteCharKeyFrame,
DiscreteColorKeyFrame,
DiscreteDecimalKeyFrame,
DiscreteDoubleKeyFrame,
DiscreteInt16KeyFrame,
DiscreteInt32KeyFrame,
DiscreteInt64KeyFrame,
DiscreteMatrixKeyFrame,
DiscreteObjectKeyFrame,
DiscretePoint3DKeyFrame,
DiscretePointKeyFrame,
DiscreteQuaternionKeyFrame,
DiscreteRectKeyFrame,
DiscreteRotation3DKeyFrame,
DiscreteSingleKeyFrame,
DiscreteSizeKeyFrame,
DiscreteStringKeyFrame,
DiscreteThicknessKeyFrame,
DiscreteVector3DKeyFrame,
DiscreteVectorKeyFrame,
DockPanel,
DocumentPageView,
DocumentReference,
DocumentViewer,
DocumentViewerBase,
Double,
DoubleAnimation,
DoubleAnimationBase,
DoubleAnimationUsingKeyFrames,
DoubleAnimationUsingPath,
DoubleCollection,
DoubleCollectionConverter,
DoubleConverter,
DoubleIListConverter,
DoubleKeyFrame,
DoubleKeyFrameCollection,
Drawing,
DrawingBrush,
DrawingCollection,
DrawingContext,
DrawingGroup,
DrawingImage,
DrawingVisual,
DropShadowBitmapEffect,
Duration,
DurationConverter,
DynamicResourceExtension,
DynamicResourceExtensionConverter,
Ellipse,
EllipseGeometry,
EmbossBitmapEffect,
EmissiveMaterial,
EnumConverter,
EventManager,
EventSetter,
EventTrigger,
Expander,
Expression,
ExpressionConverter,
Figure,
FigureLength,
FigureLengthConverter,
FixedDocument,
FixedDocumentSequence,
FixedPage,
Floater,
FlowDocument,
FlowDocumentPageViewer,
FlowDocumentReader,
FlowDocumentScrollViewer,
FocusManager,
FontFamily,
FontFamilyConverter,
FontSizeConverter,
FontStretch,
FontStretchConverter,
FontStyle,
FontStyleConverter,
FontWeight,
FontWeightConverter,
FormatConvertedBitmap,
Frame,
FrameworkContentElement,
FrameworkElement,
FrameworkElementFactory,
FrameworkPropertyMetadata,
FrameworkPropertyMetadataOptions,
FrameworkRichTextComposition,
FrameworkTemplate,
FrameworkTextComposition,
Freezable,
GeneralTransform,
GeneralTransformCollection,
GeneralTransformGroup,
Geometry,
Geometry3D,
GeometryCollection,
GeometryConverter,
GeometryDrawing,
GeometryGroup,
GeometryModel3D,
GestureRecognizer,
GifBitmapDecoder,
GifBitmapEncoder,
GlyphRun,
GlyphRunDrawing,
GlyphTypeface,
Glyphs,
GradientBrush,
GradientStop,
GradientStopCollection,
Grid,
GridLength,
GridLengthConverter,
GridSplitter,
GridView,
GridViewColumn,
GridViewColumnHeader,
GridViewHeaderRowPresenter,
GridViewRowPresenter,
GridViewRowPresenterBase,
GroupBox,
GroupItem,
Guid,
GuidConverter,
GuidelineSet,
HeaderedContentControl,
HeaderedItemsControl,
HierarchicalDataTemplate,
HostVisual,
Hyperlink,
IAddChild,
IAddChildInternal,
ICommand,
IComponentConnector,
INameScope,
IStyleConnector,
IconBitmapDecoder,
Image,
ImageBrush,
ImageDrawing,
ImageMetadata,
ImageSource,
ImageSourceConverter,
InPlaceBitmapMetadataWriter,
InkCanvas,
InkPresenter,
Inline,
InlineCollection,
InlineUIContainer,
InputBinding,
InputDevice,
InputLanguageManager,
InputManager,
InputMethod,
InputScope,
InputScopeConverter,
InputScopeName,
InputScopeNameConverter,
Int16,
Int16Animation,
Int16AnimationBase,
Int16AnimationUsingKeyFrames,
Int16Converter,
Int16KeyFrame,
Int16KeyFrameCollection,
Int32,
Int32Animation,
Int32AnimationBase,
Int32AnimationUsingKeyFrames,
Int32Collection,
Int32CollectionConverter,
Int32Converter,
Int32KeyFrame,
Int32KeyFrameCollection,
Int32Rect,
Int32RectConverter,
Int64,
Int64Animation,
Int64AnimationBase,
Int64AnimationUsingKeyFrames,
Int64Converter,
Int64KeyFrame,
Int64KeyFrameCollection,
Italic,
ItemCollection,
ItemsControl,
ItemsPanelTemplate,
ItemsPresenter,
JournalEntry,
JournalEntryListConverter,
JournalEntryUnifiedViewConverter,
JpegBitmapDecoder,
JpegBitmapEncoder,
KeyBinding,
KeyConverter,
KeyGesture,
KeyGestureConverter,
KeySpline,
KeySplineConverter,
KeyTime,
KeyTimeConverter,
KeyboardDevice,
Label,
LateBoundBitmapDecoder,
LengthConverter,
Light,
Line,
LineBreak,
LineGeometry,
LineSegment,
LinearByteKeyFrame,
LinearColorKeyFrame,
LinearDecimalKeyFrame,
LinearDoubleKeyFrame,
LinearGradientBrush,
LinearInt16KeyFrame,
LinearInt32KeyFrame,
LinearInt64KeyFrame,
LinearPoint3DKeyFrame,
LinearPointKeyFrame,
LinearQuaternionKeyFrame,
LinearRectKeyFrame,
LinearRotation3DKeyFrame,
LinearSingleKeyFrame,
LinearSizeKeyFrame,
LinearThicknessKeyFrame,
LinearVector3DKeyFrame,
LinearVectorKeyFrame,
List,
ListBox,
ListBoxItem,
ListCollectionView,
ListItem,
ListView,
ListViewItem,
Localization,
LostFocusEventManager,
MarkupExtension,
Material,
MaterialCollection,
MaterialGroup,
Matrix,
Matrix3D,
Matrix3DConverter,
MatrixAnimationBase,
MatrixAnimationUsingKeyFrames,
MatrixAnimationUsingPath,
MatrixCamera,
MatrixConverter,
MatrixKeyFrame,
MatrixKeyFrameCollection,
MatrixTransform,
MatrixTransform3D,
MediaClock,
MediaElement,
MediaPlayer,
MediaTimeline,
Menu,
MenuBase,
MenuItem,
MenuScrollingVisibilityConverter,
MeshGeometry3D,
Model3D,
Model3DCollection,
Model3DGroup,
ModelVisual3D,
ModifierKeysConverter,
MouseActionConverter,
MouseBinding,
MouseDevice,
MouseGesture,
MouseGestureConverter,
MultiBinding,
MultiBindingExpression,
MultiDataTrigger,
MultiTrigger,
NameScope,
NavigationWindow,
NullExtension,
NullableBoolConverter,
NullableConverter,
NumberSubstitution,
Object,
ObjectAnimationBase,
ObjectAnimationUsingKeyFrames,
ObjectDataProvider,
ObjectKeyFrame,
ObjectKeyFrameCollection,
OrthographicCamera,
OuterGlowBitmapEffect,
Page,
PageContent,
PageFunctionBase,
Panel,
Paragraph,
ParallelTimeline,
ParserContext,
PasswordBox,
Path,
PathFigure,
PathFigureCollection,
PathFigureCollectionConverter,
PathGeometry,
PathSegment,
PathSegmentCollection,
PauseStoryboard,
Pen,
PerspectiveCamera,
PixelFormat,
PixelFormatConverter,
PngBitmapDecoder,
PngBitmapEncoder,
Point,
Point3D,
Point3DAnimation,
Point3DAnimationBase,
Point3DAnimationUsingKeyFrames,
Point3DCollection,
Point3DCollectionConverter,
Point3DConverter,
Point3DKeyFrame,
Point3DKeyFrameCollection,
Point4D,
Point4DConverter,
PointAnimation,
PointAnimationBase,
PointAnimationUsingKeyFrames,
PointAnimationUsingPath,
PointCollection,
PointCollectionConverter,
PointConverter,
PointIListConverter,
PointKeyFrame,
PointKeyFrameCollection,
PointLight,
PointLightBase,
PolyBezierSegment,
PolyLineSegment,
PolyQuadraticBezierSegment,
Polygon,
Polyline,
Popup,
PresentationSource,
PriorityBinding,
PriorityBindingExpression,
ProgressBar,
ProjectionCamera,
PropertyPath,
PropertyPathConverter,
QuadraticBezierSegment,
Quaternion,
QuaternionAnimation,
QuaternionAnimationBase,
QuaternionAnimationUsingKeyFrames,
QuaternionConverter,
QuaternionKeyFrame,
QuaternionKeyFrameCollection,
QuaternionRotation3D,
RadialGradientBrush,
RadioButton,
RangeBase,
Rect,
Rect3D,
Rect3DConverter,
RectAnimation,
RectAnimationBase,
RectAnimationUsingKeyFrames,
RectConverter,
RectKeyFrame,
RectKeyFrameCollection,
Rectangle,
RectangleGeometry,
RelativeSource,
RemoveStoryboard,
RenderOptions,
RenderTargetBitmap,
RepeatBehavior,
RepeatBehaviorConverter,
RepeatButton,
ResizeGrip,
ResourceDictionary,
ResourceKey,
ResumeStoryboard,
RichTextBox,
RotateTransform,
RotateTransform3D,
Rotation3D,
Rotation3DAnimation,
Rotation3DAnimationBase,
Rotation3DAnimationUsingKeyFrames,
Rotation3DKeyFrame,
Rotation3DKeyFrameCollection,
RoutedCommand,
RoutedEvent,
RoutedEventConverter,
RoutedUICommand,
RoutingStrategy,
RowDefinition,
Run,
RuntimeNamePropertyAttribute,
SByte,
SByteConverter,
ScaleTransform,
ScaleTransform3D,
ScrollBar,
ScrollContentPresenter,
ScrollViewer,
Section,
SeekStoryboard,
Selector,
Separator,
SetStoryboardSpeedRatio,
Setter,
SetterBase,
Shape,
Single,
SingleAnimation,
SingleAnimationBase,
SingleAnimationUsingKeyFrames,
SingleConverter,
SingleKeyFrame,
SingleKeyFrameCollection,
Size,
Size3D,
Size3DConverter,
SizeAnimation,
SizeAnimationBase,
SizeAnimationUsingKeyFrames,
SizeConverter,
SizeKeyFrame,
SizeKeyFrameCollection,
SkewTransform,
SkipStoryboardToFill,
Slider,
SolidColorBrush,
SoundPlayerAction,
Span,
SpecularMaterial,
SpellCheck,
SplineByteKeyFrame,
SplineColorKeyFrame,
SplineDecimalKeyFrame,
SplineDoubleKeyFrame,
SplineInt16KeyFrame,
SplineInt32KeyFrame,
SplineInt64KeyFrame,
SplinePoint3DKeyFrame,
SplinePointKeyFrame,
SplineQuaternionKeyFrame,
SplineRectKeyFrame,
SplineRotation3DKeyFrame,
SplineSingleKeyFrame,
SplineSizeKeyFrame,
SplineThicknessKeyFrame,
SplineVector3DKeyFrame,
SplineVectorKeyFrame,
SpotLight,
StackPanel,
StaticExtension,
StaticResourceExtension,
StatusBar,
StatusBarItem,
StickyNoteControl,
StopStoryboard,
Storyboard,
StreamGeometry,
StreamGeometryContext,
StreamResourceInfo,
String,
StringAnimationBase,
StringAnimationUsingKeyFrames,
StringConverter,
StringKeyFrame,
StringKeyFrameCollection,
StrokeCollection,
StrokeCollectionConverter,
Style,
Stylus,
StylusDevice,
TabControl,
TabItem,
TabPanel,
Table,
TableCell,
TableColumn,
TableRow,
TableRowGroup,
TabletDevice,
TemplateBindingExpression,
TemplateBindingExpressionConverter,
TemplateBindingExtension,
TemplateBindingExtensionConverter,
TemplateKey,
TemplateKeyConverter,
TextBlock,
TextBox,
TextBoxBase,
TextComposition,
TextCompositionManager,
TextDecoration,
TextDecorationCollection,
TextDecorationCollectionConverter,
TextEffect,
TextEffectCollection,
TextElement,
TextSearch,
ThemeDictionaryExtension,
Thickness,
ThicknessAnimation,
ThicknessAnimationBase,
ThicknessAnimationUsingKeyFrames,
ThicknessConverter,
ThicknessKeyFrame,
ThicknessKeyFrameCollection,
Thumb,
TickBar,
TiffBitmapDecoder,
TiffBitmapEncoder,
TileBrush,
TimeSpan,
TimeSpanConverter,
Timeline,
TimelineCollection,
TimelineGroup,
ToggleButton,
ToolBar,
ToolBarOverflowPanel,
ToolBarPanel,
ToolBarTray,
ToolTip,
ToolTipService,
Track,
Transform,
Transform3D,
Transform3DCollection,
Transform3DGroup,
TransformCollection,
TransformConverter,
TransformGroup,
TransformedBitmap,
TranslateTransform,
TranslateTransform3D,
TreeView,
TreeViewItem,
Trigger,
TriggerAction,
TriggerBase,
TypeExtension,
TypeTypeConverter,
Typography,
UIElement,
UInt16,
UInt16Converter,
UInt32,
UInt32Converter,
UInt64,
UInt64Converter,
UShortIListConverter,
Underline,
UniformGrid,
Uri,
UriTypeConverter,
UserControl,
Validation,
Vector,
Vector3D,
Vector3DAnimation,
Vector3DAnimationBase,
Vector3DAnimationUsingKeyFrames,
Vector3DCollection,
Vector3DCollectionConverter,
Vector3DConverter,
Vector3DKeyFrame,
Vector3DKeyFrameCollection,
VectorAnimation,
VectorAnimationBase,
VectorAnimationUsingKeyFrames,
VectorCollection,
VectorCollectionConverter,
VectorConverter,
VectorKeyFrame,
VectorKeyFrameCollection,
VideoDrawing,
ViewBase,
Viewbox,
Viewport3D,
Viewport3DVisual,
VirtualizingPanel,
VirtualizingStackPanel,
Visual,
Visual3D,
VisualBrush,
VisualTarget,
WeakEventManager,
WhitespaceSignificantCollectionAttribute,
Window,
WmpBitmapDecoder,
WmpBitmapEncoder,
WrapPanel,
WriteableBitmap,
XamlBrushSerializer,
XamlInt32CollectionSerializer,
XamlPathDataSerializer,
XamlPoint3DCollectionSerializer,
XamlPointCollectionSerializer,
XamlReader,
XamlStyleSerializer,
XamlTemplateSerializer,
XamlVector3DCollectionSerializer,
XamlWriter,
XmlDataProvider,
XmlLangPropertyAttribute,
XmlLanguage,
XmlLanguageConverter,
XmlNamespaceMapping,
ZoomPercentageConverter,
MaxElement
}
// This enum specifies the IDs we use for known CLR and DP Properties in BAML.
// The baml files contains the negative of these values.
internal enum KnownProperties : short
{
UnknownProperty = 0,
AccessText_Text,
BeginStoryboard_Storyboard,
BitmapEffectGroup_Children,
Border_Background,
Border_BorderBrush,
Border_BorderThickness,
ButtonBase_Command,
ButtonBase_CommandParameter,
ButtonBase_CommandTarget,
ButtonBase_IsPressed,
ColumnDefinition_MaxWidth,
ColumnDefinition_MinWidth,
ColumnDefinition_Width,
ContentControl_Content,
ContentControl_ContentTemplate,
ContentControl_ContentTemplateSelector,
ContentControl_HasContent,
ContentElement_Focusable,
ContentPresenter_Content,
ContentPresenter_ContentSource,
ContentPresenter_ContentTemplate,
ContentPresenter_ContentTemplateSelector,
ContentPresenter_RecognizesAccessKey,
Control_Background,
Control_BorderBrush,
Control_BorderThickness,
Control_FontFamily,
Control_FontSize,
Control_FontStretch,
Control_FontStyle,
Control_FontWeight,
Control_Foreground,
Control_HorizontalContentAlignment,
Control_IsTabStop,
Control_Padding,
Control_TabIndex,
Control_Template,
Control_VerticalContentAlignment,
DockPanel_Dock,
DockPanel_LastChildFill,
DocumentViewerBase_Document,
DrawingGroup_Children,
FlowDocumentReader_Document,
FlowDocumentScrollViewer_Document,
FrameworkContentElement_Style,
FrameworkElement_FlowDirection,
FrameworkElement_Height,
FrameworkElement_HorizontalAlignment,
FrameworkElement_Margin,
FrameworkElement_MaxHeight,
FrameworkElement_MaxWidth,
FrameworkElement_MinHeight,
FrameworkElement_MinWidth,
FrameworkElement_Name,
FrameworkElement_Style,
FrameworkElement_VerticalAlignment,
FrameworkElement_Width,
GeneralTransformGroup_Children,
GeometryGroup_Children,
GradientBrush_GradientStops,
Grid_Column,
Grid_ColumnSpan,
Grid_Row,
Grid_RowSpan,
GridViewColumn_Header,
HeaderedContentControl_HasHeader,
HeaderedContentControl_Header,
HeaderedContentControl_HeaderTemplate,
HeaderedContentControl_HeaderTemplateSelector,
HeaderedItemsControl_HasHeader,
HeaderedItemsControl_Header,
HeaderedItemsControl_HeaderTemplate,
HeaderedItemsControl_HeaderTemplateSelector,
Hyperlink_NavigateUri,
Image_Source,
Image_Stretch,
ItemsControl_ItemContainerStyle,
ItemsControl_ItemContainerStyleSelector,
ItemsControl_ItemTemplate,
ItemsControl_ItemTemplateSelector,
ItemsControl_ItemsPanel,
ItemsControl_ItemsSource,
MaterialGroup_Children,
Model3DGroup_Children,
Page_Content,
Panel_Background,
Path_Data,
PathFigure_Segments,
PathGeometry_Figures,
Popup_Child,
Popup_IsOpen,
Popup_Placement,
Popup_PopupAnimation,
RowDefinition_Height,
RowDefinition_MaxHeight,
RowDefinition_MinHeight,
ScrollViewer_CanContentScroll,
ScrollViewer_HorizontalScrollBarVisibility,
ScrollViewer_VerticalScrollBarVisibility,
Shape_Fill,
Shape_Stroke,
Shape_StrokeThickness,
TextBlock_Background,
TextBlock_FontFamily,
TextBlock_FontSize,
TextBlock_FontStretch,
TextBlock_FontStyle,
TextBlock_FontWeight,
TextBlock_Foreground,
TextBlock_Text,
TextBlock_TextDecorations,
TextBlock_TextTrimming,
TextBlock_TextWrapping,
TextBox_Text,
TextElement_Background,
TextElement_FontFamily,
TextElement_FontSize,
TextElement_FontStretch,
TextElement_FontStyle,
TextElement_FontWeight,
TextElement_Foreground,
TimelineGroup_Children,
Track_IsDirectionReversed,
Track_Maximum,
Track_Minimum,
Track_Orientation,
Track_Value,
Track_ViewportSize,
Transform3DGroup_Children,
TransformGroup_Children,
UIElement_ClipToBounds,
UIElement_Focusable,
UIElement_IsEnabled,
UIElement_RenderTransform,
UIElement_Visibility,
Viewport3D_Children,
MaxDependencyProperty,
AdornedElementPlaceholder_Child,
AdornerDecorator_Child,
AnchoredBlock_Blocks,
ArrayExtension_Items,
BlockUIContainer_Child,
Bold_Inlines,
BooleanAnimationUsingKeyFrames_KeyFrames,
Border_Child,
BulletDecorator_Child,
Button_Content,
ButtonBase_Content,
ByteAnimationUsingKeyFrames_KeyFrames,
Canvas_Children,
CharAnimationUsingKeyFrames_KeyFrames,
CheckBox_Content,
ColorAnimationUsingKeyFrames_KeyFrames,
ComboBox_Items,
ComboBoxItem_Content,
ContextMenu_Items,
ControlTemplate_VisualTree,
DataTemplate_VisualTree,
DataTrigger_Setters,
DecimalAnimationUsingKeyFrames_KeyFrames,
Decorator_Child,
DockPanel_Children,
DocumentViewer_Document,
DoubleAnimationUsingKeyFrames_KeyFrames,
EventTrigger_Actions,
Expander_Content,
Figure_Blocks,
FixedDocument_Pages,
FixedDocumentSequence_References,
FixedPage_Children,
Floater_Blocks,
FlowDocument_Blocks,
FlowDocumentPageViewer_Document,
FrameworkTemplate_VisualTree,
Grid_Children,
GridView_Columns,
GridViewColumnHeader_Content,
GroupBox_Content,
GroupItem_Content,
HeaderedContentControl_Content,
HeaderedItemsControl_Items,
HierarchicalDataTemplate_VisualTree,
Hyperlink_Inlines,
InkCanvas_Children,
InkPresenter_Child,
InlineUIContainer_Child,
InputScopeName_NameValue,
Int16AnimationUsingKeyFrames_KeyFrames,
Int32AnimationUsingKeyFrames_KeyFrames,
Int64AnimationUsingKeyFrames_KeyFrames,
Italic_Inlines,
ItemsControl_Items,
ItemsPanelTemplate_VisualTree,
Label_Content,
LinearGradientBrush_GradientStops,
List_ListItems,
ListBox_Items,
ListBoxItem_Content,
ListItem_Blocks,
ListView_Items,
ListViewItem_Content,
MatrixAnimationUsingKeyFrames_KeyFrames,
Menu_Items,
MenuBase_Items,
MenuItem_Items,
ModelVisual3D_Children,
MultiBinding_Bindings,
MultiDataTrigger_Setters,
MultiTrigger_Setters,
ObjectAnimationUsingKeyFrames_KeyFrames,
PageContent_Child,
PageFunctionBase_Content,
Panel_Children,
Paragraph_Inlines,
ParallelTimeline_Children,
Point3DAnimationUsingKeyFrames_KeyFrames,
PointAnimationUsingKeyFrames_KeyFrames,
PriorityBinding_Bindings,
QuaternionAnimationUsingKeyFrames_KeyFrames,
RadialGradientBrush_GradientStops,
RadioButton_Content,
RectAnimationUsingKeyFrames_KeyFrames,
RepeatButton_Content,
RichTextBox_Document,
Rotation3DAnimationUsingKeyFrames_KeyFrames,
Run_Text,
ScrollViewer_Content,
Section_Blocks,
Selector_Items,
SingleAnimationUsingKeyFrames_KeyFrames,
SizeAnimationUsingKeyFrames_KeyFrames,
Span_Inlines,
StackPanel_Children,
StatusBar_Items,
StatusBarItem_Content,
Storyboard_Children,
StringAnimationUsingKeyFrames_KeyFrames,
Style_Setters,
TabControl_Items,
TabItem_Content,
TabPanel_Children,
Table_RowGroups,
TableCell_Blocks,
TableRow_Cells,
TableRowGroup_Rows,
TextBlock_Inlines,
ThicknessAnimationUsingKeyFrames_KeyFrames,
ToggleButton_Content,
ToolBar_Items,
ToolBarOverflowPanel_Children,
ToolBarPanel_Children,
ToolBarTray_ToolBars,
ToolTip_Content,
TreeView_Items,
TreeViewItem_Items,
Trigger_Setters,
Underline_Inlines,
UniformGrid_Children,
UserControl_Content,
Vector3DAnimationUsingKeyFrames_KeyFrames,
VectorAnimationUsingKeyFrames_KeyFrames,
Viewbox_Child,
Viewport3DVisual_Children,
VirtualizingPanel_Children,
VirtualizingStackPanel_Children,
Window_Content,
WrapPanel_Children,
XmlDataProvider_XmlSerializer,
MaxProperty,
}
#if !BAMLDASM
internal static partial class KnownTypes
{
#if !PBTCOMPILER
// Code compiled into PresentationFramework.dll
// Initialize known object types
internal static object CreateKnownElement(KnownElements knownElement)
{
object o = null;
switch (knownElement)
{
case KnownElements.AccessText: o = new System.Windows.Controls.AccessText(); break;
case KnownElements.AdornedElementPlaceholder: o = new System.Windows.Controls.AdornedElementPlaceholder(); break;
case KnownElements.AdornerDecorator: o = new System.Windows.Documents.AdornerDecorator(); break;
case KnownElements.AmbientLight: o = new System.Windows.Media.Media3D.AmbientLight(); break;
case KnownElements.Application: o = new System.Windows.Application(); break;
case KnownElements.ArcSegment: o = new System.Windows.Media.ArcSegment(); break;
case KnownElements.ArrayExtension: o = new System.Windows.Markup.ArrayExtension(); break;
case KnownElements.AxisAngleRotation3D: o = new System.Windows.Media.Media3D.AxisAngleRotation3D(); break;
case KnownElements.BeginStoryboard: o = new System.Windows.Media.Animation.BeginStoryboard(); break;
case KnownElements.BevelBitmapEffect: o = new System.Windows.Media.Effects.BevelBitmapEffect(); break;
case KnownElements.BezierSegment: o = new System.Windows.Media.BezierSegment(); break;
case KnownElements.Binding: o = new System.Windows.Data.Binding(); break;
case KnownElements.BitmapEffectCollection: o = new System.Windows.Media.Effects.BitmapEffectCollection(); break;
case KnownElements.BitmapEffectGroup: o = new System.Windows.Media.Effects.BitmapEffectGroup(); break;
case KnownElements.BitmapEffectInput: o = new System.Windows.Media.Effects.BitmapEffectInput(); break;
case KnownElements.BitmapImage: o = new System.Windows.Media.Imaging.BitmapImage(); break;
case KnownElements.BlockUIContainer: o = new System.Windows.Documents.BlockUIContainer(); break;
case KnownElements.BlurBitmapEffect: o = new System.Windows.Media.Effects.BlurBitmapEffect(); break;
case KnownElements.BmpBitmapEncoder: o = new System.Windows.Media.Imaging.BmpBitmapEncoder(); break;
case KnownElements.Bold: o = new System.Windows.Documents.Bold(); break;
case KnownElements.BoolIListConverter: o = new System.Windows.Media.Converters.BoolIListConverter(); break;
case KnownElements.BooleanAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames(); break;
case KnownElements.BooleanConverter: o = new System.ComponentModel.BooleanConverter(); break;
case KnownElements.BooleanKeyFrameCollection: o = new System.Windows.Media.Animation.BooleanKeyFrameCollection(); break;
case KnownElements.BooleanToVisibilityConverter: o = new System.Windows.Controls.BooleanToVisibilityConverter(); break;
case KnownElements.Border: o = new System.Windows.Controls.Border(); break;
case KnownElements.BorderGapMaskConverter: o = new System.Windows.Controls.BorderGapMaskConverter(); break;
case KnownElements.BrushConverter: o = new System.Windows.Media.BrushConverter(); break;
case KnownElements.BulletDecorator: o = new System.Windows.Controls.Primitives.BulletDecorator(); break;
case KnownElements.Button: o = new System.Windows.Controls.Button(); break;
case KnownElements.ByteAnimation: o = new System.Windows.Media.Animation.ByteAnimation(); break;
case KnownElements.ByteAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ByteAnimationUsingKeyFrames(); break;
case KnownElements.ByteConverter: o = new System.ComponentModel.ByteConverter(); break;
case KnownElements.ByteKeyFrameCollection: o = new System.Windows.Media.Animation.ByteKeyFrameCollection(); break;
case KnownElements.Canvas: o = new System.Windows.Controls.Canvas(); break;
case KnownElements.CharAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.CharAnimationUsingKeyFrames(); break;
case KnownElements.CharConverter: o = new System.ComponentModel.CharConverter(); break;
case KnownElements.CharIListConverter: o = new System.Windows.Media.Converters.CharIListConverter(); break;
case KnownElements.CharKeyFrameCollection: o = new System.Windows.Media.Animation.CharKeyFrameCollection(); break;
case KnownElements.CheckBox: o = new System.Windows.Controls.CheckBox(); break;
case KnownElements.CollectionContainer: o = new System.Windows.Data.CollectionContainer(); break;
case KnownElements.CollectionViewSource: o = new System.Windows.Data.CollectionViewSource(); break;
case KnownElements.Color: o = new System.Windows.Media.Color(); break;
case KnownElements.ColorAnimation: o = new System.Windows.Media.Animation.ColorAnimation(); break;
case KnownElements.ColorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ColorAnimationUsingKeyFrames(); break;
case KnownElements.ColorConvertedBitmap: o = new System.Windows.Media.Imaging.ColorConvertedBitmap(); break;
case KnownElements.ColorConvertedBitmapExtension: o = new System.Windows.ColorConvertedBitmapExtension(); break;
case KnownElements.ColorConverter: o = new System.Windows.Media.ColorConverter(); break;
case KnownElements.ColorKeyFrameCollection: o = new System.Windows.Media.Animation.ColorKeyFrameCollection(); break;
case KnownElements.ColumnDefinition: o = new System.Windows.Controls.ColumnDefinition(); break;
case KnownElements.CombinedGeometry: o = new System.Windows.Media.CombinedGeometry(); break;
case KnownElements.ComboBox: o = new System.Windows.Controls.ComboBox(); break;
case KnownElements.ComboBoxItem: o = new System.Windows.Controls.ComboBoxItem(); break;
case KnownElements.CommandConverter: o = new System.Windows.Input.CommandConverter(); break;
case KnownElements.ComponentResourceKey: o = new System.Windows.ComponentResourceKey(); break;
case KnownElements.ComponentResourceKeyConverter: o = new System.Windows.Markup.ComponentResourceKeyConverter(); break;
case KnownElements.Condition: o = new System.Windows.Condition(); break;
case KnownElements.ContainerVisual: o = new System.Windows.Media.ContainerVisual(); break;
case KnownElements.ContentControl: o = new System.Windows.Controls.ContentControl(); break;
case KnownElements.ContentElement: o = new System.Windows.ContentElement(); break;
case KnownElements.ContentPresenter: o = new System.Windows.Controls.ContentPresenter(); break;
case KnownElements.ContextMenu: o = new System.Windows.Controls.ContextMenu(); break;
case KnownElements.Control: o = new System.Windows.Controls.Control(); break;
case KnownElements.ControlTemplate: o = new System.Windows.Controls.ControlTemplate(); break;
case KnownElements.CornerRadius: o = new System.Windows.CornerRadius(); break;
case KnownElements.CornerRadiusConverter: o = new System.Windows.CornerRadiusConverter(); break;
case KnownElements.CroppedBitmap: o = new System.Windows.Media.Imaging.CroppedBitmap(); break;
case KnownElements.CultureInfoConverter: o = new System.ComponentModel.CultureInfoConverter(); break;
case KnownElements.CultureInfoIetfLanguageTagConverter: o = new System.Windows.CultureInfoIetfLanguageTagConverter(); break;
case KnownElements.CursorConverter: o = new System.Windows.Input.CursorConverter(); break;
case KnownElements.DashStyle: o = new System.Windows.Media.DashStyle(); break;
case KnownElements.DataTemplate: o = new System.Windows.DataTemplate(); break;
case KnownElements.DataTemplateKey: o = new System.Windows.DataTemplateKey(); break;
case KnownElements.DataTrigger: o = new System.Windows.DataTrigger(); break;
case KnownElements.DateTimeConverter: o = new System.ComponentModel.DateTimeConverter(); break;
case KnownElements.DateTimeConverter2: o = new System.Windows.Markup.DateTimeConverter2(); break;
case KnownElements.DecimalAnimation: o = new System.Windows.Media.Animation.DecimalAnimation(); break;
case KnownElements.DecimalAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames(); break;
case KnownElements.DecimalConverter: o = new System.ComponentModel.DecimalConverter(); break;
case KnownElements.DecimalKeyFrameCollection: o = new System.Windows.Media.Animation.DecimalKeyFrameCollection(); break;
case KnownElements.Decorator: o = new System.Windows.Controls.Decorator(); break;
case KnownElements.DependencyObject: o = new System.Windows.DependencyObject(); break;
case KnownElements.DependencyPropertyConverter: o = new System.Windows.Markup.DependencyPropertyConverter(); break;
case KnownElements.DialogResultConverter: o = new System.Windows.DialogResultConverter(); break;
case KnownElements.DiffuseMaterial: o = new System.Windows.Media.Media3D.DiffuseMaterial(); break;
case KnownElements.DirectionalLight: o = new System.Windows.Media.Media3D.DirectionalLight(); break;
case KnownElements.DiscreteBooleanKeyFrame: o = new System.Windows.Media.Animation.DiscreteBooleanKeyFrame(); break;
case KnownElements.DiscreteByteKeyFrame: o = new System.Windows.Media.Animation.DiscreteByteKeyFrame(); break;
case KnownElements.DiscreteCharKeyFrame: o = new System.Windows.Media.Animation.DiscreteCharKeyFrame(); break;
case KnownElements.DiscreteColorKeyFrame: o = new System.Windows.Media.Animation.DiscreteColorKeyFrame(); break;
case KnownElements.DiscreteDecimalKeyFrame: o = new System.Windows.Media.Animation.DiscreteDecimalKeyFrame(); break;
case KnownElements.DiscreteDoubleKeyFrame: o = new System.Windows.Media.Animation.DiscreteDoubleKeyFrame(); break;
case KnownElements.DiscreteInt16KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt16KeyFrame(); break;
case KnownElements.DiscreteInt32KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt32KeyFrame(); break;
case KnownElements.DiscreteInt64KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt64KeyFrame(); break;
case KnownElements.DiscreteMatrixKeyFrame: o = new System.Windows.Media.Animation.DiscreteMatrixKeyFrame(); break;
case KnownElements.DiscreteObjectKeyFrame: o = new System.Windows.Media.Animation.DiscreteObjectKeyFrame(); break;
case KnownElements.DiscretePoint3DKeyFrame: o = new System.Windows.Media.Animation.DiscretePoint3DKeyFrame(); break;
case KnownElements.DiscretePointKeyFrame: o = new System.Windows.Media.Animation.DiscretePointKeyFrame(); break;
case KnownElements.DiscreteQuaternionKeyFrame: o = new System.Windows.Media.Animation.DiscreteQuaternionKeyFrame(); break;
case KnownElements.DiscreteRectKeyFrame: o = new System.Windows.Media.Animation.DiscreteRectKeyFrame(); break;
case KnownElements.DiscreteRotation3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteRotation3DKeyFrame(); break;
case KnownElements.DiscreteSingleKeyFrame: o = new System.Windows.Media.Animation.DiscreteSingleKeyFrame(); break;
case KnownElements.DiscreteSizeKeyFrame: o = new System.Windows.Media.Animation.DiscreteSizeKeyFrame(); break;
case KnownElements.DiscreteStringKeyFrame: o = new System.Windows.Media.Animation.DiscreteStringKeyFrame(); break;
case KnownElements.DiscreteThicknessKeyFrame: o = new System.Windows.Media.Animation.DiscreteThicknessKeyFrame(); break;
case KnownElements.DiscreteVector3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteVector3DKeyFrame(); break;
case KnownElements.DiscreteVectorKeyFrame: o = new System.Windows.Media.Animation.DiscreteVectorKeyFrame(); break;
case KnownElements.DockPanel: o = new System.Windows.Controls.DockPanel(); break;
case KnownElements.DocumentPageView: o = new System.Windows.Controls.Primitives.DocumentPageView(); break;
case KnownElements.DocumentReference: o = new System.Windows.Documents.DocumentReference(); break;
case KnownElements.DocumentViewer: o = new System.Windows.Controls.DocumentViewer(); break;
case KnownElements.DoubleAnimation: o = new System.Windows.Media.Animation.DoubleAnimation(); break;
case KnownElements.DoubleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames(); break;
case KnownElements.DoubleAnimationUsingPath: o = new System.Windows.Media.Animation.DoubleAnimationUsingPath(); break;
case KnownElements.DoubleCollection: o = new System.Windows.Media.DoubleCollection(); break;
case KnownElements.DoubleCollectionConverter: o = new System.Windows.Media.DoubleCollectionConverter(); break;
case KnownElements.DoubleConverter: o = new System.ComponentModel.DoubleConverter(); break;
case KnownElements.DoubleIListConverter: o = new System.Windows.Media.Converters.DoubleIListConverter(); break;
case KnownElements.DoubleKeyFrameCollection: o = new System.Windows.Media.Animation.DoubleKeyFrameCollection(); break;
case KnownElements.DrawingBrush: o = new System.Windows.Media.DrawingBrush(); break;
case KnownElements.DrawingCollection: o = new System.Windows.Media.DrawingCollection(); break;
case KnownElements.DrawingGroup: o = new System.Windows.Media.DrawingGroup(); break;
case KnownElements.DrawingImage: o = new System.Windows.Media.DrawingImage(); break;
case KnownElements.DrawingVisual: o = new System.Windows.Media.DrawingVisual(); break;
case KnownElements.DropShadowBitmapEffect: o = new System.Windows.Media.Effects.DropShadowBitmapEffect(); break;
case KnownElements.Duration: o = new System.Windows.Duration(); break;
case KnownElements.DurationConverter: o = new System.Windows.DurationConverter(); break;
case KnownElements.DynamicResourceExtension: o = new System.Windows.DynamicResourceExtension(); break;
case KnownElements.DynamicResourceExtensionConverter: o = new System.Windows.DynamicResourceExtensionConverter(); break;
case KnownElements.Ellipse: o = new System.Windows.Shapes.Ellipse(); break;
case KnownElements.EllipseGeometry: o = new System.Windows.Media.EllipseGeometry(); break;
case KnownElements.EmbossBitmapEffect: o = new System.Windows.Media.Effects.EmbossBitmapEffect(); break;
case KnownElements.EmissiveMaterial: o = new System.Windows.Media.Media3D.EmissiveMaterial(); break;
case KnownElements.EventSetter: o = new System.Windows.EventSetter(); break;
case KnownElements.EventTrigger: o = new System.Windows.EventTrigger(); break;
case KnownElements.Expander: o = new System.Windows.Controls.Expander(); break;
case KnownElements.ExpressionConverter: o = new System.Windows.ExpressionConverter(); break;
case KnownElements.Figure: o = new System.Windows.Documents.Figure(); break;
case KnownElements.FigureLength: o = new System.Windows.FigureLength(); break;
case KnownElements.FigureLengthConverter: o = new System.Windows.FigureLengthConverter(); break;
case KnownElements.FixedDocument: o = new System.Windows.Documents.FixedDocument(); break;
case KnownElements.FixedDocumentSequence: o = new System.Windows.Documents.FixedDocumentSequence(); break;
case KnownElements.FixedPage: o = new System.Windows.Documents.FixedPage(); break;
case KnownElements.Floater: o = new System.Windows.Documents.Floater(); break;
case KnownElements.FlowDocument: o = new System.Windows.Documents.FlowDocument(); break;
case KnownElements.FlowDocumentPageViewer: o = new System.Windows.Controls.FlowDocumentPageViewer(); break;
case KnownElements.FlowDocumentReader: o = new System.Windows.Controls.FlowDocumentReader(); break;
case KnownElements.FlowDocumentScrollViewer: o = new System.Windows.Controls.FlowDocumentScrollViewer(); break;
case KnownElements.FontFamily: o = new System.Windows.Media.FontFamily(); break;
case KnownElements.FontFamilyConverter: o = new System.Windows.Media.FontFamilyConverter(); break;
case KnownElements.FontSizeConverter: o = new System.Windows.FontSizeConverter(); break;
case KnownElements.FontStretch: o = new System.Windows.FontStretch(); break;
case KnownElements.FontStretchConverter: o = new System.Windows.FontStretchConverter(); break;
case KnownElements.FontStyle: o = new System.Windows.FontStyle(); break;
case KnownElements.FontStyleConverter: o = new System.Windows.FontStyleConverter(); break;
case KnownElements.FontWeight: o = new System.Windows.FontWeight(); break;
case KnownElements.FontWeightConverter: o = new System.Windows.FontWeightConverter(); break;
case KnownElements.FormatConvertedBitmap: o = new System.Windows.Media.Imaging.FormatConvertedBitmap(); break;
case KnownElements.Frame: o = new System.Windows.Controls.Frame(); break;
case KnownElements.FrameworkContentElement: o = new System.Windows.FrameworkContentElement(); break;
case KnownElements.FrameworkElement: o = new System.Windows.FrameworkElement(); break;
case KnownElements.FrameworkElementFactory: o = new System.Windows.FrameworkElementFactory(); break;
case KnownElements.FrameworkPropertyMetadata: o = new System.Windows.FrameworkPropertyMetadata(); break;
case KnownElements.GeneralTransformCollection: o = new System.Windows.Media.GeneralTransformCollection(); break;
case KnownElements.GeneralTransformGroup: o = new System.Windows.Media.GeneralTransformGroup(); break;
case KnownElements.GeometryCollection: o = new System.Windows.Media.GeometryCollection(); break;
case KnownElements.GeometryConverter: o = new System.Windows.Media.GeometryConverter(); break;
case KnownElements.GeometryDrawing: o = new System.Windows.Media.GeometryDrawing(); break;
case KnownElements.GeometryGroup: o = new System.Windows.Media.GeometryGroup(); break;
case KnownElements.GeometryModel3D: o = new System.Windows.Media.Media3D.GeometryModel3D(); break;
case KnownElements.GestureRecognizer: o = new System.Windows.Ink.GestureRecognizer(); break;
case KnownElements.GifBitmapEncoder: o = new System.Windows.Media.Imaging.GifBitmapEncoder(); break;
case KnownElements.GlyphRun: o = new System.Windows.Media.GlyphRun(); break;
case KnownElements.GlyphRunDrawing: o = new System.Windows.Media.GlyphRunDrawing(); break;
case KnownElements.GlyphTypeface: o = new System.Windows.Media.GlyphTypeface(); break;
case KnownElements.Glyphs: o = new System.Windows.Documents.Glyphs(); break;
case KnownElements.GradientStop: o = new System.Windows.Media.GradientStop(); break;
case KnownElements.GradientStopCollection: o = new System.Windows.Media.GradientStopCollection(); break;
case KnownElements.Grid: o = new System.Windows.Controls.Grid(); break;
case KnownElements.GridLength: o = new System.Windows.GridLength(); break;
case KnownElements.GridLengthConverter: o = new System.Windows.GridLengthConverter(); break;
case KnownElements.GridSplitter: o = new System.Windows.Controls.GridSplitter(); break;
case KnownElements.GridView: o = new System.Windows.Controls.GridView(); break;
case KnownElements.GridViewColumn: o = new System.Windows.Controls.GridViewColumn(); break;
case KnownElements.GridViewColumnHeader: o = new System.Windows.Controls.GridViewColumnHeader(); break;
case KnownElements.GridViewHeaderRowPresenter: o = new System.Windows.Controls.GridViewHeaderRowPresenter(); break;
case KnownElements.GridViewRowPresenter: o = new System.Windows.Controls.GridViewRowPresenter(); break;
case KnownElements.GroupBox: o = new System.Windows.Controls.GroupBox(); break;
case KnownElements.GroupItem: o = new System.Windows.Controls.GroupItem(); break;
case KnownElements.GuidConverter: o = new System.ComponentModel.GuidConverter(); break;
case KnownElements.GuidelineSet: o = new System.Windows.Media.GuidelineSet(); break;
case KnownElements.HeaderedContentControl: o = new System.Windows.Controls.HeaderedContentControl(); break;
case KnownElements.HeaderedItemsControl: o = new System.Windows.Controls.HeaderedItemsControl(); break;
case KnownElements.HierarchicalDataTemplate: o = new System.Windows.HierarchicalDataTemplate(); break;
case KnownElements.HostVisual: o = new System.Windows.Media.HostVisual(); break;
case KnownElements.Hyperlink: o = new System.Windows.Documents.Hyperlink(); break;
case KnownElements.Image: o = new System.Windows.Controls.Image(); break;
case KnownElements.ImageBrush: o = new System.Windows.Media.ImageBrush(); break;
case KnownElements.ImageDrawing: o = new System.Windows.Media.ImageDrawing(); break;
case KnownElements.ImageSourceConverter: o = new System.Windows.Media.ImageSourceConverter(); break;
case KnownElements.InkCanvas: o = new System.Windows.Controls.InkCanvas(); break;
case KnownElements.InkPresenter: o = new System.Windows.Controls.InkPresenter(); break;
case KnownElements.InlineUIContainer: o = new System.Windows.Documents.InlineUIContainer(); break;
case KnownElements.InputScope: o = new System.Windows.Input.InputScope(); break;
case KnownElements.InputScopeConverter: o = new System.Windows.Input.InputScopeConverter(); break;
case KnownElements.InputScopeName: o = new System.Windows.Input.InputScopeName(); break;
case KnownElements.InputScopeNameConverter: o = new System.Windows.Input.InputScopeNameConverter(); break;
case KnownElements.Int16Animation: o = new System.Windows.Media.Animation.Int16Animation(); break;
case KnownElements.Int16AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int16AnimationUsingKeyFrames(); break;
case KnownElements.Int16Converter: o = new System.ComponentModel.Int16Converter(); break;
case KnownElements.Int16KeyFrameCollection: o = new System.Windows.Media.Animation.Int16KeyFrameCollection(); break;
case KnownElements.Int32Animation: o = new System.Windows.Media.Animation.Int32Animation(); break;
case KnownElements.Int32AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int32AnimationUsingKeyFrames(); break;
case KnownElements.Int32Collection: o = new System.Windows.Media.Int32Collection(); break;
case KnownElements.Int32CollectionConverter: o = new System.Windows.Media.Int32CollectionConverter(); break;
case KnownElements.Int32Converter: o = new System.ComponentModel.Int32Converter(); break;
case KnownElements.Int32KeyFrameCollection: o = new System.Windows.Media.Animation.Int32KeyFrameCollection(); break;
case KnownElements.Int32Rect: o = new System.Windows.Int32Rect(); break;
case KnownElements.Int32RectConverter: o = new System.Windows.Int32RectConverter(); break;
case KnownElements.Int64Animation: o = new System.Windows.Media.Animation.Int64Animation(); break;
case KnownElements.Int64AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int64AnimationUsingKeyFrames(); break;
case KnownElements.Int64Converter: o = new System.ComponentModel.Int64Converter(); break;
case KnownElements.Int64KeyFrameCollection: o = new System.Windows.Media.Animation.Int64KeyFrameCollection(); break;
case KnownElements.Italic: o = new System.Windows.Documents.Italic(); break;
case KnownElements.ItemsControl: o = new System.Windows.Controls.ItemsControl(); break;
case KnownElements.ItemsPanelTemplate: o = new System.Windows.Controls.ItemsPanelTemplate(); break;
case KnownElements.ItemsPresenter: o = new System.Windows.Controls.ItemsPresenter(); break;
case KnownElements.JournalEntryListConverter: o = new System.Windows.Navigation.JournalEntryListConverter(); break;
case KnownElements.JournalEntryUnifiedViewConverter: o = new System.Windows.Navigation.JournalEntryUnifiedViewConverter(); break;
case KnownElements.JpegBitmapEncoder: o = new System.Windows.Media.Imaging.JpegBitmapEncoder(); break;
case KnownElements.KeyBinding: o = new System.Windows.Input.KeyBinding(); break;
case KnownElements.KeyConverter: o = new System.Windows.Input.KeyConverter(); break;
case KnownElements.KeyGestureConverter: o = new System.Windows.Input.KeyGestureConverter(); break;
case KnownElements.KeySpline: o = new System.Windows.Media.Animation.KeySpline(); break;
case KnownElements.KeySplineConverter: o = new System.Windows.KeySplineConverter(); break;
case KnownElements.KeyTime: o = new System.Windows.Media.Animation.KeyTime(); break;
case KnownElements.KeyTimeConverter: o = new System.Windows.KeyTimeConverter(); break;
case KnownElements.Label: o = new System.Windows.Controls.Label(); break;
case KnownElements.LengthConverter: o = new System.Windows.LengthConverter(); break;
case KnownElements.Line: o = new System.Windows.Shapes.Line(); break;
case KnownElements.LineBreak: o = new System.Windows.Documents.LineBreak(); break;
case KnownElements.LineGeometry: o = new System.Windows.Media.LineGeometry(); break;
case KnownElements.LineSegment: o = new System.Windows.Media.LineSegment(); break;
case KnownElements.LinearByteKeyFrame: o = new System.Windows.Media.Animation.LinearByteKeyFrame(); break;
case KnownElements.LinearColorKeyFrame: o = new System.Windows.Media.Animation.LinearColorKeyFrame(); break;
case KnownElements.LinearDecimalKeyFrame: o = new System.Windows.Media.Animation.LinearDecimalKeyFrame(); break;
case KnownElements.LinearDoubleKeyFrame: o = new System.Windows.Media.Animation.LinearDoubleKeyFrame(); break;
case KnownElements.LinearGradientBrush: o = new System.Windows.Media.LinearGradientBrush(); break;
case KnownElements.LinearInt16KeyFrame: o = new System.Windows.Media.Animation.LinearInt16KeyFrame(); break;
case KnownElements.LinearInt32KeyFrame: o = new System.Windows.Media.Animation.LinearInt32KeyFrame(); break;
case KnownElements.LinearInt64KeyFrame: o = new System.Windows.Media.Animation.LinearInt64KeyFrame(); break;
case KnownElements.LinearPoint3DKeyFrame: o = new System.Windows.Media.Animation.LinearPoint3DKeyFrame(); break;
case KnownElements.LinearPointKeyFrame: o = new System.Windows.Media.Animation.LinearPointKeyFrame(); break;
case KnownElements.LinearQuaternionKeyFrame: o = new System.Windows.Media.Animation.LinearQuaternionKeyFrame(); break;
case KnownElements.LinearRectKeyFrame: o = new System.Windows.Media.Animation.LinearRectKeyFrame(); break;
case KnownElements.LinearRotation3DKeyFrame: o = new System.Windows.Media.Animation.LinearRotation3DKeyFrame(); break;
case KnownElements.LinearSingleKeyFrame: o = new System.Windows.Media.Animation.LinearSingleKeyFrame(); break;
case KnownElements.LinearSizeKeyFrame: o = new System.Windows.Media.Animation.LinearSizeKeyFrame(); break;
case KnownElements.LinearThicknessKeyFrame: o = new System.Windows.Media.Animation.LinearThicknessKeyFrame(); break;
case KnownElements.LinearVector3DKeyFrame: o = new System.Windows.Media.Animation.LinearVector3DKeyFrame(); break;
case KnownElements.LinearVectorKeyFrame: o = new System.Windows.Media.Animation.LinearVectorKeyFrame(); break;
case KnownElements.List: o = new System.Windows.Documents.List(); break;
case KnownElements.ListBox: o = new System.Windows.Controls.ListBox(); break;
case KnownElements.ListBoxItem: o = new System.Windows.Controls.ListBoxItem(); break;
case KnownElements.ListItem: o = new System.Windows.Documents.ListItem(); break;
case KnownElements.ListView: o = new System.Windows.Controls.ListView(); break;
case KnownElements.ListViewItem: o = new System.Windows.Controls.ListViewItem(); break;
case KnownElements.MaterialCollection: o = new System.Windows.Media.Media3D.MaterialCollection(); break;
case KnownElements.MaterialGroup: o = new System.Windows.Media.Media3D.MaterialGroup(); break;
case KnownElements.Matrix: o = new System.Windows.Media.Matrix(); break;
case KnownElements.Matrix3D: o = new System.Windows.Media.Media3D.Matrix3D(); break;
case KnownElements.Matrix3DConverter: o = new System.Windows.Media.Media3D.Matrix3DConverter(); break;
case KnownElements.MatrixAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames(); break;
case KnownElements.MatrixAnimationUsingPath: o = new System.Windows.Media.Animation.MatrixAnimationUsingPath(); break;
case KnownElements.MatrixCamera: o = new System.Windows.Media.Media3D.MatrixCamera(); break;
case KnownElements.MatrixConverter: o = new System.Windows.Media.MatrixConverter(); break;
case KnownElements.MatrixKeyFrameCollection: o = new System.Windows.Media.Animation.MatrixKeyFrameCollection(); break;
case KnownElements.MatrixTransform: o = new System.Windows.Media.MatrixTransform(); break;
case KnownElements.MatrixTransform3D: o = new System.Windows.Media.Media3D.MatrixTransform3D(); break;
case KnownElements.MediaElement: o = new System.Windows.Controls.MediaElement(); break;
case KnownElements.MediaPlayer: o = new System.Windows.Media.MediaPlayer(); break;
case KnownElements.MediaTimeline: o = new System.Windows.Media.MediaTimeline(); break;
case KnownElements.Menu: o = new System.Windows.Controls.Menu(); break;
case KnownElements.MenuItem: o = new System.Windows.Controls.MenuItem(); break;
case KnownElements.MenuScrollingVisibilityConverter: o = new System.Windows.Controls.MenuScrollingVisibilityConverter(); break;
case KnownElements.MeshGeometry3D: o = new System.Windows.Media.Media3D.MeshGeometry3D(); break;
case KnownElements.Model3DCollection: o = new System.Windows.Media.Media3D.Model3DCollection(); break;
case KnownElements.Model3DGroup: o = new System.Windows.Media.Media3D.Model3DGroup(); break;
case KnownElements.ModelVisual3D: o = new System.Windows.Media.Media3D.ModelVisual3D(); break;
case KnownElements.ModifierKeysConverter: o = new System.Windows.Input.ModifierKeysConverter(); break;
case KnownElements.MouseActionConverter: o = new System.Windows.Input.MouseActionConverter(); break;
case KnownElements.MouseBinding: o = new System.Windows.Input.MouseBinding(); break;
case KnownElements.MouseGesture: o = new System.Windows.Input.MouseGesture(); break;
case KnownElements.MouseGestureConverter: o = new System.Windows.Input.MouseGestureConverter(); break;
case KnownElements.MultiBinding: o = new System.Windows.Data.MultiBinding(); break;
case KnownElements.MultiDataTrigger: o = new System.Windows.MultiDataTrigger(); break;
case KnownElements.MultiTrigger: o = new System.Windows.MultiTrigger(); break;
case KnownElements.NameScope: o = new System.Windows.NameScope(); break;
case KnownElements.NavigationWindow: o = new System.Windows.Navigation.NavigationWindow(); break;
case KnownElements.NullExtension: o = new System.Windows.Markup.NullExtension(); break;
case KnownElements.NullableBoolConverter: o = new System.Windows.NullableBoolConverter(); break;
case KnownElements.NumberSubstitution: o = new System.Windows.Media.NumberSubstitution(); break;
case KnownElements.Object: o = new System.Object(); break;
case KnownElements.ObjectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames(); break;
case KnownElements.ObjectDataProvider: o = new System.Windows.Data.ObjectDataProvider(); break;
case KnownElements.ObjectKeyFrameCollection: o = new System.Windows.Media.Animation.ObjectKeyFrameCollection(); break;
case KnownElements.OrthographicCamera: o = new System.Windows.Media.Media3D.OrthographicCamera(); break;
case KnownElements.OuterGlowBitmapEffect: o = new System.Windows.Media.Effects.OuterGlowBitmapEffect(); break;
case KnownElements.Page: o = new System.Windows.Controls.Page(); break;
case KnownElements.PageContent: o = new System.Windows.Documents.PageContent(); break;
case KnownElements.Paragraph: o = new System.Windows.Documents.Paragraph(); break;
case KnownElements.ParallelTimeline: o = new System.Windows.Media.Animation.ParallelTimeline(); break;
case KnownElements.ParserContext: o = new System.Windows.Markup.ParserContext(); break;
case KnownElements.PasswordBox: o = new System.Windows.Controls.PasswordBox(); break;
case KnownElements.Path: o = new System.Windows.Shapes.Path(); break;
case KnownElements.PathFigure: o = new System.Windows.Media.PathFigure(); break;
case KnownElements.PathFigureCollection: o = new System.Windows.Media.PathFigureCollection(); break;
case KnownElements.PathFigureCollectionConverter: o = new System.Windows.Media.PathFigureCollectionConverter(); break;
case KnownElements.PathGeometry: o = new System.Windows.Media.PathGeometry(); break;
case KnownElements.PathSegmentCollection: o = new System.Windows.Media.PathSegmentCollection(); break;
case KnownElements.PauseStoryboard: o = new System.Windows.Media.Animation.PauseStoryboard(); break;
case KnownElements.Pen: o = new System.Windows.Media.Pen(); break;
case KnownElements.PerspectiveCamera: o = new System.Windows.Media.Media3D.PerspectiveCamera(); break;
case KnownElements.PixelFormat: o = new System.Windows.Media.PixelFormat(); break;
case KnownElements.PixelFormatConverter: o = new System.Windows.Media.PixelFormatConverter(); break;
case KnownElements.PngBitmapEncoder: o = new System.Windows.Media.Imaging.PngBitmapEncoder(); break;
case KnownElements.Point: o = new System.Windows.Point(); break;
case KnownElements.Point3D: o = new System.Windows.Media.Media3D.Point3D(); break;
case KnownElements.Point3DAnimation: o = new System.Windows.Media.Animation.Point3DAnimation(); break;
case KnownElements.Point3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames(); break;
case KnownElements.Point3DCollection: o = new System.Windows.Media.Media3D.Point3DCollection(); break;
case KnownElements.Point3DCollectionConverter: o = new System.Windows.Media.Media3D.Point3DCollectionConverter(); break;
case KnownElements.Point3DConverter: o = new System.Windows.Media.Media3D.Point3DConverter(); break;
case KnownElements.Point3DKeyFrameCollection: o = new System.Windows.Media.Animation.Point3DKeyFrameCollection(); break;
case KnownElements.Point4D: o = new System.Windows.Media.Media3D.Point4D(); break;
case KnownElements.Point4DConverter: o = new System.Windows.Media.Media3D.Point4DConverter(); break;
case KnownElements.PointAnimation: o = new System.Windows.Media.Animation.PointAnimation(); break;
case KnownElements.PointAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.PointAnimationUsingKeyFrames(); break;
case KnownElements.PointAnimationUsingPath: o = new System.Windows.Media.Animation.PointAnimationUsingPath(); break;
case KnownElements.PointCollection: o = new System.Windows.Media.PointCollection(); break;
case KnownElements.PointCollectionConverter: o = new System.Windows.Media.PointCollectionConverter(); break;
case KnownElements.PointConverter: o = new System.Windows.PointConverter(); break;
case KnownElements.PointIListConverter: o = new System.Windows.Media.Converters.PointIListConverter(); break;
case KnownElements.PointKeyFrameCollection: o = new System.Windows.Media.Animation.PointKeyFrameCollection(); break;
case KnownElements.PointLight: o = new System.Windows.Media.Media3D.PointLight(); break;
case KnownElements.PolyBezierSegment: o = new System.Windows.Media.PolyBezierSegment(); break;
case KnownElements.PolyLineSegment: o = new System.Windows.Media.PolyLineSegment(); break;
case KnownElements.PolyQuadraticBezierSegment: o = new System.Windows.Media.PolyQuadraticBezierSegment(); break;
case KnownElements.Polygon: o = new System.Windows.Shapes.Polygon(); break;
case KnownElements.Polyline: o = new System.Windows.Shapes.Polyline(); break;
case KnownElements.Popup: o = new System.Windows.Controls.Primitives.Popup(); break;
case KnownElements.PriorityBinding: o = new System.Windows.Data.PriorityBinding(); break;
case KnownElements.ProgressBar: o = new System.Windows.Controls.ProgressBar(); break;
case KnownElements.PropertyPathConverter: o = new System.Windows.PropertyPathConverter(); break;
case KnownElements.QuadraticBezierSegment: o = new System.Windows.Media.QuadraticBezierSegment(); break;
case KnownElements.Quaternion: o = new System.Windows.Media.Media3D.Quaternion(); break;
case KnownElements.QuaternionAnimation: o = new System.Windows.Media.Animation.QuaternionAnimation(); break;
case KnownElements.QuaternionAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames(); break;
case KnownElements.QuaternionConverter: o = new System.Windows.Media.Media3D.QuaternionConverter(); break;
case KnownElements.QuaternionKeyFrameCollection: o = new System.Windows.Media.Animation.QuaternionKeyFrameCollection(); break;
case KnownElements.QuaternionRotation3D: o = new System.Windows.Media.Media3D.QuaternionRotation3D(); break;
case KnownElements.RadialGradientBrush: o = new System.Windows.Media.RadialGradientBrush(); break;
case KnownElements.RadioButton: o = new System.Windows.Controls.RadioButton(); break;
case KnownElements.Rect: o = new System.Windows.Rect(); break;
case KnownElements.Rect3D: o = new System.Windows.Media.Media3D.Rect3D(); break;
case KnownElements.Rect3DConverter: o = new System.Windows.Media.Media3D.Rect3DConverter(); break;
case KnownElements.RectAnimation: o = new System.Windows.Media.Animation.RectAnimation(); break;
case KnownElements.RectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.RectAnimationUsingKeyFrames(); break;
case KnownElements.RectConverter: o = new System.Windows.RectConverter(); break;
case KnownElements.RectKeyFrameCollection: o = new System.Windows.Media.Animation.RectKeyFrameCollection(); break;
case KnownElements.Rectangle: o = new System.Windows.Shapes.Rectangle(); break;
case KnownElements.RectangleGeometry: o = new System.Windows.Media.RectangleGeometry(); break;
case KnownElements.RelativeSource: o = new System.Windows.Data.RelativeSource(); break;
case KnownElements.RemoveStoryboard: o = new System.Windows.Media.Animation.RemoveStoryboard(); break;
case KnownElements.RepeatBehavior: o = new System.Windows.Media.Animation.RepeatBehavior(); break;
case KnownElements.RepeatBehaviorConverter: o = new System.Windows.Media.Animation.RepeatBehaviorConverter(); break;
case KnownElements.RepeatButton: o = new System.Windows.Controls.Primitives.RepeatButton(); break;
case KnownElements.ResizeGrip: o = new System.Windows.Controls.Primitives.ResizeGrip(); break;
case KnownElements.ResourceDictionary: o = new System.Windows.ResourceDictionary(); break;
case KnownElements.ResumeStoryboard: o = new System.Windows.Media.Animation.ResumeStoryboard(); break;
case KnownElements.RichTextBox: o = new System.Windows.Controls.RichTextBox(); break;
case KnownElements.RotateTransform: o = new System.Windows.Media.RotateTransform(); break;
case KnownElements.RotateTransform3D: o = new System.Windows.Media.Media3D.RotateTransform3D(); break;
case KnownElements.Rotation3DAnimation: o = new System.Windows.Media.Animation.Rotation3DAnimation(); break;
case KnownElements.Rotation3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames(); break;
case KnownElements.Rotation3DKeyFrameCollection: o = new System.Windows.Media.Animation.Rotation3DKeyFrameCollection(); break;
case KnownElements.RoutedCommand: o = new System.Windows.Input.RoutedCommand(); break;
case KnownElements.RoutedEventConverter: o = new System.Windows.Markup.RoutedEventConverter(); break;
case KnownElements.RoutedUICommand: o = new System.Windows.Input.RoutedUICommand(); break;
case KnownElements.RowDefinition: o = new System.Windows.Controls.RowDefinition(); break;
case KnownElements.Run: o = new System.Windows.Documents.Run(); break;
case KnownElements.SByteConverter: o = new System.ComponentModel.SByteConverter(); break;
case KnownElements.ScaleTransform: o = new System.Windows.Media.ScaleTransform(); break;
case KnownElements.ScaleTransform3D: o = new System.Windows.Media.Media3D.ScaleTransform3D(); break;
case KnownElements.ScrollBar: o = new System.Windows.Controls.Primitives.ScrollBar(); break;
case KnownElements.ScrollContentPresenter: o = new System.Windows.Controls.ScrollContentPresenter(); break;
case KnownElements.ScrollViewer: o = new System.Windows.Controls.ScrollViewer(); break;
case KnownElements.Section: o = new System.Windows.Documents.Section(); break;
case KnownElements.SeekStoryboard: o = new System.Windows.Media.Animation.SeekStoryboard(); break;
case KnownElements.Separator: o = new System.Windows.Controls.Separator(); break;
case KnownElements.SetStoryboardSpeedRatio: o = new System.Windows.Media.Animation.SetStoryboardSpeedRatio(); break;
case KnownElements.Setter: o = new System.Windows.Setter(); break;
case KnownElements.SingleAnimation: o = new System.Windows.Media.Animation.SingleAnimation(); break;
case KnownElements.SingleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SingleAnimationUsingKeyFrames(); break;
case KnownElements.SingleConverter: o = new System.ComponentModel.SingleConverter(); break;
case KnownElements.SingleKeyFrameCollection: o = new System.Windows.Media.Animation.SingleKeyFrameCollection(); break;
case KnownElements.Size: o = new System.Windows.Size(); break;
case KnownElements.Size3D: o = new System.Windows.Media.Media3D.Size3D(); break;
case KnownElements.Size3DConverter: o = new System.Windows.Media.Media3D.Size3DConverter(); break;
case KnownElements.SizeAnimation: o = new System.Windows.Media.Animation.SizeAnimation(); break;
case KnownElements.SizeAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SizeAnimationUsingKeyFrames(); break;
case KnownElements.SizeConverter: o = new System.Windows.SizeConverter(); break;
case KnownElements.SizeKeyFrameCollection: o = new System.Windows.Media.Animation.SizeKeyFrameCollection(); break;
case KnownElements.SkewTransform: o = new System.Windows.Media.SkewTransform(); break;
case KnownElements.SkipStoryboardToFill: o = new System.Windows.Media.Animation.SkipStoryboardToFill(); break;
case KnownElements.Slider: o = new System.Windows.Controls.Slider(); break;
case KnownElements.SolidColorBrush: o = new System.Windows.Media.SolidColorBrush(); break;
case KnownElements.SoundPlayerAction: o = new System.Windows.Controls.SoundPlayerAction(); break;
case KnownElements.Span: o = new System.Windows.Documents.Span(); break;
case KnownElements.SpecularMaterial: o = new System.Windows.Media.Media3D.SpecularMaterial(); break;
case KnownElements.SplineByteKeyFrame: o = new System.Windows.Media.Animation.SplineByteKeyFrame(); break;
case KnownElements.SplineColorKeyFrame: o = new System.Windows.Media.Animation.SplineColorKeyFrame(); break;
case KnownElements.SplineDecimalKeyFrame: o = new System.Windows.Media.Animation.SplineDecimalKeyFrame(); break;
case KnownElements.SplineDoubleKeyFrame: o = new System.Windows.Media.Animation.SplineDoubleKeyFrame(); break;
case KnownElements.SplineInt16KeyFrame: o = new System.Windows.Media.Animation.SplineInt16KeyFrame(); break;
case KnownElements.SplineInt32KeyFrame: o = new System.Windows.Media.Animation.SplineInt32KeyFrame(); break;
case KnownElements.SplineInt64KeyFrame: o = new System.Windows.Media.Animation.SplineInt64KeyFrame(); break;
case KnownElements.SplinePoint3DKeyFrame: o = new System.Windows.Media.Animation.SplinePoint3DKeyFrame(); break;
case KnownElements.SplinePointKeyFrame: o = new System.Windows.Media.Animation.SplinePointKeyFrame(); break;
case KnownElements.SplineQuaternionKeyFrame: o = new System.Windows.Media.Animation.SplineQuaternionKeyFrame(); break;
case KnownElements.SplineRectKeyFrame: o = new System.Windows.Media.Animation.SplineRectKeyFrame(); break;
case KnownElements.SplineRotation3DKeyFrame: o = new System.Windows.Media.Animation.SplineRotation3DKeyFrame(); break;
case KnownElements.SplineSingleKeyFrame: o = new System.Windows.Media.Animation.SplineSingleKeyFrame(); break;
case KnownElements.SplineSizeKeyFrame: o = new System.Windows.Media.Animation.SplineSizeKeyFrame(); break;
case KnownElements.SplineThicknessKeyFrame: o = new System.Windows.Media.Animation.SplineThicknessKeyFrame(); break;
case KnownElements.SplineVector3DKeyFrame: o = new System.Windows.Media.Animation.SplineVector3DKeyFrame(); break;
case KnownElements.SplineVectorKeyFrame: o = new System.Windows.Media.Animation.SplineVectorKeyFrame(); break;
case KnownElements.SpotLight: o = new System.Windows.Media.Media3D.SpotLight(); break;
case KnownElements.StackPanel: o = new System.Windows.Controls.StackPanel(); break;
case KnownElements.StaticExtension: o = new System.Windows.Markup.StaticExtension(); break;
case KnownElements.StaticResourceExtension: o = new System.Windows.StaticResourceExtension(); break;
case KnownElements.StatusBar: o = new System.Windows.Controls.Primitives.StatusBar(); break;
case KnownElements.StatusBarItem: o = new System.Windows.Controls.Primitives.StatusBarItem(); break;
case KnownElements.StopStoryboard: o = new System.Windows.Media.Animation.StopStoryboard(); break;
case KnownElements.Storyboard: o = new System.Windows.Media.Animation.Storyboard(); break;
case KnownElements.StreamGeometry: o = new System.Windows.Media.StreamGeometry(); break;
case KnownElements.StreamResourceInfo: o = new System.Windows.Resources.StreamResourceInfo(); break;
case KnownElements.StringAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.StringAnimationUsingKeyFrames(); break;
case KnownElements.StringConverter: o = new System.ComponentModel.StringConverter(); break;
case KnownElements.StringKeyFrameCollection: o = new System.Windows.Media.Animation.StringKeyFrameCollection(); break;
case KnownElements.StrokeCollection: o = new System.Windows.Ink.StrokeCollection(); break;
case KnownElements.StrokeCollectionConverter: o = new System.Windows.StrokeCollectionConverter(); break;
case KnownElements.Style: o = new System.Windows.Style(); break;
case KnownElements.TabControl: o = new System.Windows.Controls.TabControl(); break;
case KnownElements.TabItem: o = new System.Windows.Controls.TabItem(); break;
case KnownElements.TabPanel: o = new System.Windows.Controls.Primitives.TabPanel(); break;
case KnownElements.Table: o = new System.Windows.Documents.Table(); break;
case KnownElements.TableCell: o = new System.Windows.Documents.TableCell(); break;
case KnownElements.TableColumn: o = new System.Windows.Documents.TableColumn(); break;
case KnownElements.TableRow: o = new System.Windows.Documents.TableRow(); break;
case KnownElements.TableRowGroup: o = new System.Windows.Documents.TableRowGroup(); break;
case KnownElements.TemplateBindingExpressionConverter: o = new System.Windows.TemplateBindingExpressionConverter(); break;
case KnownElements.TemplateBindingExtension: o = new System.Windows.TemplateBindingExtension(); break;
case KnownElements.TemplateBindingExtensionConverter: o = new System.Windows.TemplateBindingExtensionConverter(); break;
case KnownElements.TemplateKeyConverter: o = new System.Windows.Markup.TemplateKeyConverter(); break;
case KnownElements.TextBlock: o = new System.Windows.Controls.TextBlock(); break;
case KnownElements.TextBox: o = new System.Windows.Controls.TextBox(); break;
case KnownElements.TextDecoration: o = new System.Windows.TextDecoration(); break;
case KnownElements.TextDecorationCollection: o = new System.Windows.TextDecorationCollection(); break;
case KnownElements.TextDecorationCollectionConverter: o = new System.Windows.TextDecorationCollectionConverter(); break;
case KnownElements.TextEffect: o = new System.Windows.Media.TextEffect(); break;
case KnownElements.TextEffectCollection: o = new System.Windows.Media.TextEffectCollection(); break;
case KnownElements.ThemeDictionaryExtension: o = new System.Windows.ThemeDictionaryExtension(); break;
case KnownElements.Thickness: o = new System.Windows.Thickness(); break;
case KnownElements.ThicknessAnimation: o = new System.Windows.Media.Animation.ThicknessAnimation(); break;
case KnownElements.ThicknessAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames(); break;
case KnownElements.ThicknessConverter: o = new System.Windows.ThicknessConverter(); break;
case KnownElements.ThicknessKeyFrameCollection: o = new System.Windows.Media.Animation.ThicknessKeyFrameCollection(); break;
case KnownElements.Thumb: o = new System.Windows.Controls.Primitives.Thumb(); break;
case KnownElements.TickBar: o = new System.Windows.Controls.Primitives.TickBar(); break;
case KnownElements.TiffBitmapEncoder: o = new System.Windows.Media.Imaging.TiffBitmapEncoder(); break;
case KnownElements.TimeSpanConverter: o = new System.ComponentModel.TimeSpanConverter(); break;
case KnownElements.TimelineCollection: o = new System.Windows.Media.Animation.TimelineCollection(); break;
case KnownElements.ToggleButton: o = new System.Windows.Controls.Primitives.ToggleButton(); break;
case KnownElements.ToolBar: o = new System.Windows.Controls.ToolBar(); break;
case KnownElements.ToolBarOverflowPanel: o = new System.Windows.Controls.Primitives.ToolBarOverflowPanel(); break;
case KnownElements.ToolBarPanel: o = new System.Windows.Controls.Primitives.ToolBarPanel(); break;
case KnownElements.ToolBarTray: o = new System.Windows.Controls.ToolBarTray(); break;
case KnownElements.ToolTip: o = new System.Windows.Controls.ToolTip(); break;
case KnownElements.Track: o = new System.Windows.Controls.Primitives.Track(); break;
case KnownElements.Transform3DCollection: o = new System.Windows.Media.Media3D.Transform3DCollection(); break;
case KnownElements.Transform3DGroup: o = new System.Windows.Media.Media3D.Transform3DGroup(); break;
case KnownElements.TransformCollection: o = new System.Windows.Media.TransformCollection(); break;
case KnownElements.TransformConverter: o = new System.Windows.Media.TransformConverter(); break;
case KnownElements.TransformGroup: o = new System.Windows.Media.TransformGroup(); break;
case KnownElements.TransformedBitmap: o = new System.Windows.Media.Imaging.TransformedBitmap(); break;
case KnownElements.TranslateTransform: o = new System.Windows.Media.TranslateTransform(); break;
case KnownElements.TranslateTransform3D: o = new System.Windows.Media.Media3D.TranslateTransform3D(); break;
case KnownElements.TreeView: o = new System.Windows.Controls.TreeView(); break;
case KnownElements.TreeViewItem: o = new System.Windows.Controls.TreeViewItem(); break;
case KnownElements.Trigger: o = new System.Windows.Trigger(); break;
case KnownElements.TypeExtension: o = new System.Windows.Markup.TypeExtension(); break;
case KnownElements.TypeTypeConverter: o = new System.Windows.Markup.TypeTypeConverter(); break;
case KnownElements.UIElement: o = new System.Windows.UIElement(); break;
case KnownElements.UInt16Converter: o = new System.ComponentModel.UInt16Converter(); break;
case KnownElements.UInt32Converter: o = new System.ComponentModel.UInt32Converter(); break;
case KnownElements.UInt64Converter: o = new System.ComponentModel.UInt64Converter(); break;
case KnownElements.UShortIListConverter: o = new System.Windows.Media.Converters.UShortIListConverter(); break;
case KnownElements.Underline: o = new System.Windows.Documents.Underline(); break;
case KnownElements.UniformGrid: o = new System.Windows.Controls.Primitives.UniformGrid(); break;
case KnownElements.UriTypeConverter: o = new System.UriTypeConverter(); break;
case KnownElements.UserControl: o = new System.Windows.Controls.UserControl(); break;
case KnownElements.Vector: o = new System.Windows.Vector(); break;
case KnownElements.Vector3D: o = new System.Windows.Media.Media3D.Vector3D(); break;
case KnownElements.Vector3DAnimation: o = new System.Windows.Media.Animation.Vector3DAnimation(); break;
case KnownElements.Vector3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames(); break;
case KnownElements.Vector3DCollection: o = new System.Windows.Media.Media3D.Vector3DCollection(); break;
case KnownElements.Vector3DCollectionConverter: o = new System.Windows.Media.Media3D.Vector3DCollectionConverter(); break;
case KnownElements.Vector3DConverter: o = new System.Windows.Media.Media3D.Vector3DConverter(); break;
case KnownElements.Vector3DKeyFrameCollection: o = new System.Windows.Media.Animation.Vector3DKeyFrameCollection(); break;
case KnownElements.VectorAnimation: o = new System.Windows.Media.Animation.VectorAnimation(); break;
case KnownElements.VectorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.VectorAnimationUsingKeyFrames(); break;
case KnownElements.VectorCollection: o = new System.Windows.Media.VectorCollection(); break;
case KnownElements.VectorCollectionConverter: o = new System.Windows.Media.VectorCollectionConverter(); break;
case KnownElements.VectorConverter: o = new System.Windows.VectorConverter(); break;
case KnownElements.VectorKeyFrameCollection: o = new System.Windows.Media.Animation.VectorKeyFrameCollection(); break;
case KnownElements.VideoDrawing: o = new System.Windows.Media.VideoDrawing(); break;
case KnownElements.Viewbox: o = new System.Windows.Controls.Viewbox(); break;
case KnownElements.Viewport3D: o = new System.Windows.Controls.Viewport3D(); break;
case KnownElements.Viewport3DVisual: o = new System.Windows.Media.Media3D.Viewport3DVisual(); break;
case KnownElements.VirtualizingStackPanel: o = new System.Windows.Controls.VirtualizingStackPanel(); break;
case KnownElements.VisualBrush: o = new System.Windows.Media.VisualBrush(); break;
case KnownElements.Window: o = new System.Windows.Window(); break;
case KnownElements.WmpBitmapEncoder: o = new System.Windows.Media.Imaging.WmpBitmapEncoder(); break;
case KnownElements.WrapPanel: o = new System.Windows.Controls.WrapPanel(); break;
case KnownElements.XamlBrushSerializer: o = new System.Windows.Markup.XamlBrushSerializer(); break;
case KnownElements.XamlInt32CollectionSerializer: o = new System.Windows.Markup.XamlInt32CollectionSerializer(); break;
case KnownElements.XamlPathDataSerializer: o = new System.Windows.Markup.XamlPathDataSerializer(); break;
case KnownElements.XamlPoint3DCollectionSerializer: o = new System.Windows.Markup.XamlPoint3DCollectionSerializer(); break;
case KnownElements.XamlPointCollectionSerializer: o = new System.Windows.Markup.XamlPointCollectionSerializer(); break;
case KnownElements.XamlStyleSerializer: o = new System.Windows.Markup.XamlStyleSerializer(); break;
case KnownElements.XamlTemplateSerializer: o = new System.Windows.Markup.XamlTemplateSerializer(); break;
case KnownElements.XamlVector3DCollectionSerializer: o = new System.Windows.Markup.XamlVector3DCollectionSerializer(); break;
case KnownElements.XmlDataProvider: o = new System.Windows.Data.XmlDataProvider(); break;
case KnownElements.XmlLanguageConverter: o = new System.Windows.Markup.XmlLanguageConverter(); break;
case KnownElements.XmlNamespaceMapping: o = new System.Windows.Data.XmlNamespaceMapping(); break;
case KnownElements.ZoomPercentageConverter: o = new System.Windows.Documents.ZoomPercentageConverter(); break;
}
return o;
}
internal static DependencyProperty GetKnownDependencyPropertyFromId(KnownProperties knownProperty)
{
switch (knownProperty)
{
case KnownProperties.AccessText_Text:
return System.Windows.Controls.AccessText.TextProperty;
case KnownProperties.BeginStoryboard_Storyboard:
return System.Windows.Media.Animation.BeginStoryboard.StoryboardProperty;
case KnownProperties.BitmapEffectGroup_Children:
return System.Windows.Media.Effects.BitmapEffectGroup.ChildrenProperty;
case KnownProperties.Border_Background:
return System.Windows.Controls.Border.BackgroundProperty;
case KnownProperties.Border_BorderBrush:
return System.Windows.Controls.Border.BorderBrushProperty;
case KnownProperties.Border_BorderThickness:
return System.Windows.Controls.Border.BorderThicknessProperty;
case KnownProperties.ButtonBase_Command:
return System.Windows.Controls.Primitives.ButtonBase.CommandProperty;
case KnownProperties.ButtonBase_CommandParameter:
return System.Windows.Controls.Primitives.ButtonBase.CommandParameterProperty;
case KnownProperties.ButtonBase_CommandTarget:
return System.Windows.Controls.Primitives.ButtonBase.CommandTargetProperty;
case KnownProperties.ButtonBase_IsPressed:
return System.Windows.Controls.Primitives.ButtonBase.IsPressedProperty;
case KnownProperties.ColumnDefinition_MaxWidth:
return System.Windows.Controls.ColumnDefinition.MaxWidthProperty;
case KnownProperties.ColumnDefinition_MinWidth:
return System.Windows.Controls.ColumnDefinition.MinWidthProperty;
case KnownProperties.ColumnDefinition_Width:
return System.Windows.Controls.ColumnDefinition.WidthProperty;
case KnownProperties.ContentControl_Content:
return System.Windows.Controls.ContentControl.ContentProperty;
case KnownProperties.ContentControl_ContentTemplate:
return System.Windows.Controls.ContentControl.ContentTemplateProperty;
case KnownProperties.ContentControl_ContentTemplateSelector:
return System.Windows.Controls.ContentControl.ContentTemplateSelectorProperty;
case KnownProperties.ContentControl_HasContent:
return System.Windows.Controls.ContentControl.HasContentProperty;
case KnownProperties.ContentElement_Focusable:
return System.Windows.ContentElement.FocusableProperty;
case KnownProperties.ContentPresenter_Content:
return System.Windows.Controls.ContentPresenter.ContentProperty;
case KnownProperties.ContentPresenter_ContentSource:
return System.Windows.Controls.ContentPresenter.ContentSourceProperty;
case KnownProperties.ContentPresenter_ContentTemplate:
return System.Windows.Controls.ContentPresenter.ContentTemplateProperty;
case KnownProperties.ContentPresenter_ContentTemplateSelector:
return System.Windows.Controls.ContentPresenter.ContentTemplateSelectorProperty;
case KnownProperties.ContentPresenter_RecognizesAccessKey:
return System.Windows.Controls.ContentPresenter.RecognizesAccessKeyProperty;
case KnownProperties.Control_Background:
return System.Windows.Controls.Control.BackgroundProperty;
case KnownProperties.Control_BorderBrush:
return System.Windows.Controls.Control.BorderBrushProperty;
case KnownProperties.Control_BorderThickness:
return System.Windows.Controls.Control.BorderThicknessProperty;
case KnownProperties.Control_FontFamily:
return System.Windows.Controls.Control.FontFamilyProperty;
case KnownProperties.Control_FontSize:
return System.Windows.Controls.Control.FontSizeProperty;
case KnownProperties.Control_FontStretch:
return System.Windows.Controls.Control.FontStretchProperty;
case KnownProperties.Control_FontStyle:
return System.Windows.Controls.Control.FontStyleProperty;
case KnownProperties.Control_FontWeight:
return System.Windows.Controls.Control.FontWeightProperty;
case KnownProperties.Control_Foreground:
return System.Windows.Controls.Control.ForegroundProperty;
case KnownProperties.Control_HorizontalContentAlignment:
return System.Windows.Controls.Control.HorizontalContentAlignmentProperty;
case KnownProperties.Control_IsTabStop:
return System.Windows.Controls.Control.IsTabStopProperty;
case KnownProperties.Control_Padding:
return System.Windows.Controls.Control.PaddingProperty;
case KnownProperties.Control_TabIndex:
return System.Windows.Controls.Control.TabIndexProperty;
case KnownProperties.Control_Template:
return System.Windows.Controls.Control.TemplateProperty;
case KnownProperties.Control_VerticalContentAlignment:
return System.Windows.Controls.Control.VerticalContentAlignmentProperty;
case KnownProperties.DockPanel_Dock:
return System.Windows.Controls.DockPanel.DockProperty;
case KnownProperties.DockPanel_LastChildFill:
return System.Windows.Controls.DockPanel.LastChildFillProperty;
case KnownProperties.DocumentViewerBase_Document:
return System.Windows.Controls.Primitives.DocumentViewerBase.DocumentProperty;
case KnownProperties.DrawingGroup_Children:
return System.Windows.Media.DrawingGroup.ChildrenProperty;
case KnownProperties.FlowDocumentReader_Document:
return System.Windows.Controls.FlowDocumentReader.DocumentProperty;
case KnownProperties.FlowDocumentScrollViewer_Document:
return System.Windows.Controls.FlowDocumentScrollViewer.DocumentProperty;
case KnownProperties.FrameworkContentElement_Style:
return System.Windows.FrameworkContentElement.StyleProperty;
case KnownProperties.FrameworkElement_FlowDirection:
return System.Windows.FrameworkElement.FlowDirectionProperty;
case KnownProperties.FrameworkElement_Height:
return System.Windows.FrameworkElement.HeightProperty;
case KnownProperties.FrameworkElement_HorizontalAlignment:
return System.Windows.FrameworkElement.HorizontalAlignmentProperty;
case KnownProperties.FrameworkElement_Margin:
return System.Windows.FrameworkElement.MarginProperty;
case KnownProperties.FrameworkElement_MaxHeight:
return System.Windows.FrameworkElement.MaxHeightProperty;
case KnownProperties.FrameworkElement_MaxWidth:
return System.Windows.FrameworkElement.MaxWidthProperty;
case KnownProperties.FrameworkElement_MinHeight:
return System.Windows.FrameworkElement.MinHeightProperty;
case KnownProperties.FrameworkElement_MinWidth:
return System.Windows.FrameworkElement.MinWidthProperty;
case KnownProperties.FrameworkElement_Name:
return System.Windows.FrameworkElement.NameProperty;
case KnownProperties.FrameworkElement_Style:
return System.Windows.FrameworkElement.StyleProperty;
case KnownProperties.FrameworkElement_VerticalAlignment:
return System.Windows.FrameworkElement.VerticalAlignmentProperty;
case KnownProperties.FrameworkElement_Width:
return System.Windows.FrameworkElement.WidthProperty;
case KnownProperties.GeneralTransformGroup_Children:
return System.Windows.Media.GeneralTransformGroup.ChildrenProperty;
case KnownProperties.GeometryGroup_Children:
return System.Windows.Media.GeometryGroup.ChildrenProperty;
case KnownProperties.GradientBrush_GradientStops:
return System.Windows.Media.GradientBrush.GradientStopsProperty;
case KnownProperties.Grid_Column:
return System.Windows.Controls.Grid.ColumnProperty;
case KnownProperties.Grid_ColumnSpan:
return System.Windows.Controls.Grid.ColumnSpanProperty;
case KnownProperties.Grid_Row:
return System.Windows.Controls.Grid.RowProperty;
case KnownProperties.Grid_RowSpan:
return System.Windows.Controls.Grid.RowSpanProperty;
case KnownProperties.GridViewColumn_Header:
return System.Windows.Controls.GridViewColumn.HeaderProperty;
case KnownProperties.HeaderedContentControl_HasHeader:
return System.Windows.Controls.HeaderedContentControl.HasHeaderProperty;
case KnownProperties.HeaderedContentControl_Header:
return System.Windows.Controls.HeaderedContentControl.HeaderProperty;
case KnownProperties.HeaderedContentControl_HeaderTemplate:
return System.Windows.Controls.HeaderedContentControl.HeaderTemplateProperty;
case KnownProperties.HeaderedContentControl_HeaderTemplateSelector:
return System.Windows.Controls.HeaderedContentControl.HeaderTemplateSelectorProperty;
case KnownProperties.HeaderedItemsControl_HasHeader:
return System.Windows.Controls.HeaderedItemsControl.HasHeaderProperty;
case KnownProperties.HeaderedItemsControl_Header:
return System.Windows.Controls.HeaderedItemsControl.HeaderProperty;
case KnownProperties.HeaderedItemsControl_HeaderTemplate:
return System.Windows.Controls.HeaderedItemsControl.HeaderTemplateProperty;
case KnownProperties.HeaderedItemsControl_HeaderTemplateSelector:
return System.Windows.Controls.HeaderedItemsControl.HeaderTemplateSelectorProperty;
case KnownProperties.Hyperlink_NavigateUri:
return System.Windows.Documents.Hyperlink.NavigateUriProperty;
case KnownProperties.Image_Source:
return System.Windows.Controls.Image.SourceProperty;
case KnownProperties.Image_Stretch:
return System.Windows.Controls.Image.StretchProperty;
case KnownProperties.ItemsControl_ItemContainerStyle:
return System.Windows.Controls.ItemsControl.ItemContainerStyleProperty;
case KnownProperties.ItemsControl_ItemContainerStyleSelector:
return System.Windows.Controls.ItemsControl.ItemContainerStyleSelectorProperty;
case KnownProperties.ItemsControl_ItemTemplate:
return System.Windows.Controls.ItemsControl.ItemTemplateProperty;
case KnownProperties.ItemsControl_ItemTemplateSelector:
return System.Windows.Controls.ItemsControl.ItemTemplateSelectorProperty;
case KnownProperties.ItemsControl_ItemsPanel:
return System.Windows.Controls.ItemsControl.ItemsPanelProperty;
case KnownProperties.ItemsControl_ItemsSource:
return System.Windows.Controls.ItemsControl.ItemsSourceProperty;
case KnownProperties.MaterialGroup_Children:
return System.Windows.Media.Media3D.MaterialGroup.ChildrenProperty;
case KnownProperties.Model3DGroup_Children:
return System.Windows.Media.Media3D.Model3DGroup.ChildrenProperty;
case KnownProperties.Page_Content:
return System.Windows.Controls.Page.ContentProperty;
case KnownProperties.Panel_Background:
return System.Windows.Controls.Panel.BackgroundProperty;
case KnownProperties.Path_Data:
return System.Windows.Shapes.Path.DataProperty;
case KnownProperties.PathFigure_Segments:
return System.Windows.Media.PathFigure.SegmentsProperty;
case KnownProperties.PathGeometry_Figures:
return System.Windows.Media.PathGeometry.FiguresProperty;
case KnownProperties.Popup_Child:
return System.Windows.Controls.Primitives.Popup.ChildProperty;
case KnownProperties.Popup_IsOpen:
return System.Windows.Controls.Primitives.Popup.IsOpenProperty;
case KnownProperties.Popup_Placement:
return System.Windows.Controls.Primitives.Popup.PlacementProperty;
case KnownProperties.Popup_PopupAnimation:
return System.Windows.Controls.Primitives.Popup.PopupAnimationProperty;
case KnownProperties.RowDefinition_Height:
return System.Windows.Controls.RowDefinition.HeightProperty;
case KnownProperties.RowDefinition_MaxHeight:
return System.Windows.Controls.RowDefinition.MaxHeightProperty;
case KnownProperties.RowDefinition_MinHeight:
return System.Windows.Controls.RowDefinition.MinHeightProperty;
case KnownProperties.Run_Text:
return System.Windows.Documents.Run.TextProperty;
case KnownProperties.ScrollViewer_CanContentScroll:
return System.Windows.Controls.ScrollViewer.CanContentScrollProperty;
case KnownProperties.ScrollViewer_HorizontalScrollBarVisibility:
return System.Windows.Controls.ScrollViewer.HorizontalScrollBarVisibilityProperty;
case KnownProperties.ScrollViewer_VerticalScrollBarVisibility:
return System.Windows.Controls.ScrollViewer.VerticalScrollBarVisibilityProperty;
case KnownProperties.Shape_Fill:
return System.Windows.Shapes.Shape.FillProperty;
case KnownProperties.Shape_Stroke:
return System.Windows.Shapes.Shape.StrokeProperty;
case KnownProperties.Shape_StrokeThickness:
return System.Windows.Shapes.Shape.StrokeThicknessProperty;
case KnownProperties.TextBlock_Background:
return System.Windows.Controls.TextBlock.BackgroundProperty;
case KnownProperties.TextBlock_FontFamily:
return System.Windows.Controls.TextBlock.FontFamilyProperty;
case KnownProperties.TextBlock_FontSize:
return System.Windows.Controls.TextBlock.FontSizeProperty;
case KnownProperties.TextBlock_FontStretch:
return System.Windows.Controls.TextBlock.FontStretchProperty;
case KnownProperties.TextBlock_FontStyle:
return System.Windows.Controls.TextBlock.FontStyleProperty;
case KnownProperties.TextBlock_FontWeight:
return System.Windows.Controls.TextBlock.FontWeightProperty;
case KnownProperties.TextBlock_Foreground:
return System.Windows.Controls.TextBlock.ForegroundProperty;
case KnownProperties.TextBlock_Text:
return System.Windows.Controls.TextBlock.TextProperty;
case KnownProperties.TextBlock_TextDecorations:
return System.Windows.Controls.TextBlock.TextDecorationsProperty;
case KnownProperties.TextBlock_TextTrimming:
return System.Windows.Controls.TextBlock.TextTrimmingProperty;
case KnownProperties.TextBlock_TextWrapping:
return System.Windows.Controls.TextBlock.TextWrappingProperty;
case KnownProperties.TextBox_Text:
return System.Windows.Controls.TextBox.TextProperty;
case KnownProperties.TextElement_Background:
return System.Windows.Documents.TextElement.BackgroundProperty;
case KnownProperties.TextElement_FontFamily:
return System.Windows.Documents.TextElement.FontFamilyProperty;
case KnownProperties.TextElement_FontSize:
return System.Windows.Documents.TextElement.FontSizeProperty;
case KnownProperties.TextElement_FontStretch:
return System.Windows.Documents.TextElement.FontStretchProperty;
case KnownProperties.TextElement_FontStyle:
return System.Windows.Documents.TextElement.FontStyleProperty;
case KnownProperties.TextElement_FontWeight:
return System.Windows.Documents.TextElement.FontWeightProperty;
case KnownProperties.TextElement_Foreground:
return System.Windows.Documents.TextElement.ForegroundProperty;
case KnownProperties.TimelineGroup_Children:
return System.Windows.Media.Animation.TimelineGroup.ChildrenProperty;
case KnownProperties.Track_IsDirectionReversed:
return System.Windows.Controls.Primitives.Track.IsDirectionReversedProperty;
case KnownProperties.Track_Maximum:
return System.Windows.Controls.Primitives.Track.MaximumProperty;
case KnownProperties.Track_Minimum:
return System.Windows.Controls.Primitives.Track.MinimumProperty;
case KnownProperties.Track_Orientation:
return System.Windows.Controls.Primitives.Track.OrientationProperty;
case KnownProperties.Track_Value:
return System.Windows.Controls.Primitives.Track.ValueProperty;
case KnownProperties.Track_ViewportSize:
return System.Windows.Controls.Primitives.Track.ViewportSizeProperty;
case KnownProperties.Transform3DGroup_Children:
return System.Windows.Media.Media3D.Transform3DGroup.ChildrenProperty;
case KnownProperties.TransformGroup_Children:
return System.Windows.Media.TransformGroup.ChildrenProperty;
case KnownProperties.UIElement_ClipToBounds:
return System.Windows.UIElement.ClipToBoundsProperty;
case KnownProperties.UIElement_Focusable:
return System.Windows.UIElement.FocusableProperty;
case KnownProperties.UIElement_IsEnabled:
return System.Windows.UIElement.IsEnabledProperty;
case KnownProperties.UIElement_RenderTransform:
return System.Windows.UIElement.RenderTransformProperty;
case KnownProperties.UIElement_Visibility:
return System.Windows.UIElement.VisibilityProperty;
case KnownProperties.Viewport3D_Children:
return System.Windows.Controls.Viewport3D.ChildrenProperty;
}
return null;
}
internal static KnownElements GetKnownElementFromKnownCommonProperty(KnownProperties knownProperty)
{
switch (knownProperty)
{
case KnownProperties.AccessText_Text:
return KnownElements.AccessText;
case KnownProperties.AdornedElementPlaceholder_Child:
return KnownElements.AdornedElementPlaceholder;
case KnownProperties.AdornerDecorator_Child:
return KnownElements.AdornerDecorator;
case KnownProperties.AnchoredBlock_Blocks:
return KnownElements.AnchoredBlock;
case KnownProperties.ArrayExtension_Items:
return KnownElements.ArrayExtension;
case KnownProperties.BeginStoryboard_Storyboard:
return KnownElements.BeginStoryboard;
case KnownProperties.BitmapEffectGroup_Children:
return KnownElements.BitmapEffectGroup;
case KnownProperties.BlockUIContainer_Child:
return KnownElements.BlockUIContainer;
case KnownProperties.Bold_Inlines:
return KnownElements.Bold;
case KnownProperties.BooleanAnimationUsingKeyFrames_KeyFrames:
return KnownElements.BooleanAnimationUsingKeyFrames;
case KnownProperties.Border_Background:
case KnownProperties.Border_BorderBrush:
case KnownProperties.Border_BorderThickness:
case KnownProperties.Border_Child:
return KnownElements.Border;
case KnownProperties.BulletDecorator_Child:
return KnownElements.BulletDecorator;
case KnownProperties.Button_Content:
return KnownElements.Button;
case KnownProperties.ButtonBase_Command:
case KnownProperties.ButtonBase_CommandParameter:
case KnownProperties.ButtonBase_CommandTarget:
case KnownProperties.ButtonBase_Content:
case KnownProperties.ButtonBase_IsPressed:
return KnownElements.ButtonBase;
case KnownProperties.ByteAnimationUsingKeyFrames_KeyFrames:
return KnownElements.ByteAnimationUsingKeyFrames;
case KnownProperties.Canvas_Children:
return KnownElements.Canvas;
case KnownProperties.CharAnimationUsingKeyFrames_KeyFrames:
return KnownElements.CharAnimationUsingKeyFrames;
case KnownProperties.CheckBox_Content:
return KnownElements.CheckBox;
case KnownProperties.ColorAnimationUsingKeyFrames_KeyFrames:
return KnownElements.ColorAnimationUsingKeyFrames;
case KnownProperties.ColumnDefinition_MaxWidth:
case KnownProperties.ColumnDefinition_MinWidth:
case KnownProperties.ColumnDefinition_Width:
return KnownElements.ColumnDefinition;
case KnownProperties.ComboBox_Items:
return KnownElements.ComboBox;
case KnownProperties.ComboBoxItem_Content:
return KnownElements.ComboBoxItem;
case KnownProperties.ContentControl_Content:
case KnownProperties.ContentControl_ContentTemplate:
case KnownProperties.ContentControl_ContentTemplateSelector:
case KnownProperties.ContentControl_HasContent:
return KnownElements.ContentControl;
case KnownProperties.ContentElement_Focusable:
return KnownElements.ContentElement;
case KnownProperties.ContentPresenter_Content:
case KnownProperties.ContentPresenter_ContentSource:
case KnownProperties.ContentPresenter_ContentTemplate:
case KnownProperties.ContentPresenter_ContentTemplateSelector:
case KnownProperties.ContentPresenter_RecognizesAccessKey:
return KnownElements.ContentPresenter;
case KnownProperties.ContextMenu_Items:
return KnownElements.ContextMenu;
case KnownProperties.Control_Background:
case KnownProperties.Control_BorderBrush:
case KnownProperties.Control_BorderThickness:
case KnownProperties.Control_FontFamily:
case KnownProperties.Control_FontSize:
case KnownProperties.Control_FontStretch:
case KnownProperties.Control_FontStyle:
case KnownProperties.Control_FontWeight:
case KnownProperties.Control_Foreground:
case KnownProperties.Control_HorizontalContentAlignment:
case KnownProperties.Control_IsTabStop:
case KnownProperties.Control_Padding:
case KnownProperties.Control_TabIndex:
case KnownProperties.Control_Template:
case KnownProperties.Control_VerticalContentAlignment:
return KnownElements.Control;
case KnownProperties.ControlTemplate_VisualTree:
return KnownElements.ControlTemplate;
case KnownProperties.DataTemplate_VisualTree:
return KnownElements.DataTemplate;
case KnownProperties.DataTrigger_Setters:
return KnownElements.DataTrigger;
case KnownProperties.DecimalAnimationUsingKeyFrames_KeyFrames:
return KnownElements.DecimalAnimationUsingKeyFrames;
case KnownProperties.Decorator_Child:
return KnownElements.Decorator;
case KnownProperties.DockPanel_Children:
case KnownProperties.DockPanel_Dock:
case KnownProperties.DockPanel_LastChildFill:
return KnownElements.DockPanel;
case KnownProperties.DocumentViewer_Document:
return KnownElements.DocumentViewer;
case KnownProperties.DocumentViewerBase_Document:
return KnownElements.DocumentViewerBase;
case KnownProperties.DoubleAnimationUsingKeyFrames_KeyFrames:
return KnownElements.DoubleAnimationUsingKeyFrames;
case KnownProperties.DrawingGroup_Children:
return KnownElements.DrawingGroup;
case KnownProperties.EventTrigger_Actions:
return KnownElements.EventTrigger;
case KnownProperties.Expander_Content:
return KnownElements.Expander;
case KnownProperties.Figure_Blocks:
return KnownElements.Figure;
case KnownProperties.FixedDocument_Pages:
return KnownElements.FixedDocument;
case KnownProperties.FixedDocumentSequence_References:
return KnownElements.FixedDocumentSequence;
case KnownProperties.FixedPage_Children:
return KnownElements.FixedPage;
case KnownProperties.Floater_Blocks:
return KnownElements.Floater;
case KnownProperties.FlowDocument_Blocks:
return KnownElements.FlowDocument;
case KnownProperties.FlowDocumentPageViewer_Document:
return KnownElements.FlowDocumentPageViewer;
case KnownProperties.FlowDocumentReader_Document:
return KnownElements.FlowDocumentReader;
case KnownProperties.FlowDocumentScrollViewer_Document:
return KnownElements.FlowDocumentScrollViewer;
case KnownProperties.FrameworkContentElement_Style:
return KnownElements.FrameworkContentElement;
case KnownProperties.FrameworkElement_FlowDirection:
case KnownProperties.FrameworkElement_Height:
case KnownProperties.FrameworkElement_HorizontalAlignment:
case KnownProperties.FrameworkElement_Margin:
case KnownProperties.FrameworkElement_MaxHeight:
case KnownProperties.FrameworkElement_MaxWidth:
case KnownProperties.FrameworkElement_MinHeight:
case KnownProperties.FrameworkElement_MinWidth:
case KnownProperties.FrameworkElement_Name:
case KnownProperties.FrameworkElement_Style:
case KnownProperties.FrameworkElement_VerticalAlignment:
case KnownProperties.FrameworkElement_Width:
return KnownElements.FrameworkElement;
case KnownProperties.FrameworkTemplate_VisualTree:
return KnownElements.FrameworkTemplate;
case KnownProperties.GeneralTransformGroup_Children:
return KnownElements.GeneralTransformGroup;
case KnownProperties.GeometryGroup_Children:
return KnownElements.GeometryGroup;
case KnownProperties.GradientBrush_GradientStops:
return KnownElements.GradientBrush;
case KnownProperties.Grid_Children:
case KnownProperties.Grid_Column:
case KnownProperties.Grid_ColumnSpan:
case KnownProperties.Grid_Row:
case KnownProperties.Grid_RowSpan:
return KnownElements.Grid;
case KnownProperties.GridView_Columns:
return KnownElements.GridView;
case KnownProperties.GridViewColumn_Header:
return KnownElements.GridViewColumn;
case KnownProperties.GridViewColumnHeader_Content:
return KnownElements.GridViewColumnHeader;
case KnownProperties.GroupBox_Content:
return KnownElements.GroupBox;
case KnownProperties.GroupItem_Content:
return KnownElements.GroupItem;
case KnownProperties.HeaderedContentControl_Content:
case KnownProperties.HeaderedContentControl_HasHeader:
case KnownProperties.HeaderedContentControl_Header:
case KnownProperties.HeaderedContentControl_HeaderTemplate:
case KnownProperties.HeaderedContentControl_HeaderTemplateSelector:
return KnownElements.HeaderedContentControl;
case KnownProperties.HeaderedItemsControl_HasHeader:
case KnownProperties.HeaderedItemsControl_Header:
case KnownProperties.HeaderedItemsControl_HeaderTemplate:
case KnownProperties.HeaderedItemsControl_HeaderTemplateSelector:
case KnownProperties.HeaderedItemsControl_Items:
return KnownElements.HeaderedItemsControl;
case KnownProperties.HierarchicalDataTemplate_VisualTree:
return KnownElements.HierarchicalDataTemplate;
case KnownProperties.Hyperlink_Inlines:
case KnownProperties.Hyperlink_NavigateUri:
return KnownElements.Hyperlink;
case KnownProperties.Image_Source:
case KnownProperties.Image_Stretch:
return KnownElements.Image;
case KnownProperties.InkCanvas_Children:
return KnownElements.InkCanvas;
case KnownProperties.InkPresenter_Child:
return KnownElements.InkPresenter;
case KnownProperties.InlineUIContainer_Child:
return KnownElements.InlineUIContainer;
case KnownProperties.InputScopeName_NameValue:
return KnownElements.InputScopeName;
case KnownProperties.Int16AnimationUsingKeyFrames_KeyFrames:
return KnownElements.Int16AnimationUsingKeyFrames;
case KnownProperties.Int32AnimationUsingKeyFrames_KeyFrames:
return KnownElements.Int32AnimationUsingKeyFrames;
case KnownProperties.Int64AnimationUsingKeyFrames_KeyFrames:
return KnownElements.Int64AnimationUsingKeyFrames;
case KnownProperties.Italic_Inlines:
return KnownElements.Italic;
case KnownProperties.ItemsControl_ItemContainerStyle:
case KnownProperties.ItemsControl_ItemContainerStyleSelector:
case KnownProperties.ItemsControl_ItemTemplate:
case KnownProperties.ItemsControl_ItemTemplateSelector:
case KnownProperties.ItemsControl_Items:
case KnownProperties.ItemsControl_ItemsPanel:
case KnownProperties.ItemsControl_ItemsSource:
return KnownElements.ItemsControl;
case KnownProperties.ItemsPanelTemplate_VisualTree:
return KnownElements.ItemsPanelTemplate;
case KnownProperties.Label_Content:
return KnownElements.Label;
case KnownProperties.LinearGradientBrush_GradientStops:
return KnownElements.LinearGradientBrush;
case KnownProperties.List_ListItems:
return KnownElements.List;
case KnownProperties.ListBox_Items:
return KnownElements.ListBox;
case KnownProperties.ListBoxItem_Content:
return KnownElements.ListBoxItem;
case KnownProperties.ListItem_Blocks:
return KnownElements.ListItem;
case KnownProperties.ListView_Items:
return KnownElements.ListView;
case KnownProperties.ListViewItem_Content:
return KnownElements.ListViewItem;
case KnownProperties.MaterialGroup_Children:
return KnownElements.MaterialGroup;
case KnownProperties.MatrixAnimationUsingKeyFrames_KeyFrames:
return KnownElements.MatrixAnimationUsingKeyFrames;
case KnownProperties.Menu_Items:
return KnownElements.Menu;
case KnownProperties.MenuBase_Items:
return KnownElements.MenuBase;
case KnownProperties.MenuItem_Items:
return KnownElements.MenuItem;
case KnownProperties.Model3DGroup_Children:
return KnownElements.Model3DGroup;
case KnownProperties.ModelVisual3D_Children:
return KnownElements.ModelVisual3D;
case KnownProperties.MultiBinding_Bindings:
return KnownElements.MultiBinding;
case KnownProperties.MultiDataTrigger_Setters:
return KnownElements.MultiDataTrigger;
case KnownProperties.MultiTrigger_Setters:
return KnownElements.MultiTrigger;
case KnownProperties.ObjectAnimationUsingKeyFrames_KeyFrames:
return KnownElements.ObjectAnimationUsingKeyFrames;
case KnownProperties.Page_Content:
return KnownElements.Page;
case KnownProperties.PageContent_Child:
return KnownElements.PageContent;
case KnownProperties.PageFunctionBase_Content:
return KnownElements.PageFunctionBase;
case KnownProperties.Panel_Background:
case KnownProperties.Panel_Children:
return KnownElements.Panel;
case KnownProperties.Paragraph_Inlines:
return KnownElements.Paragraph;
case KnownProperties.ParallelTimeline_Children:
return KnownElements.ParallelTimeline;
case KnownProperties.Path_Data:
return KnownElements.Path;
case KnownProperties.PathFigure_Segments:
return KnownElements.PathFigure;
case KnownProperties.PathGeometry_Figures:
return KnownElements.PathGeometry;
case KnownProperties.Point3DAnimationUsingKeyFrames_KeyFrames:
return KnownElements.Point3DAnimationUsingKeyFrames;
case KnownProperties.PointAnimationUsingKeyFrames_KeyFrames:
return KnownElements.PointAnimationUsingKeyFrames;
case KnownProperties.Popup_Child:
case KnownProperties.Popup_IsOpen:
case KnownProperties.Popup_Placement:
case KnownProperties.Popup_PopupAnimation:
return KnownElements.Popup;
case KnownProperties.PriorityBinding_Bindings:
return KnownElements.PriorityBinding;
case KnownProperties.QuaternionAnimationUsingKeyFrames_KeyFrames:
return KnownElements.QuaternionAnimationUsingKeyFrames;
case KnownProperties.RadialGradientBrush_GradientStops:
return KnownElements.RadialGradientBrush;
case KnownProperties.RadioButton_Content:
return KnownElements.RadioButton;
case KnownProperties.RectAnimationUsingKeyFrames_KeyFrames:
return KnownElements.RectAnimationUsingKeyFrames;
case KnownProperties.RepeatButton_Content:
return KnownElements.RepeatButton;
case KnownProperties.RichTextBox_Document:
return KnownElements.RichTextBox;
case KnownProperties.Rotation3DAnimationUsingKeyFrames_KeyFrames:
return KnownElements.Rotation3DAnimationUsingKeyFrames;
case KnownProperties.RowDefinition_Height:
case KnownProperties.RowDefinition_MaxHeight:
case KnownProperties.RowDefinition_MinHeight:
return KnownElements.RowDefinition;
case KnownProperties.Run_Text:
return KnownElements.Run;
case KnownProperties.ScrollViewer_CanContentScroll:
case KnownProperties.ScrollViewer_Content:
case KnownProperties.ScrollViewer_HorizontalScrollBarVisibility:
case KnownProperties.ScrollViewer_VerticalScrollBarVisibility:
return KnownElements.ScrollViewer;
case KnownProperties.Section_Blocks:
return KnownElements.Section;
case KnownProperties.Selector_Items:
return KnownElements.Selector;
case KnownProperties.Shape_Fill:
case KnownProperties.Shape_Stroke:
case KnownProperties.Shape_StrokeThickness:
return KnownElements.Shape;
case KnownProperties.SingleAnimationUsingKeyFrames_KeyFrames:
return KnownElements.SingleAnimationUsingKeyFrames;
case KnownProperties.SizeAnimationUsingKeyFrames_KeyFrames:
return KnownElements.SizeAnimationUsingKeyFrames;
case KnownProperties.Span_Inlines:
return KnownElements.Span;
case KnownProperties.StackPanel_Children:
return KnownElements.StackPanel;
case KnownProperties.StatusBar_Items:
return KnownElements.StatusBar;
case KnownProperties.StatusBarItem_Content:
return KnownElements.StatusBarItem;
case KnownProperties.Storyboard_Children:
return KnownElements.Storyboard;
case KnownProperties.StringAnimationUsingKeyFrames_KeyFrames:
return KnownElements.StringAnimationUsingKeyFrames;
case KnownProperties.Style_Setters:
return KnownElements.Style;
case KnownProperties.TabControl_Items:
return KnownElements.TabControl;
case KnownProperties.TabItem_Content:
return KnownElements.TabItem;
case KnownProperties.TabPanel_Children:
return KnownElements.TabPanel;
case KnownProperties.Table_RowGroups:
return KnownElements.Table;
case KnownProperties.TableCell_Blocks:
return KnownElements.TableCell;
case KnownProperties.TableRow_Cells:
return KnownElements.TableRow;
case KnownProperties.TableRowGroup_Rows:
return KnownElements.TableRowGroup;
case KnownProperties.TextBlock_Background:
case KnownProperties.TextBlock_FontFamily:
case KnownProperties.TextBlock_FontSize:
case KnownProperties.TextBlock_FontStretch:
case KnownProperties.TextBlock_FontStyle:
case KnownProperties.TextBlock_FontWeight:
case KnownProperties.TextBlock_Foreground:
case KnownProperties.TextBlock_Inlines:
case KnownProperties.TextBlock_Text:
case KnownProperties.TextBlock_TextDecorations:
case KnownProperties.TextBlock_TextTrimming:
case KnownProperties.TextBlock_TextWrapping:
return KnownElements.TextBlock;
case KnownProperties.TextBox_Text:
return KnownElements.TextBox;
case KnownProperties.TextElement_Background:
case KnownProperties.TextElement_FontFamily:
case KnownProperties.TextElement_FontSize:
case KnownProperties.TextElement_FontStretch:
case KnownProperties.TextElement_FontStyle:
case KnownProperties.TextElement_FontWeight:
case KnownProperties.TextElement_Foreground:
return KnownElements.TextElement;
case KnownProperties.ThicknessAnimationUsingKeyFrames_KeyFrames:
return KnownElements.ThicknessAnimationUsingKeyFrames;
case KnownProperties.TimelineGroup_Children:
return KnownElements.TimelineGroup;
case KnownProperties.ToggleButton_Content:
return KnownElements.ToggleButton;
case KnownProperties.ToolBar_Items:
return KnownElements.ToolBar;
case KnownProperties.ToolBarOverflowPanel_Children:
return KnownElements.ToolBarOverflowPanel;
case KnownProperties.ToolBarPanel_Children:
return KnownElements.ToolBarPanel;
case KnownProperties.ToolBarTray_ToolBars:
return KnownElements.ToolBarTray;
case KnownProperties.ToolTip_Content:
return KnownElements.ToolTip;
case KnownProperties.Track_IsDirectionReversed:
case KnownProperties.Track_Maximum:
case KnownProperties.Track_Minimum:
case KnownProperties.Track_Orientation:
case KnownProperties.Track_Value:
case KnownProperties.Track_ViewportSize:
return KnownElements.Track;
case KnownProperties.Transform3DGroup_Children:
return KnownElements.Transform3DGroup;
case KnownProperties.TransformGroup_Children:
return KnownElements.TransformGroup;
case KnownProperties.TreeView_Items:
return KnownElements.TreeView;
case KnownProperties.TreeViewItem_Items:
return KnownElements.TreeViewItem;
case KnownProperties.Trigger_Setters:
return KnownElements.Trigger;
case KnownProperties.UIElement_ClipToBounds:
case KnownProperties.UIElement_Focusable:
case KnownProperties.UIElement_IsEnabled:
case KnownProperties.UIElement_RenderTransform:
case KnownProperties.UIElement_Visibility:
return KnownElements.UIElement;
case KnownProperties.Underline_Inlines:
return KnownElements.Underline;
case KnownProperties.UniformGrid_Children:
return KnownElements.UniformGrid;
case KnownProperties.UserControl_Content:
return KnownElements.UserControl;
case KnownProperties.Vector3DAnimationUsingKeyFrames_KeyFrames:
return KnownElements.Vector3DAnimationUsingKeyFrames;
case KnownProperties.VectorAnimationUsingKeyFrames_KeyFrames:
return KnownElements.VectorAnimationUsingKeyFrames;
case KnownProperties.Viewbox_Child:
return KnownElements.Viewbox;
case KnownProperties.Viewport3D_Children:
return KnownElements.Viewport3D;
case KnownProperties.Viewport3DVisual_Children:
return KnownElements.Viewport3DVisual;
case KnownProperties.VirtualizingPanel_Children:
return KnownElements.VirtualizingPanel;
case KnownProperties.VirtualizingStackPanel_Children:
return KnownElements.VirtualizingStackPanel;
case KnownProperties.Window_Content:
return KnownElements.Window;
case KnownProperties.WrapPanel_Children:
return KnownElements.WrapPanel;
case KnownProperties.XmlDataProvider_XmlSerializer:
return KnownElements.XmlDataProvider;
}
return KnownElements.UnknownElement;
}
// This code 'knows' that all non-DP (clr) KnownProperties are
// also Content Properties. As long as that is true there is no
// need for a second string table, and we can just cross reference.
internal static string GetKnownClrPropertyNameFromId(KnownProperties knownProperty)
{
KnownElements knownElement = GetKnownElementFromKnownCommonProperty(knownProperty);
string name = GetContentPropertyName(knownElement);
return name;
}
// Returns IList interface of the Content Property for the given Element.
// WARNING can return null if no CPA is defined on the Element, or the CPA does implement IList.
internal static IList GetCollectionForCPA(object o, KnownElements knownElement)
{
// We don't cache because we return the IList of the given object.
switch(knownElement)
{
// Panel.Children
case KnownElements.Canvas:
case KnownElements.DockPanel:
case KnownElements.Grid:
case KnownElements.Panel:
case KnownElements.StackPanel:
case KnownElements.TabPanel:
case KnownElements.ToolBarOverflowPanel:
case KnownElements.ToolBarPanel:
case KnownElements.UniformGrid:
case KnownElements.VirtualizingPanel:
case KnownElements.VirtualizingStackPanel:
case KnownElements.WrapPanel:
return (o as System.Windows.Controls.Panel).Children;
// ItemsControl.Items
case KnownElements.ComboBox:
case KnownElements.ContextMenu:
case KnownElements.HeaderedItemsControl:
case KnownElements.ItemsControl:
case KnownElements.ListBox:
case KnownElements.ListView:
case KnownElements.Menu:
case KnownElements.MenuBase:
case KnownElements.MenuItem:
case KnownElements.Selector:
case KnownElements.StatusBar:
case KnownElements.TabControl:
case KnownElements.ToolBar:
case KnownElements.TreeView:
case KnownElements.TreeViewItem:
return (o as System.Windows.Controls.ItemsControl).Items;
// Span.Inlines
case KnownElements.Bold:
case KnownElements.Hyperlink:
case KnownElements.Italic:
case KnownElements.Span:
case KnownElements.Underline:
return (o as System.Windows.Documents.Span).Inlines;
// AnchoredBlock.Blocks
case KnownElements.AnchoredBlock:
case KnownElements.Figure:
case KnownElements.Floater:
return (o as System.Windows.Documents.AnchoredBlock).Blocks;
// GradientBrush.GradientStops
case KnownElements.GradientBrush:
case KnownElements.LinearGradientBrush:
case KnownElements.RadialGradientBrush:
return (o as System.Windows.Media.GradientBrush).GradientStops;
// TimelineGroup.Children
case KnownElements.ParallelTimeline:
case KnownElements.Storyboard:
case KnownElements.TimelineGroup:
return (o as System.Windows.Media.Animation.TimelineGroup).Children;
// Other
case KnownElements.BitmapEffectGroup: return (o as System.Windows.Media.Effects.BitmapEffectGroup).Children;
case KnownElements.BooleanAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames).KeyFrames;
case KnownElements.ByteAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.ByteAnimationUsingKeyFrames).KeyFrames;
case KnownElements.CharAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.CharAnimationUsingKeyFrames).KeyFrames;
case KnownElements.ColorAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.ColorAnimationUsingKeyFrames).KeyFrames;
case KnownElements.DataTrigger: return (o as System.Windows.DataTrigger).Setters;
case KnownElements.DecimalAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames).KeyFrames;
case KnownElements.DoubleAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames).KeyFrames;
case KnownElements.DrawingGroup: return (o as System.Windows.Media.DrawingGroup).Children;
case KnownElements.EventTrigger: return (o as System.Windows.EventTrigger).Actions;
case KnownElements.FixedPage: return (o as System.Windows.Documents.FixedPage).Children;
case KnownElements.FlowDocument: return (o as System.Windows.Documents.FlowDocument).Blocks;
case KnownElements.GeneralTransformGroup: return (o as System.Windows.Media.GeneralTransformGroup).Children;
case KnownElements.GeometryGroup: return (o as System.Windows.Media.GeometryGroup).Children;
case KnownElements.GridView: return (o as System.Windows.Controls.GridView).Columns;
case KnownElements.InkCanvas: return (o as System.Windows.Controls.InkCanvas).Children;
case KnownElements.Int16AnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Int16AnimationUsingKeyFrames).KeyFrames;
case KnownElements.Int32AnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Int32AnimationUsingKeyFrames).KeyFrames;
case KnownElements.Int64AnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Int64AnimationUsingKeyFrames).KeyFrames;
case KnownElements.List: return (o as System.Windows.Documents.List).ListItems;
case KnownElements.ListItem: return (o as System.Windows.Documents.ListItem).Blocks;
case KnownElements.MaterialGroup: return (o as System.Windows.Media.Media3D.MaterialGroup).Children;
case KnownElements.MatrixAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Model3DGroup: return (o as System.Windows.Media.Media3D.Model3DGroup).Children;
case KnownElements.ModelVisual3D: return (o as System.Windows.Media.Media3D.ModelVisual3D).Children;
case KnownElements.MultiBinding: return (o as System.Windows.Data.MultiBinding).Bindings;
case KnownElements.MultiDataTrigger: return (o as System.Windows.MultiDataTrigger).Setters;
case KnownElements.MultiTrigger: return (o as System.Windows.MultiTrigger).Setters;
case KnownElements.ObjectAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Paragraph: return (o as System.Windows.Documents.Paragraph).Inlines;
case KnownElements.PathFigure: return (o as System.Windows.Media.PathFigure).Segments;
case KnownElements.PathGeometry: return (o as System.Windows.Media.PathGeometry).Figures;
case KnownElements.Point3DAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames).KeyFrames;
case KnownElements.PointAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.PointAnimationUsingKeyFrames).KeyFrames;
case KnownElements.PriorityBinding: return (o as System.Windows.Data.PriorityBinding).Bindings;
case KnownElements.QuaternionAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames).KeyFrames;
case KnownElements.RectAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.RectAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Rotation3DAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Section: return (o as System.Windows.Documents.Section).Blocks;
case KnownElements.SingleAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.SingleAnimationUsingKeyFrames).KeyFrames;
case KnownElements.SizeAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.SizeAnimationUsingKeyFrames).KeyFrames;
case KnownElements.StringAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.StringAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Style: return (o as System.Windows.Style).Setters;
case KnownElements.Table: return (o as System.Windows.Documents.Table).RowGroups;
case KnownElements.TableCell: return (o as System.Windows.Documents.TableCell).Blocks;
case KnownElements.TableRow: return (o as System.Windows.Documents.TableRow).Cells;
case KnownElements.TableRowGroup: return (o as System.Windows.Documents.TableRowGroup).Rows;
case KnownElements.TextBlock: return (o as System.Windows.Controls.TextBlock).Inlines;
case KnownElements.ThicknessAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames).KeyFrames;
case KnownElements.ToolBarTray: return (o as System.Windows.Controls.ToolBarTray).ToolBars;
case KnownElements.Transform3DGroup: return (o as System.Windows.Media.Media3D.Transform3DGroup).Children;
case KnownElements.TransformGroup: return (o as System.Windows.Media.TransformGroup).Children;
case KnownElements.Trigger: return (o as System.Windows.Trigger).Setters;
case KnownElements.Vector3DAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames).KeyFrames;
case KnownElements.VectorAnimationUsingKeyFrames: return (o as System.Windows.Media.Animation.VectorAnimationUsingKeyFrames).KeyFrames;
case KnownElements.Viewport3D: return (o as System.Windows.Controls.Viewport3D).Children;
case KnownElements.Viewport3DVisual: return (o as System.Windows.Media.Media3D.Viewport3DVisual).Children;
}
return null;
}
#endif // #if !PBTCOMPILER
// Indicate if a collection type can accept strings. E.g. DoubleCollection cannot
// accept strings, because it is an ICollection<Double>. But UIElementCollection does
// accept strings, because it is just IList.
internal static bool CanCollectionTypeAcceptStrings(KnownElements knownElement)
{
switch(knownElement)
{
case KnownElements.BitmapEffectCollection:
case KnownElements.DoubleCollection:
case KnownElements.DrawingCollection:
case KnownElements.GeneralTransformCollection:
case KnownElements.GeometryCollection:
case KnownElements.GradientStopCollection:
case KnownElements.Int32Collection:
case KnownElements.MaterialCollection:
case KnownElements.Model3DCollection:
case KnownElements.PathFigureCollection:
case KnownElements.PathSegmentCollection:
case KnownElements.Point3DCollection:
case KnownElements.PointCollection:
case KnownElements.StrokeCollection:
case KnownElements.TextDecorationCollection:
case KnownElements.TextEffectCollection:
case KnownElements.TimelineCollection:
case KnownElements.Transform3DCollection:
case KnownElements.TransformCollection:
case KnownElements.Vector3DCollection:
case KnownElements.VectorCollection:
return false;
}
return true;
}
internal static string GetContentPropertyName(KnownElements knownElement)
{
string name=null;
switch(knownElement)
{
case KnownElements.EventTrigger:
name = "Actions";
break;
case KnownElements.MultiBinding:
case KnownElements.PriorityBinding:
name = "Bindings";
break;
case KnownElements.AnchoredBlock:
case KnownElements.Figure:
case KnownElements.Floater:
case KnownElements.FlowDocument:
case KnownElements.ListItem:
case KnownElements.Section:
case KnownElements.TableCell:
name = "Blocks";
break;
case KnownElements.TableRow:
name = "Cells";
break;
case KnownElements.AdornedElementPlaceholder:
case KnownElements.AdornerDecorator:
case KnownElements.BlockUIContainer:
case KnownElements.Border:
case KnownElements.BulletDecorator:
case KnownElements.Decorator:
case KnownElements.InkPresenter:
case KnownElements.InlineUIContainer:
case KnownElements.PageContent:
case KnownElements.Popup:
case KnownElements.Viewbox:
name = "Child";
break;
case KnownElements.BitmapEffectGroup:
case KnownElements.Canvas:
case KnownElements.DockPanel:
case KnownElements.DrawingGroup:
case KnownElements.FixedPage:
case KnownElements.GeneralTransformGroup:
case KnownElements.GeometryGroup:
case KnownElements.Grid:
case KnownElements.InkCanvas:
case KnownElements.MaterialGroup:
case KnownElements.Model3DGroup:
case KnownElements.ModelVisual3D:
case KnownElements.Panel:
case KnownElements.ParallelTimeline:
case KnownElements.StackPanel:
case KnownElements.Storyboard:
case KnownElements.TabPanel:
case KnownElements.TimelineGroup:
case KnownElements.ToolBarOverflowPanel:
case KnownElements.ToolBarPanel:
case KnownElements.Transform3DGroup:
case KnownElements.TransformGroup:
case KnownElements.UniformGrid:
case KnownElements.Viewport3D:
case KnownElements.Viewport3DVisual:
case KnownElements.VirtualizingPanel:
case KnownElements.VirtualizingStackPanel:
case KnownElements.WrapPanel:
name = "Children";
break;
case KnownElements.GridView:
name = "Columns";
break;
case KnownElements.Button:
case KnownElements.ButtonBase:
case KnownElements.CheckBox:
case KnownElements.ComboBoxItem:
case KnownElements.ContentControl:
case KnownElements.Expander:
case KnownElements.GridViewColumnHeader:
case KnownElements.GroupBox:
case KnownElements.GroupItem:
case KnownElements.HeaderedContentControl:
case KnownElements.Label:
case KnownElements.ListBoxItem:
case KnownElements.ListViewItem:
case KnownElements.Page:
case KnownElements.PageFunctionBase:
case KnownElements.RadioButton:
case KnownElements.RepeatButton:
case KnownElements.ScrollViewer:
case KnownElements.StatusBarItem:
case KnownElements.TabItem:
case KnownElements.ToggleButton:
case KnownElements.ToolTip:
case KnownElements.UserControl:
case KnownElements.Window:
name = "Content";
break;
case KnownElements.DocumentViewer:
case KnownElements.DocumentViewerBase:
case KnownElements.FlowDocumentPageViewer:
case KnownElements.FlowDocumentReader:
case KnownElements.FlowDocumentScrollViewer:
case KnownElements.RichTextBox:
name = "Document";
break;
case KnownElements.PathGeometry:
name = "Figures";
break;
case KnownElements.GradientBrush:
case KnownElements.LinearGradientBrush:
case KnownElements.RadialGradientBrush:
name = "GradientStops";
break;
case KnownElements.GridViewColumn:
name = "Header";
break;
case KnownElements.Bold:
case KnownElements.Hyperlink:
case KnownElements.Italic:
case KnownElements.Paragraph:
case KnownElements.Span:
case KnownElements.TextBlock:
case KnownElements.Underline:
name = "Inlines";
break;
case KnownElements.ArrayExtension:
case KnownElements.ComboBox:
case KnownElements.ContextMenu:
case KnownElements.HeaderedItemsControl:
case KnownElements.ItemsControl:
case KnownElements.ListBox:
case KnownElements.ListView:
case KnownElements.Menu:
case KnownElements.MenuBase:
case KnownElements.MenuItem:
case KnownElements.Selector:
case KnownElements.StatusBar:
case KnownElements.TabControl:
case KnownElements.ToolBar:
case KnownElements.TreeView:
case KnownElements.TreeViewItem:
name = "Items";
break;
case KnownElements.BooleanAnimationUsingKeyFrames:
case KnownElements.ByteAnimationUsingKeyFrames:
case KnownElements.CharAnimationUsingKeyFrames:
case KnownElements.ColorAnimationUsingKeyFrames:
case KnownElements.DecimalAnimationUsingKeyFrames:
case KnownElements.DoubleAnimationUsingKeyFrames:
case KnownElements.Int16AnimationUsingKeyFrames:
case KnownElements.Int32AnimationUsingKeyFrames:
case KnownElements.Int64AnimationUsingKeyFrames:
case KnownElements.MatrixAnimationUsingKeyFrames:
case KnownElements.ObjectAnimationUsingKeyFrames:
case KnownElements.Point3DAnimationUsingKeyFrames:
case KnownElements.PointAnimationUsingKeyFrames:
case KnownElements.QuaternionAnimationUsingKeyFrames:
case KnownElements.RectAnimationUsingKeyFrames:
case KnownElements.Rotation3DAnimationUsingKeyFrames:
case KnownElements.SingleAnimationUsingKeyFrames:
case KnownElements.SizeAnimationUsingKeyFrames:
case KnownElements.StringAnimationUsingKeyFrames:
case KnownElements.ThicknessAnimationUsingKeyFrames:
case KnownElements.Vector3DAnimationUsingKeyFrames:
case KnownElements.VectorAnimationUsingKeyFrames:
name = "KeyFrames";
break;
case KnownElements.List:
name = "ListItems";
break;
case KnownElements.InputScopeName:
name = "NameValue";
break;
case KnownElements.FixedDocument:
name = "Pages";
break;
case KnownElements.FixedDocumentSequence:
name = "References";
break;
case KnownElements.Table:
name = "RowGroups";
break;
case KnownElements.TableRowGroup:
name = "Rows";
break;
case KnownElements.PathFigure:
name = "Segments";
break;
case KnownElements.DataTrigger:
case KnownElements.MultiDataTrigger:
case KnownElements.MultiTrigger:
case KnownElements.Style:
case KnownElements.Trigger:
name = "Setters";
break;
case KnownElements.BeginStoryboard:
name = "Storyboard";
break;
case KnownElements.AccessText:
case KnownElements.Run:
case KnownElements.TextBox:
name = "Text";
break;
case KnownElements.ToolBarTray:
name = "ToolBars";
break;
case KnownElements.ControlTemplate:
case KnownElements.DataTemplate:
case KnownElements.FrameworkTemplate:
case KnownElements.HierarchicalDataTemplate:
case KnownElements.ItemsPanelTemplate:
name = "VisualTree";
break;
case KnownElements.XmlDataProvider:
name = "XmlSerializer";
break;
}
return name;
}
internal static short GetKnownPropertyAttributeId(KnownElements typeID, string fieldName)
{
switch (typeID)
{
case KnownElements.AccessText:
if (String.CompareOrdinal(fieldName, "Text") == 0)
return (short)KnownProperties.AccessText_Text;
break;
case KnownElements.AdornedElementPlaceholder:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.AdornedElementPlaceholder_Child;
break;
case KnownElements.AdornerDecorator:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.AdornerDecorator_Child;
break;
case KnownElements.AnchoredBlock:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.AnchoredBlock_Blocks;
break;
case KnownElements.ArrayExtension:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ArrayExtension_Items;
break;
case KnownElements.BeginStoryboard:
if (String.CompareOrdinal(fieldName, "Storyboard") == 0)
return (short)KnownProperties.BeginStoryboard_Storyboard;
break;
case KnownElements.BitmapEffectGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.BitmapEffectGroup_Children;
break;
case KnownElements.BlockUIContainer:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.BlockUIContainer_Child;
break;
case KnownElements.Bold:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Bold_Inlines;
break;
case KnownElements.BooleanAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.BooleanAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Border:
if (String.CompareOrdinal(fieldName, "Background") == 0)
return (short)KnownProperties.Border_Background;
if (String.CompareOrdinal(fieldName, "BorderBrush") == 0)
return (short)KnownProperties.Border_BorderBrush;
if (String.CompareOrdinal(fieldName, "BorderThickness") == 0)
return (short)KnownProperties.Border_BorderThickness;
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.Border_Child;
break;
case KnownElements.BulletDecorator:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.BulletDecorator_Child;
break;
case KnownElements.Button:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.Button_Content;
break;
case KnownElements.ButtonBase:
if (String.CompareOrdinal(fieldName, "Command") == 0)
return (short)KnownProperties.ButtonBase_Command;
if (String.CompareOrdinal(fieldName, "CommandParameter") == 0)
return (short)KnownProperties.ButtonBase_CommandParameter;
if (String.CompareOrdinal(fieldName, "CommandTarget") == 0)
return (short)KnownProperties.ButtonBase_CommandTarget;
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ButtonBase_Content;
if (String.CompareOrdinal(fieldName, "IsPressed") == 0)
return (short)KnownProperties.ButtonBase_IsPressed;
break;
case KnownElements.ByteAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.ByteAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Canvas:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Canvas_Children;
break;
case KnownElements.CharAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.CharAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.CheckBox:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.CheckBox_Content;
break;
case KnownElements.ColorAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.ColorAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.ColumnDefinition:
if (String.CompareOrdinal(fieldName, "MaxWidth") == 0)
return (short)KnownProperties.ColumnDefinition_MaxWidth;
if (String.CompareOrdinal(fieldName, "MinWidth") == 0)
return (short)KnownProperties.ColumnDefinition_MinWidth;
if (String.CompareOrdinal(fieldName, "Width") == 0)
return (short)KnownProperties.ColumnDefinition_Width;
break;
case KnownElements.ComboBox:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ComboBox_Items;
break;
case KnownElements.ComboBoxItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ComboBoxItem_Content;
break;
case KnownElements.ContentControl:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ContentControl_Content;
if (String.CompareOrdinal(fieldName, "ContentTemplate") == 0)
return (short)KnownProperties.ContentControl_ContentTemplate;
if (String.CompareOrdinal(fieldName, "ContentTemplateSelector") == 0)
return (short)KnownProperties.ContentControl_ContentTemplateSelector;
if (String.CompareOrdinal(fieldName, "HasContent") == 0)
return (short)KnownProperties.ContentControl_HasContent;
break;
case KnownElements.ContentElement:
if (String.CompareOrdinal(fieldName, "Focusable") == 0)
return (short)KnownProperties.ContentElement_Focusable;
break;
case KnownElements.ContentPresenter:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ContentPresenter_Content;
if (String.CompareOrdinal(fieldName, "ContentSource") == 0)
return (short)KnownProperties.ContentPresenter_ContentSource;
if (String.CompareOrdinal(fieldName, "ContentTemplate") == 0)
return (short)KnownProperties.ContentPresenter_ContentTemplate;
if (String.CompareOrdinal(fieldName, "ContentTemplateSelector") == 0)
return (short)KnownProperties.ContentPresenter_ContentTemplateSelector;
if (String.CompareOrdinal(fieldName, "RecognizesAccessKey") == 0)
return (short)KnownProperties.ContentPresenter_RecognizesAccessKey;
break;
case KnownElements.ContextMenu:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ContextMenu_Items;
break;
case KnownElements.Control:
if (String.CompareOrdinal(fieldName, "Background") == 0)
return (short)KnownProperties.Control_Background;
if (String.CompareOrdinal(fieldName, "BorderBrush") == 0)
return (short)KnownProperties.Control_BorderBrush;
if (String.CompareOrdinal(fieldName, "BorderThickness") == 0)
return (short)KnownProperties.Control_BorderThickness;
if (String.CompareOrdinal(fieldName, "FontFamily") == 0)
return (short)KnownProperties.Control_FontFamily;
if (String.CompareOrdinal(fieldName, "FontSize") == 0)
return (short)KnownProperties.Control_FontSize;
if (String.CompareOrdinal(fieldName, "FontStretch") == 0)
return (short)KnownProperties.Control_FontStretch;
if (String.CompareOrdinal(fieldName, "FontStyle") == 0)
return (short)KnownProperties.Control_FontStyle;
if (String.CompareOrdinal(fieldName, "FontWeight") == 0)
return (short)KnownProperties.Control_FontWeight;
if (String.CompareOrdinal(fieldName, "Foreground") == 0)
return (short)KnownProperties.Control_Foreground;
if (String.CompareOrdinal(fieldName, "HorizontalContentAlignment") == 0)
return (short)KnownProperties.Control_HorizontalContentAlignment;
if (String.CompareOrdinal(fieldName, "IsTabStop") == 0)
return (short)KnownProperties.Control_IsTabStop;
if (String.CompareOrdinal(fieldName, "Padding") == 0)
return (short)KnownProperties.Control_Padding;
if (String.CompareOrdinal(fieldName, "TabIndex") == 0)
return (short)KnownProperties.Control_TabIndex;
if (String.CompareOrdinal(fieldName, "Template") == 0)
return (short)KnownProperties.Control_Template;
if (String.CompareOrdinal(fieldName, "VerticalContentAlignment") == 0)
return (short)KnownProperties.Control_VerticalContentAlignment;
break;
case KnownElements.ControlTemplate:
if (String.CompareOrdinal(fieldName, "VisualTree") == 0)
return (short)KnownProperties.ControlTemplate_VisualTree;
break;
case KnownElements.DataTemplate:
if (String.CompareOrdinal(fieldName, "VisualTree") == 0)
return (short)KnownProperties.DataTemplate_VisualTree;
break;
case KnownElements.DataTrigger:
if (String.CompareOrdinal(fieldName, "Setters") == 0)
return (short)KnownProperties.DataTrigger_Setters;
break;
case KnownElements.DecimalAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.DecimalAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Decorator:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.Decorator_Child;
break;
case KnownElements.DockPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.DockPanel_Children;
if (String.CompareOrdinal(fieldName, "Dock") == 0)
return (short)KnownProperties.DockPanel_Dock;
if (String.CompareOrdinal(fieldName, "LastChildFill") == 0)
return (short)KnownProperties.DockPanel_LastChildFill;
break;
case KnownElements.DocumentViewer:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.DocumentViewer_Document;
break;
case KnownElements.DocumentViewerBase:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.DocumentViewerBase_Document;
break;
case KnownElements.DoubleAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.DoubleAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.DrawingGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.DrawingGroup_Children;
break;
case KnownElements.EventTrigger:
if (String.CompareOrdinal(fieldName, "Actions") == 0)
return (short)KnownProperties.EventTrigger_Actions;
break;
case KnownElements.Expander:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.Expander_Content;
break;
case KnownElements.Figure:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.Figure_Blocks;
break;
case KnownElements.FixedDocument:
if (String.CompareOrdinal(fieldName, "Pages") == 0)
return (short)KnownProperties.FixedDocument_Pages;
break;
case KnownElements.FixedDocumentSequence:
if (String.CompareOrdinal(fieldName, "References") == 0)
return (short)KnownProperties.FixedDocumentSequence_References;
break;
case KnownElements.FixedPage:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.FixedPage_Children;
break;
case KnownElements.Floater:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.Floater_Blocks;
break;
case KnownElements.FlowDocument:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.FlowDocument_Blocks;
break;
case KnownElements.FlowDocumentPageViewer:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.FlowDocumentPageViewer_Document;
break;
case KnownElements.FlowDocumentReader:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.FlowDocumentReader_Document;
break;
case KnownElements.FlowDocumentScrollViewer:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.FlowDocumentScrollViewer_Document;
break;
case KnownElements.FrameworkContentElement:
if (String.CompareOrdinal(fieldName, "Style") == 0)
return (short)KnownProperties.FrameworkContentElement_Style;
break;
case KnownElements.FrameworkElement:
if (String.CompareOrdinal(fieldName, "FlowDirection") == 0)
return (short)KnownProperties.FrameworkElement_FlowDirection;
if (String.CompareOrdinal(fieldName, "Height") == 0)
return (short)KnownProperties.FrameworkElement_Height;
if (String.CompareOrdinal(fieldName, "HorizontalAlignment") == 0)
return (short)KnownProperties.FrameworkElement_HorizontalAlignment;
if (String.CompareOrdinal(fieldName, "Margin") == 0)
return (short)KnownProperties.FrameworkElement_Margin;
if (String.CompareOrdinal(fieldName, "MaxHeight") == 0)
return (short)KnownProperties.FrameworkElement_MaxHeight;
if (String.CompareOrdinal(fieldName, "MaxWidth") == 0)
return (short)KnownProperties.FrameworkElement_MaxWidth;
if (String.CompareOrdinal(fieldName, "MinHeight") == 0)
return (short)KnownProperties.FrameworkElement_MinHeight;
if (String.CompareOrdinal(fieldName, "MinWidth") == 0)
return (short)KnownProperties.FrameworkElement_MinWidth;
if (String.CompareOrdinal(fieldName, "Name") == 0)
return (short)KnownProperties.FrameworkElement_Name;
if (String.CompareOrdinal(fieldName, "Style") == 0)
return (short)KnownProperties.FrameworkElement_Style;
if (String.CompareOrdinal(fieldName, "VerticalAlignment") == 0)
return (short)KnownProperties.FrameworkElement_VerticalAlignment;
if (String.CompareOrdinal(fieldName, "Width") == 0)
return (short)KnownProperties.FrameworkElement_Width;
break;
case KnownElements.FrameworkTemplate:
if (String.CompareOrdinal(fieldName, "VisualTree") == 0)
return (short)KnownProperties.FrameworkTemplate_VisualTree;
break;
case KnownElements.GeneralTransformGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.GeneralTransformGroup_Children;
break;
case KnownElements.GeometryGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.GeometryGroup_Children;
break;
case KnownElements.GradientBrush:
if (String.CompareOrdinal(fieldName, "GradientStops") == 0)
return (short)KnownProperties.GradientBrush_GradientStops;
break;
case KnownElements.Grid:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Grid_Children;
if (String.CompareOrdinal(fieldName, "Column") == 0)
return (short)KnownProperties.Grid_Column;
if (String.CompareOrdinal(fieldName, "ColumnSpan") == 0)
return (short)KnownProperties.Grid_ColumnSpan;
if (String.CompareOrdinal(fieldName, "Row") == 0)
return (short)KnownProperties.Grid_Row;
if (String.CompareOrdinal(fieldName, "RowSpan") == 0)
return (short)KnownProperties.Grid_RowSpan;
break;
case KnownElements.GridView:
if (String.CompareOrdinal(fieldName, "Columns") == 0)
return (short)KnownProperties.GridView_Columns;
break;
case KnownElements.GridViewColumn:
if (String.CompareOrdinal(fieldName, "Header") == 0)
return (short)KnownProperties.GridViewColumn_Header;
break;
case KnownElements.GridViewColumnHeader:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.GridViewColumnHeader_Content;
break;
case KnownElements.GroupBox:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.GroupBox_Content;
break;
case KnownElements.GroupItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.GroupItem_Content;
break;
case KnownElements.HeaderedContentControl:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.HeaderedContentControl_Content;
if (String.CompareOrdinal(fieldName, "HasHeader") == 0)
return (short)KnownProperties.HeaderedContentControl_HasHeader;
if (String.CompareOrdinal(fieldName, "Header") == 0)
return (short)KnownProperties.HeaderedContentControl_Header;
if (String.CompareOrdinal(fieldName, "HeaderTemplate") == 0)
return (short)KnownProperties.HeaderedContentControl_HeaderTemplate;
if (String.CompareOrdinal(fieldName, "HeaderTemplateSelector") == 0)
return (short)KnownProperties.HeaderedContentControl_HeaderTemplateSelector;
break;
case KnownElements.HeaderedItemsControl:
if (String.CompareOrdinal(fieldName, "HasHeader") == 0)
return (short)KnownProperties.HeaderedItemsControl_HasHeader;
if (String.CompareOrdinal(fieldName, "Header") == 0)
return (short)KnownProperties.HeaderedItemsControl_Header;
if (String.CompareOrdinal(fieldName, "HeaderTemplate") == 0)
return (short)KnownProperties.HeaderedItemsControl_HeaderTemplate;
if (String.CompareOrdinal(fieldName, "HeaderTemplateSelector") == 0)
return (short)KnownProperties.HeaderedItemsControl_HeaderTemplateSelector;
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.HeaderedItemsControl_Items;
break;
case KnownElements.HierarchicalDataTemplate:
if (String.CompareOrdinal(fieldName, "VisualTree") == 0)
return (short)KnownProperties.HierarchicalDataTemplate_VisualTree;
break;
case KnownElements.Hyperlink:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Hyperlink_Inlines;
if (String.CompareOrdinal(fieldName, "NavigateUri") == 0)
return (short)KnownProperties.Hyperlink_NavigateUri;
break;
case KnownElements.Image:
if (String.CompareOrdinal(fieldName, "Source") == 0)
return (short)KnownProperties.Image_Source;
if (String.CompareOrdinal(fieldName, "Stretch") == 0)
return (short)KnownProperties.Image_Stretch;
break;
case KnownElements.InkCanvas:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.InkCanvas_Children;
break;
case KnownElements.InkPresenter:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.InkPresenter_Child;
break;
case KnownElements.InlineUIContainer:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.InlineUIContainer_Child;
break;
case KnownElements.InputScopeName:
if (String.CompareOrdinal(fieldName, "NameValue") == 0)
return (short)KnownProperties.InputScopeName_NameValue;
break;
case KnownElements.Int16AnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Int16AnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Int32AnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Int32AnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Int64AnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Int64AnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Italic:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Italic_Inlines;
break;
case KnownElements.ItemsControl:
if (String.CompareOrdinal(fieldName, "ItemContainerStyle") == 0)
return (short)KnownProperties.ItemsControl_ItemContainerStyle;
if (String.CompareOrdinal(fieldName, "ItemContainerStyleSelector") == 0)
return (short)KnownProperties.ItemsControl_ItemContainerStyleSelector;
if (String.CompareOrdinal(fieldName, "ItemTemplate") == 0)
return (short)KnownProperties.ItemsControl_ItemTemplate;
if (String.CompareOrdinal(fieldName, "ItemTemplateSelector") == 0)
return (short)KnownProperties.ItemsControl_ItemTemplateSelector;
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ItemsControl_Items;
if (String.CompareOrdinal(fieldName, "ItemsPanel") == 0)
return (short)KnownProperties.ItemsControl_ItemsPanel;
if (String.CompareOrdinal(fieldName, "ItemsSource") == 0)
return (short)KnownProperties.ItemsControl_ItemsSource;
break;
case KnownElements.ItemsPanelTemplate:
if (String.CompareOrdinal(fieldName, "VisualTree") == 0)
return (short)KnownProperties.ItemsPanelTemplate_VisualTree;
break;
case KnownElements.Label:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.Label_Content;
break;
case KnownElements.LinearGradientBrush:
if (String.CompareOrdinal(fieldName, "GradientStops") == 0)
return (short)KnownProperties.LinearGradientBrush_GradientStops;
break;
case KnownElements.List:
if (String.CompareOrdinal(fieldName, "ListItems") == 0)
return (short)KnownProperties.List_ListItems;
break;
case KnownElements.ListBox:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ListBox_Items;
break;
case KnownElements.ListBoxItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ListBoxItem_Content;
break;
case KnownElements.ListItem:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.ListItem_Blocks;
break;
case KnownElements.ListView:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ListView_Items;
break;
case KnownElements.ListViewItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ListViewItem_Content;
break;
case KnownElements.MaterialGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.MaterialGroup_Children;
break;
case KnownElements.MatrixAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.MatrixAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Menu:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.Menu_Items;
break;
case KnownElements.MenuBase:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.MenuBase_Items;
break;
case KnownElements.MenuItem:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.MenuItem_Items;
break;
case KnownElements.Model3DGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Model3DGroup_Children;
break;
case KnownElements.ModelVisual3D:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.ModelVisual3D_Children;
break;
case KnownElements.MultiBinding:
if (String.CompareOrdinal(fieldName, "Bindings") == 0)
return (short)KnownProperties.MultiBinding_Bindings;
break;
case KnownElements.MultiDataTrigger:
if (String.CompareOrdinal(fieldName, "Setters") == 0)
return (short)KnownProperties.MultiDataTrigger_Setters;
break;
case KnownElements.MultiTrigger:
if (String.CompareOrdinal(fieldName, "Setters") == 0)
return (short)KnownProperties.MultiTrigger_Setters;
break;
case KnownElements.ObjectAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.ObjectAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Page:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.Page_Content;
break;
case KnownElements.PageContent:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.PageContent_Child;
break;
case KnownElements.PageFunctionBase:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.PageFunctionBase_Content;
break;
case KnownElements.Panel:
if (String.CompareOrdinal(fieldName, "Background") == 0)
return (short)KnownProperties.Panel_Background;
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Panel_Children;
break;
case KnownElements.Paragraph:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Paragraph_Inlines;
break;
case KnownElements.ParallelTimeline:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.ParallelTimeline_Children;
break;
case KnownElements.Path:
if (String.CompareOrdinal(fieldName, "Data") == 0)
return (short)KnownProperties.Path_Data;
break;
case KnownElements.PathFigure:
if (String.CompareOrdinal(fieldName, "Segments") == 0)
return (short)KnownProperties.PathFigure_Segments;
break;
case KnownElements.PathGeometry:
if (String.CompareOrdinal(fieldName, "Figures") == 0)
return (short)KnownProperties.PathGeometry_Figures;
break;
case KnownElements.Point3DAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Point3DAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.PointAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.PointAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Popup:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.Popup_Child;
if (String.CompareOrdinal(fieldName, "IsOpen") == 0)
return (short)KnownProperties.Popup_IsOpen;
if (String.CompareOrdinal(fieldName, "Placement") == 0)
return (short)KnownProperties.Popup_Placement;
if (String.CompareOrdinal(fieldName, "PopupAnimation") == 0)
return (short)KnownProperties.Popup_PopupAnimation;
break;
case KnownElements.PriorityBinding:
if (String.CompareOrdinal(fieldName, "Bindings") == 0)
return (short)KnownProperties.PriorityBinding_Bindings;
break;
case KnownElements.QuaternionAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.QuaternionAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.RadialGradientBrush:
if (String.CompareOrdinal(fieldName, "GradientStops") == 0)
return (short)KnownProperties.RadialGradientBrush_GradientStops;
break;
case KnownElements.RadioButton:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.RadioButton_Content;
break;
case KnownElements.RectAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.RectAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.RepeatButton:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.RepeatButton_Content;
break;
case KnownElements.RichTextBox:
if (String.CompareOrdinal(fieldName, "Document") == 0)
return (short)KnownProperties.RichTextBox_Document;
break;
case KnownElements.Rotation3DAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Rotation3DAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.RowDefinition:
if (String.CompareOrdinal(fieldName, "Height") == 0)
return (short)KnownProperties.RowDefinition_Height;
if (String.CompareOrdinal(fieldName, "MaxHeight") == 0)
return (short)KnownProperties.RowDefinition_MaxHeight;
if (String.CompareOrdinal(fieldName, "MinHeight") == 0)
return (short)KnownProperties.RowDefinition_MinHeight;
break;
case KnownElements.Run:
if (String.CompareOrdinal(fieldName, "Text") == 0)
return (short)KnownProperties.Run_Text;
break;
case KnownElements.ScrollViewer:
if (String.CompareOrdinal(fieldName, "CanContentScroll") == 0)
return (short)KnownProperties.ScrollViewer_CanContentScroll;
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ScrollViewer_Content;
if (String.CompareOrdinal(fieldName, "HorizontalScrollBarVisibility") == 0)
return (short)KnownProperties.ScrollViewer_HorizontalScrollBarVisibility;
if (String.CompareOrdinal(fieldName, "VerticalScrollBarVisibility") == 0)
return (short)KnownProperties.ScrollViewer_VerticalScrollBarVisibility;
break;
case KnownElements.Section:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.Section_Blocks;
break;
case KnownElements.Selector:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.Selector_Items;
break;
case KnownElements.Shape:
if (String.CompareOrdinal(fieldName, "Fill") == 0)
return (short)KnownProperties.Shape_Fill;
if (String.CompareOrdinal(fieldName, "Stroke") == 0)
return (short)KnownProperties.Shape_Stroke;
if (String.CompareOrdinal(fieldName, "StrokeThickness") == 0)
return (short)KnownProperties.Shape_StrokeThickness;
break;
case KnownElements.SingleAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.SingleAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.SizeAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.SizeAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Span:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Span_Inlines;
break;
case KnownElements.StackPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.StackPanel_Children;
break;
case KnownElements.StatusBar:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.StatusBar_Items;
break;
case KnownElements.StatusBarItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.StatusBarItem_Content;
break;
case KnownElements.Storyboard:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Storyboard_Children;
break;
case KnownElements.StringAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.StringAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Style:
if (String.CompareOrdinal(fieldName, "Setters") == 0)
return (short)KnownProperties.Style_Setters;
break;
case KnownElements.TabControl:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.TabControl_Items;
break;
case KnownElements.TabItem:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.TabItem_Content;
break;
case KnownElements.TabPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.TabPanel_Children;
break;
case KnownElements.Table:
if (String.CompareOrdinal(fieldName, "RowGroups") == 0)
return (short)KnownProperties.Table_RowGroups;
break;
case KnownElements.TableCell:
if (String.CompareOrdinal(fieldName, "Blocks") == 0)
return (short)KnownProperties.TableCell_Blocks;
break;
case KnownElements.TableRow:
if (String.CompareOrdinal(fieldName, "Cells") == 0)
return (short)KnownProperties.TableRow_Cells;
break;
case KnownElements.TableRowGroup:
if (String.CompareOrdinal(fieldName, "Rows") == 0)
return (short)KnownProperties.TableRowGroup_Rows;
break;
case KnownElements.TextBlock:
if (String.CompareOrdinal(fieldName, "Background") == 0)
return (short)KnownProperties.TextBlock_Background;
if (String.CompareOrdinal(fieldName, "FontFamily") == 0)
return (short)KnownProperties.TextBlock_FontFamily;
if (String.CompareOrdinal(fieldName, "FontSize") == 0)
return (short)KnownProperties.TextBlock_FontSize;
if (String.CompareOrdinal(fieldName, "FontStretch") == 0)
return (short)KnownProperties.TextBlock_FontStretch;
if (String.CompareOrdinal(fieldName, "FontStyle") == 0)
return (short)KnownProperties.TextBlock_FontStyle;
if (String.CompareOrdinal(fieldName, "FontWeight") == 0)
return (short)KnownProperties.TextBlock_FontWeight;
if (String.CompareOrdinal(fieldName, "Foreground") == 0)
return (short)KnownProperties.TextBlock_Foreground;
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.TextBlock_Inlines;
if (String.CompareOrdinal(fieldName, "Text") == 0)
return (short)KnownProperties.TextBlock_Text;
if (String.CompareOrdinal(fieldName, "TextDecorations") == 0)
return (short)KnownProperties.TextBlock_TextDecorations;
if (String.CompareOrdinal(fieldName, "TextTrimming") == 0)
return (short)KnownProperties.TextBlock_TextTrimming;
if (String.CompareOrdinal(fieldName, "TextWrapping") == 0)
return (short)KnownProperties.TextBlock_TextWrapping;
break;
case KnownElements.TextBox:
if (String.CompareOrdinal(fieldName, "Text") == 0)
return (short)KnownProperties.TextBox_Text;
break;
case KnownElements.TextElement:
if (String.CompareOrdinal(fieldName, "Background") == 0)
return (short)KnownProperties.TextElement_Background;
if (String.CompareOrdinal(fieldName, "FontFamily") == 0)
return (short)KnownProperties.TextElement_FontFamily;
if (String.CompareOrdinal(fieldName, "FontSize") == 0)
return (short)KnownProperties.TextElement_FontSize;
if (String.CompareOrdinal(fieldName, "FontStretch") == 0)
return (short)KnownProperties.TextElement_FontStretch;
if (String.CompareOrdinal(fieldName, "FontStyle") == 0)
return (short)KnownProperties.TextElement_FontStyle;
if (String.CompareOrdinal(fieldName, "FontWeight") == 0)
return (short)KnownProperties.TextElement_FontWeight;
if (String.CompareOrdinal(fieldName, "Foreground") == 0)
return (short)KnownProperties.TextElement_Foreground;
break;
case KnownElements.ThicknessAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.ThicknessAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.TimelineGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.TimelineGroup_Children;
break;
case KnownElements.ToggleButton:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ToggleButton_Content;
break;
case KnownElements.ToolBar:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.ToolBar_Items;
break;
case KnownElements.ToolBarOverflowPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.ToolBarOverflowPanel_Children;
break;
case KnownElements.ToolBarPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.ToolBarPanel_Children;
break;
case KnownElements.ToolBarTray:
if (String.CompareOrdinal(fieldName, "ToolBars") == 0)
return (short)KnownProperties.ToolBarTray_ToolBars;
break;
case KnownElements.ToolTip:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.ToolTip_Content;
break;
case KnownElements.Track:
if (String.CompareOrdinal(fieldName, "IsDirectionReversed") == 0)
return (short)KnownProperties.Track_IsDirectionReversed;
if (String.CompareOrdinal(fieldName, "Maximum") == 0)
return (short)KnownProperties.Track_Maximum;
if (String.CompareOrdinal(fieldName, "Minimum") == 0)
return (short)KnownProperties.Track_Minimum;
if (String.CompareOrdinal(fieldName, "Orientation") == 0)
return (short)KnownProperties.Track_Orientation;
if (String.CompareOrdinal(fieldName, "Value") == 0)
return (short)KnownProperties.Track_Value;
if (String.CompareOrdinal(fieldName, "ViewportSize") == 0)
return (short)KnownProperties.Track_ViewportSize;
break;
case KnownElements.Transform3DGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Transform3DGroup_Children;
break;
case KnownElements.TransformGroup:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.TransformGroup_Children;
break;
case KnownElements.TreeView:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.TreeView_Items;
break;
case KnownElements.TreeViewItem:
if (String.CompareOrdinal(fieldName, "Items") == 0)
return (short)KnownProperties.TreeViewItem_Items;
break;
case KnownElements.Trigger:
if (String.CompareOrdinal(fieldName, "Setters") == 0)
return (short)KnownProperties.Trigger_Setters;
break;
case KnownElements.UIElement:
if (String.CompareOrdinal(fieldName, "ClipToBounds") == 0)
return (short)KnownProperties.UIElement_ClipToBounds;
if (String.CompareOrdinal(fieldName, "Focusable") == 0)
return (short)KnownProperties.UIElement_Focusable;
if (String.CompareOrdinal(fieldName, "IsEnabled") == 0)
return (short)KnownProperties.UIElement_IsEnabled;
if (String.CompareOrdinal(fieldName, "RenderTransform") == 0)
return (short)KnownProperties.UIElement_RenderTransform;
if (String.CompareOrdinal(fieldName, "Visibility") == 0)
return (short)KnownProperties.UIElement_Visibility;
break;
case KnownElements.Underline:
if (String.CompareOrdinal(fieldName, "Inlines") == 0)
return (short)KnownProperties.Underline_Inlines;
break;
case KnownElements.UniformGrid:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.UniformGrid_Children;
break;
case KnownElements.UserControl:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.UserControl_Content;
break;
case KnownElements.Vector3DAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.Vector3DAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.VectorAnimationUsingKeyFrames:
if (String.CompareOrdinal(fieldName, "KeyFrames") == 0)
return (short)KnownProperties.VectorAnimationUsingKeyFrames_KeyFrames;
break;
case KnownElements.Viewbox:
if (String.CompareOrdinal(fieldName, "Child") == 0)
return (short)KnownProperties.Viewbox_Child;
break;
case KnownElements.Viewport3D:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Viewport3D_Children;
break;
case KnownElements.Viewport3DVisual:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.Viewport3DVisual_Children;
break;
case KnownElements.VirtualizingPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.VirtualizingPanel_Children;
break;
case KnownElements.VirtualizingStackPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.VirtualizingStackPanel_Children;
break;
case KnownElements.Window:
if (String.CompareOrdinal(fieldName, "Content") == 0)
return (short)KnownProperties.Window_Content;
break;
case KnownElements.WrapPanel:
if (String.CompareOrdinal(fieldName, "Children") == 0)
return (short)KnownProperties.WrapPanel_Children;
break;
case KnownElements.XmlDataProvider:
if (String.CompareOrdinal(fieldName, "XmlSerializer") == 0)
return (short)KnownProperties.XmlDataProvider_XmlSerializer;
break;
}
return 0;
}
private static bool IsStandardLengthProp(string propName)
{
return (String.CompareOrdinal(propName, "Width") == 0 ||
String.CompareOrdinal(propName, "MinWidth") == 0 ||
String.CompareOrdinal(propName, "MaxWidth") == 0 ||
String.CompareOrdinal(propName, "Height") == 0 ||
String.CompareOrdinal(propName, "MinHeight") == 0 ||
String.CompareOrdinal(propName, "MaxHeight") == 0);
}
// Look for a converter type that is associated with a known type.
// Return KnownElements.UnknownElements if not found.
internal static KnownElements GetKnownTypeConverterId(KnownElements knownElement)
{
KnownElements converterId = KnownElements.UnknownElement;
switch (knownElement)
{
case KnownElements.ComponentResourceKey: converterId = KnownElements.ComponentResourceKeyConverter; break;
case KnownElements.CornerRadius: converterId = KnownElements.CornerRadiusConverter; break;
case KnownElements.BindingExpressionBase: converterId = KnownElements.ExpressionConverter; break;
case KnownElements.BindingExpression: converterId = KnownElements.ExpressionConverter; break;
case KnownElements.MultiBindingExpression: converterId = KnownElements.ExpressionConverter; break;
case KnownElements.PriorityBindingExpression: converterId = KnownElements.ExpressionConverter; break;
case KnownElements.TemplateKey: converterId = KnownElements.TemplateKeyConverter; break;
case KnownElements.DataTemplateKey: converterId = KnownElements.TemplateKeyConverter; break;
case KnownElements.DynamicResourceExtension: converterId = KnownElements.DynamicResourceExtensionConverter; break;
case KnownElements.FigureLength: converterId = KnownElements.FigureLengthConverter; break;
case KnownElements.GridLength: converterId = KnownElements.GridLengthConverter; break;
case KnownElements.PropertyPath: converterId = KnownElements.PropertyPathConverter; break;
case KnownElements.TemplateBindingExpression: converterId = KnownElements.TemplateBindingExpressionConverter; break;
case KnownElements.TemplateBindingExtension: converterId = KnownElements.TemplateBindingExtensionConverter; break;
case KnownElements.Thickness: converterId = KnownElements.ThicknessConverter; break;
case KnownElements.Duration: converterId = KnownElements.DurationConverter; break;
case KnownElements.FontStyle: converterId = KnownElements.FontStyleConverter; break;
case KnownElements.FontStretch: converterId = KnownElements.FontStretchConverter; break;
case KnownElements.FontWeight: converterId = KnownElements.FontWeightConverter; break;
case KnownElements.RoutedEvent: converterId = KnownElements.RoutedEventConverter; break;
case KnownElements.TextDecorationCollection: converterId = KnownElements.TextDecorationCollectionConverter; break;
case KnownElements.StrokeCollection: converterId = KnownElements.StrokeCollectionConverter; break;
case KnownElements.ICommand: converterId = KnownElements.CommandConverter; break;
case KnownElements.KeyGesture: converterId = KnownElements.KeyGestureConverter; break;
case KnownElements.MouseGesture: converterId = KnownElements.MouseGestureConverter; break;
case KnownElements.RoutedCommand: converterId = KnownElements.CommandConverter; break;
case KnownElements.RoutedUICommand: converterId = KnownElements.CommandConverter; break;
case KnownElements.Cursor: converterId = KnownElements.CursorConverter; break;
case KnownElements.InputScope: converterId = KnownElements.InputScopeConverter; break;
case KnownElements.InputScopeName: converterId = KnownElements.InputScopeNameConverter; break;
case KnownElements.KeySpline: converterId = KnownElements.KeySplineConverter; break;
case KnownElements.KeyTime: converterId = KnownElements.KeyTimeConverter; break;
case KnownElements.RepeatBehavior: converterId = KnownElements.RepeatBehaviorConverter; break;
case KnownElements.Brush: converterId = KnownElements.BrushConverter; break;
case KnownElements.Color: converterId = KnownElements.ColorConverter; break;
case KnownElements.Geometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.CombinedGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.TileBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.DrawingBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.ImageSource: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.DrawingImage: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.EllipseGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.FontFamily: converterId = KnownElements.FontFamilyConverter; break;
case KnownElements.DoubleCollection: converterId = KnownElements.DoubleCollectionConverter; break;
case KnownElements.GeometryGroup: converterId = KnownElements.GeometryConverter; break;
case KnownElements.GradientBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.ImageBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.Int32Collection: converterId = KnownElements.Int32CollectionConverter; break;
case KnownElements.LinearGradientBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.LineGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.Transform: converterId = KnownElements.TransformConverter; break;
case KnownElements.MatrixTransform: converterId = KnownElements.TransformConverter; break;
case KnownElements.PathFigureCollection: converterId = KnownElements.PathFigureCollectionConverter; break;
case KnownElements.PathGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.PointCollection: converterId = KnownElements.PointCollectionConverter; break;
case KnownElements.RadialGradientBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.RectangleGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.RotateTransform: converterId = KnownElements.TransformConverter; break;
case KnownElements.ScaleTransform: converterId = KnownElements.TransformConverter; break;
case KnownElements.SkewTransform: converterId = KnownElements.TransformConverter; break;
case KnownElements.SolidColorBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.StreamGeometry: converterId = KnownElements.GeometryConverter; break;
case KnownElements.TransformGroup: converterId = KnownElements.TransformConverter; break;
case KnownElements.TranslateTransform: converterId = KnownElements.TransformConverter; break;
case KnownElements.VectorCollection: converterId = KnownElements.VectorCollectionConverter; break;
case KnownElements.VisualBrush: converterId = KnownElements.BrushConverter; break;
case KnownElements.BitmapSource: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.BitmapFrame: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.BitmapImage: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.CachedBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.ColorConvertedBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.CroppedBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.FormatConvertedBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.RenderTargetBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.TransformedBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.WriteableBitmap: converterId = KnownElements.ImageSourceConverter; break;
case KnownElements.PixelFormat: converterId = KnownElements.PixelFormatConverter; break;
case KnownElements.Matrix3D: converterId = KnownElements.Matrix3DConverter; break;
case KnownElements.Point3D: converterId = KnownElements.Point3DConverter; break;
case KnownElements.Point3DCollection: converterId = KnownElements.Point3DCollectionConverter; break;
case KnownElements.Vector3DCollection: converterId = KnownElements.Vector3DCollectionConverter; break;
case KnownElements.Point4D: converterId = KnownElements.Point4DConverter; break;
case KnownElements.Quaternion: converterId = KnownElements.QuaternionConverter; break;
case KnownElements.Rect3D: converterId = KnownElements.Rect3DConverter; break;
case KnownElements.Size3D: converterId = KnownElements.Size3DConverter; break;
case KnownElements.Vector3D: converterId = KnownElements.Vector3DConverter; break;
case KnownElements.XmlLanguage: converterId = KnownElements.XmlLanguageConverter; break;
case KnownElements.Point: converterId = KnownElements.PointConverter; break;
case KnownElements.Size: converterId = KnownElements.SizeConverter; break;
case KnownElements.Vector: converterId = KnownElements.VectorConverter; break;
case KnownElements.Rect: converterId = KnownElements.RectConverter; break;
case KnownElements.Matrix: converterId = KnownElements.MatrixConverter; break;
case KnownElements.DependencyProperty: converterId = KnownElements.DependencyPropertyConverter; break;
case KnownElements.Expression: converterId = KnownElements.ExpressionConverter; break;
case KnownElements.Int32Rect: converterId = KnownElements.Int32RectConverter; break;
case KnownElements.Boolean: converterId = KnownElements.BooleanConverter; break;
case KnownElements.Int16: converterId = KnownElements.Int16Converter; break;
case KnownElements.Int32: converterId = KnownElements.Int32Converter; break;
case KnownElements.Int64: converterId = KnownElements.Int64Converter; break;
case KnownElements.UInt16: converterId = KnownElements.UInt16Converter; break;
case KnownElements.UInt32: converterId = KnownElements.UInt32Converter; break;
case KnownElements.UInt64: converterId = KnownElements.UInt64Converter; break;
case KnownElements.Single: converterId = KnownElements.SingleConverter; break;
case KnownElements.Double: converterId = KnownElements.DoubleConverter; break;
case KnownElements.Object: converterId = KnownElements.StringConverter; break;
case KnownElements.String: converterId = KnownElements.StringConverter; break;
case KnownElements.Byte: converterId = KnownElements.ByteConverter; break;
case KnownElements.SByte: converterId = KnownElements.SByteConverter; break;
case KnownElements.Char: converterId = KnownElements.CharConverter; break;
case KnownElements.Decimal: converterId = KnownElements.DecimalConverter; break;
case KnownElements.TimeSpan: converterId = KnownElements.TimeSpanConverter; break;
case KnownElements.Guid: converterId = KnownElements.GuidConverter; break;
case KnownElements.DateTime: converterId = KnownElements.DateTimeConverter2; break;
case KnownElements.Uri: converterId = KnownElements.UriTypeConverter; break;
case KnownElements.CultureInfo: converterId = KnownElements.CultureInfoConverter; break;
}
return converterId;
}
// Look for a converter type that is associated with a known type.
// Return KnownElements.UnknownElements if not found.
internal static KnownElements GetKnownTypeConverterIdForProperty(
KnownElements id,
string propName)
{
KnownElements converterId = KnownElements.UnknownElement;
switch (id)
{
case KnownElements.ColumnDefinition:
if (String.CompareOrdinal(propName, "MinWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MaxWidth") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.RowDefinition:
if (String.CompareOrdinal(propName, "MinHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MaxHeight") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.FrameworkElement:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Adorner:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Shape:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Panel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Canvas:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Left") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Top") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Right") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Bottom") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Control:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ContentControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Window:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Top") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Left") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "DialogResult") == 0)
converterId = KnownElements.DialogResultConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.NavigationWindow:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Top") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Left") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "DialogResult") == 0)
converterId = KnownElements.DialogResultConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.CollectionView:
if (String.CompareOrdinal(propName, "Culture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.StickyNoteControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ItemsControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.MenuBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ContextMenu:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.HeaderedItemsControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.MenuItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.FlowDocumentScrollViewer:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.DocumentViewerBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.FlowDocumentPageViewer:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.AccessText:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.AdornedElementPlaceholder:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Decorator:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Border:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ButtonBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Button:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ToggleButton:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsChecked") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.CheckBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsChecked") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Selector:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsSynchronizedWithCurrentItem") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ComboBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MaxDropDownHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsSynchronizedWithCurrentItem") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ListBoxItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ComboBoxItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ContentPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ContextMenuService:
if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.DockPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.DocumentViewer:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.HeaderedContentControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Expander:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.FlowDocumentReader:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Frame:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Grid:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.GridViewColumn:
if (String.CompareOrdinal(propName, "Width") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.GridViewColumnHeader:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.GridViewRowPresenterBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.GridViewHeaderRowPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.GridViewRowPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Thumb:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.GridSplitter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.GroupBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.GroupItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Image:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.InkCanvas:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Top") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Bottom") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Left") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Right") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.InkPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ItemCollection:
if (String.CompareOrdinal(propName, "Culture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.ItemsPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Label:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ListBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsSynchronizedWithCurrentItem") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ListView:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsSynchronizedWithCurrentItem") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ListViewItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.MediaElement:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Menu:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Page:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.PasswordBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.BulletDecorator:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.DocumentPageView:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Popup:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.RangeBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.RepeatButton:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ResizeGrip:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ScrollBar:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ScrollContentPresenter:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.StatusBar:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.StatusBarItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TabPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.TextBoxBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TickBar:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ToolBarOverflowPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.StackPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ToolBarPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Track:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.UniformGrid:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ProgressBar:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.RadioButton:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsChecked") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.RichTextBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ScrollViewer:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Separator:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Slider:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TabControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "IsSynchronizedWithCurrentItem") == 0)
converterId = KnownElements.NullableBoolConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TabItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TextBlock:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.TextBox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ToolBar:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ToolBarTray:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.ToolTip:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ToolTipService:
if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.TreeView:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TreeViewItem:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.UserControl:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Viewbox:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Viewport3D:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.VirtualizingPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.VirtualizingStackPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.WrapPanel:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "ItemWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "ItemHeight") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Binding:
if (String.CompareOrdinal(propName, "ConverterCulture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.BindingListCollectionView:
if (String.CompareOrdinal(propName, "Culture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.CollectionViewSource:
if (String.CompareOrdinal(propName, "Culture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.ListCollectionView:
if (String.CompareOrdinal(propName, "Culture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.MultiBinding:
if (String.CompareOrdinal(propName, "ConverterCulture") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.AdornerDecorator:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.AdornerLayer:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.TextElement:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Inline:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.AnchoredBlock:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Block:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.BlockUIContainer:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Span:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Bold:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.DocumentReference:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Figure:
if (String.CompareOrdinal(propName, "HorizontalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "VerticalOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.FixedPage:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Left") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Top") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Right") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Bottom") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Floater:
if (String.CompareOrdinal(propName, "Width") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.FlowDocument:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "ColumnWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "ColumnGap") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "ColumnRuleWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "PageWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MinPageWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MaxPageWidth") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "PageHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MinPageHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "MaxPageHeight") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Glyphs:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontRenderingEmSize") == 0)
converterId = KnownElements.FontSizeConverter;
else if (String.CompareOrdinal(propName, "OriginX") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "OriginY") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Hyperlink:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.InlineUIContainer:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Italic:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.LineBreak:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.List:
if (String.CompareOrdinal(propName, "MarkerOffset") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.ListItem:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.PageContent:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Paragraph:
if (String.CompareOrdinal(propName, "TextIndent") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Run:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Section:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Table:
if (String.CompareOrdinal(propName, "CellSpacing") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TableCell:
if (String.CompareOrdinal(propName, "LineHeight") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TableRow:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.TableRowGroup:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Underline:
if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.PageFunctionBase:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "FontSize") == 0)
converterId = KnownElements.FontSizeConverter;
break;
case KnownElements.Ellipse:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Line:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "X1") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Y1") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "X2") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "Y2") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Path:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Polygon:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Polyline:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.Rectangle:
if (IsStandardLengthProp(propName))
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "RadiusX") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "RadiusY") == 0)
converterId = KnownElements.LengthConverter;
else if (String.CompareOrdinal(propName, "StrokeThickness") == 0)
converterId = KnownElements.LengthConverter;
break;
case KnownElements.InputBinding:
if (String.CompareOrdinal(propName, "Command") == 0)
converterId = KnownElements.CommandConverter;
break;
case KnownElements.KeyBinding:
if (String.CompareOrdinal(propName, "Gesture") == 0)
converterId = KnownElements.KeyGestureConverter;
else if (String.CompareOrdinal(propName, "Command") == 0)
converterId = KnownElements.CommandConverter;
break;
case KnownElements.MouseBinding:
if (String.CompareOrdinal(propName, "Gesture") == 0)
converterId = KnownElements.MouseGestureConverter;
else if (String.CompareOrdinal(propName, "Command") == 0)
converterId = KnownElements.CommandConverter;
break;
case KnownElements.InputLanguageManager:
if (String.CompareOrdinal(propName, "CurrentInputLanguage") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
else if (String.CompareOrdinal(propName, "InputLanguage") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
case KnownElements.GlyphRun:
if (String.CompareOrdinal(propName, "CaretStops") == 0)
converterId = KnownElements.BoolIListConverter;
else if (String.CompareOrdinal(propName, "ClusterMap") == 0)
converterId = KnownElements.UShortIListConverter;
else if (String.CompareOrdinal(propName, "Characters") == 0)
converterId = KnownElements.CharIListConverter;
else if (String.CompareOrdinal(propName, "GlyphIndices") == 0)
converterId = KnownElements.UShortIListConverter;
else if (String.CompareOrdinal(propName, "AdvanceWidths") == 0)
converterId = KnownElements.DoubleIListConverter;
else if (String.CompareOrdinal(propName, "GlyphOffsets") == 0)
converterId = KnownElements.PointIListConverter;
break;
case KnownElements.NumberSubstitution:
if (String.CompareOrdinal(propName, "CultureOverride") == 0)
converterId = KnownElements.CultureInfoIetfLanguageTagConverter;
break;
}
return converterId;
}
}
// Index class for lazy initialization of KnownTypes on the Compiler path.
internal partial class TypeIndexer
{
#if PBTCOMPILER
private static bool _initialized = false;
private static Assembly _asmFramework;
private static Assembly _asmCore;
private static Assembly _asmBase;
public void Initialize(Assembly asmFramework, Assembly asmCore, Assembly asmBase)
{
// Paramater validation
Debug.Assert(asmFramework != null, "asmFramework must not be null");
Debug.Assert(asmCore != null, "asmCore must not be null");
Debug.Assert(asmBase != null, "asmBase must not be null");
if (!_initialized)
{
_asmFramework = asmFramework;
_asmCore = asmCore;
_asmBase = asmBase;
_initialized = true;
}
}
// Initialize the Known WCP types from basic WCP assemblies
private Type InitializeOneType(KnownElements knownElement)
{
Type t = null;
switch(knownElement)
{
case KnownElements.FrameworkContentElement: t = _asmFramework.GetType("System.Windows.FrameworkContentElement"); break;
case KnownElements.DefinitionBase: t = _asmFramework.GetType("System.Windows.Controls.DefinitionBase"); break;
case KnownElements.ColumnDefinition: t = _asmFramework.GetType("System.Windows.Controls.ColumnDefinition"); break;
case KnownElements.RowDefinition: t = _asmFramework.GetType("System.Windows.Controls.RowDefinition"); break;
case KnownElements.FrameworkElement: t = _asmFramework.GetType("System.Windows.FrameworkElement"); break;
case KnownElements.Adorner: t = _asmFramework.GetType("System.Windows.Documents.Adorner"); break;
case KnownElements.Shape: t = _asmFramework.GetType("System.Windows.Shapes.Shape"); break;
case KnownElements.Panel: t = _asmFramework.GetType("System.Windows.Controls.Panel"); break;
case KnownElements.Canvas: t = _asmFramework.GetType("System.Windows.Controls.Canvas"); break;
case KnownElements.JournalEntry: t = _asmFramework.GetType("System.Windows.Navigation.JournalEntry"); break;
case KnownElements.Control: t = _asmFramework.GetType("System.Windows.Controls.Control"); break;
case KnownElements.ContentControl: t = _asmFramework.GetType("System.Windows.Controls.ContentControl"); break;
case KnownElements.Window: t = _asmFramework.GetType("System.Windows.Window"); break;
case KnownElements.NavigationWindow: t = _asmFramework.GetType("System.Windows.Navigation.NavigationWindow"); break;
case KnownElements.Application: t = _asmFramework.GetType("System.Windows.Application"); break;
case KnownElements.CollectionView: t = _asmFramework.GetType("System.Windows.Data.CollectionView"); break;
case KnownElements.StickyNoteControl: t = _asmFramework.GetType("System.Windows.Controls.StickyNoteControl"); break;
case KnownElements.ItemsControl: t = _asmFramework.GetType("System.Windows.Controls.ItemsControl"); break;
case KnownElements.MenuBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.MenuBase"); break;
case KnownElements.ContextMenu: t = _asmFramework.GetType("System.Windows.Controls.ContextMenu"); break;
case KnownElements.HeaderedItemsControl: t = _asmFramework.GetType("System.Windows.Controls.HeaderedItemsControl"); break;
case KnownElements.MenuItem: t = _asmFramework.GetType("System.Windows.Controls.MenuItem"); break;
case KnownElements.FlowDocumentScrollViewer: t = _asmFramework.GetType("System.Windows.Controls.FlowDocumentScrollViewer"); break;
case KnownElements.DocumentViewerBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.DocumentViewerBase"); break;
case KnownElements.FlowDocumentPageViewer: t = _asmFramework.GetType("System.Windows.Controls.FlowDocumentPageViewer"); break;
case KnownElements.ResourceKey: t = _asmFramework.GetType("System.Windows.ResourceKey"); break;
case KnownElements.ComponentResourceKey: t = _asmFramework.GetType("System.Windows.ComponentResourceKey"); break;
case KnownElements.FrameworkTemplate: t = _asmFramework.GetType("System.Windows.FrameworkTemplate"); break;
case KnownElements.ControlTemplate: t = _asmFramework.GetType("System.Windows.Controls.ControlTemplate"); break;
case KnownElements.AccessText: t = _asmFramework.GetType("System.Windows.Controls.AccessText"); break;
case KnownElements.AdornedElementPlaceholder: t = _asmFramework.GetType("System.Windows.Controls.AdornedElementPlaceholder"); break;
case KnownElements.BooleanToVisibilityConverter: t = _asmFramework.GetType("System.Windows.Controls.BooleanToVisibilityConverter"); break;
case KnownElements.Decorator: t = _asmFramework.GetType("System.Windows.Controls.Decorator"); break;
case KnownElements.Border: t = _asmFramework.GetType("System.Windows.Controls.Border"); break;
case KnownElements.BorderGapMaskConverter: t = _asmFramework.GetType("System.Windows.Controls.BorderGapMaskConverter"); break;
case KnownElements.ButtonBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ButtonBase"); break;
case KnownElements.Button: t = _asmFramework.GetType("System.Windows.Controls.Button"); break;
case KnownElements.ToggleButton: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ToggleButton"); break;
case KnownElements.CheckBox: t = _asmFramework.GetType("System.Windows.Controls.CheckBox"); break;
case KnownElements.Selector: t = _asmFramework.GetType("System.Windows.Controls.Primitives.Selector"); break;
case KnownElements.ComboBox: t = _asmFramework.GetType("System.Windows.Controls.ComboBox"); break;
case KnownElements.ListBoxItem: t = _asmFramework.GetType("System.Windows.Controls.ListBoxItem"); break;
case KnownElements.ComboBoxItem: t = _asmFramework.GetType("System.Windows.Controls.ComboBoxItem"); break;
case KnownElements.ContentPresenter: t = _asmFramework.GetType("System.Windows.Controls.ContentPresenter"); break;
case KnownElements.DataTemplate: t = _asmFramework.GetType("System.Windows.DataTemplate"); break;
case KnownElements.ContextMenuService: t = _asmFramework.GetType("System.Windows.Controls.ContextMenuService"); break;
case KnownElements.DockPanel: t = _asmFramework.GetType("System.Windows.Controls.DockPanel"); break;
case KnownElements.DocumentViewer: t = _asmFramework.GetType("System.Windows.Controls.DocumentViewer"); break;
case KnownElements.HeaderedContentControl: t = _asmFramework.GetType("System.Windows.Controls.HeaderedContentControl"); break;
case KnownElements.Expander: t = _asmFramework.GetType("System.Windows.Controls.Expander"); break;
case KnownElements.FlowDocumentReader: t = _asmFramework.GetType("System.Windows.Controls.FlowDocumentReader"); break;
case KnownElements.Frame: t = _asmFramework.GetType("System.Windows.Controls.Frame"); break;
case KnownElements.Grid: t = _asmFramework.GetType("System.Windows.Controls.Grid"); break;
case KnownElements.ViewBase: t = _asmFramework.GetType("System.Windows.Controls.ViewBase"); break;
case KnownElements.GridView: t = _asmFramework.GetType("System.Windows.Controls.GridView"); break;
case KnownElements.GridViewColumn: t = _asmFramework.GetType("System.Windows.Controls.GridViewColumn"); break;
case KnownElements.GridViewColumnHeader: t = _asmFramework.GetType("System.Windows.Controls.GridViewColumnHeader"); break;
case KnownElements.GridViewRowPresenterBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.GridViewRowPresenterBase"); break;
case KnownElements.GridViewHeaderRowPresenter: t = _asmFramework.GetType("System.Windows.Controls.GridViewHeaderRowPresenter"); break;
case KnownElements.GridViewRowPresenter: t = _asmFramework.GetType("System.Windows.Controls.GridViewRowPresenter"); break;
case KnownElements.Thumb: t = _asmFramework.GetType("System.Windows.Controls.Primitives.Thumb"); break;
case KnownElements.GridSplitter: t = _asmFramework.GetType("System.Windows.Controls.GridSplitter"); break;
case KnownElements.GroupBox: t = _asmFramework.GetType("System.Windows.Controls.GroupBox"); break;
case KnownElements.GroupItem: t = _asmFramework.GetType("System.Windows.Controls.GroupItem"); break;
case KnownElements.Image: t = _asmFramework.GetType("System.Windows.Controls.Image"); break;
case KnownElements.InkCanvas: t = _asmFramework.GetType("System.Windows.Controls.InkCanvas"); break;
case KnownElements.InkPresenter: t = _asmFramework.GetType("System.Windows.Controls.InkPresenter"); break;
case KnownElements.ItemCollection: t = _asmFramework.GetType("System.Windows.Controls.ItemCollection"); break;
case KnownElements.ItemsPanelTemplate: t = _asmFramework.GetType("System.Windows.Controls.ItemsPanelTemplate"); break;
case KnownElements.ItemsPresenter: t = _asmFramework.GetType("System.Windows.Controls.ItemsPresenter"); break;
case KnownElements.Label: t = _asmFramework.GetType("System.Windows.Controls.Label"); break;
case KnownElements.ListBox: t = _asmFramework.GetType("System.Windows.Controls.ListBox"); break;
case KnownElements.ListView: t = _asmFramework.GetType("System.Windows.Controls.ListView"); break;
case KnownElements.ListViewItem: t = _asmFramework.GetType("System.Windows.Controls.ListViewItem"); break;
case KnownElements.MediaElement: t = _asmFramework.GetType("System.Windows.Controls.MediaElement"); break;
case KnownElements.Menu: t = _asmFramework.GetType("System.Windows.Controls.Menu"); break;
case KnownElements.MenuScrollingVisibilityConverter: t = _asmFramework.GetType("System.Windows.Controls.MenuScrollingVisibilityConverter"); break;
case KnownElements.Page: t = _asmFramework.GetType("System.Windows.Controls.Page"); break;
case KnownElements.PasswordBox: t = _asmFramework.GetType("System.Windows.Controls.PasswordBox"); break;
case KnownElements.BulletDecorator: t = _asmFramework.GetType("System.Windows.Controls.Primitives.BulletDecorator"); break;
case KnownElements.DocumentPageView: t = _asmFramework.GetType("System.Windows.Controls.Primitives.DocumentPageView"); break;
case KnownElements.Popup: t = _asmFramework.GetType("System.Windows.Controls.Primitives.Popup"); break;
case KnownElements.RangeBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.RangeBase"); break;
case KnownElements.RepeatButton: t = _asmFramework.GetType("System.Windows.Controls.Primitives.RepeatButton"); break;
case KnownElements.ResizeGrip: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ResizeGrip"); break;
case KnownElements.ScrollBar: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ScrollBar"); break;
case KnownElements.ScrollContentPresenter: t = _asmFramework.GetType("System.Windows.Controls.ScrollContentPresenter"); break;
case KnownElements.StatusBar: t = _asmFramework.GetType("System.Windows.Controls.Primitives.StatusBar"); break;
case KnownElements.StatusBarItem: t = _asmFramework.GetType("System.Windows.Controls.Primitives.StatusBarItem"); break;
case KnownElements.TabPanel: t = _asmFramework.GetType("System.Windows.Controls.Primitives.TabPanel"); break;
case KnownElements.TextBoxBase: t = _asmFramework.GetType("System.Windows.Controls.Primitives.TextBoxBase"); break;
case KnownElements.TickBar: t = _asmFramework.GetType("System.Windows.Controls.Primitives.TickBar"); break;
case KnownElements.ToolBarOverflowPanel: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ToolBarOverflowPanel"); break;
case KnownElements.StackPanel: t = _asmFramework.GetType("System.Windows.Controls.StackPanel"); break;
case KnownElements.ToolBarPanel: t = _asmFramework.GetType("System.Windows.Controls.Primitives.ToolBarPanel"); break;
case KnownElements.Track: t = _asmFramework.GetType("System.Windows.Controls.Primitives.Track"); break;
case KnownElements.UniformGrid: t = _asmFramework.GetType("System.Windows.Controls.Primitives.UniformGrid"); break;
case KnownElements.ProgressBar: t = _asmFramework.GetType("System.Windows.Controls.ProgressBar"); break;
case KnownElements.RadioButton: t = _asmFramework.GetType("System.Windows.Controls.RadioButton"); break;
case KnownElements.RichTextBox: t = _asmFramework.GetType("System.Windows.Controls.RichTextBox"); break;
case KnownElements.ScrollViewer: t = _asmFramework.GetType("System.Windows.Controls.ScrollViewer"); break;
case KnownElements.Separator: t = _asmFramework.GetType("System.Windows.Controls.Separator"); break;
case KnownElements.Slider: t = _asmFramework.GetType("System.Windows.Controls.Slider"); break;
case KnownElements.TriggerAction: t = _asmFramework.GetType("System.Windows.TriggerAction"); break;
case KnownElements.SoundPlayerAction: t = _asmFramework.GetType("System.Windows.Controls.SoundPlayerAction"); break;
case KnownElements.SpellCheck: t = _asmFramework.GetType("System.Windows.Controls.SpellCheck"); break;
case KnownElements.TabControl: t = _asmFramework.GetType("System.Windows.Controls.TabControl"); break;
case KnownElements.TabItem: t = _asmFramework.GetType("System.Windows.Controls.TabItem"); break;
case KnownElements.TextBlock: t = _asmFramework.GetType("System.Windows.Controls.TextBlock"); break;
case KnownElements.TextBox: t = _asmFramework.GetType("System.Windows.Controls.TextBox"); break;
case KnownElements.TextSearch: t = _asmFramework.GetType("System.Windows.Controls.TextSearch"); break;
case KnownElements.ToolBar: t = _asmFramework.GetType("System.Windows.Controls.ToolBar"); break;
case KnownElements.ToolBarTray: t = _asmFramework.GetType("System.Windows.Controls.ToolBarTray"); break;
case KnownElements.ToolTip: t = _asmFramework.GetType("System.Windows.Controls.ToolTip"); break;
case KnownElements.ToolTipService: t = _asmFramework.GetType("System.Windows.Controls.ToolTipService"); break;
case KnownElements.TreeView: t = _asmFramework.GetType("System.Windows.Controls.TreeView"); break;
case KnownElements.TreeViewItem: t = _asmFramework.GetType("System.Windows.Controls.TreeViewItem"); break;
case KnownElements.UserControl: t = _asmFramework.GetType("System.Windows.Controls.UserControl"); break;
case KnownElements.Validation: t = _asmFramework.GetType("System.Windows.Controls.Validation"); break;
case KnownElements.Viewbox: t = _asmFramework.GetType("System.Windows.Controls.Viewbox"); break;
case KnownElements.Viewport3D: t = _asmFramework.GetType("System.Windows.Controls.Viewport3D"); break;
case KnownElements.VirtualizingPanel: t = _asmFramework.GetType("System.Windows.Controls.VirtualizingPanel"); break;
case KnownElements.VirtualizingStackPanel: t = _asmFramework.GetType("System.Windows.Controls.VirtualizingStackPanel"); break;
case KnownElements.WrapPanel: t = _asmFramework.GetType("System.Windows.Controls.WrapPanel"); break;
case KnownElements.CornerRadius: t = _asmFramework.GetType("System.Windows.CornerRadius"); break;
case KnownElements.CornerRadiusConverter: t = _asmFramework.GetType("System.Windows.CornerRadiusConverter"); break;
case KnownElements.BindingBase: t = _asmFramework.GetType("System.Windows.Data.BindingBase"); break;
case KnownElements.Binding: t = _asmFramework.GetType("System.Windows.Data.Binding"); break;
case KnownElements.BindingExpressionBase: t = _asmFramework.GetType("System.Windows.Data.BindingExpressionBase"); break;
case KnownElements.BindingExpression: t = _asmFramework.GetType("System.Windows.Data.BindingExpression"); break;
case KnownElements.BindingListCollectionView: t = _asmFramework.GetType("System.Windows.Data.BindingListCollectionView"); break;
case KnownElements.CollectionContainer: t = _asmFramework.GetType("System.Windows.Data.CollectionContainer"); break;
case KnownElements.CollectionViewSource: t = _asmFramework.GetType("System.Windows.Data.CollectionViewSource"); break;
case KnownElements.DataChangedEventManager: t = _asmFramework.GetType("System.Windows.Data.DataChangedEventManager"); break;
case KnownElements.ListCollectionView: t = _asmFramework.GetType("System.Windows.Data.ListCollectionView"); break;
case KnownElements.MultiBinding: t = _asmFramework.GetType("System.Windows.Data.MultiBinding"); break;
case KnownElements.MultiBindingExpression: t = _asmFramework.GetType("System.Windows.Data.MultiBindingExpression"); break;
case KnownElements.ObjectDataProvider: t = _asmFramework.GetType("System.Windows.Data.ObjectDataProvider"); break;
case KnownElements.PriorityBinding: t = _asmFramework.GetType("System.Windows.Data.PriorityBinding"); break;
case KnownElements.PriorityBindingExpression: t = _asmFramework.GetType("System.Windows.Data.PriorityBindingExpression"); break;
case KnownElements.RelativeSource: t = _asmFramework.GetType("System.Windows.Data.RelativeSource"); break;
case KnownElements.XmlDataProvider: t = _asmFramework.GetType("System.Windows.Data.XmlDataProvider"); break;
case KnownElements.XmlNamespaceMapping: t = _asmFramework.GetType("System.Windows.Data.XmlNamespaceMapping"); break;
case KnownElements.TemplateKey: t = _asmFramework.GetType("System.Windows.TemplateKey"); break;
case KnownElements.DataTemplateKey: t = _asmFramework.GetType("System.Windows.DataTemplateKey"); break;
case KnownElements.TriggerBase: t = _asmFramework.GetType("System.Windows.TriggerBase"); break;
case KnownElements.DataTrigger: t = _asmFramework.GetType("System.Windows.DataTrigger"); break;
case KnownElements.DialogResultConverter: t = _asmFramework.GetType("System.Windows.DialogResultConverter"); break;
case KnownElements.AdornerDecorator: t = _asmFramework.GetType("System.Windows.Documents.AdornerDecorator"); break;
case KnownElements.AdornerLayer: t = _asmFramework.GetType("System.Windows.Documents.AdornerLayer"); break;
case KnownElements.TextElement: t = _asmFramework.GetType("System.Windows.Documents.TextElement"); break;
case KnownElements.Inline: t = _asmFramework.GetType("System.Windows.Documents.Inline"); break;
case KnownElements.AnchoredBlock: t = _asmFramework.GetType("System.Windows.Documents.AnchoredBlock"); break;
case KnownElements.Block: t = _asmFramework.GetType("System.Windows.Documents.Block"); break;
case KnownElements.BlockUIContainer: t = _asmFramework.GetType("System.Windows.Documents.BlockUIContainer"); break;
case KnownElements.Span: t = _asmFramework.GetType("System.Windows.Documents.Span"); break;
case KnownElements.Bold: t = _asmFramework.GetType("System.Windows.Documents.Bold"); break;
case KnownElements.DocumentReference: t = _asmFramework.GetType("System.Windows.Documents.DocumentReference"); break;
case KnownElements.FixedDocumentSequence: t = _asmFramework.GetType("System.Windows.Documents.FixedDocumentSequence"); break;
case KnownElements.Figure: t = _asmFramework.GetType("System.Windows.Documents.Figure"); break;
case KnownElements.FixedDocument: t = _asmFramework.GetType("System.Windows.Documents.FixedDocument"); break;
case KnownElements.FixedPage: t = _asmFramework.GetType("System.Windows.Documents.FixedPage"); break;
case KnownElements.Floater: t = _asmFramework.GetType("System.Windows.Documents.Floater"); break;
case KnownElements.FlowDocument: t = _asmFramework.GetType("System.Windows.Documents.FlowDocument"); break;
case KnownElements.FrameworkTextComposition: t = _asmFramework.GetType("System.Windows.Documents.FrameworkTextComposition"); break;
case KnownElements.FrameworkRichTextComposition: t = _asmFramework.GetType("System.Windows.Documents.FrameworkRichTextComposition"); break;
case KnownElements.Glyphs: t = _asmFramework.GetType("System.Windows.Documents.Glyphs"); break;
case KnownElements.Hyperlink: t = _asmFramework.GetType("System.Windows.Documents.Hyperlink"); break;
case KnownElements.InlineUIContainer: t = _asmFramework.GetType("System.Windows.Documents.InlineUIContainer"); break;
case KnownElements.Italic: t = _asmFramework.GetType("System.Windows.Documents.Italic"); break;
case KnownElements.LineBreak: t = _asmFramework.GetType("System.Windows.Documents.LineBreak"); break;
case KnownElements.List: t = _asmFramework.GetType("System.Windows.Documents.List"); break;
case KnownElements.ListItem: t = _asmFramework.GetType("System.Windows.Documents.ListItem"); break;
case KnownElements.PageContent: t = _asmFramework.GetType("System.Windows.Documents.PageContent"); break;
case KnownElements.Paragraph: t = _asmFramework.GetType("System.Windows.Documents.Paragraph"); break;
case KnownElements.Run: t = _asmFramework.GetType("System.Windows.Documents.Run"); break;
case KnownElements.Section: t = _asmFramework.GetType("System.Windows.Documents.Section"); break;
case KnownElements.Table: t = _asmFramework.GetType("System.Windows.Documents.Table"); break;
case KnownElements.TableCell: t = _asmFramework.GetType("System.Windows.Documents.TableCell"); break;
case KnownElements.TableColumn: t = _asmFramework.GetType("System.Windows.Documents.TableColumn"); break;
case KnownElements.TableRow: t = _asmFramework.GetType("System.Windows.Documents.TableRow"); break;
case KnownElements.TableRowGroup: t = _asmFramework.GetType("System.Windows.Documents.TableRowGroup"); break;
case KnownElements.Typography: t = _asmFramework.GetType("System.Windows.Documents.Typography"); break;
case KnownElements.Underline: t = _asmFramework.GetType("System.Windows.Documents.Underline"); break;
case KnownElements.ZoomPercentageConverter: t = _asmFramework.GetType("System.Windows.Documents.ZoomPercentageConverter"); break;
case KnownElements.DynamicResourceExtension: t = _asmFramework.GetType("System.Windows.DynamicResourceExtension"); break;
case KnownElements.DynamicResourceExtensionConverter: t = _asmFramework.GetType("System.Windows.DynamicResourceExtensionConverter"); break;
case KnownElements.SetterBase: t = _asmFramework.GetType("System.Windows.SetterBase"); break;
case KnownElements.EventSetter: t = _asmFramework.GetType("System.Windows.EventSetter"); break;
case KnownElements.EventTrigger: t = _asmFramework.GetType("System.Windows.EventTrigger"); break;
case KnownElements.FigureLength: t = _asmFramework.GetType("System.Windows.FigureLength"); break;
case KnownElements.FigureLengthConverter: t = _asmFramework.GetType("System.Windows.FigureLengthConverter"); break;
case KnownElements.FontSizeConverter: t = _asmFramework.GetType("System.Windows.FontSizeConverter"); break;
case KnownElements.GridLength: t = _asmFramework.GetType("System.Windows.GridLength"); break;
case KnownElements.GridLengthConverter: t = _asmFramework.GetType("System.Windows.GridLengthConverter"); break;
case KnownElements.HierarchicalDataTemplate: t = _asmFramework.GetType("System.Windows.HierarchicalDataTemplate"); break;
case KnownElements.LengthConverter: t = _asmFramework.GetType("System.Windows.LengthConverter"); break;
case KnownElements.Localization: t = _asmFramework.GetType("System.Windows.Localization"); break;
case KnownElements.LostFocusEventManager: t = _asmFramework.GetType("System.Windows.LostFocusEventManager"); break;
case KnownElements.BeginStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.BeginStoryboard"); break;
case KnownElements.ControllableStoryboardAction: t = _asmFramework.GetType("System.Windows.Media.Animation.ControllableStoryboardAction"); break;
case KnownElements.PauseStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.PauseStoryboard"); break;
case KnownElements.RemoveStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.RemoveStoryboard"); break;
case KnownElements.ResumeStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.ResumeStoryboard"); break;
case KnownElements.SeekStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.SeekStoryboard"); break;
case KnownElements.SetStoryboardSpeedRatio: t = _asmFramework.GetType("System.Windows.Media.Animation.SetStoryboardSpeedRatio"); break;
case KnownElements.SkipStoryboardToFill: t = _asmFramework.GetType("System.Windows.Media.Animation.SkipStoryboardToFill"); break;
case KnownElements.StopStoryboard: t = _asmFramework.GetType("System.Windows.Media.Animation.StopStoryboard"); break;
case KnownElements.Storyboard: t = _asmFramework.GetType("System.Windows.Media.Animation.Storyboard"); break;
case KnownElements.ThicknessKeyFrame: t = _asmFramework.GetType("System.Windows.Media.Animation.ThicknessKeyFrame"); break;
case KnownElements.DiscreteThicknessKeyFrame: t = _asmFramework.GetType("System.Windows.Media.Animation.DiscreteThicknessKeyFrame"); break;
case KnownElements.LinearThicknessKeyFrame: t = _asmFramework.GetType("System.Windows.Media.Animation.LinearThicknessKeyFrame"); break;
case KnownElements.SplineThicknessKeyFrame: t = _asmFramework.GetType("System.Windows.Media.Animation.SplineThicknessKeyFrame"); break;
case KnownElements.ThicknessAnimationBase: t = _asmFramework.GetType("System.Windows.Media.Animation.ThicknessAnimationBase"); break;
case KnownElements.ThicknessAnimation: t = _asmFramework.GetType("System.Windows.Media.Animation.ThicknessAnimation"); break;
case KnownElements.ThicknessAnimationUsingKeyFrames: t = _asmFramework.GetType("System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames"); break;
case KnownElements.ThicknessKeyFrameCollection: t = _asmFramework.GetType("System.Windows.Media.Animation.ThicknessKeyFrameCollection"); break;
case KnownElements.MultiDataTrigger: t = _asmFramework.GetType("System.Windows.MultiDataTrigger"); break;
case KnownElements.MultiTrigger: t = _asmFramework.GetType("System.Windows.MultiTrigger"); break;
case KnownElements.NameScope: t = _asmFramework.GetType("System.Windows.NameScope"); break;
case KnownElements.JournalEntryListConverter: t = _asmFramework.GetType("System.Windows.Navigation.JournalEntryListConverter"); break;
case KnownElements.JournalEntryUnifiedViewConverter: t = _asmFramework.GetType("System.Windows.Navigation.JournalEntryUnifiedViewConverter"); break;
case KnownElements.PageFunctionBase: t = _asmFramework.GetType("System.Windows.Navigation.PageFunctionBase"); break;
case KnownElements.NullableBoolConverter: t = _asmFramework.GetType("System.Windows.NullableBoolConverter"); break;
case KnownElements.PropertyPath: t = _asmFramework.GetType("System.Windows.PropertyPath"); break;
case KnownElements.PropertyPathConverter: t = _asmFramework.GetType("System.Windows.PropertyPathConverter"); break;
case KnownElements.ResourceDictionary: t = _asmFramework.GetType("System.Windows.ResourceDictionary"); break;
case KnownElements.ColorConvertedBitmapExtension: t = _asmFramework.GetType("System.Windows.ColorConvertedBitmapExtension"); break;
case KnownElements.StaticResourceExtension: t = _asmFramework.GetType("System.Windows.StaticResourceExtension"); break;
case KnownElements.Setter: t = _asmFramework.GetType("System.Windows.Setter"); break;
case KnownElements.Ellipse: t = _asmFramework.GetType("System.Windows.Shapes.Ellipse"); break;
case KnownElements.Line: t = _asmFramework.GetType("System.Windows.Shapes.Line"); break;
case KnownElements.Path: t = _asmFramework.GetType("System.Windows.Shapes.Path"); break;
case KnownElements.Polygon: t = _asmFramework.GetType("System.Windows.Shapes.Polygon"); break;
case KnownElements.Polyline: t = _asmFramework.GetType("System.Windows.Shapes.Polyline"); break;
case KnownElements.Rectangle: t = _asmFramework.GetType("System.Windows.Shapes.Rectangle"); break;
case KnownElements.Style: t = _asmFramework.GetType("System.Windows.Style"); break;
case KnownElements.TemplateBindingExpression: t = _asmFramework.GetType("System.Windows.TemplateBindingExpression"); break;
case KnownElements.TemplateBindingExpressionConverter: t = _asmFramework.GetType("System.Windows.TemplateBindingExpressionConverter"); break;
case KnownElements.TemplateBindingExtension: t = _asmFramework.GetType("System.Windows.TemplateBindingExtension"); break;
case KnownElements.TemplateBindingExtensionConverter: t = _asmFramework.GetType("System.Windows.TemplateBindingExtensionConverter"); break;
case KnownElements.ThemeDictionaryExtension: t = _asmFramework.GetType("System.Windows.ThemeDictionaryExtension"); break;
case KnownElements.Thickness: t = _asmFramework.GetType("System.Windows.Thickness"); break;
case KnownElements.ThicknessConverter: t = _asmFramework.GetType("System.Windows.ThicknessConverter"); break;
case KnownElements.Trigger: t = _asmFramework.GetType("System.Windows.Trigger"); break;
case KnownElements.BaseIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.BaseIListConverter"); break;
case KnownElements.DoubleIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.DoubleIListConverter"); break;
case KnownElements.UShortIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.UShortIListConverter"); break;
case KnownElements.BoolIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.BoolIListConverter"); break;
case KnownElements.PointIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.PointIListConverter"); break;
case KnownElements.CharIListConverter: t = _asmCore.GetType("System.Windows.Media.Converters.CharIListConverter"); break;
case KnownElements.Visual: t = _asmCore.GetType("System.Windows.Media.Visual"); break;
case KnownElements.ContainerVisual: t = _asmCore.GetType("System.Windows.Media.ContainerVisual"); break;
case KnownElements.DrawingVisual: t = _asmCore.GetType("System.Windows.Media.DrawingVisual"); break;
case KnownElements.StreamGeometryContext: t = _asmCore.GetType("System.Windows.Media.StreamGeometryContext"); break;
case KnownElements.Animatable: t = _asmCore.GetType("System.Windows.Media.Animation.Animatable"); break;
case KnownElements.GeneralTransform: t = _asmCore.GetType("System.Windows.Media.GeneralTransform"); break;
case KnownElements.ContentElement: t = _asmCore.GetType("System.Windows.ContentElement"); break;
case KnownElements.CultureInfoIetfLanguageTagConverter: t = _asmCore.GetType("System.Windows.CultureInfoIetfLanguageTagConverter"); break;
case KnownElements.Duration: t = _asmCore.GetType("System.Windows.Duration"); break;
case KnownElements.DurationConverter: t = _asmCore.GetType("System.Windows.DurationConverter"); break;
case KnownElements.FontStyle: t = _asmCore.GetType("System.Windows.FontStyle"); break;
case KnownElements.FontStyleConverter: t = _asmCore.GetType("System.Windows.FontStyleConverter"); break;
case KnownElements.FontStretch: t = _asmCore.GetType("System.Windows.FontStretch"); break;
case KnownElements.FontStretchConverter: t = _asmCore.GetType("System.Windows.FontStretchConverter"); break;
case KnownElements.FontWeight: t = _asmCore.GetType("System.Windows.FontWeight"); break;
case KnownElements.FontWeightConverter: t = _asmCore.GetType("System.Windows.FontWeightConverter"); break;
case KnownElements.UIElement: t = _asmCore.GetType("System.Windows.UIElement"); break;
case KnownElements.Visual3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Visual3D"); break;
case KnownElements.RoutedEvent: t = _asmCore.GetType("System.Windows.RoutedEvent"); break;
case KnownElements.TextDecoration: t = _asmCore.GetType("System.Windows.TextDecoration"); break;
case KnownElements.TextDecorationCollection: t = _asmCore.GetType("System.Windows.TextDecorationCollection"); break;
case KnownElements.TextDecorationCollectionConverter: t = _asmCore.GetType("System.Windows.TextDecorationCollectionConverter"); break;
case KnownElements.GestureRecognizer: t = _asmCore.GetType("System.Windows.Ink.GestureRecognizer"); break;
case KnownElements.StrokeCollection: t = _asmCore.GetType("System.Windows.Ink.StrokeCollection"); break;
case KnownElements.StrokeCollectionConverter: t = _asmCore.GetType("System.Windows.StrokeCollectionConverter"); break;
case KnownElements.InputDevice: t = _asmCore.GetType("System.Windows.Input.InputDevice"); break;
case KnownElements.ICommand: t = _asmCore.GetType("System.Windows.Input.ICommand"); break;
case KnownElements.InputBinding: t = _asmCore.GetType("System.Windows.Input.InputBinding"); break;
case KnownElements.KeyBinding: t = _asmCore.GetType("System.Windows.Input.KeyBinding"); break;
case KnownElements.KeyGesture: t = _asmCore.GetType("System.Windows.Input.KeyGesture"); break;
case KnownElements.KeyGestureConverter: t = _asmCore.GetType("System.Windows.Input.KeyGestureConverter"); break;
case KnownElements.MouseActionConverter: t = _asmCore.GetType("System.Windows.Input.MouseActionConverter"); break;
case KnownElements.MouseBinding: t = _asmCore.GetType("System.Windows.Input.MouseBinding"); break;
case KnownElements.MouseGesture: t = _asmCore.GetType("System.Windows.Input.MouseGesture"); break;
case KnownElements.MouseGestureConverter: t = _asmCore.GetType("System.Windows.Input.MouseGestureConverter"); break;
case KnownElements.RoutedCommand: t = _asmCore.GetType("System.Windows.Input.RoutedCommand"); break;
case KnownElements.RoutedUICommand: t = _asmCore.GetType("System.Windows.Input.RoutedUICommand"); break;
case KnownElements.Cursor: t = _asmCore.GetType("System.Windows.Input.Cursor"); break;
case KnownElements.CursorConverter: t = _asmCore.GetType("System.Windows.Input.CursorConverter"); break;
case KnownElements.TextComposition: t = _asmCore.GetType("System.Windows.Input.TextComposition"); break;
case KnownElements.FocusManager: t = _asmCore.GetType("System.Windows.Input.FocusManager"); break;
case KnownElements.InputLanguageManager: t = _asmCore.GetType("System.Windows.Input.InputLanguageManager"); break;
case KnownElements.InputManager: t = _asmCore.GetType("System.Windows.Input.InputManager"); break;
case KnownElements.InputMethod: t = _asmCore.GetType("System.Windows.Input.InputMethod"); break;
case KnownElements.InputScope: t = _asmCore.GetType("System.Windows.Input.InputScope"); break;
case KnownElements.InputScopeName: t = _asmCore.GetType("System.Windows.Input.InputScopeName"); break;
case KnownElements.InputScopeConverter: t = _asmCore.GetType("System.Windows.Input.InputScopeConverter"); break;
case KnownElements.InputScopeNameConverter: t = _asmCore.GetType("System.Windows.Input.InputScopeNameConverter"); break;
case KnownElements.KeyboardDevice: t = _asmCore.GetType("System.Windows.Input.KeyboardDevice"); break;
case KnownElements.MouseDevice: t = _asmCore.GetType("System.Windows.Input.MouseDevice"); break;
case KnownElements.HostVisual: t = _asmCore.GetType("System.Windows.Media.HostVisual"); break;
case KnownElements.Stylus: t = _asmCore.GetType("System.Windows.Input.Stylus"); break;
case KnownElements.StylusDevice: t = _asmCore.GetType("System.Windows.Input.StylusDevice"); break;
case KnownElements.TabletDevice: t = _asmCore.GetType("System.Windows.Input.TabletDevice"); break;
case KnownElements.TextCompositionManager: t = _asmCore.GetType("System.Windows.Input.TextCompositionManager"); break;
case KnownElements.CompositionTarget: t = _asmCore.GetType("System.Windows.Media.CompositionTarget"); break;
case KnownElements.PresentationSource: t = _asmCore.GetType("System.Windows.PresentationSource"); break;
case KnownElements.Clock: t = _asmCore.GetType("System.Windows.Media.Animation.Clock"); break;
case KnownElements.AnimationClock: t = _asmCore.GetType("System.Windows.Media.Animation.AnimationClock"); break;
case KnownElements.Timeline: t = _asmCore.GetType("System.Windows.Media.Animation.Timeline"); break;
case KnownElements.AnimationTimeline: t = _asmCore.GetType("System.Windows.Media.Animation.AnimationTimeline"); break;
case KnownElements.ClockController: t = _asmCore.GetType("System.Windows.Media.Animation.ClockController"); break;
case KnownElements.ClockGroup: t = _asmCore.GetType("System.Windows.Media.Animation.ClockGroup"); break;
case KnownElements.DoubleAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleAnimationBase"); break;
case KnownElements.DoubleAnimationUsingPath: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleAnimationUsingPath"); break;
case KnownElements.BooleanAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.BooleanAnimationBase"); break;
case KnownElements.BooleanAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames"); break;
case KnownElements.BooleanKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.BooleanKeyFrameCollection"); break;
case KnownElements.ByteAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.ByteAnimationBase"); break;
case KnownElements.ByteAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.ByteAnimation"); break;
case KnownElements.ByteAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.ByteAnimationUsingKeyFrames"); break;
case KnownElements.ByteKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.ByteKeyFrameCollection"); break;
case KnownElements.CharAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.CharAnimationBase"); break;
case KnownElements.CharAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.CharAnimationUsingKeyFrames"); break;
case KnownElements.CharKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.CharKeyFrameCollection"); break;
case KnownElements.ColorAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.ColorAnimationBase"); break;
case KnownElements.ColorAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.ColorAnimation"); break;
case KnownElements.ColorAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.ColorAnimationUsingKeyFrames"); break;
case KnownElements.ColorKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.ColorKeyFrameCollection"); break;
case KnownElements.DecimalAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.DecimalAnimationBase"); break;
case KnownElements.DecimalAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.DecimalAnimation"); break;
case KnownElements.DecimalAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames"); break;
case KnownElements.DecimalKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.DecimalKeyFrameCollection"); break;
case KnownElements.BooleanKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.BooleanKeyFrame"); break;
case KnownElements.DiscreteBooleanKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteBooleanKeyFrame"); break;
case KnownElements.ByteKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.ByteKeyFrame"); break;
case KnownElements.DiscreteByteKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteByteKeyFrame"); break;
case KnownElements.CharKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.CharKeyFrame"); break;
case KnownElements.DiscreteCharKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteCharKeyFrame"); break;
case KnownElements.ColorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.ColorKeyFrame"); break;
case KnownElements.DiscreteColorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteColorKeyFrame"); break;
case KnownElements.DecimalKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DecimalKeyFrame"); break;
case KnownElements.DiscreteDecimalKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteDecimalKeyFrame"); break;
case KnownElements.DoubleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleKeyFrame"); break;
case KnownElements.DiscreteDoubleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteDoubleKeyFrame"); break;
case KnownElements.Int16KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Int16KeyFrame"); break;
case KnownElements.DiscreteInt16KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteInt16KeyFrame"); break;
case KnownElements.Int32KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Int32KeyFrame"); break;
case KnownElements.DiscreteInt32KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteInt32KeyFrame"); break;
case KnownElements.Int64KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Int64KeyFrame"); break;
case KnownElements.DiscreteInt64KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteInt64KeyFrame"); break;
case KnownElements.MatrixKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.MatrixKeyFrame"); break;
case KnownElements.DiscreteMatrixKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteMatrixKeyFrame"); break;
case KnownElements.ObjectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.ObjectKeyFrame"); break;
case KnownElements.DiscreteObjectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteObjectKeyFrame"); break;
case KnownElements.PointKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.PointKeyFrame"); break;
case KnownElements.DiscretePointKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscretePointKeyFrame"); break;
case KnownElements.Point3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Point3DKeyFrame"); break;
case KnownElements.DiscretePoint3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscretePoint3DKeyFrame"); break;
case KnownElements.QuaternionKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.QuaternionKeyFrame"); break;
case KnownElements.DiscreteQuaternionKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteQuaternionKeyFrame"); break;
case KnownElements.Rotation3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Rotation3DKeyFrame"); break;
case KnownElements.DiscreteRotation3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteRotation3DKeyFrame"); break;
case KnownElements.RectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.RectKeyFrame"); break;
case KnownElements.DiscreteRectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteRectKeyFrame"); break;
case KnownElements.SingleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SingleKeyFrame"); break;
case KnownElements.DiscreteSingleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteSingleKeyFrame"); break;
case KnownElements.SizeKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SizeKeyFrame"); break;
case KnownElements.DiscreteSizeKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteSizeKeyFrame"); break;
case KnownElements.StringKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.StringKeyFrame"); break;
case KnownElements.DiscreteStringKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteStringKeyFrame"); break;
case KnownElements.VectorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.VectorKeyFrame"); break;
case KnownElements.DiscreteVectorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteVectorKeyFrame"); break;
case KnownElements.Vector3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.Vector3DKeyFrame"); break;
case KnownElements.DiscreteVector3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.DiscreteVector3DKeyFrame"); break;
case KnownElements.DoubleAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleAnimation"); break;
case KnownElements.DoubleAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames"); break;
case KnownElements.DoubleKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.DoubleKeyFrameCollection"); break;
case KnownElements.Int16AnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Int16AnimationBase"); break;
case KnownElements.Int16Animation: t = _asmCore.GetType("System.Windows.Media.Animation.Int16Animation"); break;
case KnownElements.Int16AnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Int16AnimationUsingKeyFrames"); break;
case KnownElements.Int16KeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Int16KeyFrameCollection"); break;
case KnownElements.Int32AnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Int32AnimationBase"); break;
case KnownElements.Int32Animation: t = _asmCore.GetType("System.Windows.Media.Animation.Int32Animation"); break;
case KnownElements.Int32AnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Int32AnimationUsingKeyFrames"); break;
case KnownElements.Int32KeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Int32KeyFrameCollection"); break;
case KnownElements.Int64AnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Int64AnimationBase"); break;
case KnownElements.Int64Animation: t = _asmCore.GetType("System.Windows.Media.Animation.Int64Animation"); break;
case KnownElements.Int64AnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Int64AnimationUsingKeyFrames"); break;
case KnownElements.Int64KeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Int64KeyFrameCollection"); break;
case KnownElements.LinearByteKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearByteKeyFrame"); break;
case KnownElements.LinearColorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearColorKeyFrame"); break;
case KnownElements.LinearDecimalKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearDecimalKeyFrame"); break;
case KnownElements.LinearDoubleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearDoubleKeyFrame"); break;
case KnownElements.LinearInt16KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearInt16KeyFrame"); break;
case KnownElements.LinearInt32KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearInt32KeyFrame"); break;
case KnownElements.LinearInt64KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearInt64KeyFrame"); break;
case KnownElements.LinearPointKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearPointKeyFrame"); break;
case KnownElements.LinearPoint3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearPoint3DKeyFrame"); break;
case KnownElements.LinearQuaternionKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearQuaternionKeyFrame"); break;
case KnownElements.LinearRotation3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearRotation3DKeyFrame"); break;
case KnownElements.LinearRectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearRectKeyFrame"); break;
case KnownElements.LinearSingleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearSingleKeyFrame"); break;
case KnownElements.LinearSizeKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearSizeKeyFrame"); break;
case KnownElements.LinearVectorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearVectorKeyFrame"); break;
case KnownElements.LinearVector3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.LinearVector3DKeyFrame"); break;
case KnownElements.MatrixAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.MatrixAnimationBase"); break;
case KnownElements.MatrixAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames"); break;
case KnownElements.MatrixKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.MatrixKeyFrameCollection"); break;
case KnownElements.ObjectAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.ObjectAnimationBase"); break;
case KnownElements.ObjectAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames"); break;
case KnownElements.ObjectKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.ObjectKeyFrameCollection"); break;
case KnownElements.TimelineGroup: t = _asmCore.GetType("System.Windows.Media.Animation.TimelineGroup"); break;
case KnownElements.ParallelTimeline: t = _asmCore.GetType("System.Windows.Media.Animation.ParallelTimeline"); break;
case KnownElements.Point3DAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Point3DAnimationBase"); break;
case KnownElements.Point3DAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.Point3DAnimation"); break;
case KnownElements.Point3DAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames"); break;
case KnownElements.Point3DKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Point3DKeyFrameCollection"); break;
case KnownElements.PointAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.PointAnimationBase"); break;
case KnownElements.PointAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.PointAnimation"); break;
case KnownElements.PointAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.PointAnimationUsingKeyFrames"); break;
case KnownElements.PointKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.PointKeyFrameCollection"); break;
case KnownElements.QuaternionAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.QuaternionAnimationBase"); break;
case KnownElements.QuaternionAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.QuaternionAnimation"); break;
case KnownElements.QuaternionAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames"); break;
case KnownElements.QuaternionKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.QuaternionKeyFrameCollection"); break;
case KnownElements.RectAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.RectAnimationBase"); break;
case KnownElements.RectAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.RectAnimation"); break;
case KnownElements.RectAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.RectAnimationUsingKeyFrames"); break;
case KnownElements.RectKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.RectKeyFrameCollection"); break;
case KnownElements.Rotation3DAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Rotation3DAnimationBase"); break;
case KnownElements.Rotation3DAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.Rotation3DAnimation"); break;
case KnownElements.Rotation3DAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames"); break;
case KnownElements.Rotation3DKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Rotation3DKeyFrameCollection"); break;
case KnownElements.SingleAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.SingleAnimationBase"); break;
case KnownElements.SingleAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.SingleAnimation"); break;
case KnownElements.SingleAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.SingleAnimationUsingKeyFrames"); break;
case KnownElements.SingleKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.SingleKeyFrameCollection"); break;
case KnownElements.SizeAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.SizeAnimationBase"); break;
case KnownElements.SizeAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.SizeAnimation"); break;
case KnownElements.SizeAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.SizeAnimationUsingKeyFrames"); break;
case KnownElements.SizeKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.SizeKeyFrameCollection"); break;
case KnownElements.SplineByteKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineByteKeyFrame"); break;
case KnownElements.SplineColorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineColorKeyFrame"); break;
case KnownElements.SplineDecimalKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineDecimalKeyFrame"); break;
case KnownElements.SplineDoubleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineDoubleKeyFrame"); break;
case KnownElements.SplineInt16KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineInt16KeyFrame"); break;
case KnownElements.SplineInt32KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineInt32KeyFrame"); break;
case KnownElements.SplineInt64KeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineInt64KeyFrame"); break;
case KnownElements.SplinePointKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplinePointKeyFrame"); break;
case KnownElements.SplinePoint3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplinePoint3DKeyFrame"); break;
case KnownElements.SplineQuaternionKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineQuaternionKeyFrame"); break;
case KnownElements.SplineRotation3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineRotation3DKeyFrame"); break;
case KnownElements.SplineRectKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineRectKeyFrame"); break;
case KnownElements.SplineSingleKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineSingleKeyFrame"); break;
case KnownElements.SplineSizeKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineSizeKeyFrame"); break;
case KnownElements.SplineVectorKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineVectorKeyFrame"); break;
case KnownElements.SplineVector3DKeyFrame: t = _asmCore.GetType("System.Windows.Media.Animation.SplineVector3DKeyFrame"); break;
case KnownElements.StringAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.StringAnimationBase"); break;
case KnownElements.StringAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.StringAnimationUsingKeyFrames"); break;
case KnownElements.StringKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.StringKeyFrameCollection"); break;
case KnownElements.TimelineCollection: t = _asmCore.GetType("System.Windows.Media.Animation.TimelineCollection"); break;
case KnownElements.Vector3DAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.Vector3DAnimationBase"); break;
case KnownElements.Vector3DAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.Vector3DAnimation"); break;
case KnownElements.Vector3DAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames"); break;
case KnownElements.Vector3DKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.Vector3DKeyFrameCollection"); break;
case KnownElements.VectorAnimationBase: t = _asmCore.GetType("System.Windows.Media.Animation.VectorAnimationBase"); break;
case KnownElements.VectorAnimation: t = _asmCore.GetType("System.Windows.Media.Animation.VectorAnimation"); break;
case KnownElements.VectorAnimationUsingKeyFrames: t = _asmCore.GetType("System.Windows.Media.Animation.VectorAnimationUsingKeyFrames"); break;
case KnownElements.VectorKeyFrameCollection: t = _asmCore.GetType("System.Windows.Media.Animation.VectorKeyFrameCollection"); break;
case KnownElements.KeySpline: t = _asmCore.GetType("System.Windows.Media.Animation.KeySpline"); break;
case KnownElements.KeySplineConverter: t = _asmCore.GetType("System.Windows.KeySplineConverter"); break;
case KnownElements.KeyTime: t = _asmCore.GetType("System.Windows.Media.Animation.KeyTime"); break;
case KnownElements.KeyTimeConverter: t = _asmCore.GetType("System.Windows.KeyTimeConverter"); break;
case KnownElements.MatrixAnimationUsingPath: t = _asmCore.GetType("System.Windows.Media.Animation.MatrixAnimationUsingPath"); break;
case KnownElements.PointAnimationUsingPath: t = _asmCore.GetType("System.Windows.Media.Animation.PointAnimationUsingPath"); break;
case KnownElements.RepeatBehavior: t = _asmCore.GetType("System.Windows.Media.Animation.RepeatBehavior"); break;
case KnownElements.RepeatBehaviorConverter: t = _asmCore.GetType("System.Windows.Media.Animation.RepeatBehaviorConverter"); break;
case KnownElements.PathSegment: t = _asmCore.GetType("System.Windows.Media.PathSegment"); break;
case KnownElements.ArcSegment: t = _asmCore.GetType("System.Windows.Media.ArcSegment"); break;
case KnownElements.BezierSegment: t = _asmCore.GetType("System.Windows.Media.BezierSegment"); break;
case KnownElements.DrawingContext: t = _asmCore.GetType("System.Windows.Media.DrawingContext"); break;
case KnownElements.Brush: t = _asmCore.GetType("System.Windows.Media.Brush"); break;
case KnownElements.Color: t = _asmCore.GetType("System.Windows.Media.Color"); break;
case KnownElements.ColorConverter: t = _asmCore.GetType("System.Windows.Media.ColorConverter"); break;
case KnownElements.Geometry: t = _asmCore.GetType("System.Windows.Media.Geometry"); break;
case KnownElements.CombinedGeometry: t = _asmCore.GetType("System.Windows.Media.CombinedGeometry"); break;
case KnownElements.DashStyle: t = _asmCore.GetType("System.Windows.Media.DashStyle"); break;
case KnownElements.Drawing: t = _asmCore.GetType("System.Windows.Media.Drawing"); break;
case KnownElements.TileBrush: t = _asmCore.GetType("System.Windows.Media.TileBrush"); break;
case KnownElements.DrawingBrush: t = _asmCore.GetType("System.Windows.Media.DrawingBrush"); break;
case KnownElements.DrawingCollection: t = _asmCore.GetType("System.Windows.Media.DrawingCollection"); break;
case KnownElements.DrawingGroup: t = _asmCore.GetType("System.Windows.Media.DrawingGroup"); break;
case KnownElements.ImageSource: t = _asmCore.GetType("System.Windows.Media.ImageSource"); break;
case KnownElements.DrawingImage: t = _asmCore.GetType("System.Windows.Media.DrawingImage"); break;
case KnownElements.BitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.BitmapEffect"); break;
case KnownElements.BitmapEffectGroup: t = _asmCore.GetType("System.Windows.Media.Effects.BitmapEffectGroup"); break;
case KnownElements.BitmapEffectInput: t = _asmCore.GetType("System.Windows.Media.Effects.BitmapEffectInput"); break;
case KnownElements.BevelBitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.BevelBitmapEffect"); break;
case KnownElements.BlurBitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.BlurBitmapEffect"); break;
case KnownElements.DropShadowBitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.DropShadowBitmapEffect"); break;
case KnownElements.EmbossBitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.EmbossBitmapEffect"); break;
case KnownElements.OuterGlowBitmapEffect: t = _asmCore.GetType("System.Windows.Media.Effects.OuterGlowBitmapEffect"); break;
case KnownElements.BitmapEffectCollection: t = _asmCore.GetType("System.Windows.Media.Effects.BitmapEffectCollection"); break;
case KnownElements.EllipseGeometry: t = _asmCore.GetType("System.Windows.Media.EllipseGeometry"); break;
case KnownElements.FontFamily: t = _asmCore.GetType("System.Windows.Media.FontFamily"); break;
case KnownElements.FontFamilyConverter: t = _asmCore.GetType("System.Windows.Media.FontFamilyConverter"); break;
case KnownElements.GeneralTransformGroup: t = _asmCore.GetType("System.Windows.Media.GeneralTransformGroup"); break;
case KnownElements.BrushConverter: t = _asmCore.GetType("System.Windows.Media.BrushConverter"); break;
case KnownElements.DoubleCollection: t = _asmCore.GetType("System.Windows.Media.DoubleCollection"); break;
case KnownElements.DoubleCollectionConverter: t = _asmCore.GetType("System.Windows.Media.DoubleCollectionConverter"); break;
case KnownElements.GeneralTransformCollection: t = _asmCore.GetType("System.Windows.Media.GeneralTransformCollection"); break;
case KnownElements.GeometryCollection: t = _asmCore.GetType("System.Windows.Media.GeometryCollection"); break;
case KnownElements.GeometryConverter: t = _asmCore.GetType("System.Windows.Media.GeometryConverter"); break;
case KnownElements.GeometryDrawing: t = _asmCore.GetType("System.Windows.Media.GeometryDrawing"); break;
case KnownElements.GeometryGroup: t = _asmCore.GetType("System.Windows.Media.GeometryGroup"); break;
case KnownElements.GlyphRunDrawing: t = _asmCore.GetType("System.Windows.Media.GlyphRunDrawing"); break;
case KnownElements.GradientBrush: t = _asmCore.GetType("System.Windows.Media.GradientBrush"); break;
case KnownElements.GradientStop: t = _asmCore.GetType("System.Windows.Media.GradientStop"); break;
case KnownElements.GradientStopCollection: t = _asmCore.GetType("System.Windows.Media.GradientStopCollection"); break;
case KnownElements.ImageBrush: t = _asmCore.GetType("System.Windows.Media.ImageBrush"); break;
case KnownElements.ImageDrawing: t = _asmCore.GetType("System.Windows.Media.ImageDrawing"); break;
case KnownElements.Int32Collection: t = _asmCore.GetType("System.Windows.Media.Int32Collection"); break;
case KnownElements.Int32CollectionConverter: t = _asmCore.GetType("System.Windows.Media.Int32CollectionConverter"); break;
case KnownElements.LinearGradientBrush: t = _asmCore.GetType("System.Windows.Media.LinearGradientBrush"); break;
case KnownElements.LineGeometry: t = _asmCore.GetType("System.Windows.Media.LineGeometry"); break;
case KnownElements.LineSegment: t = _asmCore.GetType("System.Windows.Media.LineSegment"); break;
case KnownElements.Transform: t = _asmCore.GetType("System.Windows.Media.Transform"); break;
case KnownElements.MatrixTransform: t = _asmCore.GetType("System.Windows.Media.MatrixTransform"); break;
case KnownElements.MediaTimeline: t = _asmCore.GetType("System.Windows.Media.MediaTimeline"); break;
case KnownElements.PathFigure: t = _asmCore.GetType("System.Windows.Media.PathFigure"); break;
case KnownElements.PathFigureCollection: t = _asmCore.GetType("System.Windows.Media.PathFigureCollection"); break;
case KnownElements.PathFigureCollectionConverter: t = _asmCore.GetType("System.Windows.Media.PathFigureCollectionConverter"); break;
case KnownElements.PathGeometry: t = _asmCore.GetType("System.Windows.Media.PathGeometry"); break;
case KnownElements.PathSegmentCollection: t = _asmCore.GetType("System.Windows.Media.PathSegmentCollection"); break;
case KnownElements.Pen: t = _asmCore.GetType("System.Windows.Media.Pen"); break;
case KnownElements.PointCollection: t = _asmCore.GetType("System.Windows.Media.PointCollection"); break;
case KnownElements.PointCollectionConverter: t = _asmCore.GetType("System.Windows.Media.PointCollectionConverter"); break;
case KnownElements.PolyBezierSegment: t = _asmCore.GetType("System.Windows.Media.PolyBezierSegment"); break;
case KnownElements.PolyLineSegment: t = _asmCore.GetType("System.Windows.Media.PolyLineSegment"); break;
case KnownElements.PolyQuadraticBezierSegment: t = _asmCore.GetType("System.Windows.Media.PolyQuadraticBezierSegment"); break;
case KnownElements.QuadraticBezierSegment: t = _asmCore.GetType("System.Windows.Media.QuadraticBezierSegment"); break;
case KnownElements.RadialGradientBrush: t = _asmCore.GetType("System.Windows.Media.RadialGradientBrush"); break;
case KnownElements.RectangleGeometry: t = _asmCore.GetType("System.Windows.Media.RectangleGeometry"); break;
case KnownElements.RotateTransform: t = _asmCore.GetType("System.Windows.Media.RotateTransform"); break;
case KnownElements.ScaleTransform: t = _asmCore.GetType("System.Windows.Media.ScaleTransform"); break;
case KnownElements.SkewTransform: t = _asmCore.GetType("System.Windows.Media.SkewTransform"); break;
case KnownElements.SolidColorBrush: t = _asmCore.GetType("System.Windows.Media.SolidColorBrush"); break;
case KnownElements.StreamGeometry: t = _asmCore.GetType("System.Windows.Media.StreamGeometry"); break;
case KnownElements.TextEffect: t = _asmCore.GetType("System.Windows.Media.TextEffect"); break;
case KnownElements.TextEffectCollection: t = _asmCore.GetType("System.Windows.Media.TextEffectCollection"); break;
case KnownElements.TransformCollection: t = _asmCore.GetType("System.Windows.Media.TransformCollection"); break;
case KnownElements.TransformConverter: t = _asmCore.GetType("System.Windows.Media.TransformConverter"); break;
case KnownElements.TransformGroup: t = _asmCore.GetType("System.Windows.Media.TransformGroup"); break;
case KnownElements.TranslateTransform: t = _asmCore.GetType("System.Windows.Media.TranslateTransform"); break;
case KnownElements.VectorCollection: t = _asmCore.GetType("System.Windows.Media.VectorCollection"); break;
case KnownElements.VectorCollectionConverter: t = _asmCore.GetType("System.Windows.Media.VectorCollectionConverter"); break;
case KnownElements.VisualBrush: t = _asmCore.GetType("System.Windows.Media.VisualBrush"); break;
case KnownElements.VideoDrawing: t = _asmCore.GetType("System.Windows.Media.VideoDrawing"); break;
case KnownElements.GuidelineSet: t = _asmCore.GetType("System.Windows.Media.GuidelineSet"); break;
case KnownElements.GlyphRun: t = _asmCore.GetType("System.Windows.Media.GlyphRun"); break;
case KnownElements.GlyphTypeface: t = _asmCore.GetType("System.Windows.Media.GlyphTypeface"); break;
case KnownElements.ImageMetadata: t = _asmCore.GetType("System.Windows.Media.ImageMetadata"); break;
case KnownElements.ImageSourceConverter: t = _asmCore.GetType("System.Windows.Media.ImageSourceConverter"); break;
case KnownElements.BitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapDecoder"); break;
case KnownElements.BitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapEncoder"); break;
case KnownElements.BmpBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.BmpBitmapDecoder"); break;
case KnownElements.BmpBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.BmpBitmapEncoder"); break;
case KnownElements.BitmapSource: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapSource"); break;
case KnownElements.BitmapFrame: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapFrame"); break;
case KnownElements.BitmapMetadata: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapMetadata"); break;
case KnownElements.BitmapPalette: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapPalette"); break;
case KnownElements.BitmapImage: t = _asmCore.GetType("System.Windows.Media.Imaging.BitmapImage"); break;
case KnownElements.CachedBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.CachedBitmap"); break;
case KnownElements.ColorConvertedBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.ColorConvertedBitmap"); break;
case KnownElements.CroppedBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.CroppedBitmap"); break;
case KnownElements.FormatConvertedBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.FormatConvertedBitmap"); break;
case KnownElements.GifBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.GifBitmapDecoder"); break;
case KnownElements.GifBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.GifBitmapEncoder"); break;
case KnownElements.IconBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.IconBitmapDecoder"); break;
case KnownElements.InPlaceBitmapMetadataWriter: t = _asmCore.GetType("System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter"); break;
case KnownElements.LateBoundBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.LateBoundBitmapDecoder"); break;
case KnownElements.JpegBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.JpegBitmapDecoder"); break;
case KnownElements.JpegBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.JpegBitmapEncoder"); break;
case KnownElements.PngBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.PngBitmapDecoder"); break;
case KnownElements.PngBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.PngBitmapEncoder"); break;
case KnownElements.RenderTargetBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.RenderTargetBitmap"); break;
case KnownElements.TiffBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.TiffBitmapDecoder"); break;
case KnownElements.TiffBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.TiffBitmapEncoder"); break;
case KnownElements.WmpBitmapDecoder: t = _asmCore.GetType("System.Windows.Media.Imaging.WmpBitmapDecoder"); break;
case KnownElements.WmpBitmapEncoder: t = _asmCore.GetType("System.Windows.Media.Imaging.WmpBitmapEncoder"); break;
case KnownElements.TransformedBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.TransformedBitmap"); break;
case KnownElements.WriteableBitmap: t = _asmCore.GetType("System.Windows.Media.Imaging.WriteableBitmap"); break;
case KnownElements.MediaClock: t = _asmCore.GetType("System.Windows.Media.MediaClock"); break;
case KnownElements.MediaPlayer: t = _asmCore.GetType("System.Windows.Media.MediaPlayer"); break;
case KnownElements.PixelFormat: t = _asmCore.GetType("System.Windows.Media.PixelFormat"); break;
case KnownElements.PixelFormatConverter: t = _asmCore.GetType("System.Windows.Media.PixelFormatConverter"); break;
case KnownElements.RenderOptions: t = _asmCore.GetType("System.Windows.Media.RenderOptions"); break;
case KnownElements.NumberSubstitution: t = _asmCore.GetType("System.Windows.Media.NumberSubstitution"); break;
case KnownElements.VisualTarget: t = _asmCore.GetType("System.Windows.Media.VisualTarget"); break;
case KnownElements.Transform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Transform3D"); break;
case KnownElements.AffineTransform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.AffineTransform3D"); break;
case KnownElements.Model3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Model3D"); break;
case KnownElements.Light: t = _asmCore.GetType("System.Windows.Media.Media3D.Light"); break;
case KnownElements.AmbientLight: t = _asmCore.GetType("System.Windows.Media.Media3D.AmbientLight"); break;
case KnownElements.Rotation3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Rotation3D"); break;
case KnownElements.AxisAngleRotation3D: t = _asmCore.GetType("System.Windows.Media.Media3D.AxisAngleRotation3D"); break;
case KnownElements.Camera: t = _asmCore.GetType("System.Windows.Media.Media3D.Camera"); break;
case KnownElements.Material: t = _asmCore.GetType("System.Windows.Media.Media3D.Material"); break;
case KnownElements.DiffuseMaterial: t = _asmCore.GetType("System.Windows.Media.Media3D.DiffuseMaterial"); break;
case KnownElements.DirectionalLight: t = _asmCore.GetType("System.Windows.Media.Media3D.DirectionalLight"); break;
case KnownElements.EmissiveMaterial: t = _asmCore.GetType("System.Windows.Media.Media3D.EmissiveMaterial"); break;
case KnownElements.Geometry3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Geometry3D"); break;
case KnownElements.GeometryModel3D: t = _asmCore.GetType("System.Windows.Media.Media3D.GeometryModel3D"); break;
case KnownElements.MaterialGroup: t = _asmCore.GetType("System.Windows.Media.Media3D.MaterialGroup"); break;
case KnownElements.Matrix3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Matrix3D"); break;
case KnownElements.MatrixCamera: t = _asmCore.GetType("System.Windows.Media.Media3D.MatrixCamera"); break;
case KnownElements.MatrixTransform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.MatrixTransform3D"); break;
case KnownElements.MeshGeometry3D: t = _asmCore.GetType("System.Windows.Media.Media3D.MeshGeometry3D"); break;
case KnownElements.Model3DGroup: t = _asmCore.GetType("System.Windows.Media.Media3D.Model3DGroup"); break;
case KnownElements.ModelVisual3D: t = _asmCore.GetType("System.Windows.Media.Media3D.ModelVisual3D"); break;
case KnownElements.Point3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Point3D"); break;
case KnownElements.Point3DCollection: t = _asmCore.GetType("System.Windows.Media.Media3D.Point3DCollection"); break;
case KnownElements.Vector3DCollection: t = _asmCore.GetType("System.Windows.Media.Media3D.Vector3DCollection"); break;
case KnownElements.Point4D: t = _asmCore.GetType("System.Windows.Media.Media3D.Point4D"); break;
case KnownElements.PointLightBase: t = _asmCore.GetType("System.Windows.Media.Media3D.PointLightBase"); break;
case KnownElements.PointLight: t = _asmCore.GetType("System.Windows.Media.Media3D.PointLight"); break;
case KnownElements.ProjectionCamera: t = _asmCore.GetType("System.Windows.Media.Media3D.ProjectionCamera"); break;
case KnownElements.OrthographicCamera: t = _asmCore.GetType("System.Windows.Media.Media3D.OrthographicCamera"); break;
case KnownElements.PerspectiveCamera: t = _asmCore.GetType("System.Windows.Media.Media3D.PerspectiveCamera"); break;
case KnownElements.Quaternion: t = _asmCore.GetType("System.Windows.Media.Media3D.Quaternion"); break;
case KnownElements.QuaternionRotation3D: t = _asmCore.GetType("System.Windows.Media.Media3D.QuaternionRotation3D"); break;
case KnownElements.Rect3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Rect3D"); break;
case KnownElements.RotateTransform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.RotateTransform3D"); break;
case KnownElements.ScaleTransform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.ScaleTransform3D"); break;
case KnownElements.Size3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Size3D"); break;
case KnownElements.SpecularMaterial: t = _asmCore.GetType("System.Windows.Media.Media3D.SpecularMaterial"); break;
case KnownElements.SpotLight: t = _asmCore.GetType("System.Windows.Media.Media3D.SpotLight"); break;
case KnownElements.Transform3DGroup: t = _asmCore.GetType("System.Windows.Media.Media3D.Transform3DGroup"); break;
case KnownElements.TranslateTransform3D: t = _asmCore.GetType("System.Windows.Media.Media3D.TranslateTransform3D"); break;
case KnownElements.Vector3D: t = _asmCore.GetType("System.Windows.Media.Media3D.Vector3D"); break;
case KnownElements.Viewport3DVisual: t = _asmCore.GetType("System.Windows.Media.Media3D.Viewport3DVisual"); break;
case KnownElements.MaterialCollection: t = _asmCore.GetType("System.Windows.Media.Media3D.MaterialCollection"); break;
case KnownElements.Matrix3DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Matrix3DConverter"); break;
case KnownElements.Model3DCollection: t = _asmCore.GetType("System.Windows.Media.Media3D.Model3DCollection"); break;
case KnownElements.Point3DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Point3DConverter"); break;
case KnownElements.Point3DCollectionConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Point3DCollectionConverter"); break;
case KnownElements.Point4DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Point4DConverter"); break;
case KnownElements.QuaternionConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.QuaternionConverter"); break;
case KnownElements.Rect3DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Rect3DConverter"); break;
case KnownElements.Size3DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Size3DConverter"); break;
case KnownElements.Transform3DCollection: t = _asmCore.GetType("System.Windows.Media.Media3D.Transform3DCollection"); break;
case KnownElements.Vector3DConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Vector3DConverter"); break;
case KnownElements.Vector3DCollectionConverter: t = _asmCore.GetType("System.Windows.Media.Media3D.Vector3DCollectionConverter"); break;
case KnownElements.XmlLanguage: t = _asmCore.GetType("System.Windows.Markup.XmlLanguage"); break;
case KnownElements.XmlLanguageConverter: t = _asmCore.GetType("System.Windows.Markup.XmlLanguageConverter"); break;
case KnownElements.Point: t = _asmBase.GetType("System.Windows.Point"); break;
case KnownElements.Size: t = _asmBase.GetType("System.Windows.Size"); break;
case KnownElements.Vector: t = _asmBase.GetType("System.Windows.Vector"); break;
case KnownElements.Rect: t = _asmBase.GetType("System.Windows.Rect"); break;
case KnownElements.Matrix: t = _asmBase.GetType("System.Windows.Media.Matrix"); break;
case KnownElements.DependencyProperty: t = _asmBase.GetType("System.Windows.DependencyProperty"); break;
case KnownElements.DependencyObject: t = _asmBase.GetType("System.Windows.DependencyObject"); break;
case KnownElements.Expression: t = _asmBase.GetType("System.Windows.Expression"); break;
case KnownElements.Freezable: t = _asmBase.GetType("System.Windows.Freezable"); break;
case KnownElements.WeakEventManager: t = _asmBase.GetType("System.Windows.WeakEventManager"); break;
case KnownElements.Int32Rect: t = _asmBase.GetType("System.Windows.Int32Rect"); break;
case KnownElements.ExpressionConverter: t = _asmBase.GetType("System.Windows.ExpressionConverter"); break;
case KnownElements.Int32RectConverter: t = _asmBase.GetType("System.Windows.Int32RectConverter"); break;
case KnownElements.PointConverter: t = _asmBase.GetType("System.Windows.PointConverter"); break;
case KnownElements.RectConverter: t = _asmBase.GetType("System.Windows.RectConverter"); break;
case KnownElements.SizeConverter: t = _asmBase.GetType("System.Windows.SizeConverter"); break;
case KnownElements.VectorConverter: t = _asmBase.GetType("System.Windows.VectorConverter"); break;
case KnownElements.KeyConverter: t = _asmBase.GetType("System.Windows.Input.KeyConverter"); break;
case KnownElements.MatrixConverter: t = _asmBase.GetType("System.Windows.Media.MatrixConverter"); break;
case KnownElements.MarkupExtension: t = _asmBase.GetType("System.Windows.Markup.MarkupExtension"); break;
case KnownElements.ModifierKeysConverter: t = _asmBase.GetType("System.Windows.Input.ModifierKeysConverter"); break;
case KnownElements.FrameworkPropertyMetadataOptions: t = _asmFramework.GetType("System.Windows.FrameworkPropertyMetadataOptions"); break;
case KnownElements.NullExtension: t = _asmFramework.GetType("System.Windows.Markup.NullExtension"); break;
case KnownElements.StaticExtension: t = _asmFramework.GetType("System.Windows.Markup.StaticExtension"); break;
case KnownElements.ArrayExtension: t = _asmFramework.GetType("System.Windows.Markup.ArrayExtension"); break;
case KnownElements.TypeExtension: t = _asmFramework.GetType("System.Windows.Markup.TypeExtension"); break;
case KnownElements.IStyleConnector: t = _asmFramework.GetType("System.Windows.Markup.IStyleConnector"); break;
case KnownElements.ParserContext: t = _asmFramework.GetType("System.Windows.Markup.ParserContext"); break;
case KnownElements.XamlReader: t = _asmFramework.GetType("System.Windows.Markup.XamlReader"); break;
case KnownElements.XamlWriter: t = _asmFramework.GetType("System.Windows.Markup.XamlWriter"); break;
case KnownElements.StreamResourceInfo: t = _asmFramework.GetType("System.Windows.Resources.StreamResourceInfo"); break;
case KnownElements.CommandConverter: t = _asmFramework.GetType("System.Windows.Input.CommandConverter"); break;
case KnownElements.DependencyPropertyConverter: t = _asmFramework.GetType("System.Windows.Markup.DependencyPropertyConverter"); break;
case KnownElements.ComponentResourceKeyConverter: t = _asmFramework.GetType("System.Windows.Markup.ComponentResourceKeyConverter"); break;
case KnownElements.TemplateKeyConverter: t = _asmFramework.GetType("System.Windows.Markup.TemplateKeyConverter"); break;
case KnownElements.RoutedEventConverter: t = _asmFramework.GetType("System.Windows.Markup.RoutedEventConverter"); break;
case KnownElements.FrameworkPropertyMetadata: t = _asmFramework.GetType("System.Windows.FrameworkPropertyMetadata"); break;
case KnownElements.Condition: t = _asmFramework.GetType("System.Windows.Condition"); break;
case KnownElements.FrameworkElementFactory: t = _asmFramework.GetType("System.Windows.FrameworkElementFactory"); break;
case KnownElements.IAddChild: t = _asmCore.GetType("System.Windows.Markup.IAddChild"); break;
case KnownElements.IAddChildInternal: t = _asmCore.GetType("System.Windows.Markup.IAddChildInternal"); break;
case KnownElements.RoutingStrategy: t = _asmCore.GetType("System.Windows.RoutingStrategy"); break;
case KnownElements.EventManager: t = _asmCore.GetType("System.Windows.EventManager"); break;
case KnownElements.XmlLangPropertyAttribute: t = _asmBase.GetType("System.Windows.Markup.XmlLangPropertyAttribute"); break;
case KnownElements.INameScope: t = _asmBase.GetType("System.Windows.Markup.INameScope"); break;
case KnownElements.IComponentConnector: t = _asmBase.GetType("System.Windows.Markup.IComponentConnector"); break;
case KnownElements.RuntimeNamePropertyAttribute: t = _asmBase.GetType("System.Windows.Markup.RuntimeNamePropertyAttribute"); break;
case KnownElements.ContentPropertyAttribute: t = _asmBase.GetType("System.Windows.Markup.ContentPropertyAttribute"); break;
case KnownElements.WhitespaceSignificantCollectionAttribute: t = _asmBase.GetType("System.Windows.Markup.WhitespaceSignificantCollectionAttribute"); break;
case KnownElements.ContentWrapperAttribute: t = _asmBase.GetType("System.Windows.Markup.ContentWrapperAttribute"); break;
case KnownElements.InlineCollection: t = _asmFramework.GetType("System.Windows.Documents.InlineCollection"); break;
case KnownElements.XamlStyleSerializer: t = typeof(XamlStyleSerializer); break;
case KnownElements.XamlTemplateSerializer: t = typeof(XamlTemplateSerializer); break;
case KnownElements.XamlBrushSerializer: t = typeof(XamlBrushSerializer); break;
case KnownElements.XamlPoint3DCollectionSerializer: t = typeof(XamlPoint3DCollectionSerializer); break;
case KnownElements.XamlVector3DCollectionSerializer: t = typeof(XamlVector3DCollectionSerializer); break;
case KnownElements.XamlPointCollectionSerializer: t = typeof(XamlPointCollectionSerializer); break;
case KnownElements.XamlInt32CollectionSerializer: t = typeof(XamlInt32CollectionSerializer); break;
case KnownElements.XamlPathDataSerializer: t = typeof(XamlPathDataSerializer); break;
case KnownElements.TypeTypeConverter: t = typeof(TypeTypeConverter); break;
case KnownElements.Boolean: t = typeof(Boolean); break;
case KnownElements.Int16: t = typeof(Int16); break;
case KnownElements.Int32: t = typeof(Int32); break;
case KnownElements.Int64: t = typeof(Int64); break;
case KnownElements.UInt16: t = typeof(UInt16); break;
case KnownElements.UInt32: t = typeof(UInt32); break;
case KnownElements.UInt64: t = typeof(UInt64); break;
case KnownElements.Single: t = typeof(Single); break;
case KnownElements.Double: t = typeof(Double); break;
case KnownElements.Object: t = typeof(Object); break;
case KnownElements.String: t = typeof(String); break;
case KnownElements.Byte: t = typeof(Byte); break;
case KnownElements.SByte: t = typeof(SByte); break;
case KnownElements.Char: t = typeof(Char); break;
case KnownElements.Decimal: t = typeof(Decimal); break;
case KnownElements.TimeSpan: t = typeof(TimeSpan); break;
case KnownElements.Guid: t = typeof(Guid); break;
case KnownElements.DateTime: t = typeof(DateTime); break;
case KnownElements.Uri: t = typeof(Uri); break;
case KnownElements.CultureInfo: t = typeof(CultureInfo); break;
case KnownElements.EnumConverter: t = typeof(EnumConverter); break;
case KnownElements.NullableConverter: t = typeof(NullableConverter); break;
case KnownElements.BooleanConverter: t = typeof(BooleanConverter); break;
case KnownElements.Int16Converter: t = typeof(Int16Converter); break;
case KnownElements.Int32Converter: t = typeof(Int32Converter); break;
case KnownElements.Int64Converter: t = typeof(Int64Converter); break;
case KnownElements.UInt16Converter: t = typeof(UInt16Converter); break;
case KnownElements.UInt32Converter: t = typeof(UInt32Converter); break;
case KnownElements.UInt64Converter: t = typeof(UInt64Converter); break;
case KnownElements.SingleConverter: t = typeof(SingleConverter); break;
case KnownElements.DoubleConverter: t = typeof(DoubleConverter); break;
case KnownElements.StringConverter: t = typeof(StringConverter); break;
case KnownElements.ByteConverter: t = typeof(ByteConverter); break;
case KnownElements.SByteConverter: t = typeof(SByteConverter); break;
case KnownElements.CharConverter: t = typeof(CharConverter); break;
case KnownElements.DecimalConverter: t = typeof(DecimalConverter); break;
case KnownElements.TimeSpanConverter: t = typeof(TimeSpanConverter); break;
case KnownElements.GuidConverter: t = typeof(GuidConverter); break;
case KnownElements.CultureInfoConverter: t = typeof(CultureInfoConverter); break;
case KnownElements.DateTimeConverter: t = typeof(DateTimeConverter); break;
case KnownElements.DateTimeConverter2: t = typeof(DateTimeConverter2); break;
case KnownElements.UriTypeConverter: t = typeof(UriTypeConverter); break;
}
if(t == null)
{
MarkupCompiler.ThrowCompilerException(SRID.ParserInvalidKnownType, ((int)knownElement).ToString(CultureInfo.InvariantCulture), knownElement.ToString());
}
return t;
}
#else
// Initialize the Known WCP types from basic WCP assemblies
private Type InitializeOneType(KnownElements knownElement)
{
Type t = null;
switch(knownElement)
{
case KnownElements.AccessText: t = typeof(System.Windows.Controls.AccessText); break;
case KnownElements.AdornedElementPlaceholder: t = typeof(System.Windows.Controls.AdornedElementPlaceholder); break;
case KnownElements.Adorner: t = typeof(System.Windows.Documents.Adorner); break;
case KnownElements.AdornerDecorator: t = typeof(System.Windows.Documents.AdornerDecorator); break;
case KnownElements.AdornerLayer: t = typeof(System.Windows.Documents.AdornerLayer); break;
case KnownElements.AffineTransform3D: t = typeof(System.Windows.Media.Media3D.AffineTransform3D); break;
case KnownElements.AmbientLight: t = typeof(System.Windows.Media.Media3D.AmbientLight); break;
case KnownElements.AnchoredBlock: t = typeof(System.Windows.Documents.AnchoredBlock); break;
case KnownElements.Animatable: t = typeof(System.Windows.Media.Animation.Animatable); break;
case KnownElements.AnimationClock: t = typeof(System.Windows.Media.Animation.AnimationClock); break;
case KnownElements.AnimationTimeline: t = typeof(System.Windows.Media.Animation.AnimationTimeline); break;
case KnownElements.Application: t = typeof(System.Windows.Application); break;
case KnownElements.ArcSegment: t = typeof(System.Windows.Media.ArcSegment); break;
case KnownElements.ArrayExtension: t = typeof(System.Windows.Markup.ArrayExtension); break;
case KnownElements.AxisAngleRotation3D: t = typeof(System.Windows.Media.Media3D.AxisAngleRotation3D); break;
case KnownElements.BaseIListConverter: t = typeof(System.Windows.Media.Converters.BaseIListConverter); break;
case KnownElements.BeginStoryboard: t = typeof(System.Windows.Media.Animation.BeginStoryboard); break;
case KnownElements.BevelBitmapEffect: t = typeof(System.Windows.Media.Effects.BevelBitmapEffect); break;
case KnownElements.BezierSegment: t = typeof(System.Windows.Media.BezierSegment); break;
case KnownElements.Binding: t = typeof(System.Windows.Data.Binding); break;
case KnownElements.BindingBase: t = typeof(System.Windows.Data.BindingBase); break;
case KnownElements.BindingExpression: t = typeof(System.Windows.Data.BindingExpression); break;
case KnownElements.BindingExpressionBase: t = typeof(System.Windows.Data.BindingExpressionBase); break;
case KnownElements.BindingListCollectionView: t = typeof(System.Windows.Data.BindingListCollectionView); break;
case KnownElements.BitmapDecoder: t = typeof(System.Windows.Media.Imaging.BitmapDecoder); break;
case KnownElements.BitmapEffect: t = typeof(System.Windows.Media.Effects.BitmapEffect); break;
case KnownElements.BitmapEffectCollection: t = typeof(System.Windows.Media.Effects.BitmapEffectCollection); break;
case KnownElements.BitmapEffectGroup: t = typeof(System.Windows.Media.Effects.BitmapEffectGroup); break;
case KnownElements.BitmapEffectInput: t = typeof(System.Windows.Media.Effects.BitmapEffectInput); break;
case KnownElements.BitmapEncoder: t = typeof(System.Windows.Media.Imaging.BitmapEncoder); break;
case KnownElements.BitmapFrame: t = typeof(System.Windows.Media.Imaging.BitmapFrame); break;
case KnownElements.BitmapImage: t = typeof(System.Windows.Media.Imaging.BitmapImage); break;
case KnownElements.BitmapMetadata: t = typeof(System.Windows.Media.Imaging.BitmapMetadata); break;
case KnownElements.BitmapPalette: t = typeof(System.Windows.Media.Imaging.BitmapPalette); break;
case KnownElements.BitmapSource: t = typeof(System.Windows.Media.Imaging.BitmapSource); break;
case KnownElements.Block: t = typeof(System.Windows.Documents.Block); break;
case KnownElements.BlockUIContainer: t = typeof(System.Windows.Documents.BlockUIContainer); break;
case KnownElements.BlurBitmapEffect: t = typeof(System.Windows.Media.Effects.BlurBitmapEffect); break;
case KnownElements.BmpBitmapDecoder: t = typeof(System.Windows.Media.Imaging.BmpBitmapDecoder); break;
case KnownElements.BmpBitmapEncoder: t = typeof(System.Windows.Media.Imaging.BmpBitmapEncoder); break;
case KnownElements.Bold: t = typeof(System.Windows.Documents.Bold); break;
case KnownElements.BoolIListConverter: t = typeof(System.Windows.Media.Converters.BoolIListConverter); break;
case KnownElements.Boolean: t = typeof(System.Boolean); break;
case KnownElements.BooleanAnimationBase: t = typeof(System.Windows.Media.Animation.BooleanAnimationBase); break;
case KnownElements.BooleanAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames); break;
case KnownElements.BooleanConverter: t = typeof(System.ComponentModel.BooleanConverter); break;
case KnownElements.BooleanKeyFrame: t = typeof(System.Windows.Media.Animation.BooleanKeyFrame); break;
case KnownElements.BooleanKeyFrameCollection: t = typeof(System.Windows.Media.Animation.BooleanKeyFrameCollection); break;
case KnownElements.BooleanToVisibilityConverter: t = typeof(System.Windows.Controls.BooleanToVisibilityConverter); break;
case KnownElements.Border: t = typeof(System.Windows.Controls.Border); break;
case KnownElements.BorderGapMaskConverter: t = typeof(System.Windows.Controls.BorderGapMaskConverter); break;
case KnownElements.Brush: t = typeof(System.Windows.Media.Brush); break;
case KnownElements.BrushConverter: t = typeof(System.Windows.Media.BrushConverter); break;
case KnownElements.BulletDecorator: t = typeof(System.Windows.Controls.Primitives.BulletDecorator); break;
case KnownElements.Button: t = typeof(System.Windows.Controls.Button); break;
case KnownElements.ButtonBase: t = typeof(System.Windows.Controls.Primitives.ButtonBase); break;
case KnownElements.Byte: t = typeof(System.Byte); break;
case KnownElements.ByteAnimation: t = typeof(System.Windows.Media.Animation.ByteAnimation); break;
case KnownElements.ByteAnimationBase: t = typeof(System.Windows.Media.Animation.ByteAnimationBase); break;
case KnownElements.ByteAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.ByteAnimationUsingKeyFrames); break;
case KnownElements.ByteConverter: t = typeof(System.ComponentModel.ByteConverter); break;
case KnownElements.ByteKeyFrame: t = typeof(System.Windows.Media.Animation.ByteKeyFrame); break;
case KnownElements.ByteKeyFrameCollection: t = typeof(System.Windows.Media.Animation.ByteKeyFrameCollection); break;
case KnownElements.CachedBitmap: t = typeof(System.Windows.Media.Imaging.CachedBitmap); break;
case KnownElements.Camera: t = typeof(System.Windows.Media.Media3D.Camera); break;
case KnownElements.Canvas: t = typeof(System.Windows.Controls.Canvas); break;
case KnownElements.Char: t = typeof(System.Char); break;
case KnownElements.CharAnimationBase: t = typeof(System.Windows.Media.Animation.CharAnimationBase); break;
case KnownElements.CharAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.CharAnimationUsingKeyFrames); break;
case KnownElements.CharConverter: t = typeof(System.ComponentModel.CharConverter); break;
case KnownElements.CharIListConverter: t = typeof(System.Windows.Media.Converters.CharIListConverter); break;
case KnownElements.CharKeyFrame: t = typeof(System.Windows.Media.Animation.CharKeyFrame); break;
case KnownElements.CharKeyFrameCollection: t = typeof(System.Windows.Media.Animation.CharKeyFrameCollection); break;
case KnownElements.CheckBox: t = typeof(System.Windows.Controls.CheckBox); break;
case KnownElements.Clock: t = typeof(System.Windows.Media.Animation.Clock); break;
case KnownElements.ClockController: t = typeof(System.Windows.Media.Animation.ClockController); break;
case KnownElements.ClockGroup: t = typeof(System.Windows.Media.Animation.ClockGroup); break;
case KnownElements.CollectionContainer: t = typeof(System.Windows.Data.CollectionContainer); break;
case KnownElements.CollectionView: t = typeof(System.Windows.Data.CollectionView); break;
case KnownElements.CollectionViewSource: t = typeof(System.Windows.Data.CollectionViewSource); break;
case KnownElements.Color: t = typeof(System.Windows.Media.Color); break;
case KnownElements.ColorAnimation: t = typeof(System.Windows.Media.Animation.ColorAnimation); break;
case KnownElements.ColorAnimationBase: t = typeof(System.Windows.Media.Animation.ColorAnimationBase); break;
case KnownElements.ColorAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.ColorAnimationUsingKeyFrames); break;
case KnownElements.ColorConvertedBitmap: t = typeof(System.Windows.Media.Imaging.ColorConvertedBitmap); break;
case KnownElements.ColorConvertedBitmapExtension: t = typeof(System.Windows.ColorConvertedBitmapExtension); break;
case KnownElements.ColorConverter: t = typeof(System.Windows.Media.ColorConverter); break;
case KnownElements.ColorKeyFrame: t = typeof(System.Windows.Media.Animation.ColorKeyFrame); break;
case KnownElements.ColorKeyFrameCollection: t = typeof(System.Windows.Media.Animation.ColorKeyFrameCollection); break;
case KnownElements.ColumnDefinition: t = typeof(System.Windows.Controls.ColumnDefinition); break;
case KnownElements.CombinedGeometry: t = typeof(System.Windows.Media.CombinedGeometry); break;
case KnownElements.ComboBox: t = typeof(System.Windows.Controls.ComboBox); break;
case KnownElements.ComboBoxItem: t = typeof(System.Windows.Controls.ComboBoxItem); break;
case KnownElements.CommandConverter: t = typeof(System.Windows.Input.CommandConverter); break;
case KnownElements.ComponentResourceKey: t = typeof(System.Windows.ComponentResourceKey); break;
case KnownElements.ComponentResourceKeyConverter: t = typeof(System.Windows.Markup.ComponentResourceKeyConverter); break;
case KnownElements.CompositionTarget: t = typeof(System.Windows.Media.CompositionTarget); break;
case KnownElements.Condition: t = typeof(System.Windows.Condition); break;
case KnownElements.ContainerVisual: t = typeof(System.Windows.Media.ContainerVisual); break;
case KnownElements.ContentControl: t = typeof(System.Windows.Controls.ContentControl); break;
case KnownElements.ContentElement: t = typeof(System.Windows.ContentElement); break;
case KnownElements.ContentPresenter: t = typeof(System.Windows.Controls.ContentPresenter); break;
case KnownElements.ContentPropertyAttribute: t = typeof(System.Windows.Markup.ContentPropertyAttribute); break;
case KnownElements.ContentWrapperAttribute: t = typeof(System.Windows.Markup.ContentWrapperAttribute); break;
case KnownElements.ContextMenu: t = typeof(System.Windows.Controls.ContextMenu); break;
case KnownElements.ContextMenuService: t = typeof(System.Windows.Controls.ContextMenuService); break;
case KnownElements.Control: t = typeof(System.Windows.Controls.Control); break;
case KnownElements.ControlTemplate: t = typeof(System.Windows.Controls.ControlTemplate); break;
case KnownElements.ControllableStoryboardAction: t = typeof(System.Windows.Media.Animation.ControllableStoryboardAction); break;
case KnownElements.CornerRadius: t = typeof(System.Windows.CornerRadius); break;
case KnownElements.CornerRadiusConverter: t = typeof(System.Windows.CornerRadiusConverter); break;
case KnownElements.CroppedBitmap: t = typeof(System.Windows.Media.Imaging.CroppedBitmap); break;
case KnownElements.CultureInfo: t = typeof(System.Globalization.CultureInfo); break;
case KnownElements.CultureInfoConverter: t = typeof(System.ComponentModel.CultureInfoConverter); break;
case KnownElements.CultureInfoIetfLanguageTagConverter: t = typeof(System.Windows.CultureInfoIetfLanguageTagConverter); break;
case KnownElements.Cursor: t = typeof(System.Windows.Input.Cursor); break;
case KnownElements.CursorConverter: t = typeof(System.Windows.Input.CursorConverter); break;
case KnownElements.DashStyle: t = typeof(System.Windows.Media.DashStyle); break;
case KnownElements.DataChangedEventManager: t = typeof(System.Windows.Data.DataChangedEventManager); break;
case KnownElements.DataTemplate: t = typeof(System.Windows.DataTemplate); break;
case KnownElements.DataTemplateKey: t = typeof(System.Windows.DataTemplateKey); break;
case KnownElements.DataTrigger: t = typeof(System.Windows.DataTrigger); break;
case KnownElements.DateTime: t = typeof(System.DateTime); break;
case KnownElements.DateTimeConverter: t = typeof(System.ComponentModel.DateTimeConverter); break;
case KnownElements.DateTimeConverter2: t = typeof(System.Windows.Markup.DateTimeConverter2); break;
case KnownElements.Decimal: t = typeof(System.Decimal); break;
case KnownElements.DecimalAnimation: t = typeof(System.Windows.Media.Animation.DecimalAnimation); break;
case KnownElements.DecimalAnimationBase: t = typeof(System.Windows.Media.Animation.DecimalAnimationBase); break;
case KnownElements.DecimalAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames); break;
case KnownElements.DecimalConverter: t = typeof(System.ComponentModel.DecimalConverter); break;
case KnownElements.DecimalKeyFrame: t = typeof(System.Windows.Media.Animation.DecimalKeyFrame); break;
case KnownElements.DecimalKeyFrameCollection: t = typeof(System.Windows.Media.Animation.DecimalKeyFrameCollection); break;
case KnownElements.Decorator: t = typeof(System.Windows.Controls.Decorator); break;
case KnownElements.DefinitionBase: t = typeof(System.Windows.Controls.DefinitionBase); break;
case KnownElements.DependencyObject: t = typeof(System.Windows.DependencyObject); break;
case KnownElements.DependencyProperty: t = typeof(System.Windows.DependencyProperty); break;
case KnownElements.DependencyPropertyConverter: t = typeof(System.Windows.Markup.DependencyPropertyConverter); break;
case KnownElements.DialogResultConverter: t = typeof(System.Windows.DialogResultConverter); break;
case KnownElements.DiffuseMaterial: t = typeof(System.Windows.Media.Media3D.DiffuseMaterial); break;
case KnownElements.DirectionalLight: t = typeof(System.Windows.Media.Media3D.DirectionalLight); break;
case KnownElements.DiscreteBooleanKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteBooleanKeyFrame); break;
case KnownElements.DiscreteByteKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteByteKeyFrame); break;
case KnownElements.DiscreteCharKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteCharKeyFrame); break;
case KnownElements.DiscreteColorKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteColorKeyFrame); break;
case KnownElements.DiscreteDecimalKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteDecimalKeyFrame); break;
case KnownElements.DiscreteDoubleKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteDoubleKeyFrame); break;
case KnownElements.DiscreteInt16KeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteInt16KeyFrame); break;
case KnownElements.DiscreteInt32KeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteInt32KeyFrame); break;
case KnownElements.DiscreteInt64KeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteInt64KeyFrame); break;
case KnownElements.DiscreteMatrixKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteMatrixKeyFrame); break;
case KnownElements.DiscreteObjectKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteObjectKeyFrame); break;
case KnownElements.DiscretePoint3DKeyFrame: t = typeof(System.Windows.Media.Animation.DiscretePoint3DKeyFrame); break;
case KnownElements.DiscretePointKeyFrame: t = typeof(System.Windows.Media.Animation.DiscretePointKeyFrame); break;
case KnownElements.DiscreteQuaternionKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteQuaternionKeyFrame); break;
case KnownElements.DiscreteRectKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteRectKeyFrame); break;
case KnownElements.DiscreteRotation3DKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteRotation3DKeyFrame); break;
case KnownElements.DiscreteSingleKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteSingleKeyFrame); break;
case KnownElements.DiscreteSizeKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteSizeKeyFrame); break;
case KnownElements.DiscreteStringKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteStringKeyFrame); break;
case KnownElements.DiscreteThicknessKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteThicknessKeyFrame); break;
case KnownElements.DiscreteVector3DKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteVector3DKeyFrame); break;
case KnownElements.DiscreteVectorKeyFrame: t = typeof(System.Windows.Media.Animation.DiscreteVectorKeyFrame); break;
case KnownElements.DockPanel: t = typeof(System.Windows.Controls.DockPanel); break;
case KnownElements.DocumentPageView: t = typeof(System.Windows.Controls.Primitives.DocumentPageView); break;
case KnownElements.DocumentReference: t = typeof(System.Windows.Documents.DocumentReference); break;
case KnownElements.DocumentViewer: t = typeof(System.Windows.Controls.DocumentViewer); break;
case KnownElements.DocumentViewerBase: t = typeof(System.Windows.Controls.Primitives.DocumentViewerBase); break;
case KnownElements.Double: t = typeof(System.Double); break;
case KnownElements.DoubleAnimation: t = typeof(System.Windows.Media.Animation.DoubleAnimation); break;
case KnownElements.DoubleAnimationBase: t = typeof(System.Windows.Media.Animation.DoubleAnimationBase); break;
case KnownElements.DoubleAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames); break;
case KnownElements.DoubleAnimationUsingPath: t = typeof(System.Windows.Media.Animation.DoubleAnimationUsingPath); break;
case KnownElements.DoubleCollection: t = typeof(System.Windows.Media.DoubleCollection); break;
case KnownElements.DoubleCollectionConverter: t = typeof(System.Windows.Media.DoubleCollectionConverter); break;
case KnownElements.DoubleConverter: t = typeof(System.ComponentModel.DoubleConverter); break;
case KnownElements.DoubleIListConverter: t = typeof(System.Windows.Media.Converters.DoubleIListConverter); break;
case KnownElements.DoubleKeyFrame: t = typeof(System.Windows.Media.Animation.DoubleKeyFrame); break;
case KnownElements.DoubleKeyFrameCollection: t = typeof(System.Windows.Media.Animation.DoubleKeyFrameCollection); break;
case KnownElements.Drawing: t = typeof(System.Windows.Media.Drawing); break;
case KnownElements.DrawingBrush: t = typeof(System.Windows.Media.DrawingBrush); break;
case KnownElements.DrawingCollection: t = typeof(System.Windows.Media.DrawingCollection); break;
case KnownElements.DrawingContext: t = typeof(System.Windows.Media.DrawingContext); break;
case KnownElements.DrawingGroup: t = typeof(System.Windows.Media.DrawingGroup); break;
case KnownElements.DrawingImage: t = typeof(System.Windows.Media.DrawingImage); break;
case KnownElements.DrawingVisual: t = typeof(System.Windows.Media.DrawingVisual); break;
case KnownElements.DropShadowBitmapEffect: t = typeof(System.Windows.Media.Effects.DropShadowBitmapEffect); break;
case KnownElements.Duration: t = typeof(System.Windows.Duration); break;
case KnownElements.DurationConverter: t = typeof(System.Windows.DurationConverter); break;
case KnownElements.DynamicResourceExtension: t = typeof(System.Windows.DynamicResourceExtension); break;
case KnownElements.DynamicResourceExtensionConverter: t = typeof(System.Windows.DynamicResourceExtensionConverter); break;
case KnownElements.Ellipse: t = typeof(System.Windows.Shapes.Ellipse); break;
case KnownElements.EllipseGeometry: t = typeof(System.Windows.Media.EllipseGeometry); break;
case KnownElements.EmbossBitmapEffect: t = typeof(System.Windows.Media.Effects.EmbossBitmapEffect); break;
case KnownElements.EmissiveMaterial: t = typeof(System.Windows.Media.Media3D.EmissiveMaterial); break;
case KnownElements.EnumConverter: t = typeof(System.ComponentModel.EnumConverter); break;
case KnownElements.EventManager: t = typeof(System.Windows.EventManager); break;
case KnownElements.EventSetter: t = typeof(System.Windows.EventSetter); break;
case KnownElements.EventTrigger: t = typeof(System.Windows.EventTrigger); break;
case KnownElements.Expander: t = typeof(System.Windows.Controls.Expander); break;
case KnownElements.Expression: t = typeof(System.Windows.Expression); break;
case KnownElements.ExpressionConverter: t = typeof(System.Windows.ExpressionConverter); break;
case KnownElements.Figure: t = typeof(System.Windows.Documents.Figure); break;
case KnownElements.FigureLength: t = typeof(System.Windows.FigureLength); break;
case KnownElements.FigureLengthConverter: t = typeof(System.Windows.FigureLengthConverter); break;
case KnownElements.FixedDocument: t = typeof(System.Windows.Documents.FixedDocument); break;
case KnownElements.FixedDocumentSequence: t = typeof(System.Windows.Documents.FixedDocumentSequence); break;
case KnownElements.FixedPage: t = typeof(System.Windows.Documents.FixedPage); break;
case KnownElements.Floater: t = typeof(System.Windows.Documents.Floater); break;
case KnownElements.FlowDocument: t = typeof(System.Windows.Documents.FlowDocument); break;
case KnownElements.FlowDocumentPageViewer: t = typeof(System.Windows.Controls.FlowDocumentPageViewer); break;
case KnownElements.FlowDocumentReader: t = typeof(System.Windows.Controls.FlowDocumentReader); break;
case KnownElements.FlowDocumentScrollViewer: t = typeof(System.Windows.Controls.FlowDocumentScrollViewer); break;
case KnownElements.FocusManager: t = typeof(System.Windows.Input.FocusManager); break;
case KnownElements.FontFamily: t = typeof(System.Windows.Media.FontFamily); break;
case KnownElements.FontFamilyConverter: t = typeof(System.Windows.Media.FontFamilyConverter); break;
case KnownElements.FontSizeConverter: t = typeof(System.Windows.FontSizeConverter); break;
case KnownElements.FontStretch: t = typeof(System.Windows.FontStretch); break;
case KnownElements.FontStretchConverter: t = typeof(System.Windows.FontStretchConverter); break;
case KnownElements.FontStyle: t = typeof(System.Windows.FontStyle); break;
case KnownElements.FontStyleConverter: t = typeof(System.Windows.FontStyleConverter); break;
case KnownElements.FontWeight: t = typeof(System.Windows.FontWeight); break;
case KnownElements.FontWeightConverter: t = typeof(System.Windows.FontWeightConverter); break;
case KnownElements.FormatConvertedBitmap: t = typeof(System.Windows.Media.Imaging.FormatConvertedBitmap); break;
case KnownElements.Frame: t = typeof(System.Windows.Controls.Frame); break;
case KnownElements.FrameworkContentElement: t = typeof(System.Windows.FrameworkContentElement); break;
case KnownElements.FrameworkElement: t = typeof(System.Windows.FrameworkElement); break;
case KnownElements.FrameworkElementFactory: t = typeof(System.Windows.FrameworkElementFactory); break;
case KnownElements.FrameworkPropertyMetadata: t = typeof(System.Windows.FrameworkPropertyMetadata); break;
case KnownElements.FrameworkPropertyMetadataOptions: t = typeof(System.Windows.FrameworkPropertyMetadataOptions); break;
case KnownElements.FrameworkRichTextComposition: t = typeof(System.Windows.Documents.FrameworkRichTextComposition); break;
case KnownElements.FrameworkTemplate: t = typeof(System.Windows.FrameworkTemplate); break;
case KnownElements.FrameworkTextComposition: t = typeof(System.Windows.Documents.FrameworkTextComposition); break;
case KnownElements.Freezable: t = typeof(System.Windows.Freezable); break;
case KnownElements.GeneralTransform: t = typeof(System.Windows.Media.GeneralTransform); break;
case KnownElements.GeneralTransformCollection: t = typeof(System.Windows.Media.GeneralTransformCollection); break;
case KnownElements.GeneralTransformGroup: t = typeof(System.Windows.Media.GeneralTransformGroup); break;
case KnownElements.Geometry: t = typeof(System.Windows.Media.Geometry); break;
case KnownElements.Geometry3D: t = typeof(System.Windows.Media.Media3D.Geometry3D); break;
case KnownElements.GeometryCollection: t = typeof(System.Windows.Media.GeometryCollection); break;
case KnownElements.GeometryConverter: t = typeof(System.Windows.Media.GeometryConverter); break;
case KnownElements.GeometryDrawing: t = typeof(System.Windows.Media.GeometryDrawing); break;
case KnownElements.GeometryGroup: t = typeof(System.Windows.Media.GeometryGroup); break;
case KnownElements.GeometryModel3D: t = typeof(System.Windows.Media.Media3D.GeometryModel3D); break;
case KnownElements.GestureRecognizer: t = typeof(System.Windows.Ink.GestureRecognizer); break;
case KnownElements.GifBitmapDecoder: t = typeof(System.Windows.Media.Imaging.GifBitmapDecoder); break;
case KnownElements.GifBitmapEncoder: t = typeof(System.Windows.Media.Imaging.GifBitmapEncoder); break;
case KnownElements.GlyphRun: t = typeof(System.Windows.Media.GlyphRun); break;
case KnownElements.GlyphRunDrawing: t = typeof(System.Windows.Media.GlyphRunDrawing); break;
case KnownElements.GlyphTypeface: t = typeof(System.Windows.Media.GlyphTypeface); break;
case KnownElements.Glyphs: t = typeof(System.Windows.Documents.Glyphs); break;
case KnownElements.GradientBrush: t = typeof(System.Windows.Media.GradientBrush); break;
case KnownElements.GradientStop: t = typeof(System.Windows.Media.GradientStop); break;
case KnownElements.GradientStopCollection: t = typeof(System.Windows.Media.GradientStopCollection); break;
case KnownElements.Grid: t = typeof(System.Windows.Controls.Grid); break;
case KnownElements.GridLength: t = typeof(System.Windows.GridLength); break;
case KnownElements.GridLengthConverter: t = typeof(System.Windows.GridLengthConverter); break;
case KnownElements.GridSplitter: t = typeof(System.Windows.Controls.GridSplitter); break;
case KnownElements.GridView: t = typeof(System.Windows.Controls.GridView); break;
case KnownElements.GridViewColumn: t = typeof(System.Windows.Controls.GridViewColumn); break;
case KnownElements.GridViewColumnHeader: t = typeof(System.Windows.Controls.GridViewColumnHeader); break;
case KnownElements.GridViewHeaderRowPresenter: t = typeof(System.Windows.Controls.GridViewHeaderRowPresenter); break;
case KnownElements.GridViewRowPresenter: t = typeof(System.Windows.Controls.GridViewRowPresenter); break;
case KnownElements.GridViewRowPresenterBase: t = typeof(System.Windows.Controls.Primitives.GridViewRowPresenterBase); break;
case KnownElements.GroupBox: t = typeof(System.Windows.Controls.GroupBox); break;
case KnownElements.GroupItem: t = typeof(System.Windows.Controls.GroupItem); break;
case KnownElements.Guid: t = typeof(System.Guid); break;
case KnownElements.GuidConverter: t = typeof(System.ComponentModel.GuidConverter); break;
case KnownElements.GuidelineSet: t = typeof(System.Windows.Media.GuidelineSet); break;
case KnownElements.HeaderedContentControl: t = typeof(System.Windows.Controls.HeaderedContentControl); break;
case KnownElements.HeaderedItemsControl: t = typeof(System.Windows.Controls.HeaderedItemsControl); break;
case KnownElements.HierarchicalDataTemplate: t = typeof(System.Windows.HierarchicalDataTemplate); break;
case KnownElements.HostVisual: t = typeof(System.Windows.Media.HostVisual); break;
case KnownElements.Hyperlink: t = typeof(System.Windows.Documents.Hyperlink); break;
case KnownElements.IAddChild: t = typeof(System.Windows.Markup.IAddChild); break;
case KnownElements.IAddChildInternal: t = typeof(System.Windows.Markup.IAddChildInternal); break;
case KnownElements.ICommand: t = typeof(System.Windows.Input.ICommand); break;
case KnownElements.IComponentConnector: t = typeof(System.Windows.Markup.IComponentConnector); break;
case KnownElements.INameScope: t = typeof(System.Windows.Markup.INameScope); break;
case KnownElements.IStyleConnector: t = typeof(System.Windows.Markup.IStyleConnector); break;
case KnownElements.IconBitmapDecoder: t = typeof(System.Windows.Media.Imaging.IconBitmapDecoder); break;
case KnownElements.Image: t = typeof(System.Windows.Controls.Image); break;
case KnownElements.ImageBrush: t = typeof(System.Windows.Media.ImageBrush); break;
case KnownElements.ImageDrawing: t = typeof(System.Windows.Media.ImageDrawing); break;
case KnownElements.ImageMetadata: t = typeof(System.Windows.Media.ImageMetadata); break;
case KnownElements.ImageSource: t = typeof(System.Windows.Media.ImageSource); break;
case KnownElements.ImageSourceConverter: t = typeof(System.Windows.Media.ImageSourceConverter); break;
case KnownElements.InPlaceBitmapMetadataWriter: t = typeof(System.Windows.Media.Imaging.InPlaceBitmapMetadataWriter); break;
case KnownElements.InkCanvas: t = typeof(System.Windows.Controls.InkCanvas); break;
case KnownElements.InkPresenter: t = typeof(System.Windows.Controls.InkPresenter); break;
case KnownElements.Inline: t = typeof(System.Windows.Documents.Inline); break;
case KnownElements.InlineCollection: t = typeof(System.Windows.Documents.InlineCollection); break;
case KnownElements.InlineUIContainer: t = typeof(System.Windows.Documents.InlineUIContainer); break;
case KnownElements.InputBinding: t = typeof(System.Windows.Input.InputBinding); break;
case KnownElements.InputDevice: t = typeof(System.Windows.Input.InputDevice); break;
case KnownElements.InputLanguageManager: t = typeof(System.Windows.Input.InputLanguageManager); break;
case KnownElements.InputManager: t = typeof(System.Windows.Input.InputManager); break;
case KnownElements.InputMethod: t = typeof(System.Windows.Input.InputMethod); break;
case KnownElements.InputScope: t = typeof(System.Windows.Input.InputScope); break;
case KnownElements.InputScopeConverter: t = typeof(System.Windows.Input.InputScopeConverter); break;
case KnownElements.InputScopeName: t = typeof(System.Windows.Input.InputScopeName); break;
case KnownElements.InputScopeNameConverter: t = typeof(System.Windows.Input.InputScopeNameConverter); break;
case KnownElements.Int16: t = typeof(System.Int16); break;
case KnownElements.Int16Animation: t = typeof(System.Windows.Media.Animation.Int16Animation); break;
case KnownElements.Int16AnimationBase: t = typeof(System.Windows.Media.Animation.Int16AnimationBase); break;
case KnownElements.Int16AnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Int16AnimationUsingKeyFrames); break;
case KnownElements.Int16Converter: t = typeof(System.ComponentModel.Int16Converter); break;
case KnownElements.Int16KeyFrame: t = typeof(System.Windows.Media.Animation.Int16KeyFrame); break;
case KnownElements.Int16KeyFrameCollection: t = typeof(System.Windows.Media.Animation.Int16KeyFrameCollection); break;
case KnownElements.Int32: t = typeof(System.Int32); break;
case KnownElements.Int32Animation: t = typeof(System.Windows.Media.Animation.Int32Animation); break;
case KnownElements.Int32AnimationBase: t = typeof(System.Windows.Media.Animation.Int32AnimationBase); break;
case KnownElements.Int32AnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Int32AnimationUsingKeyFrames); break;
case KnownElements.Int32Collection: t = typeof(System.Windows.Media.Int32Collection); break;
case KnownElements.Int32CollectionConverter: t = typeof(System.Windows.Media.Int32CollectionConverter); break;
case KnownElements.Int32Converter: t = typeof(System.ComponentModel.Int32Converter); break;
case KnownElements.Int32KeyFrame: t = typeof(System.Windows.Media.Animation.Int32KeyFrame); break;
case KnownElements.Int32KeyFrameCollection: t = typeof(System.Windows.Media.Animation.Int32KeyFrameCollection); break;
case KnownElements.Int32Rect: t = typeof(System.Windows.Int32Rect); break;
case KnownElements.Int32RectConverter: t = typeof(System.Windows.Int32RectConverter); break;
case KnownElements.Int64: t = typeof(System.Int64); break;
case KnownElements.Int64Animation: t = typeof(System.Windows.Media.Animation.Int64Animation); break;
case KnownElements.Int64AnimationBase: t = typeof(System.Windows.Media.Animation.Int64AnimationBase); break;
case KnownElements.Int64AnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Int64AnimationUsingKeyFrames); break;
case KnownElements.Int64Converter: t = typeof(System.ComponentModel.Int64Converter); break;
case KnownElements.Int64KeyFrame: t = typeof(System.Windows.Media.Animation.Int64KeyFrame); break;
case KnownElements.Int64KeyFrameCollection: t = typeof(System.Windows.Media.Animation.Int64KeyFrameCollection); break;
case KnownElements.Italic: t = typeof(System.Windows.Documents.Italic); break;
case KnownElements.ItemCollection: t = typeof(System.Windows.Controls.ItemCollection); break;
case KnownElements.ItemsControl: t = typeof(System.Windows.Controls.ItemsControl); break;
case KnownElements.ItemsPanelTemplate: t = typeof(System.Windows.Controls.ItemsPanelTemplate); break;
case KnownElements.ItemsPresenter: t = typeof(System.Windows.Controls.ItemsPresenter); break;
case KnownElements.JournalEntry: t = typeof(System.Windows.Navigation.JournalEntry); break;
case KnownElements.JournalEntryListConverter: t = typeof(System.Windows.Navigation.JournalEntryListConverter); break;
case KnownElements.JournalEntryUnifiedViewConverter: t = typeof(System.Windows.Navigation.JournalEntryUnifiedViewConverter); break;
case KnownElements.JpegBitmapDecoder: t = typeof(System.Windows.Media.Imaging.JpegBitmapDecoder); break;
case KnownElements.JpegBitmapEncoder: t = typeof(System.Windows.Media.Imaging.JpegBitmapEncoder); break;
case KnownElements.KeyBinding: t = typeof(System.Windows.Input.KeyBinding); break;
case KnownElements.KeyConverter: t = typeof(System.Windows.Input.KeyConverter); break;
case KnownElements.KeyGesture: t = typeof(System.Windows.Input.KeyGesture); break;
case KnownElements.KeyGestureConverter: t = typeof(System.Windows.Input.KeyGestureConverter); break;
case KnownElements.KeySpline: t = typeof(System.Windows.Media.Animation.KeySpline); break;
case KnownElements.KeySplineConverter: t = typeof(System.Windows.KeySplineConverter); break;
case KnownElements.KeyTime: t = typeof(System.Windows.Media.Animation.KeyTime); break;
case KnownElements.KeyTimeConverter: t = typeof(System.Windows.KeyTimeConverter); break;
case KnownElements.KeyboardDevice: t = typeof(System.Windows.Input.KeyboardDevice); break;
case KnownElements.Label: t = typeof(System.Windows.Controls.Label); break;
case KnownElements.LateBoundBitmapDecoder: t = typeof(System.Windows.Media.Imaging.LateBoundBitmapDecoder); break;
case KnownElements.LengthConverter: t = typeof(System.Windows.LengthConverter); break;
case KnownElements.Light: t = typeof(System.Windows.Media.Media3D.Light); break;
case KnownElements.Line: t = typeof(System.Windows.Shapes.Line); break;
case KnownElements.LineBreak: t = typeof(System.Windows.Documents.LineBreak); break;
case KnownElements.LineGeometry: t = typeof(System.Windows.Media.LineGeometry); break;
case KnownElements.LineSegment: t = typeof(System.Windows.Media.LineSegment); break;
case KnownElements.LinearByteKeyFrame: t = typeof(System.Windows.Media.Animation.LinearByteKeyFrame); break;
case KnownElements.LinearColorKeyFrame: t = typeof(System.Windows.Media.Animation.LinearColorKeyFrame); break;
case KnownElements.LinearDecimalKeyFrame: t = typeof(System.Windows.Media.Animation.LinearDecimalKeyFrame); break;
case KnownElements.LinearDoubleKeyFrame: t = typeof(System.Windows.Media.Animation.LinearDoubleKeyFrame); break;
case KnownElements.LinearGradientBrush: t = typeof(System.Windows.Media.LinearGradientBrush); break;
case KnownElements.LinearInt16KeyFrame: t = typeof(System.Windows.Media.Animation.LinearInt16KeyFrame); break;
case KnownElements.LinearInt32KeyFrame: t = typeof(System.Windows.Media.Animation.LinearInt32KeyFrame); break;
case KnownElements.LinearInt64KeyFrame: t = typeof(System.Windows.Media.Animation.LinearInt64KeyFrame); break;
case KnownElements.LinearPoint3DKeyFrame: t = typeof(System.Windows.Media.Animation.LinearPoint3DKeyFrame); break;
case KnownElements.LinearPointKeyFrame: t = typeof(System.Windows.Media.Animation.LinearPointKeyFrame); break;
case KnownElements.LinearQuaternionKeyFrame: t = typeof(System.Windows.Media.Animation.LinearQuaternionKeyFrame); break;
case KnownElements.LinearRectKeyFrame: t = typeof(System.Windows.Media.Animation.LinearRectKeyFrame); break;
case KnownElements.LinearRotation3DKeyFrame: t = typeof(System.Windows.Media.Animation.LinearRotation3DKeyFrame); break;
case KnownElements.LinearSingleKeyFrame: t = typeof(System.Windows.Media.Animation.LinearSingleKeyFrame); break;
case KnownElements.LinearSizeKeyFrame: t = typeof(System.Windows.Media.Animation.LinearSizeKeyFrame); break;
case KnownElements.LinearThicknessKeyFrame: t = typeof(System.Windows.Media.Animation.LinearThicknessKeyFrame); break;
case KnownElements.LinearVector3DKeyFrame: t = typeof(System.Windows.Media.Animation.LinearVector3DKeyFrame); break;
case KnownElements.LinearVectorKeyFrame: t = typeof(System.Windows.Media.Animation.LinearVectorKeyFrame); break;
case KnownElements.List: t = typeof(System.Windows.Documents.List); break;
case KnownElements.ListBox: t = typeof(System.Windows.Controls.ListBox); break;
case KnownElements.ListBoxItem: t = typeof(System.Windows.Controls.ListBoxItem); break;
case KnownElements.ListCollectionView: t = typeof(System.Windows.Data.ListCollectionView); break;
case KnownElements.ListItem: t = typeof(System.Windows.Documents.ListItem); break;
case KnownElements.ListView: t = typeof(System.Windows.Controls.ListView); break;
case KnownElements.ListViewItem: t = typeof(System.Windows.Controls.ListViewItem); break;
case KnownElements.Localization: t = typeof(System.Windows.Localization); break;
case KnownElements.LostFocusEventManager: t = typeof(System.Windows.LostFocusEventManager); break;
case KnownElements.MarkupExtension: t = typeof(System.Windows.Markup.MarkupExtension); break;
case KnownElements.Material: t = typeof(System.Windows.Media.Media3D.Material); break;
case KnownElements.MaterialCollection: t = typeof(System.Windows.Media.Media3D.MaterialCollection); break;
case KnownElements.MaterialGroup: t = typeof(System.Windows.Media.Media3D.MaterialGroup); break;
case KnownElements.Matrix: t = typeof(System.Windows.Media.Matrix); break;
case KnownElements.Matrix3D: t = typeof(System.Windows.Media.Media3D.Matrix3D); break;
case KnownElements.Matrix3DConverter: t = typeof(System.Windows.Media.Media3D.Matrix3DConverter); break;
case KnownElements.MatrixAnimationBase: t = typeof(System.Windows.Media.Animation.MatrixAnimationBase); break;
case KnownElements.MatrixAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames); break;
case KnownElements.MatrixAnimationUsingPath: t = typeof(System.Windows.Media.Animation.MatrixAnimationUsingPath); break;
case KnownElements.MatrixCamera: t = typeof(System.Windows.Media.Media3D.MatrixCamera); break;
case KnownElements.MatrixConverter: t = typeof(System.Windows.Media.MatrixConverter); break;
case KnownElements.MatrixKeyFrame: t = typeof(System.Windows.Media.Animation.MatrixKeyFrame); break;
case KnownElements.MatrixKeyFrameCollection: t = typeof(System.Windows.Media.Animation.MatrixKeyFrameCollection); break;
case KnownElements.MatrixTransform: t = typeof(System.Windows.Media.MatrixTransform); break;
case KnownElements.MatrixTransform3D: t = typeof(System.Windows.Media.Media3D.MatrixTransform3D); break;
case KnownElements.MediaClock: t = typeof(System.Windows.Media.MediaClock); break;
case KnownElements.MediaElement: t = typeof(System.Windows.Controls.MediaElement); break;
case KnownElements.MediaPlayer: t = typeof(System.Windows.Media.MediaPlayer); break;
case KnownElements.MediaTimeline: t = typeof(System.Windows.Media.MediaTimeline); break;
case KnownElements.Menu: t = typeof(System.Windows.Controls.Menu); break;
case KnownElements.MenuBase: t = typeof(System.Windows.Controls.Primitives.MenuBase); break;
case KnownElements.MenuItem: t = typeof(System.Windows.Controls.MenuItem); break;
case KnownElements.MenuScrollingVisibilityConverter: t = typeof(System.Windows.Controls.MenuScrollingVisibilityConverter); break;
case KnownElements.MeshGeometry3D: t = typeof(System.Windows.Media.Media3D.MeshGeometry3D); break;
case KnownElements.Model3D: t = typeof(System.Windows.Media.Media3D.Model3D); break;
case KnownElements.Model3DCollection: t = typeof(System.Windows.Media.Media3D.Model3DCollection); break;
case KnownElements.Model3DGroup: t = typeof(System.Windows.Media.Media3D.Model3DGroup); break;
case KnownElements.ModelVisual3D: t = typeof(System.Windows.Media.Media3D.ModelVisual3D); break;
case KnownElements.ModifierKeysConverter: t = typeof(System.Windows.Input.ModifierKeysConverter); break;
case KnownElements.MouseActionConverter: t = typeof(System.Windows.Input.MouseActionConverter); break;
case KnownElements.MouseBinding: t = typeof(System.Windows.Input.MouseBinding); break;
case KnownElements.MouseDevice: t = typeof(System.Windows.Input.MouseDevice); break;
case KnownElements.MouseGesture: t = typeof(System.Windows.Input.MouseGesture); break;
case KnownElements.MouseGestureConverter: t = typeof(System.Windows.Input.MouseGestureConverter); break;
case KnownElements.MultiBinding: t = typeof(System.Windows.Data.MultiBinding); break;
case KnownElements.MultiBindingExpression: t = typeof(System.Windows.Data.MultiBindingExpression); break;
case KnownElements.MultiDataTrigger: t = typeof(System.Windows.MultiDataTrigger); break;
case KnownElements.MultiTrigger: t = typeof(System.Windows.MultiTrigger); break;
case KnownElements.NameScope: t = typeof(System.Windows.NameScope); break;
case KnownElements.NavigationWindow: t = typeof(System.Windows.Navigation.NavigationWindow); break;
case KnownElements.NullExtension: t = typeof(System.Windows.Markup.NullExtension); break;
case KnownElements.NullableBoolConverter: t = typeof(System.Windows.NullableBoolConverter); break;
case KnownElements.NullableConverter: t = typeof(System.ComponentModel.NullableConverter); break;
case KnownElements.NumberSubstitution: t = typeof(System.Windows.Media.NumberSubstitution); break;
case KnownElements.Object: t = typeof(System.Object); break;
case KnownElements.ObjectAnimationBase: t = typeof(System.Windows.Media.Animation.ObjectAnimationBase); break;
case KnownElements.ObjectAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames); break;
case KnownElements.ObjectDataProvider: t = typeof(System.Windows.Data.ObjectDataProvider); break;
case KnownElements.ObjectKeyFrame: t = typeof(System.Windows.Media.Animation.ObjectKeyFrame); break;
case KnownElements.ObjectKeyFrameCollection: t = typeof(System.Windows.Media.Animation.ObjectKeyFrameCollection); break;
case KnownElements.OrthographicCamera: t = typeof(System.Windows.Media.Media3D.OrthographicCamera); break;
case KnownElements.OuterGlowBitmapEffect: t = typeof(System.Windows.Media.Effects.OuterGlowBitmapEffect); break;
case KnownElements.Page: t = typeof(System.Windows.Controls.Page); break;
case KnownElements.PageContent: t = typeof(System.Windows.Documents.PageContent); break;
case KnownElements.PageFunctionBase: t = typeof(System.Windows.Navigation.PageFunctionBase); break;
case KnownElements.Panel: t = typeof(System.Windows.Controls.Panel); break;
case KnownElements.Paragraph: t = typeof(System.Windows.Documents.Paragraph); break;
case KnownElements.ParallelTimeline: t = typeof(System.Windows.Media.Animation.ParallelTimeline); break;
case KnownElements.ParserContext: t = typeof(System.Windows.Markup.ParserContext); break;
case KnownElements.PasswordBox: t = typeof(System.Windows.Controls.PasswordBox); break;
case KnownElements.Path: t = typeof(System.Windows.Shapes.Path); break;
case KnownElements.PathFigure: t = typeof(System.Windows.Media.PathFigure); break;
case KnownElements.PathFigureCollection: t = typeof(System.Windows.Media.PathFigureCollection); break;
case KnownElements.PathFigureCollectionConverter: t = typeof(System.Windows.Media.PathFigureCollectionConverter); break;
case KnownElements.PathGeometry: t = typeof(System.Windows.Media.PathGeometry); break;
case KnownElements.PathSegment: t = typeof(System.Windows.Media.PathSegment); break;
case KnownElements.PathSegmentCollection: t = typeof(System.Windows.Media.PathSegmentCollection); break;
case KnownElements.PauseStoryboard: t = typeof(System.Windows.Media.Animation.PauseStoryboard); break;
case KnownElements.Pen: t = typeof(System.Windows.Media.Pen); break;
case KnownElements.PerspectiveCamera: t = typeof(System.Windows.Media.Media3D.PerspectiveCamera); break;
case KnownElements.PixelFormat: t = typeof(System.Windows.Media.PixelFormat); break;
case KnownElements.PixelFormatConverter: t = typeof(System.Windows.Media.PixelFormatConverter); break;
case KnownElements.PngBitmapDecoder: t = typeof(System.Windows.Media.Imaging.PngBitmapDecoder); break;
case KnownElements.PngBitmapEncoder: t = typeof(System.Windows.Media.Imaging.PngBitmapEncoder); break;
case KnownElements.Point: t = typeof(System.Windows.Point); break;
case KnownElements.Point3D: t = typeof(System.Windows.Media.Media3D.Point3D); break;
case KnownElements.Point3DAnimation: t = typeof(System.Windows.Media.Animation.Point3DAnimation); break;
case KnownElements.Point3DAnimationBase: t = typeof(System.Windows.Media.Animation.Point3DAnimationBase); break;
case KnownElements.Point3DAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames); break;
case KnownElements.Point3DCollection: t = typeof(System.Windows.Media.Media3D.Point3DCollection); break;
case KnownElements.Point3DCollectionConverter: t = typeof(System.Windows.Media.Media3D.Point3DCollectionConverter); break;
case KnownElements.Point3DConverter: t = typeof(System.Windows.Media.Media3D.Point3DConverter); break;
case KnownElements.Point3DKeyFrame: t = typeof(System.Windows.Media.Animation.Point3DKeyFrame); break;
case KnownElements.Point3DKeyFrameCollection: t = typeof(System.Windows.Media.Animation.Point3DKeyFrameCollection); break;
case KnownElements.Point4D: t = typeof(System.Windows.Media.Media3D.Point4D); break;
case KnownElements.Point4DConverter: t = typeof(System.Windows.Media.Media3D.Point4DConverter); break;
case KnownElements.PointAnimation: t = typeof(System.Windows.Media.Animation.PointAnimation); break;
case KnownElements.PointAnimationBase: t = typeof(System.Windows.Media.Animation.PointAnimationBase); break;
case KnownElements.PointAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.PointAnimationUsingKeyFrames); break;
case KnownElements.PointAnimationUsingPath: t = typeof(System.Windows.Media.Animation.PointAnimationUsingPath); break;
case KnownElements.PointCollection: t = typeof(System.Windows.Media.PointCollection); break;
case KnownElements.PointCollectionConverter: t = typeof(System.Windows.Media.PointCollectionConverter); break;
case KnownElements.PointConverter: t = typeof(System.Windows.PointConverter); break;
case KnownElements.PointIListConverter: t = typeof(System.Windows.Media.Converters.PointIListConverter); break;
case KnownElements.PointKeyFrame: t = typeof(System.Windows.Media.Animation.PointKeyFrame); break;
case KnownElements.PointKeyFrameCollection: t = typeof(System.Windows.Media.Animation.PointKeyFrameCollection); break;
case KnownElements.PointLight: t = typeof(System.Windows.Media.Media3D.PointLight); break;
case KnownElements.PointLightBase: t = typeof(System.Windows.Media.Media3D.PointLightBase); break;
case KnownElements.PolyBezierSegment: t = typeof(System.Windows.Media.PolyBezierSegment); break;
case KnownElements.PolyLineSegment: t = typeof(System.Windows.Media.PolyLineSegment); break;
case KnownElements.PolyQuadraticBezierSegment: t = typeof(System.Windows.Media.PolyQuadraticBezierSegment); break;
case KnownElements.Polygon: t = typeof(System.Windows.Shapes.Polygon); break;
case KnownElements.Polyline: t = typeof(System.Windows.Shapes.Polyline); break;
case KnownElements.Popup: t = typeof(System.Windows.Controls.Primitives.Popup); break;
case KnownElements.PresentationSource: t = typeof(System.Windows.PresentationSource); break;
case KnownElements.PriorityBinding: t = typeof(System.Windows.Data.PriorityBinding); break;
case KnownElements.PriorityBindingExpression: t = typeof(System.Windows.Data.PriorityBindingExpression); break;
case KnownElements.ProgressBar: t = typeof(System.Windows.Controls.ProgressBar); break;
case KnownElements.ProjectionCamera: t = typeof(System.Windows.Media.Media3D.ProjectionCamera); break;
case KnownElements.PropertyPath: t = typeof(System.Windows.PropertyPath); break;
case KnownElements.PropertyPathConverter: t = typeof(System.Windows.PropertyPathConverter); break;
case KnownElements.QuadraticBezierSegment: t = typeof(System.Windows.Media.QuadraticBezierSegment); break;
case KnownElements.Quaternion: t = typeof(System.Windows.Media.Media3D.Quaternion); break;
case KnownElements.QuaternionAnimation: t = typeof(System.Windows.Media.Animation.QuaternionAnimation); break;
case KnownElements.QuaternionAnimationBase: t = typeof(System.Windows.Media.Animation.QuaternionAnimationBase); break;
case KnownElements.QuaternionAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames); break;
case KnownElements.QuaternionConverter: t = typeof(System.Windows.Media.Media3D.QuaternionConverter); break;
case KnownElements.QuaternionKeyFrame: t = typeof(System.Windows.Media.Animation.QuaternionKeyFrame); break;
case KnownElements.QuaternionKeyFrameCollection: t = typeof(System.Windows.Media.Animation.QuaternionKeyFrameCollection); break;
case KnownElements.QuaternionRotation3D: t = typeof(System.Windows.Media.Media3D.QuaternionRotation3D); break;
case KnownElements.RadialGradientBrush: t = typeof(System.Windows.Media.RadialGradientBrush); break;
case KnownElements.RadioButton: t = typeof(System.Windows.Controls.RadioButton); break;
case KnownElements.RangeBase: t = typeof(System.Windows.Controls.Primitives.RangeBase); break;
case KnownElements.Rect: t = typeof(System.Windows.Rect); break;
case KnownElements.Rect3D: t = typeof(System.Windows.Media.Media3D.Rect3D); break;
case KnownElements.Rect3DConverter: t = typeof(System.Windows.Media.Media3D.Rect3DConverter); break;
case KnownElements.RectAnimation: t = typeof(System.Windows.Media.Animation.RectAnimation); break;
case KnownElements.RectAnimationBase: t = typeof(System.Windows.Media.Animation.RectAnimationBase); break;
case KnownElements.RectAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.RectAnimationUsingKeyFrames); break;
case KnownElements.RectConverter: t = typeof(System.Windows.RectConverter); break;
case KnownElements.RectKeyFrame: t = typeof(System.Windows.Media.Animation.RectKeyFrame); break;
case KnownElements.RectKeyFrameCollection: t = typeof(System.Windows.Media.Animation.RectKeyFrameCollection); break;
case KnownElements.Rectangle: t = typeof(System.Windows.Shapes.Rectangle); break;
case KnownElements.RectangleGeometry: t = typeof(System.Windows.Media.RectangleGeometry); break;
case KnownElements.RelativeSource: t = typeof(System.Windows.Data.RelativeSource); break;
case KnownElements.RemoveStoryboard: t = typeof(System.Windows.Media.Animation.RemoveStoryboard); break;
case KnownElements.RenderOptions: t = typeof(System.Windows.Media.RenderOptions); break;
case KnownElements.RenderTargetBitmap: t = typeof(System.Windows.Media.Imaging.RenderTargetBitmap); break;
case KnownElements.RepeatBehavior: t = typeof(System.Windows.Media.Animation.RepeatBehavior); break;
case KnownElements.RepeatBehaviorConverter: t = typeof(System.Windows.Media.Animation.RepeatBehaviorConverter); break;
case KnownElements.RepeatButton: t = typeof(System.Windows.Controls.Primitives.RepeatButton); break;
case KnownElements.ResizeGrip: t = typeof(System.Windows.Controls.Primitives.ResizeGrip); break;
case KnownElements.ResourceDictionary: t = typeof(System.Windows.ResourceDictionary); break;
case KnownElements.ResourceKey: t = typeof(System.Windows.ResourceKey); break;
case KnownElements.ResumeStoryboard: t = typeof(System.Windows.Media.Animation.ResumeStoryboard); break;
case KnownElements.RichTextBox: t = typeof(System.Windows.Controls.RichTextBox); break;
case KnownElements.RotateTransform: t = typeof(System.Windows.Media.RotateTransform); break;
case KnownElements.RotateTransform3D: t = typeof(System.Windows.Media.Media3D.RotateTransform3D); break;
case KnownElements.Rotation3D: t = typeof(System.Windows.Media.Media3D.Rotation3D); break;
case KnownElements.Rotation3DAnimation: t = typeof(System.Windows.Media.Animation.Rotation3DAnimation); break;
case KnownElements.Rotation3DAnimationBase: t = typeof(System.Windows.Media.Animation.Rotation3DAnimationBase); break;
case KnownElements.Rotation3DAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames); break;
case KnownElements.Rotation3DKeyFrame: t = typeof(System.Windows.Media.Animation.Rotation3DKeyFrame); break;
case KnownElements.Rotation3DKeyFrameCollection: t = typeof(System.Windows.Media.Animation.Rotation3DKeyFrameCollection); break;
case KnownElements.RoutedCommand: t = typeof(System.Windows.Input.RoutedCommand); break;
case KnownElements.RoutedEvent: t = typeof(System.Windows.RoutedEvent); break;
case KnownElements.RoutedEventConverter: t = typeof(System.Windows.Markup.RoutedEventConverter); break;
case KnownElements.RoutedUICommand: t = typeof(System.Windows.Input.RoutedUICommand); break;
case KnownElements.RoutingStrategy: t = typeof(System.Windows.RoutingStrategy); break;
case KnownElements.RowDefinition: t = typeof(System.Windows.Controls.RowDefinition); break;
case KnownElements.Run: t = typeof(System.Windows.Documents.Run); break;
case KnownElements.RuntimeNamePropertyAttribute: t = typeof(System.Windows.Markup.RuntimeNamePropertyAttribute); break;
case KnownElements.SByte: t = typeof(System.SByte); break;
case KnownElements.SByteConverter: t = typeof(System.ComponentModel.SByteConverter); break;
case KnownElements.ScaleTransform: t = typeof(System.Windows.Media.ScaleTransform); break;
case KnownElements.ScaleTransform3D: t = typeof(System.Windows.Media.Media3D.ScaleTransform3D); break;
case KnownElements.ScrollBar: t = typeof(System.Windows.Controls.Primitives.ScrollBar); break;
case KnownElements.ScrollContentPresenter: t = typeof(System.Windows.Controls.ScrollContentPresenter); break;
case KnownElements.ScrollViewer: t = typeof(System.Windows.Controls.ScrollViewer); break;
case KnownElements.Section: t = typeof(System.Windows.Documents.Section); break;
case KnownElements.SeekStoryboard: t = typeof(System.Windows.Media.Animation.SeekStoryboard); break;
case KnownElements.Selector: t = typeof(System.Windows.Controls.Primitives.Selector); break;
case KnownElements.Separator: t = typeof(System.Windows.Controls.Separator); break;
case KnownElements.SetStoryboardSpeedRatio: t = typeof(System.Windows.Media.Animation.SetStoryboardSpeedRatio); break;
case KnownElements.Setter: t = typeof(System.Windows.Setter); break;
case KnownElements.SetterBase: t = typeof(System.Windows.SetterBase); break;
case KnownElements.Shape: t = typeof(System.Windows.Shapes.Shape); break;
case KnownElements.Single: t = typeof(System.Single); break;
case KnownElements.SingleAnimation: t = typeof(System.Windows.Media.Animation.SingleAnimation); break;
case KnownElements.SingleAnimationBase: t = typeof(System.Windows.Media.Animation.SingleAnimationBase); break;
case KnownElements.SingleAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.SingleAnimationUsingKeyFrames); break;
case KnownElements.SingleConverter: t = typeof(System.ComponentModel.SingleConverter); break;
case KnownElements.SingleKeyFrame: t = typeof(System.Windows.Media.Animation.SingleKeyFrame); break;
case KnownElements.SingleKeyFrameCollection: t = typeof(System.Windows.Media.Animation.SingleKeyFrameCollection); break;
case KnownElements.Size: t = typeof(System.Windows.Size); break;
case KnownElements.Size3D: t = typeof(System.Windows.Media.Media3D.Size3D); break;
case KnownElements.Size3DConverter: t = typeof(System.Windows.Media.Media3D.Size3DConverter); break;
case KnownElements.SizeAnimation: t = typeof(System.Windows.Media.Animation.SizeAnimation); break;
case KnownElements.SizeAnimationBase: t = typeof(System.Windows.Media.Animation.SizeAnimationBase); break;
case KnownElements.SizeAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.SizeAnimationUsingKeyFrames); break;
case KnownElements.SizeConverter: t = typeof(System.Windows.SizeConverter); break;
case KnownElements.SizeKeyFrame: t = typeof(System.Windows.Media.Animation.SizeKeyFrame); break;
case KnownElements.SizeKeyFrameCollection: t = typeof(System.Windows.Media.Animation.SizeKeyFrameCollection); break;
case KnownElements.SkewTransform: t = typeof(System.Windows.Media.SkewTransform); break;
case KnownElements.SkipStoryboardToFill: t = typeof(System.Windows.Media.Animation.SkipStoryboardToFill); break;
case KnownElements.Slider: t = typeof(System.Windows.Controls.Slider); break;
case KnownElements.SolidColorBrush: t = typeof(System.Windows.Media.SolidColorBrush); break;
case KnownElements.SoundPlayerAction: t = typeof(System.Windows.Controls.SoundPlayerAction); break;
case KnownElements.Span: t = typeof(System.Windows.Documents.Span); break;
case KnownElements.SpecularMaterial: t = typeof(System.Windows.Media.Media3D.SpecularMaterial); break;
case KnownElements.SpellCheck: t = typeof(System.Windows.Controls.SpellCheck); break;
case KnownElements.SplineByteKeyFrame: t = typeof(System.Windows.Media.Animation.SplineByteKeyFrame); break;
case KnownElements.SplineColorKeyFrame: t = typeof(System.Windows.Media.Animation.SplineColorKeyFrame); break;
case KnownElements.SplineDecimalKeyFrame: t = typeof(System.Windows.Media.Animation.SplineDecimalKeyFrame); break;
case KnownElements.SplineDoubleKeyFrame: t = typeof(System.Windows.Media.Animation.SplineDoubleKeyFrame); break;
case KnownElements.SplineInt16KeyFrame: t = typeof(System.Windows.Media.Animation.SplineInt16KeyFrame); break;
case KnownElements.SplineInt32KeyFrame: t = typeof(System.Windows.Media.Animation.SplineInt32KeyFrame); break;
case KnownElements.SplineInt64KeyFrame: t = typeof(System.Windows.Media.Animation.SplineInt64KeyFrame); break;
case KnownElements.SplinePoint3DKeyFrame: t = typeof(System.Windows.Media.Animation.SplinePoint3DKeyFrame); break;
case KnownElements.SplinePointKeyFrame: t = typeof(System.Windows.Media.Animation.SplinePointKeyFrame); break;
case KnownElements.SplineQuaternionKeyFrame: t = typeof(System.Windows.Media.Animation.SplineQuaternionKeyFrame); break;
case KnownElements.SplineRectKeyFrame: t = typeof(System.Windows.Media.Animation.SplineRectKeyFrame); break;
case KnownElements.SplineRotation3DKeyFrame: t = typeof(System.Windows.Media.Animation.SplineRotation3DKeyFrame); break;
case KnownElements.SplineSingleKeyFrame: t = typeof(System.Windows.Media.Animation.SplineSingleKeyFrame); break;
case KnownElements.SplineSizeKeyFrame: t = typeof(System.Windows.Media.Animation.SplineSizeKeyFrame); break;
case KnownElements.SplineThicknessKeyFrame: t = typeof(System.Windows.Media.Animation.SplineThicknessKeyFrame); break;
case KnownElements.SplineVector3DKeyFrame: t = typeof(System.Windows.Media.Animation.SplineVector3DKeyFrame); break;
case KnownElements.SplineVectorKeyFrame: t = typeof(System.Windows.Media.Animation.SplineVectorKeyFrame); break;
case KnownElements.SpotLight: t = typeof(System.Windows.Media.Media3D.SpotLight); break;
case KnownElements.StackPanel: t = typeof(System.Windows.Controls.StackPanel); break;
case KnownElements.StaticExtension: t = typeof(System.Windows.Markup.StaticExtension); break;
case KnownElements.StaticResourceExtension: t = typeof(System.Windows.StaticResourceExtension); break;
case KnownElements.StatusBar: t = typeof(System.Windows.Controls.Primitives.StatusBar); break;
case KnownElements.StatusBarItem: t = typeof(System.Windows.Controls.Primitives.StatusBarItem); break;
case KnownElements.StickyNoteControl: t = typeof(System.Windows.Controls.StickyNoteControl); break;
case KnownElements.StopStoryboard: t = typeof(System.Windows.Media.Animation.StopStoryboard); break;
case KnownElements.Storyboard: t = typeof(System.Windows.Media.Animation.Storyboard); break;
case KnownElements.StreamGeometry: t = typeof(System.Windows.Media.StreamGeometry); break;
case KnownElements.StreamGeometryContext: t = typeof(System.Windows.Media.StreamGeometryContext); break;
case KnownElements.StreamResourceInfo: t = typeof(System.Windows.Resources.StreamResourceInfo); break;
case KnownElements.String: t = typeof(System.String); break;
case KnownElements.StringAnimationBase: t = typeof(System.Windows.Media.Animation.StringAnimationBase); break;
case KnownElements.StringAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.StringAnimationUsingKeyFrames); break;
case KnownElements.StringConverter: t = typeof(System.ComponentModel.StringConverter); break;
case KnownElements.StringKeyFrame: t = typeof(System.Windows.Media.Animation.StringKeyFrame); break;
case KnownElements.StringKeyFrameCollection: t = typeof(System.Windows.Media.Animation.StringKeyFrameCollection); break;
case KnownElements.StrokeCollection: t = typeof(System.Windows.Ink.StrokeCollection); break;
case KnownElements.StrokeCollectionConverter: t = typeof(System.Windows.StrokeCollectionConverter); break;
case KnownElements.Style: t = typeof(System.Windows.Style); break;
case KnownElements.Stylus: t = typeof(System.Windows.Input.Stylus); break;
case KnownElements.StylusDevice: t = typeof(System.Windows.Input.StylusDevice); break;
case KnownElements.TabControl: t = typeof(System.Windows.Controls.TabControl); break;
case KnownElements.TabItem: t = typeof(System.Windows.Controls.TabItem); break;
case KnownElements.TabPanel: t = typeof(System.Windows.Controls.Primitives.TabPanel); break;
case KnownElements.Table: t = typeof(System.Windows.Documents.Table); break;
case KnownElements.TableCell: t = typeof(System.Windows.Documents.TableCell); break;
case KnownElements.TableColumn: t = typeof(System.Windows.Documents.TableColumn); break;
case KnownElements.TableRow: t = typeof(System.Windows.Documents.TableRow); break;
case KnownElements.TableRowGroup: t = typeof(System.Windows.Documents.TableRowGroup); break;
case KnownElements.TabletDevice: t = typeof(System.Windows.Input.TabletDevice); break;
case KnownElements.TemplateBindingExpression: t = typeof(System.Windows.TemplateBindingExpression); break;
case KnownElements.TemplateBindingExpressionConverter: t = typeof(System.Windows.TemplateBindingExpressionConverter); break;
case KnownElements.TemplateBindingExtension: t = typeof(System.Windows.TemplateBindingExtension); break;
case KnownElements.TemplateBindingExtensionConverter: t = typeof(System.Windows.TemplateBindingExtensionConverter); break;
case KnownElements.TemplateKey: t = typeof(System.Windows.TemplateKey); break;
case KnownElements.TemplateKeyConverter: t = typeof(System.Windows.Markup.TemplateKeyConverter); break;
case KnownElements.TextBlock: t = typeof(System.Windows.Controls.TextBlock); break;
case KnownElements.TextBox: t = typeof(System.Windows.Controls.TextBox); break;
case KnownElements.TextBoxBase: t = typeof(System.Windows.Controls.Primitives.TextBoxBase); break;
case KnownElements.TextComposition: t = typeof(System.Windows.Input.TextComposition); break;
case KnownElements.TextCompositionManager: t = typeof(System.Windows.Input.TextCompositionManager); break;
case KnownElements.TextDecoration: t = typeof(System.Windows.TextDecoration); break;
case KnownElements.TextDecorationCollection: t = typeof(System.Windows.TextDecorationCollection); break;
case KnownElements.TextDecorationCollectionConverter: t = typeof(System.Windows.TextDecorationCollectionConverter); break;
case KnownElements.TextEffect: t = typeof(System.Windows.Media.TextEffect); break;
case KnownElements.TextEffectCollection: t = typeof(System.Windows.Media.TextEffectCollection); break;
case KnownElements.TextElement: t = typeof(System.Windows.Documents.TextElement); break;
case KnownElements.TextSearch: t = typeof(System.Windows.Controls.TextSearch); break;
case KnownElements.ThemeDictionaryExtension: t = typeof(System.Windows.ThemeDictionaryExtension); break;
case KnownElements.Thickness: t = typeof(System.Windows.Thickness); break;
case KnownElements.ThicknessAnimation: t = typeof(System.Windows.Media.Animation.ThicknessAnimation); break;
case KnownElements.ThicknessAnimationBase: t = typeof(System.Windows.Media.Animation.ThicknessAnimationBase); break;
case KnownElements.ThicknessAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames); break;
case KnownElements.ThicknessConverter: t = typeof(System.Windows.ThicknessConverter); break;
case KnownElements.ThicknessKeyFrame: t = typeof(System.Windows.Media.Animation.ThicknessKeyFrame); break;
case KnownElements.ThicknessKeyFrameCollection: t = typeof(System.Windows.Media.Animation.ThicknessKeyFrameCollection); break;
case KnownElements.Thumb: t = typeof(System.Windows.Controls.Primitives.Thumb); break;
case KnownElements.TickBar: t = typeof(System.Windows.Controls.Primitives.TickBar); break;
case KnownElements.TiffBitmapDecoder: t = typeof(System.Windows.Media.Imaging.TiffBitmapDecoder); break;
case KnownElements.TiffBitmapEncoder: t = typeof(System.Windows.Media.Imaging.TiffBitmapEncoder); break;
case KnownElements.TileBrush: t = typeof(System.Windows.Media.TileBrush); break;
case KnownElements.TimeSpan: t = typeof(System.TimeSpan); break;
case KnownElements.TimeSpanConverter: t = typeof(System.ComponentModel.TimeSpanConverter); break;
case KnownElements.Timeline: t = typeof(System.Windows.Media.Animation.Timeline); break;
case KnownElements.TimelineCollection: t = typeof(System.Windows.Media.Animation.TimelineCollection); break;
case KnownElements.TimelineGroup: t = typeof(System.Windows.Media.Animation.TimelineGroup); break;
case KnownElements.ToggleButton: t = typeof(System.Windows.Controls.Primitives.ToggleButton); break;
case KnownElements.ToolBar: t = typeof(System.Windows.Controls.ToolBar); break;
case KnownElements.ToolBarOverflowPanel: t = typeof(System.Windows.Controls.Primitives.ToolBarOverflowPanel); break;
case KnownElements.ToolBarPanel: t = typeof(System.Windows.Controls.Primitives.ToolBarPanel); break;
case KnownElements.ToolBarTray: t = typeof(System.Windows.Controls.ToolBarTray); break;
case KnownElements.ToolTip: t = typeof(System.Windows.Controls.ToolTip); break;
case KnownElements.ToolTipService: t = typeof(System.Windows.Controls.ToolTipService); break;
case KnownElements.Track: t = typeof(System.Windows.Controls.Primitives.Track); break;
case KnownElements.Transform: t = typeof(System.Windows.Media.Transform); break;
case KnownElements.Transform3D: t = typeof(System.Windows.Media.Media3D.Transform3D); break;
case KnownElements.Transform3DCollection: t = typeof(System.Windows.Media.Media3D.Transform3DCollection); break;
case KnownElements.Transform3DGroup: t = typeof(System.Windows.Media.Media3D.Transform3DGroup); break;
case KnownElements.TransformCollection: t = typeof(System.Windows.Media.TransformCollection); break;
case KnownElements.TransformConverter: t = typeof(System.Windows.Media.TransformConverter); break;
case KnownElements.TransformGroup: t = typeof(System.Windows.Media.TransformGroup); break;
case KnownElements.TransformedBitmap: t = typeof(System.Windows.Media.Imaging.TransformedBitmap); break;
case KnownElements.TranslateTransform: t = typeof(System.Windows.Media.TranslateTransform); break;
case KnownElements.TranslateTransform3D: t = typeof(System.Windows.Media.Media3D.TranslateTransform3D); break;
case KnownElements.TreeView: t = typeof(System.Windows.Controls.TreeView); break;
case KnownElements.TreeViewItem: t = typeof(System.Windows.Controls.TreeViewItem); break;
case KnownElements.Trigger: t = typeof(System.Windows.Trigger); break;
case KnownElements.TriggerAction: t = typeof(System.Windows.TriggerAction); break;
case KnownElements.TriggerBase: t = typeof(System.Windows.TriggerBase); break;
case KnownElements.TypeExtension: t = typeof(System.Windows.Markup.TypeExtension); break;
case KnownElements.TypeTypeConverter: t = typeof(System.Windows.Markup.TypeTypeConverter); break;
case KnownElements.Typography: t = typeof(System.Windows.Documents.Typography); break;
case KnownElements.UIElement: t = typeof(System.Windows.UIElement); break;
case KnownElements.UInt16: t = typeof(System.UInt16); break;
case KnownElements.UInt16Converter: t = typeof(System.ComponentModel.UInt16Converter); break;
case KnownElements.UInt32: t = typeof(System.UInt32); break;
case KnownElements.UInt32Converter: t = typeof(System.ComponentModel.UInt32Converter); break;
case KnownElements.UInt64: t = typeof(System.UInt64); break;
case KnownElements.UInt64Converter: t = typeof(System.ComponentModel.UInt64Converter); break;
case KnownElements.UShortIListConverter: t = typeof(System.Windows.Media.Converters.UShortIListConverter); break;
case KnownElements.Underline: t = typeof(System.Windows.Documents.Underline); break;
case KnownElements.UniformGrid: t = typeof(System.Windows.Controls.Primitives.UniformGrid); break;
case KnownElements.Uri: t = typeof(System.Uri); break;
case KnownElements.UriTypeConverter: t = typeof(System.UriTypeConverter); break;
case KnownElements.UserControl: t = typeof(System.Windows.Controls.UserControl); break;
case KnownElements.Validation: t = typeof(System.Windows.Controls.Validation); break;
case KnownElements.Vector: t = typeof(System.Windows.Vector); break;
case KnownElements.Vector3D: t = typeof(System.Windows.Media.Media3D.Vector3D); break;
case KnownElements.Vector3DAnimation: t = typeof(System.Windows.Media.Animation.Vector3DAnimation); break;
case KnownElements.Vector3DAnimationBase: t = typeof(System.Windows.Media.Animation.Vector3DAnimationBase); break;
case KnownElements.Vector3DAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames); break;
case KnownElements.Vector3DCollection: t = typeof(System.Windows.Media.Media3D.Vector3DCollection); break;
case KnownElements.Vector3DCollectionConverter: t = typeof(System.Windows.Media.Media3D.Vector3DCollectionConverter); break;
case KnownElements.Vector3DConverter: t = typeof(System.Windows.Media.Media3D.Vector3DConverter); break;
case KnownElements.Vector3DKeyFrame: t = typeof(System.Windows.Media.Animation.Vector3DKeyFrame); break;
case KnownElements.Vector3DKeyFrameCollection: t = typeof(System.Windows.Media.Animation.Vector3DKeyFrameCollection); break;
case KnownElements.VectorAnimation: t = typeof(System.Windows.Media.Animation.VectorAnimation); break;
case KnownElements.VectorAnimationBase: t = typeof(System.Windows.Media.Animation.VectorAnimationBase); break;
case KnownElements.VectorAnimationUsingKeyFrames: t = typeof(System.Windows.Media.Animation.VectorAnimationUsingKeyFrames); break;
case KnownElements.VectorCollection: t = typeof(System.Windows.Media.VectorCollection); break;
case KnownElements.VectorCollectionConverter: t = typeof(System.Windows.Media.VectorCollectionConverter); break;
case KnownElements.VectorConverter: t = typeof(System.Windows.VectorConverter); break;
case KnownElements.VectorKeyFrame: t = typeof(System.Windows.Media.Animation.VectorKeyFrame); break;
case KnownElements.VectorKeyFrameCollection: t = typeof(System.Windows.Media.Animation.VectorKeyFrameCollection); break;
case KnownElements.VideoDrawing: t = typeof(System.Windows.Media.VideoDrawing); break;
case KnownElements.ViewBase: t = typeof(System.Windows.Controls.ViewBase); break;
case KnownElements.Viewbox: t = typeof(System.Windows.Controls.Viewbox); break;
case KnownElements.Viewport3D: t = typeof(System.Windows.Controls.Viewport3D); break;
case KnownElements.Viewport3DVisual: t = typeof(System.Windows.Media.Media3D.Viewport3DVisual); break;
case KnownElements.VirtualizingPanel: t = typeof(System.Windows.Controls.VirtualizingPanel); break;
case KnownElements.VirtualizingStackPanel: t = typeof(System.Windows.Controls.VirtualizingStackPanel); break;
case KnownElements.Visual: t = typeof(System.Windows.Media.Visual); break;
case KnownElements.Visual3D: t = typeof(System.Windows.Media.Media3D.Visual3D); break;
case KnownElements.VisualBrush: t = typeof(System.Windows.Media.VisualBrush); break;
case KnownElements.VisualTarget: t = typeof(System.Windows.Media.VisualTarget); break;
case KnownElements.WeakEventManager: t = typeof(System.Windows.WeakEventManager); break;
case KnownElements.WhitespaceSignificantCollectionAttribute: t = typeof(System.Windows.Markup.WhitespaceSignificantCollectionAttribute); break;
case KnownElements.Window: t = typeof(System.Windows.Window); break;
case KnownElements.WmpBitmapDecoder: t = typeof(System.Windows.Media.Imaging.WmpBitmapDecoder); break;
case KnownElements.WmpBitmapEncoder: t = typeof(System.Windows.Media.Imaging.WmpBitmapEncoder); break;
case KnownElements.WrapPanel: t = typeof(System.Windows.Controls.WrapPanel); break;
case KnownElements.WriteableBitmap: t = typeof(System.Windows.Media.Imaging.WriteableBitmap); break;
case KnownElements.XamlBrushSerializer: t = typeof(System.Windows.Markup.XamlBrushSerializer); break;
case KnownElements.XamlInt32CollectionSerializer: t = typeof(System.Windows.Markup.XamlInt32CollectionSerializer); break;
case KnownElements.XamlPathDataSerializer: t = typeof(System.Windows.Markup.XamlPathDataSerializer); break;
case KnownElements.XamlPoint3DCollectionSerializer: t = typeof(System.Windows.Markup.XamlPoint3DCollectionSerializer); break;
case KnownElements.XamlPointCollectionSerializer: t = typeof(System.Windows.Markup.XamlPointCollectionSerializer); break;
case KnownElements.XamlReader: t = typeof(System.Windows.Markup.XamlReader); break;
case KnownElements.XamlStyleSerializer: t = typeof(System.Windows.Markup.XamlStyleSerializer); break;
case KnownElements.XamlTemplateSerializer: t = typeof(System.Windows.Markup.XamlTemplateSerializer); break;
case KnownElements.XamlVector3DCollectionSerializer: t = typeof(System.Windows.Markup.XamlVector3DCollectionSerializer); break;
case KnownElements.XamlWriter: t = typeof(System.Windows.Markup.XamlWriter); break;
case KnownElements.XmlDataProvider: t = typeof(System.Windows.Data.XmlDataProvider); break;
case KnownElements.XmlLangPropertyAttribute: t = typeof(System.Windows.Markup.XmlLangPropertyAttribute); break;
case KnownElements.XmlLanguage: t = typeof(System.Windows.Markup.XmlLanguage); break;
case KnownElements.XmlLanguageConverter: t = typeof(System.Windows.Markup.XmlLanguageConverter); break;
case KnownElements.XmlNamespaceMapping: t = typeof(System.Windows.Data.XmlNamespaceMapping); break;
case KnownElements.ZoomPercentageConverter: t = typeof(System.Windows.Documents.ZoomPercentageConverter); break;
}
return t;
}
#endif // PBTCOMPILER else
}
#endif // !BAMLDASM
}
| 73.524081 | 168 | 0.667618 | [
"MIT"
] | ICU-UCI/wpf | src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/KnownTypes.cs | 464,084 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MVVMFirma.ViewModels
{
public class NoweZamowienieViewModel : WorkspaceViewModel//bo wszystkie VM zakładek dziedzcza po Work...
{
public NoweZamowienieViewModel()
{
base.DisplayName = "Zamowienie";
}
}
} | 23.266667 | 108 | 0.687679 | [
"MIT"
] | kzrepo/studia-aplikacje-desktopowe-laboratorium | MVVMFirma/ViewModels/NoweZamowienieViewModel.cs | 352 | C# |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace SiteMonitR.Common
{
public class SiteMonitRConfiguration
{
public const string TABLE_NAME_SITES = "SiteMonitRSites";
public const string TABLE_NAME_SITE_LOGS = "SiteMonitRSiteLog";
public const string QUEUE_NAME_NEW_SITE = "sitemonitr-site-create";
public const string QUEUE_NAME_INCOMING_SITE_LOG = "sitemonitr-site-result";
public const string QUEUE_NAME_DELETE_SITE = "sitemonitr-site-delete";
public const string DASHBOARD_SITE_UP = "Up";
public const string DASHBOARD_SITE_DOWN = "Down";
public const string DASHBOARD_SITE_CHECKING = "Checking";
public const string DASHBOARD_SITE_UNCHECKED = "Unchecked";
public static string CleanUrlForRowKey(string url)
{
var regexp = new System.Text.RegularExpressions.Regex(@"([{}\(\)\^$&._%#!@=<>:;,~`'\’\*\?\/\+\|\[\\\\]|\]|\-)");
var cleansedUrl = regexp.Replace(url, string.Empty);
return cleansedUrl;
}
private static string GetAppSetting(string key, string defaultValue)
{
var config = ConfigurationManager.AppSettings[key];
if (config == null)
return defaultValue;
else
return config;
}
public static string GetPartitionKey()
{
return GetAppSetting("SiteMonitR.PartitionKey", "default");
}
public static string GetDashboardUrl()
{
return GetAppSetting("SiteMonitR.DashboardUrl", "http://localhost:9675");
}
private static HttpClient GetWebApiClient()
{
var client = new HttpClient();
client.BaseAddress = new Uri(GetDashboardUrl());
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
return client;
}
public static async void UpdateDashboard(SiteResult status)
{
using (var client = GetWebApiClient())
{
await client.PostAsJsonAsync<SiteResult>("api/updatedashboard", status);
}
}
public static async void RefreshDashboard()
{
using (var client = GetWebApiClient())
{
await client.GetAsync("api/refreshdashboard");
}
}
}
}
| 32.691358 | 124 | 0.612915 | [
"Apache-2.0"
] | ammogcoder/SiteMonitR | SiteMonitR.Common/SiteMonitRConfiguration.cs | 2,652 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InnerFence.ChargeAPI
{
public class ChargeRequest
{
public const string CCTERMINAL_BASE_URL = @"com-innerfence-ccterminal://charge/1.0.0/";
public const string CCTERMINAL_DISPLAY_NAME = "Credit Card Terminal";
public const string CCTERMINAL_WINDOWS_PFN = "InnerFence.CreditCardTerminal_0mbyxksw3w1fr";
public const string CCTERMINAL_WINDOWS_STORE_LINK = "ms-windows-store:PDP?PFN=" + CCTERMINAL_WINDOWS_PFN;
public const string CCTERMINAL_WP8_APP_ID = "58b2239f-30de-df11-a844-00237de2db9e";
public const string CCTERMINAL_WP8_STORE_LINK = "zune:navigate?appid=" + CCTERMINAL_WP8_APP_ID;
public static class Keys
{
public const string ADDRESS = "address";
public const string AMOUNT = "amount";
public const string AMOUNT_FIXED = "amountFixed";
public const string CITY = "city";
public const string COMPANY = "company";
public const string COUNTRY = "country";
public const string CURRENCY = "currency";
public const string DESCRIPTION = "description";
public const string EMAIL = "email";
public const string FIRST_NAME = "firstName";
public const string INVOICE_NUMBER = "invoiceNumber";
public const string LAST_NAME = "lastName";
public const string PHONE = "phone";
public const string RETURN_APP_NAME = "returnAppName";
public const string RETURN_IMMEDIATELY = "returnImmediately";
public const string RETURN_URL = "returnURL";
public const string STATE = "state";
public const string TAX_RATE = "taxRate";
public const string ZIP = "zip";
}
public ChargeRequest()
{
}
public string Address { get; set; }
public string Amount { get; set; }
public string AmountFixed { get; set; }
public string City { get; set; }
public string Company { get; set; }
public string Country { get; set; }
public string Currency { get; set; }
public string Description { get; set; }
public string Email { get; set; }
public string FirstName { get; set; }
public string InvoiceNumber { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
public string ReturnAppName { get; set; }
public string ReturnImmediately { get; set; }
public string ReturnURL { get; protected set; }
public string State { get; set; }
public string TaxRate { get; set; }
public string Zip { get; set; }
public void SetReturnURL(string returnURL, Dictionary<string, string> extraParams)
{
Uri uri = new Uri(returnURL);
// genereate nonce and add it to extra params
if (null == extraParams)
{
extraParams = new Dictionary<string, string>();
}
string nonce = CreateAndStoreNonce();
extraParams.Add(ChargeResponse.Keys.NONCE, nonce);
this.ReturnURL = ChargeUtils.UriWithAdditionalParams(uri, extraParams).ToString();
}
public Dictionary<string, string> GenerateParams()
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add(Keys.ADDRESS, this.Address);
parameters.Add(Keys.AMOUNT, this.Amount);
parameters.Add(Keys.AMOUNT_FIXED, this.AmountFixed);
parameters.Add(Keys.CITY, this.City);
parameters.Add(Keys.COMPANY, this.Company);
parameters.Add(Keys.COUNTRY, this.Country);
parameters.Add(Keys.CURRENCY, this.Currency);
parameters.Add(Keys.DESCRIPTION, this.Description);
parameters.Add(Keys.EMAIL, this.Email);
parameters.Add(Keys.FIRST_NAME, this.FirstName);
parameters.Add(Keys.INVOICE_NUMBER, this.InvoiceNumber);
parameters.Add(Keys.LAST_NAME, this.LastName);
parameters.Add(Keys.PHONE, this.Phone);
parameters.Add(Keys.RETURN_APP_NAME, this.ReturnAppName);
parameters.Add(Keys.RETURN_IMMEDIATELY, this.ReturnImmediately);
parameters.Add(Keys.RETURN_URL, this.ReturnURL);
parameters.Add(Keys.STATE, this.State);
parameters.Add(Keys.TAX_RATE, this.TaxRate);
parameters.Add(Keys.ZIP, this.Zip);
return parameters;
}
public string CreateAndStoreNonce()
{
string nonce = ChargeUtils.GenerateNonce();
ChargeUtils.SaveLocalData(ChargeResponse.Keys.NONCE, nonce);
return nonce;
}
public Uri GenerateLaunchURL()
{
Uri uri = new Uri(CCTERMINAL_BASE_URL);
Dictionary<string, string> parameters = this.GenerateParams();
return ChargeUtils.UriWithAdditionalParams(uri, parameters);
}
}
}
| 42.178862 | 113 | 0.625289 | [
"MIT"
] | innerfence/chargedemo-windows | InnerFence.ChargeAPI/ChargeRequest.cs | 5,190 | C# |
// -----------------------------------------------------------------------------
// 让 .NET 开发更简单,更通用,更流行。
// Copyright © 2020-2021 Furion, 百小僧, Baiqian Co.,Ltd.
//
// 框架名称:Furion
// 框架作者:百小僧
// 框架版本:2.8.6
// 源码地址:Gitee: https://gitee.com/dotnetchina/Furion
// Github:https://github.com/monksoul/Furion
// 开源协议:Apache-2.0(https://gitee.com/dotnetchina/Furion/blob/master/LICENSE)
// -----------------------------------------------------------------------------
using Furion.DependencyInjection;
using System.ComponentModel;
namespace Furion.TaskScheduler
{
/// <summary>
/// 任务类型
/// </summary>
[SkipScan]
public enum SpareTimeTypes
{
/// <summary>
/// 间隔方式
/// </summary>
[Description("间隔方式")]
Interval,
/// <summary>
/// Cron 表达式
/// </summary>
[Description("Cron 表达式")]
Cron
}
} | 25.027778 | 81 | 0.472808 | [
"Apache-2.0"
] | staoran/Furion | framework/Furion.Pure/TaskScheduler/Enums/SpareTimeTypes.cs | 1,040 | C# |
/*
Copyright (c) 2005 Poderosa Project, All Rights Reserved.
This file is a part of the Granados SSH Client Library that is subject to
the license included in the distributed package.
You may not use this file except in compliance with the license.
$Id: SSH1Packet.cs,v 1.4 2011/10/27 23:21:56 kzmi Exp $
*/
/*
* structure of packet
*
* length(4) padding(1-8) type(1) data(0+) crc(4)
*
* 1. length = type+data+crc
* 2. the length of padding+type+data+crc must be a multiple of 8
* 3. padding length must be 1 at least
* 4. crc is calculated from padding,type and data
*
*/
using System;
using System.Collections;
using System.Diagnostics;
using System.Threading;
using Granados.Crypto;
using Granados.IO;
using Granados.IO.SSH1;
using Granados.Util;
namespace Granados.SSH1 {
internal class SSH1Packet {
private byte _type;
private byte[] _data;
private uint _CRC;
/**
* constructs from the packet type and the body
*/
public static SSH1Packet FromPlainPayload(PacketType type, byte[] data) {
SSH1Packet p = new SSH1Packet();
p._type = (byte)type;
p._data = data;
return p;
}
public static SSH1Packet FromPlainPayload(PacketType type) {
SSH1Packet p = new SSH1Packet();
p._type = (byte)type;
p._data = new byte[0];
return p;
}
/**
* creates a packet as the input of shell
*/
static SSH1Packet AsStdinString(byte[] input) {
SSH1DataWriter w = new SSH1DataWriter();
w.WriteAsString(input);
SSH1Packet p = SSH1Packet.FromPlainPayload(PacketType.SSH_CMSG_STDIN_DATA, w.ToByteArray());
return p;
}
private byte[] BuildImage() {
int packet_length = (_data == null ? 0 : _data.Length) + 5; //type and CRC
int padding_length = 8 - (packet_length % 8);
byte[] image = new byte[packet_length + padding_length + 4];
SSHUtil.WriteIntToByteArray(image, 0, packet_length);
for (int i = 0; i < padding_length; i++)
image[4 + i] = 0; //padding: filling by random values is better
image[4 + padding_length] = _type;
if (_data != null)
Array.Copy(_data, 0, image, 4 + padding_length + 1, _data.Length);
_CRC = CRC.Calc(image, 4, image.Length - 8);
SSHUtil.WriteIntToByteArray(image, image.Length - 4, (int)_CRC);
return image;
}
/**
* writes to plain stream
*/
public void WriteTo(AbstractGranadosSocket output) {
byte[] image = BuildImage();
output.Write(image, 0, image.Length);
}
/**
* writes to encrypted stream
*/
public void WriteTo(AbstractGranadosSocket output, Cipher cipher) {
byte[] image = BuildImage();
//dumpBA(image);
byte[] encrypted = new byte[image.Length - 4];
cipher.Encrypt(image, 4, image.Length - 4, encrypted, 0); //length field must not be encrypted
Array.Copy(encrypted, 0, image, 4, encrypted.Length);
output.Write(image, 0, image.Length);
}
public PacketType Type {
get {
return (PacketType)_type;
}
}
public byte[] Data {
get {
return _data;
}
}
public int DataLength {
get {
return _data == null ? 0 : _data.Length;
}
}
}
internal class CallbackSSH1PacketHandler : IDataHandler {
internal SSH1Connection _connection;
internal CallbackSSH1PacketHandler(SSH1Connection con) {
_connection = con;
}
public void OnData(DataFragment data) {
_connection.AsyncReceivePacket(data);
}
public void OnError(Exception error) {
_connection.EventReceiver.OnError(error);
}
public void OnClosed() {
_connection.EventReceiver.OnConnectionClosed();
}
}
internal class SSH1PacketBuilder : FilterDataHandler {
private byte[] _buffer;
private int _readOffset;
private int _writeOffset;
private Cipher _cipher;
private bool _checkMAC;
public SSH1PacketBuilder(IDataHandler handler)
: base(handler) {
_buffer = new byte[0x1000];
_readOffset = 0;
_writeOffset = 0;
_cipher = null;
_checkMAC = false;
}
public void SetCipher(Cipher c, bool check_mac) {
_cipher = c;
_checkMAC = check_mac;
}
public override void OnData(DataFragment data) {
try {
while (_buffer.Length - _writeOffset < data.Length)
ExpandBuffer();
Array.Copy(data.Data, data.Offset, _buffer, _writeOffset, data.Length);
_writeOffset += data.Length;
DataFragment p = ConstructPacket();
while (p != null) {
_inner_handler.OnData(p);
p = ConstructPacket();
}
ReduceBuffer();
}
catch (Exception ex) {
_inner_handler.OnError(ex);
}
}
//returns true if a new packet could be obtained
private DataFragment ConstructPacket() {
if (_writeOffset - _readOffset < 4)
return null;
int packet_length = SSHUtil.ReadInt32(_buffer, _readOffset);
int padding_length = 8 - (packet_length % 8); //padding length
int total = packet_length + padding_length;
if (_writeOffset - _readOffset < 4 + total)
return null;
byte[] decrypted = new byte[total];
if (_cipher != null)
_cipher.Decrypt(_buffer, _readOffset + 4, total, decrypted, 0);
else
Array.Copy(_buffer, _readOffset + 4, decrypted, 0, total);
_readOffset += 4 + total;
SSH1Packet p = new SSH1Packet();
return ConstructAndCheck(decrypted, packet_length, padding_length, _checkMAC);
}
/**
* reads type, data, and crc from byte array.
* an exception is thrown if crc check fails.
*/
private DataFragment ConstructAndCheck(byte[] buf, int packet_length, int padding_length, bool check_crc) {
int body_len = packet_length - 4;
byte[] body = new byte[body_len];
Array.Copy(buf, padding_length, body, 0, body_len);
uint received_crc = (uint)SSHUtil.ReadInt32(buf, buf.Length - 4);
if (check_crc) {
uint crc = CRC.Calc(buf, 0, buf.Length - 4);
if (received_crc != crc)
throw new SSHException("CRC Error", buf);
}
return new DataFragment(body, 0, body_len);
}
private void ExpandBuffer() {
byte[] t = new byte[_buffer.Length * 2];
Array.Copy(_buffer, 0, t, 0, _buffer.Length);
_buffer = t;
}
private void ReduceBuffer() {
if (_readOffset == _writeOffset) {
_readOffset = 0;
_writeOffset = 0;
}
else {
byte[] temp = new byte[_writeOffset - _readOffset];
Array.Copy(_buffer, _readOffset, temp, 0, temp.Length);
Array.Copy(temp, 0, _buffer, 0, temp.Length);
_readOffset = 0;
_writeOffset = temp.Length;
}
}
}
}
| 32.686192 | 115 | 0.548003 | [
"Apache-2.0"
] | FNKGino/poderosa | Granados/SSH1Packet.cs | 7,814 | C# |
using RecipeApp.Base.Interfaces.Models;
using System.Collections.Generic;
namespace RecipeApp.Base.Managers.Models
{
public class MealPlan : IMealPlan
{
public string Guid { get; set; }
public IEnumerable<IRecipe> Recipes { get; set; }
public IEnumerable<IShoppingListItem> ShoppingList { get; set; }
public IUser User { get; set; }
public MealPlan(IMealPlan mealPlan)
{
Guid = mealPlan.Guid;
Recipes = mealPlan.Recipes;
ShoppingList = mealPlan.ShoppingList;
User = mealPlan.User;
}
}
}
| 28.809524 | 72 | 0.621488 | [
"MIT"
] | coltwitch/RecipeApp | src/RecipeApp.Base/Managers/Models/MealPlan.cs | 607 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Reactive.Streams;
using Reactor.Core;
using System.Threading;
using Reactor.Core.flow;
using Reactor.Core.subscriber;
using Reactor.Core.subscription;
using Reactor.Core.util;
using System.Runtime.InteropServices;
namespace Reactor.Core
{
/// <summary>
/// A processor that dispatches signals to its Subscriber and coordinates
/// requests in a lockstep fashion.
/// This type of IProcessor mandates the call to OnSubscribe().
/// </summary>
/// <typeparam name="T">The value type dispatched</typeparam>
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public sealed class PublishProcessor<T> : IFluxProcessor<T>, IDisposable
{
TrackingArray<PublishSubscription> subscribers;
readonly int prefetch;
ISubscription s;
IQueue<T> queue;
int sourceMode;
bool done;
Exception error;
Pad128 p0;
int wip;
Pad120 p1;
/// <inheritDoc/>
public bool HasSubscribers
{
get
{
return subscribers.Array().Length != 0;
}
}
/// <inheritDoc/>
public bool IsComplete
{
get
{
return Volatile.Read(ref done) && error == null;
}
}
/// <inheritDoc/>
public bool HasError
{
get
{
return Volatile.Read(ref error) != null;
}
}
/// <inheritDoc/>
public Exception Error
{
get
{
return Volatile.Read(ref error);
}
}
/// <summary>
/// Constructs a PublishProcessor with the default
/// prefetch amount of <see cref="Flux.BufferSize"/>.
/// </summary>
public PublishProcessor() : this(Flux.BufferSize)
{
}
/// <summary>
/// Constructs a PublishProcessor with the given
/// prefetch amount (rounded to the next power-of-two).
/// </summary>
/// <param name="prefetch">The prefetch amount</param>
public PublishProcessor(int prefetch)
{
subscribers.Init();
this.prefetch = prefetch;
}
/// <inheritDoc/>
public void Dispose()
{
if (SubscriptionHelper.Cancel(ref s))
{
OnError(new OperationCanceledException());
}
}
/// <inheritDoc/>
public void OnSubscribe(ISubscription s)
{
if (SubscriptionHelper.SetOnce(ref this.s, s))
{
var qs = s as IQueueSubscription<T>;
if (qs != null)
{
int m = qs.RequestFusion(FuseableHelper.ANY);
if (m == FuseableHelper.SYNC)
{
sourceMode = m;
queue = qs;
Volatile.Write(ref done, true);
Drain();
return;
}
if (m == FuseableHelper.ASYNC)
{
sourceMode = m;
queue = qs;
s.Request(prefetch < 0 ? long.MaxValue : prefetch);
return;
}
}
queue = QueueDrainHelper.CreateQueue<T>(prefetch);
s.Request(prefetch < 0 ? long.MaxValue : prefetch);
}
}
/// <inheritDoc/>
public void OnComplete()
{
if (done)
{
return;
}
Volatile.Write(ref done, true);
Drain();
}
/// <inheritDoc/>
public void OnError(Exception e)
{
if (done || Interlocked.CompareExchange(ref error, e, null) != null)
{
ExceptionHelper.OnErrorDropped(e);
return;
}
Volatile.Write(ref done, true);
Drain();
}
/// <inheritDoc/>
public void OnNext(T t)
{
if (done)
{
return;
}
if (sourceMode == FuseableHelper.NONE)
{
if (!queue.Offer(t))
{
SubscriptionHelper.Cancel(ref s);
OnError(BackpressureHelper.MissingBackpressureException());
return;
}
}
Drain();
}
/// <inheritDoc/>
public void Subscribe(ISubscriber<T> s)
{
PublishSubscription ps = new PublishSubscription(s, this);
s.OnSubscribe(ps);
if (subscribers.Add(ps))
{
if (ps.IsCancelled())
{
subscribers.Remove(ps);
}
else
{
Drain();
}
}
else
{
var ex = error;
if (ex != null)
{
EmptySubscription<T>.Error(s, ex);
}
else
{
EmptySubscription<T>.Complete(s);
}
}
}
void Drain()
{
if (!QueueDrainHelper.Enter(ref wip))
{
return;
}
int missed = 1;
var q = queue;
for (;;)
{
var array = subscribers.Array();
int n = array.Length;
if (n != 0 && q != null)
{
long r = long.MaxValue;
long e = long.MaxValue;
foreach (var s in array)
{
r = Math.Min(r, s.Requested());
e = Math.Min(e, s.Produced());
}
while (e != r)
{
bool d = Volatile.Read(ref done);
T v;
bool empty = !q.Poll(out v);
if (d && empty)
{
var ex = Volatile.Read(ref error);
if (ex != null)
{
foreach(var a in subscribers.Terminate())
{
a.actual.OnError(ex);
}
}
else
{
foreach (var a in subscribers.Terminate())
{
a.actual.OnComplete();
}
}
return;
}
if (empty)
{
break;
}
foreach (var a in array)
{
a.actual.OnNext(v);
}
e++;
}
if (e == r)
{
bool d = Volatile.Read(ref done);
bool empty = q.IsEmpty();
if (d && empty)
{
var ex = Volatile.Read(ref error);
if (ex != null)
{
foreach (var a in subscribers.Terminate())
{
a.actual.OnError(ex);
}
}
else
{
foreach (var a in subscribers.Terminate())
{
a.actual.OnComplete();
}
}
return;
}
}
if (e != 0L)
{
foreach (var a in array)
{
a.Produced(e);
}
if (sourceMode != FuseableHelper.SYNC)
{
s.Request(e);
}
}
}
missed = QueueDrainHelper.Leave(ref wip, missed);
if (missed == 0)
{
break;
}
}
}
sealed class PublishSubscription : ISubscription
{
internal readonly ISubscriber<T> actual;
readonly PublishProcessor<T> parent;
int cancelled;
long requested;
long produced;
internal PublishSubscription(ISubscriber<T> actual, PublishProcessor<T> parent)
{
this.actual = actual;
this.parent = parent;
}
public void Cancel()
{
if (Interlocked.CompareExchange(ref cancelled, 1, 0) == 0)
{
parent.subscribers.Remove(this);
}
}
public void Request(long n)
{
if (SubscriptionHelper.Validate(n))
{
BackpressureHelper.GetAndAddCap(ref requested, n);
parent.Drain();
}
}
public bool IsCancelled()
{
return Volatile.Read(ref cancelled) != 0;
}
public long Requested()
{
return Volatile.Read(ref requested);
}
public void Produced(long n)
{
produced += n;
}
public long Produced()
{
return produced;
}
}
}
}
| 26.543147 | 91 | 0.364219 | [
"Apache-2.0"
] | reactor-incubator/reactor-core-dotnet | Reactor.Core/PublishProcessor.cs | 10,460 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using Microsoft.Reactive.Testing;
using Xunit;
using ReactiveTests.Dummies;
using System.Reflection;
using System.Threading;
using System.Reactive.Disposables;
using System.Reactive.Subjects;
namespace ReactiveTests.Tests
{
public class TimeoutTest : ReactiveTest
{
[Fact]
public void Timeout_ArgumentChecking()
{
var scheduler = new TestScheduler();
var someObservable = Observable.Empty<int>();
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IObservable<int>)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset()));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IObservable<int>)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, scheduler));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IScheduler)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), TimeSpan.Zero, someObservable, scheduler));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, someObservable, null));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, TimeSpan.Zero, default(IObservable<int>), scheduler));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), scheduler));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IScheduler)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), new DateTimeOffset(), someObservable, scheduler));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), someObservable, null));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, new DateTimeOffset(), default(IObservable<int>), scheduler));
ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1)));
ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), scheduler));
ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), someObservable));
ReactiveAssert.Throws<ArgumentOutOfRangeException>(() => Observable.Timeout(someObservable, TimeSpan.FromSeconds(-1), someObservable, scheduler));
}
[Fact]
public void Timeout_InTime()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(150, 1),
OnNext(210, 2),
OnNext(230, 3),
OnNext(260, 4),
OnNext(300, 5),
OnNext(350, 6),
OnCompleted<int>(400)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(500), scheduler)
);
res.Messages.AssertEqual(
OnNext(210, 2),
OnNext(230, 3),
OnNext(260, 4),
OnNext(300, 5),
OnNext(350, 6),
OnCompleted<int>(400)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutOccurs_WithDefaultException()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(410, 1)
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), scheduler)
);
res.Messages.AssertEqual(
OnError<int>(400, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
}
[Fact]
public void Timeout_TimeSpan_TimeoutOccurs_WithDefaultException()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(410, 1)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(200), scheduler)
);
res.Messages.AssertEqual(
OnError<int>(400, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
}
[Fact]
public void Timeout_TimeSpan_DefaultScheduler()
{
Assert.True(Observable.Return(1).Timeout(TimeSpan.FromSeconds(10)).ToEnumerable().Single() == 1);
}
[Fact]
public void Timeout_TimeSpan_Observable_DefaultScheduler()
{
Assert.True(Observable.Return(1).Timeout(TimeSpan.FromSeconds(10), Observable.Return(2)).ToEnumerable().Single() == 1);
}
[Fact]
public void Timeout_DateTimeOffset_DefaultScheduler()
{
Assert.True(Observable.Return(1).Timeout(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(10)).ToEnumerable().Single() == 1);
}
[Fact]
public void Timeout_DateTimeOffset_Observable_DefaultScheduler()
{
Assert.True(Observable.Return(1).Timeout(DateTimeOffset.UtcNow + TimeSpan.FromSeconds(10), Observable.Return(2)).ToEnumerable().Single() == 1);
}
[Fact]
public void Timeout_TimeoutOccurs_1()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(70, 1),
OnNext(130, 2),
OnNext(310, 3),
OnNext(400, 4),
OnCompleted<int>(500)
);
var ys = scheduler.CreateColdObservable(
OnNext(50, -1),
OnNext(200, -2),
OnNext(310, -3),
OnCompleted<int>(320)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(350, -1),
OnNext(500, -2),
OnNext(610, -3),
OnCompleted<int>(620)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(300, 620)
);
}
[Fact]
public void Timeout_TimeoutOccurs_2()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(70, 1),
OnNext(130, 2),
OnNext(240, 3),
OnNext(310, 4),
OnNext(430, 5),
OnCompleted<int>(500)
);
var ys = scheduler.CreateColdObservable(
OnNext(50, -1),
OnNext(200, -2),
OnNext(310, -3),
OnCompleted<int>(320)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(240, 3),
OnNext(310, 4),
OnNext(460, -1),
OnNext(610, -2),
OnNext(720, -3),
OnCompleted<int>(730)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 410)
);
ys.Subscriptions.AssertEqual(
Subscribe(410, 730)
);
}
[Fact]
public void Timeout_TimeoutOccurs_Never()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(70, 1),
OnNext(130, 2),
OnNext(240, 3),
OnNext(310, 4),
OnNext(430, 5),
OnCompleted<int>(500)
);
var ys = scheduler.CreateColdObservable<int>(
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(240, 3),
OnNext(310, 4)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 410)
);
ys.Subscriptions.AssertEqual(
Subscribe(410, 1000)
);
}
[Fact]
public void Timeout_TimeoutOccurs_Completed()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnCompleted<int>(500)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(400, -1)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(300, 1000)
);
}
[Fact]
public void Timeout_TimeoutOccurs_Error()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnError<int>(500, new Exception())
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(400, -1)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(300, 1000)
);
}
[Fact]
public void Timeout_TimeoutOccurs_NextIsError()
{
var ex = new Exception();
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext<int>(500, 42)
);
var ys = scheduler.CreateColdObservable(
OnError<int>(100, ex)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnError<int>(400, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(300, 400)
);
}
[Fact]
public void Timeout_TimeoutNotOccurs_Completed()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnCompleted<int>(250)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnCompleted<int>(250)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 250)
);
ys.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_TimeoutNotOccurs_Error()
{
var scheduler = new TestScheduler();
var ex = new Exception();
var xs = scheduler.CreateHotObservable(
OnError<int>(250, ex)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnError<int>(250, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 250)
);
ys.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_TimeoutDoesNotOccur()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(70, 1),
OnNext(130, 2),
OnNext(240, 3),
OnNext(320, 4),
OnNext(410, 5),
OnCompleted<int>(500)
);
var ys = scheduler.CreateColdObservable(
OnNext(50, -1),
OnNext(200, -2),
OnNext(310, -3),
OnCompleted<int>(320)
);
var res = scheduler.Start(() =>
xs.Timeout(TimeSpan.FromTicks(100), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(240, 3),
OnNext(320, 4),
OnNext(410, 5),
OnCompleted<int>(500)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 500)
);
ys.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutOccurs()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(410, 1)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(500, -1)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(400, 1000)
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutDoesNotOccur_Completed()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnCompleted<int>(390)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnCompleted<int>(390)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 390)
);
ys.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutDoesNotOccur_Error()
{
var scheduler = new TestScheduler();
var ex = new Exception();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnError<int>(390, ex)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnError<int>(390, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 390)
);
ys.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutOccur_2()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable(
OnNext(100, -1)
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(500, -1)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(400, 1000)
);
}
[Fact]
public void Timeout_DateTimeOffset_TimeoutOccur_3()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<int>(
);
var res = scheduler.Start(() =>
xs.Timeout(new DateTimeOffset(new DateTime(400), TimeSpan.Zero), ys, scheduler)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(400, 1000)
);
}
[Fact]
public void Timeout_Duration_ArgumentChecking()
{
var someObservable = Observable.Empty<int>();
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), someObservable, x => someObservable, someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(IObservable<int>), x => someObservable, someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, default(Func<int, IObservable<int>>), someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, x => someObservable, default(IObservable<int>)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), someObservable, x => someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(IObservable<int>), x => someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, someObservable, default(Func<int, IObservable<int>>)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), x => someObservable, someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(Func<int, IObservable<int>>), someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, x => someObservable, default(IObservable<int>)));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(default(IObservable<int>), x => someObservable));
ReactiveAssert.Throws<ArgumentNullException>(() => Observable.Timeout(someObservable, default(Func<int, IObservable<int>>)));
}
[Fact]
public void Timeout_Duration_Simple_Never()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<int>(
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => ys)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 450)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310),
Subscribe(310, 350),
Subscribe(350, 420),
Subscribe(420, 450)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutFirst()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
OnNext(100, "Boo!")
);
var zs = scheduler.CreateColdObservable<string>(
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => zs)
);
res.Messages.AssertEqual(
OnError<int>(300, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
zs.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutFirst_Other()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
OnNext(100, "Boo!")
);
var zs = scheduler.CreateColdObservable<string>(
);
var ts = scheduler.CreateColdObservable<int>(
OnNext(50, 42),
OnCompleted<int>(70)
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => zs, ts)
);
res.Messages.AssertEqual(
OnNext(350, 42),
OnCompleted<int>(370)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 300)
);
zs.Subscriptions.AssertEqual(
);
ts.Subscriptions.AssertEqual(
Subscribe(300, 370)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutLater()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
OnNext(50, "Boo!")
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => zs)
);
res.Messages.AssertEqual(
OnNext<int>(310, 1),
OnNext<int>(350, 2),
OnError<int>(400, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutLater_Other()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
OnNext(50, "Boo!")
);
var ts = scheduler.CreateColdObservable<int>(
OnNext(50, 42),
OnCompleted<int>(70)
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => zs, ts)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(450, 42),
OnCompleted<int>(470)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
ts.Subscriptions.AssertEqual(
Subscribe(400, 470)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutLater_NoFirst()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var zs = scheduler.CreateColdObservable<string>(
OnNext(50, "Boo!")
);
var res = scheduler.Start(() =>
xs.Timeout(_ => zs)
);
res.Messages.AssertEqual(
OnNext<int>(310, 1),
OnNext<int>(350, 2),
OnError<int>(400, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutLater_Other_NoFirst()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var zs = scheduler.CreateColdObservable<string>(
OnNext(50, "Boo!")
);
var ts = scheduler.CreateColdObservable<int>(
OnNext(50, 42),
OnCompleted<int>(70)
);
var res = scheduler.Start(() =>
xs.Timeout(_ => zs, ts)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(450, 42),
OnCompleted<int>(470)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
ts.Subscriptions.AssertEqual(
Subscribe(400, 470)
);
}
[Fact]
public void Timeout_Duration_Simple_TimeoutByCompletion()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
OnCompleted<string>(50)
);
var res = scheduler.Start(() =>
xs.Timeout(ys, _ => zs)
);
res.Messages.AssertEqual(
OnNext<int>(310, 1),
OnNext<int>(350, 2),
OnError<int>(400, ex => ex is TimeoutException)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
}
[Fact]
public void Timeout_Duration_Simple_SelectorThrows()
{
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
);
var ex = new Exception();
var res = scheduler.Start(() =>
xs.Timeout(ys, x =>
{
if (x < 3)
return zs;
else
throw ex;
})
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnError<int>(420, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 420)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 420)
);
}
[Fact]
public void Timeout_Duration_Simple_InnerThrows()
{
var ex = new Exception();
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
OnError<string>(50, ex)
);
var res = scheduler.Start(() =>
xs.Timeout(ys, x => zs)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnError<int>(400, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 400)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 400)
);
}
[Fact]
public void Timeout_Duration_Simple_FirstThrows()
{
var ex = new Exception();
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnCompleted<int>(450)
);
var ys = scheduler.CreateColdObservable<string>(
OnError<string>(50, ex)
);
var zs = scheduler.CreateColdObservable<string>(
);
var res = scheduler.Start(() =>
xs.Timeout(ys, x => zs)
);
res.Messages.AssertEqual(
OnError<int>(250, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 250)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 250)
);
zs.Subscriptions.AssertEqual(
);
}
[Fact]
public void Timeout_Duration_Simple_SourceThrows()
{
var ex = new Exception();
var scheduler = new TestScheduler();
var xs = scheduler.CreateHotObservable(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnError<int>(450, ex)
);
var ys = scheduler.CreateColdObservable<string>(
);
var zs = scheduler.CreateColdObservable<string>(
);
var res = scheduler.Start(() =>
xs.Timeout(ys, x => zs)
);
res.Messages.AssertEqual(
OnNext(310, 1),
OnNext(350, 2),
OnNext(420, 3),
OnError<int>(450, ex)
);
xs.Subscriptions.AssertEqual(
Subscribe(200, 450)
);
ys.Subscriptions.AssertEqual(
Subscribe(200, 310)
);
zs.Subscriptions.AssertEqual(
Subscribe(310, 350),
Subscribe(350, 420),
Subscribe(420, 450)
);
}
}
}
| 29.543993 | 169 | 0.493743 | [
"Apache-2.0"
] | ryanwersal/reactive | Rx.NET/Source/tests/Tests.System.Reactive/Tests/Linq/Observable/TimeoutTest.cs | 34,923 | C# |
using System;
namespace Starcounter.MultiModelBenchmark.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}
| 19.166667 | 70 | 0.691304 | [
"MIT"
] | Starcounter/Starcounter.MultiModelBenchmark | src/Models/ErrorViewModel.cs | 230 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MetodoGet.Account
{
public partial class ChangePasswordSuccess
{
}
}
| 26.055556 | 82 | 0.413646 | [
"MIT"
] | wgcv/Ayudantias-Programacion-en-Capas | Clase 1 MetodoGet/MetodoGet/Account/ChangePasswordSuccess.aspx.designer.cs | 471 | C# |
using Microsoft.Toolkit.Uwp.Notifications;
using Windows.Data.Xml.Dom;
using Windows.UI.Notifications;
namespace Param_RootNamespace.Services
{
public partial class ToastNotificationsService
{
public void ShowToastNotificationSample()
{
// Create the toast content
var content = new ToastContent()
{
// More about the Launch property at https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.notifications.toastcontent
Launch = "ToastContentActivationParams",
Visual = new ToastVisual()
{
BindingGeneric = new ToastBindingGeneric()
{
Children =
{
new AdaptiveText()
{
Text = "Sample Toast Notification"
},
new AdaptiveText()
{
Text = @"Click OK to see how activation from a toast notification can be handled in the ToastNotificationService."
}
}
}
},
Actions = new ToastActionsCustom()
{
Buttons =
{
// More about Toast Buttons at https://docs.microsoft.com/dotnet/api/microsoft.toolkit.uwp.notifications.toastbutton
new ToastButton("OK", "ToastButtonActivationArguments")
{
ActivationType = ToastActivationType.Foreground
},
new ToastButtonDismiss("Cancel")
}
}
};
// Add the content to the toast
var doc = new XmlDocument();
doc.LoadXml(content.GetContent());
var toast = new ToastNotification(doc)
{
// TODO WTS: Set a unique identifier for this notification within the notification group. (optional)
// More details at https://docs.microsoft.com/uwp/api/windows.ui.notifications.toastnotification.tag
Tag = "ToastTag"
};
// And show the toast
ShowToastNotification(toast);
}
}
} | 38.276923 | 148 | 0.465836 | [
"MIT"
] | ConnectionMaster/WindowsTemplateStudio | templates/Wpf/Features/ToastNotifications/Services/ToastNotificationsService.Samples.cs | 2,426 | C# |
using System.Collections;
using System.Collections.Generic;
using com.mukarillo.prominentcolor;
using UnityEngine;
public class SampleColorGrid : MonoBehaviour {
public List<string> urls = new List<string>();
public Transform elemenTransformParent;
public GameObject elementPrefab;
public int maxColors = 3;
public float colorLimiterPercentage = 85f;
public int uniteColorsTolerance = 5;
public float minimiumColorPercentage = 10f;
private Texture2D mTexture;
private void Start()
{
mTexture = new Texture2D(2, 2);
StartCoroutine(ProminentColorsInUrl(urls));
}
private IEnumerator ProminentColorsInUrl(List<string> imgUrls)
{
for (int i = 0; i < imgUrls.Count; i++)
{
string imgUrl = imgUrls[i];
WWW www = new WWW(imgUrl);
yield return www;
www.LoadImageIntoTexture(mTexture);
if (mTexture == null || (mTexture.width == 8 && mTexture.height == 8)) continue;
Instantiate(elementPrefab, elemenTransformParent)
.GetComponent<Element>()
.SetupElement(mTexture,
ProminentColor.GetColors32FromImage(mTexture,
maxColors,
colorLimiterPercentage,
uniteColorsTolerance,
minimiumColorPercentage));
}
}
}
| 31.413043 | 92 | 0.600692 | [
"MIT"
] | Hsantos/UnityProminentColor | Assets/Package/Samples~/SampleColorGrid/SampleColorGrid.cs | 1,447 | C# |
#pragma checksum "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\Shared\_Layout.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6a69ccf251fd038efc0c1477e1cf3c63d42f15d2"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Shared__Layout), @"mvc.1.0.view", @"/Views/Shared/_Layout.cshtml")]
namespace AspNetCore
{
#line hidden
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
#nullable restore
#line 1 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\_ViewImports.cshtml"
using MVC_CoreProject;
#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\_ViewImports.cshtml"
using MVC_CoreProject.Models;
#line default
#line hidden
#nullable disable
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"6a69ccf251fd038efc0c1477e1cf3c63d42f15d2", @"/Views/Shared/_Layout.cshtml")]
[global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"489d51d8aff94f7b19f5c397c763638bcd9574ac", @"/Views/_ViewImports.cshtml")]
public class Views_Shared__Layout : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
{
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("rel", new global::Microsoft.AspNetCore.Html.HtmlString("stylesheet"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/lib/bootstrap/dist/css/bootstrap.min.css"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/css/site.css"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("navbar-brand"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-area", "", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-controller", "Home", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-action", "Index", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("nav-link text-dark"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_8 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-action", "Privacy", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_9 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/lib/jquery/dist/jquery.min.js"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_10 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_11 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", "~/js/site.js", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line hidden
#pragma warning disable 0649
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext;
#pragma warning restore 0649
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner();
#pragma warning disable 0169
private string __tagHelperStringValueBuffer;
#pragma warning restore 0169
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null;
private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager
{
get
{
if (__backed__tagHelperScopeManager == null)
{
__backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope);
}
return __backed__tagHelperScopeManager;
}
}
private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper;
private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper;
private global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper;
private global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper;
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
WriteLiteral("<!DOCTYPE html>\r\n<html lang=\"en\">\r\n");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d27768", async() => {
WriteLiteral("\r\n <meta charset=\"utf-8\" />\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n <title>");
#nullable restore
#line 6 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\Shared\_Layout.cshtml"
Write(ViewData["Title"]);
#line default
#line hidden
#nullable disable
WriteLiteral(" - MVC_CoreProject</title>\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d28427", async() => {
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d29605", async() => {
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n");
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d211487", async() => {
WriteLiteral("\r\n <header>\r\n <nav class=\"navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3\">\r\n <div class=\"container\">\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d211943", async() => {
WriteLiteral("MVC_CoreProject");
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_4.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral(@"
<button class=""navbar-toggler"" type=""button"" data-toggle=""collapse"" data-target="".navbar-collapse"" aria-controls=""navbarSupportedContent""
aria-expanded=""false"" aria-label=""Toggle navigation"">
<span class=""navbar-toggler-icon""></span>
</button>
<div class=""navbar-collapse collapse d-sm-inline-flex justify-content-between"">
<ul class=""navbar-nav flex-grow-1"">
<li class=""nav-item"">
");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d214255", async() => {
WriteLiteral("Home");
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_4.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_6.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n </li>\r\n <li class=\"nav-item\">\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d216094", async() => {
WriteLiteral("Privacy");
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_4.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n </nav>\r\n </header>\r\n <div class=\"container\">\r\n <main role=\"main\" class=\"pb-3\">\r\n ");
#nullable restore
#line 34 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\Shared\_Layout.cshtml"
Write(RenderBody());
#line default
#line hidden
#nullable disable
WriteLiteral("\r\n </main>\r\n </div>\r\n\r\n <footer class=\"border-top footer text-muted\">\r\n <div class=\"container\">\r\n © 2022 - MVC_CoreProject - ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d218473", async() => {
WriteLiteral("Privacy");
}
);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_4.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_5.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n </div>\r\n </footer>\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d220155", async() => {
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d221255", async() => {
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_10);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "6a69ccf251fd038efc0c1477e1cf3c63d42f15d222356", async() => {
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper);
__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.Src = (string)__tagHelperAttribute_11.Value;
__tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_11);
#nullable restore
#line 45 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\Shared\_Layout.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion = true;
#line default
#line hidden
#nullable disable
__tagHelperExecutionContext.AddTagHelperAttribute("asp-append-version", __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
#nullable restore
#line 46 "C:\Users\Batuhan\source\repos\CoreProject_MVC\CoreProject_MVC\Views\Shared\_Layout.cshtml"
Write(await RenderSectionAsync("Scripts", required: false));
#line default
#line hidden
#nullable disable
WriteLiteral("\r\n");
}
);
__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper>();
__tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper);
await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
if (!__tagHelperExecutionContext.Output.IsContentModified)
{
await __tagHelperExecutionContext.SetOutputContentAsync();
}
Write(__tagHelperExecutionContext.Output);
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n</html>\r\n");
}
#pragma warning restore 1998
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
[global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
}
}
#pragma warning restore 1591
| 82.371429 | 384 | 0.725479 | [
"MIT"
] | batuhansariikaya/MVC_CoreBlogProject | CoreProject_MVC/CoreProject_MVC/obj/Debug/net5.0/Razor/Views/Shared/_Layout.cshtml.g.cs | 25,947 | C# |
using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
namespace Devkoes.Core.MVVM
{
/// <summary>
/// Implementation is like the version in Microsoft PRISM
/// </summary>
public class ViewModelBase : INotifyPropertyChanged
{
private PropertyChangedEventHandler propertyChanged;
public event PropertyChangedEventHandler PropertyChanged
{
add
{
PropertyChangedEventHandler handler2;
PropertyChangedEventHandler propertyChanged = this.propertyChanged;
do
{
handler2 = propertyChanged;
PropertyChangedEventHandler handler3 = (PropertyChangedEventHandler)Delegate.Combine(handler2, value);
propertyChanged = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this.propertyChanged, handler3, handler2);
}
while (propertyChanged != handler2);
}
remove
{
PropertyChangedEventHandler handler2;
PropertyChangedEventHandler propertyChanged = this.propertyChanged;
do
{
handler2 = propertyChanged;
PropertyChangedEventHandler handler3 = (PropertyChangedEventHandler)Delegate.Remove(handler2, value);
propertyChanged = Interlocked.CompareExchange<PropertyChangedEventHandler>(ref this.propertyChanged, handler3, handler2);
}
while (propertyChanged != handler2);
}
}
protected void RaisePropertyChanged(params string[] propertyNames)
{
if (propertyNames == null)
{
throw new ArgumentNullException("propertyNames");
}
foreach (string str in propertyNames)
{
this.RaisePropertyChanged(str);
}
}
protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
{
string propertyName = PropertySupport.ExtractPropertyName<T>(propertyExpression);
this.RaisePropertyChanged(propertyName);
}
protected virtual void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = this.propertyChanged;
if (propertyChanged != null)
{
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public static class PropertySupport
{
// Methods
public static string ExtractPropertyName<T>(Expression<Func<T>> propertyExpression)
{
if (propertyExpression == null)
{
throw new ArgumentNullException("propertyExpression");
}
MemberExpression body = propertyExpression.Body as MemberExpression;
if (body == null)
{
throw new ArgumentException("propertyExpression");
}
PropertyInfo member = body.Member as PropertyInfo;
if (member == null)
{
throw new ArgumentException("propertyExpression");
}
if (member.GetGetMethod(true).IsStatic)
{
throw new ArgumentException("propertyExpression");
}
return body.Member.Name;
}
}
}
| 35.575758 | 141 | 0.587166 | [
"MIT"
] | jenkins-integrations/vsjenkinsmanager | Devkoes.VSJenkinsManager/Devkoes.Core/MVVM/ViewModelBase.cs | 3,524 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// Ten kod został wygenerowany przez narzędzie.
// Wersja wykonawcza:4.0.30319.42000
//
// Zmiany w tym pliku mogą spowodować nieprawidłowe zachowanie i zostaną utracone, jeśli
// kod zostanie ponownie wygenerowany.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataLayer.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=DESKTOP-KE9V009;Initial Catalog=Bookstore;Persist Security Info=True;" +
"User ID=bookstore;Password=123")]
public string BookstoreConnectionString {
get {
return ((string)(this["BookstoreConnectionString"]));
}
}
}
}
| 45.842105 | 152 | 0.631458 | [
"MIT"
] | ArtJSON/PT | Task2/DataLayer/Properties/Settings.Designer.cs | 1,751 | C# |
using OrderingService.API.Models;
using OrderingService.Core.OrderAggregateRoot;
namespace OrderingService.API.Endpoints.OrderEndpoints
{
public record GetOrderByIdResponse
{
public OrderDetailsDto Order { get; init; }
}
} | 25.3 | 55 | 0.735178 | [
"MIT"
] | NguyenVinhPhuoc/eshop | services/ordering-service/src/OrderingService.API/Endpoints/OrderEndpoints/GetById.GetOrderByIdResponse.cs | 255 | C# |
using System.Linq;
using System.Threading.Tasks;
using Loop54.Model.Request;
using Loop54.Model.Request.Parameters.Filters;
using Loop54.Model.Response;
using Loop54.Test.AspNetCore.Models;
using Microsoft.AspNetCore.Mvc;
namespace Loop54.Test.AspNetCore.Controllers
{
public class GetEntitiesByAttributeController : Controller
{
private readonly ILoop54Client _loop54Client;
public GetEntitiesByAttributeController(ILoop54Client loop54Client)
{
_loop54Client = loop54Client;
}
[HttpGet]
public IActionResult Index()
{
return View();
}
[HttpPost]
public async Task<IActionResult> Index(string category, bool organic)
{
GetEntitiesByAttributeRequest request = new GetEntitiesByAttributeRequest("Category", category);
//We only want organic/non-organic products that have got the price attribute
request.ResultsOptions.Filter = new AndFilterParameter(
new AttributeExistsFilterParameter("Price"),
//Because the organic attribute is stored as a string in the engine we need to filter with that type.
//If it would have been stored as a boolean we would have used bool instead.
new AttributeFilterParameter<string>("Organic", organic ? "True" : "False"));
request.ResultsOptions.AddDistinctFacet<string>("Manufacturer");
request.ResultsOptions.AddRangeFacet<double>("Price");
request.ResultsOptions.Skip = 0;
request.ResultsOptions.Take = 20;
GetEntitiesByAttributeResponse response = await _loop54Client.GetEntitiesByAttributeAsync(request);
return View(new GetEntitiesByAttributeViewModel
{
Count = response.Results.Count,
Results = ModelUtils.GetViewModelFromEntities(response.Results.Items),
Facets = response.Results.Facets.Where(f => f.HasValues).Select(ModelUtils.CreateFacet).ToList(),
});
}
}
}
| 38.740741 | 117 | 0.664914 | [
"BSD-3-Clause"
] | LoopFiftyFour/.NET-Connector | Loop54.Test.AspNetCore/Controllers/GetEntitiesByAttributeController.cs | 2,092 | C# |
// <auto-generated> - Template:WebApiControllerPartialMethods, Version:1.1, Id:54f0612b-5235-437d-af2d-0b75efa68630
using System.Data.Entity;
using System.Linq;
using entQR = CGH.QuikRide.Repository.Entities.QR;
namespace CGH.QuikRide.API.Controllers.QR
{
public partial class UserRewardAccountsQRController : QRBaseApiController
{
//partial void RunCustomLogicAfterInsert(ref entQR.UserRewardAccount newDBItem, ref IRepositoryActionResult<entQR.UserRewardAccount> result) {}
//partial void RunCustomLogicAfterUpdatePatch(ref entQR.UserRewardAccount updatedDBItem, ref IRepositoryActionResult<entQR.UserRewardAccount> result) {}
//partial void RunCustomLogicAfterUpdatePut(ref entQR.UserRewardAccount updatedDBItem, ref IRepositoryActionResult<entQR.UserRewardAccount> result) {}
///// <summary>
///// A sample implementation of custom logic used to either manipulate a DTO item or include related entities.
///// </summary>
///// <param name="dbItem"></param>
///// <param name="id"></param>
///// <param name="numChildLevels"></param>
// partial void RunCustomLogicOnGetEntityByPK(ref entQR.UserRewardAccount dbItem, int userId, int numChildLevels)
// {
// if (numChildLevels > 1)
// {
// int[] orderLineItemIds = dbItem.OrderLineItems.Select(x => x.OrderLineItemId).ToArray();
// var lineItemDiscounts = Repo.QRDataContext.OrderLineItemDiscounts.Where(x => orderLineItemIds.Contains(x.OrderLineItemId)).ToList();
// foreach (var lineItemDiscount in lineItemDiscounts)
// { // Find the match and add the item to it.
// var orderLineItem = dbItem.OrderLineItems.Where(x => x.OrderLineItemId == lineItemDiscount.OrderLineItemId).FirstOrDefault();
// if (orderLineItem == null)
// {
// throw new System.Data.Entity.Core.ObjectNotFoundException($"Unable to locate matching OrderLineItem record for {lineItemDiscount.OrderLineItemId}."
// }
// orderLineItem.LineItemDiscounts.Add(lineItemDiscount);
// }
// }
// }
///// <summary>
///// A sample implementation of custom logic used to filter on a field that exists in a related, parent, table.
///// </summary>
///// <param name="dbItems"></param>
///// <param name="filterList"></param>
//partial void RunCustomLogicAfterGetQueryableList(ref IQueryable<entQR.UserRewardAccount> dbItems, ref List<string> filterList)
//{
// var queryableFilters = filterList.ToQueryableFilter();
// var myFilterCriterion = queryableFilters.Where(y => y.Member.ToLowerInvariant() == "<myFieldName>").FirstOrDefault(); // Examine the incoming filter for the presence of a field name which does not exist on the target entity.
// if (myFilterCriterion != null)
// { // myFieldName is a criterion that has to be evaluated at a level other than our target entity.
// dbItems = dbItems.Include(x => x.myFKRelatedEntity).Where(x => x.myFKRelatedEntity.myFieldName == new Guid(myFilterCriterion.Value));
// queryableFilters.Remove(myFilterCriterion); // The evaluated criterion needs to be removed from the list of filters before we invoke the ApplyFilter() extension method.
// filterList = queryableFilters.ToQueryableStringList();
// }
//}
}
}
| 48.575758 | 229 | 0.734872 | [
"MIT"
] | MSCTek/QuikRide | src/CGH.QuikRide.API/Controllers/QR/Custom/UserRewardAccountsControllerCustom.cs | 3,206 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Libraries.Collections;
using Libraries.Extensions;
namespace Libraries.LexicalAnalysis
{
public class TokenShakerContainer<T> : ShakerContainer<T>
{
private TypedShakeSelector<T> selector;
public new TypedShakeSelector<T> Selector
{
get
{
return selector;
}
set
{
this.selector = value;
base.Selector = (x, y) => CompatibilitySelector(x, y, selector);
}
}
private static Tuple<Hunk<T>, Hunk<T>> CompatibilitySelector(Segment seg, Hunk<T> hunk, TypedShakeSelector<T> selector)
{
var r = selector(new TypedSegment(seg, string.Empty), new Token<T>(hunk));
return new Tuple<Hunk<T>, Hunk<T>>(r.Item1, r.Item2);
}
public TokenShakerContainer(TypedShakeSelector<T> selector)
: base(null) //compat
{
Selector = selector;
}
public IEnumerable<Token<T>> TypedShake(Token<T> target, TypedShakeCondition<T> cond)
{
return TypedShake(target, cond, Selector);
}
public IEnumerable<Token<T>> TypedShake(Token<T> target, TypedShakeCondition<T> cond, TypedShakeSelector<T> selector)
{
Token<T> prev = target;
Tuple<Token<T>, Token<T>, Token<T>> curr = new Tuple<Token<T>, Token<T>, Token<T>>(null, null, target);
//Console.WriteLine("Yes this is getting called!");
do
{
curr = BasicTypedShakerFunction(curr.Item3, cond, selector);
if (curr.Item1 != null)
{
if(!curr.Item1.IsBig)
curr.Item1.IsBig = true;
yield return curr.Item1;
}
if (curr.Item2 != null)
yield return curr.Item2;
if (curr.Item3.Equals((Hunk<T>)prev))
{
if (curr.Item3.Length > 0)
{
if(!curr.Item3.IsBig)
curr.Item3.IsBig = true;
yield return curr.Item3;
}
yield break;
}
prev = curr.Item3;
} while (true);
}
public IEnumerable<Token<T>> TypedShake(Token<T> target, TypedShakeCondition<T> a, TypedShakeCondition<T> b)
{
foreach (var v in TypedShake(target, a))
{
if (v.IsBig)
foreach (var q in TypedShake(v, b))
yield return q;
else
yield return v;
}
}
private IEnumerable<Token<T>> TypedShakeInternal(IEnumerable<Token<T>> outer, TypedShakeCondition<T> cond)
{
if (cond == null)
{
foreach (var v in outer)
yield return v;
}
else
{
foreach (var v in outer)
{
if (v.IsBig)
{
foreach (var q in TypedShake(v, cond))
yield return q;
}
else
yield return v;
}
}
}
private IEnumerable<Token<T>> TypedShakeSingle(Token<T> tok)
{
return new Token<T>[] { tok };
}
public IEnumerable<Token<T>> TypedShake(Hunk<T> input, IEnumerable<TypedShakeCondition<T>> conds)
{
return TypedShake(new Token<T>(input), conds);
}
public IEnumerable<Token<T>> TypedShake(Token<T> target, IEnumerable<TypedShakeCondition<T>> conds)
{
IEnumerable<Token<T>> initial = TypedShake(target, conds.First()).ToArray();
foreach (var cond in conds.Skip(1))
initial = TypedShakeInternal(initial, cond);
return TypedShakeInternal(initial, null);
}
public Tuple<Token<T>, Token<T>, Token<T>> BasicTypedShakerFunction(Token<T> target, TypedShakeCondition<T> cond)
{
return BasicTypedShakerFunction(target, cond, selector);
}
protected Tuple<Token<T>, Token<T>, Token<T>> BasicTypedShakerFunction(
Token<T> target,
TypedShakeCondition<T> cond,
TypedShakeSelector<T> selector)
{
Func<TypedSegment, Token<T>, int> getRest = (seg, hunk) => (hunk.Length - (seg.Start + seg.Length));
Func<TypedSegment, int> getComputedStart = (seg) => seg.Start + seg.Length;
TypedSegment result = cond(target);
if (result == null)
{
return new Tuple<Token<T>, Token<T>, Token<T>>(null, null, target);
}
else
{
TypedSegment restSection = new TypedSegment(getRest(result, target), string.Empty, getComputedStart(result));
var matchTokens = selector(result, target);
var before = matchTokens.Item1;
var match = matchTokens.Item2;
//Console.WriteLine("\t\tIncoming match = {0}", match);
match.IsBig = false;
var restTokens = selector(restSection, target);
var rest = restTokens.Item2;
rest.IsBig = true;
return new Tuple<Token<T>, Token<T>, Token<T>>(before, match, rest);
}
}
}
public delegate Tuple<Token<T>, Token<T>> TypedShakeSelector<T>(TypedSegment seg, Token<T> token);
public delegate TypedSegment TypedShakeCondition<T>(Token<T> hunk);
public delegate Tuple<Token<T>, Token<T>, Token<T>> TypedShaker<T>(Hunk<T> target,
TypedShakeCondition<T> condition, TypedShakeSelector<T> selector);
/*
public delegate Segment ShakeCondition<T>(Hunk<T> hunk);
public delegate Tuple<Hunk<T>, Hunk<T>> ShakeSelector<T>(Segment seg, Hunk<T> target);
public delegate Tuple<Hunk<T>, Hunk<T>, Hunk<T>> Shaker<T>(Hunk<T> target,
ShakeCondition<T> condition, ShakeSelector<T> selector);
*/
}
| 31.530864 | 122 | 0.646045 | [
"BSD-3-Clause"
] | DrItanium/ImageProcessingApplication | src/lib/LexicalAnalysis/TokenShakerContainer.cs | 5,110 | C# |
using YAF.Lucene.Net.Documents;
using System;
using YAF.Lucene.Net.Diagnostics;
using System.Runtime.CompilerServices;
namespace YAF.Lucene.Net.Index
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using DocIdSetIterator = YAF.Lucene.Net.Search.DocIdSetIterator;
using FixedBitSet = YAF.Lucene.Net.Util.FixedBitSet;
using InPlaceMergeSorter = YAF.Lucene.Net.Util.InPlaceMergeSorter;
using NumericDocValuesUpdate = YAF.Lucene.Net.Index.DocValuesUpdate.NumericDocValuesUpdate;
using PackedInt32s = YAF.Lucene.Net.Util.Packed.PackedInt32s;
using PagedGrowableWriter = YAF.Lucene.Net.Util.Packed.PagedGrowableWriter;
using PagedMutable = YAF.Lucene.Net.Util.Packed.PagedMutable;
/// <summary>
/// A <see cref="DocValuesFieldUpdates"/> which holds updates of documents, of a single
/// <see cref="NumericDocValuesField"/>.
/// <para/>
/// @lucene.experimental
/// </summary>
internal class NumericDocValuesFieldUpdates : DocValuesFieldUpdates
{
new internal sealed class Iterator : DocValuesFieldUpdates.Iterator
{
private readonly int size;
private readonly PagedGrowableWriter values;
private readonly FixedBitSet docsWithField;
private readonly PagedMutable docs;
private long idx = 0; // long so we don't overflow if size == Integer.MAX_VALUE
private int doc = -1;
private long? value = null;
internal Iterator(int size, PagedGrowableWriter values, FixedBitSet docsWithField, PagedMutable docs)
{
this.size = size;
this.values = values;
this.docsWithField = docsWithField;
this.docs = docs;
}
public override object Value => value;
public override int NextDoc()
{
if (idx >= size)
{
value = null;
return doc = DocIdSetIterator.NO_MORE_DOCS;
}
doc = (int)docs.Get(idx);
++idx;
while (idx < size && docs.Get(idx) == doc)
{
++idx;
}
if (!docsWithField.Get((int)(idx - 1)))
{
value = null;
}
else
{
// idx points to the "next" element
value = values.Get(idx - 1);
}
return doc;
}
public override int Doc => doc;
public override void Reset()
{
doc = -1;
value = null;
idx = 0;
}
}
private FixedBitSet docsWithField;
private PagedMutable docs;
private PagedGrowableWriter values;
private int size;
public NumericDocValuesFieldUpdates(string field, int maxDoc)
: base(field, DocValuesFieldUpdatesType.NUMERIC)
{
docsWithField = new FixedBitSet(64);
docs = new PagedMutable(1, 1024, PackedInt32s.BitsRequired(maxDoc - 1), PackedInt32s.COMPACT);
values = new PagedGrowableWriter(1, 1024, 1, PackedInt32s.FAST);
size = 0;
}
public override void Add(int doc, object value)
{
// TODO: if the Sorter interface changes to take long indexes, we can remove that limitation
if (size == int.MaxValue)
{
throw IllegalStateException.Create("cannot support more than System.Int32.MaxValue doc/value entries");
}
long? val = (long?)value;
if (val == null)
{
val = NumericDocValuesUpdate.MISSING;
}
// grow the structures to have room for more elements
if (docs.Count == size)
{
docs = docs.Grow(size + 1);
values = values.Grow(size + 1);
docsWithField = FixedBitSet.EnsureCapacity(docsWithField, (int)docs.Count);
}
if (val != NumericDocValuesUpdate.MISSING)
{
// only mark the document as having a value in that field if the value wasn't set to null (MISSING)
docsWithField.Set(size);
}
docs.Set(size, doc);
values.Set(size, (long)val);
++size;
}
public override DocValuesFieldUpdates.Iterator GetIterator()
{
PagedMutable docs = this.docs;
PagedGrowableWriter values = this.values;
FixedBitSet docsWithField = this.docsWithField;
new InPlaceMergeSorterAnonymousClass(docs, values, docsWithField).Sort(0, size);
return new Iterator(size, values, docsWithField, docs);
}
private class InPlaceMergeSorterAnonymousClass : InPlaceMergeSorter
{
private readonly PagedMutable docs;
private readonly PagedGrowableWriter values;
private readonly FixedBitSet docsWithField;
public InPlaceMergeSorterAnonymousClass(PagedMutable docs, PagedGrowableWriter values, FixedBitSet docsWithField)
{
this.docs = docs;
this.values = values;
this.docsWithField = docsWithField;
}
protected override void Swap(int i, int j)
{
long tmpDoc = docs.Get(j);
docs.Set(j, docs.Get(i));
docs.Set(i, tmpDoc);
long tmpVal = values.Get(j);
values.Set(j, values.Get(i));
values.Set(i, tmpVal);
bool tmpBool = docsWithField.Get(j);
if (docsWithField.Get(i))
{
docsWithField.Set(j);
}
else
{
docsWithField.Clear(j);
}
if (tmpBool)
{
docsWithField.Set(i);
}
else
{
docsWithField.Clear(i);
}
}
protected override int Compare(int i, int j)
{
int x = (int)docs.Get(i);
int y = (int)docs.Get(j);
return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override void Merge(DocValuesFieldUpdates other)
{
if (Debugging.AssertsEnabled) Debugging.Assert(other is NumericDocValuesFieldUpdates);
NumericDocValuesFieldUpdates otherUpdates = (NumericDocValuesFieldUpdates)other;
if (size + otherUpdates.size > int.MaxValue)
{
throw IllegalStateException.Create("cannot support more than System.Int32.MaxValue doc/value entries; size=" + size + " other.size=" + otherUpdates.size);
}
docs = docs.Grow(size + otherUpdates.size);
values = values.Grow(size + otherUpdates.size);
docsWithField = FixedBitSet.EnsureCapacity(docsWithField, (int)docs.Count);
for (int i = 0; i < otherUpdates.size; i++)
{
int doc = (int)otherUpdates.docs.Get(i);
if (otherUpdates.docsWithField.Get(i))
{
docsWithField.Set(size);
}
docs.Set(size, doc);
values.Set(size, otherUpdates.values.Get(i));
++size;
}
}
public override bool Any()
{
return size > 0;
}
}
} | 37.824034 | 171 | 0.531488 | [
"Apache-2.0"
] | 10by10pixel/YAFNET | yafsrc/Lucene.Net/Lucene.Net/Index/NumericDocValuesFieldUpdates.cs | 8,581 | C# |
using System.Collections.Generic;
using System.Linq;
using Retrospector.AchievementTab;
using Retrospector.AchievementTab.Interfaces;
using Retrospector.Tests.TestDoubles.AchievementTab;
using Retrospector.Tests.Utilities;
using Xunit;
namespace Retrospector.Tests.Tests.AchievementTab
{
public class AchievementTabViewModelTests
{
private readonly AchievementTabViewModel _viewModel;
protected AchievementTabViewModelTests()
{
var generators = new List<IAchievementGenerator>();
_viewModel = new AchievementTabViewModel(generators);
}
public class Constructor : AchievementTabViewModelTests
{
[Fact]
public void sets_header()
{
Assert.Equal("Achievements", _viewModel.Header);
}
[Theory]
[InlineDatas(0, 1, 5)]
public void gets_achievements(int countOfGenerators)
{
var generator = new AchievementGenerator_TestDouble
{
ReturnFor_GetAchievements = new List<Achievement>()
};
var generators = Enumerable.Repeat(generator, countOfGenerators);
new AchievementTabViewModel(generators);
Assert.Equal(countOfGenerators, generator.CountOfCallsTo_GetAchievements);
}
[Fact]
public void stores_achievements()
{
var achievement = new Achievement();
var generator = new AchievementGenerator_TestDouble
{
ReturnFor_GetAchievements = new [] {achievement}
};
var viewModel = new AchievementTabViewModel(new [] {generator});
Assert.Contains(achievement, viewModel.Achievements);
}
}
public class AchievementsCounts : AchievementTabViewModelTests
{
[Theory]
[InlineData(0, Achievement.Gold, 0)]
[InlineData(1, Achievement.Gold, 1)]
[InlineData(5, Achievement.Gold, 5)]
[InlineData(1, Achievement.Silver, 0)]
[InlineData(1, Achievement.Bronze, 0)]
public void gold_count_is_correct(int countOfAchievements, string colorOfAchievements, int expectedCount)
{
for (var i = 0; i < countOfAchievements; i++)
_viewModel.Achievements.Add(new Achievement
{
Color = colorOfAchievements,
Progress = 100
});
Assert.Equal(expectedCount, _viewModel.CountOfGoldAchievements);
}
[Fact]
public void gold_count_ignores_in_progress()
{
_viewModel.Achievements.Add(new Achievement
{
Color = Achievement.Gold,
Progress = 99
});
Assert.Equal(0, _viewModel.CountOfGoldAchievements);
}
[Theory]
[InlineData(0, Achievement.Silver, 0)]
[InlineData(1, Achievement.Silver, 1)]
[InlineData(5, Achievement.Silver, 5)]
[InlineData(1, Achievement.Gold, 0)]
[InlineData(1, Achievement.Bronze, 0)]
public void silver_count_is_correct(int countOfAchievements, string colorOfAchievements, int expectedCount)
{
for (var i = 0; i < countOfAchievements; i++)
_viewModel.Achievements.Add(new Achievement
{
Color = colorOfAchievements,
Progress = 100
});
Assert.Equal(expectedCount, _viewModel.CountOfSilverAchievements);
}
[Fact]
public void silver_count_ignores_in_progress()
{
_viewModel.Achievements.Add(new Achievement
{
Color = Achievement.Silver,
Progress = 99
});
Assert.Equal(0, _viewModel.CountOfSilverAchievements);
}
[Theory]
[InlineData(0, Achievement.Bronze, 0)]
[InlineData(1, Achievement.Bronze, 1)]
[InlineData(5, Achievement.Bronze, 5)]
[InlineData(1, Achievement.Silver, 0)]
[InlineData(1, Achievement.Gold, 0)]
public void bronze_count_is_correct(int countOfAchievements, string colorOfAchievements, int expectedCount)
{
for (var i = 0; i < countOfAchievements; i++)
_viewModel.Achievements.Add(new Achievement
{
Color = colorOfAchievements,
Progress = 100
});
Assert.Equal(expectedCount, _viewModel.CountOfBronzeAchievements);
}
[Fact]
public void bronze_count_ignores_in_progress()
{
_viewModel.Achievements.Add(new Achievement
{
Color = Achievement.Bronze,
Progress = 99
});
Assert.Equal(0, _viewModel.CountOfBronzeAchievements);
}
[Theory]
[InlineData(0, 0, 0)]
[InlineData(1, 50, 1)]
[InlineData(5, 75, 5)]
[InlineData(1, 100, 0)]
public void lock_count_is_correct(int countOfAchievements, int progress, int expectedCount)
{
for (var i = 0; i < countOfAchievements; i++)
_viewModel.Achievements.Add(new Achievement{Progress = progress});
Assert.Equal(expectedCount, _viewModel.CountOfLockAchievements);
}
}
}
} | 35.569697 | 119 | 0.539956 | [
"Unlicense"
] | NonlinearFruit/Retrospector | Retrospector.Tests/Tests/AchievementTab/AchievementTabViewModelTests.cs | 5,869 | C# |
//-----------------------------------------------------------------------
// <copyright file="SimpleJson.cs" company="The Outercurve Foundation">
// Copyright (c) 2011, The Outercurve Foundation.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.opensource.org/licenses/mit-license.php
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// <author>Nathan Totten (ntotten.com), Jim Zimmerman (jimzimmerman.com) and Prabir Shrestha (prabir.me)</author>
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
//-----------------------------------------------------------------------
// VERSION: 0.25.0
// NOTE: uncomment the following line to make SimpleJson class internal.
//#define SIMPLE_JSON_INTERNAL
// NOTE: uncomment the following line to make JsonArray and JsonObject class internal.
//#define SIMPLE_JSON_OBJARRAYINTERNAL
// NOTE: uncomment the following line to enable dynamic support.
//#define SIMPLE_JSON_DYNAMIC
// NOTE: uncomment the following line to enable DataContract support.
//#define SIMPLE_JSON_DATACONTRACT
// NOTE: uncomment the following line to disable linq expressions/compiled lambda (better performance) instead of method.invoke().
// define if you are using .net framework <= 3.0 or < WP7.5
//#define SIMPLE_JSON_NO_LINQ_EXPRESSION
// NOTE: uncomment the following line if you are compiling under Window Metro style application/library.
// usually already defined in properties
//#define NETFX_CORE;
// original json parsing code from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
#if NETFX_CORE
#define SIMPLE_JSON_TYPEINFO
#endif
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
#if !SIMPLE_JSON_NO_LINQ_EXPRESSION
using System.Linq.Expressions;
#endif
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
#if SIMPLE_JSON_DYNAMIC
using System.Dynamic;
#endif
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using RestSharp.Reflection;
// ReSharper disable LoopCanBeConvertedToQuery
// ReSharper disable RedundantExplicitArrayCreation
// ReSharper disable SuggestUseVarKeywordEvident
namespace RestSharp
{
/// <summary>
/// Represents the json array.
/// </summary>
[GeneratedCode("simple-json", "1.0.0")]
[EditorBrowsable(EditorBrowsableState.Never)]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
#if SIMPLE_JSON_OBJARRAYINTERNAL
internal
#else
public
#endif
class JsonArray : List<object>
{
/// <summary>
/// Initializes a new instance of the <see cref="JsonArray"/> class.
/// </summary>
public JsonArray() { }
/// <summary>
/// Initializes a new instance of the <see cref="JsonArray"/> class.
/// </summary>
/// <param name="capacity">The capacity of the json array.</param>
public JsonArray(int capacity) : base(capacity) { }
/// <summary>
/// The json representation of the array.
/// </summary>
/// <returns>The json representation of the array.</returns>
public override string ToString()
{
return SimpleJson.SerializeObject(this) ?? string.Empty;
}
}
/// <summary>
/// Represents the json object.
/// </summary>
[GeneratedCode("simple-json", "1.0.0")]
[EditorBrowsable(EditorBrowsableState.Never)]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
#if SIMPLE_JSON_OBJARRAYINTERNAL
internal
#else
public
#endif
class JsonObject :
#if SIMPLE_JSON_DYNAMIC
DynamicObject,
#endif
IDictionary<string, object>
{
/// <summary>
/// The internal member dictionary.
/// </summary>
private readonly Dictionary<string, object> _members;
/// <summary>
/// Initializes a new instance of <see cref="JsonObject"/>.
/// </summary>
public JsonObject()
{
_members = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of <see cref="JsonObject"/>.
/// </summary>
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IEqualityComparer`1"/> implementation to use when comparing keys, or null to use the default <see cref="T:System.Collections.Generic.EqualityComparer`1"/> for the type of the key.</param>
public JsonObject(IEqualityComparer<string> comparer)
{
_members = new Dictionary<string, object>(comparer);
}
/// <summary>
/// Gets the <see cref="System.Object"/> at the specified index.
/// </summary>
/// <value></value>
public object this[int index]
{
get { return GetAtIndex(_members, index); }
}
internal static object GetAtIndex(IDictionary<string, object> obj, int index)
{
if (obj == null)
throw new ArgumentNullException("obj");
if (index >= obj.Count)
throw new ArgumentOutOfRangeException("index");
int i = 0;
foreach (KeyValuePair<string, object> o in obj)
if (i++ == index) return o.Value;
return null;
}
/// <summary>
/// Adds the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
public void Add(string key, object value)
{
_members.Add(key, value);
}
/// <summary>
/// Determines whether the specified key contains key.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>
/// <c>true</c> if the specified key contains key; otherwise, <c>false</c>.
/// </returns>
public bool ContainsKey(string key)
{
return _members.ContainsKey(key);
}
/// <summary>
/// Gets the keys.
/// </summary>
/// <value>The keys.</value>
public ICollection<string> Keys
{
get { return _members.Keys; }
}
/// <summary>
/// Removes the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <returns></returns>
public bool Remove(string key)
{
return _members.Remove(key);
}
/// <summary>
/// Tries the get value.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
/// <returns></returns>
public bool TryGetValue(string key, out object value)
{
return _members.TryGetValue(key, out value);
}
/// <summary>
/// Gets the values.
/// </summary>
/// <value>The values.</value>
public ICollection<object> Values
{
get { return _members.Values; }
}
/// <summary>
/// Gets or sets the <see cref="System.Object"/> with the specified key.
/// </summary>
/// <value></value>
public object this[string key]
{
get { return _members[key]; }
set { _members[key] = value; }
}
/// <summary>
/// Adds the specified item.
/// </summary>
/// <param name="item">The item.</param>
public void Add(KeyValuePair<string, object> item)
{
_members.Add(item.Key, item.Value);
}
/// <summary>
/// Clears this instance.
/// </summary>
public void Clear()
{
_members.Clear();
}
/// <summary>
/// Determines whether [contains] [the specified item].
/// </summary>
/// <param name="item">The item.</param>
/// <returns>
/// <c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.
/// </returns>
public bool Contains(KeyValuePair<string, object> item)
{
return _members.ContainsKey(item.Key) && _members[item.Key] == item.Value;
}
/// <summary>
/// Copies to.
/// </summary>
/// <param name="array">The array.</param>
/// <param name="arrayIndex">Index of the array.</param>
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
{
if (array == null) throw new ArgumentNullException("array");
int num = Count;
foreach (KeyValuePair<string, object> kvp in this)
{
array[arrayIndex++] = kvp;
if (--num <= 0)
return;
}
}
/// <summary>
/// Gets the count.
/// </summary>
/// <value>The count.</value>
public int Count
{
get { return _members.Count; }
}
/// <summary>
/// Gets a value indicating whether this instance is read only.
/// </summary>
/// <value>
/// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
/// </value>
public bool IsReadOnly
{
get { return false; }
}
/// <summary>
/// Removes the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
public bool Remove(KeyValuePair<string, object> item)
{
return _members.Remove(item.Key);
}
/// <summary>
/// Gets the enumerator.
/// </summary>
/// <returns></returns>
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
return _members.GetEnumerator();
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
IEnumerator IEnumerable.GetEnumerator()
{
return _members.GetEnumerator();
}
/// <summary>
/// Returns a json <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// A json <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
/// </returns>
public override string ToString()
{
return SimpleJson.SerializeObject(this);
}
#if SIMPLE_JSON_DYNAMIC
/// <summary>
/// Provides implementation for type conversion operations. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations that convert an object from one type to another.
/// </summary>
/// <param name="binder">Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, binder.Type returns the <see cref="T:System.String"/> type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion.</param>
/// <param name="result">The result of the type conversion operation.</param>
/// <returns>
/// Alwasy returns true.
/// </returns>
public override bool TryConvert(ConvertBinder binder, out object result)
{
// <pex>
if (binder == null)
throw new ArgumentNullException("binder");
// </pex>
Type targetType = binder.Type;
if ((targetType == typeof(IEnumerable)) ||
(targetType == typeof(IEnumerable<KeyValuePair<string, object>>)) ||
(targetType == typeof(IDictionary<string, object>)) ||
(targetType == typeof(IDictionary)))
{
result = this;
return true;
}
return base.TryConvert(binder, out result);
}
/// <summary>
/// Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic.
/// </summary>
/// <param name="binder">Provides information about the deletion.</param>
/// <returns>
/// Alwasy returns true.
/// </returns>
public override bool TryDeleteMember(DeleteMemberBinder binder)
{
// <pex>
if (binder == null)
throw new ArgumentNullException("binder");
// </pex>
return _members.Remove(binder.Name);
}
/// <summary>
/// Provides the implementation for operations that get a value by index. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for indexing operations.
/// </summary>
/// <param name="binder">Provides information about the operation.</param>
/// <param name="indexes">The indexes that are used in the operation. For example, for the sampleObject[3] operation in C# (sampleObject(3) in Visual Basic), where sampleObject is derived from the DynamicObject class, <paramref name="indexes"/> is equal to 3.</param>
/// <param name="result">The result of the index operation.</param>
/// <returns>
/// Alwasy returns true.
/// </returns>
public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
{
if (indexes == null) throw new ArgumentNullException("indexes");
if (indexes.Length == 1)
{
result = ((IDictionary<string, object>)this)[(string)indexes[0]];
return true;
}
result = null;
return true;
}
/// <summary>
/// Provides the implementation for operations that get member values. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.
/// </summary>
/// <param name="binder">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>
/// <param name="result">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name="result"/>.</param>
/// <returns>
/// Alwasy returns true.
/// </returns>
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
object value;
if (_members.TryGetValue(binder.Name, out value))
{
result = value;
return true;
}
result = null;
return true;
}
/// <summary>
/// Provides the implementation for operations that set a value by index. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations that access objects by a specified index.
/// </summary>
/// <param name="binder">Provides information about the operation.</param>
/// <param name="indexes">The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, <paramref name="indexes"/> is equal to 3.</param>
/// <param name="value">The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, <paramref name="value"/> is equal to 10.</param>
/// <returns>
/// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.
/// </returns>
public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
{
if (indexes == null) throw new ArgumentNullException("indexes");
if (indexes.Length == 1)
{
((IDictionary<string, object>)this)[(string)indexes[0]] = value;
return true;
}
return base.TrySetIndex(binder, indexes, value);
}
/// <summary>
/// Provides the implementation for operations that set member values. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations such as setting a value for a property.
/// </summary>
/// <param name="binder">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>
/// <param name="value">The value to set to the member. For example, for sampleObject.SampleProperty = "Test", where sampleObject is an instance of the class derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, the <paramref name="value"/> is "Test".</param>
/// <returns>
/// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)
/// </returns>
public override bool TrySetMember(SetMemberBinder binder, object value)
{
// <pex>
if (binder == null)
throw new ArgumentNullException("binder");
// </pex>
_members[binder.Name] = value;
return true;
}
/// <summary>
/// Returns the enumeration of all dynamic member names.
/// </summary>
/// <returns>
/// A sequence that contains dynamic member names.
/// </returns>
public override IEnumerable<string> GetDynamicMemberNames()
{
foreach (var key in Keys)
yield return key;
}
#endif
}
}
namespace RestSharp
{
public class SerializerOptions
{
public SerializerOptions()
{
// set defaults
SkipNullProperties = false;
}
public bool SkipNullProperties { get; set; }
}
/// <summary>
/// This class encodes and decodes JSON strings.
/// Spec. details, see http://www.json.org/
///
/// JSON uses Arrays and Objects. These correspond here to the datatypes JsonArray(IList<object>) and JsonObject(IDictionary<string,object>).
/// All numbers are parsed to doubles.
/// </summary>
[GeneratedCode("simple-json", "1.0.0")]
#if SIMPLE_JSON_INTERNAL
internal
#else
public
#endif
static class SimpleJson
{
private const int TOKEN_NONE = 0;
private const int TOKEN_CURLY_OPEN = 1;
private const int TOKEN_CURLY_CLOSE = 2;
private const int TOKEN_SQUARED_OPEN = 3;
private const int TOKEN_SQUARED_CLOSE = 4;
private const int TOKEN_COLON = 5;
private const int TOKEN_COMMA = 6;
private const int TOKEN_STRING = 7;
private const int TOKEN_NUMBER = 8;
private const int TOKEN_TRUE = 9;
private const int TOKEN_FALSE = 10;
private const int TOKEN_NULL = 11;
private const int BUILDER_CAPACITY = 2000;
/// <summary>
/// Parses the string json into a value
/// </summary>
/// <param name="json">A JSON string.</param>
/// <returns>An IList<object>, a IDictionary<string,object>, a double, a string, null, true, or false</returns>
public static object DeserializeObject(string json)
{
object obj;
if (TryDeserializeObject(json, out obj))
return obj;
throw new SerializationException("Invalid JSON string");
}
/// <summary>
/// Try parsing the json string into a value.
/// </summary>
/// <param name="json">
/// A JSON string.
/// </param>
/// <param name="obj">
/// The object.
/// </param>
/// <returns>
/// Returns true if successfull otherwise false.
/// </returns>
[SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")]
public static bool TryDeserializeObject(string json, out object obj)
{
bool success = true;
if (json != null)
{
char[] charArray = json.ToCharArray();
int index = 0;
obj = ParseValue(charArray, ref index, ref success);
}
else
obj = null;
return success;
}
public static object DeserializeObject(string json, Type type, IJsonSerializerStrategy jsonSerializerStrategy)
{
object jsonObject = DeserializeObject(json);
return type == null || jsonObject != null && ReflectionUtils.IsAssignableFrom(jsonObject.GetType(), type)
? jsonObject
: (jsonSerializerStrategy ?? CurrentJsonSerializerStrategy).DeserializeObject(jsonObject, type);
}
public static object DeserializeObject(string json, Type type)
{
return DeserializeObject(json, type, null);
}
public static T DeserializeObject<T>(string json, IJsonSerializerStrategy jsonSerializerStrategy)
{
return (T)DeserializeObject(json, typeof(T), jsonSerializerStrategy);
}
public static T DeserializeObject<T>(string json)
{
return (T)DeserializeObject(json, typeof(T), null);
}
/// <summary>
/// Converts a IDictionary<string,object> / IList<object> object into a JSON string
/// </summary>
/// <param name="json">A IDictionary<string,object> / IList<object></param>
/// <param name="jsonSerializerStrategy">Serializer strategy to use</param>
/// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
public static string SerializeObject(object json, IJsonSerializerStrategy jsonSerializerStrategy, SerializerOptions options = null)
{
StringBuilder builder = new StringBuilder(BUILDER_CAPACITY);
bool success = SerializeValue(jsonSerializerStrategy, json, builder, options);
return (success ? builder.ToString() : null);
}
public static string SerializeObject(object json, SerializerOptions options = null)
{
return SerializeObject(json, CurrentJsonSerializerStrategy, options);
}
public static string EscapeToJavascriptString(string jsonString)
{
if (string.IsNullOrEmpty(jsonString))
return jsonString;
StringBuilder sb = new StringBuilder();
char c;
for (int i = 0; i < jsonString.Length; )
{
c = jsonString[i++];
if (c == '\\')
{
int remainingLength = jsonString.Length - i;
if (remainingLength >= 2)
{
char lookahead = jsonString[i];
if (lookahead == '\\')
{
sb.Append('\\');
++i;
}
else if (lookahead == '"')
{
sb.Append("\"");
++i;
}
else if (lookahead == 't')
{
sb.Append('\t');
++i;
}
else if (lookahead == 'b')
{
sb.Append('\b');
++i;
}
else if (lookahead == 'n')
{
sb.Append('\n');
++i;
}
else if (lookahead == 'r')
{
sb.Append('\r');
++i;
}
}
}
else
{
sb.Append(c);
}
}
return sb.ToString();
}
static IDictionary<string, object> ParseObject(char[] json, ref int index, ref bool success)
{
IDictionary<string, object> table = new JsonObject();
int token;
// {
NextToken(json, ref index);
bool done = false;
while (!done)
{
token = LookAhead(json, index);
if (token == TOKEN_NONE)
{
success = false;
return null;
}
else if (token == TOKEN_COMMA)
NextToken(json, ref index);
else if (token == TOKEN_CURLY_CLOSE)
{
NextToken(json, ref index);
return table;
}
else
{
// name
string name = ParseString(json, ref index, ref success);
if (!success)
{
success = false;
return null;
}
// :
token = NextToken(json, ref index);
if (token != TOKEN_COLON)
{
success = false;
return null;
}
// value
object value = ParseValue(json, ref index, ref success);
if (!success)
{
success = false;
return null;
}
table[name] = value;
}
}
return table;
}
static JsonArray ParseArray(char[] json, ref int index, ref bool success)
{
JsonArray array = new JsonArray();
// [
NextToken(json, ref index);
bool done = false;
while (!done)
{
int token = LookAhead(json, index);
if (token == TOKEN_NONE)
{
success = false;
return null;
}
else if (token == TOKEN_COMMA)
NextToken(json, ref index);
else if (token == TOKEN_SQUARED_CLOSE)
{
NextToken(json, ref index);
break;
}
else
{
object value = ParseValue(json, ref index, ref success);
if (!success)
return null;
array.Add(value);
}
}
return array;
}
static object ParseValue(char[] json, ref int index, ref bool success)
{
switch (LookAhead(json, index))
{
case TOKEN_STRING:
return ParseString(json, ref index, ref success);
case TOKEN_NUMBER:
return ParseNumber(json, ref index, ref success);
case TOKEN_CURLY_OPEN:
return ParseObject(json, ref index, ref success);
case TOKEN_SQUARED_OPEN:
return ParseArray(json, ref index, ref success);
case TOKEN_TRUE:
NextToken(json, ref index);
return true;
case TOKEN_FALSE:
NextToken(json, ref index);
return false;
case TOKEN_NULL:
NextToken(json, ref index);
return null;
case TOKEN_NONE:
break;
}
success = false;
return null;
}
static string ParseString(char[] json, ref int index, ref bool success)
{
StringBuilder s = new StringBuilder(BUILDER_CAPACITY);
char c;
EatWhitespace(json, ref index);
// "
c = json[index++];
bool complete = false;
while (!complete)
{
if (index == json.Length)
break;
c = json[index++];
if (c == '"')
{
complete = true;
break;
}
else if (c == '\\')
{
if (index == json.Length)
break;
c = json[index++];
if (c == '"')
s.Append('"');
else if (c == '\\')
s.Append('\\');
else if (c == '/')
s.Append('/');
else if (c == 'b')
s.Append('\b');
else if (c == 'f')
s.Append('\f');
else if (c == 'n')
s.Append('\n');
else if (c == 'r')
s.Append('\r');
else if (c == 't')
s.Append('\t');
else if (c == 'u')
{
int remainingLength = json.Length - index;
if (remainingLength >= 4)
{
// parse the 32 bit hex into an integer codepoint
uint codePoint;
if (!(success = UInt32.TryParse(new string(json, index, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out codePoint)))
return "";
// convert the integer codepoint to a unicode char and add to string
if (0xD800 <= codePoint && codePoint <= 0xDBFF) // if high surrogate
{
index += 4; // skip 4 chars
remainingLength = json.Length - index;
if (remainingLength >= 6)
{
uint lowCodePoint;
if (new string(json, index, 2) == "\\u" && UInt32.TryParse(new string(json, index + 2, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out lowCodePoint))
{
if (0xDC00 <= lowCodePoint && lowCodePoint <= 0xDFFF) // if low surrogate
{
s.Append((char)codePoint);
s.Append((char)lowCodePoint);
index += 6; // skip 6 chars
continue;
}
}
}
success = false; // invalid surrogate pair
return "";
}
s.Append(ConvertFromUtf32((int)codePoint));
// skip 4 chars
index += 4;
}
else
break;
}
}
else
s.Append(c);
}
if (!complete)
{
success = false;
return null;
}
return s.ToString();
}
private static string ConvertFromUtf32(int utf32)
{
// http://www.java2s.com/Open-Source/CSharp/2.6.4-mono-.net-core/System/System/Char.cs.htm
if (utf32 < 0 || utf32 > 0x10FFFF)
throw new ArgumentOutOfRangeException("utf32", "The argument must be from 0 to 0x10FFFF.");
if (0xD800 <= utf32 && utf32 <= 0xDFFF)
throw new ArgumentOutOfRangeException("utf32", "The argument must not be in surrogate pair range.");
if (utf32 < 0x10000)
return new string((char)utf32, 1);
utf32 -= 0x10000;
return new string(new char[] { (char)((utf32 >> 10) + 0xD800), (char)(utf32 % 0x0400 + 0xDC00) });
}
static object ParseNumber(char[] json, ref int index, ref bool success)
{
EatWhitespace(json, ref index);
int lastIndex = GetLastIndexOfNumber(json, index);
int charLength = (lastIndex - index) + 1;
object returnNumber;
string str = new string(json, index, charLength);
if (str.IndexOf(".", StringComparison.OrdinalIgnoreCase) != -1 || str.IndexOf("e", StringComparison.OrdinalIgnoreCase) != -1)
{
double number;
success = double.TryParse(new string(json, index, charLength), NumberStyles.Any, CultureInfo.InvariantCulture, out number);
returnNumber = number;
}
else
{
long number;
success = long.TryParse(new string(json, index, charLength), NumberStyles.Any, CultureInfo.InvariantCulture, out number);
returnNumber = number;
}
index = lastIndex + 1;
return returnNumber;
}
static int GetLastIndexOfNumber(char[] json, int index)
{
int lastIndex;
for (lastIndex = index; lastIndex < json.Length; lastIndex++)
if ("0123456789+-.eE".IndexOf(json[lastIndex]) == -1) break;
return lastIndex - 1;
}
static void EatWhitespace(char[] json, ref int index)
{
for (; index < json.Length; index++)
if (" \t\n\r\b\f".IndexOf(json[index]) == -1) break;
}
static int LookAhead(char[] json, int index)
{
int saveIndex = index;
return NextToken(json, ref saveIndex);
}
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
static int NextToken(char[] json, ref int index)
{
EatWhitespace(json, ref index);
if (index == json.Length)
return TOKEN_NONE;
char c = json[index];
index++;
switch (c)
{
case '{':
return TOKEN_CURLY_OPEN;
case '}':
return TOKEN_CURLY_CLOSE;
case '[':
return TOKEN_SQUARED_OPEN;
case ']':
return TOKEN_SQUARED_CLOSE;
case ',':
return TOKEN_COMMA;
case '"':
return TOKEN_STRING;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case '-':
return TOKEN_NUMBER;
case ':':
return TOKEN_COLON;
}
index--;
int remainingLength = json.Length - index;
// false
if (remainingLength >= 5)
{
if (json[index] == 'f' && json[index + 1] == 'a' && json[index + 2] == 'l' && json[index + 3] == 's' && json[index + 4] == 'e')
{
index += 5;
return TOKEN_FALSE;
}
}
// true
if (remainingLength >= 4)
{
if (json[index] == 't' && json[index + 1] == 'r' && json[index + 2] == 'u' && json[index + 3] == 'e')
{
index += 4;
return TOKEN_TRUE;
}
}
// null
if (remainingLength >= 4)
{
if (json[index] == 'n' && json[index + 1] == 'u' && json[index + 2] == 'l' && json[index + 3] == 'l')
{
index += 4;
return TOKEN_NULL;
}
}
return TOKEN_NONE;
}
static bool SerializeValue(IJsonSerializerStrategy jsonSerializerStrategy, object value, StringBuilder builder, SerializerOptions options = null)
{
bool success = true;
string stringValue = value as string;
if (stringValue != null)
success = SerializeString(stringValue, builder);
else
{
IDictionary<string, object> dict = value as IDictionary<string, object>;
if (dict != null)
{
success = SerializeObject(jsonSerializerStrategy, dict.Keys, dict.Values, builder, options);
}
else
{
IDictionary<string, string> stringDictionary = value as IDictionary<string, string>;
if (stringDictionary != null)
{
success = SerializeObject(jsonSerializerStrategy, stringDictionary.Keys, stringDictionary.Values, builder, options);
}
else
{
IEnumerable enumerableValue = value as IEnumerable;
if (enumerableValue != null)
success = SerializeArray(jsonSerializerStrategy, enumerableValue, builder, options);
else if (IsNumeric(value))
success = SerializeNumber(value, builder);
else if (value is bool)
builder.Append((bool)value ? "true" : "false");
else if (value == null)
{
if (options == null)
{
builder.Append("null");
}
else
{
if (!options.SkipNullProperties)
{
builder.Append("null");
}
}
}
else
{
object serializedObject;
success = jsonSerializerStrategy.TrySerializeNonPrimitiveObject(value, out serializedObject);
if (success)
SerializeValue(jsonSerializerStrategy, serializedObject, builder, options);
}
}
}
}
return success;
}
static bool SerializeObject(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable keys, IEnumerable values, StringBuilder builder, SerializerOptions options = null)
{
builder.Append("{");
IEnumerator ke = keys.GetEnumerator();
IEnumerator ve = values.GetEnumerator();
bool first = true;
while (ke.MoveNext() && ve.MoveNext())
{
object key = ke.Current;
object value = ve.Current;
string stringKey = key as string;
if ((options != null) && (stringKey != null) && (options.SkipNullProperties) && (value == null))
continue;
if (!first)
builder.Append(",");
if (stringKey != null)
SerializeString(stringKey, builder);
else
if (!SerializeValue(jsonSerializerStrategy, value, builder, options)) return false;
builder.Append(":");
if (!SerializeValue(jsonSerializerStrategy, value, builder, options))
return false;
first = false;
}
builder.Append("}");
return true;
}
static bool SerializeArray(IJsonSerializerStrategy jsonSerializerStrategy, IEnumerable anArray, StringBuilder builder, SerializerOptions options = null)
{
builder.Append("[");
bool first = true;
foreach (object value in anArray)
{
if (!first)
builder.Append(",");
if (!SerializeValue(jsonSerializerStrategy, value, builder, options))
return false;
first = false;
}
builder.Append("]");
return true;
}
static bool SerializeString(string aString, StringBuilder builder)
{
builder.Append("\"");
char[] charArray = aString.ToCharArray();
for (int i = 0; i < charArray.Length; i++)
{
char c = charArray[i];
if (c == '"')
builder.Append("\\\"");
else if (c == '\\')
builder.Append("\\\\");
else if (c == '\b')
builder.Append("\\b");
else if (c == '\f')
builder.Append("\\f");
else if (c == '\n')
builder.Append("\\n");
else if (c == '\r')
builder.Append("\\r");
else if (c == '\t')
builder.Append("\\t");
else
builder.Append(c);
}
builder.Append("\"");
return true;
}
static bool SerializeNumber(object number, StringBuilder builder)
{
if (number is long)
builder.Append(((long)number).ToString(CultureInfo.InvariantCulture));
else if (number is ulong)
builder.Append(((ulong)number).ToString(CultureInfo.InvariantCulture));
else if (number is int)
builder.Append(((int)number).ToString(CultureInfo.InvariantCulture));
else if (number is uint)
builder.Append(((uint)number).ToString(CultureInfo.InvariantCulture));
else if (number is decimal)
builder.Append(((decimal)number).ToString(CultureInfo.InvariantCulture));
else if (number is float)
builder.Append(((float)number).ToString(CultureInfo.InvariantCulture));
else
builder.Append(Convert.ToDouble(number, CultureInfo.InvariantCulture).ToString("r", CultureInfo.InvariantCulture));
return true;
}
/// <summary>
/// Determines if a given object is numeric in any way
/// (can be integer, double, null, etc).
/// </summary>
static bool IsNumeric(object value)
{
if (value is sbyte) return true;
if (value is byte) return true;
if (value is short) return true;
if (value is ushort) return true;
if (value is int) return true;
if (value is uint) return true;
if (value is long) return true;
if (value is ulong) return true;
if (value is float) return true;
if (value is double) return true;
if (value is decimal) return true;
return false;
}
private static IJsonSerializerStrategy _currentJsonSerializerStrategy;
public static IJsonSerializerStrategy CurrentJsonSerializerStrategy
{
get
{
return _currentJsonSerializerStrategy ??
(_currentJsonSerializerStrategy =
#if SIMPLE_JSON_DATACONTRACT
DataContractJsonSerializerStrategy
#else
PocoJsonSerializerStrategy
#endif
);
}
set
{
_currentJsonSerializerStrategy = value;
}
}
private static PocoJsonSerializerStrategy _pocoJsonSerializerStrategy;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static PocoJsonSerializerStrategy PocoJsonSerializerStrategy
{
get
{
return _pocoJsonSerializerStrategy ?? (_pocoJsonSerializerStrategy = new PocoJsonSerializerStrategy());
}
}
#if SIMPLE_JSON_DATACONTRACT
private static DataContractJsonSerializerStrategy _dataContractJsonSerializerStrategy;
[System.ComponentModel.EditorBrowsable(EditorBrowsableState.Advanced)]
public static DataContractJsonSerializerStrategy DataContractJsonSerializerStrategy
{
get
{
return _dataContractJsonSerializerStrategy ?? (_dataContractJsonSerializerStrategy = new DataContractJsonSerializerStrategy());
}
}
#endif
}
[GeneratedCode("simple-json", "1.0.0")]
#if SIMPLE_JSON_INTERNAL
internal
#else
public
#endif
interface IJsonSerializerStrategy
{
[SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")]
bool TrySerializeNonPrimitiveObject(object input, out object output);
object DeserializeObject(object value, Type type);
}
[GeneratedCode("simple-json", "1.0.0")]
#if SIMPLE_JSON_INTERNAL
internal
#else
public
#endif
class PocoJsonSerializerStrategy : IJsonSerializerStrategy
{
internal IDictionary<Type, ReflectionUtils.ConstructorDelegate> ConstructorCache;
internal IDictionary<Type, IDictionary<string, ReflectionUtils.GetDelegate>> GetCache;
internal IDictionary<Type, IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>>> SetCache;
internal static readonly Type[] EmptyTypes = new Type[0];
internal static readonly Type[] ArrayConstructorParameterTypes = new Type[] { typeof(int) };
private static readonly string[] Iso8601Format = new string[]
{
@"yyyy-MM-dd\THH:mm:ss.FFFFFFF\Z",
@"yyyy-MM-dd\THH:mm:ss\Z",
@"yyyy-MM-dd\THH:mm:ssK"
};
public PocoJsonSerializerStrategy()
{
ConstructorCache = new ReflectionUtils.ThreadSafeDictionary<Type, ReflectionUtils.ConstructorDelegate>(ContructorDelegateFactory);
GetCache = new ReflectionUtils.ThreadSafeDictionary<Type, IDictionary<string, ReflectionUtils.GetDelegate>>(GetterValueFactory);
SetCache = new ReflectionUtils.ThreadSafeDictionary<Type, IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>>>(SetterValueFactory);
}
protected virtual string MapClrMemberNameToJsonFieldName(string clrPropertyName)
{
return clrPropertyName;
}
internal virtual ReflectionUtils.ConstructorDelegate ContructorDelegateFactory(Type key)
{
return ReflectionUtils.GetContructor(key, key.IsArray ? ArrayConstructorParameterTypes : EmptyTypes);
}
internal virtual IDictionary<string, ReflectionUtils.GetDelegate> GetterValueFactory(Type type)
{
IDictionary<string, ReflectionUtils.GetDelegate> result = new Dictionary<string, ReflectionUtils.GetDelegate>();
foreach (PropertyInfo propertyInfo in ReflectionUtils.GetProperties(type))
{
if (propertyInfo.CanRead)
{
MethodInfo getMethod = ReflectionUtils.GetGetterMethodInfo(propertyInfo);
if (getMethod.IsStatic || !getMethod.IsPublic)
continue;
result[MapClrMemberNameToJsonFieldName(propertyInfo.Name)] = ReflectionUtils.GetGetMethod(propertyInfo);
}
}
foreach (FieldInfo fieldInfo in ReflectionUtils.GetFields(type))
{
if (fieldInfo.IsStatic || !fieldInfo.IsPublic)
continue;
result[MapClrMemberNameToJsonFieldName(fieldInfo.Name)] = ReflectionUtils.GetGetMethod(fieldInfo);
}
return result;
}
internal virtual IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>> SetterValueFactory(Type type)
{
IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>> result = new Dictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>>();
foreach (PropertyInfo propertyInfo in ReflectionUtils.GetProperties(type))
{
if (propertyInfo.CanWrite)
{
MethodInfo setMethod = ReflectionUtils.GetSetterMethodInfo(propertyInfo);
if (setMethod.IsStatic || !setMethod.IsPublic)
continue;
result[MapClrMemberNameToJsonFieldName(propertyInfo.Name)] = new KeyValuePair<Type, ReflectionUtils.SetDelegate>(propertyInfo.PropertyType, ReflectionUtils.GetSetMethod(propertyInfo));
}
}
foreach (FieldInfo fieldInfo in ReflectionUtils.GetFields(type))
{
if (fieldInfo.IsInitOnly || fieldInfo.IsStatic || !fieldInfo.IsPublic)
continue;
result[MapClrMemberNameToJsonFieldName(fieldInfo.Name)] = new KeyValuePair<Type, ReflectionUtils.SetDelegate>(fieldInfo.FieldType, ReflectionUtils.GetSetMethod(fieldInfo));
}
return result;
}
public virtual bool TrySerializeNonPrimitiveObject(object input, out object output)
{
return TrySerializeKnownTypes(input, out output) || TrySerializeUnknownTypes(input, out output);
}
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
public virtual object DeserializeObject(object value, Type type)
{
if (type == null) throw new ArgumentNullException("type");
string str = value as string;
if (type == typeof(Guid) && string.IsNullOrEmpty(str))
return default(Guid);
if (value == null)
return null;
object obj = null;
if (str != null)
{
if (str.Length != 0) // We know it can't be null now.
{
if (type == typeof(DateTime) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(DateTime)))
return DateTime.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
if (type == typeof(DateTimeOffset) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(DateTimeOffset)))
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
return new Guid(str);
return str;
}
else
{
if (type == typeof(Guid))
obj = default(Guid);
else if (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid))
obj = null;
else
obj = str;
}
// Empty string case
if (!ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid))
return str;
}
else if (value is bool)
return value;
bool valueIsLong = value is long;
bool valueIsDouble = value is double;
if ((valueIsLong && type == typeof(long)) || (valueIsDouble && type == typeof(double)))
return value;
if ((valueIsDouble && type != typeof(double)) || (valueIsLong && type != typeof(long)))
{
obj =
#if NETFX_CORE
type == typeof(int) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(bool) || type == typeof(decimal) || type == typeof(byte) || type == typeof(short)
#else
typeof(IConvertible).IsAssignableFrom(type)
#endif
? Convert.ChangeType(value, type, CultureInfo.InvariantCulture) : value;
}
else
{
IDictionary<string, object> objects = value as IDictionary<string, object>;
if (objects != null)
{
IDictionary<string, object> jsonObject = objects;
if (ReflectionUtils.IsTypeDictionary(type))
{
// if dictionary then
Type[] types = ReflectionUtils.GetGenericTypeArguments(type);
Type keyType = types[0];
Type valueType = types[1];
Type genericType = typeof(Dictionary<,>).MakeGenericType(keyType, valueType);
IDictionary dict = (IDictionary)ConstructorCache[genericType]();
foreach (KeyValuePair<string, object> kvp in jsonObject)
dict.Add(kvp.Key, DeserializeObject(kvp.Value, valueType));
obj = dict;
}
else
{
if (type == typeof(object))
obj = value;
else
{
obj = ConstructorCache[type]();
foreach (KeyValuePair<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>> setter in SetCache[type])
{
object jsonValue;
if (jsonObject.TryGetValue(setter.Key, out jsonValue))
{
jsonValue = DeserializeObject(jsonValue, setter.Value.Key);
setter.Value.Value(obj, jsonValue);
}
}
}
}
}
else
{
IList<object> valueAsList = value as IList<object>;
if (valueAsList != null)
{
IList<object> jsonObject = valueAsList;
IList list = null;
if (type.IsArray)
{
list = (IList)ConstructorCache[type](jsonObject.Count);
int i = 0;
foreach (object o in jsonObject)
list[i++] = DeserializeObject(o, type.GetElementType());
}
else if (ReflectionUtils.IsTypeGenericeCollectionInterface(type) || ReflectionUtils.IsAssignableFrom(typeof(IList), type))
{
Type innerType = ReflectionUtils.GetGenericTypeArguments(type)[0];
Type genericType = typeof(List<>).MakeGenericType(innerType);
list = (IList)ConstructorCache[genericType](jsonObject.Count);
foreach (object o in jsonObject)
list.Add(DeserializeObject(o, innerType));
}
obj = list;
}
}
return obj;
}
if (ReflectionUtils.IsNullableType(type))
return ReflectionUtils.ToNullableType(obj, type);
return obj;
}
protected virtual object SerializeEnum(Enum p)
{
return Convert.ToDouble(p, CultureInfo.InvariantCulture);
}
[SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")]
protected virtual bool TrySerializeKnownTypes(object input, out object output)
{
bool returnValue = true;
if (input is DateTime)
output = ((DateTime)input).ToUniversalTime().ToString(Iso8601Format[0], CultureInfo.InvariantCulture);
else if (input is DateTimeOffset)
output = ((DateTimeOffset)input).ToUniversalTime().ToString(Iso8601Format[0], CultureInfo.InvariantCulture);
else if (input is Guid)
output = ((Guid)input).ToString("D");
else if (input is Uri)
output = input.ToString();
else
{
Enum inputEnum = input as Enum;
if (inputEnum != null)
output = SerializeEnum(inputEnum);
else
{
returnValue = false;
output = null;
}
}
return returnValue;
}
[SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")]
protected virtual bool TrySerializeUnknownTypes(object input, out object output)
{
if (input == null) throw new ArgumentNullException("input");
output = null;
Type type = input.GetType();
if (type.FullName == null)
return false;
IDictionary<string, object> obj = new JsonObject();
IDictionary<string, ReflectionUtils.GetDelegate> getters = GetCache[type];
foreach (KeyValuePair<string, ReflectionUtils.GetDelegate> getter in getters)
{
if (getter.Value != null)
obj.Add(MapClrMemberNameToJsonFieldName(getter.Key), getter.Value(input));
}
output = obj;
return true;
}
}
#if SIMPLE_JSON_DATACONTRACT
[GeneratedCode("simple-json", "1.0.0")]
#if SIMPLE_JSON_INTERNAL
internal
#else
public
#endif
class DataContractJsonSerializerStrategy : PocoJsonSerializerStrategy
{
public DataContractJsonSerializerStrategy()
{
GetCache = new ReflectionUtils.ThreadSafeDictionary<Type, IDictionary<string, ReflectionUtils.GetDelegate>>(GetterValueFactory);
SetCache = new ReflectionUtils.ThreadSafeDictionary<Type, IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>>>(SetterValueFactory);
}
internal override IDictionary<string, ReflectionUtils.GetDelegate> GetterValueFactory(Type type)
{
bool hasDataContract = ReflectionUtils.GetAttribute(type, typeof(DataContractAttribute)) != null;
if (!hasDataContract)
return base.GetterValueFactory(type);
string jsonKey;
IDictionary<string, ReflectionUtils.GetDelegate> result = new Dictionary<string, ReflectionUtils.GetDelegate>();
foreach (PropertyInfo propertyInfo in ReflectionUtils.GetProperties(type))
{
if (propertyInfo.CanRead)
{
MethodInfo getMethod = ReflectionUtils.GetGetterMethodInfo(propertyInfo);
if (!getMethod.IsStatic && CanAdd(propertyInfo, out jsonKey))
result[jsonKey] = ReflectionUtils.GetGetMethod(propertyInfo);
}
}
foreach (FieldInfo fieldInfo in ReflectionUtils.GetFields(type))
{
if (!fieldInfo.IsStatic && CanAdd(fieldInfo, out jsonKey))
result[jsonKey] = ReflectionUtils.GetGetMethod(fieldInfo);
}
return result;
}
internal override IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>> SetterValueFactory(Type type)
{
bool hasDataContract = ReflectionUtils.GetAttribute(type, typeof(DataContractAttribute)) != null;
if (!hasDataContract)
return base.SetterValueFactory(type);
string jsonKey;
IDictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>> result = new Dictionary<string, KeyValuePair<Type, ReflectionUtils.SetDelegate>>();
foreach (PropertyInfo propertyInfo in ReflectionUtils.GetProperties(type))
{
if (propertyInfo.CanWrite)
{
MethodInfo setMethod = ReflectionUtils.GetSetterMethodInfo(propertyInfo);
if (!setMethod.IsStatic && CanAdd(propertyInfo, out jsonKey))
result[jsonKey] = new KeyValuePair<Type, ReflectionUtils.SetDelegate>(propertyInfo.PropertyType, ReflectionUtils.GetSetMethod(propertyInfo));
}
}
foreach (FieldInfo fieldInfo in ReflectionUtils.GetFields(type))
{
if (!fieldInfo.IsInitOnly && !fieldInfo.IsStatic && CanAdd(fieldInfo, out jsonKey))
result[jsonKey] = new KeyValuePair<Type, ReflectionUtils.SetDelegate>(fieldInfo.FieldType, ReflectionUtils.GetSetMethod(fieldInfo));
}
// todo implement sorting for DATACONTRACT.
return result;
}
private static bool CanAdd(MemberInfo info, out string jsonKey)
{
jsonKey = null;
if (ReflectionUtils.GetAttribute(info, typeof(IgnoreDataMemberAttribute)) != null)
return false;
DataMemberAttribute dataMemberAttribute = (DataMemberAttribute)ReflectionUtils.GetAttribute(info, typeof(DataMemberAttribute));
if (dataMemberAttribute == null)
return false;
jsonKey = string.IsNullOrEmpty(dataMemberAttribute.Name) ? info.Name : dataMemberAttribute.Name;
return true;
}
}
#endif
namespace Reflection
{
// This class is meant to be copied into other libraries. So we want to exclude it from Code Analysis rules
// that might be in place in the target project.
[GeneratedCode("reflection-utils", "1.0.0")]
#if SIMPLE_JSON_REFLECTION_UTILS_PUBLIC
public
#else
internal
#endif
class ReflectionUtils
{
private static readonly object[] EmptyObjects = new object[] { };
public delegate object GetDelegate(object source);
public delegate void SetDelegate(object source, object value);
public delegate object ConstructorDelegate(params object[] args);
public delegate TValue ThreadSafeDictionaryValueFactory<TKey, TValue>(TKey key);
public static Attribute GetAttribute(MemberInfo info, Type type)
{
#if SIMPLE_JSON_TYPEINFO
if (info == null || type == null || !info.IsDefined(type))
return null;
return info.GetCustomAttribute(type);
#else
if (info == null || type == null || !Attribute.IsDefined(info, type))
return null;
return Attribute.GetCustomAttribute(info, type);
#endif
}
public static Attribute GetAttribute(Type objectType, Type attributeType)
{
#if SIMPLE_JSON_TYPEINFO
if (objectType == null || attributeType == null || !objectType.GetTypeInfo().IsDefined(attributeType))
return null;
return objectType.GetTypeInfo().GetCustomAttribute(attributeType);
#else
if (objectType == null || attributeType == null || !Attribute.IsDefined(objectType, attributeType))
return null;
return Attribute.GetCustomAttribute(objectType, attributeType);
#endif
}
public static Type[] GetGenericTypeArguments(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().GenericTypeArguments;
#else
return type.GetGenericArguments();
#endif
}
public static bool IsTypeGenericeCollectionInterface(Type type)
{
#if SIMPLE_JSON_TYPEINFO
if (!type.GetTypeInfo().IsGenericType)
#else
if (!type.IsGenericType)
#endif
return false;
Type genericDefinition = type.GetGenericTypeDefinition();
return (genericDefinition == typeof(IList<>) || genericDefinition == typeof(ICollection<>) || genericDefinition == typeof(IEnumerable<>));
}
public static bool IsAssignableFrom(Type type1, Type type2)
{
#if SIMPLE_JSON_TYPEINFO
return type1.GetTypeInfo().IsAssignableFrom(type2.GetTypeInfo());
#else
return type1.IsAssignableFrom(type2);
#endif
}
public static bool IsTypeDictionary(Type type)
{
#if SIMPLE_JSON_TYPEINFO
if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
return true;
if (!type.GetTypeInfo().IsGenericType)
return false;
#else
if (typeof(System.Collections.IDictionary).IsAssignableFrom(type))
return true;
if (!type.IsGenericType)
return false;
#endif
Type genericDefinition = type.GetGenericTypeDefinition();
return genericDefinition == typeof(IDictionary<,>);
}
public static bool IsNullableType(Type type)
{
return
#if SIMPLE_JSON_TYPEINFO
type.GetTypeInfo().IsGenericType
#else
type.IsGenericType
#endif
&& type.GetGenericTypeDefinition() == typeof(Nullable<>);
}
public static object ToNullableType(object obj, Type nullableType)
{
return obj == null ? null : Convert.ChangeType(obj, Nullable.GetUnderlyingType(nullableType), CultureInfo.InvariantCulture);
}
public static bool IsValueType(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().IsValueType;
#else
return type.IsValueType;
#endif
}
public static IEnumerable<ConstructorInfo> GetConstructors(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().DeclaredConstructors;
#else
return type.GetConstructors();
#endif
}
public static ConstructorInfo GetConstructorInfo(Type type, params Type[] argsType)
{
IEnumerable<ConstructorInfo> constructorInfos = GetConstructors(type);
int i;
bool matches;
foreach (ConstructorInfo constructorInfo in constructorInfos)
{
ParameterInfo[] parameters = constructorInfo.GetParameters();
if (argsType.Length != parameters.Length)
continue;
i = 0;
matches = true;
foreach (ParameterInfo parameterInfo in constructorInfo.GetParameters())
{
if (parameterInfo.ParameterType != argsType[i])
{
matches = false;
break;
}
}
if (matches)
return constructorInfo;
}
return null;
}
public static IEnumerable<PropertyInfo> GetProperties(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().DeclaredProperties;
#else
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
#endif
}
public static IEnumerable<FieldInfo> GetFields(Type type)
{
#if SIMPLE_JSON_TYPEINFO
return type.GetTypeInfo().DeclaredFields;
#else
return type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
#endif
}
public static MethodInfo GetGetterMethodInfo(PropertyInfo propertyInfo)
{
#if SIMPLE_JSON_TYPEINFO
return propertyInfo.GetMethod;
#else
return propertyInfo.GetGetMethod(true);
#endif
}
public static MethodInfo GetSetterMethodInfo(PropertyInfo propertyInfo)
{
#if SIMPLE_JSON_TYPEINFO
return propertyInfo.SetMethod;
#else
return propertyInfo.GetSetMethod(true);
#endif
}
public static ConstructorDelegate GetContructor(ConstructorInfo constructorInfo)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetConstructorByReflection(constructorInfo);
#else
return GetConstructorByExpression(constructorInfo);
#endif
}
public static ConstructorDelegate GetContructor(Type type, params Type[] argsType)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetConstructorByReflection(type, argsType);
#else
return GetConstructorByExpression(type, argsType);
#endif
}
public static ConstructorDelegate GetConstructorByReflection(ConstructorInfo constructorInfo)
{
return delegate(object[] args) { return constructorInfo.Invoke(args); };
}
public static ConstructorDelegate GetConstructorByReflection(Type type, params Type[] argsType)
{
ConstructorInfo constructorInfo = GetConstructorInfo(type, argsType);
return constructorInfo == null ? null : GetConstructorByReflection(constructorInfo);
}
#if !SIMPLE_JSON_NO_LINQ_EXPRESSION
public static ConstructorDelegate GetConstructorByExpression(ConstructorInfo constructorInfo)
{
ParameterInfo[] paramsInfo = constructorInfo.GetParameters();
ParameterExpression param = Expression.Parameter(typeof(object[]), "args");
Expression[] argsExp = new Expression[paramsInfo.Length];
for (int i = 0; i < paramsInfo.Length; i++)
{
Expression index = Expression.Constant(i);
Type paramType = paramsInfo[i].ParameterType;
Expression paramAccessorExp = Expression.ArrayIndex(param, index);
Expression paramCastExp = Expression.Convert(paramAccessorExp, paramType);
argsExp[i] = paramCastExp;
}
NewExpression newExp = Expression.New(constructorInfo, argsExp);
Expression<Func<object[], object>> lambda = Expression.Lambda<Func<object[], object>>(newExp, param);
Func<object[], object> compiledLambda = lambda.Compile();
return delegate(object[] args) { return compiledLambda(args); };
}
public static ConstructorDelegate GetConstructorByExpression(Type type, params Type[] argsType)
{
ConstructorInfo constructorInfo = GetConstructorInfo(type, argsType);
return constructorInfo == null ? null : GetConstructorByExpression(constructorInfo);
}
#endif
public static GetDelegate GetGetMethod(PropertyInfo propertyInfo)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetGetMethodByReflection(propertyInfo);
#else
return GetGetMethodByExpression(propertyInfo);
#endif
}
public static GetDelegate GetGetMethod(FieldInfo fieldInfo)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetGetMethodByReflection(fieldInfo);
#else
return GetGetMethodByExpression(fieldInfo);
#endif
}
public static GetDelegate GetGetMethodByReflection(PropertyInfo propertyInfo)
{
MethodInfo methodInfo = GetGetterMethodInfo(propertyInfo);
return delegate(object source) { return methodInfo.Invoke(source, EmptyObjects); };
}
public static GetDelegate GetGetMethodByReflection(FieldInfo fieldInfo)
{
return delegate(object source) { return fieldInfo.GetValue(source); };
}
#if !SIMPLE_JSON_NO_LINQ_EXPRESSION
public static GetDelegate GetGetMethodByExpression(PropertyInfo propertyInfo)
{
MethodInfo getMethodInfo = GetGetterMethodInfo(propertyInfo);
ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
UnaryExpression instanceCast = (!IsValueType(propertyInfo.DeclaringType)) ? Expression.TypeAs(instance, propertyInfo.DeclaringType) : Expression.Convert(instance, propertyInfo.DeclaringType);
Func<object, object> compiled = Expression.Lambda<Func<object, object>>(Expression.TypeAs(Expression.Call(instanceCast, getMethodInfo), typeof(object)), instance).Compile();
return delegate(object source) { return compiled(source); };
}
public static GetDelegate GetGetMethodByExpression(FieldInfo fieldInfo)
{
ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
MemberExpression member = Expression.Field(Expression.Convert(instance, fieldInfo.DeclaringType), fieldInfo);
GetDelegate compiled = Expression.Lambda<GetDelegate>(Expression.Convert(member, typeof(object)), instance).Compile();
return delegate(object source) { return compiled(source); };
}
#endif
public static SetDelegate GetSetMethod(PropertyInfo propertyInfo)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetSetMethodByReflection(propertyInfo);
#else
return GetSetMethodByExpression(propertyInfo);
#endif
}
public static SetDelegate GetSetMethod(FieldInfo fieldInfo)
{
#if SIMPLE_JSON_NO_LINQ_EXPRESSION
return GetSetMethodByReflection(fieldInfo);
#else
return GetSetMethodByExpression(fieldInfo);
#endif
}
public static SetDelegate GetSetMethodByReflection(PropertyInfo propertyInfo)
{
MethodInfo methodInfo = GetSetterMethodInfo(propertyInfo);
return delegate(object source, object value) { methodInfo.Invoke(source, new object[] { value }); };
}
public static SetDelegate GetSetMethodByReflection(FieldInfo fieldInfo)
{
return delegate(object source, object value) { fieldInfo.SetValue(source, value); };
}
#if !SIMPLE_JSON_NO_LINQ_EXPRESSION
public static SetDelegate GetSetMethodByExpression(PropertyInfo propertyInfo)
{
MethodInfo setMethodInfo = GetSetterMethodInfo(propertyInfo);
ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
ParameterExpression value = Expression.Parameter(typeof(object), "value");
UnaryExpression instanceCast = (!IsValueType(propertyInfo.DeclaringType)) ? Expression.TypeAs(instance, propertyInfo.DeclaringType) : Expression.Convert(instance, propertyInfo.DeclaringType);
UnaryExpression valueCast = (!IsValueType(propertyInfo.PropertyType)) ? Expression.TypeAs(value, propertyInfo.PropertyType) : Expression.Convert(value, propertyInfo.PropertyType);
Action<object, object> compiled = Expression.Lambda<Action<object, object>>(Expression.Call(instanceCast, setMethodInfo, valueCast), new ParameterExpression[] { instance, value }).Compile();
return delegate(object source, object val) { compiled(source, val); };
}
public static SetDelegate GetSetMethodByExpression(FieldInfo fieldInfo)
{
ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
ParameterExpression value = Expression.Parameter(typeof(object), "value");
Action<object, object> compiled = Expression.Lambda<Action<object, object>>(
Assign(Expression.Field(Expression.Convert(instance, fieldInfo.DeclaringType), fieldInfo), Expression.Convert(value, fieldInfo.FieldType)), instance, value).Compile();
return delegate(object source, object val) { compiled(source, val); };
}
public static BinaryExpression Assign(Expression left, Expression right)
{
#if SIMPLE_JSON_TYPEINFO
return Expression.Assign(left, right);
#else
MethodInfo assign = typeof(Assigner<>).MakeGenericType(left.Type).GetMethod("Assign");
BinaryExpression assignExpr = Expression.Add(left, right, assign);
return assignExpr;
#endif
}
private static class Assigner<T>
{
public static T Assign(ref T left, T right)
{
return (left = right);
}
}
#endif
public sealed class ThreadSafeDictionary<TKey, TValue> : IDictionary<TKey, TValue>
{
private readonly object _lock = new object();
private readonly ThreadSafeDictionaryValueFactory<TKey, TValue> _valueFactory;
private Dictionary<TKey, TValue> _dictionary;
public ThreadSafeDictionary(ThreadSafeDictionaryValueFactory<TKey, TValue> valueFactory)
{
_valueFactory = valueFactory;
}
private TValue Get(TKey key)
{
if (_dictionary == null)
return AddValue(key);
TValue value;
if (!_dictionary.TryGetValue(key, out value))
return AddValue(key);
return value;
}
private TValue AddValue(TKey key)
{
TValue value = _valueFactory(key);
lock (_lock)
{
if (_dictionary == null)
{
_dictionary = new Dictionary<TKey, TValue>();
_dictionary[key] = value;
}
else
{
TValue val;
if (_dictionary.TryGetValue(key, out val))
return val;
Dictionary<TKey, TValue> dict = new Dictionary<TKey, TValue>(_dictionary);
dict[key] = value;
_dictionary = dict;
}
}
return value;
}
public void Add(TKey key, TValue value)
{
throw new NotImplementedException();
}
public bool ContainsKey(TKey key)
{
return _dictionary.ContainsKey(key);
}
public ICollection<TKey> Keys
{
get { return _dictionary.Keys; }
}
public bool Remove(TKey key)
{
throw new NotImplementedException();
}
public bool TryGetValue(TKey key, out TValue value)
{
value = this[key];
return true;
}
public ICollection<TValue> Values
{
get { return _dictionary.Values; }
}
public TValue this[TKey key]
{
get { return Get(key); }
set { throw new NotImplementedException(); }
}
public void Add(KeyValuePair<TKey, TValue> item)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Contains(KeyValuePair<TKey, TValue> item)
{
throw new NotImplementedException();
}
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
throw new NotImplementedException();
}
public int Count
{
get { return _dictionary.Count; }
}
public bool IsReadOnly
{
get { throw new NotImplementedException(); }
}
public bool Remove(KeyValuePair<TKey, TValue> item)
{
throw new NotImplementedException();
}
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
return _dictionary.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return _dictionary.GetEnumerator();
}
}
}
}
}
// ReSharper restore LoopCanBeConvertedToQuery
// ReSharper restore RedundantExplicitArrayCreation
// ReSharper restore SuggestUseVarKeywordEvident
| 31.579453 | 613 | 0.698586 | [
"Apache-2.0"
] | ctacke/RestSharp | RestSharp/SimpleJson.cs | 65,780 | C# |
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#nullable disable
namespace StyleCop.Analyzers.Test.CSharp9.LayoutRules
{
using StyleCop.Analyzers.Test.CSharp8.LayoutRules;
public class SA1511CSharp9UnitTests : SA1511CSharp8UnitTests
{
}
}
| 26.785714 | 91 | 0.770667 | [
"MIT"
] | RogerHowellDfE/StyleCopAnalyzers | StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/LayoutRules/SA1511CSharp9UnitTests.cs | 377 | C# |
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace TheDevice
{
public static class TheDevice
{
static int width = 30;
static int height = 5;
static byte[] data;
static TheDevice()
{
Clear();
}
public static void Resize(int width, int height)
{
TheDevice.width = width;
TheDevice.height = height;
Clear();
}
public static void Clear()
{
data = new byte[width * height];
for (int i = 0; i < width * height; i++)
{
data[i] = 0;
}
}
public static int GetWidth()
{
return width;
}
public static int GetHeight()
{
return height;
}
public static void SetPixel(int x, int y, bool on)
{
if (x >= 0 && x < width && y >= 0 && y < height)
{
data[x + y * width] = on ? (byte)1 : (byte)0;
}
}
private static void CreateGraphics(string fileName)
{
using (Bitmap im = new Bitmap(width, height))
{
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
var v = data[x + y * width];
Color c;
if(v==1)
{
c = Color.FromArgb(255, 0, 0, 0);
}else{
c = Color.FromArgb(255, 255, 255, 255);
}
im.SetPixel(x, y, c);
}
}
var t = DateTime.UtcNow.ToString("yyyyMMdd-HHmmss-fffff");
im.Save(fileName ?? (t + ".bmp"), ImageFormat.Bmp);
}
}
private static void VisualizeAsText()
{
System.Console.WriteLine($"{width}x{height}:");
// TOP
System.Console.Write("┌");
for (int x = 0; x < width; x++)
{
System.Console.Write("─");
}
System.Console.WriteLine("┐");
// MIDDLE
for (int y = 0; y < height; y++)
{
System.Console.Write("│");
for (int x = 0; x < width; x++)
{
System.Console.Write(data[x + y * width] == 0 ? " " : "*");
}
System.Console.Write("│");
System.Console.WriteLine();
}
// BOTTOM
System.Console.Write("└");
for (int x = 0; x < width; x++)
{
System.Console.Write("─");
}
System.Console.WriteLine("┘");
}
public static void Visualize(bool textMode = true, string fileName = null)
{
if (textMode)
{
VisualizeAsText();
}
else
{
CreateGraphics(fileName);
}
}
}
} | 25.64 | 82 | 0.377847 | [
"MIT"
] | bwosh/csharpqa | 02_BaseLine/TheDevice.cs | 3,221 | C# |
using System;
namespace SimpleConfiguratorBackend.Areas.HelpPage
{
/// <summary>
/// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class.
/// </summary>
public class InvalidSample
{
public InvalidSample(string errorMessage)
{
if (errorMessage == null)
{
throw new ArgumentNullException("errorMessage");
}
ErrorMessage = errorMessage;
}
public string ErrorMessage { get; private set; }
public override bool Equals(object obj)
{
InvalidSample other = obj as InvalidSample;
return other != null && ErrorMessage == other.ErrorMessage;
}
public override int GetHashCode()
{
return ErrorMessage.GetHashCode();
}
public override string ToString()
{
return ErrorMessage;
}
}
} | 26.675676 | 134 | 0.58156 | [
"MIT"
] | YazanGhafir/SimpleConfigurator | Backend_Csharp_ASPNET/SimpleConfiguratorBackend/Areas/HelpPage/SampleGeneration/InvalidSample.cs | 987 | C# |
using UnityEngine;
using System.Collections;
using HighlightingSystem;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace HighlightingSystem.Demo
{
[System.Obsolete]
public class HighlighterInteractive : MonoBehaviour
{
public bool seeThrough = true;
}
#if UNITY_EDITOR
[System.Obsolete]
[CustomEditor(typeof(HighlighterInteractive))]
public class HighliterInteractiveEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.HelpBox("Component deprecated. Press upgrade button to automatically convert it.", MessageType.Warning);
if (GUILayout.Button("Upgrade", GUILayout.Height(30f)))
{
HighlightingUpgrade.Upgrade((target as MonoBehaviour).transform);
}
}
}
#endif
} | 21.514286 | 123 | 0.76494 | [
"Apache-2.0"
] | adityasamant/magic_card | Assets/ArtResource/HighlightingSystemDemo/Scripts/Advanced/Deprecated/HighlighterInteractive.cs | 753 | C# |
using System.Net.NetworkInformation;
using System.Threading;
using System.Diagnostics;
using System.Collections.Generic;
using System;
using System.Reflection;
using System.Linq;
using System.Net;
namespace NetworkScanner
{
static class Scanner
{
#region Members
private static List<Ping> m_Pingers = new List<Ping>();
private static int m_Instances = 0;
private static int m_Result = 0;
private static int m_Timeout = 250;
private static int m_Ttl = 5;
private static object @lock = new object();
#endregion
public static void Main(string[] args)
{
#region Startup
var versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
var attribute = Assembly.GetExecutingAssembly()
.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)
.Cast<AssemblyDescriptionAttribute>().FirstOrDefault();
var appName = string.Format("{0} v{1}", typeof(Scanner).Assembly.GetName().Name, versionInfo.ProductVersion);
Console.Title = appName;
Console.WindowWidth = 81;
Console.BufferWidth = 81;
Console.WindowHeight = 36;
Console.WriteLine();
Console.BackgroundColor = ConsoleColor.Gray;
Console.ForegroundColor = ConsoleColor.Black;
Console.WriteLine(appName);
Console.ResetColor();
if (attribute != null)
Console.WriteLine(attribute.Description);
Console.WriteLine();
Console.WriteLine(versionInfo.LegalCopyright);
Console.WriteLine(String.Empty.PadLeft(80, '-'));
Console.WriteLine();
#endregion
string baseIP = null;
//Scan adapters
if (args.Length > 0)
{
baseIP = args[0];
}
else
{
var lans = GetLans();
if (lans == null || lans.Count < 1)
{
Console.ReadKey();
return;
}
IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
Console.WriteLine("Interface information for {0}.{1}", computerProperties.HostName, computerProperties.DomainName);
for (int i = 0; i < lans.Count; i++)
{
Console.WriteLine("{0}:\t{1}", i + 1, lans[i].GetInfo());
}
Console.WriteLine();
Console.Write("Select interface: ");
var key = Console.ReadKey();
int s = int.Parse(key.KeyChar.ToString());
//Hier das zu scannende Netz angeben (Bsp. "192.168.0.")
baseIP = lans[s - 1].Address.ToString().Substring(0, lans[s - 1].Address.ToString().LastIndexOf('.') + 1);
Console.WriteLine();
Console.WriteLine(String.Empty.PadLeft(80, '-'));
}
Console.WriteLine("Pinging 255 destinations of D-class in {0}*", baseIP);
createPingers(255);
var pingOptions = new PingOptions(m_Ttl, true);
var encoding = new System.Text.ASCIIEncoding();
var data = encoding.GetBytes("abababababababababababababababab");
var wait = new SpinWait();
int cnt = 1;
var watch = Stopwatch.StartNew();
Console.WriteLine();
foreach (var p in m_Pingers)
{
lock (@lock)
{
m_Instances++;
}
p.SendAsync(string.Concat(baseIP, cnt.ToString()), m_Timeout, data, pingOptions);
cnt++;
}
while (m_Instances > 0)
{
wait.SpinOnce();
}
watch.Stop();
destroyPingers();
Console.WriteLine();
Console.WriteLine("Finished in {0}. Found {1} active IP-addresses.", watch.Elapsed.ToString(), m_Result);
Console.ReadKey();
}
private static List<LanInfo> GetLans()
{
var lans = new List<LanInfo>();
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
if (nics == null || nics.Length < 1)
{
Console.WriteLine(" No network interfaces found.");
return null;
}
foreach (NetworkInterface adapter in nics)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
if (!(adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet
|| adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
|| adapter.OperationalStatus != OperationalStatus.Up)
continue;
var ip = GetIPv4Address(properties);
if (ip != null)
{
lans.Add(new LanInfo(adapter.Name, adapter.Description, ip));
}
}
return lans;
}
public static IPAddress GetIPv4Address(IPInterfaceProperties adapterProperties)
{
UnicastIPAddressInformationCollection uniCast = adapterProperties.UnicastAddresses;
if (uniCast != null)
{
foreach (UnicastIPAddressInformation uni in uniCast)
{
if (uni.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
return uni.Address;
}
}
return null;
}
public static String GetHostNameByIp(IPAddress address)
{
try
{
return Dns.GetHostEntry(address).HostName;
}
catch (System.Net.Sockets.SocketException ex)
{
return String.Empty;
}
}
public static void PingCompleted(object s, PingCompletedEventArgs e)
{
if (e.Reply.Status == IPStatus.Success)
{
Console.WriteLine("Active IP: {0,-16} {1}", e.Reply.Address, GetHostNameByIp(e.Reply.Address));
m_Result += 1;
}
lock (@lock)
m_Instances--;
}
private static void createPingers(int cnt)
{
for (int i = 1; i <= cnt; i++)
{
var ping = new Ping();
ping.PingCompleted += PingCompleted;
m_Pingers.Add(ping);
}
}
private static void destroyPingers()
{
foreach (var ping in m_Pingers)
{
ping.PingCompleted -= PingCompleted;
ping.Dispose();
}
m_Pingers.Clear();
}
}
}
| 31.742081 | 131 | 0.517605 | [
"MIT"
] | 100prznt/NetworkScanner | NetworkScanner/Program.cs | 7,017 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the ec2-2015-04-15.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.EC2.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
namespace Amazon.EC2.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for DescribeReservedInstances operation
/// </summary>
public class DescribeReservedInstancesResponseUnmarshaller : EC2ResponseUnmarshaller
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
{
DescribeReservedInstancesResponse response = new DescribeReservedInstancesResponse();
int originalDepth = context.CurrentDepth;
int targetDepth = originalDepth + 1;
if (context.IsStartOfDocument)
targetDepth = 2;
while (context.ReadAtDepth(originalDepth))
{
if (context.IsStartElement || context.IsAttribute)
{
if (context.TestExpression("reservedInstancesSet/item", targetDepth))
{
var unmarshaller = ReservedInstancesUnmarshaller.Instance;
var item = unmarshaller.Unmarshall(context);
response.ReservedInstances.Add(item);
continue;
}
}
}
return response;
}
/// <summary>
/// Unmarshaller error response to exception.
/// </summary>
/// <param name="context"></param>
/// <param name="innerException"></param>
/// <param name="statusCode"></param>
/// <returns></returns>
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
{
ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
return new AmazonEC2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
}
private static DescribeReservedInstancesResponseUnmarshaller _instance = new DescribeReservedInstancesResponseUnmarshaller();
internal static DescribeReservedInstancesResponseUnmarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static DescribeReservedInstancesResponseUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 36.460784 | 158 | 0.64399 | [
"Apache-2.0"
] | jasoncwik/aws-sdk-net | sdk/src/Services/EC2/Generated/Model/Internal/MarshallTransformations/DescribeReservedInstancesResponseUnmarshaller.cs | 3,719 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _07.Center_Point
{
class Program
{
static double Point(double X,double Y)
{
double map = Math.Sqrt(Math.Pow(X,2)) + Math.Sqrt(Math.Pow(Y,2));
return map;
}
static void Main(string[] args)
{
double X1 = double.Parse(Console.ReadLine());
double Y1 = double.Parse(Console.ReadLine());
double X2 = double.Parse(Console.ReadLine());
double Y2 = double.Parse(Console.ReadLine());
double FirstPdoubleDistance = Point(X1, Y1);
double SecondPdoubleDistance = Point(X2, Y2);
if (FirstPdoubleDistance <= SecondPdoubleDistance) Console.WriteLine($"({X1}, {Y1})");
else Console.WriteLine($"({X2}, {Y2})");
}
}
}
| 24.34375 | 89 | 0.682927 | [
"MIT"
] | MichelleMihova/SoftUni | C# Methods. Debugging and Troubleshooting Code - Exercises/07. Primes in Given Range/Program.cs | 781 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Media.Devices
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
#endif
public partial class AudioDeviceModule
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public string ClassId
{
get
{
throw new global::System.NotImplementedException("The member string AudioDeviceModule.ClassId is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public string DisplayName
{
get
{
throw new global::System.NotImplementedException("The member string AudioDeviceModule.DisplayName is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public uint InstanceId
{
get
{
throw new global::System.NotImplementedException("The member uint AudioDeviceModule.InstanceId is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public uint MajorVersion
{
get
{
throw new global::System.NotImplementedException("The member uint AudioDeviceModule.MajorVersion is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public uint MinorVersion
{
get
{
throw new global::System.NotImplementedException("The member uint AudioDeviceModule.MinorVersion is not implemented in Uno.");
}
}
#endif
// Forced skipping of method Windows.Media.Devices.AudioDeviceModule.ClassId.get
// Forced skipping of method Windows.Media.Devices.AudioDeviceModule.DisplayName.get
// Forced skipping of method Windows.Media.Devices.AudioDeviceModule.InstanceId.get
// Forced skipping of method Windows.Media.Devices.AudioDeviceModule.MajorVersion.get
// Forced skipping of method Windows.Media.Devices.AudioDeviceModule.MinorVersion.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __MACOS__
[global::Uno.NotImplemented]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Media.Devices.ModuleCommandResult> SendCommandAsync( global::Windows.Storage.Streams.IBuffer Command)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<ModuleCommandResult> AudioDeviceModule.SendCommandAsync(IBuffer Command) is not implemented in Uno.");
}
#endif
}
}
| 35.337838 | 182 | 0.742256 | [
"Apache-2.0"
] | 06needhamt/uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Media.Devices/AudioDeviceModule.cs | 2,615 | C# |
public interface IPlayableBehaviour // TypeDefIndex: 3342
{
// Methods
[RequiredByNativeCodeAttribute] // RVA: 0xD9BF0 Offset: 0xD9CF1 VA: 0xD9BF0
// RVA: -1 Offset: -1 Slot: 0
public abstract void OnGraphStart(Playable playable) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C00 Offset: 0xD9D01 VA: 0xD9C00
// RVA: -1 Offset: -1 Slot: 1
public abstract void OnGraphStop(Playable playable) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C10 Offset: 0xD9D11 VA: 0xD9C10
// RVA: -1 Offset: -1 Slot: 2
public abstract void OnPlayableCreate(Playable playable) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C20 Offset: 0xD9D21 VA: 0xD9C20
// RVA: -1 Offset: -1 Slot: 3
public abstract void OnPlayableDestroy(Playable playable) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C30 Offset: 0xD9D31 VA: 0xD9C30
// RVA: -1 Offset: -1 Slot: 4
public abstract void OnBehaviourPlay(Playable playable, FrameData info) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C40 Offset: 0xD9D41 VA: 0xD9C40
// RVA: -1 Offset: -1 Slot: 5
public abstract void OnBehaviourPause(Playable playable, FrameData info) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C50 Offset: 0xD9D51 VA: 0xD9C50
// RVA: -1 Offset: -1 Slot: 6
public abstract void PrepareFrame(Playable playable, FrameData info) { }
[RequiredByNativeCodeAttribute] // RVA: 0xD9C60 Offset: 0xD9D61 VA: 0xD9C60
// RVA: -1 Offset: -1 Slot: 7
public abstract void ProcessFrame(Playable playable, FrameData info, object playerData) { }
}
| 39.710526 | 92 | 0.744201 | [
"MIT"
] | SinsofSloth/RF5-global-metadata | UnityEngine/Playables/IPlayableBehaviour.cs | 1,509 | C# |
using Autofac;
using Autofac.Extensions.DependencyInjection;
using EventBus;
using EventBus.Abstractions;
using HealthChecks.UI.Client;
using Locations.Data;
using Locations.Infrastructure.Repositories;
using Locations.Infrastructure.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
namespace Locations.API
{
using EventBus.RabbitMQ;
using Locations.API.Filters;
using Microsoft.AspNetCore.Http;
using Microsoft.OpenApi.Models;
using RabbitMQ.Client;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services
.AddCustomHealthCheck(Configuration)
.AddControllers();
ConfigureAuthService(services);
services.Configure<LocationSettings>(Configuration);
services.AddSingleton<IRabbitMQPersistentConnection>(sp =>
{
var logger = sp.GetRequiredService<ILogger<DefaultRabbitMQPersistentConnection>>();
var factory = new ConnectionFactory()
{
HostName = Configuration["EventBusConnection"]
};
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
{
factory.UserName = Configuration["EventBusUserName"];
}
if (!string.IsNullOrEmpty(Configuration["EventBusPassword"]))
{
factory.Password = Configuration["EventBusPassword"];
}
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
{
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new DefaultRabbitMQPersistentConnection(factory, logger, retryCount);
});
RegisterEventBus(services);
// Add framework services.
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
{
Title = "SkeletonOnContainers - Locations HTTP API",
Version = "v1",
Description = "The Locations Microservice HTTP API. This is a Data-Driven/CRUD microservice sample"
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
Implicit = new OpenApiOAuthFlow()
{
AuthorizationUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
TokenUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),
Scopes = new Dictionary<string, string>()
{
{ "locations", "Locations API" }
}
}
}
});
options.OperationFilter<AuthorizeCheckOperationFilter>();
});
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder
.SetIsOriginAllowed((host) => true)
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
services.AddTransient<ILocationsRepository, LocationsRepository>();
services.AddTransient<ILocationsService, LocationsService>();
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddTransient<IIdentityService, IdentityService>();
// autofac
var container = new ContainerBuilder();
container.Populate(services);
return new AutofacServiceProvider(container.Build());
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
{
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy");
app.UseRouting();
ConfigureAuth(app);
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
endpoints.MapControllers();
endpoints.MapHealthChecks("/hc", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
endpoints.MapHealthChecks("/liveness", new HealthCheckOptions
{
Predicate = r => r.Name.Contains("self")
});
});
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Locations.API V1");
c.OAuthClientId("locationsswaggerui");
c.OAuthAppName("Locations Swagger UI");
});
LocationsContextSeed.SeedAsync(app, loggerFactory)
.Wait();
}
private void ConfigureAuthService(IServiceCollection services)
{
// prevent from mapping "sub" claim to nameidentifier.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.Authority = Configuration.GetValue<string>("IdentityUrl");
options.Audience = "locations";
options.RequireHttpsMetadata = false;
});
}
private void RegisterEventBus(IServiceCollection services)
{
var subscriptionClientName = Configuration["SubscriptionClientName"];
services.AddSingleton<IEventBus, EventBusRabbitMQ>(sp =>
{
var rabbitMQPersistentConnection = sp.GetRequiredService<IRabbitMQPersistentConnection>();
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
var logger = sp.GetRequiredService<ILogger<EventBusRabbitMQ>>();
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
var retryCount = 5;
if (!string.IsNullOrEmpty(Configuration["EventBusRetryCount"]))
{
retryCount = int.Parse(Configuration["EventBusRetryCount"]);
}
return new EventBusRabbitMQ(rabbitMQPersistentConnection, logger, iLifetimeScope, eventBusSubcriptionsManager, subscriptionClientName, retryCount);
});
services.AddSingleton<IEventBusSubscriptionsManager, InMemoryEventBusSubscriptionsManager>();
}
protected virtual void ConfigureAuth(IApplicationBuilder app)
{
app.UseAuthentication();
app.UseAuthorization();
}
}
public static class CustomExtensionMethods
{
public static IServiceCollection AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
{
var hcBuilder = services.AddHealthChecks();
hcBuilder.AddCheck("self", () => HealthCheckResult.Healthy());
hcBuilder.AddMongoDb(mongodbConnectionString: configuration["ConnectionString"],
name: "locations-mongodb-check",
tags: new string[] { "mongodb" });
hcBuilder.AddRabbitMQ(
$"amqp://{configuration["EventBusConnection"]}",
name: "locations-rabbitmqbus-check",
tags: new string[] { "rabbitmqbus" });
return services;
}
}
}
| 38.322176 | 163 | 0.581068 | [
"MIT"
] | pkyurkchiev/microservices-skeleton-net-core | src/Services/Locations/Locations.API/Startup.cs | 9,161 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Booklet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Booklet")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2fee55df-938b-4b2f-b563-64a32c81e31d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.486486 | 84 | 0.743331 | [
"MIT"
] | Contasimple-Engineering/PDFsharp-samples | samples/wpf/Booklet/Properties/AssemblyInfo.cs | 1,390 | C# |
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Heist
{
// borrowed from https://dejanstojanovic.net/aspnet/2014/november/adding-extra-info-to-an-image-file/ to try to add additional properties
public enum MetaProperty
{
Title = 40091,
Comment = 40092,
Author = 40093,
Keywords = 40094,
Subject = 40095,
Copyright = 33432,
Software = 11,
DateTime = 36867
}
public static class Extensions
{
public static Image SetMetaValue(this Image sourceBitmap, MetaProperty property, string value)
{
var prop = sourceBitmap.PropertyItems[0];
int iLen = value.Length + 1;
byte[] bTxt = new Byte[iLen];
for (int i = 0; i < iLen - 1; i++)
bTxt[i] = (byte)value[i];
bTxt[iLen - 1] = 0x00;
prop.Id = (int)property;
prop.Type = 2;
prop.Value = bTxt;
prop.Len = iLen;
sourceBitmap.SetPropertyItem(prop);
return sourceBitmap;
}
public static void AddMetaProperty(this Image image, MetaProperty property, string value)
{
var prop = (PropertyItem)FormatterServices.GetUninitializedObject(typeof(PropertyItem));
prop.Id = (int)property;
prop.Type = 2;
prop.Value = System.Text.ASCIIEncoding.ASCII.GetBytes(value);
prop.Len = prop.Value.Length;
image.SetPropertyItem(prop);
}
public static string GetMetaValue(this Image sourceBitmap, MetaProperty property)
{
var propItems = sourceBitmap.PropertyItems;
var prop = propItems.FirstOrDefault(p => p.Id == (int)property);
if (prop != null)
{
return Encoding.UTF8.GetString(prop.Value);
}
else
{
return null;
}
}
}
}
| 30.731343 | 142 | 0.565809 | [
"MIT"
] | reallyjim/Heist | Heist/BitmapExtensions.cs | 2,061 | C# |
//from https://referencesource.microsoft.com/#System.Core/Microsoft/Scripting/Ast/DebugViewWriter.cs,05c213f459ccd9cb
/* ****************************************************************************
*
* Copyright (c) Microsoft Corporation.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0. A
* copy of the license can be found in the License.html file at the root of this distribution. If
* you cannot locate the Apache License, Version 2.0, please send an email to
* dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
* by the terms of the Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*
*
* ***************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
//using System.Dynamic.Utils;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Collections.ObjectModel;
#if CLR2
namespace Microsoft.Scripting.Ast {
#else
namespace System.Linq.Expressions {
#endif
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
public sealed class DebugViewWriter : ExpressionVisitor
{
[Flags]
private enum Flow
{
None,
Space,
NewLine,
Break = 0x8000 // newline if column > MaxColumn
};
private const int Tab = 4;
private const int MaxColumn = 120;
private TextWriter _out;
private int _column;
private Stack<int> _stack = new Stack<int>();
private int _delta;
private Flow _flow;
// All the unique lambda expressions in the ET, will be used for displaying all
// the lambda definitions.
private Queue<LambdaExpression> _lambdas;
// Associate every unique anonymous LambdaExpression in the tree with an integer.
// The id is used to create a name for the anonymous lambda.
//
private Dictionary<LambdaExpression, int> _lambdaIds;
// Associate every unique anonymous parameter or variable in the tree with an integer.
// The id is used to create a name for the anonymous parameter or variable.
//
private Dictionary<ParameterExpression, int> _paramIds;
// Associate every unique anonymous LabelTarget in the tree with an integer.
// The id is used to create a name for the anonymous LabelTarget.
//
private Dictionary<LabelTarget, int> _labelIds;
private DebugViewWriter(TextWriter file)
{
_out = file;
}
private int Base
{
get
{
return _stack.Count > 0 ? _stack.Peek() : 0;
}
}
private int Delta
{
get { return _delta; }
}
private int Depth
{
get { return Base + Delta; }
}
private void Indent()
{
_delta += Tab;
}
private void Dedent()
{
_delta -= Tab;
}
private void NewLine()
{
_flow = Flow.NewLine;
}
private static int GetId<T>(T e, ref Dictionary<T, int> ids)
{
if (ids == null)
{
ids = new Dictionary<T, int>();
ids.Add(e, 1);
return 1;
}
else
{
int id;
if (!ids.TryGetValue(e, out id))
{
// e is met the first time
id = ids.Count + 1;
ids.Add(e, id);
}
return id;
}
}
private int GetLambdaId(LambdaExpression le)
{
Debug.Assert(String.IsNullOrEmpty(le.Name));
return GetId(le, ref _lambdaIds);
}
private int GetParamId(ParameterExpression p)
{
Debug.Assert(String.IsNullOrEmpty(p.Name));
return GetId(p, ref _paramIds);
}
private int GetLabelTargetId(LabelTarget target)
{
Debug.Assert(String.IsNullOrEmpty(target.Name));
return GetId(target, ref _labelIds);
}
/// <summary>
/// Write out the given AST
/// </summary>
public static void WriteTo(Expression node, TextWriter writer)
{
Debug.Assert(node != null);
Debug.Assert(writer != null);
new DebugViewWriter(writer).WriteTo(node);
}
private void WriteTo(Expression node)
{
var lambda = node as LambdaExpression;
if (lambda != null)
{
WriteLambda(lambda);
}
else
{
Visit(node);
Debug.Assert(_stack.Count == 0);
}
//
// Output all lambda expression definitions.
// in the order of their appearances in the tree.
//
while (_lambdas != null && _lambdas.Count > 0)
{
WriteLine();
WriteLine();
WriteLambda(_lambdas.Dequeue());
}
}
#region The printing code
private void Out(string s)
{
Out(Flow.None, s, Flow.None);
}
private void Out(Flow before, string s)
{
Out(before, s, Flow.None);
}
private void Out(string s, Flow after)
{
Out(Flow.None, s, after);
}
private void Out(Flow before, string s, Flow after)
{
switch (GetFlow(before))
{
case Flow.None:
break;
case Flow.Space:
Write(" ");
break;
case Flow.NewLine:
WriteLine();
Write(new String(' ', Depth));
break;
}
Write(s);
_flow = after;
}
private void WriteLine()
{
_out.WriteLine();
_column = 0;
}
private void Write(string s)
{
_out.Write(s);
_column += s.Length;
}
private Flow GetFlow(Flow flow)
{
Flow last;
last = CheckBreak(_flow);
flow = CheckBreak(flow);
// Get the biggest flow that is requested None < Space < NewLine
return (Flow)System.Math.Max((int)last, (int)flow);
}
private Flow CheckBreak(Flow flow)
{
if ((flow & Flow.Break) != 0)
{
if (_column > (MaxColumn + Depth))
{
flow = Flow.NewLine;
}
else
{
flow &= ~Flow.Break;
}
}
return flow;
}
#endregion
#region The AST Output
// More proper would be to make this a virtual method on Action
private static string FormatBinder(CallSiteBinder binder)
{
ConvertBinder convert;
GetMemberBinder getMember;
SetMemberBinder setMember;
DeleteMemberBinder deleteMember;
InvokeMemberBinder call;
UnaryOperationBinder unary;
BinaryOperationBinder binary;
if ((convert = binder as ConvertBinder) != null)
{
return "Convert " + convert.Type.ToString();
}
else if ((getMember = binder as GetMemberBinder) != null)
{
return "GetMember " + getMember.Name;
}
else if ((setMember = binder as SetMemberBinder) != null)
{
return "SetMember " + setMember.Name;
}
else if ((deleteMember = binder as DeleteMemberBinder) != null)
{
return "DeleteMember " + deleteMember.Name;
}
else if (binder is GetIndexBinder)
{
return "GetIndex";
}
else if (binder is SetIndexBinder)
{
return "SetIndex";
}
else if (binder is DeleteIndexBinder)
{
return "DeleteIndex";
}
else if ((call = binder as InvokeMemberBinder) != null)
{
return "Call " + call.Name;
}
else if (binder is InvokeBinder)
{
return "Invoke";
}
else if (binder is CreateInstanceBinder)
{
return "Create";
}
else if ((unary = binder as UnaryOperationBinder) != null)
{
return "UnaryOperation " + unary.Operation;
}
else if ((binary = binder as BinaryOperationBinder) != null)
{
return "BinaryOperation " + binary.Operation;
}
else
{
return binder.ToString();
}
}
private void VisitExpressions<T>(char open, IList<T> expressions) where T : Expression
{
VisitExpressions<T>(open, ',', expressions);
}
private void VisitExpressions<T>(char open, char separator, IList<T> expressions) where T : Expression
{
VisitExpressions(open, separator, expressions, e => Visit(e));
}
private void VisitDeclarations(IList<ParameterExpression> expressions)
{
VisitExpressions('(', ',', expressions, variable =>
{
Out(variable.Type.ToString());
if (variable.IsByRef)
{
Out("&");
}
Out(" ");
VisitParameter(variable);
});
}
private void VisitExpressions<T>(char open, char separator, IList<T> expressions, Action<T> visit)
{
Out(open.ToString());
if (expressions != null)
{
Indent();
bool isFirst = true;
foreach (T e in expressions)
{
if (isFirst)
{
if (open == '{' || expressions.Count > 1)
{
NewLine();
}
isFirst = false;
}
else
{
Out(separator.ToString(), Flow.NewLine);
}
visit(e);
}
Dedent();
}
char close;
switch (open)
{
case '(': close = ')'; break;
case '{': close = '}'; break;
case '[': close = ']'; break;
case '<': close = '>'; break;
//default: throw ContractUtils.Unreachable;
default: throw new InvalidOperationException("Code supposed to be unreachable");
}
if (open == '{')
{
NewLine();
}
Out(close.ToString(), Flow.Break);
}
protected override Expression VisitDynamic(DynamicExpression node)
{
Out(".Dynamic", Flow.Space);
Out(FormatBinder(node.Binder));
VisitExpressions('(', node.Arguments);
return node;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
protected override Expression VisitBinary(BinaryExpression node)
{
if (node.NodeType == ExpressionType.ArrayIndex)
{
ParenthesizedVisit(node, node.Left);
Out("[");
Visit(node.Right);
Out("]");
}
else
{
bool parenthesizeLeft = NeedsParentheses(node, node.Left);
bool parenthesizeRight = NeedsParentheses(node, node.Right);
string op;
bool isChecked = false;
Flow beforeOp = Flow.Space;
switch (node.NodeType)
{
case ExpressionType.Assign: op = "="; break;
case ExpressionType.Equal: op = "=="; break;
case ExpressionType.NotEqual: op = "!="; break;
case ExpressionType.AndAlso: op = "&&"; beforeOp = Flow.Break | Flow.Space; break;
case ExpressionType.OrElse: op = "||"; beforeOp = Flow.Break | Flow.Space; break;
case ExpressionType.GreaterThan: op = ">"; break;
case ExpressionType.LessThan: op = "<"; break;
case ExpressionType.GreaterThanOrEqual: op = ">="; break;
case ExpressionType.LessThanOrEqual: op = "<="; break;
case ExpressionType.Add: op = "+"; break;
case ExpressionType.AddAssign: op = "+="; break;
case ExpressionType.AddAssignChecked: op = "+="; isChecked = true; break;
case ExpressionType.AddChecked: op = "+"; isChecked = true; break;
case ExpressionType.Subtract: op = "-"; break;
case ExpressionType.SubtractAssign: op = "-="; break;
case ExpressionType.SubtractAssignChecked: op = "-="; isChecked = true; break;
case ExpressionType.SubtractChecked: op = "-"; isChecked = true; break;
case ExpressionType.Divide: op = "/"; break;
case ExpressionType.DivideAssign: op = "/="; break;
case ExpressionType.Modulo: op = "%"; break;
case ExpressionType.ModuloAssign: op = "%="; break;
case ExpressionType.Multiply: op = "*"; break;
case ExpressionType.MultiplyAssign: op = "*="; break;
case ExpressionType.MultiplyAssignChecked: op = "*="; isChecked = true; break;
case ExpressionType.MultiplyChecked: op = "*"; isChecked = true; break;
case ExpressionType.LeftShift: op = "<<"; break;
case ExpressionType.LeftShiftAssign: op = "<<="; break;
case ExpressionType.RightShift: op = ">>"; break;
case ExpressionType.RightShiftAssign: op = ">>="; break;
case ExpressionType.And: op = "&"; break;
case ExpressionType.AndAssign: op = "&="; break;
case ExpressionType.Or: op = "|"; break;
case ExpressionType.OrAssign: op = "|="; break;
case ExpressionType.ExclusiveOr: op = "^"; break;
case ExpressionType.ExclusiveOrAssign: op = "^="; break;
case ExpressionType.Power: op = "**"; break;
case ExpressionType.PowerAssign: op = "**="; break;
case ExpressionType.Coalesce: op = "??"; break;
default:
throw new InvalidOperationException();
}
if (parenthesizeLeft)
{
Out("(", Flow.None);
}
Visit(node.Left);
if (parenthesizeLeft)
{
Out(Flow.None, ")", Flow.Break);
}
// prepend # to the operator to represent checked op
if (isChecked)
{
op = String.Format(
CultureInfo.CurrentCulture,
"#{0}",
op
);
}
Out(beforeOp, op, Flow.Space | Flow.Break);
if (parenthesizeRight)
{
Out("(", Flow.None);
}
Visit(node.Right);
if (parenthesizeRight)
{
Out(Flow.None, ")", Flow.Break);
}
}
return node;
}
protected override Expression VisitParameter(ParameterExpression node)
{
// Have '$' for the DebugView of ParameterExpressions
Out("$");
if (String.IsNullOrEmpty(node.Name))
{
// If no name if provided, generate a name as $var1, $var2.
// No guarantee for not having name conflicts with user provided variable names.
//
int id = GetParamId(node);
Out("var" + id);
}
else
{
Out(GetDisplayName(node.Name));
}
return node;
}
protected override Expression VisitLambda<T>(Expression<T> node)
{
Out(
String.Format(CultureInfo.CurrentCulture,
"{0} {1}<{2}>",
".Lambda",
GetLambdaName(node),
node.Type.ToString()
)
);
if (_lambdas == null)
{
_lambdas = new Queue<LambdaExpression>();
}
// N^2 performance, for keeping the order of the lambdas.
if (!_lambdas.Contains(node))
{
_lambdas.Enqueue(node);
}
return node;
}
private static bool IsSimpleExpression(Expression node)
{
var binary = node as BinaryExpression;
if (binary != null)
{
return !(binary.Left is BinaryExpression || binary.Right is BinaryExpression);
}
return false;
}
protected override Expression VisitConditional(ConditionalExpression node)
{
if (IsSimpleExpression(node.Test))
{
Out(".If (");
Visit(node.Test);
Out(") {", Flow.NewLine);
}
else
{
Out(".If (", Flow.NewLine);
Indent();
Visit(node.Test);
Dedent();
Out(Flow.NewLine, ") {", Flow.NewLine);
}
Indent();
Visit(node.IfTrue);
Dedent();
Out(Flow.NewLine, "} .Else {", Flow.NewLine);
Indent();
Visit(node.IfFalse);
Dedent();
Out(Flow.NewLine, "}");
return node;
}
protected override Expression VisitConstant(ConstantExpression node)
{
object value = node.Value;
if (value == null)
{
Out("null");
}
else if ((value is string) && node.Type == typeof(string))
{
Out(String.Format(
CultureInfo.CurrentCulture,
"\"{0}\"",
value));
}
else if ((value is char) && node.Type == typeof(char))
{
Out(String.Format(
CultureInfo.CurrentCulture,
"'{0}'",
value));
}
else if ((value is int) && node.Type == typeof(int)
|| (value is bool) && node.Type == typeof(bool))
{
Out(value.ToString());
}
else
{
string suffix = GetConstantValueSuffix(node.Type);
if (suffix != null)
{
Out(value.ToString());
Out(suffix);
}
else
{
Out(String.Format(
CultureInfo.CurrentCulture,
".Constant<{0}>({1})",
node.Type.ToString(),
value));
}
}
return node;
}
private static string GetConstantValueSuffix(Type type)
{
if (type == typeof(UInt32))
{
return "U";
}
if (type == typeof(Int64))
{
return "L";
}
if (type == typeof(UInt64))
{
return "UL";
}
if (type == typeof(Double))
{
return "D";
}
if (type == typeof(Single))
{
return "F";
}
if (type == typeof(Decimal))
{
return "M";
}
return null;
}
protected override Expression VisitRuntimeVariables(RuntimeVariablesExpression node)
{
Out(".RuntimeVariables");
VisitExpressions('(', node.Variables);
return node;
}
// Prints ".instanceField" or "declaringType.staticField"
private void OutMember(Expression node, Expression instance, MemberInfo member)
{
if (instance != null)
{
ParenthesizedVisit(node, instance);
Out("." + member.Name);
}
else
{
// For static members, include the type name
Out(member.DeclaringType.ToString() + "." + member.Name);
}
}
protected override Expression VisitMember(MemberExpression node)
{
OutMember(node, node.Expression, node.Member);
return node;
}
protected override Expression VisitInvocation(InvocationExpression node)
{
Out(".Invoke ");
ParenthesizedVisit(node, node.Expression);
VisitExpressions('(', node.Arguments);
return node;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
private static bool NeedsParentheses(Expression parent, Expression child)
{
Debug.Assert(parent != null);
if (child == null)
{
return false;
}
// Some nodes always have parentheses because of how they are
// displayed, for example: ".Unbox(obj.Foo)"
switch (parent.NodeType)
{
case ExpressionType.Increment:
case ExpressionType.Decrement:
case ExpressionType.IsTrue:
case ExpressionType.IsFalse:
case ExpressionType.Unbox:
return true;
}
int childOpPrec = GetOperatorPrecedence(child);
int parentOpPrec = GetOperatorPrecedence(parent);
if (childOpPrec == parentOpPrec)
{
// When parent op and child op has the same precedence,
// we want to be a little conservative to have more clarity.
// Parentheses are not needed if
// 1) Both ops are &&, ||, &, |, or ^, all of them are the only
// op that has the precedence.
// 2) Parent op is + or *, e.g. x + (y - z) can be simplified to
// x + y - z.
// 3) Parent op is -, / or %, and the child is the left operand.
// In this case, if left and right operand are the same, we don't
// remove parenthesis, e.g. (x + y) - (x + y)
//
switch (parent.NodeType)
{
case ExpressionType.AndAlso:
case ExpressionType.OrElse:
case ExpressionType.And:
case ExpressionType.Or:
case ExpressionType.ExclusiveOr:
// Since these ops are the only ones on their precedence,
// the child op must be the same.
Debug.Assert(child.NodeType == parent.NodeType);
// We remove the parenthesis, e.g. x && y && z
return false;
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
return false;
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
case ExpressionType.Divide:
case ExpressionType.Modulo:
BinaryExpression binary = parent as BinaryExpression;
Debug.Assert(binary != null);
// Need to have parenthesis for the right operand.
return child == binary.Right;
}
return true;
}
// Special case: negate of a constant needs parentheses, to
// disambiguate it from a negative constant.
if (child != null && child.NodeType == ExpressionType.Constant &&
(parent.NodeType == ExpressionType.Negate || parent.NodeType == ExpressionType.NegateChecked))
{
return true;
}
// If the parent op has higher precedence, need parentheses for the child.
return childOpPrec < parentOpPrec;
}
// the greater the higher
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
private static int GetOperatorPrecedence(Expression node)
{
// Roughly matches C# operator precedence, with some additional
// operators. Also things which are not binary/unary expressions,
// such as conditional and type testing, don't use this mechanism.
switch (node.NodeType)
{
// Assignment
case ExpressionType.Assign:
case ExpressionType.ExclusiveOrAssign:
case ExpressionType.AddAssign:
case ExpressionType.AddAssignChecked:
case ExpressionType.SubtractAssign:
case ExpressionType.SubtractAssignChecked:
case ExpressionType.DivideAssign:
case ExpressionType.ModuloAssign:
case ExpressionType.MultiplyAssign:
case ExpressionType.MultiplyAssignChecked:
case ExpressionType.LeftShiftAssign:
case ExpressionType.RightShiftAssign:
case ExpressionType.AndAssign:
case ExpressionType.OrAssign:
case ExpressionType.PowerAssign:
case ExpressionType.Coalesce:
return 1;
// Conditional (?:) would go here
// Conditional OR
case ExpressionType.OrElse:
return 2;
// Conditional AND
case ExpressionType.AndAlso:
return 3;
// Logical OR
case ExpressionType.Or:
return 4;
// Logical XOR
case ExpressionType.ExclusiveOr:
return 5;
// Logical AND
case ExpressionType.And:
return 6;
// Equality
case ExpressionType.Equal:
case ExpressionType.NotEqual:
return 7;
// Relational, type testing
case ExpressionType.GreaterThan:
case ExpressionType.LessThan:
case ExpressionType.GreaterThanOrEqual:
case ExpressionType.LessThanOrEqual:
case ExpressionType.TypeAs:
case ExpressionType.TypeIs:
case ExpressionType.TypeEqual:
return 8;
// Shift
case ExpressionType.LeftShift:
case ExpressionType.RightShift:
return 9;
// Additive
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
return 10;
// Multiplicative
case ExpressionType.Divide:
case ExpressionType.Modulo:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
return 11;
// Unary
case ExpressionType.Negate:
case ExpressionType.NegateChecked:
case ExpressionType.UnaryPlus:
case ExpressionType.Not:
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
case ExpressionType.PreIncrementAssign:
case ExpressionType.PreDecrementAssign:
case ExpressionType.OnesComplement:
case ExpressionType.Increment:
case ExpressionType.Decrement:
case ExpressionType.IsTrue:
case ExpressionType.IsFalse:
case ExpressionType.Unbox:
case ExpressionType.Throw:
return 12;
// Power, which is not in C#
// But VB/Python/Ruby put it here, above unary.
case ExpressionType.Power:
return 13;
// Primary, which includes all other node types:
// member access, calls, indexing, new.
case ExpressionType.PostIncrementAssign:
case ExpressionType.PostDecrementAssign:
default:
return 14;
// These aren't expressions, so never need parentheses:
// constants, variables
case ExpressionType.Constant:
case ExpressionType.Parameter:
return 15;
}
}
private void ParenthesizedVisit(Expression parent, Expression nodeToVisit)
{
if (NeedsParentheses(parent, nodeToVisit))
{
Out("(");
Visit(nodeToVisit);
Out(")");
}
else
{
Visit(nodeToVisit);
}
}
protected override Expression VisitMethodCall(MethodCallExpression node)
{
Out(".Call ");
if (node.Object != null)
{
ParenthesizedVisit(node, node.Object);
}
else if (node.Method.DeclaringType != null)
{
Out(node.Method.DeclaringType.ToString());
}
else
{
Out("<UnknownType>");
}
Out(".");
Out(node.Method.Name);
VisitExpressions('(', node.Arguments);
return node;
}
protected override Expression VisitNewArray(NewArrayExpression node)
{
if (node.NodeType == ExpressionType.NewArrayBounds)
{
// .NewArray MyType[expr1, expr2]
Out(".NewArray " + node.Type.GetElementType().ToString());
VisitExpressions('[', node.Expressions);
}
else
{
// .NewArray MyType {expr1, expr2}
Out(".NewArray " + node.Type.ToString(), Flow.Space);
VisitExpressions('{', node.Expressions);
}
return node;
}
protected override Expression VisitNew(NewExpression node)
{
Out(".New " + node.Type.ToString());
VisitExpressions('(', node.Arguments);
return node;
}
protected override ElementInit VisitElementInit(ElementInit node)
{
if (node.Arguments.Count == 1)
{
Visit(node.Arguments[0]);
}
else
{
VisitExpressions('{', node.Arguments);
}
return node;
}
protected override Expression VisitListInit(ListInitExpression node)
{
Visit(node.NewExpression);
VisitExpressions('{', ',', node.Initializers, e => VisitElementInit(e));
return node;
}
protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
Out(assignment.Member.Name);
Out(Flow.Space, "=", Flow.Space);
Visit(assignment.Expression);
return assignment;
}
protected override MemberListBinding VisitMemberListBinding(MemberListBinding binding)
{
Out(binding.Member.Name);
Out(Flow.Space, "=", Flow.Space);
VisitExpressions('{', ',', binding.Initializers, e => VisitElementInit(e));
return binding;
}
protected override MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
{
Out(binding.Member.Name);
Out(Flow.Space, "=", Flow.Space);
VisitExpressions('{', ',', binding.Bindings, e => VisitMemberBinding(e));
return binding;
}
protected override Expression VisitMemberInit(MemberInitExpression node)
{
Visit(node.NewExpression);
VisitExpressions('{', ',', node.Bindings, e => VisitMemberBinding(e));
return node;
}
protected override Expression VisitTypeBinary(TypeBinaryExpression node)
{
ParenthesizedVisit(node, node.Expression);
switch (node.NodeType)
{
case ExpressionType.TypeIs:
Out(Flow.Space, ".Is", Flow.Space);
break;
case ExpressionType.TypeEqual:
Out(Flow.Space, ".TypeEqual", Flow.Space);
break;
}
Out(node.TypeOperand.ToString());
return node;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
protected override Expression VisitUnary(UnaryExpression node)
{
switch (node.NodeType)
{
case ExpressionType.Convert:
Out("(" + node.Type.ToString() + ")");
break;
case ExpressionType.ConvertChecked:
Out("#(" + node.Type.ToString() + ")");
break;
case ExpressionType.TypeAs:
break;
case ExpressionType.Not:
Out(node.Type == typeof(bool) ? "!" : "~");
break;
case ExpressionType.OnesComplement:
Out("~");
break;
case ExpressionType.Negate:
Out("-");
break;
case ExpressionType.NegateChecked:
Out("#-");
break;
case ExpressionType.UnaryPlus:
Out("+");
break;
case ExpressionType.ArrayLength:
break;
case ExpressionType.Quote:
Out("'");
break;
case ExpressionType.Throw:
if (node.Operand == null)
{
Out(".Rethrow");
}
else
{
Out(".Throw", Flow.Space);
}
break;
case ExpressionType.IsFalse:
Out(".IsFalse");
break;
case ExpressionType.IsTrue:
Out(".IsTrue");
break;
case ExpressionType.Decrement:
Out(".Decrement");
break;
case ExpressionType.Increment:
Out(".Increment");
break;
case ExpressionType.PreDecrementAssign:
Out("--");
break;
case ExpressionType.PreIncrementAssign:
Out("++");
break;
case ExpressionType.Unbox:
Out(".Unbox");
break;
}
ParenthesizedVisit(node, node.Operand);
switch (node.NodeType)
{
case ExpressionType.TypeAs:
Out(Flow.Space, ".As", Flow.Space | Flow.Break);
Out(node.Type.ToString());
break;
case ExpressionType.ArrayLength:
Out(".Length");
break;
case ExpressionType.PostDecrementAssign:
Out("--");
break;
case ExpressionType.PostIncrementAssign:
Out("++");
break;
}
return node;
}
protected override Expression VisitBlock(BlockExpression node)
{
Out(".Block");
// Display <type> if the type of the BlockExpression is different from the
// last expression's type in the block.
//if (node.Type != node.GetExpression(node.ExpressionCount - 1).Type)
//{
Out(String.Format(CultureInfo.CurrentCulture, "<{0}>", node.Type.ToString()));
//}
VisitDeclarations(node.Variables);
Out(" ");
// Use ; to separate expressions in the block
VisitExpressions('{', ';', node.Expressions);
return node;
}
protected override Expression VisitDefault(DefaultExpression node)
{
Out(".Default(" + node.Type.ToString() + ")");
return node;
}
protected override Expression VisitLabel(LabelExpression node)
{
Out(".Label", Flow.NewLine);
Indent();
Visit(node.DefaultValue);
Dedent();
NewLine();
DumpLabel(node.Target);
return node;
}
protected override Expression VisitGoto(GotoExpression node)
{
Out("." + node.Kind.ToString(), Flow.Space);
Out(GetLabelTargetName(node.Target), Flow.Space);
Out("{", Flow.Space);
Visit(node.Value);
Out(Flow.Space, "}");
return node;
}
protected override Expression VisitLoop(LoopExpression node)
{
Out(".Loop", Flow.Space);
if (node.ContinueLabel != null)
{
DumpLabel(node.ContinueLabel);
}
Out(" {", Flow.NewLine);
Indent();
Visit(node.Body);
Dedent();
Out(Flow.NewLine, "}");
if (node.BreakLabel != null)
{
Out("", Flow.NewLine);
DumpLabel(node.BreakLabel);
}
return node;
}
protected override SwitchCase VisitSwitchCase(SwitchCase node)
{
foreach (var test in node.TestValues)
{
Out(".Case (");
Visit(test);
Out("):", Flow.NewLine);
}
Indent(); Indent();
Visit(node.Body);
Dedent(); Dedent();
NewLine();
return node;
}
protected override Expression VisitSwitch(SwitchExpression node)
{
Out(".Switch ");
Out("(");
Visit(node.SwitchValue);
Out(") {", Flow.NewLine);
Visit(node.Cases, VisitSwitchCase);
if (node.DefaultBody != null)
{
Out(".Default:", Flow.NewLine);
Indent(); Indent();
Visit(node.DefaultBody);
Dedent(); Dedent();
NewLine();
}
Out("}");
return node;
}
protected override CatchBlock VisitCatchBlock(CatchBlock node)
{
Out(Flow.NewLine, "} .Catch (" + node.Test.ToString());
if (node.Variable != null)
{
Out(Flow.Space, "");
VisitParameter(node.Variable);
}
if (node.Filter != null)
{
Out(") .If (", Flow.Break);
Visit(node.Filter);
}
Out(") {", Flow.NewLine);
Indent();
Visit(node.Body);
Dedent();
return node;
}
protected override Expression VisitTry(TryExpression node)
{
Out(".Try {", Flow.NewLine);
Indent();
Visit(node.Body);
Dedent();
Visit(node.Handlers, VisitCatchBlock);
if (node.Finally != null)
{
Out(Flow.NewLine, "} .Finally {", Flow.NewLine);
Indent();
Visit(node.Finally);
Dedent();
}
else if (node.Fault != null)
{
Out(Flow.NewLine, "} .Fault {", Flow.NewLine);
Indent();
Visit(node.Fault);
Dedent();
}
Out(Flow.NewLine, "}");
return node;
}
protected override Expression VisitIndex(IndexExpression node)
{
if (node.Indexer != null)
{
OutMember(node, node.Object, node.Indexer);
}
else
{
ParenthesizedVisit(node, node.Object);
}
VisitExpressions('[', node.Arguments);
return node;
}
protected override Expression VisitExtension(Expression node)
{
Out(String.Format(CultureInfo.CurrentCulture, ".Extension<{0}>", node.GetType().ToString()));
if (node.CanReduce)
{
Out(Flow.Space, "{", Flow.NewLine);
Indent();
Visit(node.Reduce());
Dedent();
Out(Flow.NewLine, "}");
}
return node;
}
protected override Expression VisitDebugInfo(DebugInfoExpression node)
{
Out(String.Format(
CultureInfo.CurrentCulture,
".DebugInfo({0}: {1}, {2} - {3}, {4})",
node.Document.FileName,
node.StartLine,
node.StartColumn,
node.EndLine,
node.EndColumn)
);
return node;
}
private void DumpLabel(LabelTarget target)
{
Out(String.Format(CultureInfo.CurrentCulture, ".LabelTarget {0}:", GetLabelTargetName(target)));
}
private string GetLabelTargetName(LabelTarget target)
{
if (string.IsNullOrEmpty(target.Name))
{
// Create the label target name as #Label1, #Label2, etc.
return String.Format(CultureInfo.CurrentCulture, "#Label{0}", GetLabelTargetId(target));
}
else
{
return GetDisplayName(target.Name);
}
}
private void WriteLambda(LambdaExpression lambda)
{
Out(
String.Format(
CultureInfo.CurrentCulture,
".Lambda {0}<{1}>",
GetLambdaName(lambda),
lambda.Type.ToString())
);
VisitDeclarations(lambda.Parameters);
Out(Flow.Space, "{", Flow.NewLine);
Indent();
Visit(lambda.Body);
Dedent();
Out(Flow.NewLine, "}");
Debug.Assert(_stack.Count == 0);
}
private string GetLambdaName(LambdaExpression lambda)
{
if (String.IsNullOrEmpty(lambda.Name))
{
return "#Lambda" + GetLambdaId(lambda);
}
return GetDisplayName(lambda.Name);
}
/// <summary>
/// Return true if the input string contains any whitespace character.
/// Otherwise false.
/// </summary>
private static bool ContainsWhiteSpace(string name)
{
foreach (char c in name)
{
if (Char.IsWhiteSpace(c))
{
return true;
}
}
return false;
}
private static string QuoteName(string name)
{
return String.Format(CultureInfo.CurrentCulture, "'{0}'", name);
}
private static string GetDisplayName(string name)
{
if (ContainsWhiteSpace(name))
{
// if name has whitespaces in it, quote it
return QuoteName(name);
}
else
{
return name;
}
}
#endregion
}
}
| 24.982079 | 120 | 0.620057 | [
"MIT"
] | argentsea/shared | src/DebugViewWriter.cs | 34,852 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Android.App;
using Android.Content;
using Android.Text;
using Android.Views;
using Android.Widget;
using Microsoft.Maui.Controls.Internals;
using AppCompatActivity = AndroidX.AppCompat.App.AppCompatActivity;
using AppCompatAlertDialog = AndroidX.AppCompat.App.AlertDialog;
using AWindow = Android.Views.Window;
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android
{
internal static class PopupManager
{
static readonly List<PopupRequestHelper> s_subscriptions = new List<PopupRequestHelper>();
internal static void Subscribe(Activity context)
{
if (s_subscriptions.Any(s => s.Activity == context))
{
return;
}
s_subscriptions.Add(new PopupRequestHelper(context));
}
internal static void Unsubscribe(Activity context)
{
var toRemove = s_subscriptions.Where(s => s.Activity == context).ToList();
foreach (PopupRequestHelper popupRequestHelper in toRemove)
{
popupRequestHelper.Dispose();
s_subscriptions.Remove(popupRequestHelper);
}
}
internal static void ResetBusyCount(Activity context)
{
s_subscriptions.FirstOrDefault(s => s.Activity == context)?.ResetBusyCount();
}
internal sealed class PopupRequestHelper : IDisposable
{
int _busyCount;
bool? _supportsProgress;
internal PopupRequestHelper(Activity context)
{
Activity = context;
MessagingCenter.Subscribe<Page, bool>(Activity, Page.BusySetSignalName, OnPageBusy);
MessagingCenter.Subscribe<Page, AlertArguments>(Activity, Page.AlertSignalName, OnAlertRequested);
MessagingCenter.Subscribe<Page, PromptArguments>(Activity, Page.PromptSignalName, OnPromptRequested);
MessagingCenter.Subscribe<Page, ActionSheetArguments>(Activity, Page.ActionSheetSignalName, OnActionSheetRequested);
}
public Activity Activity { get; }
public void Dispose()
{
MessagingCenter.Unsubscribe<Page, bool>(Activity, Page.BusySetSignalName);
MessagingCenter.Unsubscribe<Page, AlertArguments>(Activity, Page.AlertSignalName);
MessagingCenter.Unsubscribe<Page, PromptArguments>(Activity, Page.PromptSignalName);
MessagingCenter.Unsubscribe<Page, ActionSheetArguments>(Activity, Page.ActionSheetSignalName);
}
public void ResetBusyCount()
{
_busyCount = 0;
}
void OnPageBusy(Page sender, bool enabled)
{
// Verify that the page making the request is part of this activity
if (!PageIsInThisContext(sender))
{
return;
}
_busyCount = Math.Max(0, enabled ? _busyCount + 1 : _busyCount - 1);
UpdateProgressBarVisibility(_busyCount > 0);
}
void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
{
// Verify that the page making the request is part of this activity
if (!PageIsInThisContext(sender))
{
return;
}
var builder = new DialogBuilder(Activity);
builder.SetTitle(arguments.Title);
string[] items = arguments.Buttons.ToArray();
builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));
if (arguments.Cancel != null)
builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
if (arguments.Destruction != null)
builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
var dialog = builder.Create();
builder.Dispose();
//to match current functionality of renderer we set cancelable on outside
//and return null
if (arguments.FlowDirection == FlowDirection.MatchParent && sender is IVisualElementController ve)
dialog.Window.DecorView.UpdateFlowDirection(ve);
else if (arguments.FlowDirection == FlowDirection.LeftToRight)
dialog.Window.DecorView.LayoutDirection = LayoutDirection.Ltr;
else if (arguments.FlowDirection == FlowDirection.RightToLeft)
dialog.Window.DecorView.LayoutDirection = LayoutDirection.Rtl;
dialog.SetCanceledOnTouchOutside(true);
dialog.SetCancelEvent((o, e) => arguments.SetResult(null));
dialog.Show();
dialog.GetListView().TextDirection = GetTextDirection(sender, arguments.FlowDirection);
LayoutDirection layoutDirection = GetLayoutDirection(sender, arguments.FlowDirection);
if (arguments.Cancel != null)
((dialog.GetButton((int)DialogButtonType.Positive).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection;
if (arguments.Destruction != null)
((dialog.GetButton((int)DialogButtonType.Negative).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection;
}
void OnAlertRequested(Page sender, AlertArguments arguments)
{
// Verify that the page making the request is part of this activity
if (!PageIsInThisContext(sender))
{
return;
}
int messageID = 16908299;
var alert = new DialogBuilder(Activity).Create();
if (arguments.FlowDirection == FlowDirection.MatchParent && sender is IVisualElementController ve)
alert.Window.DecorView.UpdateFlowDirection(ve);
else if (arguments.FlowDirection == FlowDirection.LeftToRight)
alert.Window.DecorView.LayoutDirection = LayoutDirection.Ltr;
else if (arguments.FlowDirection == FlowDirection.RightToLeft)
alert.Window.DecorView.LayoutDirection = LayoutDirection.Rtl;
alert.SetTitle(arguments.Title);
alert.SetMessage(arguments.Message);
if (arguments.Accept != null)
alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
alert.SetCancelEvent((o, args) => { arguments.SetResult(false); });
alert.Show();
TextView textView = (TextView)alert.findViewByID(messageID);
textView.TextDirection = GetTextDirection(sender, arguments.FlowDirection);
((alert.GetButton((int)DialogButtonType.Negative).Parent) as global::Android.Views.View).LayoutDirection = GetLayoutDirection(sender, arguments.FlowDirection);
}
private LayoutDirection GetLayoutDirection(Page sender, FlowDirection flowDirection)
{
if (flowDirection == FlowDirection.LeftToRight)
return LayoutDirection.Ltr;
else if (flowDirection == FlowDirection.RightToLeft)
return LayoutDirection.Rtl;
else
{
if ((sender as IVisualElementController).EffectiveFlowDirection.IsRightToLeft())
return LayoutDirection.Rtl;
else if ((sender as IVisualElementController).EffectiveFlowDirection.IsLeftToRight())
return LayoutDirection.Ltr;
}
return LayoutDirection.Ltr;
}
private TextDirection GetTextDirection(Page sender, FlowDirection flowDirection)
{
if (flowDirection == FlowDirection.LeftToRight)
return TextDirection.Ltr;
else if (flowDirection == FlowDirection.RightToLeft)
return TextDirection.Rtl;
else
{
if ((sender as IVisualElementController).EffectiveFlowDirection.IsRightToLeft())
return TextDirection.Rtl;
else if ((sender as IVisualElementController).EffectiveFlowDirection.IsLeftToRight())
return TextDirection.Ltr;
}
return TextDirection.Ltr;
}
void OnPromptRequested(Page sender, PromptArguments arguments)
{
// Verify that the page making the request is part of this activity
if (!PageIsInThisContext(sender))
{
return;
}
var alertDialog = new DialogBuilder(Activity).Create();
alertDialog.SetTitle(arguments.Title);
alertDialog.SetMessage(arguments.Message);
var frameLayout = new FrameLayout(Activity);
var editText = new EditText(Activity) { Hint = arguments.Placeholder, Text = arguments.InitialValue };
var layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
{
LeftMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density),
RightMargin = (int)(22 * Activity.Resources.DisplayMetrics.Density)
};
editText.LayoutParameters = layoutParams;
editText.InputType = arguments.Keyboard.ToInputType();
if (arguments.Keyboard == Keyboard.Numeric)
editText.KeyListener = LocalizedDigitsKeyListener.Create(editText.InputType);
if (arguments.MaxLength > -1)
editText.SetFilters(new IInputFilter[] { new InputFilterLengthFilter(arguments.MaxLength) });
frameLayout.AddView(editText);
alertDialog.SetView(frameLayout);
alertDialog.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(editText.Text));
alertDialog.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(null));
alertDialog.SetCancelEvent((o, args) => { arguments.SetResult(null); });
alertDialog.Window.SetSoftInputMode(SoftInput.StateVisible);
alertDialog.Show();
editText.RequestFocus();
}
void UpdateProgressBarVisibility(bool isBusy)
{
if (!SupportsProgress)
return;
#pragma warning disable 612, 618
Activity.SetProgressBarIndeterminate(true);
Activity.SetProgressBarIndeterminateVisibility(isBusy);
#pragma warning restore 612, 618
}
internal bool SupportsProgress
{
get
{
if (_supportsProgress.HasValue)
{
return _supportsProgress.Value;
}
int progressCircularId = Activity.Resources.GetIdentifier("progress_circular", "id", "android");
if (progressCircularId > 0)
_supportsProgress = Activity.FindViewById(progressCircularId) != null;
else
_supportsProgress = true;
return _supportsProgress.Value;
}
}
bool PageIsInThisContext(Page page)
{
var renderer = Platform.GetRenderer(page);
if (renderer?.View?.Context == null)
{
return false;
}
return renderer.View.Context.Equals(Activity);
}
// This is a proxy dialog builder class to support both pre-appcompat and appcompat dialogs for Alert,
// ActionSheet, Prompt, etc.
internal sealed class DialogBuilder
{
AppCompatAlertDialog.Builder _appcompatBuilder;
AlertDialog.Builder _legacyBuilder;
bool _useAppCompat;
public DialogBuilder(Activity activity)
{
if (activity is AppCompatActivity)
{
_appcompatBuilder = new AppCompatAlertDialog.Builder(activity);
_useAppCompat = true;
}
else
{
_legacyBuilder = new AlertDialog.Builder(activity);
}
}
public void SetTitle(string title)
{
if (_useAppCompat)
{
_appcompatBuilder.SetTitle(title);
}
else
{
_legacyBuilder.SetTitle(title);
}
}
public void SetItems(string[] items, EventHandler<DialogClickEventArgs> handler)
{
if (_useAppCompat)
{
_appcompatBuilder.SetItems(items, handler);
}
else
{
_legacyBuilder.SetItems(items, handler);
}
}
public void SetPositiveButton(string text, EventHandler<DialogClickEventArgs> handler)
{
if (_useAppCompat)
{
_appcompatBuilder.SetPositiveButton(text, handler);
}
else
{
_legacyBuilder.SetPositiveButton(text, handler);
}
}
public void SetNegativeButton(string text, EventHandler<DialogClickEventArgs> handler)
{
if (_useAppCompat)
{
_appcompatBuilder.SetNegativeButton(text, handler);
}
else
{
_legacyBuilder.SetNegativeButton(text, handler);
}
}
public FlexibleAlertDialog Create()
{
if (_useAppCompat)
{
return new FlexibleAlertDialog(_appcompatBuilder.Create());
}
return new FlexibleAlertDialog(_legacyBuilder.Create());
}
public void Dispose()
{
if (_useAppCompat)
{
_appcompatBuilder.Dispose();
}
else
{
_legacyBuilder.Dispose();
}
}
}
internal sealed class FlexibleAlertDialog
{
readonly AppCompatAlertDialog _appcompatAlertDialog;
readonly AlertDialog _legacyAlertDialog;
bool _useAppCompat;
public FlexibleAlertDialog(AlertDialog alertDialog)
{
_legacyAlertDialog = alertDialog;
}
public FlexibleAlertDialog(AppCompatAlertDialog alertDialog)
{
_appcompatAlertDialog = alertDialog;
_useAppCompat = true;
}
public void SetTitle(string title)
{
if (_useAppCompat)
{
_appcompatAlertDialog.SetTitle(title);
}
else
{
_legacyAlertDialog.SetTitle(title);
}
}
public void SetMessage(string message)
{
if (_useAppCompat)
{
_appcompatAlertDialog.SetMessage(message);
}
else
{
_legacyAlertDialog.SetMessage(message);
}
}
public void SetButton(int whichButton, string text, EventHandler<DialogClickEventArgs> handler)
{
if (_useAppCompat)
{
_appcompatAlertDialog.SetButton(whichButton, text, handler);
}
else
{
_legacyAlertDialog.SetButton(whichButton, text, handler);
}
}
public global::Android.Widget.Button GetButton(int whichButton)
{
if (_useAppCompat)
{
return _appcompatAlertDialog.GetButton(whichButton);
}
else
{
return _legacyAlertDialog.GetButton(whichButton);
}
}
public global::Android.Views.View GetListView()
{
if (_useAppCompat)
{
return _appcompatAlertDialog.ListView;
}
else
{
return _legacyAlertDialog.ListView;
}
}
public void SetCancelEvent(EventHandler cancel)
{
if (_useAppCompat)
{
_appcompatAlertDialog.CancelEvent += cancel;
}
else
{
_legacyAlertDialog.CancelEvent += cancel;
}
}
public void SetCanceledOnTouchOutside(bool canceledOnTouchOutSide)
{
if (_useAppCompat)
{
_appcompatAlertDialog.SetCanceledOnTouchOutside(canceledOnTouchOutSide);
}
else
{
_legacyAlertDialog.SetCanceledOnTouchOutside(canceledOnTouchOutSide);
}
}
public void SetView(global::Android.Views.View view)
{
if (_useAppCompat)
{
_appcompatAlertDialog.SetView(view);
}
else
{
_legacyAlertDialog.SetView(view);
}
}
public global::Android.Views.View findViewByID(int id)
{
if (_useAppCompat)
{
return _appcompatAlertDialog.FindViewById(id);
}
else
{
return _legacyAlertDialog.FindViewById(id);
}
}
public AWindow Window => _useAppCompat ? _appcompatAlertDialog.Window : _legacyAlertDialog.Window;
public void Show()
{
if (_useAppCompat)
{
_appcompatAlertDialog.Show();
}
else
{
_legacyAlertDialog.Show();
}
}
}
}
}
} | 29.059172 | 163 | 0.703591 | [
"MIT"
] | 3DSX/maui | src/Compatibility/Core/src/Android/PopupManager.cs | 14,733 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Veterinaria.BL;
namespace Veterinaria.Win
{
public partial class Form2 : Form
{
ReportedeVentasPorProductoBL _reporteVentasPorProductoBL;
public Form2()
{
InitializeComponent();
_reporteVentasPorProductoBL = new ReportedeVentasPorProductoBL();
RefrescarDatos();
}
private void button1_Click(object sender, EventArgs e)
{
RefrescarDatos();
}
private void RefrescarDatos()
{
var listadeVentasPorProducto = _reporteVentasPorProductoBL.ObtenerVentasPorProducto();
listadeVentasPorProductoBindingSource.DataSource = listadeVentasPorProducto;
listadeVentasPorProductoBindingSource.ResetBindings(false);
}
}
}
| 26.74359 | 99 | 0.661553 | [
"MIT"
] | AlbaHG/Veterinaria | Veterinaria.Win/Form2.cs | 1,045 | C# |
using System;
using System.Reactive.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
using MahApps.Metro.Controls;
using ReactiveUI;
using SimpleMusicPlayer.Core;
using SimpleMusicPlayer.ViewModels;
namespace SimpleMusicPlayer.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow, IViewFor<MainViewModel>
{
public MainWindow(MainViewModel mainViewModel)
{
this.ViewModel = mainViewModel;
this.InitializeComponent();
//this.Title = string.Format("{0} {1}", this.Title, Assembly.GetExecutingAssembly().GetName().Version);
this.Title = string.Format("{0}", this.Title);
this.WhenAnyValue(x => x.ViewModel).BindTo(this, x => x.DataContext);
this.Events().SourceInitialized.Subscribe(e => this.FitIntoScreen());
// load playlist and command line stuff
this.Events().Loaded.Throttle(TimeSpan.FromMilliseconds(500), RxApp.MainThreadScheduler).InvokeCommand(this.ViewModel.PlayListsViewModel.StartUpCommand);
this.WhenActivated(d => this.WhenAnyValue(x => x.ViewModel)
.Subscribe(vm => {
var previewKeyDown = this.Events().PreviewKeyDown;
// handle main view keys
previewKeyDown.Subscribe(vm.HandlePreviewKeyDown);
// handle playlist keys
previewKeyDown.Where(x => x.Key == Key.Enter).InvokeCommand(vm.PlayListsViewModel.PlayCommand);
previewKeyDown.Where(x => x.Key == Key.Delete).InvokeCommand(vm.PlayListsViewModel.DeleteCommand);
var window = Window.GetWindow(this);
if (window != null)
{
vm.PlayListsViewModel.CalcPlayListItemTemplateByActualWidth(window.ActualWidth, window.ActualHeight);
window.Events().SizeChanged.Throttle(TimeSpan.FromMilliseconds(15), RxApp.MainThreadScheduler).Subscribe(e => vm.PlayListsViewModel.CalcPlayListItemTemplateByActualWidth(e.NewSize.Width, e.NewSize.Height));
}
this.Events().Closed.InvokeCommand(vm.PlayListsViewModel.FileSearchWorker.StopSearchCmd);
this.Events().Closed.Subscribe(x => vm.ShutDown());
}));
}
public override IWindowPlacementSettings GetWindowPlacementSettings()
{
return this.ViewModel.CustomWindowPlacementSettings;
}
public MainViewModel ViewModel
{
get { return (MainViewModel)GetValue(ViewModelProperty); }
set { SetValue(ViewModelProperty, value); }
}
public static readonly DependencyProperty ViewModelProperty =
DependencyProperty.Register("ViewModel", typeof(MainViewModel), typeof(MainWindow), new PropertyMetadata(null));
object IViewFor.ViewModel
{
get { return ViewModel; }
set { ViewModel = (MainViewModel)value; }
}
}
} | 46.88 | 254 | 0.5657 | [
"Unlicense",
"MIT"
] | kaushik1605/sample_DotNet | SimpleMusicPlayer/SimpleMusicPlayer/Views/MainWindow.xaml.cs | 3,518 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.CSharp.Emit;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.Symbols
{
internal sealed partial class AnonymousTypeManager
{
/// <summary>
/// Represents a base implementation for anonymous type synthesized methods.
/// </summary>
private abstract class SynthesizedMethodBase : SynthesizedInstanceMethodSymbol
{
private readonly NamedTypeSymbol _containingType;
private readonly string _name;
public SynthesizedMethodBase(NamedTypeSymbol containingType, string name)
{
_containingType = containingType;
_name = name;
}
internal sealed override bool GenerateDebugInfo
{
get { return false; }
}
public sealed override int Arity
{
get { return 0; }
}
public sealed override Symbol ContainingSymbol
{
get { return _containingType; }
}
public override NamedTypeSymbol ContainingType
{
get
{
return _containingType;
}
}
public override ImmutableArray<Location> Locations
{
get { return ImmutableArray<Location>.Empty; }
}
public sealed override Accessibility DeclaredAccessibility
{
get { return Accessibility.Public; }
}
public sealed override bool IsStatic
{
get { return false; }
}
public sealed override bool IsVirtual
{
get { return false; }
}
public sealed override bool IsAsync
{
get { return false; }
}
internal sealed override System.Reflection.MethodImplAttributes ImplementationAttributes
{
get { return default(System.Reflection.MethodImplAttributes); }
}
internal sealed override Cci.CallingConvention CallingConvention
{
get { return Cci.CallingConvention.HasThis; }
}
public sealed override bool IsExtensionMethod
{
get { return false; }
}
public sealed override bool HidesBaseMethodsByName
{
get { return false; }
}
public sealed override bool IsVararg
{
get { return false; }
}
public sealed override FlowAnalysisAnnotations ReturnTypeFlowAnalysisAnnotations => FlowAnalysisAnnotations.None;
public sealed override ImmutableHashSet<string> ReturnNotNullIfParameterNotNull => ImmutableHashSet<string>.Empty;
public sealed override ImmutableArray<TypeWithAnnotations> TypeArgumentsWithAnnotations
{
get { return ImmutableArray<TypeWithAnnotations>.Empty; }
}
public sealed override ImmutableArray<TypeParameterSymbol> TypeParameters
{
get { return ImmutableArray<TypeParameterSymbol>.Empty; }
}
internal sealed override bool IsExplicitInterfaceImplementation
{
get { return false; }
}
public sealed override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
{
get { return ImmutableArray<MethodSymbol>.Empty; }
}
// methods on classes are never 'readonly'
internal sealed override bool IsDeclaredReadOnly => false;
public sealed override ImmutableArray<CustomModifier> RefCustomModifiers
{
get { return ImmutableArray<CustomModifier>.Empty; }
}
public override Symbol AssociatedSymbol
{
get { return null; }
}
public sealed override bool IsAbstract
{
get { return false; }
}
public sealed override bool IsSealed
{
get { return false; }
}
public sealed override bool IsExtern
{
get { return false; }
}
public sealed override string Name
{
get { return _name; }
}
internal sealed override bool IsMetadataNewSlot(bool ignoreInterfaceImplementationChanges = false)
{
return false;
}
internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<SynthesizedAttributeData> attributes)
{
base.AddSynthesizedAttributes(moduleBuilder, ref attributes);
AddSynthesizedAttribute(ref attributes, Manager.Compilation.TrySynthesizeAttribute(
WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor));
}
protected AnonymousTypeManager Manager
{
get
{
AnonymousTypeTemplateSymbol template = _containingType as AnonymousTypeTemplateSymbol;
return ((object)template != null) ? template.Manager : ((AnonymousTypePublicSymbol)_containingType).Manager;
}
}
internal sealed override bool RequiresSecurityObject
{
get { return false; }
}
public sealed override DllImportData GetDllImportData()
{
return null;
}
internal sealed override MarshalPseudoCustomAttributeData ReturnValueMarshallingInformation
{
get { return null; }
}
internal sealed override bool HasDeclarativeSecurity
{
get { return false; }
}
internal sealed override IEnumerable<Cci.SecurityAttribute> GetSecurityInformation()
{
throw ExceptionUtilities.Unreachable;
}
internal sealed override ImmutableArray<string> GetAppliedConditionalSymbols()
{
return ImmutableArray<string>.Empty;
}
internal override bool SynthesizesLoweredBoundBody
{
get
{
return true;
}
}
protected SyntheticBoundNodeFactory CreateBoundNodeFactory(TypeCompilationState compilationState, DiagnosticBag diagnostics)
{
var F = new SyntheticBoundNodeFactory(this, this.GetNonNullSyntaxNode(), compilationState, diagnostics);
F.CurrentFunction = this;
return F;
}
internal sealed override int CalculateLocalSyntaxOffset(int localPosition, SyntaxTree localTree)
{
throw ExceptionUtilities.Unreachable;
}
}
}
}
| 32.311688 | 161 | 0.561227 | [
"Apache-2.0"
] | 20chan/roslyn | src/Compilers/CSharp/Portable/Symbols/AnonymousTypes/SynthesizedSymbols/AnonymousType.SynthesizedMethodBase.cs | 7,466 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.