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
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using LinqToDB.Configuration; using LinqToDB.Data; using LinqToDB.DataProvider; #if NETCORE using System.Data.Common; #endif namespace LinqToDB.LINQPad { internal class ProviderHelper { static readonly Dictionary<string, DynamicProviderRecord> _dynamicProviders = new (); public static DynamicProviderRecord[] DynamicProviders => _dynamicProviders.Values.ToArray(); static readonly Dictionary<string, LoadProviderInfo> LoadedProviders = new (); static void AddDataProvider(DynamicProviderRecord providerInfo) { if (providerInfo == null) throw new ArgumentNullException(nameof(providerInfo)); _dynamicProviders.Add(providerInfo.ProviderName, providerInfo); } static ProviderHelper() { InitializeDataProviders(); } //static class DB2iSeriesProviderName //{ // public const string DB2 = "DB2.iSeries"; //} static void InitializeDataProviders() { AddDataProvider(new DynamicProviderRecord(ProviderName.Access , "Microsoft Access (OleDb)" , "System.Data.OleDb.OleDbConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.AccessOdbc , "Microsoft Access (ODBC)" , "System.Data.Odbc.OdbcConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.Firebird , "Firebird" , "FirebirdSql.Data.FirebirdClient.FbConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.MySqlConnector, "MySql" , "MySql.Data.MySqlClient.MySqlConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.PostgreSQL , "PostgreSQL" , "Npgsql.NpgsqlConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.SybaseManaged , "SAP/Sybase ASE" , "AdoNetCore.AseClient.AseConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.SQLiteClassic , "SQLite" , "System.Data.SQLite.SQLiteConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.SqlCe , "Microsoft SQL Server Compact" , "System.Data.SqlServerCe.SqlCeConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.DB2LUW , "DB2 for Linux, UNIX and Windows", "IBM.Data.DB2.DB2Connection")); AddDataProvider(new DynamicProviderRecord(ProviderName.DB2zOS , "DB2 for z/OS" , "IBM.Data.DB2.DB2Connection")); AddDataProvider(new DynamicProviderRecord(ProviderName.InformixDB2 , "Informix (IDS)" , "IBM.Data.DB2.DB2Connection")); AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaNative , "SAP HANA (Native)" , "Sap.Data.Hana.HanaConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.SapHanaOdbc , "SAP HANA (ODBC)" , "System.Data.Odbc.OdbcConnection")); AddDataProvider(new DynamicProviderRecord(ProviderName.OracleManaged , "Oracle (Managed)" , "Oracle.ManagedDataAccess.Client.OracleConnection")); // we use System.Data.SqlClient to be able to use Microsoft.SqlServer.Types AddDataProvider(new DynamicProviderRecord(ProviderName.SqlServer , "Microsoft SQL Server" , "System.Data.SqlClient.SqlConnection")); //AddDataProvider( // new DynamicProviderRecord( // ProviderName.SqlServer, // "Microsoft SQL Server", // "System.Data.SqlClient.SqlConnection") // { // AdditionalNamespaces = new[] { "Microsoft.SqlServer.Types" }, // ProviderLibraries = "Microsoft.SqlServer.Types.dll" // }); //AddDataProvider(new DynamicProviderRecord(DB2iSeriesProviderName.DB2, "DB2 iSeries (Requires iAccess 7.1 .NET Provider)", "IBM.Data.DB2.iSeries.iDB2Connection") //{ // InitializationClassName = "LinqToDB.DataProvider.DB2iSeries.DB2iSeriesTools, LinqToDB.DataProvider.DB2iSeries", // ProviderLibraries = "LinqToDB.DataProvider.DB2iSeries.dll;IBM.Data.DB2.iSeries.dll" //}); } public class DynamicProviderRecord { public string ProviderName { get; } public string Description { get; } public string ConnectionTypeName { get; } public IReadOnlyCollection<string> Libraries { get; } public string? InitializationClassName { get; set; } public NamedValue[]? ProviderNamedValues { get; set; } public string[]? AdditionalNamespaces { get; set; } public DynamicProviderRecord(string providerName, string description, string connectionTypeName, params string[] providerLibraries) { ProviderName = providerName; Description = description; ConnectionTypeName = connectionTypeName; Libraries = providerLibraries ?? Array.Empty<string>(); } } public class LoadProviderInfo { public LoadProviderInfo(DynamicProviderRecord provider) { Provider = provider; } public DynamicProviderRecord Provider { get; } public bool IsLoaded { get; private set; } public Assembly[]? LoadedAssemblies { get; private set; } public Exception? LoadException { get; private set; } public void Load(string connectionString) { if (IsLoaded) return; if (LoadException != null) return; try { IEnumerable<Assembly> loadLibraries = Provider.Libraries .Select(l => { try { return Assembly.Load(Path.GetFileNameWithoutExtension(l)); } catch (Exception e) { Debug.WriteLine(e.Message); return null; } } ) .Where(l => l != null)!; var providerLibraries = loadLibraries .Concat(new[] { typeof(DataConnection).Assembly }) .ToArray(); var typeName = Provider.InitializationClassName; if (!string.IsNullOrEmpty(typeName)) { var initType = Type.GetType(typeName, true)!; RuntimeHelpers.RunClassConstructor(initType.TypeHandle); } var provider = ProviderHelper.GetDataProvider(Provider.ProviderName, connectionString); var connectionAssemblies = new List<Assembly>() { provider.GetType().Assembly }; try { using var connection = provider.CreateConnection(connectionString); connectionAssemblies.Add(connection.GetType().Assembly); } catch { } LoadedAssemblies = connectionAssemblies .Concat(providerLibraries) .Distinct() .ToArray(); IsLoaded = true; } catch (Exception e) { LoadException = e; IsLoaded = false; } } public IEnumerable<string> GetAssemblyLocation(string connectionString) { Load(connectionString); if (LoadedAssemblies != null) return LoadedAssemblies.Select(a => a.Location); var directory = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location); if (directory == null) return Provider.Libraries; return Provider.Libraries.Select(l => Path.Combine(directory, l)); } public string? GetConnectionNamespace() { var ns = Provider?.ConnectionTypeName?.Split(',').Last().TrimStart(); if (!string.IsNullOrEmpty(ns)) return ns!; var path = Provider?.ConnectionTypeName?.Split('.').ToArray(); if (path?.Length > 1) { return string.Join(".", path.Take(path.Length - 1)); } return null; } public IDataProvider GetDataProvider(string connectionString) { Load(connectionString); return ProviderHelper.GetDataProvider(Provider.ProviderName, connectionString); } } public static LoadProviderInfo GetProvider(string? providerName, string? providerPath) { #if NETCORE RegisterProviderFactory(providerName, providerPath); #endif if (providerName == null) throw new ArgumentNullException(nameof(providerName), $"Provider name missing"); if (LoadedProviders.TryGetValue(providerName, out var info)) return info; if (!_dynamicProviders.TryGetValue(providerName, out var providerRecord)) throw new ArgumentException($"Unknown provider: {providerName}"); info = new LoadProviderInfo(providerRecord); LoadedProviders.Add(providerName, info); return info; } static IDataProvider GetDataProvider(string providerName, string connectionString) { var provider = DataConnection.GetDataProvider(providerName, connectionString); if (provider == null) throw new LinqToDBLinqPadException($"Can not activate provider \"{providerName}\""); return provider; } #if NETCORE static void RegisterProviderFactory(string? providerName, string? providerPath) { if (!string.IsNullOrWhiteSpace(providerPath)) { switch (providerName) { case ProviderName.SqlCe: RegisterSqlCEFactory(providerPath); break; case ProviderName.SapHanaNative: RegisterSapHanaFactory(providerPath); break; } } } private static bool _sqlceLoaded; static void RegisterSqlCEFactory(string providerPath) { if (_sqlceLoaded) return; try { var assembly = Assembly.LoadFrom(providerPath); DbProviderFactories.RegisterFactory("System.Data.SqlServerCe.4.0", assembly.GetType("System.Data.SqlServerCe.SqlCeProviderFactory")); _sqlceLoaded = true; } catch { } } private static bool _sapHanaLoaded; static void RegisterSapHanaFactory(string providerPath) { if (_sapHanaLoaded) return; try { var targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory!, Path.GetFileName(providerPath)); if (File.Exists(providerPath)) { // original path contains spaces which breaks broken native dlls discovery logic in SAP provider // (at least SPS04 040) // if you run tests from path with spaces - it will not help you File.Copy(providerPath, targetPath, true); var sapHanaAssembly = Assembly.LoadFrom(targetPath); DbProviderFactories.RegisterFactory("Sap.Data.Hana", sapHanaAssembly.GetType("Sap.Data.Hana.HanaFactory")); _sapHanaLoaded = true; } } catch { } } #endif } }
35.589226
166
0.666982
[ "MIT" ]
aTiKhan/linq2db.LINQPad
Source/ProviderHelper.cs
10,572
C#
#region License /* The MIT License Copyright (c) 2008 Sky Morey 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. */ #endregion using System; using System.Abstract; using System.Linq; using Contoso.GenericBus; using Contoso.GenericBus.Actions; using Contoso.GenericBus.Config; using Contoso.GenericBus.Impl; using Contoso.GenericBus.Internal; using IServiceBus = Contoso.GenericBus.IServiceBus; using IServiceLocator = Contoso.GenericBus.Internal.IServiceLocator; using System.Reflection; using System.Collections.Generic; namespace Contoso.Abstract.GenericBus { internal class ServiceLocatorBuilder : IBusContainerBuilder { readonly AbstractGenericBusConfiguration _config; readonly System.Abstract.IServiceLocator _locator; readonly System.Abstract.IServiceRegistrar _registrar; public ServiceLocatorBuilder(System.Abstract.IServiceLocator locator, AbstractGenericBusConfiguration config) { _locator = locator; _registrar = locator.Registrar; _config = config; _config.BuildWith(this); } public void RegisterAll<T>(Predicate<Type> condition) where T : class { _registrar.RegisterByTypeMatch<T>(condition, typeof(T).Assembly); } public void RegisterAll<T>(params Type[] excludes) where T : class { _registrar.RegisterByTypeMatch<T>(x => (!x.IsAbstract && !x.IsInterface && typeof(T).IsAssignableFrom(x) && !excludes.Contains<Type>(x)), typeof(T).Assembly); } public void RegisterBus() { var config = (GenericBusConfiguration)_config; _registrar.BehaveAs(ServiceRegistrarLifetime.Singleton).Register<IStartableServiceBus>(l => new DefaultGenericBus(l.Resolve<IServiceLocator>())); _registrar.Register<IStartable, IStartableServiceBus>(); _registrar.Register<IServiceBus, IStartableServiceBus>(); } public void RegisterDefaultServices(IEnumerable<Assembly> assemblies) { _registrar.Register<IServiceLocator, ServiceLocatorAdapter>(); ServiceLocatorExtensions.RegisterByTypeMatch<IBusConfigurationAware>(_registrar, typeof(IServiceBus).Assembly); foreach (var assembly in assemblies) _registrar.RegisterByTypeMatch<IBusConfigurationAware>(assembly); var locator = _locator.Resolve<IServiceLocator>(); foreach (var aware in _locator.ResolveAll<IBusConfigurationAware>()) aware.Configure(_config, this, locator); } public void RegisterSingleton<T>(Func<T> func) where T : class { _registrar.Register<T>(x => func()); } public void RegisterSingleton<T>(string name, Func<T> func) where T : class { _registrar.Register<T>(x => func(), name); } } }
41.319588
171
0.68987
[ "MIT" ]
BclEx/BclEx-Abstract
src/ServiceBuses/Contoso.Abstract.GenericBus/Abstract/GenericBus/ServiceLocatorBuilder.cs
4,010
C#
namespace AngleSharp.Dom.Collections { using AngleSharp.Css; using AngleSharp.Dom.Css; using AngleSharp.Extensions; using AngleSharp.Parser.Css; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; /// <summary> /// Represents a list of media elements. /// </summary> sealed class MediaList : CssNode, IMediaList { #region Fields readonly CssParser _parser; #endregion #region ctor internal MediaList(CssParser parser) { _parser = parser; } #endregion #region Index public String this[Int32 index] { get { return Media.GetItemByIndex(index).ToCss(); } } #endregion #region Properties public IEnumerable<CssMedium> Media { get { return Children.OfType<CssMedium>(); } } public Int32 Length { get { return Media.Count(); } } public String MediaText { get { return this.ToCss(); } set { Clear(); foreach (var medium in _parser.ParseMediaList(value)) { if (medium == null) throw new DomException(DomError.Syntax); AppendChild(medium); } } } #endregion #region Methods public override void ToCss(TextWriter writer, IStyleFormatter formatter) { var parts = Media.ToArray(); if (parts.Length > 0) { parts[0].ToCss(writer, formatter); for (var i = 1; i < parts.Length; i++) { writer.Write(", "); parts[i].ToCss(writer, formatter); } } } public Boolean Validate(RenderDevice device) { return !Media.Any(m => !m.Validate(device)); } public void Add(String newMedium) { var medium = _parser.ParseMedium(newMedium); if (medium == null) throw new DomException(DomError.Syntax); AppendChild(medium); } public void Remove(String oldMedium) { var medium = _parser.ParseMedium(oldMedium); if (medium == null) throw new DomException(DomError.Syntax); foreach (var item in Media) { if (item.Equals(medium)) { RemoveChild(item); return; } } throw new DomException(DomError.NotFound); } #endregion #region IEnumerable implementation public IEnumerator<ICssMedium> GetEnumerator() { return Media.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } #endregion } }
22.077465
80
0.487719
[ "MIT" ]
ArmyMedalMei/AngleSharp
src/AngleSharp/Dom/Collections/MediaList.cs
3,137
C#
using System.Reflection; 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("Microsoft.Recognizers.Text.NumberWithUnit")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft.Recognizers.Text.NumberWithUnit")] [assembly: AssemblyCopyright("Copyright © 2017")] [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("d7ea6651-8118-478d-aaa7-437613159978")] // 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.526316
84
0.748948
[ "MIT" ]
SivilTaram/Recognizers-Text
Microsoft.Recognizers.Text.NumberWithUnit/Properties/AssemblyInfo.cs
1,429
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 chime-sdk-identity-2021-04-20.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.ChimeSDKIdentity.Model { /// <summary> /// This is the response object from the DescribeAppInstance operation. /// </summary> public partial class DescribeAppInstanceResponse : AmazonWebServiceResponse { private AppInstance _appInstance; /// <summary> /// Gets and sets the property AppInstance. /// <para> /// The ARN, metadata, created and last-updated timestamps, and the name of the <code>AppInstance</code>. /// All timestamps use epoch milliseconds. /// </para> /// </summary> public AppInstance AppInstance { get { return this._appInstance; } set { this._appInstance = value; } } // Check to see if AppInstance property is set internal bool IsSetAppInstance() { return this._appInstance != null; } } }
31.051724
116
0.669628
[ "Apache-2.0" ]
ChristopherButtars/aws-sdk-net
sdk/src/Services/ChimeSDKIdentity/Generated/Model/DescribeAppInstanceResponse.cs
1,801
C#
using System; using System.IO; using System.Xml; using System.Text; using System.ComponentModel; using System.Data.SqlClient; using System.Collections.Generic; using System.Security.Cryptography; using System.Xml.Serialization; using MySql.Data.MySqlClient; //========================================================================================== //User OBJECT // //========================================================================================== //<XmlRoot("city")> _ //<Serialization.XmlTypeAttribute(Namespace:="http://services.morrisonred.com"), _ //Serialization.XmlRootAttribute("morrisonred", [Namespace]:="http://services.morrisonred.com", IsNullable:=False)> _ namespace Globalization { [DataObject] [XmlRoot("city")] [Serializable()] public class City { private Int16 _id; private string _countrycode; private string _name; private string _district; private Int32 _population; #region Constructors and Destructors /// <summary> /// Instanicate New City /// </summary> public City() { SetBase(); } /// <summary> /// Set MyBase to string.empty /// </summary> private void SetBase() { } #endregion #region Functions and Sub Routines #endregion } }
26.226415
117
0.53741
[ "MIT" ]
MorrisonRed/DemoCode
WithOutEntity.mvc/APP/DAL/Globalization/City.cs
1,392
C#
public interface IWriter { void WriteLine(string output); void Append(string text); void PrintResult(); }
13.875
31
0.738739
[ "MIT" ]
SimeonShterev/2018.01.22-2018.04.22-CSharpFundamentals
2018.03.19-OOPAdvanced/2018.04.16-ExamPrep/Last Army/Interfaces/IWriter.cs
113
C#
/* * The MIT License(MIT) * Copyright(c) 2016 * * 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.Generic; using System.Linq; using XmlTimeUniqueifier.DAL; using XmlTimeUniqueifier.Model; namespace XmlTimeUniqueifier.Processing { /// <summary> /// Creates a unique event time by storing in the DB /// </summary> public class DbUniqueifier : IUniqueifier { // Database context EventsContext eventData = new EventsContext(); private int history; private int eventCount; /// <summary> /// Creates the uniquifier /// </summary> /// <param name="historyLenght">Number of file to keep in the DB</param> public DbUniqueifier(int historyLenght) { history = historyLenght; eventCount = eventData.Events.Count(); } /// <summary> /// Craete unique event date /// </summary> /// <param name="eventDate">Event date for record</param> /// <param name="patientCode">Patient code for the record</param> /// <returns>A unique event dat if one can be created</returns> public string Uniquify(string eventDate, string patientCode) { lock(this) { try { List<Event> events = eventData.Events.Where(e => e.EventDate.StartsWith(eventDate) && e.PatientCode == patientCode).ToList(); for (int i = 0; i < 60; i++) { string updatedEventDate = string.Format("{0}:{1:D2}", eventDate, i); if (events.FirstOrDefault(e => e.EventDate == updatedEventDate) == null) { Event newEvent = new Event() { EventDate = updatedEventDate, PatientCode = patientCode, Created = DateTime.UtcNow }; eventData.Events.Add(newEvent); eventData.SaveChanges(); eventCount++; return updatedEventDate; } } throw new Exception("Unique file name cannot be created"); } finally { if (eventCount > history * 1.1) { Cleanup(); } } } } /// <summary> /// Cleanup history to avoid large data sets /// </summary> private void Cleanup() { // If history is lsee than one no cleanup is needed if(history < 1) { return; } IEnumerable<Event> eventsToRemove = eventData.Events.OrderByDescending(e => e.Created).Skip(history).ToList(); eventData.Events.RemoveRange(eventsToRemove); eventCount = eventData.Events.Count(); } } }
38.730769
145
0.57572
[ "MIT" ]
tseech/XmlTimeUniqueifier
XmlTimeUniqueifier/Processing/DbUniqueifier.cs
4,030
C#
namespace BC7.Business.Implementation.Files.Commands.UploadFile { public class UploadFileViewModel { public string PathToFile { get; set; } } }
23.714286
64
0.692771
[ "MIT" ]
XardasLord/BitClub7
BC7.Business.Implementation/Files/Commands/UploadFile/UploadFileViewModel.cs
168
C#
using System.IO; using CP77.CR2W.Reflection; using FastMember; using static CP77.CR2W.Types.Enums; namespace CP77.CR2W.Types { [REDMeta] public class gameHitRepresentationResult : CVariable { [Ordinal(0)] [RED("sult")] public gameQueryResult Sult { get; set; } [Ordinal(1)] [RED("tityID")] public entEntityID TityID { get; set; } public gameHitRepresentationResult(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { } } }
28
114
0.705882
[ "MIT" ]
Eingin/CP77Tools
CP77.CR2W/Types/cp77/gameHitRepresentationResult.cs
460
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.IO; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Components.RenderTree; namespace Microsoft.AspNetCore.Components.Server.Circuits { /// <summary> /// Writeable memory stream backed by a an <see cref="ArrayBuilder{T}"/>. /// </summary> internal sealed class ArrayBuilderMemoryStream : Stream { public ArrayBuilderMemoryStream(ArrayBuilder<byte> arrayBuilder) { ArrayBuilder = arrayBuilder; } /// <inheritdoc /> public override bool CanRead => false; /// <inheritdoc /> public override bool CanSeek => false; /// <inheritdoc /> public override bool CanWrite => true; /// <inheritdoc /> public override long Length => ArrayBuilder.Count; /// <inheritdoc /> public override long Position { get => ArrayBuilder.Count; set => throw new NotSupportedException(); } public ArrayBuilder<byte> ArrayBuilder { get; } /// <inheritdoc /> public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); /// <inheritdoc /> public override int Read(byte[] buffer, int offset, int count) => throw new NotSupportedException(); /// <inheritdoc /> public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => throw new NotSupportedException(); /// <inheritdoc /> public override void Write(byte[] buffer, int offset, int count) { ValidateArguments(buffer, offset, count); ArrayBuilder.Append(buffer, offset, count); } /// <inheritdoc /> public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { ValidateArguments(buffer, offset, count); ArrayBuilder.Append(buffer, offset, count); return Task.CompletedTask; } /// <inheritdoc /> public override void Flush() { // Do nothing. } /// <inheritdoc /> public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask; /// <inheritdoc /> public override void SetLength(long value) => throw new NotSupportedException(); /// <inheritdoc /> protected override void Dispose(bool disposing) { // Do nothing. } /// <inheritdoc /> public override ValueTask DisposeAsync() => default; [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void ValidateArguments(byte[] buffer, int offset, int count) { if (buffer == null) { ThrowHelper.ThrowArgumentNullException(nameof(buffer)); } if (offset < 0) { ThrowHelper.ThrowArgumentOutOfRangeException(nameof(offset)); } if (count < 0) { ThrowHelper.ThrowArgumentOutOfRangeException(nameof(count)); } if (buffer.Length - offset < count) { ThrowHelper.ThrowArgumentOutOfRangeException(nameof(offset)); } } private static class ThrowHelper { public static void ThrowArgumentNullException(string name) => throw new ArgumentNullException(name); public static void ThrowArgumentOutOfRangeException(string name) => throw new ArgumentOutOfRangeException(name); } } }
30.913386
118
0.597555
[ "Apache-2.0" ]
06b/AspNetCore
src/Components/Server/src/Circuits/ArrayBuilderMemoryStream.cs
3,926
C#
using System; using System.Linq; using System.Collections.Generic; using UnityEngine; namespace VoiceChat { [RequireComponent(typeof(AudioSource))] public class VoiceChatPlayer : MonoBehaviour { public event Action PlayerStarted; float lastTime = 0; double played = 0; double received = 0; int index = 0; float[] data; float playDelay = 0; bool shouldPlay = false; float lastRecvTime = 0; NSpeex.SpeexDecoder speexDec = new NSpeex.SpeexDecoder(NSpeex.BandMode.Narrow); [SerializeField] [Range(.1f, 5f)] float playbackDelay = .5f; [SerializeField] [Range(1, 32)] int packetBufferSize = 10; SortedList<ulong, VoiceChatPacket> packetsToPlay = new SortedList<ulong, VoiceChatPacket>(); public float LastRecvTime { get { return lastRecvTime; } } void Start() { int size = VoiceChatSettings.Instance.Frequency * 10; GetComponent<AudioSource>().loop = true; GetComponent<AudioSource>().clip = AudioClip.Create("VoiceChat", size, 1, VoiceChatSettings.Instance.Frequency, false); data = new float[size]; if (VoiceChatSettings.Instance.LocalDebug) { VoiceChatRecorder.Instance.NewSample += OnNewSample; } if(PlayerStarted != null) { PlayerStarted(); } } void Update() { if (GetComponent<AudioSource>().isPlaying) { // Wrapped around if (lastTime > GetComponent<AudioSource>().time) { played += GetComponent<AudioSource>().clip.length; } lastTime = GetComponent<AudioSource>().time; // Check if we've played to far if (played + GetComponent<AudioSource>().time >= received) { Stop(); shouldPlay = false; } } else { if (shouldPlay) { playDelay -= Time.deltaTime; if (playDelay <= 0) { GetComponent<AudioSource>().Play(); } } } } void Stop() { GetComponent<AudioSource>().Stop(); GetComponent<AudioSource>().time = 0; index = 0; played = 0; received = 0; lastTime = 0; } public void OnNewSample(VoiceChatPacket newPacket) { // Set last time we got something // Set last time we got something lastRecvTime = Time.time; // Add this new line; if ( packetsToPlay.ContainsKey( newPacket.PacketId ) ) return; packetsToPlay.Add(newPacket.PacketId, newPacket); if (packetsToPlay.Count < 10) { return; } var pair = packetsToPlay.First(); var packet = pair.Value; packetsToPlay.Remove(pair.Key); // Decompress float[] sample = null; int length = VoiceChatUtils.Decompress(speexDec, packet, out sample); // Add more time to received received += VoiceChatSettings.Instance.SampleTime; // Push data to buffer Array.Copy(sample, 0, data, index, length); // Increase index index += length; // Handle wrap-around if (index >= GetComponent<AudioSource>().clip.samples) { index = 0; } // Set data GetComponent<AudioSource>().clip.SetData(data, 0); // If we're not playing if (!GetComponent<AudioSource>().isPlaying) { // Set that we should be playing shouldPlay = true; // And if we have no delay set, set it. if (playDelay <= 0) { playbackDelay = 0.1f; playDelay = (float)VoiceChatSettings.Instance.SampleTime * playbackDelay; } } VoiceChatFloatPool.Instance.Return(sample); } } }
29.18239
132
0.472198
[ "MIT", "Unlicense" ]
alkamegames/unityassets
VoiceChat/Assets/VoiceChat/Scripts/VoiceChatPlayer.cs
4,640
C#
using System.Threading.Tasks; using Android.Content; using Xamarians.FacebookLogin.Platforms; using Xamarians.FacebookLogin.Droid.Platforms; using Xamarin.Forms; using Xamarians.FacebookLogin.Droid.DS; using System; [assembly: Dependency(typeof(FacebookLogin))] namespace Xamarians.FacebookLogin.Droid.DS { public class FacebookLogin : IFacebookLogin { public static string FacebookAppId { get; set; } public static void Init(string facebookAppId) { FacebookAppId = facebookAppId; } public void ShareImageOnFacebook(string caption, string imagePath) { var dbIntent = new Intent(Xamarin.Forms.Forms.Context, typeof(FacebookShareActivity)); dbIntent.PutExtra("Title", caption); dbIntent.PutExtra("ImagePath", imagePath); Xamarin.Forms.Forms.Context.StartActivity(dbIntent); } public void ShareLinkOnFacebook(string title, string description, string link) { var dbIntent = new Intent(Xamarin.Forms.Forms.Context, typeof(FacebookShareActivity)); dbIntent.PutExtra("Title", title); dbIntent.PutExtra("Description", description); dbIntent.PutExtra("Link", link); Xamarin.Forms.Forms.Context.StartActivity(dbIntent); } public void ShareTextOnFacebook(string text) { var dbIntent = new Intent(Xamarin.Forms.Forms.Context, typeof(FacebookShareActivity)); dbIntent.PutExtra("Title", "Joybird"); dbIntent.PutExtra("Description", text); Xamarin.Forms.Forms.Context.StartActivity(dbIntent); } public Task<FbLoginResult> SignIn() { var tcs = new TaskCompletionSource<FbLoginResult>(); FacebookLoginActivity.OnLoginCompleted(tcs); var fbIntent = new Intent(Xamarin.Forms.Forms.Context, typeof(FacebookLoginActivity)); fbIntent.PutExtra("Permissions", "email"); Xamarin.Forms.Forms.Context.StartActivity(fbIntent); return tcs.Task; } public Task<FbLoginResult> SignOut() { var tcs = new TaskCompletionSource<FbLoginResult>(); FacebookLoginActivity.SignOut(tcs); return tcs.Task; } } }
37.322581
98
0.651253
[ "MIT" ]
Xamarians/Xamarians.FacebookLogin
Xamarians.FacebookLogin/Xamarians.FacebookLogin.Droid/DS/FacebookLogin.cs
2,314
C#
// Copyright (c) 2014 Takashi Yoshizawa using System; using System.Collections.Generic; using System.Linq; using System.Text; using OpenQA.Selenium; using Excel = Microsoft.Office.Interop.Excel; namespace SeleniumExcelAddIn.TestCommands { public class VerifySelectedIdCommand : ITestCommand { public TestCommandSyntax Syntax { get { return TestCommandSyntax.Both; } } public bool IsScreenCapture { get { return true; } } public string Description { get { return TestCommandResource.VerifySelectedId; } } public string TargetDescription { get { return TestCommandResource.VerifySelectedId_Target; } } public string ValueDescription { get { return TestCommandResource.VerifySelectedId_Value; } } public void Execute(ITestContext context) { if (null == context) { throw new ArgumentNullException("context"); } ExecuteInternal(context); } public static void ExecuteInternal(ITestContext context) { if (null == context) { throw new ArgumentNullException("context"); } TestCommandHelper.Verify(AssertSelectedIdCommand.ExecuteInternal, context); } } }
21.207792
87
0.512554
[ "Apache-2.0" ]
daluu/seleniumexceladdin
SeleniumExcelAddIn/TestCommands/VerifySelectedIdCommand.cs
1,633
C#
// <auto-generated /> using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using SPNewsData.Data.Context; namespace SPNewsData.Data.Migrations { [DbContext(typeof(SPNewsDataContext))] partial class SPNewsDataContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Relational:MaxIdentifierLength", 64) .HasAnnotation("ProductVersion", "5.0.11"); modelBuilder.Entity("SPNewsData.Domain.Entities.Evidence", b => { b.Property<int?>("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); b.Property<int?>("EvidenceType") .HasColumnType("int"); b.Property<int?>("GovNewsId") .HasColumnType("int"); b.Property<string>("RawContent") .HasColumnType("text"); b.HasKey("Id"); b.HasIndex("GovNewsId"); b.ToTable("Evidences"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.GovNews", b => { b.Property<int?>("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); b.Property<DateTime?>("CaptureDate") .ValueGeneratedOnAdd() .HasColumnType("datetime(6)") .HasDefaultValueSql("(CURRENT_TIMESTAMP)"); b.Property<string>("Content") .HasColumnType("text"); b.Property<DateTime?>("PublicationDate") .HasColumnType("datetime(6)"); b.Property<string>("Search") .HasColumnType("longtext"); b.Property<string>("Source") .HasColumnType("longtext"); b.Property<string>("Subtitle") .HasColumnType("longtext"); b.Property<string>("Title") .HasColumnType("longtext"); b.Property<string>("Url") .HasColumnType("longtext"); b.HasKey("Id"); b.ToTable("GovNews"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.Subject", b => { b.Property<int?>("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); b.Property<int?>("GovNewsId") .HasColumnType("int"); b.Property<string>("Name") .HasColumnType("longtext"); b.HasKey("Id"); b.HasIndex("GovNewsId"); b.ToTable("Subjects"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.UrlExtracted", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); b.Property<bool>("ParsingLayout") .ValueGeneratedOnAdd() .HasColumnType("tinyint(1)") .HasDefaultValue(false); b.Property<string>("Search") .HasColumnType("longtext"); b.Property<string>("Title") .HasColumnType("longtext"); b.Property<string>("Url") .HasColumnType("longtext"); b.HasKey("Id"); b.ToTable("UrlExtracteds"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.Evidence", b => { b.HasOne("SPNewsData.Domain.Entities.GovNews", "GovNews") .WithMany("Evidences") .HasForeignKey("GovNewsId"); b.Navigation("GovNews"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.Subject", b => { b.HasOne("SPNewsData.Domain.Entities.GovNews", "GovNews") .WithMany("Subjects") .HasForeignKey("GovNewsId"); b.Navigation("GovNews"); }); modelBuilder.Entity("SPNewsData.Domain.Entities.GovNews", b => { b.Navigation("Evidences"); b.Navigation("Subjects"); }); #pragma warning restore 612, 618 } } }
32.847682
79
0.452419
[ "MIT" ]
Marcus-V-Freitas/CrawlerBrazilGovData
Contexts/SPNewsData/SPNewsData.Data/Migrations/SPNewsDataContextModelSnapshot.cs
4,962
C#
/* * Licensed to SharpSoftware under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * SharpSoftware 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 Itinero.Attributes; using Itinero.Data.Shortcuts; using Itinero.Osm.Vehicles; using NUnit.Framework; namespace Itinero.Test.Data.Shortcuts { /// <summary> /// Contains tests for the shortcuts db. /// </summary> [TestFixture] public class ShortcutsDbTests { /// <summary> /// Tests adding stops. /// </summary> [Test] public void TestAddStops() { var db = new ShortcutsDb(Vehicle.Bicycle.Fastest()); db.AddStop(10, new AttributeCollection(new Attribute() { Key = "some_key", Value = "some_value" })); db.AddStop(11, new AttributeCollection(new Attribute() { Key = "some_key", Value = "some_value" })); db.AddStop(12, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); db.AddStop(13, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); } /// <summary> /// Tests getting stops. /// </summary> [Test] public void TestGetStop() { var db = new ShortcutsDb(Vehicle.Bicycle.Fastest()); db.AddStop(10, new AttributeCollection(new Attribute() { Key = "some_key", Value = "some_value" })); db.AddStop(11, new AttributeCollection(new Attribute() { Key = "some_key", Value = "some_value" })); db.AddStop(12, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); db.AddStop(13, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); var a = db.GetStop(10); Assert.IsNotNull(a); Assert.AreEqual(1, a.Count); } /// <summary> /// Tests adding shortcuts. /// </summary> [Test] public void TestAddShortcuts() { var db = new ShortcutsDb(Vehicle.Bicycle.Fastest()); db.AddStop(10, null); db.AddStop(11, null); db.AddStop(12, null); db.AddStop(13, null); db.Add(new uint[] { 10, 100, 101, 102, 103, 11 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); db.Add(new uint[] { 12, 110, 111, 112, 113, 13 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); } /// <summary> /// Tests getting shortcuts. /// </summary> [Test] public void TestGetShortcut() { var db = new ShortcutsDb(Vehicle.Bicycle.Fastest()); db.AddStop(10, null); db.AddStop(11, null); db.AddStop(12, null); db.AddStop(13, null); var s1 = db.Add(new uint[] { 10, 100, 101, 102, 103, 11 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); var s2 = db.Add(new uint[] { 12, 110, 111, 112, 113, 13 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); IAttributeCollection meta; var s = db.Get(s1, out meta); Assert.IsNotNull(s); Assert.AreEqual(6, s.Length); Assert.IsNotNull(meta); Assert.AreEqual(1, meta.Count); } /// <summary> /// Tests getting shortcuts by vertices. /// </summary> [Test] public void TestGetShortcutByVertices() { var db = new ShortcutsDb(Vehicle.Bicycle.Fastest()); db.AddStop(10, null); db.AddStop(11, null); db.AddStop(12, null); db.AddStop(13, null); var s1 = db.Add(new uint[] { 10, 100, 101, 102, 103, 11 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); var s2 = db.Add(new uint[] { 12, 110, 111, 112, 113, 13 }, new AttributeCollection(new Attribute() { Key = "some_key1", Value = "some_value1" })); IAttributeCollection meta; var s = db.Get(10, 11, out meta); Assert.IsNotNull(s); Assert.AreEqual(6, s.Length); Assert.IsNotNull(meta); Assert.AreEqual(1, meta.Count); s = db.Get(12, 13, out meta); Assert.IsNotNull(s); Assert.AreEqual(6, s.Length); Assert.IsNotNull(meta); Assert.AreEqual(1, meta.Count); } } }
31.190722
110
0.502231
[ "Apache-2.0" ]
AlexanderTaeschner/routing
test/Itinero.Test/Data/Shortcuts/ShortcutsDbTests.cs
6,053
C#
using CallCenter.Core.Dtos; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; namespace CallCenterManagementSystem.Dtos { public class SoldDeviceDto { public int Id { get; set; } [Required] [StringLength(50)] public string Name { get; set; } [Required] public DateTime WarrantyStartDate { get; set; } [Required] public DateTime WarrantyEndDate { get; set; } public DeviceSupplierDto DeviceSupplier { get; set; } public BuyerDto Buyer { get; set; } [Required] public int BuyerId { get; set; } [Required] public decimal Price { get; set; } } }
21.222222
61
0.620419
[ "MIT" ]
nikola-sekulic/CallCenterManagement
CallCenter/Core/Dtos/SoldDeviceDto.cs
766
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.ReverseProxy.Abstractions; using Microsoft.ReverseProxy.Middleware; using Microsoft.ReverseProxy.Service; namespace Microsoft.AspNetCore.Builder { /// <summary> /// Extension methods for <see cref="IEndpointRouteBuilder"/> /// used to add Reverse Proxy to the ASP .NET Core request pipeline. /// </summary> public static class ReverseProxyIEndpointRouteBuilderExtensions { /// <summary> /// Adds Reverse Proxy routes to the route table using the default processing pipeline. /// </summary> public static void MapReverseProxy(this IEndpointRouteBuilder endpoints) { endpoints.MapReverseProxy(app => { app.UseAffinitizedDestinationLookup(); app.UseProxyLoadBalancing(); app.UseRequestAffinitizer(); }); } /// <summary> /// Adds Reverse Proxy routes to the route table with the customized processing pipeline. The pipeline includes /// by default the initialization step and the final proxy step, but not LoadBalancingMiddleware or other intermediate components. /// </summary> public static void MapReverseProxy(this IEndpointRouteBuilder endpoints, Action<IApplicationBuilder> configureApp) { if (endpoints is null) { throw new ArgumentNullException(nameof(endpoints)); } if (configureApp is null) { throw new ArgumentNullException(nameof(configureApp)); } var appBuilder = endpoints.CreateApplicationBuilder(); appBuilder.UseMiddleware<DestinationInitializerMiddleware>(); configureApp(appBuilder); appBuilder.UseMiddleware<ProxyInvokerMiddleware>(); var app = appBuilder.Build(); var routeBuilder = endpoints.ServiceProvider.GetRequiredService<IRuntimeRouteBuilder>(); routeBuilder.SetProxyPipeline(app); var configManager = endpoints.ServiceProvider.GetRequiredService<IProxyConfigManager>(); // Config validation is async but startup is sync. We want this to block so that A) any validation errors can prevent // the app from starting, and B) so that all the config is ready before the server starts accepting requests. // Reloads will be async. var dataSource = configManager.InitialLoadAsync().GetAwaiter().GetResult(); endpoints.DataSources.Add(dataSource); } } }
41.545455
138
0.663384
[ "MIT" ]
JasonCoombs/reverse-proxy
src/ReverseProxy/Configuration/ReverseProxyIEndpointRouteBuilderExtensions.cs
2,742
C#
using System.Data; using YJC.Toolkit.Sys; namespace YJC.Toolkit.Data { [InstancePlugIn] //[ModelCreator(Author = "YJC", CreateDate = "2017-04-15", Description = "以DataSet的方式创建界面展示所需的数据Model接口")] internal class DataSetModelCreator// : BaseDataSetModelCreator { #region IModelCreator 成员 public IListModel CreateListModel(object model) { TkDebug.AssertArgumentNull(model, "model", null); DataSet dataSet = model.Convert<DataSet>(); return new DataSetListModel(dataSet); } public IEditModel CreateEditModel(object model) { TkDebug.AssertArgumentNull(model, "model", null); DataSet dataSet = model.Convert<DataSet>(); return new DataSetEditModel(dataSet); } public IDetailModel CreateDetailModel(object model) { TkDebug.AssertArgumentNull(model, "model", null); DataSet dataSet = model.Convert<DataSet>(); return new DataSetDetailModel(dataSet); } #endregion IModelCreator 成员 } }
28.921053
110
0.630573
[ "BSD-3-Clause" ]
madiantech/tkcore
CoreWeb/YJC.Toolkit.Razor.Web/Data/_DataSet/DataSetModelCreator.cs
1,143
C#
namespace GitHub.Logging { public abstract class LogAdapterBase { public abstract void Info(string context, string message); public abstract void Debug(string context, string message); public abstract void Trace(string context, string message); public abstract void Warning(string context, string message); public abstract void Error(string context, string message); } }
28.4
69
0.706573
[ "MIT" ]
Acidburn0zzz/Unity
src/GitHub.Logging/LogAdapterBase.cs
426
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. // ISCIIEncoding // // Ported from windows c_iscii. If you find bugs here, there are likely similar // bugs in the windows version using System.Diagnostics; using System.Runtime.Serialization; namespace System.Text { // Encodes text into and out of the ISCII encodings. // ISCII contains characters to encode indic scripts by mapping indic scripts // to the same code page. This works because they are all related scripts. // ISCII provides a "font" selection method to switch between the appropriate // fonts to display the other scripts. All ISCII characters are above the // ASCII range to provide ASCII compatibility. // // IsAlwaysNormalized() isn't overridden // We don't override IsAlwaysNormalized() because it is false for all forms (like base implementation) // Forms C & KC have things like 0933 + 093C == composed 0934, so they aren't normalized // Forms D & KD have things like 0934, which decomposes to 0933 + 093C, so not normal. // Form IDNA has the above problems plus case mapping, so false (like most encodings) // internal class ISCIIEncoding : EncodingNLS, ISerializable { // Constants private const int CodeDevanagari = 2; // 0x42 57002 private const int CodePunjabi = 11; // 0x4b 57011 Punjabi (Gurmukhi) // Ranges private const int MultiByteBegin = 0xa0; // Beginning of MultiByte space in ISCII private const int IndicBegin = 0x0901; // Beginning of Unicode Indic script code points private const int IndicEnd = 0x0d6f; // End of Unicode Indic Script code points // ISCII Control Values private const byte ControlATR = 0xef; // Attribute (ATR) code private const byte ControlCodePageStart = 0x40; // Start of code page range // Interesting ISCII characters private const byte Virama = 0xe8; private const byte Nukta = 0xe9; private const byte DevenagariExt = 0xf0; // Interesting Unicode characters private const char ZWNJ = (char)0x200c; private const char ZWJ = (char)0x200d; // Code Page private int _defaultCodePage; public ISCIIEncoding(int codePage) : base(codePage) { // Set our code page (subtracting windows code page # offset) _defaultCodePage = codePage - 57000; // Legal windows code pages are between Devanagari and Punjabi Debug.Assert(_defaultCodePage >= CodeDevanagari && _defaultCodePage <= CodePunjabi, "[ISCIIEncoding] Code page (" + codePage + " isn't supported by ISCIIEncoding!"); // This shouldn't really be possible if (_defaultCodePage < CodeDevanagari || _defaultCodePage > CodePunjabi) throw new ArgumentException(SR.Format(SR.Argument_CodepageNotSupported, codePage), nameof(codePage)); } void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { throw new PlatformNotSupportedException(); } // Our MaxByteCount is 4 times the input size. That could be because // the first input character could be in the wrong code page ("font") and // then that character could also be encoded in 2 code points public override int GetMaxByteCount(int charCount) { if (charCount < 0) throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_NeedNonNegNum); // Characters would be # of characters + 1 in case high surrogate is ? * max fallback long byteCount = (long)charCount + 1; if (EncoderFallback.MaxCharCount > 1) byteCount *= EncoderFallback.MaxCharCount; // 4 Time input because 1st input could require code page change and also that char could require 2 code points byteCount *= 4; if (byteCount > 0x7fffffff) throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow); return (int)byteCount; } // Our MaxCharCount is the same as the byteCount. There are a few sequences // where 2 (or more) bytes could become 2 chars, but that's still 1 to 1. public override int GetMaxCharCount(int byteCount) { if (byteCount < 0) throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_NeedNonNegNum); // Our MaxCharCount is the same as the byteCount. There are a few sequences // where 2 (or more) bytes could become 2 chars, but that's still 1 to 1. // Also could have 1 in decoder if we're waiting to see if next char's a nukta. long charCount = ((long)byteCount + 1); // Some code points are undefined so we could fall back. if (DecoderFallback.MaxCharCount > 1) charCount *= DecoderFallback.MaxCharCount; if (charCount > 0x7fffffff) throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow); return (int)charCount; } // Our workhorse version public override unsafe int GetByteCount(char* chars, int count, EncoderNLS baseEncoder) { // Use null pointer to ask GetBytes for count return GetBytes(chars, count, null, 0, baseEncoder); } // Workhorse public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, EncoderNLS baseEncoder) { // Allow null bytes for counting Debug.Assert(chars != null, "[ISCIIEncoding.GetBytes]chars!=null"); // Debug.Assert(bytes != null, "[ISCIIEncoding.GetBytes]bytes!=null"); Debug.Assert(charCount >= 0, "[ISCIIEncoding.GetBytes]charCount >=0"); Debug.Assert(byteCount >= 0, "[ISCIIEncoding.GetBytes]byteCount >=0"); // Need the ISCII Encoder ISCIIEncoder encoder = (ISCIIEncoder)baseEncoder; // prepare our helpers EncodingByteBuffer buffer = new EncodingByteBuffer(this, encoder, bytes, byteCount, chars, charCount); int currentCodePage = _defaultCodePage; bool bLastVirama = false; // Use encoder info if available if (encoder != null) { // Remember our old state currentCodePage = encoder.currentCodePage; bLastVirama = encoder.bLastVirama; // If we have a high surrogate left over, then fall it back if (encoder.charLeftOver > 0) { buffer.Fallback(encoder.charLeftOver); bLastVirama = false; // Redundant } } while (buffer.MoreData) { // Get our data char ch = buffer.GetNextChar(); // See if its a Multi Byte Character if (ch < MultiByteBegin) { // Its a boring low character, add it. if (!buffer.AddByte((byte)ch)) break; bLastVirama = false; continue; } // See if its outside of the Indic script range if ((ch < IndicBegin) || (ch > IndicEnd)) { // See if its a ZWJ or ZWNJ and if we has bLastVirama; if (bLastVirama && (ch == ZWNJ || ch == ZWJ)) { // It was a bLastVirama and ZWNJ || ZWJ if (ch == ZWNJ) { if (!buffer.AddByte(Virama)) break; } else // ZWJ { if (!buffer.AddByte(Nukta)) break; } // bLastVirama now counts as false bLastVirama = false; continue; } // Have to do our fallback // // Note that this will fallback 2 chars if this is a high surrogate. // Throws if recursive (knows because we called InternalGetNextChar) buffer.Fallback(ch); bLastVirama = false; continue; } // Its in the Unicode Indic script range int indicInfo = s_UnicodeToIndicChar[ch - IndicBegin]; byte byteIndic = (byte)indicInfo; int indicScript = (0x000f & (indicInfo >> 8)); int indicTwoBytes = (0xf000 & indicInfo); // If IndicInfo is 0 then have to do fallback if (indicInfo == 0) { // Its some Unicode character we don't have indic for. // Have to do our fallback // Add Fallback Count // Note that chars was preincremented, and GetEncoderFallbackString might add an extra // if chars != charEnd and there's a surrogate. // Throws if recursive (knows because we called InternalGetNextChar) buffer.Fallback(ch); bLastVirama = false; continue; } // See if our code page ("font" in ISCII spec) has to change // (This if doesn't add character, just changes character set) Debug.Assert(indicScript != 0, "[ISCIIEncoding.GetBytes]expected an indic script value"); if (indicScript != currentCodePage) { // It changed, spit out the ATR if (!buffer.AddByte(ControlATR, (byte)(indicScript | ControlCodePageStart))) break; // Now spit out the new code page (& remember it) (do this afterwards in case AddByte failed) currentCodePage = indicScript; // We only know how to map from Unicode to pages from Devanagari to Punjabi (2 to 11) Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi, "[ISCIIEncoding.GetBytes]Code page (" + currentCodePage + " shouldn't appear in ISCII from Unicode table!"); } // Safe to add our byte now if (!buffer.AddByte(byteIndic, indicTwoBytes != 0 ? 1 : 0)) break; // Remember if this one was a Virama bLastVirama = (byteIndic == Virama); // Some characters need extra bytes if (indicTwoBytes != 0) { // This one needs another byte Debug.Assert((indicTwoBytes >> 12) > 0 && (indicTwoBytes >> 12) <= 3, "[ISCIIEncoding.GetBytes]Expected indicTwoBytes from 1-3, not " + (indicTwoBytes >> 12)); // Already did buffer checking, but... if (!buffer.AddByte(s_SecondIndicByte[indicTwoBytes >> 12])) break; } } // May need to switch back to our default code page if (currentCodePage != _defaultCodePage && (encoder == null || encoder.MustFlush)) { // It changed, spit out the ATR if (buffer.AddByte(ControlATR, (byte)(_defaultCodePage | ControlCodePageStart))) currentCodePage = _defaultCodePage; else // If not successful, convert will maintain state for next time, also // AddByte will have decremented our char count, however we need it to remain the same buffer.GetNextChar(); bLastVirama = false; } // Make sure we remember our state if necessary // Note that we don't care about flush because Virama and code page // changes are legal at the end. // Don't set encoder if we're just counting if (encoder != null && bytes != null) { // Clear Encoder if necessary. if (!buffer.fallbackBufferHelper.bUsedEncoder) { encoder.charLeftOver = (char)0; } // Remember our code page/virama state encoder.currentCodePage = currentCodePage; encoder.bLastVirama = bLastVirama; // How many chars were used? encoder.m_charsUsed = buffer.CharsUsed; } // Return our length return buffer.Count; } // Workhorse public override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder) { // Just call GetChars with null chars saying we want count return GetChars(bytes, count, null, 0, baseDecoder); } // For decoding, the following interesting rules apply: // Virama followed by another Virama or Nukta becomes Virama + ZWNJ or Virama + ZWJ // ATR is followed by a byte to switch code pages ("fonts") // Devenagari F0, B8 -> \u0952 // Devenagari F0, BF -> \u0970 // Some characters followed by E9 become a different character instead. public override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder) { // Just need to ASSERT, this is called by something else internal that checked parameters already // Allow null chars for counting Debug.Assert(bytes != null, "[ISCIIEncoding.GetChars]bytes is null"); Debug.Assert(byteCount >= 0, "[ISCIIEncoding.GetChars]byteCount is negative"); // Debug.Assert(chars != null, "[ISCIIEncoding.GetChars]chars is null"); Debug.Assert(charCount >= 0, "[ISCIIEncoding.GetChars]charCount is negative"); // Need the ISCII Decoder ISCIIDecoder decoder = (ISCIIDecoder)baseDecoder; // Get our info. EncodingCharBuffer buffer = new EncodingCharBuffer(this, decoder, chars, charCount, bytes, byteCount); int currentCodePage = _defaultCodePage; bool bLastATR = false; bool bLastVirama = false; bool bLastDevenagariStressAbbr = false; char cLastCharForNextNukta = '\0'; char cLastCharForNoNextNukta = '\0'; // See if there's anything in our decoder if (decoder != null) { currentCodePage = decoder.currentCodePage; bLastATR = decoder.bLastATR; bLastVirama = decoder.bLastVirama; bLastDevenagariStressAbbr = decoder.bLastDevenagariStressAbbr; cLastCharForNextNukta = decoder.cLastCharForNextNukta; cLastCharForNoNextNukta = decoder.cLastCharForNoNextNukta; } bool bLastSpecial = bLastVirama | bLastATR | bLastDevenagariStressAbbr | (cLastCharForNextNukta != '\0'); // Get our current code page index (some code pages are dups) int currentCodePageIndex = -1; Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi, "[ISCIIEncoding.GetChars]Decoder code page must be >= Devanagari and <= Punjabi, not " + currentCodePage); if (currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi) { currentCodePageIndex = s_IndicMappingIndex[currentCodePage]; } // Loop through our input while (buffer.MoreData) { byte b = buffer.GetNextByte(); // See if last one was special if (bLastSpecial) { // Now it won't be bLastSpecial = false; // One and only one of our flags should be set Debug.Assert(((bLastVirama ? 1 : 0) + (bLastATR ? 1 : 0) + (bLastDevenagariStressAbbr ? 1 : 0) + ((cLastCharForNextNukta > 0) ? 1 : 0)) == 1, $"[ISCIIEncoding.GetChars]Special cases require 1 and only 1 special case flag: LastATR {bLastATR} Dev. {bLastDevenagariStressAbbr} Nukta {cLastCharForNextNukta}"); // If the last one was an ATR, then we'll have to do ATR stuff if (bLastATR) { // We only support Devanagari - Punjabi if (b >= (0x40 | CodeDevanagari) && b <= (0x40 | CodePunjabi)) { // Remember the code page currentCodePage = b & 0xf; currentCodePageIndex = s_IndicMappingIndex[currentCodePage]; // No longer last ATR bLastATR = false; continue; } // Change back to default? if (b == 0x40) { currentCodePage = _defaultCodePage; currentCodePageIndex = -1; if (currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi) { currentCodePageIndex = s_IndicMappingIndex[currentCodePage]; } // No longer last ATR bLastATR = false; continue; } // We don't support Roman if (b == 0x41) { currentCodePage = _defaultCodePage; currentCodePageIndex = -1; if (currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi) { currentCodePageIndex = s_IndicMappingIndex[currentCodePage]; } // Even though we don't know how to support Roman, windows didn't add a ? so we don't either. // No longer last ATR bLastATR = false; continue; } // Other code pages & ATR codes not supported, fallback the ATR // If fails, decrements the buffer, which is OK, we remember ATR state. if (!buffer.Fallback(ControlATR)) break; // No longer last ATR (fell back) bLastATR = false; // we know we can't have any of these other modes Debug.Assert(bLastVirama == false, "[ISCIIEncoding.GetChars] Expected no bLastVirama in bLastATR mode"); Debug.Assert(bLastDevenagariStressAbbr == false, "[ISCIIEncoding.GetChars] Expected no bLastDevenagariStressAbbr in bLastATR mode"); Debug.Assert(cLastCharForNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNextNukta in bLastATR mode"); Debug.Assert(cLastCharForNoNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNoNextNukta in bLastATR mode"); // Keep processing this byte } else if (bLastVirama) { // If last was Virama, then we might need ZWNJ or ZWJ instead if (b == Virama) { // If no room, then stop if (!buffer.AddChar(ZWNJ)) break; bLastVirama = false; continue; } if (b == Nukta) { // If no room, then stop if (!buffer.AddChar(ZWJ)) break; bLastVirama = false; continue; } // No longer in this mode, fall through to handle character // (Virama itself was added when flag was set last iteration) bLastVirama = false; // We know we can't have any of these other modes Debug.Assert(bLastATR == false, "[ISCIIEncoding.GetChars] Expected no bLastATR in bLastVirama mode"); Debug.Assert(bLastDevenagariStressAbbr == false, "[ISCIIEncoding.GetChars] Expected no bLastDevenagariStressAbbr in bLastVirama mode"); Debug.Assert(cLastCharForNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNextNukta in bLastVirama mode"); Debug.Assert(cLastCharForNoNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNoNextNukta in bLastVirama mode"); } else if (bLastDevenagariStressAbbr) { // Last byte was an 0xf0 (ext). // If current is b8 or bf, then we have 952 or 970. Otherwise fallback if (b == 0xb8) { // It was a 0xb8 if (!buffer.AddChar('\x0952')) // Devanagari stress sign anudatta break; bLastDevenagariStressAbbr = false; continue; } if (b == 0xbf) { // It was a 0xbf if (!buffer.AddChar('\x0970')) // Devanagari abbr. sign break; bLastDevenagariStressAbbr = false; continue; } // Wasn't an expected pattern, do fallback for f0 (ext) // if fails, fallback will back up our buffer if (!buffer.Fallback(DevenagariExt)) break; // Keep processing this byte (turn off mode) // (last character was added when mode was set) bLastDevenagariStressAbbr = false; Debug.Assert(bLastATR == false, "[ISCIIEncoding.GetChars] Expected no bLastATR in bLastDevenagariStressAbbr mode"); Debug.Assert(bLastVirama == false, "[ISCIIEncoding.GetChars] Expected no bLastVirama in bLastDevenagariStressAbbr mode"); Debug.Assert(cLastCharForNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNextNukta in bLastDevenagariStressAbbr mode"); Debug.Assert(cLastCharForNoNextNukta == (char)0, "[ISCIIEncoding.GetChars] Expected no cLastCharForNoNextNukta in bLastDevenagariStressAbbr mode"); } else { // We were checking for next char being a nukta Debug.Assert(cLastCharForNextNukta > 0 && cLastCharForNoNextNukta > 0, "[ISCIIEncoding.GetChars]No other special case found, but cLastCharFor(No)NextNukta variable(s) aren't set."); // We'll either add combined char or last char if (b == Nukta) { // We combine nukta with previous char if (!buffer.AddChar(cLastCharForNextNukta)) break; // Done already cLastCharForNextNukta = cLastCharForNoNextNukta = '\0'; continue; } // No Nukta, just add last character and keep processing current byte if (!buffer.AddChar(cLastCharForNoNextNukta)) break; // Keep processing this byte, turn off mode. cLastCharForNextNukta = cLastCharForNoNextNukta = '\0'; Debug.Assert(bLastATR == false, "[ISCIIEncoding.GetChars] Expected no bLastATR in cLastCharForNextNukta mode"); Debug.Assert(bLastVirama == false, "[ISCIIEncoding.GetChars] Expected no bLastVirama in cLastCharForNextNukta mode"); Debug.Assert(bLastDevenagariStressAbbr == false, "[ISCIIEncoding.GetChars] Expected no bLastDevenagariStressAbbr in cLastCharForNextNukta mode"); } } // Now bLastSpecial should be false and all flags false. Debug.Assert(!bLastSpecial && !bLastDevenagariStressAbbr && !bLastVirama && !bLastATR && cLastCharForNextNukta == '\0', "[ISCIIEncoding.GetChars]No special state for last code point should exist at this point."); // If its a simple byte, just add it if (b < MultiByteBegin) { if (!buffer.AddChar((char)b)) break; continue; } // See if its an ATR marker if (b == ControlATR) { bLastATR = bLastSpecial = true; continue; } Debug.Assert(currentCodePageIndex != -1, "[ISCIIEncoding.GetChars]Expected valid currentCodePageIndex != -1"); char ch = s_IndicMapping[currentCodePageIndex, 0, b - MultiByteBegin]; char cAlt = s_IndicMapping[currentCodePageIndex, 1, b - MultiByteBegin]; // If no 2nd char, just add it, also lonely Nuktas get added as well. if (cAlt == 0 || b == Nukta) { // If it was an unknown character do fallback // ? if not known. if (ch == 0) { // Fallback the unknown byte if (!buffer.Fallback(b)) break; } else { // Add the known character if (!buffer.AddChar(ch)) break; } continue; } // if b == Virama set last Virama so we can do ZWJ or ZWNJ next time if needed. if (b == Virama) { // Add Virama if (!buffer.AddChar(ch)) break; bLastVirama = bLastSpecial = true; continue; } // See if its one that changes with a Nukta if ((cAlt & 0xF000) == 0) { // It could change if next char is a nukta bLastSpecial = true; cLastCharForNextNukta = cAlt; cLastCharForNoNextNukta = ch; continue; } // We must be the Devenagari special case for F0, B8 & F0, BF Debug.Assert(currentCodePage == CodeDevanagari && b == DevenagariExt, $"[ISCIIEncoding.GetChars] Devenagari special case must {DevenagariExt} not {b} or in Devanagari code page {CodeDevanagari} not {currentCodePage}."); bLastDevenagariStressAbbr = bLastSpecial = true; } // If we don't have a decoder, or if we had to flush, then we need to get rid // of last ATR, LastNoNextNukta and LastDevenagariExt. if (decoder == null || decoder.MustFlush) { // If these fail (because of Convert with insufficient buffer), then they'll turn off MustFlush as well. if (bLastATR) { // Have to add ATR fallback if (buffer.Fallback(ControlATR)) bLastATR = false; else // If not successful, convert will maintain state for next time, also // AddChar will have decremented our byte count, however we need it to remain the same buffer.GetNextByte(); } else if (bLastDevenagariStressAbbr) { // Have to do fallback for DevenagariExt if (buffer.Fallback(DevenagariExt)) bLastDevenagariStressAbbr = false; else // If not successful, convert will maintain state for next time, also // AddChar will have decremented our byte count, however we need it to remain the same buffer.GetNextByte(); } else if (cLastCharForNoNextNukta != '\0') { // Have to add our last char because there was no next nukta if (buffer.AddChar(cLastCharForNoNextNukta)) cLastCharForNoNextNukta = cLastCharForNextNukta = '\0'; else // If not successful, convert will maintain state for next time, also // AddChar will have decremented our byte count, however we need it to remain the same buffer.GetNextByte(); } // LastVirama is unimportant for flushing decoder. } // Remember any left over stuff // (only remember if we aren't counting) if (decoder != null && chars != null) { // If not flushing or have state (from convert) then need to remember state if (!decoder.MustFlush || cLastCharForNoNextNukta != '\0' || bLastATR || bLastDevenagariStressAbbr) { // Either not flushing or had state (from convert) Debug.Assert(!decoder.MustFlush || !decoder.m_throwOnOverflow, "[ISCIIEncoding.GetChars]Expected no state or not converting or not flushing"); decoder.currentCodePage = currentCodePage; decoder.bLastVirama = bLastVirama; decoder.bLastATR = bLastATR; decoder.bLastDevenagariStressAbbr = bLastDevenagariStressAbbr; decoder.cLastCharForNextNukta = cLastCharForNextNukta; decoder.cLastCharForNoNextNukta = cLastCharForNoNextNukta; } else { decoder.currentCodePage = _defaultCodePage; decoder.bLastVirama = false; decoder.bLastATR = false; decoder.bLastDevenagariStressAbbr = false; decoder.cLastCharForNextNukta = '\0'; decoder.cLastCharForNoNextNukta = '\0'; } decoder.m_bytesUsed = buffer.BytesUsed; } // Otherwise we already did fallback and added extra things // Return the # of characters we found return buffer.Count; } public override Decoder GetDecoder() { return new ISCIIDecoder(this); } public override Encoder GetEncoder() { return new ISCIIEncoder(this); } public override int GetHashCode() { //Not great distribution, but this is relatively unlikely to be used as the key in a hashtable. return _defaultCodePage + EncoderFallback.GetHashCode() + DecoderFallback.GetHashCode(); } internal class ISCIIEncoder : EncoderNLS { // Need to remember the default code page (for HasState) internal int defaultCodePage = 0; // Need a place for the current code page internal int currentCodePage = 0; // Was the last character a virama? (Because ZWJ and ZWNJ are different then) internal bool bLastVirama = false; public ISCIIEncoder(EncodingNLS encoding) : base(encoding) { currentCodePage = defaultCodePage = encoding.CodePage - 57000; // base calls reset } // Warning: If you're decoding mixed encoding files or something, this could be confusing // We don't always force back to base encoding mapping, so if you reset where do you restart? public override void Reset() { bLastVirama = false; charLeftOver = (char)0; if (m_fallbackBuffer != null) m_fallbackBuffer.Reset(); } // Anything left in our encoder? // Encoder not only has to get rid of left over characters, but it has to switch back to the current code page. internal override bool HasState { get { return (charLeftOver != (char)0 || currentCodePage != defaultCodePage); } } } internal class ISCIIDecoder : DecoderNLS { // Need a place to store any our current code page and last ATR flag internal int currentCodePage = 0; internal bool bLastATR = false; internal bool bLastVirama = false; internal bool bLastDevenagariStressAbbr = false; internal char cLastCharForNextNukta = '\0'; internal char cLastCharForNoNextNukta = '\0'; public ISCIIDecoder(EncodingNLS encoding) : base(encoding) { currentCodePage = encoding.CodePage - 57000; // base calls reset } // Warning: If you're decoding mixed encoding files or something, this could be confusing // We don't always force back to base encoding mapping, so if you reset where do you restart? public override void Reset() { bLastATR = false; bLastVirama = false; bLastDevenagariStressAbbr = false; cLastCharForNextNukta = '\0'; cLastCharForNoNextNukta = '\0'; if (m_fallbackBuffer != null) m_fallbackBuffer.Reset(); } // Anything left in our decoder? internal override bool HasState { get { return (cLastCharForNextNukta != '\0' || cLastCharForNoNextNukta != '\0' || bLastATR || bLastDevenagariStressAbbr); } } } // // ISCII Tables // // From Windows ISCII\tables.c // //////////////////////////////////////////////////////////////////////////// // // Char to Byte // // 0xXYZZ Where Y is the code page "font" part and ZZ is the byte character // The high X bits also reference the SecondIndicByte table if an // extra byte is needed. // 0x0000 For undefined characters // // This is valid for values IndicBegin to IndicEnd // // WARNING: When this was copied from windows, the ? characters (0x003F) were // searched/replaced with 0x0000. // //////////////////////////////////////////////////////////////////////////// private static int[] s_UnicodeToIndicChar = { 0x02a1, // U+0901 : Devanagari Sign Candrabindu 0x02a2, // U+0902 : Devanagari Sign Anusvara 0x02a3, // U+0903 : Devanagari Sign Visarga 0x0000, // U+0904 : Undefined 0x02a4, // U+0905 : Devanagari Letter A 0x02a5, // U+0906 : Devanagari Letter Aa 0x02a6, // U+0907 : Devanagari Letter I 0x02a7, // U+0908 : Devanagari Letter Ii 0x02a8, // U+0909 : Devanagari Letter U 0x02a9, // U+090a : Devanagari Letter Uu 0x02aa, // U+090b : Devanagari Letter Vocalic R 0x12a6, // U+090c : Devanagari Letter Vocalic L 0x02ae, // U+090d : Devanagari Letter Candra E 0x02ab, // U+090e : Devanagari Letter Short E 0x02ac, // U+090f : Devanagari Letter E 0x02ad, // U+0910 : Devanagari Letter Ai 0x02b2, // U+0911 : Devanagari Letter Candra O 0x02af, // U+0912 : Devanagari Letter Short O 0x02b0, // U+0913 : Devanagari Letter O 0x02b1, // U+0914 : Devanagari Letter Au 0x02b3, // U+0915 : Devanagari Letter Ka 0x02b4, // U+0916 : Devanagari Letter Kha 0x02b5, // U+0917 : Devanagari Letter Ga 0x02b6, // U+0918 : Devanagari Letter Gha 0x02b7, // U+0919 : Devanagari Letter Nga 0x02b8, // U+091a : Devanagari Letter Ca 0x02b9, // U+091b : Devanagari Letter Cha 0x02ba, // U+091c : Devanagari Letter Ja 0x02bb, // U+091d : Devanagari Letter Jha 0x02bc, // U+091e : Devanagari Letter Nya 0x02bd, // U+091f : Devanagari Letter Tta 0x02be, // U+0920 : Devanagari Letter Ttha 0x02bf, // U+0921 : Devanagari Letter Dda 0x02c0, // U+0922 : Devanagari Letter Ddha 0x02c1, // U+0923 : Devanagari Letter Nna 0x02c2, // U+0924 : Devanagari Letter Ta 0x02c3, // U+0925 : Devanagari Letter Tha 0x02c4, // U+0926 : Devanagari Letter Da 0x02c5, // U+0927 : Devanagari Letter Dha 0x02c6, // U+0928 : Devanagari Letter Na 0x02c7, // U+0929 : Devanagari Letter Nnna 0x02c8, // U+092a : Devanagari Letter Pa 0x02c9, // U+092b : Devanagari Letter Pha 0x02ca, // U+092c : Devanagari Letter Ba 0x02cb, // U+092d : Devanagari Letter Bha 0x02cc, // U+092e : Devanagari Letter Ma 0x02cd, // U+092f : Devanagari Letter Ya 0x02cf, // U+0930 : Devanagari Letter Ra 0x02d0, // U+0931 : Devanagari Letter Rra 0x02d1, // U+0932 : Devanagari Letter La 0x02d2, // U+0933 : Devanagari Letter Lla 0x02d3, // U+0934 : Devanagari Letter Llla 0x02d4, // U+0935 : Devanagari Letter Va 0x02d5, // U+0936 : Devanagari Letter Sha 0x02d6, // U+0937 : Devanagari Letter Ssa 0x02d7, // U+0938 : Devanagari Letter Sa 0x02d8, // U+0939 : Devanagari Letter Ha 0x0000, // U+093a : Undefined 0x0000, // U+093b : Undefined 0x02e9, // U+093c : Devanagari Sign Nukta 0x12ea, // U+093d : Devanagari Sign Avagraha 0x02da, // U+093e : Devanagari Vowel Sign Aa 0x02db, // U+093f : Devanagari Vowel Sign I 0x02dc, // U+0940 : Devanagari Vowel Sign Ii 0x02dd, // U+0941 : Devanagari Vowel Sign U 0x02de, // U+0942 : Devanagari Vowel Sign Uu 0x02df, // U+0943 : Devanagari Vowel Sign Vocalic R 0x12df, // U+0944 : Devanagari Vowel Sign Vocalic Rr 0x02e3, // U+0945 : Devanagari Vowel Sign Candra E 0x02e0, // U+0946 : Devanagari Vowel Sign Short E 0x02e1, // U+0947 : Devanagari Vowel Sign E 0x02e2, // U+0948 : Devanagari Vowel Sign Ai 0x02e7, // U+0949 : Devanagari Vowel Sign Candra O 0x02e4, // U+094a : Devanagari Vowel Sign Short O 0x02e5, // U+094b : Devanagari Vowel Sign O 0x02e6, // U+094c : Devanagari Vowel Sign Au 0x02e8, // U+094d : Devanagari Sign Virama 0x0000, // U+094e : Undefined 0x0000, // U+094f : Undefined 0x12a1, // U+0950 : Devanagari Om 0x0000, // U+0951 : Devanagari Stress Sign Udatta 0x22f0, // U+0952 : Devanagari Stress Sign Anudatta 0x0000, // U+0953 : Devanagari Grave Accent 0x0000, // U+0954 : Devanagari Acute Accent 0x0000, // U+0955 : Undefined 0x0000, // U+0956 : Undefined 0x0000, // U+0957 : Undefined 0x12b3, // U+0958 : Devanagari Letter Qa 0x12b4, // U+0959 : Devanagari Letter Khha 0x12b5, // U+095a : Devanagari Letter Ghha 0x12ba, // U+095b : Devanagari Letter Za 0x12bf, // U+095c : Devanagari Letter Dddha 0x12c0, // U+095d : Devanagari Letter Rha 0x12c9, // U+095e : Devanagari Letter Fa 0x02ce, // U+095f : Devanagari Letter Yya 0x12aa, // U+0960 : Devanagari Letter Vocalic Rr 0x12a7, // U+0961 : Devanagari Letter Vocalic Ll 0x12db, // U+0962 : Devanagari Vowel Sign Vocalic L 0x12dc, // U+0963 : Devanagari Vowel Sign Vocalic Ll 0x02ea, // U+0964 : Devanagari Danda 0x0000, // U+0965 : Devanagari Double Danda 0x02f1, // U+0966 : Devanagari Digit Zero 0x02f2, // U+0967 : Devanagari Digit One 0x02f3, // U+0968 : Devanagari Digit Two 0x02f4, // U+0969 : Devanagari Digit Three 0x02f5, // U+096a : Devanagari Digit Four 0x02f6, // U+096b : Devanagari Digit Five 0x02f7, // U+096c : Devanagari Digit Six 0x02f8, // U+096d : Devanagari Digit Seven 0x02f9, // U+096e : Devanagari Digit Eight 0x02fa, // U+096f : Devanagari Digit Nine 0x32f0, // U+0970 : Devanagari Abbreviation Sign 0x0000, // U+0971 : Undefined 0x0000, // U+0972 : Undefined 0x0000, // U+0973 : Undefined 0x0000, // U+0974 : Undefined 0x0000, // U+0975 : Undefined 0x0000, // U+0976 : Undefined 0x0000, // U+0977 : Undefined 0x0000, // U+0978 : Undefined 0x0000, // U+0979 : Undefined 0x0000, // U+097a : Undefined 0x0000, // U+097b : Undefined 0x0000, // U+097c : Undefined 0x0000, // U+097d : Undefined 0x0000, // U+097e : Undefined 0x0000, // U+097f : Undefined 0x0000, // U+0980 : Undefined 0x03a1, // U+0981 : Bengali Sign Candrabindu 0x03a2, // U+0982 : Bengali Sign Anusvara 0x03a3, // U+0983 : Bengali Sign Visarga 0x0000, // U+0984 : Undefined 0x03a4, // U+0985 : Bengali Letter A 0x03a5, // U+0986 : Bengali Letter Aa 0x03a6, // U+0987 : Bengali Letter I 0x03a7, // U+0988 : Bengali Letter Ii 0x03a8, // U+0989 : Bengali Letter U 0x03a9, // U+098a : Bengali Letter Uu 0x03aa, // U+098b : Bengali Letter Vocalic R 0x13a6, // U+098c : Bengali Letter Vocalic L 0x0000, // U+098d : Undefined 0x0000, // U+098e : Undefined 0x03ab, // U+098f : Bengali Letter E 0x03ad, // U+0990 : Bengali Letter Ai 0x0000, // U+0991 : Undefined 0x0000, // U+0992 : Undefined 0x03af, // U+0993 : Bengali Letter O 0x03b1, // U+0994 : Bengali Letter Au 0x03b3, // U+0995 : Bengali Letter Ka 0x03b4, // U+0996 : Bengali Letter Kha 0x03b5, // U+0997 : Bengali Letter Ga 0x03b6, // U+0998 : Bengali Letter Gha 0x03b7, // U+0999 : Bengali Letter Nga 0x03b8, // U+099a : Bengali Letter Ca 0x03b9, // U+099b : Bengali Letter Cha 0x03ba, // U+099c : Bengali Letter Ja 0x03bb, // U+099d : Bengali Letter Jha 0x03bc, // U+099e : Bengali Letter Nya 0x03bd, // U+099f : Bengali Letter Tta 0x03be, // U+09a0 : Bengali Letter Ttha 0x03bf, // U+09a1 : Bengali Letter Dda 0x03c0, // U+09a2 : Bengali Letter Ddha 0x03c1, // U+09a3 : Bengali Letter Nna 0x03c2, // U+09a4 : Bengali Letter Ta 0x03c3, // U+09a5 : Bengali Letter Tha 0x03c4, // U+09a6 : Bengali Letter Da 0x03c5, // U+09a7 : Bengali Letter Dha 0x03c6, // U+09a8 : Bengali Letter Na 0x0000, // U+09a9 : Undefined 0x03c8, // U+09aa : Bengali Letter Pa 0x03c9, // U+09ab : Bengali Letter Pha 0x03ca, // U+09ac : Bengali Letter Ba 0x03cb, // U+09ad : Bengali Letter Bha 0x03cc, // U+09ae : Bengali Letter Ma 0x03cd, // U+09af : Bengali Letter Ya 0x03cf, // U+09b0 : Bengali Letter Ra 0x0000, // U+09b1 : Undefined 0x03d1, // U+09b2 : Bengali Letter La 0x0000, // U+09b3 : Undefined 0x0000, // U+09b4 : Undefined 0x0000, // U+09b5 : Undefined 0x03d5, // U+09b6 : Bengali Letter Sha 0x03d6, // U+09b7 : Bengali Letter Ssa 0x03d7, // U+09b8 : Bengali Letter Sa 0x03d8, // U+09b9 : Bengali Letter Ha 0x0000, // U+09ba : Undefined 0x0000, // U+09bb : Undefined 0x03e9, // U+09bc : Bengali Sign Nukta 0x0000, // U+09bd : Undefined 0x03da, // U+09be : Bengali Vowel Sign Aa 0x03db, // U+09bf : Bengali Vowel Sign I 0x03dc, // U+09c0 : Bengali Vowel Sign Ii 0x03dd, // U+09c1 : Bengali Vowel Sign U 0x03de, // U+09c2 : Bengali Vowel Sign Uu 0x03df, // U+09c3 : Bengali Vowel Sign Vocalic R 0x13df, // U+09c4 : Bengali Vowel Sign Vocalic Rr 0x0000, // U+09c5 : Undefined 0x0000, // U+09c6 : Undefined 0x03e0, // U+09c7 : Bengali Vowel Sign E 0x03e2, // U+09c8 : Bengali Vowel Sign Ai 0x0000, // U+09c9 : Undefined 0x0000, // U+09ca : Undefined 0x03e4, // U+09cb : Bengali Vowel Sign O 0x03e6, // U+09cc : Bengali Vowel Sign Au 0x03e8, // U+09cd : Bengali Sign Virama 0x0000, // U+09ce : Undefined 0x0000, // U+09cf : Undefined 0x0000, // U+09d0 : Undefined 0x0000, // U+09d1 : Undefined 0x0000, // U+09d2 : Undefined 0x0000, // U+09d3 : Undefined 0x0000, // U+09d4 : Undefined 0x0000, // U+09d5 : Undefined 0x0000, // U+09d6 : Undefined 0x0000, // U+09d7 : Bengali Au Length Mark 0x0000, // U+09d8 : Undefined 0x0000, // U+09d9 : Undefined 0x0000, // U+09da : Undefined 0x0000, // U+09db : Undefined 0x13bf, // U+09dc : Bengali Letter Rra 0x13c0, // U+09dd : Bengali Letter Rha 0x0000, // U+09de : Undefined 0x03ce, // U+09df : Bengali Letter Yya 0x13aa, // U+09e0 : Bengali Letter Vocalic Rr 0x13a7, // U+09e1 : Bengali Letter Vocalic Ll 0x13db, // U+09e2 : Bengali Vowel Sign Vocalic L 0x13dc, // U+09e3 : Bengali Vowel Sign Vocalic Ll 0x0000, // U+09e4 : Undefined 0x0000, // U+09e5 : Undefined 0x03f1, // U+09e6 : Bengali Digit Zero 0x03f2, // U+09e7 : Bengali Digit One 0x03f3, // U+09e8 : Bengali Digit Two 0x03f4, // U+09e9 : Bengali Digit Three 0x03f5, // U+09ea : Bengali Digit Four 0x03f6, // U+09eb : Bengali Digit Five 0x03f7, // U+09ec : Bengali Digit Six 0x03f8, // U+09ed : Bengali Digit Seven 0x03f9, // U+09ee : Bengali Digit Eight 0x03fa, // U+09ef : Bengali Digit Nine 0x0000, // U+09f0 : Bengali Letter Ra With Middle Diagonal 0x0000, // U+09f1 : Bengali Letter Ra With Lower Diagonal 0x0000, // U+09f2 : Bengali Rupee Mark 0x0000, // U+09f3 : Bengali Rupee Sign 0x0000, // U+09f4 : Bengali Currency Numerator One 0x0000, // U+09f5 : Bengali Currency Numerator Two 0x0000, // U+09f6 : Bengali Currency Numerator Three 0x0000, // U+09f7 : Bengali Currency Numerator Four 0x0000, // U+09f8 : Bengali Currency Numerator One Less Than The Denominator 0x0000, // U+09f9 : Bengali Currency Denominator Sixteen 0x0000, // U+09fa : Bengali Isshar 0x0000, // U+09fb : Undefined 0x0000, // U+09fc : Undefined 0x0000, // U+09fd : Undefined 0x0000, // U+09fe : Undefined 0x0000, // U+09ff : Undefined 0x0000, // U+0a00 : Undefined 0x0000, // U+0a01 : Undefined 0x0ba2, // U+0a02 : Gurmukhi Sign Bindi 0x0000, // U+0a03 : Undefined 0x0000, // U+0a04 : Undefined 0x0ba4, // U+0a05 : Gurmukhi Letter A 0x0ba5, // U+0a06 : Gurmukhi Letter Aa 0x0ba6, // U+0a07 : Gurmukhi Letter I 0x0ba7, // U+0a08 : Gurmukhi Letter Ii 0x0ba8, // U+0a09 : Gurmukhi Letter U 0x0ba9, // U+0a0a : Gurmukhi Letter Uu 0x0000, // U+0a0b : Undefined 0x0000, // U+0a0c : Undefined 0x0000, // U+0a0d : Undefined 0x0000, // U+0a0e : Undefined 0x0bab, // U+0a0f : Gurmukhi Letter Ee 0x0bad, // U+0a10 : Gurmukhi Letter Ai 0x0000, // U+0a11 : Undefined 0x0000, // U+0a12 : Undefined 0x0bb0, // U+0a13 : Gurmukhi Letter Oo 0x0bb1, // U+0a14 : Gurmukhi Letter Au 0x0bb3, // U+0a15 : Gurmukhi Letter Ka 0x0bb4, // U+0a16 : Gurmukhi Letter Kha 0x0bb5, // U+0a17 : Gurmukhi Letter Ga 0x0bb6, // U+0a18 : Gurmukhi Letter Gha 0x0bb7, // U+0a19 : Gurmukhi Letter Nga 0x0bb8, // U+0a1a : Gurmukhi Letter Ca 0x0bb9, // U+0a1b : Gurmukhi Letter Cha 0x0bba, // U+0a1c : Gurmukhi Letter Ja 0x0bbb, // U+0a1d : Gurmukhi Letter Jha 0x0bbc, // U+0a1e : Gurmukhi Letter Nya 0x0bbd, // U+0a1f : Gurmukhi Letter Tta 0x0bbe, // U+0a20 : Gurmukhi Letter Ttha 0x0bbf, // U+0a21 : Gurmukhi Letter Dda 0x0bc0, // U+0a22 : Gurmukhi Letter Ddha 0x0bc1, // U+0a23 : Gurmukhi Letter Nna 0x0bc2, // U+0a24 : Gurmukhi Letter Ta 0x0bc3, // U+0a25 : Gurmukhi Letter Tha 0x0bc4, // U+0a26 : Gurmukhi Letter Da 0x0bc5, // U+0a27 : Gurmukhi Letter Dha 0x0bc6, // U+0a28 : Gurmukhi Letter Na 0x0000, // U+0a29 : Undefined 0x0bc8, // U+0a2a : Gurmukhi Letter Pa 0x0bc9, // U+0a2b : Gurmukhi Letter Pha 0x0bca, // U+0a2c : Gurmukhi Letter Ba 0x0bcb, // U+0a2d : Gurmukhi Letter Bha 0x0bcc, // U+0a2e : Gurmukhi Letter Ma 0x0bcd, // U+0a2f : Gurmukhi Letter Ya 0x0bcf, // U+0a30 : Gurmukhi Letter Ra 0x0000, // U+0a31 : Undefined 0x0bd1, // U+0a32 : Gurmukhi Letter La 0x0bd2, // U+0a33 : Gurmukhi Letter Lla 0x0000, // U+0a34 : Undefined 0x0bd4, // U+0a35 : Gurmukhi Letter Va 0x0bd5, // U+0a36 : Gurmukhi Letter Sha 0x0000, // U+0a37 : Undefined 0x0bd7, // U+0a38 : Gurmukhi Letter Sa 0x0bd8, // U+0a39 : Gurmukhi Letter Ha 0x0000, // U+0a3a : Undefined 0x0000, // U+0a3b : Undefined 0x0be9, // U+0a3c : Gurmukhi Sign Nukta 0x0000, // U+0a3d : Undefined 0x0bda, // U+0a3e : Gurmukhi Vowel Sign Aa 0x0bdb, // U+0a3f : Gurmukhi Vowel Sign I 0x0bdc, // U+0a40 : Gurmukhi Vowel Sign Ii 0x0bdd, // U+0a41 : Gurmukhi Vowel Sign U 0x0bde, // U+0a42 : Gurmukhi Vowel Sign Uu 0x0000, // U+0a43 : Undefined 0x0000, // U+0a44 : Undefined 0x0000, // U+0a45 : Undefined 0x0000, // U+0a46 : Undefined 0x0be0, // U+0a47 : Gurmukhi Vowel Sign Ee 0x0be2, // U+0a48 : Gurmukhi Vowel Sign Ai 0x0000, // U+0a49 : Undefined 0x0000, // U+0a4a : Undefined 0x0be4, // U+0a4b : Gurmukhi Vowel Sign Oo 0x0be6, // U+0a4c : Gurmukhi Vowel Sign Au 0x0be8, // U+0a4d : Gurmukhi Sign Virama 0x0000, // U+0a4e : Undefined 0x0000, // U+0a4f : Undefined 0x0000, // U+0a50 : Undefined 0x0000, // U+0a51 : Undefined 0x0000, // U+0a52 : Undefined 0x0000, // U+0a53 : Undefined 0x0000, // U+0a54 : Undefined 0x0000, // U+0a55 : Undefined 0x0000, // U+0a56 : Undefined 0x0000, // U+0a57 : Undefined 0x0000, // U+0a58 : Undefined 0x1bb4, // U+0a59 : Gurmukhi Letter Khha 0x1bb5, // U+0a5a : Gurmukhi Letter Ghha 0x1bba, // U+0a5b : Gurmukhi Letter Za 0x1bc0, // U+0a5c : Gurmukhi Letter Rra 0x0000, // U+0a5d : Undefined 0x1bc9, // U+0a5e : Gurmukhi Letter Fa 0x0000, // U+0a5f : Undefined 0x0000, // U+0a60 : Undefined 0x0000, // U+0a61 : Undefined 0x0000, // U+0a62 : Undefined 0x0000, // U+0a63 : Undefined 0x0000, // U+0a64 : Undefined 0x0000, // U+0a65 : Undefined 0x0bf1, // U+0a66 : Gurmukhi Digit Zero 0x0bf2, // U+0a67 : Gurmukhi Digit One 0x0bf3, // U+0a68 : Gurmukhi Digit Two 0x0bf4, // U+0a69 : Gurmukhi Digit Three 0x0bf5, // U+0a6a : Gurmukhi Digit Four 0x0bf6, // U+0a6b : Gurmukhi Digit Five 0x0bf7, // U+0a6c : Gurmukhi Digit Six 0x0bf8, // U+0a6d : Gurmukhi Digit Seven 0x0bf9, // U+0a6e : Gurmukhi Digit Eight 0x0bfa, // U+0a6f : Gurmukhi Digit Nine 0x0000, // U+0a70 : Gurmukhi Tippi 0x0000, // U+0a71 : Gurmukhi Addak 0x0000, // U+0a72 : Gurmukhi Iri 0x0000, // U+0a73 : Gurmukhi Ura 0x0000, // U+0a74 : Gurmukhi Ek Onkar 0x0000, // U+0a75 : Undefined 0x0000, // U+0a76 : Undefined 0x0000, // U+0a77 : Undefined 0x0000, // U+0a78 : Undefined 0x0000, // U+0a79 : Undefined 0x0000, // U+0a7a : Undefined 0x0000, // U+0a7b : Undefined 0x0000, // U+0a7c : Undefined 0x0000, // U+0a7d : Undefined 0x0000, // U+0a7e : Undefined 0x0000, // U+0a7f : Undefined 0x0000, // U+0a80 : Undefined 0x0aa1, // U+0a81 : Gujarati Sign Candrabindu 0x0aa2, // U+0a82 : Gujarati Sign Anusvara 0x0aa3, // U+0a83 : Gujarati Sign Visarga 0x0000, // U+0a84 : Undefined 0x0aa4, // U+0a85 : Gujarati Letter A 0x0aa5, // U+0a86 : Gujarati Letter Aa 0x0aa6, // U+0a87 : Gujarati Letter I 0x0aa7, // U+0a88 : Gujarati Letter Ii 0x0aa8, // U+0a89 : Gujarati Letter U 0x0aa9, // U+0a8a : Gujarati Letter Uu 0x0aaa, // U+0a8b : Gujarati Letter Vocalic R 0x0000, // U+0a8c : Undefined 0x0aae, // U+0a8d : Gujarati Vowel Candra E 0x0000, // U+0a8e : Undefined 0x0aab, // U+0a8f : Gujarati Letter E 0x0aad, // U+0a90 : Gujarati Letter Ai 0x0ab2, // U+0a91 : Gujarati Vowel Candra O 0x0000, // U+0a92 : Undefined 0x0ab0, // U+0a93 : Gujarati Letter O 0x0ab1, // U+0a94 : Gujarati Letter Au 0x0ab3, // U+0a95 : Gujarati Letter Ka 0x0ab4, // U+0a96 : Gujarati Letter Kha 0x0ab5, // U+0a97 : Gujarati Letter Ga 0x0ab6, // U+0a98 : Gujarati Letter Gha 0x0ab7, // U+0a99 : Gujarati Letter Nga 0x0ab8, // U+0a9a : Gujarati Letter Ca 0x0ab9, // U+0a9b : Gujarati Letter Cha 0x0aba, // U+0a9c : Gujarati Letter Ja 0x0abb, // U+0a9d : Gujarati Letter Jha 0x0abc, // U+0a9e : Gujarati Letter Nya 0x0abd, // U+0a9f : Gujarati Letter Tta 0x0abe, // U+0aa0 : Gujarati Letter Ttha 0x0abf, // U+0aa1 : Gujarati Letter Dda 0x0ac0, // U+0aa2 : Gujarati Letter Ddha 0x0ac1, // U+0aa3 : Gujarati Letter Nna 0x0ac2, // U+0aa4 : Gujarati Letter Ta 0x0ac3, // U+0aa5 : Gujarati Letter Tha 0x0ac4, // U+0aa6 : Gujarati Letter Da 0x0ac5, // U+0aa7 : Gujarati Letter Dha 0x0ac6, // U+0aa8 : Gujarati Letter Na 0x0000, // U+0aa9 : Undefined 0x0ac8, // U+0aaa : Gujarati Letter Pa 0x0ac9, // U+0aab : Gujarati Letter Pha 0x0aca, // U+0aac : Gujarati Letter Ba 0x0acb, // U+0aad : Gujarati Letter Bha 0x0acc, // U+0aae : Gujarati Letter Ma 0x0acd, // U+0aaf : Gujarati Letter Ya 0x0acf, // U+0ab0 : Gujarati Letter Ra 0x0000, // U+0ab1 : Undefined 0x0ad1, // U+0ab2 : Gujarati Letter La 0x0ad2, // U+0ab3 : Gujarati Letter Lla 0x0000, // U+0ab4 : Undefined 0x0ad4, // U+0ab5 : Gujarati Letter Va 0x0ad5, // U+0ab6 : Gujarati Letter Sha 0x0ad6, // U+0ab7 : Gujarati Letter Ssa 0x0ad7, // U+0ab8 : Gujarati Letter Sa 0x0ad8, // U+0ab9 : Gujarati Letter Ha 0x0000, // U+0aba : Undefined 0x0000, // U+0abb : Undefined 0x0ae9, // U+0abc : Gujarati Sign Nukta 0x1aea, // U+0abd : Gujarati Sign Avagraha 0x0ada, // U+0abe : Gujarati Vowel Sign Aa 0x0adb, // U+0abf : Gujarati Vowel Sign I 0x0adc, // U+0ac0 : Gujarati Vowel Sign Ii 0x0add, // U+0ac1 : Gujarati Vowel Sign U 0x0ade, // U+0ac2 : Gujarati Vowel Sign Uu 0x0adf, // U+0ac3 : Gujarati Vowel Sign Vocalic R 0x1adf, // U+0ac4 : Gujarati Vowel Sign Vocalic Rr 0x0ae3, // U+0ac5 : Gujarati Vowel Sign Candra E 0x0000, // U+0ac6 : Undefined 0x0ae0, // U+0ac7 : Gujarati Vowel Sign E 0x0ae2, // U+0ac8 : Gujarati Vowel Sign Ai 0x0ae7, // U+0ac9 : Gujarati Vowel Sign Candra O 0x0000, // U+0aca : Undefined 0x0ae4, // U+0acb : Gujarati Vowel Sign O 0x0ae6, // U+0acc : Gujarati Vowel Sign Au 0x0ae8, // U+0acd : Gujarati Sign Virama 0x0000, // U+0ace : Undefined 0x0000, // U+0acf : Undefined 0x1aa1, // U+0ad0 : Gujarati Om 0x0000, // U+0ad1 : Undefined 0x0000, // U+0ad2 : Undefined 0x0000, // U+0ad3 : Undefined 0x0000, // U+0ad4 : Undefined 0x0000, // U+0ad5 : Undefined 0x0000, // U+0ad6 : Undefined 0x0000, // U+0ad7 : Undefined 0x0000, // U+0ad8 : Undefined 0x0000, // U+0ad9 : Undefined 0x0000, // U+0ada : Undefined 0x0000, // U+0adb : Undefined 0x0000, // U+0adc : Undefined 0x0000, // U+0add : Undefined 0x0000, // U+0ade : Undefined 0x0000, // U+0adf : Undefined 0x1aaa, // U+0ae0 : Gujarati Letter Vocalic Rr 0x0000, // U+0ae1 : Undefined 0x0000, // U+0ae2 : Undefined 0x0000, // U+0ae3 : Undefined 0x0000, // U+0ae4 : Undefined 0x0000, // U+0ae5 : Undefined 0x0af1, // U+0ae6 : Gujarati Digit Zero 0x0af2, // U+0ae7 : Gujarati Digit One 0x0af3, // U+0ae8 : Gujarati Digit Two 0x0af4, // U+0ae9 : Gujarati Digit Three 0x0af5, // U+0aea : Gujarati Digit Four 0x0af6, // U+0aeb : Gujarati Digit Five 0x0af7, // U+0aec : Gujarati Digit Six 0x0af8, // U+0aed : Gujarati Digit Seven 0x0af9, // U+0aee : Gujarati Digit Eight 0x0afa, // U+0aef : Gujarati Digit Nine 0x0000, // U+0af0 : Undefined 0x0000, // U+0af1 : Undefined 0x0000, // U+0af2 : Undefined 0x0000, // U+0af3 : Undefined 0x0000, // U+0af4 : Undefined 0x0000, // U+0af5 : Undefined 0x0000, // U+0af6 : Undefined 0x0000, // U+0af7 : Undefined 0x0000, // U+0af8 : Undefined 0x0000, // U+0af9 : Undefined 0x0000, // U+0afa : Undefined 0x0000, // U+0afb : Undefined 0x0000, // U+0afc : Undefined 0x0000, // U+0afd : Undefined 0x0000, // U+0afe : Undefined 0x0000, // U+0aff : Undefined 0x0000, // U+0b00 : Undefined 0x07a1, // U+0b01 : Oriya Sign Candrabindu 0x07a2, // U+0b02 : Oriya Sign Anusvara 0x07a3, // U+0b03 : Oriya Sign Visarga 0x0000, // U+0b04 : Undefined 0x07a4, // U+0b05 : Oriya Letter A 0x07a5, // U+0b06 : Oriya Letter Aa 0x07a6, // U+0b07 : Oriya Letter I 0x07a7, // U+0b08 : Oriya Letter Ii 0x07a8, // U+0b09 : Oriya Letter U 0x07a9, // U+0b0a : Oriya Letter Uu 0x07aa, // U+0b0b : Oriya Letter Vocalic R 0x17a6, // U+0b0c : Oriya Letter Vocalic L 0x0000, // U+0b0d : Undefined 0x0000, // U+0b0e : Undefined 0x07ab, // U+0b0f : Oriya Letter E 0x07ad, // U+0b10 : Oriya Letter Ai 0x0000, // U+0b11 : Undefined 0x0000, // U+0b12 : Undefined 0x07b0, // U+0b13 : Oriya Letter O 0x07b1, // U+0b14 : Oriya Letter Au 0x07b3, // U+0b15 : Oriya Letter Ka 0x07b4, // U+0b16 : Oriya Letter Kha 0x07b5, // U+0b17 : Oriya Letter Ga 0x07b6, // U+0b18 : Oriya Letter Gha 0x07b7, // U+0b19 : Oriya Letter Nga 0x07b8, // U+0b1a : Oriya Letter Ca 0x07b9, // U+0b1b : Oriya Letter Cha 0x07ba, // U+0b1c : Oriya Letter Ja 0x07bb, // U+0b1d : Oriya Letter Jha 0x07bc, // U+0b1e : Oriya Letter Nya 0x07bd, // U+0b1f : Oriya Letter Tta 0x07be, // U+0b20 : Oriya Letter Ttha 0x07bf, // U+0b21 : Oriya Letter Dda 0x07c0, // U+0b22 : Oriya Letter Ddha 0x07c1, // U+0b23 : Oriya Letter Nna 0x07c2, // U+0b24 : Oriya Letter Ta 0x07c3, // U+0b25 : Oriya Letter Tha 0x07c4, // U+0b26 : Oriya Letter Da 0x07c5, // U+0b27 : Oriya Letter Dha 0x07c6, // U+0b28 : Oriya Letter Na 0x0000, // U+0b29 : Undefined 0x07c8, // U+0b2a : Oriya Letter Pa 0x07c9, // U+0b2b : Oriya Letter Pha 0x07ca, // U+0b2c : Oriya Letter Ba 0x07cb, // U+0b2d : Oriya Letter Bha 0x07cc, // U+0b2e : Oriya Letter Ma 0x07cd, // U+0b2f : Oriya Letter Ya 0x07cf, // U+0b30 : Oriya Letter Ra 0x0000, // U+0b31 : Undefined 0x07d1, // U+0b32 : Oriya Letter La 0x07d2, // U+0b33 : Oriya Letter Lla 0x0000, // U+0b34 : Undefined 0x0000, // U+0b35 : Undefined 0x07d5, // U+0b36 : Oriya Letter Sha 0x07d6, // U+0b37 : Oriya Letter Ssa 0x07d7, // U+0b38 : Oriya Letter Sa 0x07d8, // U+0b39 : Oriya Letter Ha 0x0000, // U+0b3a : Undefined 0x0000, // U+0b3b : Undefined 0x07e9, // U+0b3c : Oriya Sign Nukta 0x17ea, // U+0b3d : Oriya Sign Avagraha 0x07da, // U+0b3e : Oriya Vowel Sign Aa 0x07db, // U+0b3f : Oriya Vowel Sign I 0x07dc, // U+0b40 : Oriya Vowel Sign Ii 0x07dd, // U+0b41 : Oriya Vowel Sign U 0x07de, // U+0b42 : Oriya Vowel Sign Uu 0x07df, // U+0b43 : Oriya Vowel Sign Vocalic R 0x0000, // U+0b44 : Undefined 0x0000, // U+0b45 : Undefined 0x0000, // U+0b46 : Undefined 0x07e0, // U+0b47 : Oriya Vowel Sign E 0x07e2, // U+0b48 : Oriya Vowel Sign Ai 0x0000, // U+0b49 : Undefined 0x0000, // U+0b4a : Undefined 0x07e4, // U+0b4b : Oriya Vowel Sign O 0x07e6, // U+0b4c : Oriya Vowel Sign Au 0x07e8, // U+0b4d : Oriya Sign Virama 0x0000, // U+0b4e : Undefined 0x0000, // U+0b4f : Undefined 0x0000, // U+0b50 : Undefined 0x0000, // U+0b51 : Undefined 0x0000, // U+0b52 : Undefined 0x0000, // U+0b53 : Undefined 0x0000, // U+0b54 : Undefined 0x0000, // U+0b55 : Undefined 0x0000, // U+0b56 : Oriya Ai Length Mark 0x0000, // U+0b57 : Oriya Au Length Mark 0x0000, // U+0b58 : Undefined 0x0000, // U+0b59 : Undefined 0x0000, // U+0b5a : Undefined 0x0000, // U+0b5b : Undefined 0x17bf, // U+0b5c : Oriya Letter Rra 0x17c0, // U+0b5d : Oriya Letter Rha 0x0000, // U+0b5e : Undefined 0x07ce, // U+0b5f : Oriya Letter Yya 0x17aa, // U+0b60 : Oriya Letter Vocalic Rr 0x17a7, // U+0b61 : Oriya Letter Vocalic Ll 0x0000, // U+0b62 : Undefined 0x0000, // U+0b63 : Undefined 0x0000, // U+0b64 : Undefined 0x0000, // U+0b65 : Undefined 0x07f1, // U+0b66 : Oriya Digit Zero 0x07f2, // U+0b67 : Oriya Digit One 0x07f3, // U+0b68 : Oriya Digit Two 0x07f4, // U+0b69 : Oriya Digit Three 0x07f5, // U+0b6a : Oriya Digit Four 0x07f6, // U+0b6b : Oriya Digit Five 0x07f7, // U+0b6c : Oriya Digit Six 0x07f8, // U+0b6d : Oriya Digit Seven 0x07f9, // U+0b6e : Oriya Digit Eight 0x07fa, // U+0b6f : Oriya Digit Nine 0x0000, // U+0b70 : Oriya Isshar 0x0000, // U+0b71 : Undefined 0x0000, // U+0b72 : Undefined 0x0000, // U+0b73 : Undefined 0x0000, // U+0b74 : Undefined 0x0000, // U+0b75 : Undefined 0x0000, // U+0b76 : Undefined 0x0000, // U+0b77 : Undefined 0x0000, // U+0b78 : Undefined 0x0000, // U+0b79 : Undefined 0x0000, // U+0b7a : Undefined 0x0000, // U+0b7b : Undefined 0x0000, // U+0b7c : Undefined 0x0000, // U+0b7d : Undefined 0x0000, // U+0b7e : Undefined 0x0000, // U+0b7f : Undefined 0x0000, // U+0b80 : Undefined 0x0000, // U+0b81 : Undefined 0x04a2, // U+0b82 : Tamil Sign Anusvara 0x04a3, // U+0b83 : Tamil Sign Visarga 0x0000, // U+0b84 : Undefined 0x04a4, // U+0b85 : Tamil Letter A 0x04a5, // U+0b86 : Tamil Letter Aa 0x04a6, // U+0b87 : Tamil Letter I 0x04a7, // U+0b88 : Tamil Letter Ii 0x04a8, // U+0b89 : Tamil Letter U 0x04a9, // U+0b8a : Tamil Letter Uu 0x0000, // U+0b8b : Undefined 0x0000, // U+0b8c : Undefined 0x0000, // U+0b8d : Undefined 0x0000, // U+0b8e : Tamil Letter E 0x04ab, // U+0b8f : Tamil Letter Ee 0x04ad, // U+0b90 : Tamil Letter Ai 0x0000, // U+0b91 : Undefined 0x04af, // U+0b92 : Tamil Letter O 0x04b0, // U+0b93 : Tamil Letter Oo 0x04b1, // U+0b94 : Tamil Letter Au 0x04b3, // U+0b95 : Tamil Letter Ka 0x0000, // U+0b96 : Undefined 0x0000, // U+0b97 : Undefined 0x0000, // U+0b98 : Undefined 0x04b7, // U+0b99 : Tamil Letter Nga 0x04b8, // U+0b9a : Tamil Letter Ca 0x0000, // U+0b9b : Undefined 0x04ba, // U+0b9c : Tamil Letter Ja 0x0000, // U+0b9d : Undefined 0x04bc, // U+0b9e : Tamil Letter Nya 0x04bd, // U+0b9f : Tamil Letter Tta 0x0000, // U+0ba0 : Undefined 0x0000, // U+0ba1 : Undefined 0x0000, // U+0ba2 : Undefined 0x04c1, // U+0ba3 : Tamil Letter Nna 0x04c2, // U+0ba4 : Tamil Letter Ta 0x0000, // U+0ba5 : Undefined 0x0000, // U+0ba6 : Undefined 0x0000, // U+0ba7 : Undefined 0x04c6, // U+0ba8 : Tamil Letter Na 0x04c7, // U+0ba9 : Tamil Letter Nnna 0x04c8, // U+0baa : Tamil Letter Pa 0x0000, // U+0bab : Undefined 0x0000, // U+0bac : Undefined 0x0000, // U+0bad : Undefined 0x04cc, // U+0bae : Tamil Letter Ma 0x04cd, // U+0baf : Tamil Letter Ya 0x04cf, // U+0bb0 : Tamil Letter Ra 0x04d0, // U+0bb1 : Tamil Letter Rra 0x04d1, // U+0bb2 : Tamil Letter La 0x04d2, // U+0bb3 : Tamil Letter Lla 0x04d3, // U+0bb4 : Tamil Letter Llla 0x04d4, // U+0bb5 : Tamil Letter Va 0x0000, // U+0bb6 : Undefined 0x04d5, // U+0bb7 : Tamil Letter Ssa 0x04d7, // U+0bb8 : Tamil Letter Sa 0x04d8, // U+0bb9 : Tamil Letter Ha 0x0000, // U+0bba : Undefined 0x0000, // U+0bbb : Undefined 0x0000, // U+0bbc : Undefined 0x0000, // U+0bbd : Undefined 0x04da, // U+0bbe : Tamil Vowel Sign Aa 0x04db, // U+0bbf : Tamil Vowel Sign I 0x04dc, // U+0bc0 : Tamil Vowel Sign Ii 0x04dd, // U+0bc1 : Tamil Vowel Sign U 0x04de, // U+0bc2 : Tamil Vowel Sign Uu 0x0000, // U+0bc3 : Undefined 0x0000, // U+0bc4 : Undefined 0x0000, // U+0bc5 : Undefined 0x04e0, // U+0bc6 : Tamil Vowel Sign E 0x04e1, // U+0bc7 : Tamil Vowel Sign Ee 0x04e2, // U+0bc8 : Tamil Vowel Sign Ai 0x0000, // U+0bc9 : Undefined 0x04e4, // U+0bca : Tamil Vowel Sign O 0x04e5, // U+0bcb : Tamil Vowel Sign Oo 0x04e6, // U+0bcc : Tamil Vowel Sign Au 0x04e8, // U+0bcd : Tamil Sign Virama 0x0000, // U+0bce : Undefined 0x0000, // U+0bcf : Undefined 0x0000, // U+0bd0 : Undefined 0x0000, // U+0bd1 : Undefined 0x0000, // U+0bd2 : Undefined 0x0000, // U+0bd3 : Undefined 0x0000, // U+0bd4 : Undefined 0x0000, // U+0bd5 : Undefined 0x0000, // U+0bd6 : Undefined 0x0000, // U+0bd7 : Tamil Au Length Mark 0x0000, // U+0bd8 : Undefined 0x0000, // U+0bd9 : Undefined 0x0000, // U+0bda : Undefined 0x0000, // U+0bdb : Undefined 0x0000, // U+0bdc : Undefined 0x0000, // U+0bdd : Undefined 0x0000, // U+0bde : Undefined 0x0000, // U+0bdf : Undefined 0x0000, // U+0be0 : Undefined 0x0000, // U+0be1 : Undefined 0x0000, // U+0be2 : Undefined 0x0000, // U+0be3 : Undefined 0x0000, // U+0be4 : Undefined 0x0000, // U+0be5 : Undefined 0x0000, // U+0be6 : Undefined 0x04f2, // U+0be7 : Tamil Digit One 0x04f3, // U+0be8 : Tamil Digit Two 0x04f4, // U+0be9 : Tamil Digit Three 0x04f5, // U+0bea : Tamil Digit Four 0x04f6, // U+0beb : Tamil Digit Five 0x04f7, // U+0bec : Tamil Digit Six 0x04f8, // U+0bed : Tamil Digit Seven 0x04f9, // U+0bee : Tamil Digit Eight 0x04fa, // U+0bef : Tamil Digit Nine 0x0000, // U+0bf0 : Tamil Number Ten 0x0000, // U+0bf1 : Tamil Number One Hundred 0x0000, // U+0bf2 : Tamil Number One Thousand 0x0000, // U+0bf3 : Undefined 0x0000, // U+0bf4 : Undefined 0x0000, // U+0bf5 : Undefined 0x0000, // U+0bf6 : Undefined 0x0000, // U+0bf7 : Undefined 0x0000, // U+0bf8 : Undefined 0x0000, // U+0bf9 : Undefined 0x0000, // U+0bfa : Undefined 0x0000, // U+0bfb : Undefined 0x0000, // U+0bfc : Undefined 0x0000, // U+0bfd : Undefined 0x0000, // U+0bfe : Undefined 0x0000, // U+0bff : Undefined 0x0000, // U+0c00 : Undefined 0x05a1, // U+0c01 : Telugu Sign Candrabindu 0x05a2, // U+0c02 : Telugu Sign Anusvara 0x05a3, // U+0c03 : Telugu Sign Visarga 0x0000, // U+0c04 : Undefined 0x05a4, // U+0c05 : Telugu Letter A 0x05a5, // U+0c06 : Telugu Letter Aa 0x05a6, // U+0c07 : Telugu Letter I 0x05a7, // U+0c08 : Telugu Letter Ii 0x05a8, // U+0c09 : Telugu Letter U 0x05a9, // U+0c0a : Telugu Letter Uu 0x05aa, // U+0c0b : Telugu Letter Vocalic R 0x15a6, // U+0c0c : Telugu Letter Vocalic L 0x0000, // U+0c0d : Undefined 0x05ab, // U+0c0e : Telugu Letter E 0x05ac, // U+0c0f : Telugu Letter Ee 0x05ad, // U+0c10 : Telugu Letter Ai 0x0000, // U+0c11 : Undefined 0x05af, // U+0c12 : Telugu Letter O 0x05b0, // U+0c13 : Telugu Letter Oo 0x05b1, // U+0c14 : Telugu Letter Au 0x05b3, // U+0c15 : Telugu Letter Ka 0x05b4, // U+0c16 : Telugu Letter Kha 0x05b5, // U+0c17 : Telugu Letter Ga 0x05b6, // U+0c18 : Telugu Letter Gha 0x05b7, // U+0c19 : Telugu Letter Nga 0x05b8, // U+0c1a : Telugu Letter Ca 0x05b9, // U+0c1b : Telugu Letter Cha 0x05ba, // U+0c1c : Telugu Letter Ja 0x05bb, // U+0c1d : Telugu Letter Jha 0x05bc, // U+0c1e : Telugu Letter Nya 0x05bd, // U+0c1f : Telugu Letter Tta 0x05be, // U+0c20 : Telugu Letter Ttha 0x05bf, // U+0c21 : Telugu Letter Dda 0x05c0, // U+0c22 : Telugu Letter Ddha 0x05c1, // U+0c23 : Telugu Letter Nna 0x05c2, // U+0c24 : Telugu Letter Ta 0x05c3, // U+0c25 : Telugu Letter Tha 0x05c4, // U+0c26 : Telugu Letter Da 0x05c5, // U+0c27 : Telugu Letter Dha 0x05c6, // U+0c28 : Telugu Letter Na 0x0000, // U+0c29 : Undefined 0x05c8, // U+0c2a : Telugu Letter Pa 0x05c9, // U+0c2b : Telugu Letter Pha 0x05ca, // U+0c2c : Telugu Letter Ba 0x05cb, // U+0c2d : Telugu Letter Bha 0x05cc, // U+0c2e : Telugu Letter Ma 0x05cd, // U+0c2f : Telugu Letter Ya 0x05cf, // U+0c30 : Telugu Letter Ra 0x05d0, // U+0c31 : Telugu Letter Rra 0x05d1, // U+0c32 : Telugu Letter La 0x05d2, // U+0c33 : Telugu Letter Lla 0x0000, // U+0c34 : Undefined 0x05d4, // U+0c35 : Telugu Letter Va 0x05d5, // U+0c36 : Telugu Letter Sha 0x05d6, // U+0c37 : Telugu Letter Ssa 0x05d7, // U+0c38 : Telugu Letter Sa 0x05d8, // U+0c39 : Telugu Letter Ha 0x0000, // U+0c3a : Undefined 0x0000, // U+0c3b : Undefined 0x0000, // U+0c3c : Undefined 0x0000, // U+0c3d : Undefined 0x05da, // U+0c3e : Telugu Vowel Sign Aa 0x05db, // U+0c3f : Telugu Vowel Sign I 0x05dc, // U+0c40 : Telugu Vowel Sign Ii 0x05dd, // U+0c41 : Telugu Vowel Sign U 0x05de, // U+0c42 : Telugu Vowel Sign Uu 0x05df, // U+0c43 : Telugu Vowel Sign Vocalic R 0x15df, // U+0c44 : Telugu Vowel Sign Vocalic Rr 0x0000, // U+0c45 : Undefined 0x05e0, // U+0c46 : Telugu Vowel Sign E 0x05e1, // U+0c47 : Telugu Vowel Sign Ee 0x05e2, // U+0c48 : Telugu Vowel Sign Ai 0x0000, // U+0c49 : Undefined 0x05e4, // U+0c4a : Telugu Vowel Sign O 0x05e5, // U+0c4b : Telugu Vowel Sign Oo 0x05e6, // U+0c4c : Telugu Vowel Sign Au 0x05e8, // U+0c4d : Telugu Sign Virama 0x0000, // U+0c4e : Undefined 0x0000, // U+0c4f : Undefined 0x0000, // U+0c50 : Undefined 0x0000, // U+0c51 : Undefined 0x0000, // U+0c52 : Undefined 0x0000, // U+0c53 : Undefined 0x0000, // U+0c54 : Undefined 0x0000, // U+0c55 : Telugu Length Mark 0x0000, // U+0c56 : Telugu Ai Length Mark 0x0000, // U+0c57 : Undefined 0x0000, // U+0c58 : Undefined 0x0000, // U+0c59 : Undefined 0x0000, // U+0c5a : Undefined 0x0000, // U+0c5b : Undefined 0x0000, // U+0c5c : Undefined 0x0000, // U+0c5d : Undefined 0x0000, // U+0c5e : Undefined 0x0000, // U+0c5f : Undefined 0x15aa, // U+0c60 : Telugu Letter Vocalic Rr 0x15a7, // U+0c61 : Telugu Letter Vocalic Ll 0x0000, // U+0c62 : Undefined 0x0000, // U+0c63 : Undefined 0x0000, // U+0c64 : Undefined 0x0000, // U+0c65 : Undefined 0x05f1, // U+0c66 : Telugu Digit Zero 0x05f2, // U+0c67 : Telugu Digit One 0x05f3, // U+0c68 : Telugu Digit Two 0x05f4, // U+0c69 : Telugu Digit Three 0x05f5, // U+0c6a : Telugu Digit Four 0x05f6, // U+0c6b : Telugu Digit Five 0x05f7, // U+0c6c : Telugu Digit Six 0x05f8, // U+0c6d : Telugu Digit Seven 0x05f9, // U+0c6e : Telugu Digit Eight 0x05fa, // U+0c6f : Telugu Digit Nine 0x0000, // U+0c70 : Undefined 0x0000, // U+0c71 : Undefined 0x0000, // U+0c72 : Undefined 0x0000, // U+0c73 : Undefined 0x0000, // U+0c74 : Undefined 0x0000, // U+0c75 : Undefined 0x0000, // U+0c76 : Undefined 0x0000, // U+0c77 : Undefined 0x0000, // U+0c78 : Undefined 0x0000, // U+0c79 : Undefined 0x0000, // U+0c7a : Undefined 0x0000, // U+0c7b : Undefined 0x0000, // U+0c7c : Undefined 0x0000, // U+0c7d : Undefined 0x0000, // U+0c7e : Undefined 0x0000, // U+0c7f : Undefined 0x0000, // U+0c80 : Undefined 0x0000, // U+0c81 : Undefined 0x08a2, // U+0c82 : Kannada Sign Anusvara 0x08a3, // U+0c83 : Kannada Sign Visarga 0x0000, // U+0c84 : Undefined 0x08a4, // U+0c85 : Kannada Letter A 0x08a5, // U+0c86 : Kannada Letter Aa 0x08a6, // U+0c87 : Kannada Letter I 0x08a7, // U+0c88 : Kannada Letter Ii 0x08a8, // U+0c89 : Kannada Letter U 0x08a9, // U+0c8a : Kannada Letter Uu 0x08aa, // U+0c8b : Kannada Letter Vocalic R 0x18a6, // U+0c8c : Kannada Letter Vocalic L 0x0000, // U+0c8d : Undefined 0x08ab, // U+0c8e : Kannada Letter E 0x08ac, // U+0c8f : Kannada Letter Ee 0x08ad, // U+0c90 : Kannada Letter Ai 0x0000, // U+0c91 : Undefined 0x08af, // U+0c92 : Kannada Letter O 0x08b0, // U+0c93 : Kannada Letter Oo 0x08b1, // U+0c94 : Kannada Letter Au 0x08b3, // U+0c95 : Kannada Letter Ka 0x08b4, // U+0c96 : Kannada Letter Kha 0x08b5, // U+0c97 : Kannada Letter Ga 0x08b6, // U+0c98 : Kannada Letter Gha 0x08b7, // U+0c99 : Kannada Letter Nga 0x08b8, // U+0c9a : Kannada Letter Ca 0x08b9, // U+0c9b : Kannada Letter Cha 0x08ba, // U+0c9c : Kannada Letter Ja 0x08bb, // U+0c9d : Kannada Letter Jha 0x08bc, // U+0c9e : Kannada Letter Nya 0x08bd, // U+0c9f : Kannada Letter Tta 0x08be, // U+0ca0 : Kannada Letter Ttha 0x08bf, // U+0ca1 : Kannada Letter Dda 0x08c0, // U+0ca2 : Kannada Letter Ddha 0x08c1, // U+0ca3 : Kannada Letter Nna 0x08c2, // U+0ca4 : Kannada Letter Ta 0x08c3, // U+0ca5 : Kannada Letter Tha 0x08c4, // U+0ca6 : Kannada Letter Da 0x08c5, // U+0ca7 : Kannada Letter Dha 0x08c6, // U+0ca8 : Kannada Letter Na 0x0000, // U+0ca9 : Undefined 0x08c8, // U+0caa : Kannada Letter Pa 0x08c9, // U+0cab : Kannada Letter Pha 0x08ca, // U+0cac : Kannada Letter Ba 0x08cb, // U+0cad : Kannada Letter Bha 0x08cc, // U+0cae : Kannada Letter Ma 0x08cd, // U+0caf : Kannada Letter Ya 0x08cf, // U+0cb0 : Kannada Letter Ra 0x08d0, // U+0cb1 : Kannada Letter Rra 0x08d1, // U+0cb2 : Kannada Letter La 0x08d2, // U+0cb3 : Kannada Letter Lla 0x0000, // U+0cb4 : Undefined 0x08d4, // U+0cb5 : Kannada Letter Va 0x08d5, // U+0cb6 : Kannada Letter Sha 0x08d6, // U+0cb7 : Kannada Letter Ssa 0x08d7, // U+0cb8 : Kannada Letter Sa 0x08d8, // U+0cb9 : Kannada Letter Ha 0x0000, // U+0cba : Undefined 0x0000, // U+0cbb : Undefined 0x0000, // U+0cbc : Undefined 0x0000, // U+0cbd : Undefined 0x08da, // U+0cbe : Kannada Vowel Sign Aa 0x08db, // U+0cbf : Kannada Vowel Sign I 0x08dc, // U+0cc0 : Kannada Vowel Sign Ii 0x08dd, // U+0cc1 : Kannada Vowel Sign U 0x08de, // U+0cc2 : Kannada Vowel Sign Uu 0x08df, // U+0cc3 : Kannada Vowel Sign Vocalic R 0x18df, // U+0cc4 : Kannada Vowel Sign Vocalic Rr 0x0000, // U+0cc5 : Undefined 0x08e0, // U+0cc6 : Kannada Vowel Sign E 0x08e1, // U+0cc7 : Kannada Vowel Sign Ee 0x08e2, // U+0cc8 : Kannada Vowel Sign Ai 0x0000, // U+0cc9 : Undefined 0x08e4, // U+0cca : Kannada Vowel Sign O 0x08e5, // U+0ccb : Kannada Vowel Sign Oo 0x08e6, // U+0ccc : Kannada Vowel Sign Au 0x08e8, // U+0ccd : Kannada Sign Virama 0x0000, // U+0cce : Undefined 0x0000, // U+0ccf : Undefined 0x0000, // U+0cd0 : Undefined 0x0000, // U+0cd1 : Undefined 0x0000, // U+0cd2 : Undefined 0x0000, // U+0cd3 : Undefined 0x0000, // U+0cd4 : Undefined 0x0000, // U+0cd5 : Kannada Length Mark 0x0000, // U+0cd6 : Kannada Ai Length Mark 0x0000, // U+0cd7 : Undefined 0x0000, // U+0cd8 : Undefined 0x0000, // U+0cd9 : Undefined 0x0000, // U+0cda : Undefined 0x0000, // U+0cdb : Undefined 0x0000, // U+0cdc : Undefined 0x0000, // U+0cdd : Undefined 0x18c9, // U+0cde : Kannada Letter Fa 0x0000, // U+0cdf : Undefined 0x18aa, // U+0ce0 : Kannada Letter Vocalic Rr 0x18a7, // U+0ce1 : Kannada Letter Vocalic Ll 0x0000, // U+0ce2 : Undefined 0x0000, // U+0ce3 : Undefined 0x0000, // U+0ce4 : Undefined 0x0000, // U+0ce5 : Undefined 0x08f1, // U+0ce6 : Kannada Digit Zero 0x08f2, // U+0ce7 : Kannada Digit One 0x08f3, // U+0ce8 : Kannada Digit Two 0x08f4, // U+0ce9 : Kannada Digit Three 0x08f5, // U+0cea : Kannada Digit Four 0x08f6, // U+0ceb : Kannada Digit Five 0x08f7, // U+0cec : Kannada Digit Six 0x08f8, // U+0ced : Kannada Digit Seven 0x08f9, // U+0cee : Kannada Digit Eight 0x08fa, // U+0cef : Kannada Digit Nine 0x0000, // U+0cf0 : Undefined 0x0000, // U+0cf1 : Undefined 0x0000, // U+0cf2 : Undefined 0x0000, // U+0cf3 : Undefined 0x0000, // U+0cf4 : Undefined 0x0000, // U+0cf5 : Undefined 0x0000, // U+0cf6 : Undefined 0x0000, // U+0cf7 : Undefined 0x0000, // U+0cf8 : Undefined 0x0000, // U+0cf9 : Undefined 0x0000, // U+0cfa : Undefined 0x0000, // U+0cfb : Undefined 0x0000, // U+0cfc : Undefined 0x0000, // U+0cfd : Undefined 0x0000, // U+0cfe : Undefined 0x0000, // U+0cff : Undefined 0x0000, // U+0d00 : Undefined 0x0000, // U+0d01 : Undefined 0x09a2, // U+0d02 : Malayalam Sign Anusvara 0x09a3, // U+0d03 : Malayalam Sign Visarga 0x0000, // U+0d04 : Undefined 0x09a4, // U+0d05 : Malayalam Letter A 0x09a5, // U+0d06 : Malayalam Letter Aa 0x09a6, // U+0d07 : Malayalam Letter I 0x09a7, // U+0d08 : Malayalam Letter Ii 0x09a8, // U+0d09 : Malayalam Letter U 0x09a9, // U+0d0a : Malayalam Letter Uu 0x09aa, // U+0d0b : Malayalam Letter Vocalic R 0x19a6, // U+0d0c : Malayalam Letter Vocalic L 0x0000, // U+0d0d : Undefined 0x09ab, // U+0d0e : Malayalam Letter E 0x09ac, // U+0d0f : Malayalam Letter Ee 0x09ad, // U+0d10 : Malayalam Letter Ai 0x0000, // U+0d11 : Undefined 0x09af, // U+0d12 : Malayalam Letter O 0x09b0, // U+0d13 : Malayalam Letter Oo 0x09b1, // U+0d14 : Malayalam Letter Au 0x09b3, // U+0d15 : Malayalam Letter Ka 0x09b4, // U+0d16 : Malayalam Letter Kha 0x09b5, // U+0d17 : Malayalam Letter Ga 0x09b6, // U+0d18 : Malayalam Letter Gha 0x09b7, // U+0d19 : Malayalam Letter Nga 0x09b8, // U+0d1a : Malayalam Letter Ca 0x09b9, // U+0d1b : Malayalam Letter Cha 0x09ba, // U+0d1c : Malayalam Letter Ja 0x09bb, // U+0d1d : Malayalam Letter Jha 0x09bc, // U+0d1e : Malayalam Letter Nya 0x09bd, // U+0d1f : Malayalam Letter Tta 0x09be, // U+0d20 : Malayalam Letter Ttha 0x09bf, // U+0d21 : Malayalam Letter Dda 0x09c0, // U+0d22 : Malayalam Letter Ddha 0x09c1, // U+0d23 : Malayalam Letter Nna 0x09c2, // U+0d24 : Malayalam Letter Ta 0x09c3, // U+0d25 : Malayalam Letter Tha 0x09c4, // U+0d26 : Malayalam Letter Da 0x09c5, // U+0d27 : Malayalam Letter Dha 0x09c6, // U+0d28 : Malayalam Letter Na 0x0000, // U+0d29 : Undefined 0x09c8, // U+0d2a : Malayalam Letter Pa 0x09c9, // U+0d2b : Malayalam Letter Pha 0x09ca, // U+0d2c : Malayalam Letter Ba 0x09cb, // U+0d2d : Malayalam Letter Bha 0x09cc, // U+0d2e : Malayalam Letter Ma 0x09cd, // U+0d2f : Malayalam Letter Ya 0x09cf, // U+0d30 : Malayalam Letter Ra 0x09d0, // U+0d31 : Malayalam Letter Rra 0x09d1, // U+0d32 : Malayalam Letter La 0x09d2, // U+0d33 : Malayalam Letter Lla 0x09d3, // U+0d34 : Malayalam Letter Llla 0x09d4, // U+0d35 : Malayalam Letter Va 0x09d5, // U+0d36 : Malayalam Letter Sha 0x09d6, // U+0d37 : Malayalam Letter Ssa 0x09d7, // U+0d38 : Malayalam Letter Sa 0x09d8, // U+0d39 : Malayalam Letter Ha 0x0000, // U+0d3a : Undefined 0x0000, // U+0d3b : Undefined 0x0000, // U+0d3c : Undefined 0x0000, // U+0d3d : Undefined 0x09da, // U+0d3e : Malayalam Vowel Sign Aa 0x09db, // U+0d3f : Malayalam Vowel Sign I 0x09dc, // U+0d40 : Malayalam Vowel Sign Ii 0x09dd, // U+0d41 : Malayalam Vowel Sign U 0x09de, // U+0d42 : Malayalam Vowel Sign Uu 0x09df, // U+0d43 : Malayalam Vowel Sign Vocalic R 0x0000, // U+0d44 : Undefined 0x0000, // U+0d45 : Undefined 0x09e0, // U+0d46 : Malayalam Vowel Sign E 0x09e1, // U+0d47 : Malayalam Vowel Sign Ee 0x09e2, // U+0d48 : Malayalam Vowel Sign Ai 0x0000, // U+0d49 : Undefined 0x09e4, // U+0d4a : Malayalam Vowel Sign O 0x09e5, // U+0d4b : Malayalam Vowel Sign Oo 0x09e6, // U+0d4c : Malayalam Vowel Sign Au 0x09e8, // U+0d4d : Malayalam Sign Virama 0x0000, // U+0d4e : Undefined 0x0000, // U+0d4f : Undefined 0x0000, // U+0d50 : Undefined 0x0000, // U+0d51 : Undefined 0x0000, // U+0d52 : Undefined 0x0000, // U+0d53 : Undefined 0x0000, // U+0d54 : Undefined 0x0000, // U+0d55 : Undefined 0x0000, // U+0d56 : Undefined 0x0000, // U+0d57 : Malayalam Au Length Mark 0x0000, // U+0d58 : Undefined 0x0000, // U+0d59 : Undefined 0x0000, // U+0d5a : Undefined 0x0000, // U+0d5b : Undefined 0x0000, // U+0d5c : Undefined 0x0000, // U+0d5d : Undefined 0x0000, // U+0d5e : Undefined 0x0000, // U+0d5f : Undefined 0x19aa, // U+0d60 : Malayalam Letter Vocalic Rr 0x19a7, // U+0d61 : Malayalam Letter Vocalic Ll 0x0000, // U+0d62 : Undefined 0x0000, // U+0d63 : Undefined 0x0000, // U+0d64 : Undefined 0x0000, // U+0d65 : Undefined 0x09f1, // U+0d66 : Malayalam Digit Zero 0x09f2, // U+0d67 : Malayalam Digit One 0x09f3, // U+0d68 : Malayalam Digit Two 0x09f4, // U+0d69 : Malayalam Digit Three 0x09f5, // U+0d6a : Malayalam Digit Four 0x09f6, // U+0d6b : Malayalam Digit Five 0x09f7, // U+0d6c : Malayalam Digit Six 0x09f8, // U+0d6d : Malayalam Digit Seven 0x09f9, // U+0d6e : Malayalam Digit Eight 0x09fa // U+0d6f : Malayalam Digit Nine }; //////////////////////////////////////////////////////////////////////////// // SecondIndicByte // // This is used if the UnicodeToIndic table 4 high bits are set, this is // the value of the second Indic byte when applicable. //////////////////////////////////////////////////////////////////////////// private static byte[] s_SecondIndicByte = { 0x00, 0xe9, 0xb8, // U+0952 == 0xf0_0xb8 0xbf // U+0970 == 0xf0_0xbf }; //////////////////////////////////////////////////////////////////////////// // IndicMapping // // This table maps the 10 indic code pages to their unicode counterparts. // There are 0x60 characters in each table. The tables are in pairs of 2 // (1st char, 2nd char) and there are 10 tables (1 for each code page "font") //////////////////////////////////////////////////////////////////////////// private static int[] s_IndicMappingIndex = { -1, // 0 DEF 0X40 Default // Not a real code page -1, // 1 RMN 0X41 Roman // Transliteration not supported 0, // 2 DEV 0X42 Devanagari 1, // 3 BNG 0X43 Bengali 2, // 4 TML 0X44 Tamil 3, // 5 TLG 0X45 Telugu 1, // 6 ASM 0X46 Assamese (Bengali) - Reuses table 1 4, // 7 ORI 0X47 Oriya 5, // 8 KND 0X48 Kannada 6, // 9 MLM 0X49 Malayalam 7, // 10 GJR 0X4A Gujarati 8 // 11 PNJ 0X4B Punjabi (Gurmukhi) }; //////////////////////////////////////////////////////////////////////////// // IndicMapping // // This table contains 9 tables for the 10 indic code pages to their unicode counterparts. // There are 0x60 characters in each table. The tables are in pairs of 2 // (1st char, 2nd char) and there are 10 tables (1 for each code page "font") // // The first index is the table index (from the IndicMappingIndex table), // the 2nd the byte index, the third the character index. // // For byte 0 a 0x0000 value indicates an unknown character // For byte 1 a 0 value indicates no special attributes. // For byte 1, 200C & 200D are Virama, Nukta special cases // For byte 1, B8BF is Devanagari stress & abbreviation sign special cases // // WARNING: When copying these from windows, ? 0x003F were changed to 0x0000. // //////////////////////////////////////////////////////////////////////////// // char[codePageMapIndex][byte][character] private static char[,,] s_IndicMapping = { { //////////////////////////////////////////////////////////////////////////// // // Devanagari Table 0, Code Page (2, 0x42, 57002) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0901', '\x0902', '\x0903', '\x0905', '\x0906', '\x0907', '\x0908', // a8, a9, aa, ab, ac, ad, ae, af, '\x0909', '\x090a', '\x090b', '\x090e', '\x090f', '\x0910', '\x090d', '\x0912', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0913', '\x0914', '\x0911', '\x0915', '\x0916', '\x0917', '\x0918', '\x0919', // b8, b9, ba, bb, bc, bd, be, bf, '\x091a', '\x091b', '\x091c', '\x091d', '\x091e', '\x091f', '\x0920', '\x0921', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0922', '\x0923', '\x0924', '\x0925', '\x0926', '\x0927', '\x0928', '\x0929', // c8, c9, ca, cb, cc, cd, ce, cf, '\x092a', '\x092b', '\x092c', '\x092d', '\x092e', '\x092f', '\x095f', '\x0930', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0931', '\x0932', '\x0933', '\x0934', '\x0935', '\x0936', '\x0937', '\x0938', // d8, d9, da, db, dc, dd, de, df, '\x0939', '\x0000', '\x093e', '\x093f', '\x0940', '\x0941', '\x0942', '\x0943', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0946', '\x0947', '\x0948', '\x0945', '\x094a', '\x094b', '\x094c', '\x0949', // e8, e9, ea, eb, ec, ed, ee, ef, '\x094d', '\x093c', '\x0964', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0966', '\x0967', '\x0968', '\x0969', '\x096a', '\x096b', '\x096c', // f8, f9, fa, fb, fc, fd, fe, ff '\x096d', '\x096e', '\x096f', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0950', '\x0', '\x0', '\x0', '\x0', '\x090c', '\x0961', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0960', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0958', '\x0959', '\x095a', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x095b', '\x0', '\x0', '\x0', '\x0', '\x095c', // c0, c1, c2, c3, c4, c5, c6, c7, '\x095d', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x095e', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0962', '\x0963', '\x0', '\x0', '\x0944', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x093d', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\xB8BF', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Bengali & Assemese Table 1', Code Pages (3, '43', 57003 & 6', '46', 57006) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0981', '\x0982', '\x0983', '\x0985', '\x0986', '\x0987', '\x0988', // a8, a9, aa, ab, ac, ad, ae, af, '\x0989', '\x098a', '\x098b', '\x098f', '\x098f', '\x0990', '\x0990', '\x0993', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0993', '\x0994', '\x0994', '\x0995', '\x0996', '\x0997', '\x0998', '\x0999', // b8, b9, ba, bb, bc, bd, be, bf, '\x099a', '\x099b', '\x099c', '\x099d', '\x099e', '\x099f', '\x09a0', '\x09a1', // c0, c1, c2, c3, c4, c5, c6, c7, '\x09a2', '\x09a3', '\x09a4', '\x09a5', '\x09a6', '\x09a7', '\x09a8', '\x09a8', // c8, c9, ca, cb, cc, cd, ce, cf, '\x09aa', '\x09ab', '\x09ac', '\x09ad', '\x09ae', '\x09af', '\x09df', '\x09b0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x09b0', '\x09b2', '\x09b2', '\x09b2', '\x09ac', '\x09b6', '\x09b7', '\x09b8', // d8, d9, da, db, dc, dd, de, df, '\x09b9', '\x0000', '\x09be', '\x09bf', '\x09c0', '\x09c1', '\x09c2', '\x09c3', // e0, e1, e2, e3, e4, e5, e6, e7, '\x09c7', '\x09c7', '\x09c8', '\x09c8', '\x09cb', '\x09cb', '\x09cc', '\x09cc', // e8, e9, ea, eb, ec, ed, ee, ef, '\x09cd', '\x09bc', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x09e6', '\x09e7', '\x09e8', '\x09e9', '\x09ea', '\x09eb', '\x09ec', // f8, f9, fa, fb, fc, fd, fe, ff '\x09ed', '\x09ee', '\x09ef', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x098c', '\x09e1', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x09e0', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x09dc', // c0, c1, c2, c3, c4, c5, c6, c7, '\x09dd', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x09e2', '\x09e3', '\x0', '\x0', '\x09c4', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Tamil Table 2', Code Page (4, '44', 57004) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0000', '\x0b82', '\x0b83', '\x0b85', '\x0b86', '\x0b87', '\x0b88', // a8, a9, aa, ab, ac, ad, ae, af, '\x0b89', '\x0b8a', '\x0000', '\x0b8f', '\x0b8f', '\x0b90', '\x0b90', '\x0b92', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0b93', '\x0b94', '\x0b94', '\x0b95', '\x0b95', '\x0b95', '\x0b95', '\x0b99', // b8, b9, ba, bb, bc, bd, be, bf, '\x0b9a', '\x0b9a', '\x0b9c', '\x0b9c', '\x0b9e', '\x0b9f', '\x0b9f', '\x0b9f', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0b9f', '\x0ba3', '\x0ba4', '\x0ba4', '\x0ba4', '\x0ba4', '\x0ba8', '\x0ba9', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0baa', '\x0baa', '\x0baa', '\x0baa', '\x0bae', '\x0baf', '\x0baf', '\x0bb0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0bb1', '\x0bb2', '\x0bb3', '\x0bb4', '\x0bb5', '\x0bb7', '\x0bb7', '\x0bb8', // d8, d9, da, db, dc, dd, de, df, '\x0bb9', '\x0000', '\x0bbe', '\x0bbf', '\x0bc0', '\x0bc1', '\x0bc2', '\x0000', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0bc6', '\x0bc7', '\x0bc8', '\x0bc8', '\x0bca', '\x0bcb', '\x0bcc', '\x0bcc', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0bcd', '\x0000', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0030', '\x0be7', '\x0be8', '\x0be9', '\x0bea', '\x0beb', '\x0bec', // f8, f9, fa, fb, fc, fd, fe, ff '\x0bed', '\x0bee', '\x0bef', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Telugu Table 3', Code Page (5, '45', 57005) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0c01', '\x0c02', '\x0c03', '\x0c05', '\x0c06', '\x0c07', '\x0c08', // a8, a9, aa, ab, ac, ad, ae, af, '\x0c09', '\x0c0a', '\x0c0b', '\x0c0e', '\x0c0f', '\x0c10', '\x0c10', '\x0c12', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0c13', '\x0c14', '\x0c14', '\x0c15', '\x0c16', '\x0c17', '\x0c18', '\x0c19', // b8, b9, ba, bb, bc, bd, be, bf, '\x0c1a', '\x0c1b', '\x0c1c', '\x0c1d', '\x0c1e', '\x0c1f', '\x0c20', '\x0c21', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0c22', '\x0c23', '\x0c24', '\x0c25', '\x0c26', '\x0c27', '\x0c28', '\x0c28', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0c2a', '\x0c2b', '\x0c2c', '\x0c2d', '\x0c2e', '\x0c2f', '\x0c2f', '\x0c30', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0c31', '\x0c32', '\x0c33', '\x0c33', '\x0c35', '\x0c36', '\x0c37', '\x0c38', // d8, d9, da, db, dc, dd, de, df, '\x0c39', '\x0000', '\x0c3e', '\x0c3f', '\x0c40', '\x0c41', '\x0c42', '\x0c43', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0c46', '\x0c47', '\x0c48', '\x0c48', '\x0c4a', '\x0c4b', '\x0c4c', '\x0c4c', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0c4d', '\x0000', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0c66', '\x0c67', '\x0c68', '\x0c69', '\x0c6a', '\x0c6b', '\x0c6c', // f8, f9, fa, fb, fc, fd, fe, ff '\x0c6d', '\x0c6e', '\x0c6f', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0c0c', '\x0c61', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0c60', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0c44', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Oriya Table 4', Code Page (7, '47', 57007) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0b01', '\x0b02', '\x0b03', '\x0b05', '\x0b06', '\x0b07', '\x0b08', // a8, a9, aa, ab, ac, ad, ae, af, '\x0b09', '\x0b0a', '\x0b0b', '\x0b0f', '\x0b0f', '\x0b10', '\x0b10', '\x0b10', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0b13', '\x0b14', '\x0b14', '\x0b15', '\x0b16', '\x0b17', '\x0b18', '\x0b19', // b8, b9, ba, bb, bc, bd, be, bf, '\x0b1a', '\x0b1b', '\x0b1c', '\x0b1d', '\x0b1e', '\x0b1f', '\x0b20', '\x0b21', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0b22', '\x0b23', '\x0b24', '\x0b25', '\x0b26', '\x0b27', '\x0b28', '\x0b28', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0b2a', '\x0b2b', '\x0b2c', '\x0b2d', '\x0b2e', '\x0b2f', '\x0b5f', '\x0b30', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0b30', '\x0b32', '\x0b33', '\x0b33', '\x0b2c', '\x0b36', '\x0b37', '\x0b38', // d8, d9, da, db, dc, dd, de, df, '\x0b39', '\x0000', '\x0b3e', '\x0b3f', '\x0b40', '\x0b41', '\x0b42', '\x0b43', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0b47', '\x0b47', '\x0b48', '\x0b48', '\x0b4b', '\x0b4b', '\x0b4c', '\x0b4c', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0b4d', '\x0b3c', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0b66', '\x0b67', '\x0b68', '\x0b69', '\x0b6a', '\x0b6b', '\x0b6c', // f8, f9, fa, fb, fc, fd, fe, ff '\x0b6d', '\x0b6e', '\x0b6f', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0c0c', '\x0c61', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0c60', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0b5c', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0b5d', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0c44', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0b3d', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Kannada Table 5', Code Page (8, '48', 57008) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0000', '\x0c82', '\x0c83', '\x0c85', '\x0c86', '\x0c87', '\x0c88', // a8, a9, aa, ab, ac, ad, ae, af, '\x0c89', '\x0c8a', '\x0c8b', '\x0c8e', '\x0c8f', '\x0c90', '\x0c90', '\x0c92', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0c93', '\x0c94', '\x0c94', '\x0c95', '\x0c96', '\x0c97', '\x0c98', '\x0c99', // b8, b9, ba, bb, bc, bd, be, bf, '\x0c9a', '\x0c9b', '\x0c9c', '\x0c9d', '\x0c9e', '\x0c9f', '\x0ca0', '\x0ca1', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0ca2', '\x0ca3', '\x0ca4', '\x0ca5', '\x0ca6', '\x0ca7', '\x0ca8', '\x0ca8', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0caa', '\x0cab', '\x0cac', '\x0cad', '\x0cae', '\x0caf', '\x0caf', '\x0cb0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0cb1', '\x0cb2', '\x0cb3', '\x0cb3', '\x0cb5', '\x0cb6', '\x0cb7', '\x0cb8', // d8, d9, da, db, dc, dd, de, df, '\x0cb9', '\x0000', '\x0cbe', '\x0cbf', '\x0cc0', '\x0cc1', '\x0cc2', '\x0cc3', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0cc6', '\x0cc7', '\x0cc8', '\x0cc8', '\x0cca', '\x0ccb', '\x0ccc', '\x0ccc', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0ccd', '\x0000', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0ce6', '\x0ce7', '\x0ce8', '\x0ce9', '\x0cea', '\x0ceb', '\x0cec', // f8, f9, fa, fb, fc, fd, fe, ff '\x0ced', '\x0cee', '\x0cef', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0c8c', '\x0ce1', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0ce0', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0cde', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0cc4', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Malayalam Table 6', Code Page (9, '49', 57009) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0000', '\x0d02', '\x0d03', '\x0d05', '\x0d06', '\x0d07', '\x0d08', // a8, a9, aa, ab, ac, ad, ae, af, '\x0d09', '\x0d0a', '\x0d0b', '\x0d0e', '\x0d0f', '\x0d10', '\x0d10', '\x0d12', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0d13', '\x0d14', '\x0d14', '\x0d15', '\x0d16', '\x0d17', '\x0d18', '\x0d19', // b8, b9, ba, bb, bc, bd, be, bf, '\x0d1a', '\x0d1b', '\x0d1c', '\x0d1d', '\x0d1e', '\x0d1f', '\x0d20', '\x0d21', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0d22', '\x0d23', '\x0d24', '\x0d25', '\x0d26', '\x0d27', '\x0d28', '\x0d28', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0d2a', '\x0d2b', '\x0d2c', '\x0d2d', '\x0d2e', '\x0d2f', '\x0d2f', '\x0d30', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0d31', '\x0d32', '\x0d33', '\x0d34', '\x0d35', '\x0d36', '\x0d37', '\x0d38', // d8, d9, da, db, dc, dd, de, df, '\x0d39', '\x0000', '\x0d3e', '\x0d3f', '\x0d40', '\x0d41', '\x0d42', '\x0d43', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0d46', '\x0d47', '\x0d48', '\x0d48', '\x0d4a', '\x0d4b', '\x0d4c', '\x0d4c', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0d4d', '\x0000', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0d66', '\x0d67', '\x0d68', '\x0d69', '\x0d6a', '\x0d6b', '\x0d6c', // f8, f9, fa, fb, fc, fd, fe, ff '\x0d6d', '\x0d6e', '\x0d6f', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0d0c', '\x0d61', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0d60', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Gujarati Table 7', Code Page (10', '4a', 57010) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0a81', '\x0a82', '\x0a83', '\x0a85', '\x0a86', '\x0a87', '\x0a88', // a8, a9, aa, ab, ac, ad, ae, af, '\x0a89', '\x0a8a', '\x0a8b', '\x0a8f', '\x0a8f', '\x0a90', '\x0a8d', '\x0a8d', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0a93', '\x0a94', '\x0a91', '\x0a95', '\x0a96', '\x0a97', '\x0a98', '\x0a99', // b8, b9, ba, bb, bc, bd, be, bf, '\x0a9a', '\x0a9b', '\x0a9c', '\x0a9d', '\x0a9e', '\x0a9f', '\x0aa0', '\x0aa1', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0aa2', '\x0aa3', '\x0aa4', '\x0aa5', '\x0aa6', '\x0aa7', '\x0aa8', '\x0aa8', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0aaa', '\x0aab', '\x0aac', '\x0aad', '\x0aae', '\x0aaf', '\x0aaf', '\x0ab0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0ab0', '\x0ab2', '\x0ab3', '\x0ab3', '\x0ab5', '\x0ab6', '\x0ab7', '\x0ab8', // d8, d9, da, db, dc, dd, de, df, '\x0ab9', '\x0000', '\x0abe', '\x0abf', '\x0ac0', '\x0ac1', '\x0ac2', '\x0ac3', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0ac7', '\x0ac7', '\x0ac8', '\x0ac5', '\x0acb', '\x0acb', '\x0acc', '\x0ac9', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0acd', '\x0abc', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0ae6', '\x0ae7', '\x0ae8', '\x0ae9', '\x0aea', '\x0aeb', '\x0aec', // f8, f9, fa, fb, fc, fd, fe, ff '\x0aed', '\x0aee', '\x0aef', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0ad0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0ae0', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0ac4', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0abd', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } }, { //////////////////////////////////////////////////////////////////////////// // // Punjabi (Gurmukhi) Table 8', Code Page (11', '4b', 57011) // //////////////////////////////////////////////////////////////////////////// // Default Unicode Char { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0000', '\x0000', '\x0a02', '\x0000', '\x0a05', '\x0a06', '\x0a07', '\x0a08', // a8, a9, aa, ab, ac, ad, ae, af, '\x0a09', '\x0a0a', '\x0000', '\x0a0f', '\x0a0f', '\x0a10', '\x0a10', '\x0a10', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0a13', '\x0a14', '\x0a14', '\x0a15', '\x0a16', '\x0a17', '\x0a18', '\x0a19', // b8, b9, ba, bb, bc, bd, be, bf, '\x0a1a', '\x0a1b', '\x0a1c', '\x0a1d', '\x0a1e', '\x0a1f', '\x0a20', '\x0a21', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0a22', '\x0a23', '\x0a24', '\x0a25', '\x0a26', '\x0a27', '\x0a28', '\x0a28', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0a2a', '\x0a2b', '\x0a2c', '\x0a2d', '\x0a2e', '\x0a2f', '\x0a2f', '\x0a30', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0a30', '\x0a32', '\x0a33', '\x0a33', '\x0a35', '\x0a36', '\x0a36', '\x0a38', // d8, d9, da, db, dc, dd, de, df, '\x0a39', '\x0000', '\x0a3e', '\x0a3f', '\x0a40', '\x0a41', '\x0a42', '\x0000', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0a47', '\x0a47', '\x0a48', '\x0a48', '\x0a4b', '\x0a4b', '\x0a4c', '\x0a4c', // e8, e9, ea, eb, ec, ed, ee, ef, '\x0a4d', '\x0a3c', '\x002e', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0000', '\x0a66', '\x0a67', '\x0a68', '\x0a69', '\x0a6a', '\x0a6b', '\x0a6c', // f8, f9, fa, fb, fc, fd, fe, ff '\x0a6d', '\x0a6e', '\x0a6f', '\x0000', '\x0000', '\x0000', '\x0000', '\x0000' }, // Alternate Unicode Char & Flags { // a0, a1, a2, a3, a4, a5, a6, a7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // a8, a9, aa, ab, ac, ad, ae, af, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // b0, b1, b2, b3, b4, b5, b6, b7, '\x0', '\x0', '\x0', '\x0', '\x0a59', '\x0a5a', '\x0', '\x0', // b8, b9, ba, bb, bc, bd, be, bf, '\x0', '\x0', '\x0a5b', '\x0', '\x0', '\x0', '\x0', '\x0', // c0, c1, c2, c3, c4, c5, c6, c7, '\x0a5c', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // c8, c9, ca, cb, cc, cd, ce, cf, '\x0', '\x0a5e', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d0, d1, d2, d3, d4, d5, d6, d7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // d8, d9, da, db, dc, dd, de, df, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e0, e1, e2, e3, e4, e5, e6, e7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // e8, e9, ea, eb, ec, ed, ee, ef, '\x200C', '\x200D', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f0, f1, f2, f3, f4, f5, f6, f7, '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', // f8, f9, fa, fb, fc, fd, fe, ff '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', '\x0' } } }; } }
56.091051
188
0.411151
[ "MIT" ]
Larhwally/corefx
src/System.Text.Encoding.CodePages/src/System/Text/ISCIIEncoding.cs
144,154
C#
// <auto-generated /> using System; using AddressesAPI.Infrastructure; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AddressesAPI.Infrastructure.Migrations { [DbContext(typeof(AddressesContext))] [Migration("20201012154016_AddIndexesToTables")] partial class AddIndexesToTables { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) .HasAnnotation("ProductVersion", "3.1.6") .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("AddressesAPI.V1.Infrastructure.CrossReference", b => { b.Property<string>("CrossRefKey") .HasColumnName("xref_key") .HasColumnType("character varying(14)") .HasMaxLength(14); b.Property<string>("Code") .HasColumnName("xref_code") .HasColumnType("character varying(6)") .HasMaxLength(6); b.Property<DateTime?>("EndDate") .HasColumnName("xref_end_date") .HasColumnType("timestamp without time zone"); b.Property<string>("Name") .HasColumnName("xref_name") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<long>("UPRN") .HasColumnName("uprn") .HasColumnType("bigint"); b.Property<string>("Value") .HasColumnName("xref_value") .HasColumnType("character varying(50)") .HasMaxLength(50); b.HasKey("CrossRefKey"); b.ToTable("hackney_xref","dbo"); }); modelBuilder.Entity("AddressesAPI.V1.Infrastructure.HackneyAddress", b => { b.Property<string>("AddressKey") .HasColumnName("lpi_key") .HasColumnType("character varying(14)") .HasMaxLength(14); b.Property<int>("AddressChangeDate") .HasColumnName("lpi_last_update_date") .HasColumnType("integer"); b.Property<int>("AddressEndDate") .HasColumnName("lpi_end_date") .HasColumnType("integer"); b.Property<int>("AddressStartDate") .HasColumnName("lpi_start_date") .HasColumnType("integer"); b.Property<string>("AddressStatus") .HasColumnName("lpi_logical_status") .HasColumnType("character varying(18)") .HasMaxLength(18); b.Property<string>("BuildingName") .HasColumnName("pao_text") .HasColumnType("character varying(90)") .HasMaxLength(90); b.Property<string>("BuildingNumber") .HasColumnName("building_number") .HasColumnType("character varying(17)") .HasMaxLength(17); b.Property<double>("Easting") .HasColumnName("easting") .HasColumnType("double precision"); b.Property<string>("Gazetteer") .HasColumnName("gazetteer") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<double>("Latitude") .HasColumnName("latitude") .HasColumnType("double precision"); b.Property<string>("Line1") .HasColumnName("line1") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line2") .HasColumnName("line2") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line3") .HasColumnName("line3") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line4") .HasColumnName("line4") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<string>("Locality") .HasColumnName("locality") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<double>("Longitude") .HasColumnName("longitude") .HasColumnType("double precision"); b.Property<bool>("NeverExport") .HasColumnName("neverexport") .HasColumnType("boolean"); b.Property<double>("Northing") .HasColumnName("northing") .HasColumnType("double precision"); b.Property<string>("Organisation") .HasColumnName("organisation") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<short?>("PaonStartNumber") .HasColumnName("paon_start_num") .HasColumnType("smallint"); b.Property<long?>("ParentUPRN") .HasColumnName("parent_uprn") .HasColumnType("bigint"); b.Property<string>("PlanningUseClass") .HasColumnName("planning_use_class") .HasColumnType("character varying(50)") .HasMaxLength(50); b.Property<string>("Postcode") .HasColumnName("postcode") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<string>("PostcodeNoSpace") .HasColumnName("postcode_nospace") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<int>("PropertyChangeDate") .HasColumnName("blpu_last_update_date") .HasColumnType("integer"); b.Property<int>("PropertyEndDate") .HasColumnName("blpu_end_date") .HasColumnType("integer"); b.Property<bool>("PropertyShell") .HasColumnName("property_shell") .HasColumnType("boolean"); b.Property<int>("PropertyStartDate") .HasColumnName("blpu_start_date") .HasColumnType("integer"); b.Property<string>("Street") .HasColumnName("street_description") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<string>("Town") .HasColumnName("town") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<long>("UPRN") .HasColumnName("uprn") .HasColumnType("bigint"); b.Property<int?>("USRN") .HasColumnName("usrn") .HasColumnType("integer"); b.Property<string>("UnitName") .HasColumnName("sao_text") .HasColumnType("character varying(90)") .HasMaxLength(90); b.Property<string>("UnitNumber") .HasColumnName("unit_number") .HasColumnType("character varying(17)") .HasMaxLength(17); b.Property<string>("UsageCode") .HasColumnName("blpu_class") .HasColumnType("character varying(4)") .HasMaxLength(4); b.Property<string>("UsageDescription") .HasColumnName("usage_description") .HasColumnType("character varying(160)") .HasMaxLength(160); b.Property<string>("UsagePrimary") .HasColumnName("usage_primary") .HasColumnType("character varying(160)") .HasMaxLength(160); b.Property<string>("Ward") .HasColumnName("ward") .HasColumnType("character varying(100)") .HasMaxLength(100); b.HasKey("AddressKey"); b.ToTable("hackney_address","dbo"); }); modelBuilder.Entity("AddressesAPI.V1.Infrastructure.NationalAddress", b => { b.Property<string>("AddressKey") .HasColumnName("lpi_key") .HasColumnType("character varying(14)") .HasMaxLength(14); b.Property<int>("AddressChangeDate") .HasColumnName("lpi_last_update_date") .HasColumnType("integer"); b.Property<int>("AddressEndDate") .HasColumnName("lpi_end_date") .HasColumnType("integer"); b.Property<int>("AddressStartDate") .HasColumnName("lpi_start_date") .HasColumnType("integer"); b.Property<string>("AddressStatus") .HasColumnName("lpi_logical_status") .HasColumnType("character varying(18)") .HasMaxLength(18); b.Property<string>("BuildingName") .HasColumnName("pao_text") .HasColumnType("character varying(90)") .HasMaxLength(90); b.Property<string>("BuildingNumber") .HasColumnName("building_number") .HasColumnType("character varying(17)") .HasMaxLength(17); b.Property<double>("Easting") .HasColumnName("easting") .HasColumnType("double precision"); b.Property<string>("Gazetteer") .HasColumnName("gazetteer") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<double>("Latitude") .HasColumnName("latitude") .HasColumnType("double precision"); b.Property<string>("Line1") .HasColumnName("line1") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line2") .HasColumnName("line2") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line3") .HasColumnName("line3") .HasColumnType("character varying(200)") .HasMaxLength(200); b.Property<string>("Line4") .HasColumnName("line4") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<string>("Locality") .HasColumnName("locality") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<double>("Longitude") .HasColumnName("longitude") .HasColumnType("double precision"); b.Property<bool>("NeverExport") .HasColumnName("neverexport") .HasColumnType("boolean"); b.Property<double>("Northing") .HasColumnName("northing") .HasColumnType("double precision"); b.Property<string>("Organisation") .HasColumnName("organisation") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<short?>("PaonStartNumber") .HasColumnName("paon_start_num") .HasColumnType("smallint"); b.Property<long?>("ParentUPRN") .HasColumnName("parent_uprn") .HasColumnType("bigint"); b.Property<string>("PlanningUseClass") .HasColumnName("planning_use_class") .HasColumnType("character varying(50)") .HasMaxLength(50); b.Property<string>("Postcode") .HasColumnName("postcode") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<string>("PostcodeNoSpace") .HasColumnName("postcode_nospace") .HasColumnType("character varying(8)") .HasMaxLength(8); b.Property<int>("PropertyChangeDate") .HasColumnName("blpu_last_update_date") .HasColumnType("integer"); b.Property<int>("PropertyEndDate") .HasColumnName("blpu_end_date") .HasColumnType("integer"); b.Property<bool>("PropertyShell") .HasColumnName("property_shell") .HasColumnType("boolean"); b.Property<int>("PropertyStartDate") .HasColumnName("blpu_start_date") .HasColumnType("integer"); b.Property<string>("Street") .HasColumnName("street_description") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<string>("Town") .HasColumnName("town") .HasColumnType("character varying(100)") .HasMaxLength(100); b.Property<long>("UPRN") .HasColumnName("uprn") .HasColumnType("bigint"); b.Property<int?>("USRN") .HasColumnName("usrn") .HasColumnType("integer"); b.Property<string>("UnitName") .HasColumnName("sao_text") .HasColumnType("character varying(90)") .HasMaxLength(90); b.Property<string>("UnitNumber") .HasColumnName("unit_number") .HasColumnType("character varying(17)") .HasMaxLength(17); b.Property<string>("UsageCode") .HasColumnName("blpu_class") .HasColumnType("character varying(4)") .HasMaxLength(4); b.Property<string>("UsageDescription") .HasColumnName("usage_description") .HasColumnType("character varying(160)") .HasMaxLength(160); b.Property<string>("UsagePrimary") .HasColumnName("usage_primary") .HasColumnType("character varying(160)") .HasMaxLength(160); b.Property<string>("Ward") .HasColumnName("ward") .HasColumnType("character varying(100)") .HasMaxLength(100); b.HasKey("AddressKey"); b.ToTable("national_address","dbo"); }); #pragma warning restore 612, 618 } } }
41.021226
119
0.454551
[ "MIT" ]
LBHackney-IT/addresses-api
AddressesAPI/Infrastructure/Migrations/20201012154016_AddIndexesToTables.Designer.cs
17,395
C#
using System; using System.Collections.Generic; using System.Text.Json.Serialization; public class ConsolidatedWeather { [JsonPropertyName("id")] public object Id { get; set; } [JsonPropertyName("weather_state_name")] public string WeatherStateName { get; set; } [JsonPropertyName("weather_state_abbr")] public string WeatherStateAbbr { get; set; } [JsonPropertyName("wind_direction_compass")] public string WindDirectionCompass { get; set; } [JsonPropertyName("created")] public DateTime Created { get; set; } [JsonPropertyName("applicable_date")] public string ApplicableDate { get; set; } [JsonPropertyName("min_temp")] public double MinTemp { get; set; } [JsonPropertyName("max_temp")] public double MaxTemp { get; set; } [JsonPropertyName("the_temp")] public double TheTemp { get; set; } [JsonPropertyName("wind_speed")] public double WindSpeed { get; set; } [JsonPropertyName("wind_direction")] public double WindDirection { get; set; } [JsonPropertyName("air_pressure")] public double AirPressure { get; set; } [JsonPropertyName("humidity")] public int Humidity { get; set; } [JsonPropertyName("visibility")] public double Visibility { get; set; } [JsonPropertyName("predictability")] public int Predictability { get; set; } } public class Parent { [JsonPropertyName("title")] public string Title { get; set; } [JsonPropertyName("location_type")] public string LocationType { get; set; } [JsonPropertyName("woeid")] public int Woeid { get; set; } [JsonPropertyName("latt_long")] public string LattLong { get; set; } } public class Source { [JsonPropertyName("title")] public string Title { get; set; } [JsonPropertyName("slug")] public string Slug { get; set; } [JsonPropertyName("url")] public string Url { get; set; } [JsonPropertyName("crawl_rate")] public int CrawlRate { get; set; } } public class WeatherForecast { [JsonPropertyName("consolidated_weather")] public List<ConsolidatedWeather> ConsolidatedWeather { get; set; } [JsonPropertyName("time")] public DateTime Time { get; set; } [JsonPropertyName("sun_rise")] public DateTime SunRise { get; set; } [JsonPropertyName("sun_set")] public DateTime SunSet { get; set; } [JsonPropertyName("timezone_name")] public string TimezoneName { get; set; } [JsonPropertyName("parent")] public Parent Parent { get; set; } [JsonPropertyName("sources")] public List<Source> Sources { get; set; } [JsonPropertyName("title")] public string Title { get; set; } [JsonPropertyName("location_type")] public string LocationType { get; set; } [JsonPropertyName("woeid")] public int Woeid { get; set; } [JsonPropertyName("latt_long")] public string LattLong { get; set; } [JsonPropertyName("timezone")] public string Timezone { get; set; } }
29.389831
76
0.579585
[ "MIT" ]
TopSwagCode/AspNetCore.OpenTelemetry
src/MuseumAPI/WeatherForecast.cs
3,468
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using Microsoft.Maui.Controls.StyleSheets; namespace Microsoft.Maui.Controls { [Flags] public enum InitializationFlags : long { DisableCss = 1 << 0 } // Previewer uses reflection to bind to this method; Removal or modification of visibility will break previewer. internal static class Registrar { internal static void RegisterAll(Type[] attrTypes) => Internals.Registrar.RegisterAll(attrTypes); } } namespace Microsoft.Maui.Controls.Internals { [EditorBrowsable(EditorBrowsableState.Never)] public class Registrar<TRegistrable> where TRegistrable : class { readonly Dictionary<Type, Dictionary<Type, (Type target, short priority)>> _handlers = new Dictionary<Type, Dictionary<Type, (Type target, short priority)>>(); static Type _defaultVisualType = typeof(VisualMarker.DefaultVisual); static Type _materialVisualType = typeof(VisualMarker.MaterialVisual); static Type[] _defaultVisualRenderers = new[] { _defaultVisualType }; public void Register(Type tview, Type trender, Type[] supportedVisuals, short priority) { supportedVisuals = supportedVisuals ?? _defaultVisualRenderers; //avoid caching null renderers if (trender == null) return; if (!_handlers.TryGetValue(tview, out Dictionary<Type, (Type target, short priority)> visualRenderers)) { visualRenderers = new Dictionary<Type, (Type target, short priority)>(); _handlers[tview] = visualRenderers; } for (int i = 0; i < supportedVisuals.Length; i++) { if (visualRenderers.TryGetValue(supportedVisuals[i], out (Type target, short priority) existingTargetValue)) { if (existingTargetValue.priority <= priority) visualRenderers[supportedVisuals[i]] = (trender, priority); } else visualRenderers[supportedVisuals[i]] = (trender, priority); } // This registers a factory into the Handler version of the registrar. // This way if you are running a .NET MAUI app but want to use legacy renderers // the Handler.Registrar will use this factory to resolve a RendererToHandlerShim for the given type // This only comes into play if users "Init" a legacy set of renderers // The default for a .NET MAUI application will be to not do this but 3rd party vendors or // customers with large custom renderers will be able to use this to easily shim their renderer to a handler // to ease the migration process // TODO: This implementation isn't currently compatible with Visual but we have no concept of visual inside // .NET MAUI currently. // TODO: We need to implemnt this with the new AppHostBuilder //Microsoft.Maui.Registrar.Handlers.Register(tview, // (viewType) => // { // return Registrar.RendererToHandlerShim?.Invoke(null); // }); } public void Register(Type tview, Type trender, Type[] supportedVisual) => Register(tview, trender, supportedVisual, 0); public void Register(Type tview, Type trender) => Register(tview, trender, _defaultVisualRenderers); internal TRegistrable GetHandler(Type type) => GetHandler(type, _defaultVisualType); internal TRegistrable GetHandler(Type type, Type visualType) { Type handlerType = GetHandlerType(type, visualType ?? _defaultVisualType); if (handlerType == null) return null; object handler = DependencyResolver.ResolveOrCreate(handlerType); return (TRegistrable)handler; } internal TRegistrable GetHandler(Type type, object source, IVisual visual, params object[] args) { TRegistrable returnValue = default(TRegistrable); if (args.Length == 0) { returnValue = GetHandler(type, visual?.GetType() ?? _defaultVisualType); } else { Type handlerType = GetHandlerType(type, visual?.GetType() ?? _defaultVisualType); if (handlerType != null) returnValue = (TRegistrable)DependencyResolver.ResolveOrCreate(handlerType, source, visual?.GetType(), args); } return returnValue; } public TOut GetHandler<TOut>(Type type) where TOut : class, TRegistrable { return GetHandler(type) as TOut; } public TOut GetHandler<TOut>(Type type, params object[] args) where TOut : class, TRegistrable { return GetHandler(type, null, null, args) as TOut; } public TOut GetHandlerForObject<TOut>(object obj) where TOut : class, TRegistrable { if (obj == null) throw new ArgumentNullException(nameof(obj)); var reflectableType = obj as IReflectableType; var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType(); return GetHandler(type, (obj as IVisualController)?.EffectiveVisual?.GetType()) as TOut; } public TOut GetHandlerForObject<TOut>(object obj, params object[] args) where TOut : class, TRegistrable { if (obj == null) throw new ArgumentNullException(nameof(obj)); var reflectableType = obj as IReflectableType; var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType(); return GetHandler(type, obj, (obj as IVisualController)?.EffectiveVisual, args) as TOut; } public Type GetHandlerType(Type viewType) => GetHandlerType(viewType, _defaultVisualType); public Type GetHandlerType(Type viewType, Type visualType) { visualType = visualType ?? _defaultVisualType; // 1. Do we have this specific type registered already? if (_handlers.TryGetValue(viewType, out Dictionary<Type, (Type target, short priority)> visualRenderers)) if (visualRenderers.TryGetValue(visualType, out (Type target, short priority) specificTypeRenderer)) return specificTypeRenderer.target; else if (visualType == _materialVisualType) VisualMarker.MaterialCheck(); if (visualType != _defaultVisualType && visualRenderers != null) if (visualRenderers.TryGetValue(_defaultVisualType, out (Type target, short priority) specificTypeRenderer)) return specificTypeRenderer.target; // 2. Do we have a RenderWith for this type or its base types? Register them now. RegisterRenderWithTypes(viewType, visualType); // 3. Do we have a custom renderer for a base type or did we just register an appropriate renderer from RenderWith? if (LookupHandlerType(viewType, visualType, out (Type target, short priority) baseTypeRenderer)) return baseTypeRenderer.target; else return null; } public Type GetHandlerTypeForObject(object obj) { if (obj == null) throw new ArgumentNullException(nameof(obj)); var reflectableType = obj as IReflectableType; var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType(); return GetHandlerType(type); } bool LookupHandlerType(Type viewType, Type visualType, out (Type target, short priority) handlerType) { visualType = visualType ?? _defaultVisualType; while (viewType != null && viewType != typeof(Element)) { if (_handlers.TryGetValue(viewType, out Dictionary<Type, (Type target, short priority)> visualRenderers)) if (visualRenderers.TryGetValue(visualType, out handlerType)) return true; if (visualType != _defaultVisualType && visualRenderers != null) if (visualRenderers.TryGetValue(_defaultVisualType, out handlerType)) return true; viewType = viewType.GetTypeInfo().BaseType; } handlerType = (null, 0); return false; } void RegisterRenderWithTypes(Type viewType, Type visualType) { visualType = visualType ?? _defaultVisualType; // We're going to go through each type in this viewType's inheritance chain to look for classes // decorated with a RenderWithAttribute. We're going to register each specific type with its // renderer. while (viewType != null && viewType != typeof(Element)) { // Only go through this process if we have not registered something for this type; // we don't want RenderWith renderers to override ExportRenderers that are already registered. // Plus, there's no need to do this again if we already have a renderer registered. if (!_handlers.TryGetValue(viewType, out Dictionary<Type, (Type target, short priority)> visualRenderers) || !(visualRenderers.ContainsKey(visualType) || visualRenderers.ContainsKey(_defaultVisualType))) { // get RenderWith attribute for just this type, do not inherit attributes from base types var attribute = viewType.GetTypeInfo().GetCustomAttributes<RenderWithAttribute>(false).FirstOrDefault(); if (attribute == null) { // TODO this doesn't appear to do anything. Register just returns as a NOOP if the renderer is null Register(viewType, null, new[] { visualType }); // Cache this result so we don't have to do GetCustomAttributes again } else { Type specificTypeRenderer = attribute.Type; if (specificTypeRenderer.Name.StartsWith("_", StringComparison.Ordinal)) { // TODO: Remove attribute2 once renderer names have been unified across all platforms var attribute2 = specificTypeRenderer.GetTypeInfo().GetCustomAttribute<RenderWithAttribute>(); if (attribute2 != null) { for (int i = 0; i < attribute2.SupportedVisuals.Length; i++) { if (attribute2.SupportedVisuals[i] == _defaultVisualType) specificTypeRenderer = attribute2.Type; if (attribute2.SupportedVisuals[i] == visualType) { specificTypeRenderer = attribute2.Type; break; } } } if (specificTypeRenderer.Name.StartsWith("_", StringComparison.Ordinal)) { Register(viewType, null, new[] { visualType }); // Cache this result so we don't work through this chain again viewType = viewType.GetTypeInfo().BaseType; continue; } } Register(viewType, specificTypeRenderer, new[] { visualType }); // Register this so we don't have to look for the RenderWithAttibute again in the future } } viewType = viewType.GetTypeInfo().BaseType; } } } [EditorBrowsable(EditorBrowsableState.Never)] public static class Registrar { static Registrar() { Registered = new Registrar<IRegisterable>(); } public static IFontRegistrar FontRegistrar { get; } = new FontRegistrar(); internal static Dictionary<string, Type> Effects { get; } = new Dictionary<string, Type>(); internal static Dictionary<string, IList<StylePropertyAttribute>> StyleProperties => LazyStyleProperties.Value; static bool DisableCSS = false; static readonly Lazy<Dictionary<string, IList<StylePropertyAttribute>>> LazyStyleProperties = new Lazy<Dictionary<string, IList<StylePropertyAttribute>>>(LoadStyleSheets); public static IEnumerable<Assembly> ExtraAssemblies { get; set; } public static Registrar<IRegisterable> Registered { get; internal set; } //typeof(ExportRendererAttribute); //typeof(ExportCellAttribute); //typeof(ExportImageSourceHandlerAttribute); //TODO this is no longer used? public static void RegisterRenderers(HandlerAttribute[] attributes) { var length = attributes.Length; for (var i = 0; i < length; i++) { var attribute = attributes[i]; if (attribute.ShouldRegister()) Registered.Register(attribute.HandlerType, attribute.TargetType, attribute.SupportedVisuals, attribute.Priority); } } // This is used when you're running an app that only knows about handlers (.NET MAUI app) // If the user has called Forms.Init() this will register all found types // into the handlers registrar and then it will use this factory to create a shim internal static Func<object, IViewHandler> RendererToHandlerShim { get; private set; } public static void RegisterRendererToHandlerShim(Func<object, IViewHandler> handlerShim) { RendererToHandlerShim = handlerShim; } public static void RegisterStylesheets(InitializationFlags flags) { if ((flags & InitializationFlags.DisableCss) == InitializationFlags.DisableCss) DisableCSS = true; } static Dictionary<string, IList<StylePropertyAttribute>> LoadStyleSheets() { var properties = new Dictionary<string, IList<StylePropertyAttribute>>(); if (DisableCSS) return properties; var assembly = typeof(StylePropertyAttribute).GetTypeInfo().Assembly; var styleAttributes = assembly.GetCustomAttributesSafe(typeof(StylePropertyAttribute)); var stylePropertiesLength = styleAttributes?.Length ?? 0; for (var i = 0; i < stylePropertiesLength; i++) { var attribute = (StylePropertyAttribute)styleAttributes[i]; if (properties.TryGetValue(attribute.CssPropertyName, out var attrList)) attrList.Add(attribute); else properties[attribute.CssPropertyName] = new List<StylePropertyAttribute> { attribute }; } return properties; } public static void RegisterEffects(string resolutionName, ExportEffectAttribute[] effectAttributes) { var exportEffectsLength = effectAttributes.Length; for (var i = 0; i < exportEffectsLength; i++) { var effect = effectAttributes[i]; Effects[resolutionName + "." + effect.Id] = effect.Type; } } public static void RegisterAll(Type[] attrTypes) { RegisterAll(attrTypes, default(InitializationFlags)); } public static void RegisterAll(Type[] attrTypes, InitializationFlags flags) { Profile.FrameBegin(); Assembly[] assemblies = Device.GetAssemblies(); if (ExtraAssemblies != null) assemblies = assemblies.Union(ExtraAssemblies).ToArray(); Assembly defaultRendererAssembly = Device.PlatformServices.GetType().GetTypeInfo().Assembly; int indexOfExecuting = Array.IndexOf(assemblies, defaultRendererAssembly); if (indexOfExecuting > 0) { assemblies[indexOfExecuting] = assemblies[0]; assemblies[0] = defaultRendererAssembly; } // Don't use LINQ for performance reasons // Naive implementation can easily take over a second to run Profile.FramePartition("Reflect"); foreach (Assembly assembly in assemblies) { string frameName = Profile.IsEnabled ? assembly.GetName().Name : "Assembly"; Profile.FrameBegin(frameName); foreach (Type attrType in attrTypes) { object[] attributes = assembly.GetCustomAttributesSafe(attrType); if (attributes == null || attributes.Length == 0) continue; var length = attributes.Length; for (var i = 0; i < length; i++) { var a = attributes[i]; var attribute = a as HandlerAttribute; if (attribute == null && (a is ExportFontAttribute fa)) { FontRegistrar.Register(fa.FontFileName, fa.Alias, assembly); } else { if (attribute.ShouldRegister()) Registered.Register(attribute.HandlerType, attribute.TargetType, attribute.SupportedVisuals, attribute.Priority); } } } object[] effectAttributes = assembly.GetCustomAttributesSafe(typeof(ExportEffectAttribute)); if (effectAttributes == null || effectAttributes.Length == 0) { Profile.FrameEnd(frameName); continue; } string resolutionName = assembly.FullName; var resolutionNameAttribute = (ResolutionGroupNameAttribute)assembly.GetCustomAttribute(typeof(ResolutionGroupNameAttribute)); if (resolutionNameAttribute != null) resolutionName = resolutionNameAttribute.ShortName; //NOTE: a simple cast to ExportEffectAttribute[] failed on UWP, hence the Array.Copy var typedEffectAttributes = new ExportEffectAttribute[effectAttributes.Length]; Array.Copy(effectAttributes, typedEffectAttributes, effectAttributes.Length); RegisterEffects(resolutionName, typedEffectAttributes); Profile.FrameEnd(frameName); } if (FontRegistrar is FontRegistrar fontRegistrar) { var type = Registered.GetHandlerType(typeof(EmbeddedFont)); if (type != null) fontRegistrar.SetFontLoader((IEmbeddedFontLoader)Activator.CreateInstance(type)); } RegisterStylesheets(flags); Profile.FramePartition("DependencyService.Initialize"); DependencyService.Initialize(assemblies); Profile.FrameEnd(); } } }
37.180556
173
0.725065
[ "MIT" ]
trampster/maui
src/Controls/src/Core/Registrar.cs
16,062
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; namespace GraphGen { public class GraphVisEdge { private readonly GraphVisNode _node1; private readonly GraphVisNode _node2; public GraphVisEdge(GraphVisNode node1, GraphVisNode node2) { _node1 = node1; _node2 = node2; } public string Create() { //var (n1, _) = GraphVisNode.GetNodeInfo(node); //var (n2, _) = GraphVisNode.GetNodeInfo(subNode); return $" {_node1.Name} -> {_node2.Name};"; //[color=\"0.002 0.999 0.999\"];"; } } }
24.451613
91
0.613456
[ "MIT" ]
AndyGerlicher/MSBuildGraphVisualizer
src/GraphGen/GraphVisEdge.cs
760
C#
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2018 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. 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. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; using System.Xml.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Senparc.Weixin.Cache; using Senparc.Weixin.Cache.Redis; using Senparc.Weixin.Exceptions; using Senparc.Weixin.MP.AdvancedAPIs; using Senparc.Weixin.MP.AdvancedAPIs.User; using Senparc.Weixin.MP.CommonAPIs; using Senparc.Weixin.MP.Containers; using Senparc.Weixin.MP.Entities; using Senparc.CO2NET.Threads; using Senparc.CO2NET.Cache; using Senparc.CO2NET.Cache.Redis; namespace Senparc.Weixin.MP.Test.CommonAPIs { //已通过测试 //[TestClass] public partial class CommonApiTest { private dynamic _appConfig; protected dynamic AppConfig { get { if (_appConfig == null) { #if NETCOREAPP2_0 || NETCOREAPP2_1 var filePath = "../../../Config/test.config"; #else var filePath = "../../Config/test.config"; #endif if (File.Exists(filePath)) { #if NETCOREAPP2_0 || NETCOREAPP2_1 var stream = new FileStream(filePath, FileMode.Open); var doc = XDocument.Load(stream); stream.Dispose(); #else var doc = XDocument.Load(filePath); #endif _appConfig = new { AppId = doc.Root.Element("AppId").Value, Secret = doc.Root.Element("Secret").Value, MchId = doc.Root.Element("MchId").Value, TenPayKey = doc.Root.Element("TenPayKey").Value, TenPayCertPath = doc.Root.Element("TenPayCertPath").Value, //WxOpenAppId= doc.Root.Element("WxOpenAppId").Value, //WxOpenSecret = doc.Root.Element("WxOpenSecret").Value }; } else { _appConfig = new { AppId = "YourAppId", //换成你的信息 Secret = "YourSecret",//换成你的信息 MchId = "YourMchId",//换成你的信息 TenPayKey = "YourTenPayKey",//换成你的信息 TenPayCertPath = "YourTenPayCertPath",//换成你的信息 //WxOpenAppId="YourWxOpenAppId",//换成你的小程序AppId //WxOpenSecret= "YourWxOpenSecret",//换成你的小程序Secret }; } } return _appConfig; } } protected string _appId { get { return AppConfig.AppId; } } protected string _appSecret { get { return AppConfig.Secret; } } protected string _mchId { get { return AppConfig.MchId; } } protected string _tenPayKey { get { return AppConfig.TenPayKey; } } protected string _tenPayCertPath { get { return AppConfig.TenPayCertPath; } } //protected string _wxOpenAppId //{ // get { return AppConfig.WxOpenAppId; } //} //protected string _wxOpenSecret //{ // get { return AppConfig.WxOpenSecret; } //} protected readonly bool _useRedis = false;//是否使用Reids /* 由于获取accessToken有次数限制,为了节约请求, * 可以到 http://sdk.weixin.senparc.com/Menu 获取Token之后填入下方, * 使用当前可用Token直接进行测试。 */ private string _access_token = null; protected string _testOpenId = "olPjZjsXuQPJoV0HlruZkNzKc91E";//换成实际关注者的OpenId /// <summary> /// 自动获取Openid /// </summary> /// <param name="getNew">是否从服务器上强制获取一个</param> /// <returns></returns> protected string getTestOpenId(bool getNew) { if (getNew || string.IsNullOrEmpty(_testOpenId)) { var accessToken = AccessTokenContainer.GetAccessToken(_appId); var openIdResult = UserApi.Get(accessToken, null); _testOpenId = openIdResult.data.openid.First(); } return _testOpenId; } protected Dictionary<Thread, bool> AsyncThreadsCollection = new Dictionary<Thread, bool>(); /// <summary> /// 异步多线程测试方法 /// </summary> /// <param name="maxThreadsCount"></param> /// <param name="openId"></param> /// <param name="threadAction"></param> protected void TestAyncMethod(int maxThreadsCount, string openId, ThreadStart threadAction) { //int finishThreadsCount = 0; for (int i = 0; i < maxThreadsCount; i++) { Thread thread = new Thread(threadAction); AsyncThreadsCollection.Add(thread, false); } AsyncThreadsCollection.Keys.ToList().ForEach(z => z.Start()); while (AsyncThreadsCollection.Count > 0) { Thread.Sleep(100); } } public CommonApiTest() { if (_useRedis) { var redisConfiguration = "localhost:6379"; RedisManager.ConfigurationOption = redisConfiguration; CacheStrategyFactory.RegisterObjectCacheStrategy(() => RedisObjectCacheStrategy.Instance);//Redis } //全局只需注册一次 AccessTokenContainer.Register(_appId, _appSecret); ////注册小程序 //if (!string.IsNullOrEmpty(_wxOpenAppId)) //{ // AccessTokenContainer.Register(_wxOpenAppId, _wxOpenSecret); //} ThreadUtility.Register(); //v13.3.0之后,JsApiTicketContainer已经合并入AccessTokenContainer,已经不需要单独注册 ////全局只需注册一次 //JsApiTicketContainer.Register(_appId, _appSecret); } [TestMethod] public void GetTokenTest() { var tokenResult = CommonApi.GetToken(_appId, _appSecret); Assert.IsNotNull(tokenResult); Assert.IsTrue(tokenResult.access_token.Length > 0); Assert.IsTrue(tokenResult.expires_in > 0); } [TestMethod] public void GetTokenFailTest() { try { var result = CommonApi.GetToken("appid", "secret"); Assert.Fail();//上一步就应该已经抛出异常 } catch (ErrorJsonResultException ex) { //实际返回的信息(错误信息) Assert.AreEqual(ex.JsonResult.errcode, ReturnCode.不合法的APPID); } } [TestMethod] public void GetUserInfoTest() { try { var accessToken = AccessTokenContainer.GetAccessToken(_appId); var result = CommonApi.GetUserInfo(accessToken, _testOpenId); Assert.IsNotNull(result); } catch (Exception ex) { //如果不参加内测,只是“服务号”,这类接口仍然不能使用,会抛出异常:错误代码:45009:api freq out of limit } } [TestMethod] public void GetTicketTest() { var tokenResult = CommonApi.GetTicket(_appId, _appSecret); Assert.IsNotNull(tokenResult); Assert.IsTrue(tokenResult.ticket.Length > 0); Assert.IsTrue(tokenResult.expires_in > 0); } } }
32.868726
113
0.540233
[ "Apache-2.0" ]
TomLiu-GitHub/WeiXinMPSDK
src/Senparc.Weixin.MP/Senparc.Weixin.MP.Test/CommonAPIs/CommonApiTest.cs
8,987
C#
// Copyright (c) 2021 SceneGate // 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. namespace SceneGate.Games.ProfessorLayton.Texts { using Yarhl.Media.Text; /// <summary> /// Parameters for the <see cref="PoTableReplacer" /> converter. /// </summary> public class PoTableReplacerParams { /// <summary> /// Gets or sets the text replacements. /// </summary> public Replacer Replacer { get; set; } /// <summary> /// Gets or sets a value indicating whether the replacement is forward or backward. /// </summary> public bool TransformForward { get; set; } } }
41.7
91
0.711631
[ "MIT" ]
pleonex/LayTea
src/LayTea/Texts/PoTableReplacerParams.cs
1,668
C#
#region License // Copyright (c) 2007 James Newton-King // // 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. #endregion #if !(PORTABLE40 || PORTABLE || NETFX_CORE) using System; using System.Collections.Generic; #if NET20 using Com.Ctrip.Framework.Apollo.Newtonsoft.Json.Utilities.LinqBridge; #endif using System.Text; using System.Reflection; using Com.Ctrip.Framework.Apollo.Newtonsoft.Json.Utilities; using System.Globalization; namespace Com.Ctrip.Framework.Apollo.Newtonsoft.Json.Serialization { /// <summary> /// Get and set values for a <see cref="MemberInfo"/> using dynamic methods. /// </summary> public class DynamicValueProvider : IValueProvider { private readonly MemberInfo _memberInfo; private Func<object, object> _getter; private Action<object, object> _setter; /// <summary> /// Initializes a new instance of the <see cref="DynamicValueProvider"/> class. /// </summary> /// <param name="memberInfo">The member info.</param> public DynamicValueProvider(MemberInfo memberInfo) { ValidationUtils.ArgumentNotNull(memberInfo, "memberInfo"); _memberInfo = memberInfo; } /// <summary> /// Sets the value. /// </summary> /// <param name="target">The target to set the value on.</param> /// <param name="value">The value to set on the target.</param> public void SetValue(object target, object value) { try { if (_setter == null) _setter = DynamicReflectionDelegateFactory.Instance.CreateSet<object>(_memberInfo); #if DEBUG // dynamic method doesn't check whether the type is 'legal' to set // add this check for unit tests if (value == null) { if (!ReflectionUtils.IsNullable(ReflectionUtils.GetMemberUnderlyingType(_memberInfo))) throw new JsonSerializationException("Incompatible value. Cannot set {0} to null.".FormatWith(CultureInfo.InvariantCulture, _memberInfo)); } else if (!ReflectionUtils.GetMemberUnderlyingType(_memberInfo).IsAssignableFrom(value.GetType())) { throw new JsonSerializationException("Incompatible value. Cannot set {0} to type {1}.".FormatWith(CultureInfo.InvariantCulture, _memberInfo, value.GetType())); } #endif _setter(target, value); } catch (Exception ex) { throw new JsonSerializationException("Error setting value to '{0}' on '{1}'.".FormatWith(CultureInfo.InvariantCulture, _memberInfo.Name, target.GetType()), ex); } } /// <summary> /// Gets the value. /// </summary> /// <param name="target">The target to get the value from.</param> /// <returns>The value.</returns> public object GetValue(object target) { try { if (_getter == null) _getter = DynamicReflectionDelegateFactory.Instance.CreateGet<object>(_memberInfo); return _getter(target); } catch (Exception ex) { throw new JsonSerializationException("Error getting value from '{0}' on '{1}'.".FormatWith(CultureInfo.InvariantCulture, _memberInfo.Name, target.GetType()), ex); } } } } #endif
40.353982
179
0.638377
[ "Apache-2.0" ]
307209239/apollo-net
Apollo/Newtonsoft.Json/Serialization/DynamicValueProvider.cs
4,562
C#
/* * 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 Aliyun.Acs.Core; using System.Collections.Generic; namespace Aliyun.Acs.Rds.Model.V20140815 { public class DescribeDBInstanceByTagsResponse : AcsResponse { private string requestId; private int? pageNumber; private int? pageRecordCount; private int? totalRecordCount; private List<DescribeDBInstanceByTags_DBInstanceTag> items; public string RequestId { get { return requestId; } set { requestId = value; } } public int? PageNumber { get { return pageNumber; } set { pageNumber = value; } } public int? PageRecordCount { get { return pageRecordCount; } set { pageRecordCount = value; } } public int? TotalRecordCount { get { return totalRecordCount; } set { totalRecordCount = value; } } public List<DescribeDBInstanceByTags_DBInstanceTag> Items { get { return items; } set { items = value; } } public class DescribeDBInstanceByTags_DBInstanceTag { private string dBInstanceId; private List<DescribeDBInstanceByTags_Tag> tags; public string DBInstanceId { get { return dBInstanceId; } set { dBInstanceId = value; } } public List<DescribeDBInstanceByTags_Tag> Tags { get { return tags; } set { tags = value; } } public class DescribeDBInstanceByTags_Tag { private string tagKey; private string tagValue; public string TagKey { get { return tagKey; } set { tagKey = value; } } public string TagValue { get { return tagValue; } set { tagValue = value; } } } } } }
17.006211
63
0.604456
[ "Apache-2.0" ]
brightness007/unofficial-aliyun-openapi-net-sdk
aliyun-net-sdk-rds/Rds/Model/V20140815/DescribeDBInstanceByTagsResponse.cs
2,738
C#
using UnityEngine; using System.Collections; using System.Collections.Generic; public class BerserkerStatus : StatusM { public override void Init(int SceneID,int ResalseSceneID,int SkillID,SkillStatusInfo Info) { m_OverData = StatusOverAction.CD; m_AddRole = AddRule.Replace; m_type = StatusType.Berserker; m_SkillImmune = ImmuneSkill.Normal; m_InterruptSkill = true; m_SelfInterruptSkill = false; base.Init(SceneID,ResalseSceneID,SkillID,Info); } /// <summary> /// 获取属性数据 /// </summary> public override int GetAttrData(EffectType type) { List<int>lData = new List<int>(); for(int i = 0; i < m_StatusData.Count ; i++) { StatusAction skill = m_StatusData[i]; if(skill != null) { skill.GetAttrData(ref lData ); } } return GetAttrData(lData , type); } /// <summary> /// 持续状态属性 /// </summary> /// <author>zhulin</author> public override void DoSkillStatus(float duration) { if(m_StatusData == null || m_StatusData.Count ==0) return ; for(int j = 0; j < m_StatusData.Count; j++ ) { StatusAction skill = m_StatusData[j]; if(skill != null) { List<int>lData = new List<int>(); if(skill.GetPersistence () == true) { skill.GetAttrData(ref lData); for(int i = 0; i <lData.Count -1; i += 2 ) { EffectType Type = (EffectType)lData[i]; if (Type == EffectType.SetHpByPercent) { if (duration <= 0.0) { Life life = CM.GetAllLifeM(m_SceneID, LifeMType.ALL); life.HP = (int)(life.fullHP * lData[i+1] * 0.01f); } } } } else { List<int>l = new List<int>(); skill.GetAttrData(ref l); for(int i = 0; i <l.Count -1; i += 2 ) { EffectType Type = (EffectType)l[i]; if(Type == EffectType.RecoHp || Type == EffectType.RecoAnger || Type == EffectType.IcePoint ) { //是否要调用,可能会产生添加怒气 lData.Add(l[i]); lData.Add(l[i+1]); } } } if(skill.DoSkillStatus(duration)== true && lData.Count > 0) { //Debug.Log(" 加血 " + duration + "," + skill.Duration); AddrContinuedAttr(lData); } } } } }
23.347826
99
0.597765
[ "MIT" ]
741645596/batgame
Assets/Scripts/LifeM/LifeProperty/Status/SkillStatus/BerserkerStatus.cs
2,208
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cosmos.Sys.Network { // http://en.wikipedia.org/wiki/User_Datagram_Protocol public class UDPPacket : IP4Packet { protected new int mHeaderBegin; public UDPPacket(uint aSrcIP, UInt16 aSrcPort, uint aDestIP, UInt16 aDestPort, byte[] aData) { mHeaderBegin = Initialize(aData, 8, 0x11, aSrcIP, aDestIP); SourcePort = aSrcPort; DestinationPort = aDestPort; // Length int xSize = mData.Length - mHeaderBegin; mData[mHeaderBegin + 4] = (byte)(xSize >> 8); mData[mHeaderBegin + 5] = (byte)xSize; } public UDPPacket(byte[] aRawData) { mData = aRawData; } public UInt16 Length { get { return (UInt16)(mData[mHeaderBegin + 4] << 8 | mData[mHeaderBegin + 5]); } } // Properties are bound directly to data. For frequent updates this is slower // but typically users will not make frequent updates. // Doing it this way instead of storing in a property and inserted later // saves memory, and also eliminates the need later to write separate // parse routines when we receive packets. public UInt16 SourcePort { get { return (UInt16)(mData[mHeaderBegin] << 8 | mData[mHeaderBegin + 1]); } set { mData[mHeaderBegin] = (byte)(value >> 8); mData[mHeaderBegin + 1] = (byte)value; } } public UInt16 DestinationPort { get { return (UInt16)(mData[mHeaderBegin + 2] << 8 | mData[mHeaderBegin + 3]); } set { mData[mHeaderBegin + 2] = (byte)(value >> 8); mData[mHeaderBegin + 3] = (byte)value; } } protected override void Conclude() { base.Conclude(); mData[mHeaderBegin + 6] = 0; mData[mHeaderBegin + 7] = 0; // This needs to be updated. 0 is valid for no checksum, but this also // is correct once updated // All offsets are -34 now //mData[40] = 0; //mData[41] = 0; //// TODO: Change this to a ASM and use 32 bit addition //UInt32 xResult = 0; //// TODO: Adjust for length and odd sizes //for (int i = 34; i < 42; i = i + 2) { // xResult += (UInt16)((mData[i] << 8) + mData[i + 1]); //} //// Data //xResult += (UInt16)((mData[42] << 8) + 0); //// Pseudo header //// --Protocol //// TODO: Change to actually iterate data //xResult += (UInt16)(mData[23]); //// --IP Source //xResult += (UInt16)((mData[26] << 8) + mData[27]); //xResult += (UInt16)((mData[28] << 8) + mData[29]); //// --IP Dest //xResult += (UInt16)((mData[30] << 8) + mData[31]); //xResult += (UInt16)((mData[32] << 8) + mData[33]); //// --UDP Length //xResult += (UInt16)((mData[38] << 8) + mData[39]); //xResult = (~((xResult & 0xFFFF) + (xResult >> 16))); //mData[40] = (byte)(xResult >> 8); //mData[41] = (byte)xResult; //return (UInt16)xResult; } } }
35.530612
102
0.496841
[ "BSD-3-Clause" ]
AcaiBerii/Cosmos
source/Archive/Cosmos.Sys/Network/ChadTCPIP/UDPPacket.cs
3,484
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.IO; using System.Text.Encodings.Web; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.TagHelpers.Cache; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Internal; using Microsoft.Extensions.Primitives; using Microsoft.Extensions.WebEncoders.Testing; using Moq; using Xunit; namespace Microsoft.AspNetCore.Mvc.TagHelpers { public class CacheTagHelperTest { [Fact] public async Task ProcessAsync_DoesNotCache_IfDisabled() { // Arrange var id = "unique-id"; var childContent = "original-child-content"; var cache = new Mock<IMemoryCache>(); var value = new Mock<ICacheEntry>(); value.Setup(c => c.Value).Returns(new DefaultTagHelperContent().SetContent("ok")); cache.Setup(c => c.CreateEntry( /*key*/ It.IsAny<string>())) .Returns((object key) => value.Object) .Verifiable(); object cacheResult; cache.Setup(c => c.TryGetValue(It.IsAny<string>(), out cacheResult)) .Returns(false); var tagHelperContext = GetTagHelperContext(id); var tagHelperOutput = GetTagHelperOutput( attributes: new TagHelperAttributeList(), childContent: childContent); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache.Object), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = false }; // Act await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput); // Assert Assert.Equal(childContent, tagHelperOutput.Content.GetContent()); cache.Verify(c => c.CreateEntry( /*key*/ It.IsAny<string>()), Times.Never); } [Fact] public async Task ProcessAsync_ReturnsCachedValue_IfEnabled() { // Arrange var id = "unique-id"; var childContent = "original-child-content"; var cache = new MemoryCache(new MemoryCacheOptions()); var tagHelperContext = GetTagHelperContext(id); var tagHelperOutput = GetTagHelperOutput( attributes: new TagHelperAttributeList(), childContent: childContent); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; // Act await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput); // Assert Assert.Empty(tagHelperOutput.PreContent.GetContent()); Assert.Empty(tagHelperOutput.PostContent.GetContent()); Assert.True(tagHelperOutput.IsContentModified); Assert.Equal(childContent, tagHelperOutput.Content.GetContent()); } [Fact] public async Task ProcessAsync_ReturnsCachedValue_IfVaryByParamIsUnchanged() { // Arrange - 1 var id = "unique-id"; var childContent = "original-child-content"; var cache = new MemoryCache(new MemoryCacheOptions()); var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput( attributes: new TagHelperAttributeList(), childContent: childContent); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { VaryByQuery = "key1,key2", ViewContext = GetViewContext(), }; cacheTagHelper1.ViewContext.HttpContext.Request.QueryString = new QueryString( "?key1=value1&key2=value2"); // Act - 1 await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert - 1 Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent, tagHelperOutput1.Content.GetContent()); // Arrange - 2 var tagHelperContext2 = GetTagHelperContext(id); var tagHelperOutput2 = GetTagHelperOutput( attributes: new TagHelperAttributeList(), childContent: "different-content"); var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { VaryByQuery = "key1,key2", ViewContext = GetViewContext(), }; cacheTagHelper2.ViewContext.HttpContext.Request.QueryString = new QueryString( "?key1=value1&key2=value2"); // Act - 2 await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); // Assert - 2 Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent, tagHelperOutput2.Content.GetContent()); } [Fact] public async Task ProcessAsync_RecalculatesValueIfCacheKeyChanges() { // Arrange - 1 var id = "unique-id"; var childContent1 = "original-child-content"; var cache = new MemoryCache(new MemoryCacheOptions()); var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1); tagHelperOutput1.PreContent.Append("<cache>"); tagHelperOutput1.PostContent.SetContent("</cache>"); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { VaryByCookie = "cookie1,cookie2", ViewContext = GetViewContext(), }; cacheTagHelper1.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2"; // Act - 1 await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert - 1 Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent()); // Arrange - 2 var childContent2 = "different-content"; var tagHelperContext2 = GetTagHelperContext(id); var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2); tagHelperOutput2.PreContent.SetContent("<cache>"); tagHelperOutput2.PostContent.SetContent("</cache>"); var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { VaryByCookie = "cookie1,cookie2", ViewContext = GetViewContext(), }; cacheTagHelper2.ViewContext.HttpContext.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2"; // Act - 2 await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); // Assert - 2 Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent()); } [Fact] public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresOnIsSet() { // Arrange var expiresOn = DateTimeOffset.UtcNow.AddMinutes(4); var cache = new MemoryCache(new MemoryCacheOptions()); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ExpiresOn = expiresOn }; // Act var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions(); // Assert Assert.Equal(expiresOn, cacheEntryOptions.AbsoluteExpiration); } [Fact] public async Task ProcessAsync_SetsEntrySize_ForPlaceholderAndFinalCacheEntries() { // Arrange var mockCache = new Mock<IMemoryCache>(); var tempEntry = new Mock<ICacheEntry>(); tempEntry.SetupAllProperties(); tempEntry.Setup(e => e.ExpirationTokens).Returns(new List<IChangeToken>()); tempEntry.Setup(e => e.PostEvictionCallbacks).Returns(new List<PostEvictionCallbackRegistration>()); var finalEntry = new Mock<ICacheEntry>(); finalEntry.SetupAllProperties(); finalEntry.Setup(e => e.ExpirationTokens).Returns(new List<IChangeToken>()); finalEntry.Setup(e => e.PostEvictionCallbacks).Returns(new List<PostEvictionCallbackRegistration>()); object value; mockCache .Setup(s => s.TryGetValue(It.IsAny<object>(), out value)) .Returns(false); mockCache.SetupSequence(mc => mc.CreateEntry(It.IsAny<object>())) .Returns(tempEntry.Object) .Returns(finalEntry.Object); var id = "unique-id"; var childContent1 = "original-child-content"; var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1); tagHelperOutput1.PreContent.Append("<cache>"); tagHelperOutput1.PostContent.SetContent("</cache>"); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(mockCache.Object), new HtmlTestEncoder()) { ViewContext = GetViewContext(), }; // Act await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent()); tempEntry.VerifySet(e => e.Size = 64); finalEntry.VerifySet(e => e.Size = childContent1.Length * 2); } [Fact] public void UpdateCacheEntryOptions_DefaultsTo30SecondsSliding_IfNoEvictionCriteriaIsProvided() { // Arrange var slidingExpiresIn = TimeSpan.FromSeconds(30); var cache = new MemoryCache(new MemoryCacheOptions()); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()); // Act var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions(); // Assert Assert.Equal(slidingExpiresIn, cacheEntryOptions.SlidingExpiration); } [Fact] public void UpdateCacheEntryOptions_SetsAbsoluteExpiration_IfExpiresAfterIsSet() { // Arrange var expiresAfter = TimeSpan.FromSeconds(42); var cache = new MemoryCache(new MemoryCacheOptions()); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ExpiresAfter = expiresAfter }; // Act var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions(); // Assert Assert.Equal(expiresAfter, cacheEntryOptions.AbsoluteExpirationRelativeToNow); } [Fact] public void UpdateCacheEntryOptions_SetsSlidingExpiration_IfExpiresSlidingIsSet() { // Arrange var expiresSliding = TimeSpan.FromSeconds(37); var cache = new MemoryCache(new MemoryCacheOptions()); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ExpiresSliding = expiresSliding }; // Act var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions(); // Assert Assert.Equal(expiresSliding, cacheEntryOptions.SlidingExpiration); } [Fact] public void UpdateCacheEntryOptions_SetsCachePreservationPriority() { // Arrange var priority = CacheItemPriority.High; var cache = new MemoryCache(new MemoryCacheOptions()); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { Priority = priority }; // Act var cacheEntryOptions = cacheTagHelper.GetMemoryCacheEntryOptions(); // Assert Assert.Equal(priority, cacheEntryOptions.Priority); } [Fact] public async Task ProcessAsync_UsesExpiresAfter_ToExpireCacheEntry() { // Arrange - 1 var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero); var id = "unique-id"; var childContent1 = "original-child-content"; var clock = new Mock<ISystemClock>(); clock.SetupGet(p => p.UtcNow) .Returns(() => currentTime); var cache = new MemoryCache(new MemoryCacheOptions { Clock = clock.Object }); var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1); tagHelperOutput1.PreContent.SetContent("<cache>"); tagHelperOutput1.PostContent.SetContent("</cache>"); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresAfter = TimeSpan.FromMinutes(10) }; // Act - 1 await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert - 1 Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent()); // Arrange - 2 var childContent2 = "different-content"; var tagHelperContext2 = GetTagHelperContext(id); var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2); tagHelperOutput2.PreContent.SetContent("<cache>"); tagHelperOutput2.PostContent.SetContent("</cache>"); var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresAfter = TimeSpan.FromMinutes(10) }; currentTime = currentTime.AddMinutes(11); // Act - 2 await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); // Assert - 2 Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent()); } [Fact] public async Task ProcessAsync_UsesExpiresOn_ToExpireCacheEntry() { // Arrange - 1 var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero); var id = "unique-id"; var childContent1 = "original-child-content"; var clock = new Mock<ISystemClock>(); clock.SetupGet(p => p.UtcNow) .Returns(() => currentTime); var cache = new MemoryCache(new MemoryCacheOptions { Clock = clock.Object }); var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1); tagHelperOutput1.PreContent.SetContent("<cache>"); tagHelperOutput1.PostContent.SetContent("</cache>"); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresOn = currentTime.AddMinutes(5) }; // Act - 1 await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert - 1 Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent()); // Arrange - 2 currentTime = currentTime.AddMinutes(5).AddSeconds(2); var childContent2 = "different-content"; var tagHelperContext2 = GetTagHelperContext(id); var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2); tagHelperOutput2.PreContent.SetContent("<cache>"); tagHelperOutput2.PostContent.SetContent("</cache>"); var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresOn = currentTime.AddMinutes(5) }; // Act - 2 await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); // Assert - 2 Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent()); } [Fact] public async Task ProcessAsync_UsesExpiresSliding_ToExpireCacheEntryWithSlidingExpiration() { // Arrange - 1 var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero); var id = "unique-id"; var childContent1 = "original-child-content"; var clock = new Mock<ISystemClock>(); clock.SetupGet(p => p.UtcNow) .Returns(() => currentTime); var cache = new MemoryCache(new MemoryCacheOptions { Clock = clock.Object }); var tagHelperContext1 = GetTagHelperContext(id); var tagHelperOutput1 = GetTagHelperOutput(childContent: childContent1); tagHelperOutput1.PreContent.SetContent("<cache>"); tagHelperOutput1.PostContent.SetContent("</cache>"); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresSliding = TimeSpan.FromSeconds(30) }; // Act - 1 await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); // Assert - 1 Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent1, tagHelperOutput1.Content.GetContent()); // Arrange - 2 currentTime = currentTime.AddSeconds(35); var childContent2 = "different-content"; var tagHelperContext2 = GetTagHelperContext(id); var tagHelperOutput2 = GetTagHelperOutput(childContent: childContent2); tagHelperOutput2.PreContent.SetContent("<cache>"); tagHelperOutput2.PostContent.SetContent("</cache>"); var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), ExpiresSliding = TimeSpan.FromSeconds(30) }; // Act - 2 await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); // Assert - 2 Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent2, tagHelperOutput2.Content.GetContent()); } [Fact] [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/36765")] public async Task ProcessAsync_FlowsEntryLinkThatAllowsAddingTriggersToAddedEntry() { // Arrange var id = "some-id"; var expectedContent = new DefaultTagHelperContent(); expectedContent.SetContent("some-content"); var tokenSource = new CancellationTokenSource(); var cache = new MemoryCache(new MemoryCacheOptions()); var cacheEntryOptions = new MemoryCacheEntryOptions() .AddExpirationToken(new CancellationChangeToken(tokenSource.Token)); var tagHelperContext = new TagHelperContext( tagName: "cache", allAttributes: new TagHelperAttributeList(), items: new Dictionary<object, object>(), uniqueId: id); var tagHelperOutput = new TagHelperOutput( "cache", new TagHelperAttributeList { { "attr", "value" } }, getChildContentAsync: (useCachedResult, encoder) => { if (!cache.TryGetValue("key1", out TagHelperContent tagHelperContent)) { tagHelperContent = expectedContent; cache.Set("key1", tagHelperContent, cacheEntryOptions); } return Task.FromResult(tagHelperContent); }); tagHelperOutput.PreContent.SetContent("<cache>"); tagHelperOutput.PostContent.SetContent("</cache>"); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), }; var cacheTagKey = new CacheTagKey(cacheTagHelper, tagHelperContext); var key = cacheTagKey.GenerateKey(); // Act - 1 await cacheTagHelper.ProcessAsync(tagHelperContext, tagHelperOutput); var result = cache.TryGetValue(cacheTagKey, out Task<IHtmlContent> cachedValue); // Assert - 1 Assert.Equal("HtmlEncode[[some-content]]", tagHelperOutput.Content.GetContent()); Assert.True(result); // Act - 2 tokenSource.Cancel(); result = cache.TryGetValue(cacheTagKey, out cachedValue); // Assert - 2 Assert.False(result); Assert.Null(cachedValue); } [Fact] public async Task ProcessAsync_ComputesValueOnce_WithConcurrentRequests() { // Arrange var id = "unique-id"; var childContent = "some-content"; var event1 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var event2 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var event3 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var calls = 0; var cache = new MemoryCache(new MemoryCacheOptions()); var tagHelperContext1 = GetTagHelperContext(id + 1); var tagHelperContext2 = GetTagHelperContext(id + 2); var tagHelperOutput1 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: (useCachedResult, encoder) => { calls++; event2.SetResult(0); var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return Task.FromResult<TagHelperContent>(tagHelperContent); }); var tagHelperOutput2 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: async (useCachedResult, encoder) => { calls++; await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return tagHelperContent; }); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; // Act var task1 = Task.Run(async () => { await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); await cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1); event3.SetResult(0); }); var task2 = Task.Run(async () => { await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); await cacheTagHelper2.ProcessAsync(tagHelperContext1, tagHelperOutput2); }); event1.SetResult(0); await Task.WhenAll(task1, task2); // Assert Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.True(tagHelperOutput1.IsContentModified); Assert.Equal(childContent, tagHelperOutput1.Content.GetContent()); Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent, tagHelperOutput2.Content.GetContent()); Assert.Equal(1, calls); } [Fact] public async Task ProcessAsync_ExceptionInProcessing_DoesntBlockConcurrentRequests() { // Arrange var id = "unique-id"; var childContent = "some-content"; var event1 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var event2 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var event3 = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously); var calls = 0; var cache = new MemoryCache(new MemoryCacheOptions()); var tagHelperContext1 = GetTagHelperContext(id + 1); var tagHelperContext2 = GetTagHelperContext(id + 2); var tagHelperOutput1 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: (useCachedResult, encoder) => { calls++; event2.SetResult(0); throw new Exception(); }); var tagHelperOutput2 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: async (useCachedResult, encoder) => { calls++; await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return tagHelperContent; }); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; // Act var task1 = Task.Run(async () => { await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); await Assert.ThrowsAsync<Exception>(() => cacheTagHelper1.ProcessAsync(tagHelperContext1, tagHelperOutput1)); event3.SetResult(0); }); var task2 = Task.Run(async () => { await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5)); await cacheTagHelper2.ProcessAsync(tagHelperContext2, tagHelperOutput2); }); event1.SetResult(0); await Task.WhenAll(task1, task2); // Assert Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.False(tagHelperOutput1.IsContentModified); Assert.Empty(tagHelperOutput1.Content.GetContent()); Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.True(tagHelperOutput2.IsContentModified); Assert.Equal(childContent, tagHelperOutput2.Content.GetContent()); Assert.Equal(2, calls); } [Fact] public async Task ProcessAsync_ExceptionInProcessing_DoNotThrowInSubsequentRequests() { // Arrange var id = "unique-id"; var childContent = "some-content"; var cache = new MemoryCache(new MemoryCacheOptions()); var counter = 0; Task<TagHelperContent> GetChildContentAsync(bool useCachedResult, HtmlEncoder encoder) { counter++; if (counter < 3) { // throw on first two calls throw new Exception(); } else { // produce content on third call var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return Task.FromResult<TagHelperContent>(tagHelperContent); } } var tagHelperContext1 = GetTagHelperContext(id); var tagHelperContext2 = GetTagHelperContext(id); var tagHelperContext3 = GetTagHelperContext(id); var tagHelperContext4 = GetTagHelperContext(id); var tagHelperOutput1 = new TagHelperOutput("cache", new TagHelperAttributeList(), GetChildContentAsync); var tagHelperOutput2 = new TagHelperOutput("cache", new TagHelperAttributeList(), GetChildContentAsync); var tagHelperOutput3 = new TagHelperOutput("cache", new TagHelperAttributeList(), GetChildContentAsync); var tagHelperOutput4 = new TagHelperOutput("cache", new TagHelperAttributeList(), GetChildContentAsync); var cacheTagHelper = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true, ExpiresAfter = TimeSpan.FromHours(1.0) }; // Act - 1 await Assert.ThrowsAsync<Exception>(() => cacheTagHelper.ProcessAsync(tagHelperContext1, tagHelperOutput1)); // Assert - 1 Assert.Equal(1, counter); Assert.Empty(tagHelperOutput1.PreContent.GetContent()); Assert.Empty(tagHelperOutput1.PostContent.GetContent()); Assert.False(tagHelperOutput1.IsContentModified); Assert.Empty(tagHelperOutput1.Content.GetContent()); // Act - 2 await Assert.ThrowsAsync<Exception>(() => cacheTagHelper.ProcessAsync(tagHelperContext2, tagHelperOutput2)); // Assert - 2 Assert.Equal(2, counter); Assert.Empty(tagHelperOutput2.PreContent.GetContent()); Assert.Empty(tagHelperOutput2.PostContent.GetContent()); Assert.False(tagHelperOutput2.IsContentModified); Assert.Empty(tagHelperOutput2.Content.GetContent()); // Act - 3 await cacheTagHelper.ProcessAsync(tagHelperContext3, tagHelperOutput3); // Assert - 3 Assert.Equal(3, counter); Assert.Empty(tagHelperOutput3.PreContent.GetContent()); Assert.Empty(tagHelperOutput3.PostContent.GetContent()); Assert.True(tagHelperOutput3.IsContentModified); Assert.Equal(childContent, tagHelperOutput3.Content.GetContent()); // Act - 4 await cacheTagHelper.ProcessAsync(tagHelperContext4, tagHelperOutput4); // Assert - 4 Assert.Equal(3, counter); Assert.Empty(tagHelperOutput4.PreContent.GetContent()); Assert.Empty(tagHelperOutput4.PostContent.GetContent()); Assert.True(tagHelperOutput4.IsContentModified); Assert.Equal(childContent, tagHelperOutput4.Content.GetContent()); } [Fact] public async Task ProcessAsync_WorksForNestedCacheTagHelpers() { // Arrange var expected = "Hello world"; var cache = new MemoryCache(new MemoryCacheOptions()); var encoder = new HtmlTestEncoder(); var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), encoder) { ViewContext = GetViewContext(), Enabled = true }; var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), encoder) { ViewContext = GetViewContext(), Enabled = true }; var tagHelperOutput2 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: (useCachedResult, _) => { var content = new DefaultTagHelperContent(); content.SetContent(expected); return Task.FromResult<TagHelperContent>(content); }); var tagHelperOutput1 = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: async (useCachedResult, _) => { var context = GetTagHelperContext("test2"); var output = tagHelperOutput2; await cacheTagHelper2.ProcessAsync(context, output); return await output.GetChildContentAsync(); }); // Act await cacheTagHelper1.ProcessAsync(GetTagHelperContext(), tagHelperOutput1); // Assert Assert.Equal(encoder.Encode(expected), tagHelperOutput1.Content.GetContent()); } [Fact] public async Task ProcessAsync_ThrowsExceptionForAwaiters_IfExecutorEncountersAnException() { // Arrange var expected = new DivideByZeroException(); var cache = new TestMemoryCache(); // The two instances represent two instances of the same cache tag helper appearance in the page. var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), new HtmlTestEncoder()) { ViewContext = GetViewContext(), Enabled = true }; var invokeCount = 0; var tagHelperOutput = new TagHelperOutput( "cache", new TagHelperAttributeList(), getChildContentAsync: (useCachedResult, _) => { invokeCount++; throw expected; }); // Act var task1 = Task.Run(() => cacheTagHelper1.ProcessAsync(GetTagHelperContext(cache.Key1), tagHelperOutput)); var task2 = Task.Run(() => cacheTagHelper2.ProcessAsync(GetTagHelperContext(cache.Key2), tagHelperOutput)); // Assert await Assert.ThrowsAsync<DivideByZeroException>(() => task1); await Assert.ThrowsAsync<DivideByZeroException>(() => task2); Assert.Equal(1, invokeCount); } [Fact] public async Task ProcessAsync_AwaitersUseTheResultOfExecutor() { // Arrange var expected = "Hello world"; var cache = new TestMemoryCache(); var encoder = new HtmlTestEncoder(); // The two instances represent two instances of the same cache tag helper appearance in the page. var cacheTagHelper1 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), encoder) { ViewContext = GetViewContext(), Enabled = true }; var cacheTagHelper2 = new CacheTagHelper(new CacheTagHelperMemoryCacheFactory(cache), encoder) { ViewContext = GetViewContext(), Enabled = true }; var invokeCount = 0; Func<bool, HtmlEncoder, Task<TagHelperContent>> getChildContentAsync = (useCachedResult, _) => { invokeCount++; var content = new DefaultTagHelperContent(); content.SetContent(expected); return Task.FromResult<TagHelperContent>(content); }; var tagHelperOutput1 = new TagHelperOutput("cache", new TagHelperAttributeList(), getChildContentAsync); var tagHelperOutput2 = new TagHelperOutput("cache", new TagHelperAttributeList(), getChildContentAsync); // Act var task1 = Task.Run(() => cacheTagHelper1.ProcessAsync(GetTagHelperContext(cache.Key1), tagHelperOutput1)); var task2 = Task.Run(() => cacheTagHelper2.ProcessAsync(GetTagHelperContext(cache.Key2), tagHelperOutput2)); // Assert await Task.WhenAll(task1, task2); Assert.Equal(1, invokeCount); // We expect getChildContentAsync to be invoked exactly once. Assert.Equal(encoder.Encode(expected), tagHelperOutput1.Content.GetContent()); Assert.Equal(encoder.Encode(expected), tagHelperOutput2.Content.GetContent()); } private static ViewContext GetViewContext() { var actionContext = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()); return new ViewContext( actionContext, Mock.Of<IView>(), new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()), Mock.Of<ITempDataDictionary>(), TextWriter.Null, new HtmlHelperOptions()); } private static TagHelperContext GetTagHelperContext(string id = "testid") { return new TagHelperContext( tagName: "cache", allAttributes: new TagHelperAttributeList(), items: new Dictionary<object, object>(), uniqueId: id); } private static TagHelperOutput GetTagHelperOutput( string tagName = "cache", TagHelperAttributeList attributes = null, string childContent = "some child content") { attributes = attributes ?? new TagHelperAttributeList { { "attr", "value" } }; return new TagHelperOutput( tagName, attributes, getChildContentAsync: (useCachedResult, encoder) => { var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return Task.FromResult<TagHelperContent>(tagHelperContent); }); } private class TestCacheEntry : ICacheEntry { public object Key { get; set; } public object Value { get; set; } public DateTimeOffset? AbsoluteExpiration { get; set; } public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; } public TimeSpan? SlidingExpiration { get; set; } public long? Size { get; set; } public IList<IChangeToken> ExpirationTokens { get; } = new List<IChangeToken>(); public IList<PostEvictionCallbackRegistration> PostEvictionCallbacks { get; } = new List<PostEvictionCallbackRegistration>(); public CacheItemPriority Priority { get; set; } public Action DisposeCallback { get; set; } public void Dispose() => DisposeCallback(); } // Simulates the scenario where a call to CacheTagHelper.ProcessAsync appears immediately after a prior one has assigned // a TaskCancellationSource as an entry. We want to ensure that both calls use the results of the TCS as their output. private class TestMemoryCache : IMemoryCache { private const int WaitTimeout = 5000; public readonly string Key1 = "Key1"; public readonly string Key2 = "Key2"; public readonly ManualResetEventSlim ManualResetEvent1 = new ManualResetEventSlim(); public readonly ManualResetEventSlim ManualResetEvent2 = new ManualResetEventSlim(); public TestCacheEntry Entry { get; private set; } public ICacheEntry CreateEntry(object key) { if (Entry != null) { // We're being invoked in the inner "CreateEntry" call where the TCS is replaced by the GetChildContentAsync // Task. Wait for the other concurrent Task to grab the TCS before we proceed. Assert.True(ManualResetEvent1.Wait(WaitTimeout)); } var cacheKey = Assert.IsType<CacheTagKey>(key); Assert.Equal(Key1, cacheKey.Key); Entry = new TestCacheEntry { Key = key, DisposeCallback = ManualResetEvent2.Set, }; return Entry; } public void Dispose() { } public void Remove(object key) { } public bool TryGetValue(object key, out object value) { var cacheKey = Assert.IsType<CacheTagKey>(key); if (cacheKey.Key == Key2) { Assert.True(ManualResetEvent2.Wait(WaitTimeout)); Assert.NotNull(Entry); value = Entry.Value; Assert.NotNull(value); ManualResetEvent1.Set(); return true; } else if (cacheKey.Key == Key1) { value = null; return false; } throw new Exception(); } } } }
42.64279
131
0.599748
[ "MIT" ]
48355746/AspNetCore
src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs
45,244
C#
using FreeSql.DataAnnotations; using System; using Xunit; namespace FreeSql.Tests.SqlServer { public class SqlServerAdoTest { [Fact] public void Pool() { var t1 = g.sqlserver.Ado.MasterPool.StatisticsFullily; } [Fact] public void SlavePools() { var t2 = g.sqlserver.Ado.SlavePools.Count; } [Fact] public void IsTracePerformance() { Assert.True(g.sqlserver.Ado.IsTracePerformance); } [Fact] public void ExecuteReader() { } [Fact] public void ExecuteArray() { } [Fact] public void ExecuteNonQuery() { } [Fact] public void ExecuteScalar() { } [Fact] public void Query() { var t3 = g.sqlserver.Ado.Query<xxx>("select * from song"); var t4 = g.sqlserver.Ado.Query<(int, string, string, DateTime)>("select * from song"); var t5 = g.sqlserver.Ado.Query<dynamic>("select * from song"); } class xxx { public int Id { get; set; } public string Title { get; set; } public string Url { get; set; } public DateTime Create_time { get; set; } } } }
18.607143
89
0.642994
[ "MIT" ]
564602391/FreeSql
FreeSql.Tests/SqlServer/SqlServerAdo/SqlServerAdoTest.cs
1,042
C#
// MonoGame - Copyright (C) The MonoGame Team // This file is subject to the terms and conditions defined in // file 'LICENSE.txt', which is part of this source code package. using System; using System.Runtime.InteropServices; using System.Text; using System.Runtime.CompilerServices; using System.Security; #if __IOS__ using ObjCRuntime; #endif namespace OpenGL { // Required to allow platforms other than iOS use the same code. // just don't include this on iOS [AttributeUsage(AttributeTargets.Delegate)] public sealed class MonoNativeFunctionWrapper : Attribute { } internal class EntryPointHelper { private const string NativeLibName = "SDL2.dll"; [SuppressUnmanagedCodeSecurity] [DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_GL_GetProcAddress", ExactSpelling = true)] public static extern IntPtr GetProcAddress(IntPtr proc); public static IntPtr GetAddress(string proc) { IntPtr p = Marshal.StringToHGlobalAnsi(proc); try { var addr = GetProcAddress(p); if (addr == IntPtr.Zero) throw new EntryPointNotFoundException(proc); return addr; } finally { Marshal.FreeHGlobal(p); } } } public enum BufferAccess { ReadOnly = 0x88B8, } public enum BufferUsageHint { StreamDraw = 0x88E0, StaticDraw = 0x88E4, } public enum StencilFace { Front = 0x0404, Back = 0x0405, } public enum DrawBuffersEnum { UnsignedShort, UnsignedInt, } public enum ShaderType { VertexShader = 0x8B31, FragmentShader = 0x8B30, } public enum ShaderParameter { LogLength = 0x8B84, CompileStatus = 0x8B81, SourceLength = 0x8B88, } public enum GetProgramParameterName { LogLength = 0x8B84, LinkStatus = 0x8B82, } public enum DrawElementsType { UnsignedShort = 0x1403, UnsignedInt = 0x1405, } public enum QueryTarget { SamplesPassed = 0x8914, } public enum GetQueryObjectParam { QueryResultAvailable = 0x8867, QueryResult = 0x8866, } public enum GenerateMipmapTarget { Texture1D = 0x0DE0, Texture2D = 0x0DE1, Texture3D = 0x806F, TextureCubeMap = 0x8513, Texture1DArray = 0x8C18, Texture2DArray = 0x8C1A, Texture2DMultisample = 0x9100, Texture2DMultisampleArray = 0x9102, } public enum BlitFramebufferFilter { Nearest = 0x2600, } public enum ReadBufferMode { ColorAttachment0 = 0x8CE0, } public enum DrawBufferMode { ColorAttachment0 = 0x8CE0, } public enum FramebufferErrorCode { FramebufferUndefined = 0x8219, FramebufferComplete = 0x8CD5, FramebufferCompleteExt = 0x8CD5, FramebufferIncompleteAttachment = 0x8CD6, FramebufferIncompleteAttachmentExt = 0x8CD6, FramebufferIncompleteMissingAttachment = 0x8CD7, FramebufferIncompleteMissingAttachmentExt = 0x8CD7, FramebufferIncompleteDimensionsExt = 0x8CD9, FramebufferIncompleteFormatsExt = 0x8CDA, FramebufferIncompleteDrawBuffer = 0x8CDB, FramebufferIncompleteDrawBufferExt = 0x8CDB, FramebufferIncompleteReadBuffer = 0x8CDC, FramebufferIncompleteReadBufferExt = 0x8CDC, FramebufferUnsupported = 0x8CDD, FramebufferUnsupportedExt = 0x8CDD, FramebufferIncompleteMultisample = 0x8D56, FramebufferIncompleteLayerTargets = 0x8DA8, FramebufferIncompleteLayerCount = 0x8DA9, } public enum BufferTarget { ArrayBuffer = 0x8892, ElementArrayBuffer = 0x8893, } public enum RenderbufferTarget { Renderbuffer = 0x8D41, RenderbufferExt = 0x8D41, } public enum FramebufferTarget { Framebuffer = 0x8D40, FramebufferExt = 0x8D40, ReadFramebuffer = 0x8CA8, } public enum RenderbufferStorage { Rgba8 = 0x8058, DepthComponent16 = 0x81a5, DepthComponent24 = 0x81a6, Depth24Stencil8 = 0x88F0, } public enum EnableCap : int { PointSmooth = 0x0B10, LineSmooth = 0x0B20, CullFace = 0x0B44, Lighting = 0x0B50, ColorMaterial = 0x0B57, Fog = 0x0B60, DepthTest = 0x0B71, StencilTest = 0x0B90, Normalize = 0x0BA1, AlphaTest = 0x0BC0, Dither = 0x0BD0, Blend = 0x0BE2, ColorLogicOp = 0x0BF2, ScissorTest = 0x0C11, Texture2D = 0x0DE1, PolygonOffsetFill = 0x8037, RescaleNormal = 0x803A, VertexArray = 0x8074, NormalArray = 0x8075, ColorArray = 0x8076, TextureCoordArray = 0x8078, Multisample = 0x809D, SampleAlphaToCoverage = 0x809E, SampleAlphaToOne = 0x809F, SampleCoverage = 0x80A0, } //public enum VertexPointerType { // Float = 0x1406, // Short = 0x1402, //} public enum VertexAttribPointerType { Float = 0x1406, Short = 0x1402, UnsignedByte = 0x1401, HalfFloat = 0x140B, } public enum CullFaceMode { Back = 0x0405, Front = 0x0404, } public enum FrontFaceDirection { Cw = 0x0900, Ccw = 0x0901, } public enum MaterialFace { FrontAndBack = 0x0408, } public enum PolygonMode { Fill = 0x1B02, Line = 0x1B01, } //public enum ColorPointerType { // Float = 0x1406, // Short = 0x1402, // UnsignedShort = 0x1403, // UnsignedByte = 0x1401, // HalfFloat = 0x140B, //} //public enum NormalPointerType { // Byte = 0x1400, // Float = 0x1406, // Short = 0x1402, // UnsignedShort = 0x1403, // UnsignedByte = 0x1401, // HalfFloat = 0x140B, //} //public enum TexCoordPointerType { // Byte = 0x1400, // Float = 0x1406, // Short = 0x1402, // UnsignedShort = 0x1403, // UnsignedByte = 0x1401, // HalfFloat = 0x140B, //} public enum BlendEquationMode { FuncAdd = 0x8006, Max = 0x8008, // ios MaxExt Min = 0x8007, // ios MinExt FuncReverseSubtract = 0x800B, FuncSubtract = 0x800A, } public enum BlendingFactorSrc { Zero = 0, SrcColor = 0x0300, OneMinusSrcColor = 0x0301, SrcAlpha = 0x0302, OneMinusSrcAlpha = 0x0303, DstAlpha = 0x0304, OneMinusDstAlpha = 0x0305, DstColor = 0x0306, OneMinusDstColor = 0x0307, SrcAlphaSaturate = 0x0308, ConstantColor = 0x8001, OneMinusConstantColor = 0x8002, ConstantAlpha = 0x8003, OneMinusConstantAlpha = 0x8004, One = 1, } public enum BlendingFactorDest { Zero = 0, SrcColor = 0x0300, OneMinusSrcColor = 0x0301, SrcAlpha = 0x0302, OneMinusSrcAlpha = 0x0303, DstAlpha = 0x0304, OneMinusDstAlpha = 0x0305, DstColor = 0X0306, OneMinusDstColor = 0x0307, SrcAlphaSaturate = 0x0308, ConstantColor = 0x8001, OneMinusConstantColor = 0x8002, ConstantAlpha = 0x8003, OneMinusConstantAlpha = 0x8004, One = 1, } public enum DepthFunction { Always = 0x0207, Equal = 0x0202, Greater = 0x0204, Gequal = 0x0206, Less = 0x0201, Lequal = 0x0203, Never = 0x0200, Notequal = 0x0205, } public enum GetPName : int { MaxTextureImageUnits = 0x8872, MaxVertexAttribs = 0x8869, MaxTextureSize = 0x0D33, MaxDrawBuffers = 0x8824, TextureBinding2D = 0x8069, MaxTextureMaxAnisotropyExt = 0x84FF, } public enum StringName { Extensions = 0x1F03, Version = 0x1F02, Vendor = 0x1F00, Renderer = 0x1F01, } public enum FramebufferAttachment { ColorAttachment0 = 0x8CE0, ColorAttachment0Ext = 0x8CE0, DepthAttachment = 0x8D00, StencilAttachment = 0x8D20, } public enum GLPrimitiveType { Lines = 0x0001, LineStrip = 0x0003, Triangles = 0x0004, TriangleStrip = 0x0005, } [Flags] public enum ClearBufferMask { DepthBufferBit = 0x00000100, StencilBufferBit = 0x00000400, ColorBufferBit = 0x00004000, } public enum ErrorCode { NoError = 0, } public enum TextureUnit { Texture0 = 0x84C0, } public enum TextureTarget { Texture2D = 0x0DE1, Texture3D = 0x806F, TextureCubeMap = 0x8513, TextureCubeMapPositiveX = 0x8515, TextureCubeMapPositiveY = 0x8517, TextureCubeMapPositiveZ = 0x8519, TextureCubeMapNegativeX = 0x8516, TextureCubeMapNegativeY = 0x8518, TextureCubeMapNegativeZ = 0x851A, } public enum PixelInternalFormat { Rgba = 0x1908, Rgb = 0x1907, Rgba4 = 0x8056, Luminance = 0x1909, CompressedRgbS3tcDxt1Ext = 0x83F0, CompressedSrgbS3tcDxt1Ext = 0x8C4C, CompressedRgbaS3tcDxt1Ext = 0x83F1, CompressedRgbaS3tcDxt3Ext = 0x83F2, CompressedSrgbAlphaS3tcDxt3Ext = 0x8C4E, CompressedRgbaS3tcDxt5Ext = 0x83F3, CompressedSrgbAlphaS3tcDxt5Ext = 0x8C4F, R32f = 0x822E, Rg16f = 0x822F, Rgba16f = 0x881A, R16f = 0x822D, Rg32f = 0x8230, Rgba32f = 0x8814, Rg8i = 0x8237, Rgba8i = 0x8D8E, Rg16ui = 0x823A, Rgba16ui = 0x8D76, Rgb10A2ui = 0x906F, // PVRTC CompressedRgbPvrtc2Bppv1Img = 0x8C01, CompressedRgbPvrtc4Bppv1Img = 0x8C00, CompressedRgbaPvrtc2Bppv1Img = 0x8C03, CompressedRgbaPvrtc4Bppv1Img = 0x8C02, // ATITC AtcRgbaExplicitAlphaAmd = 0x8C93, AtcRgbaInterpolatedAlphaAmd = 0x87EE, // DXT } public enum PixelFormat { Rgba = 0x1908, Rgb = 0x1907, Luminance = 0x1909, CompressedTextureFormats = 0x86A3, Red = 0x1903, Rg = 0x8227, } public enum PixelType { UnsignedByte = 0x1401, UnsignedShort565 = 0x8363, UnsignedShort4444 = 0x8033, UnsignedShort5551 = 0x8034, Float = 0x1406, HalfFloat = 0x140B, Byte = 0x1400, UnsignedShort = 0x1403, UnsignedInt1010102 = 0x8036, } public enum PixelStoreParameter { UnpackAlignment = 0x0CF5, } public enum GLStencilFunction { Always = 0x0207, Equal = 0x0202, Greater = 0x0204, Gequal = 0x0206, Less = 0x0201, Lequal = 0x0203, Never = 0x0200, Notequal = 0x0205, } public enum StencilOp { Keep = 0x1E00, DecrWrap = 0x8508, Decr = 0x1E03, Incr = 0x1E02, IncrWrap = 0x8507, Invert = 0x150A, Replace = 0x1E01, Zero = 0, } public enum TextureParameterName { TextureMaxAnisotropyExt = 0x84FE, TextureMaxLevel = 0x813D, TextureMinFilter = 0x2801, TextureMagFilter = 0x2800, TextureWrapS = 0x2802, TextureWrapT = 0x2803, TextureBorderColor = 0x1004, TextureLodBias = 0x8501, TextureCompareMode = 0x884C, TextureCompareFunc = 0x884D, GenerateMipmap = 0x8191, } //public enum Bool { // True = 1, // False = 0, //} //public enum TextureMinFilter { // LinearMipmapNearest = 0x2701, // NearestMipmapLinear = 0x2702, // LinearMipmapLinear = 0x2703, // Linear = 0x2601, // NearestMipmapNearest = 0x2700, // Nearest = 0x2600, //} //public enum TextureMagFilter { // Linear = 0x2601, // Nearest = 0x2600, //} //public enum TextureCompareMode { // CompareRefToTexture = 0x884E, // None = 0, //} //public enum TextureWrapMode { // ClampToEdge = 0x812F, // Repeat = 0x2901, // MirroredRepeat = 0x8370, // //GLES // ClampToBorder = 0x812D, //} //public partial class ColorFormat { // public ColorFormat(int r, int g, int b, int a) // { // R = r; // G = g; // B = b; // A = a; // } // public int R { get; private set; } // public int G { get; private set; } // public int B { get; private set; } // public int A { get; private set; } //} public partial class GL { public enum RenderApi { ES = 12448, GL = 12450, } public static RenderApi BoundApi = RenderApi.GL; //public partial class Ext //{ // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void GenRenderbuffersDelegate (int count, out int buffer); // public static GenRenderbuffersDelegate GenRenderbuffers; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void BindRenderbufferDelegate (RenderbufferTarget target, int buffer); // public static BindRenderbufferDelegate BindRenderbuffer; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void DeleteRenderbuffersDelegate (int count, ref int buffer); // public static DeleteRenderbuffersDelegate DeleteRenderbuffers; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void RenderbufferStorageMultisampleDelegate (RenderbufferTarget target, int sampleCount, // RenderbufferStorage storage, int width, int height); // public static RenderbufferStorageMultisampleDelegate RenderbufferStorageMultisample; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void GenFramebuffersDelegate (int count, out int buffer); // public static GenFramebuffersDelegate GenFramebuffers; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void BindFramebufferDelegate (FramebufferTarget target, int buffer); // public static BindFramebufferDelegate BindFramebuffer; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void DeleteFramebuffersDelegate (int count, ref int buffer); // public static DeleteFramebuffersDelegate DeleteFramebuffers; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void FramebufferTexture2DDelegate (FramebufferTarget target, FramebufferAttachment attachement, // TextureTarget textureTarget, int texture, int level); // public static FramebufferTexture2DDelegate FramebufferTexture2D; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void FramebufferRenderbufferDelegate (FramebufferTarget target, FramebufferAttachment attachement, // RenderbufferTarget renderBufferTarget, int buffer); // public static FramebufferRenderbufferDelegate FramebufferRenderbuffer; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void GenerateMipmapDelegate (GenerateMipmapTarget target); // public static GenerateMipmapDelegate GenerateMipmap; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate void BlitFramebufferDelegate (int srcX0, // int srcY0, // int srcX1, // int srcY1, // int dstX0, // int dstY0, // int dstX1, // int dstY1, // ClearBufferMask mask, // BlitFramebufferFilter filter); // public static BlitFramebufferDelegate BlitFramebuffer; // [System.Security.SuppressUnmanagedCodeSecurity ()] // [MonoNativeFunctionWrapper] // public delegate FramebufferErrorCode CheckFramebufferStatusDelegate (FramebufferTarget target); // public static CheckFramebufferStatusDelegate CheckFramebufferStatus; //} [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void EnableVertexAttribArrayDelegate (int attrib); public static EnableVertexAttribArrayDelegate EnableVertexAttribArray; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DisableVertexAttribArrayDelegte (int attrib); public static DisableVertexAttribArrayDelegte DisableVertexAttribArray; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void MakeCurrentDelegate(IntPtr window); public static MakeCurrentDelegate MakeCurrent; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void GetIntegerDelegate(int param, [Out] int* data); public static GetIntegerDelegate GetIntegerv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] internal delegate IntPtr GetStringDelegate(StringName param); internal static GetStringDelegate GetStringInternal; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ClearDepthDelegate (float depth); public static ClearDepthDelegate ClearDepth; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void DepthRangeDelegate (double min, double max); //public static DepthRangeDelegate DepthRange; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ClearDelegate(ClearBufferMask mask); public static ClearDelegate Clear; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ClearColorDelegate(float red,float green,float blue,float alpha); public static ClearColorDelegate ClearColor; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ClearStencilDelegate(int stencil); public static ClearStencilDelegate ClearStencil; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ViewportDelegate(int x, int y, int w, int h); public static ViewportDelegate Viewport; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate ErrorCode GetErrorDelegate(); public static GetErrorDelegate GetError; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void FlushDelegate(); public static FlushDelegate Flush; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenTexturesDelegte (int count, [Out] out int id); public static GenTexturesDelegte GenTextures; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BindTextureDelegate(TextureTarget target, int id); public static BindTextureDelegate BindTexture; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int EnableDelegate (EnableCap cap); public static EnableDelegate Enable; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int DisableDelegate (EnableCap cap); public static DisableDelegate Disable; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void CullFaceDelegate(CullFaceMode mode); public static CullFaceDelegate CullFace; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void FrontFaceDelegate(FrontFaceDirection direction); public static FrontFaceDelegate FrontFace; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void PolygonModeDelegate (MaterialFace face, PolygonMode mode); //public static PolygonModeDelegate PolygonMode; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void PolygonOffsetDelegate (float slopeScaleDepthBias, float depthbias); //public static PolygonOffsetDelegate PolygonOffset; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DrawBuffersDelegate (int count, DrawBuffersEnum[] buffers); public static DrawBuffersDelegate DrawBuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void UseProgramDelegate(int program); public static UseProgramDelegate UseProgram; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void Uniform4fvDelegate (int location, int size, float* values); public static Uniform4fvDelegate Uniform4fv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void UniformMatrix4fvDelegate(int location, int count, bool transpose, float* values); public static UniformMatrix4fvDelegate UniformMatrix4fv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void Uniform1iDelegate (int location, int value); public static Uniform1iDelegate Uniform1i; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ScissorDelegate(int x, int y, int width, int height); public static ScissorDelegate Scissor; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BindBufferDelegate(BufferTarget target, uint buffer); public static BindBufferDelegate BindBuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DrawElementsDelegate (GLPrimitiveType primitiveType, int count, DrawElementsType elementType, IntPtr offset); public static DrawElementsDelegate DrawElements; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DrawArraysDelegate (GLPrimitiveType primitiveType, int offset, int count); public static DrawArraysDelegate DrawArrays; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenRenderbuffersDelegate(int count, [Out] out int buffer); public static GenRenderbuffersDelegate GenRenderbuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BindRenderbufferDelegate (RenderbufferTarget target, int buffer); public static BindRenderbufferDelegate BindRenderbuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteRenderbuffersDelegate(int count, [In] [Out] ref int buffer); public static DeleteRenderbuffersDelegate DeleteRenderbuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void RenderbufferStorageMultisampleDelegate(RenderbufferTarget target, int sampleCount, RenderbufferStorage storage, int width, int height); public static RenderbufferStorageMultisampleDelegate RenderbufferStorageMultisample; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenFramebuffersDelegate(int count, out int buffer); public static GenFramebuffersDelegate GenFramebuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BindFramebufferDelegate (FramebufferTarget target, int buffer); public static BindFramebufferDelegate BindFramebuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteFramebuffersDelegate(int count, ref int buffer); public static DeleteFramebuffersDelegate DeleteFramebuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void FramebufferTexture2DDelegate(FramebufferTarget target, FramebufferAttachment attachement, TextureTarget textureTarget, int texture, int level ); public static FramebufferTexture2DDelegate FramebufferTexture2D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void FramebufferRenderbufferDelegate (FramebufferTarget target, FramebufferAttachment attachement, RenderbufferTarget renderBufferTarget, int buffer); public static FramebufferRenderbufferDelegate FramebufferRenderbuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenerateMipmapDelegate (GenerateMipmapTarget target); public static GenerateMipmapDelegate GenerateMipmap; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void ReadBufferDelegate (ReadBufferMode buffer); //public static ReadBufferDelegate ReadBuffer; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void DrawBufferDelegate (DrawBufferMode buffer); //public static DrawBufferDelegate DrawBuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BlitFramebufferDelegate (int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, ClearBufferMask mask, BlitFramebufferFilter filter); public static BlitFramebufferDelegate BlitFramebuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate FramebufferErrorCode CheckFramebufferStatusDelegate (FramebufferTarget target); public static CheckFramebufferStatusDelegate CheckFramebufferStatus; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexParameterFloatDelegate (TextureTarget target, TextureParameterName name, float value); public static TexParameterFloatDelegate TexParameterf; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void TexParameterFloatArrayDelegate (TextureTarget target, TextureParameterName name, float* values); public static TexParameterFloatArrayDelegate TexParameterfv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexParameterIntDelegate (TextureTarget target, TextureParameterName name, int value); public static TexParameterIntDelegate TexParameteri; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenQueriesDelegate (int count, [Out] out int queryId); public static GenQueriesDelegate GenQueries; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BeginQueryDelegate (QueryTarget target, int queryId); public static BeginQueryDelegate BeginQuery; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void EndQueryDelegate (QueryTarget target); public static EndQueryDelegate EndQuery; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GetQueryObjectDelegate(int queryId, GetQueryObjectParam getparam, [Out] out int ready); public static GetQueryObjectDelegate GetQueryObject; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteQueriesDelegate(int count, [In] [Out] ref int queryId); public static DeleteQueriesDelegate DeleteQueries; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ActiveTextureDelegate (TextureUnit textureUnit); public static ActiveTextureDelegate ActiveTexture; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int CreateShaderDelegate (ShaderType type); public static CreateShaderDelegate CreateShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void ShaderSourceDelegate(uint shaderId, int count, IntPtr code, int* length); public static ShaderSourceDelegate ShaderSourceInternal; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void CompileShaderDelegate (int shaderId); public static CompileShaderDelegate CompileShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void GetShaderDelegate(uint shaderId, uint parameter, int* value); public static GetShaderDelegate GetShaderiv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GetShaderInfoLogDelegate(uint shader, int bufSize, IntPtr length, StringBuilder infoLog); public static GetShaderInfoLogDelegate GetShaderInfoLogInternal; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate bool IsShaderDelegate(int shaderId); public static IsShaderDelegate IsShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteShaderDelegate (int shaderId); public static DeleteShaderDelegate DeleteShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int GetAttribLocationDelegate(int programId, string name); public static GetAttribLocationDelegate GetAttribLocation; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int GetUniformLocationDelegate(int programId, string name); public static GetUniformLocationDelegate GetUniformLocation; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate bool IsProgramDelegate (int programId); public static IsProgramDelegate IsProgram; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteProgramDelegate (int programId); public static DeleteProgramDelegate DeleteProgram; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate int CreateProgramDelegate(); public static CreateProgramDelegate CreateProgram; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void AttachShaderDelegate (int programId, int shaderId); public static AttachShaderDelegate AttachShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void LinkProgramDelegate(int programId); public static LinkProgramDelegate LinkProgram; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public unsafe delegate void GetProgramDelegate(int programId, uint name, int* linked); public static GetProgramDelegate GetProgramiv; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GetProgramInfoLogDelegate(uint program, int bufSize, IntPtr length, StringBuilder infoLog); public static GetProgramInfoLogDelegate GetProgramInfoLogInternal; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DetachShaderDelegate(int programId, int shaderId); public static DetachShaderDelegate DetachShader; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BlendColorDelegate(float r, float g, float b, float a); public static BlendColorDelegate BlendColor; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BlendEquationSeparateDelegate(BlendEquationMode colorMode, BlendEquationMode alphaMode); public static BlendEquationSeparateDelegate BlendEquationSeparate; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BlendFuncSeparateDelegate(BlendingFactorSrc colorSrc, BlendingFactorDest colorDst, BlendingFactorSrc alphaSrc, BlendingFactorDest alphaDst); public static BlendFuncSeparateDelegate BlendFuncSeparate; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void ColorMaskDelegate(bool r, bool g, bool b, bool a); public static ColorMaskDelegate ColorMask; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DepthFuncDelegate(DepthFunction function); public static DepthFuncDelegate DepthFunc; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DepthMaskDelegate (bool enabled); public static DepthMaskDelegate DepthMask; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void StencilFuncSeparateDelegate (StencilFace face, GLStencilFunction function, int referenceStencil, int mask); public static StencilFuncSeparateDelegate StencilFuncSeparate; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void StencilOpSeparateDelegate(StencilFace face, StencilOp stencilfail, StencilOp depthFail, StencilOp pass); public static StencilOpSeparateDelegate StencilOpSeparate; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void StencilFuncDelegate(GLStencilFunction function, int referenceStencil, int mask); public static StencilFuncDelegate StencilFunc; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void StencilOpDelegate (StencilOp stencilfail, StencilOp depthFail, StencilOp pass); public static StencilOpDelegate StencilOp; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void StencilMaskDelegate(int mask); public static StencilMaskDelegate StencilMask; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void CompressedTexImage2DDelegate(TextureTarget target, int level, PixelInternalFormat internalFormat, // int width, int height, int border, int size, IntPtr data); //public static CompressedTexImage2DDelegate CompressedTexImage2D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexImage2DDelegate(TextureTarget target,int level, PixelInternalFormat internalFormat, int width, int height, int border,PixelFormat format, PixelType pixelType, IntPtr data); public static TexImage2DDelegate TexImage2D; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //public delegate void CompressedTexSubImage2DDelegate (TextureTarget target, int level, // int x, int y, int width, int height, PixelFormat format, int size, IntPtr data); //public static CompressedTexSubImage2DDelegate CompressedTexSubImage2D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexSubImage2DDelegate (TextureTarget target, int level, int x, int y, int width, int height, PixelFormat format, PixelType pixelType, IntPtr data); public static TexSubImage2DDelegate TexSubImage2D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void PixelStoreDelegate (PixelStoreParameter parameter, int size); public static PixelStoreDelegate PixelStore; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void FinishDelegate(); public static FinishDelegate Finish; //[System.Security.SuppressUnmanagedCodeSecurity()] //[MonoNativeFunctionWrapper] //internal delegate void GetTexImageDelegate(TextureTarget target, int level, PixelFormat format, PixelType type, [Out] IntPtr pixels); //internal static GetTexImageDelegate GetTexImageInternal; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexImage3DDelegate(TextureTarget target,int level, PixelInternalFormat internalFormat, int width, int height, int depth, int border,PixelFormat format, PixelType pixelType, IntPtr data); public static TexImage3DDelegate TexImage3D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void TexSubImage3DDelegate (TextureTarget target, int level, int x, int y, int z, int width, int height, int depth, PixelFormat format, PixelType pixelType, IntPtr data); public static TexSubImage3DDelegate TexSubImage3D; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteTexturesDelegate(int count, ref int id); public static DeleteTexturesDelegate DeleteTextures; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void GenBuffersDelegate(int count, out uint buffer); public static GenBuffersDelegate GenBuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BufferDataDelegate(BufferTarget target, IntPtr size, IntPtr n, BufferUsageHint usage); public static BufferDataDelegate BufferData; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate IntPtr MapBufferDelegate(BufferTarget target, BufferAccess access); public static MapBufferDelegate MapBuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void UnmapBufferDelegate(BufferTarget target); public static UnmapBufferDelegate UnmapBuffer; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void BufferSubDataDelegate (BufferTarget target, IntPtr offset, IntPtr size, IntPtr data); public static BufferSubDataDelegate BufferSubData; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void DeleteBuffersDelegate (int count, [In] [Out] ref uint buffer); public static DeleteBuffersDelegate DeleteBuffers; [System.Security.SuppressUnmanagedCodeSecurity()] [MonoNativeFunctionWrapper] public delegate void VertexAttribPointerDelegate(int location, int elementCount, VertexAttribPointerType type, bool normalize, int stride, IntPtr data); public static VertexAttribPointerDelegate VertexAttribPointer; public static int SwapInterval { get; set; } public static void LoadEntryPoints() { GetStringInternal = (GetStringDelegate)LoadEntryPoint<GetStringDelegate>("glGetString"); if (Viewport == null) Viewport = (ViewportDelegate)LoadEntryPoint<ViewportDelegate>("glViewport"); if (Scissor == null) Scissor = (ScissorDelegate)LoadEntryPoint<ScissorDelegate>("glScissor"); GetError = (GetErrorDelegate)LoadEntryPoint<GetErrorDelegate>("glGetError"); TexParameterf = (TexParameterFloatDelegate)LoadEntryPoint<TexParameterFloatDelegate>("glTexParameterf"); TexParameterfv = (TexParameterFloatArrayDelegate)LoadEntryPoint<TexParameterFloatArrayDelegate>("glTexParameterfv"); TexParameteri = (TexParameterIntDelegate)LoadEntryPoint<TexParameterIntDelegate>("glTexParameteri"); EnableVertexAttribArray = (EnableVertexAttribArrayDelegate)LoadEntryPoint<EnableVertexAttribArrayDelegate>("glEnableVertexAttribArray"); DisableVertexAttribArray = (DisableVertexAttribArrayDelegte)LoadEntryPoint<DisableVertexAttribArrayDelegte>("glDisableVertexAttribArray"); //MakeCurrent = (MakeCurrentDelegate)LoadEntryPoint<MakeCurrentDelegate>("glMakeCurrent"); GetIntegerv = (GetIntegerDelegate)LoadEntryPoint<GetIntegerDelegate>("glGetIntegerv"); ClearDepth = (ClearDepthDelegate)LoadEntryPoint<ClearDepthDelegate>("glClearDepthf"); //DepthRange = (DepthRangeDelegate)LoadEntryPoint<DepthRangeDelegate>("glDepthRange"); Clear = (ClearDelegate)LoadEntryPoint<ClearDelegate>("glClear"); ClearColor = (ClearColorDelegate)LoadEntryPoint<ClearColorDelegate>("glClearColor"); ClearStencil = (ClearStencilDelegate)LoadEntryPoint<ClearStencilDelegate>("glClearStencil"); Flush = (FlushDelegate)LoadEntryPoint<FlushDelegate>("glFlush"); GenTextures = (GenTexturesDelegte)LoadEntryPoint<GenTexturesDelegte>("glGenTextures"); BindTexture = (BindTextureDelegate)LoadEntryPoint<BindTextureDelegate>("glBindTexture"); Enable = (EnableDelegate)LoadEntryPoint<EnableDelegate>("glEnable"); Disable = (DisableDelegate)LoadEntryPoint<DisableDelegate>("glDisable"); CullFace = (CullFaceDelegate)LoadEntryPoint<CullFaceDelegate>("glCullFace"); FrontFace = (FrontFaceDelegate)LoadEntryPoint<FrontFaceDelegate>("glFrontFace"); //PolygonMode = (PolygonModeDelegate)LoadEntryPoint<PolygonModeDelegate>("glPolygonMode"); //PolygonOffset = (PolygonOffsetDelegate)LoadEntryPoint<PolygonOffsetDelegate>("glPolygonOffset"); BindBuffer = (BindBufferDelegate)LoadEntryPoint<BindBufferDelegate>("glBindBuffer"); //DrawBuffers = (DrawBuffersDelegate)LoadEntryPoint<DrawBuffersDelegate>("glDrawBuffers"); DrawElements = (DrawElementsDelegate)LoadEntryPoint<DrawElementsDelegate>("glDrawElements"); DrawArrays = (DrawArraysDelegate)LoadEntryPoint<DrawArraysDelegate>("glDrawArrays"); Uniform1i = (Uniform1iDelegate)LoadEntryPoint<Uniform1iDelegate>("glUniform1i"); Uniform4fv = (Uniform4fvDelegate)LoadEntryPoint<Uniform4fvDelegate>("glUniform4fv"); UniformMatrix4fv = (UniformMatrix4fvDelegate)LoadEntryPoint<UniformMatrix4fvDelegate>("glUniformMatrix4fv"); ActiveTexture = (ActiveTextureDelegate)LoadEntryPoint<ActiveTextureDelegate>("glActiveTexture"); CreateShader = (CreateShaderDelegate)LoadEntryPoint<CreateShaderDelegate>("glCreateShader"); ShaderSourceInternal = (ShaderSourceDelegate)LoadEntryPoint<ShaderSourceDelegate>("glShaderSource"); CompileShader = (CompileShaderDelegate)LoadEntryPoint<CompileShaderDelegate>("glCompileShader"); GetShaderiv = (GetShaderDelegate)LoadEntryPoint<GetShaderDelegate>("glGetShaderiv"); GetShaderInfoLogInternal = (GetShaderInfoLogDelegate)LoadEntryPoint<GetShaderInfoLogDelegate>("glGetShaderInfoLog"); IsShader = (IsShaderDelegate)LoadEntryPoint<IsShaderDelegate>("glIsShader"); DeleteShader = (DeleteShaderDelegate)LoadEntryPoint<DeleteShaderDelegate>("glDeleteShader"); GetAttribLocation = (GetAttribLocationDelegate)LoadEntryPoint<GetAttribLocationDelegate>("glGetAttribLocation"); GetUniformLocation = (GetUniformLocationDelegate)LoadEntryPoint<GetUniformLocationDelegate>("glGetUniformLocation"); IsProgram = (IsProgramDelegate)LoadEntryPoint<IsProgramDelegate>("glIsProgram"); DeleteProgram = (DeleteProgramDelegate)LoadEntryPoint<DeleteProgramDelegate>("glDeleteProgram"); CreateProgram = (CreateProgramDelegate)LoadEntryPoint<CreateProgramDelegate>("glCreateProgram"); AttachShader = (AttachShaderDelegate)LoadEntryPoint<AttachShaderDelegate>("glAttachShader"); UseProgram = (UseProgramDelegate)LoadEntryPoint<UseProgramDelegate>("glUseProgram"); LinkProgram = (LinkProgramDelegate)LoadEntryPoint<LinkProgramDelegate>("glLinkProgram"); GetProgramiv = (GetProgramDelegate)LoadEntryPoint<GetProgramDelegate>("glGetProgramiv"); GetProgramInfoLogInternal = (GetProgramInfoLogDelegate)LoadEntryPoint<GetProgramInfoLogDelegate>("glGetProgramInfoLog"); DetachShader = (DetachShaderDelegate)LoadEntryPoint<DetachShaderDelegate>("glDetachShader"); BlendColor = (BlendColorDelegate)LoadEntryPoint<BlendColorDelegate>("glBlendColor"); BlendEquationSeparate = (BlendEquationSeparateDelegate)LoadEntryPoint<BlendEquationSeparateDelegate>("glBlendEquationSeparate"); BlendFuncSeparate = (BlendFuncSeparateDelegate)LoadEntryPoint<BlendFuncSeparateDelegate>("glBlendFuncSeparate"); ColorMask = (ColorMaskDelegate)LoadEntryPoint<ColorMaskDelegate>("glColorMask"); DepthFunc = (DepthFuncDelegate)LoadEntryPoint<DepthFuncDelegate>("glDepthFunc"); DepthMask = (DepthMaskDelegate)LoadEntryPoint<DepthMaskDelegate>("glDepthMask"); StencilFuncSeparate = (StencilFuncSeparateDelegate)LoadEntryPoint<StencilFuncSeparateDelegate>("glStencilFuncSeparate"); StencilOpSeparate = (StencilOpSeparateDelegate)LoadEntryPoint<StencilOpSeparateDelegate>("glStencilOpSeparate"); StencilFunc = (StencilFuncDelegate)LoadEntryPoint<StencilFuncDelegate>("glStencilFunc"); StencilOp = (StencilOpDelegate)LoadEntryPoint<StencilOpDelegate>("glStencilOp"); StencilMask = (StencilMaskDelegate)LoadEntryPoint<StencilMaskDelegate>("glStencilMask"); //CompressedTexImage2D = (CompressedTexImage2DDelegate)LoadEntryPoint<CompressedTexImage2DDelegate>("glCompressedTexImage2D"); TexImage2D = (TexImage2DDelegate)LoadEntryPoint<TexImage2DDelegate>("glTexImage2D"); //CompressedTexSubImage2D = (CompressedTexSubImage2DDelegate)LoadEntryPoint<CompressedTexSubImage2DDelegate>("glCompressedTexSubImage2D"); TexSubImage2D = (TexSubImage2DDelegate)LoadEntryPoint<TexSubImage2DDelegate>("glTexSubImage2D"); PixelStore = (PixelStoreDelegate)LoadEntryPoint<PixelStoreDelegate>("glPixelStorei"); Finish = (FinishDelegate)LoadEntryPoint<FinishDelegate>("glFinish"); // GetTexImageInternal = (GetTexImageDelegate)LoadEntryPoint<GetTexImageDelegate>("glGetTexImage"); // TexImage3D = (TexImage3DDelegate)LoadEntryPoint<TexImage3DDelegate>("glTexImage3D"); // TexSubImage3D = (TexSubImage3DDelegate)LoadEntryPoint<TexSubImage3DDelegate>("glTexSubImage3D"); DeleteTextures = (DeleteTexturesDelegate)LoadEntryPoint<DeleteTexturesDelegate>("glDeleteTextures"); GenBuffers = (GenBuffersDelegate)LoadEntryPoint<GenBuffersDelegate>("glGenBuffers"); BufferData = (BufferDataDelegate)LoadEntryPoint<BufferDataDelegate>("glBufferData"); // MapBuffer = (MapBufferDelegate)LoadEntryPoint<MapBufferDelegate>("glMapBuffer"); // UnmapBuffer = (UnmapBufferDelegate)LoadEntryPoint<UnmapBufferDelegate>("glUnmapBuffer"); // BufferSubData = (BufferSubDataDelegate)LoadEntryPoint<BufferSubDataDelegate>("glBufferSubData"); DeleteBuffers = (DeleteBuffersDelegate)LoadEntryPoint<DeleteBuffersDelegate>("glDeleteBuffers"); VertexAttribPointer = (VertexAttribPointerDelegate)LoadEntryPoint<VertexAttribPointerDelegate>("glVertexAttribPointer"); } public static System.Delegate LoadEntryPoint<T>(string proc) { return Marshal.GetDelegateForFunctionPointer(EntryPointHelper.GetAddress(proc), typeof(T)); } public unsafe static string GetString (StringName name) { if (GetStringInternal!=null) return Marshal.PtrToStringAnsi (GetStringInternal (name)); return string.Empty; } protected static IntPtr MarshalStringArrayToPtr (string[] strings) { IntPtr intPtr = IntPtr.Zero; if (strings != null && strings.Length != 0) { intPtr = Marshal.AllocHGlobal (strings.Length * IntPtr.Size); if (intPtr == IntPtr.Zero) { throw new OutOfMemoryException (); } int i = 0; try { for (i = 0; i < strings.Length; i++) { IntPtr val = MarshalStringToPtr (strings [i]); Marshal.WriteIntPtr (intPtr, i * IntPtr.Size, val); } } catch (OutOfMemoryException) { for (i--; i >= 0; i--) { Marshal.FreeHGlobal (Marshal.ReadIntPtr (intPtr, i * IntPtr.Size)); } Marshal.FreeHGlobal (intPtr); throw; } } return intPtr; } protected unsafe static IntPtr MarshalStringToPtr (string str) { if (string.IsNullOrEmpty (str)) { return IntPtr.Zero; } int num = Encoding.ASCII.GetMaxByteCount (str.Length) + 1; IntPtr intPtr = Marshal.AllocHGlobal (num); if (intPtr == IntPtr.Zero) { throw new OutOfMemoryException (); } fixed (char* chars = str + RuntimeHelpers.OffsetToStringData / 2) { int bytes = Encoding.ASCII.GetBytes (chars, str.Length, (byte*)((void*)intPtr), num); Marshal.WriteByte (intPtr, bytes, 0); return intPtr; } } protected static void FreeStringArrayPtr (IntPtr ptr, int length) { for (int i = 0; i < length; i++) { Marshal.FreeHGlobal (Marshal.ReadIntPtr (ptr, i * IntPtr.Size)); } Marshal.FreeHGlobal (ptr); } public static string GetProgramInfoLog (int programId) { int length = 0; GetProgram(programId, GetProgramParameterName.LogLength, out length); var sb = new StringBuilder(); GetProgramInfoLogInternal ((uint)programId, length, IntPtr.Zero, sb); return sb.ToString(); } public static string GetShaderInfoLog (int shaderId) { int length = 0; GetShader(shaderId, ShaderParameter.LogLength, out length); var sb = new StringBuilder(length+1); GetShaderInfoLogInternal ((uint)shaderId, length, IntPtr.Zero, sb); return sb.ToString(); } public unsafe static void ShaderSource(int shaderId, string code) { int length = code.Length; IntPtr intPtr = MarshalStringArrayToPtr (new string[] { code }); ShaderSourceInternal((uint)shaderId, 1, intPtr, &length); FreeStringArrayPtr(intPtr, 1); } public unsafe static void GetShader (int shaderId, ShaderParameter name, out int result) { fixed (int* ptr = &result) { GetShaderiv((uint)shaderId, (uint)name, ptr); } } public unsafe static void GetProgram(int programId, GetProgramParameterName name, out int result) { fixed (int* ptr = &result) { GetProgramiv((int)programId, (uint)name, ptr); } } //public unsafe static void GetInteger (GetPName name, out int value) //{ // fixed (int* ptr = &value) { // GetIntegerv ((int)name, ptr); // } //} //public unsafe static void GetInteger (int name, out int value) //{ // fixed (int* ptr = &value) // { // GetIntegerv (name, ptr); // } //} //public static void TexParameter(TextureTarget target, TextureParameterName name, float value) //{ // TexParameterf(target, name, value); //} //public unsafe static void TexParameter(TextureTarget target, TextureParameterName name, float[] values) //{ // fixed (float* ptr = &values[0]) // { // TexParameterfv(target, name, ptr); // } //} //public static void TexParameter(TextureTarget target, TextureParameterName name, int value) //{ // TexParameteri(target, name, value); //} //public static unsafe void GetTexImage<T>(TextureTarget target, int level, PixelFormat format, PixelType type, [In] [Out] T[] pixels) where T : struct //{ // GCHandle pixels_ptr = GCHandle.Alloc(pixels, GCHandleType.Pinned); // try // { // GetTexImageInternal(target, (Int32)level, format, type, (IntPtr)pixels_ptr.AddrOfPinnedObject()); // } // finally // { // pixels_ptr.Free(); // } //} } }
41.536727
159
0.668832
[ "MIT" ]
procfxgen/NetPacker
Examples/Intro01/Graphics/OpenGL.cs
57,115
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Overlays.Dialog; using osu.Game.Scoring; using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Graphics.Sprites; namespace osu.Game.Screens.Select { public class BeatmapClearScoresDialog : PopupDialog { [Resolved] private ScoreManager scoreManager { get; set; } public BeatmapClearScoresDialog(BeatmapInfo beatmapInfo, Action onCompletion) { BodyText = $@"{beatmapInfo.Metadata?.Artist} - {beatmapInfo.Metadata?.Title}"; Icon = FontAwesome.Solid.Eraser; HeaderText = @"Clearing all local scores. Are you sure?"; Buttons = new PopupDialogButton[] { new PopupDialogOkButton { Text = @"Yes. Please.", Action = () => { Task.Run(() => scoreManager.Delete(scoreManager.QueryScores(s => !s.DeletePending && s.BeatmapInfo.ID == beatmapInfo.ID).ToList())) .ContinueWith(_ => onCompletion); } }, new PopupDialogCancelButton { Text = @"No, I'm still attached.", }, }; } } }
34.818182
156
0.546345
[ "MIT" ]
5ln/osu
osu.Game/Screens/Select/BeatmapClearScoresDialog.cs
1,491
C#
using System; using System.Threading.Tasks; using UGF.Application.Runtime; using UGF.Module.Controllers.Runtime; using UGF.RuntimeTools.Runtime.Contexts; namespace UGF.Models.Runtime { public abstract class ModelControllerAsyncDescribed<TDescription> : ControllerDescribed<TDescription>, IModelControllerAsync where TDescription : class, IControllerDescription { protected ModelControllerAsyncDescribed(TDescription description, IApplication application) : base(description, application) { } public Task ExecuteAsync(IModel model, IContext context) { if (model == null) throw new ArgumentNullException(nameof(model)); if (context == null) throw new ArgumentNullException(nameof(context)); return OnExecuteAsync(model, context); } protected abstract Task OnExecuteAsync(IModel model, IContext context); } }
35.192308
179
0.728962
[ "MIT" ]
unity-game-framework/ugf-models
Packages/UGF.Models/Runtime/ModelControllerAsyncDescribed.cs
917
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("FluentFTP")] [assembly: AssemblyDescription("FTP and FTPS client implementation")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FluentFTP")] [assembly: AssemblyCopyright("J.P. Trosclair and Harsh Gupta")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Semantic versioning // - Change MAJOR when the API breaks // - Change MINOR when new features are added // - CHANGE REVISION when fixes / very minor features are made [assembly: AssemblyVersion("16.3.0")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] [assembly: GuidAttribute("A88FA910-1553-4000-AA56-6FC001AD7CF1")] [assembly: NeutralResourcesLanguageAttribute("en")]
35.575758
82
0.773424
[ "MIT" ]
dorisoy/FluentFTP
FluentFTP/Properties/AssemblyInfo.cs
1,174
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 workmail-2017-10-01.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.WorkMail.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.WorkMail.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for UpdateResource operation /// </summary> public class UpdateResourceResponseUnmarshaller : JsonResponseUnmarshaller { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { UpdateResourceResponse response = new UpdateResourceResponse(); 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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("DirectoryUnavailableException")) { return new DirectoryUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("EmailAddressInUseException")) { return new EmailAddressInUseException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("EntityNotFoundException")) { return new EntityNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("EntityStateException")) { return new EntityStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationException")) { return new InvalidConfigurationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("MailDomainNotFoundException")) { return new MailDomainNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("MailDomainStateException")) { return new MailDomainStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("NameAvailabilityException")) { return new NameAvailabilityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationNotFoundException")) { return new OrganizationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationStateException")) { return new OrganizationStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } return new AmazonWorkMailException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } private static UpdateResourceResponseUnmarshaller _instance = new UpdateResourceResponseUnmarshaller(); internal static UpdateResourceResponseUnmarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static UpdateResourceResponseUnmarshaller Instance { get { return _instance; } } } }
47.277778
173
0.681887
[ "Apache-2.0" ]
Bio2hazard/aws-sdk-net
sdk/src/Services/WorkMail/Generated/Model/Internal/MarshallTransformations/UpdateResourceResponseUnmarshaller.cs
5,957
C#
using System; using System.Runtime.Serialization; namespace Eaf.Domain.Uow { [Serializable] public class EafDbConcurrencyException : EafException { /// <summary> /// Creates a new <see cref="EafDbConcurrencyException"/> object. /// </summary> public EafDbConcurrencyException() { } /// <summary> /// Creates a new <see cref="EafException"/> object. /// </summary> public EafDbConcurrencyException(SerializationInfo serializationInfo, StreamingContext context) : base(serializationInfo, context) { } /// <summary> /// Creates a new <see cref="EafDbConcurrencyException"/> object. /// </summary> /// <param name="message">Exception message</param> public EafDbConcurrencyException(string message) : base(message) { } /// <summary> /// Creates a new <see cref="EafDbConcurrencyException"/> object. /// </summary> /// <param name="message">Exception message</param> /// <param name="innerException">Inner exception</param> public EafDbConcurrencyException(string message, Exception innerException) : base(message, innerException) { } } }
30.372093
103
0.591118
[ "MIT" ]
afonsoft/EAF
src/Eaf/Domain/Uow/EafDbConcurrencyException.cs
1,308
C#
namespace MS.GTA.BOTService.Common.Models { using System.Collections.Generic; using System.Runtime.Serialization; /// <summary> /// This represents the summary of Job Application schedule /// </summary> [DataContract] public class UpcomingInterviews { [DataMember(Name = "ExternalJobOpeningId", EmitDefaultValue = false, IsRequired = false)] public string ExternalJobOpeningId { get; set; } [DataMember(Name = "PositionTitle", EmitDefaultValue = false, IsRequired = false)] public string PositionTitle { get; set; } [DataMember(Name = "ScheduleSummaries", EmitDefaultValue = false, IsRequired = false)] public IList<ScheduleSummary> ScheduleSummaries { get; set; } } }
32.956522
97
0.682058
[ "Unlicense" ]
kanishk13/MS_Teams_BOT
Microsoft_teams_bot/MS_BOT_Service_.Common/Models/UpcomingInterviews.cs
760
C#
// ServerSidePasswordValidatonAction using ClubPenguin; using ClubPenguin.Mix; using ClubPenguin.UI; using DevonLocalization.Core; using Disney.Kelowna.Common; using Disney.LaunchPadFramework; using Disney.Mix.SDK; using Disney.MobileNetwork; using System.Collections; using System.Diagnostics; public class ServerSidePasswordValidatonAction : InputFieldValidatonAction { private MixLoginCreateService loginService; private bool isBaseValidationDone; private bool isWaiting = false; private Stopwatch sw; private int maxTime; public override IEnumerator Execute(ScriptableActionPlayer player) { if (!isWaiting) { setup(player); isBaseValidationDone = false; } loginService = Service.Get<MixLoginCreateService>(); while (loginService.ValidationInProgress) { yield return null; } loginService.ValidationInProgress = true; loginService.OnValidationSuccess += onValidationSuccess; loginService.OnValidationFailed += onValidationFailed; loginService.ValidateUsernamePassword("K4fR0VfK4MToQslVupGkGvAKFqw3HBXOfkpXalYUX1Kv5kbKL08MNxk3W2gfjk0", inputString); isWaiting = true; sw = new Stopwatch(); sw.Start(); maxTime = 30000; while (!isBaseValidationDone && sw.ElapsedMilliseconds < maxTime) { yield return null; } if (!isBaseValidationDone) { loginService.OnValidationSuccess -= onValidationSuccess; loginService.OnValidationFailed -= onValidationFailed; HasError = false; } isWaiting = false; loginService.ValidationInProgress = false; } private void onValidationSuccess() { loginService.OnValidationSuccess -= onValidationSuccess; loginService.OnValidationFailed -= onValidationFailed; HasError = false; isBaseValidationDone = true; } private void onValidationFailed(IValidateNewAccountResult result) { loginService.OnValidationSuccess -= onValidationSuccess; loginService.OnValidationFailed -= onValidationFailed; HasError = true; string text = string.Empty; if (result.Errors != null) { foreach (IValidateNewAccountError error in result.Errors) { object obj = text; text = obj + "\t[" + error + "] "; if (error is IValidateNewAccountNothingToValidateError) { i18nErrorMessage = Service.Get<Localizer>().GetTokenTranslationFormatted("Account.Create.Validation.Empty", "Account.Create.Validation.PasswrodField"); } else if (error is IValidateNewAccountPassswordMissingCharactersError) { i18nErrorMessage = "Account.Create.Validation.PasswordComplexity"; } else if (error is IValidateNewAccountPasswordCommonError) { i18nErrorMessage = "Acount.Create.Validate.TooCommon"; } else if (error is IValidateNewAccountPasswordPhoneError) { i18nErrorMessage = "Account.Create.Validation.PasswordPhoneNumber"; } else if (error is IValidateNewAccountPasswordSizeError) { i18nErrorMessage = "Account.Create.Validation.PasswordLength"; } else if (error is IValidateNewAccountRateLimitedError) { string type = ""; string format = "Account.General.Error.RateLimited"; Service.Get<EventDispatcher>().DispatchEvent(new ApplicationService.Error(type, format)); } text += i18nErrorMessage; text += "\n"; } } if (string.IsNullOrEmpty(text)) { i18nErrorMessage = "Account.Create.Validation.UnknownError"; text += i18nErrorMessage; text += "\n"; } isBaseValidationDone = true; } public override string GetErrorMessage() { return Service.Get<Localizer>().GetTokenTranslation(i18nErrorMessage); } }
28.804878
156
0.75247
[ "MIT" ]
smdx24/CPI-Source-Code
ClubPenguin.UI/ServerSidePasswordValidatonAction.cs
3,543
C#
using System; using System.IO; using Abp.Reflection.Extensions; namespace HealthCare { /// <summary> /// Central point for application version. /// </summary> public class AppVersionHelper { /// <summary> /// Gets current version of the application. /// It's also shown in the web page. /// </summary> public const string Version = "3.5.0.0"; /// <summary> /// Gets release (last build) date of the application. /// It's shown in the web page. /// </summary> public static DateTime ReleaseDate { get { return new FileInfo(typeof(AppVersionHelper).GetAssembly().Location).LastWriteTime; } } } }
26.035714
103
0.581619
[ "MIT" ]
pickituup/HealthCare_collaboration
aspnet-core/src/HealthCare.Core/AppVersionHelper.cs
731
C#
using System; using System.Collections.Generic; using System.Linq; namespace _01.Masterchef { class Program { static void Main(string[] args) { Dictionary<int, string> dish = new Dictionary<int, string>() { { 150, "Dipping sauce" }, { 250, "Green salad" }, { 300, "Chocolate cake" }, { 400, "Lobster" } }; Dictionary<string, int> cookedDish = new Dictionary<string, int>() { { "Dipping sauce", 0 }, { "Green salad", 0 }, { "Chocolate cake", 0 }, { "Lobster", 0 } }; Queue<int> ingredients = new Queue<int>(Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)); Stack<int> freshness = new Stack<int>(Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)); while (ingredients.Any() && freshness.Any()) { if (ingredients.Peek() == 0) { ingredients.Dequeue(); continue; } int sum = ingredients.Peek() * freshness.Peek(); if (dish.ContainsKey(sum)) { ingredients.Dequeue(); freshness.Pop(); cookedDish[dish[sum]]++; continue; } freshness.Pop(); ingredients.Enqueue(ingredients.Dequeue() + 5); } Console.WriteLine(cookedDish.All(x => x.Value > 0) ? "Applause! The judges are fascinated by your dishes!" : "You were voted off. Better luck next year."); if (ingredients.Any()) { Console.WriteLine($"Ingredients left: {ingredients.Sum()}"); } foreach (var item in cookedDish.Where(x => x.Value > 0).OrderBy(x => x.Key)) { Console.WriteLine($" # {item.Key} --> {item.Value}"); } } } }
31.014085
140
0.452316
[ "MIT" ]
anidz/Software-University---C-Advanced---January-2022-Solutions
Advanced_Exam/AdvancedExam_26June2021/01.Masterchef/Program.cs
2,204
C#
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. // This code is generated by tool. DO NOT EDIT. using System.Text.Json.Serialization; namespace AccelByte.Sdk.Api.Platform.Model { public class ItemReturnRequest : AccelByte.Sdk.Core.Model { [JsonPropertyName("orderNo")] public string? OrderNo { get; set; } } }
29.625
64
0.723629
[ "MIT" ]
AccelByte/accelbyte-csharp-sdk
AccelByte.Sdk/Api/Platform/Model/ItemReturnRequest.cs
474
C#
namespace Noise.UI.Views { /// <summary> /// Interaction logic for LibraryConfigurationDialog.xaml /// </summary> public partial class LibraryConfigurationDialog { public LibraryConfigurationDialog() { InitializeComponent(); } } }
22.181818
58
0.733607
[ "MIT" ]
bswanson58/NoiseMusicSystem
Noise.UI/Views/LibraryConfigurationDialog.xaml.cs
246
C#
/******************************************************************************** * ConcurrentLinkedList.cs * * * * Author: Denes Solti * ********************************************************************************/ using System; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; namespace Solti.Utils.Primitives.Threading.Tests { [TestFixture] public class ConcurrentLinkedListTests { public ConcurrentLinkedList<int> List { get; set; } [SetUp] public void Setup() { List = new ConcurrentLinkedList<int>(); } [Test] public void ThreadingTest_UsingParallelAddAndRemove() { Assert.DoesNotThrowAsync(() => Task.WhenAll(Enumerable.Repeat(0, 100).Select((_, i) => Task.Run(() => { LinkedListNode<int>[] nodes = Enumerable .Repeat(0, 3000) .Select(_ => List.AddFirst(i)) .ToArray(); foreach (LinkedListNode<int> node in nodes) { Assert.DoesNotThrow(() => List.Remove(node)); Assert.That(node.Owner, Is.Null); Assert.That(node.Prev, Is.Null); Assert.That(node.Next, Is.Null); } })))); Assert.That(List.Count, Is.EqualTo(0)); } [Test] public void ThreadingTest_UsingParallelAddAndTakeFirst() { Assert.DoesNotThrowAsync(() => Task.WhenAll(Enumerable.Repeat(0, 100).Select((_, _) => Task.Run(() => { for (int i = 0; i < 3000; i++) { List.AddFirst(0); } for (int i = 0; i < 3000; i++) { Assert.That(List.TakeFirst(out _)); } })))); Assert.That(List, Is.Empty); } [Test] public void ThreadingTest_UsingParallelAddAndForEach() { Assert.DoesNotThrowAsync(() => Task.WhenAll(Enumerable.Repeat(0, 100).Select((_, i) => Task.Run(() => { for (int j = 0; j < 3000; j++) { List.AddFirst(i); } Assert.That(List.Count(x => x == i), Is.EqualTo(3000)); })))); } [Test] public void ThreadingTest_UsingParallelAddRemoveAndForEach() { Assert.DoesNotThrowAsync(() => Task.WhenAll(Enumerable.Repeat(0, 100).Select((_, i) => Task.Run(() => { LinkedListNode<int>[] toBeRemoved = Enumerable .Repeat(0, 3000) .Select((_, i) => List.AddFirst(i)) .ToArray(); foreach (LinkedListNode<int> node in toBeRemoved) { Assert.DoesNotThrow(() => List.Remove(node)); Assert.That(node.Owner, Is.Null); Assert.That(node.Prev, Is.Null); Assert.That(node.Next, Is.Null); } })))); Assert.That(List, Is.Empty); } [Test] public void EmptyList_CanBeEnumerated() { Assert.DoesNotThrowAsync(() => Task.Run(() => List.Count())); Assert.That(List.Head.LockedBy, Is.EqualTo(0)); Assert.DoesNotThrow(() => List.AddFirst(0)); } [Test] public void Enumeration_MayBeBroken() { LinkedListNode<int> node1 = List.AddFirst(0), node2 = List.AddFirst(1); foreach (int x in List) { break; } Assert.That(List.Head.LockedBy, Is.EqualTo(0)); Assert.That(node1.LockedBy, Is.EqualTo(0)); Assert.That(node2.LockedBy, Is.EqualTo(0)); } [Test] public void Remove_ShouldThrowInsideAForeachLoop() { LinkedListNode<int> node = List.AddFirst(0); foreach (int x in List) { Assert.Throws<InvalidOperationException>(() => List.Remove(node)); } Assert.DoesNotThrow(() => List.Remove(node)); } } }
32
114
0.435062
[ "MIT" ]
Sholtee/primitives
TEST/ConcurrentLinkedList.cs
4,514
C#
using Microsoft.EntityFrameworkCore.Metadata.Builders; using System; namespace EFCore.Sharding { /// <summary> /// 构建者 /// </summary> public interface IShardingBuilder { /// <summary> /// 设置实体的程序集路径 /// </summary> /// <param name="entityAssemblyPaths">程序集路径</param> /// <returns></returns> IShardingBuilder SetEntityAssemblyPath(params string[] entityAssemblyPaths); /// <summary> /// 设置SQL执行超时时间(单位秒,默认30) /// </summary> /// <param name="timeout">超时时间</param> /// <returns></returns> IShardingBuilder SetCommandTimeout(int timeout); /// <summary> /// 添加实体模型构建过滤器 /// </summary> /// <param name="filter">过滤器</param> /// <returns></returns> IShardingBuilder AddEntityTypeBuilderFilter(Action<EntityTypeBuilder> filter); /// <summary> /// 使用Code First进行迁移时忽略外键 /// </summary> /// <returns></returns> IShardingBuilder MigrationsWithoutForeignKey(); /// <summary> /// 是否在启动时自动创建分表,默认true /// </summary> /// <param name="enable">是否启用</param> /// <returns></returns> IShardingBuilder CreateShardingTableOnStarting(bool enable); /// <summary> /// 是否启用分表数据库迁移,默认false /// </summary> /// <param name="enable">是否启用</param> /// <returns></returns> IShardingBuilder EnableShardingMigration(bool enable); /// <summary> /// 是否启用注释,默认true /// </summary> /// <param name="enable">是否启用</param> /// <returns></returns> IShardingBuilder EnableComments(bool enable); /// <summary> /// 使用逻辑删除 /// </summary> /// <param name="keyField">主键字段,字段类型为string</param> /// <param name="deletedField">已删除标志字段,字段类型为bool</param> /// <returns></returns> IShardingBuilder UseLogicDelete(string keyField = "Id", string deletedField = "Deleted"); /// <summary> /// 使用默认数据库 /// 注入IDbAccessor /// </summary> /// <param name="conString">连接字符串</param> /// <param name="dbType">数据库类型</param> /// <param name="entityNamespace">实体命名空间</param> /// <returns></returns> IShardingBuilder UseDatabase(string conString, DatabaseType dbType, string entityNamespace = null); /// <summary> /// 使用数据库 /// </summary> /// <typeparam name="TDbAccessor">自定义的IDbAccessor</typeparam> /// <param name="conString">连接字符串</param> /// <param name="dbType">数据库类型</param> /// <param name="entityNamespace">实体命名空间</param> /// <returns></returns> IShardingBuilder UseDatabase<TDbAccessor>(string conString, DatabaseType dbType, string entityNamespace = null) where TDbAccessor : class, IDbAccessor; /// <summary> /// 使用默认数据库 /// 注入IDbAccessor /// </summary> /// <param name="dbs">读写数据库配置</param> /// <param name="dbType">数据库类型</param> /// <param name="entityNamespace">实体命名空间</param> /// <returns></returns> IShardingBuilder UseDatabase((string connectionString, ReadWriteType readWriteType)[] dbs, DatabaseType dbType, string entityNamespace = null); /// <summary> /// 使用数据库 /// </summary> /// <typeparam name="TDbAccessor">自定义的IDbAccessor</typeparam> /// <param name="dbs">读写数据库配置</param> /// <param name="dbType">数据库类型</param> /// <param name="entityNamespace">实体命名空间</param> /// <returns></returns> IShardingBuilder UseDatabase<TDbAccessor>((string connectionString, ReadWriteType readWriteType)[] dbs, DatabaseType dbType, string entityNamespace = null) where TDbAccessor : class, IDbAccessor; /// <summary> /// 添加数据源 /// </summary> /// <param name="connectionString">连接字符串</param> /// <param name="readWriteType">读写模式</param> /// <param name="dbType">数据库类型</param> /// <param name="sourceName">数据源名</param> /// <returns></returns> IShardingBuilder AddDataSource(string connectionString, ReadWriteType readWriteType, DatabaseType dbType, string sourceName = "DefaultSource"); /// <summary> /// 添加数据源 /// </summary> /// <param name="dbs">数据库组</param> /// <param name="dbType">数据库类型</param> /// <param name="sourceName">数据源名</param> /// <returns></returns> IShardingBuilder AddDataSource((string connectionString, ReadWriteType readWriteType)[] dbs, DatabaseType dbType, string sourceName = "DefaultSource"); /// <summary> /// 设置分表规则(哈希取模) /// 注:默认自动创建分表(若分表不存在) /// </summary> /// <typeparam name="TEntity">对应抽象表类型</typeparam> /// <param name="shardingField">分表字段</param> /// <param name="mod">取模</param> /// <param name="sourceName">数据源名</param> /// <returns></returns> IShardingBuilder SetHashModSharding<TEntity>( string shardingField, int mod, string sourceName = ShardingConstant.DefaultSource ); /// <summary> /// 设置分表规则(哈希取模) /// 注:默认自动创建分表(若分表不存在) /// </summary> /// <typeparam name="TEntity">对应抽象表类型</typeparam> /// <param name="shardingField">分表字段</param> /// <param name="mod">取模</param> /// <param name="ranges">分库配置</param> /// <returns></returns> IShardingBuilder SetHashModSharding<TEntity>( string shardingField, int mod, params (int start, int end, string sourceName)[] ranges ); /// <summary> /// 设置分表规则(按日期) /// </summary> /// <typeparam name="TEntity">对应抽象表类型</typeparam> /// <param name="shardingField">分表字段</param> /// <param name="expandByDateMode">扩容模式</param> /// <param name="startTime">开始时间</param> /// <param name="sourceName">数据源名</param> /// <returns></returns> IShardingBuilder SetDateSharding<TEntity>( string shardingField, ExpandByDateMode expandByDateMode, DateTime startTime, string sourceName = ShardingConstant.DefaultSource ); /// <summary> /// 设置分表规则(按日期) /// </summary> /// <typeparam name="TEntity">对应抽象表类型</typeparam> /// <param name="shardingField">分表字段</param> /// <param name="expandByDateMode">扩容模式</param> /// <param name="ranges">分库配置</param> /// <returns></returns> IShardingBuilder SetDateSharding<TEntity>( string shardingField, ExpandByDateMode expandByDateMode, params (DateTime startTime, DateTime endTime, string sourceName)[] ranges); } }
37.021505
203
0.574935
[ "Apache-2.0" ]
lable/EFCore.Sharding
src/EFCore.Sharding/DependencyInjection/IShardingBuilder.cs
7,734
C#
using System; using System.Data; using System.Linq; using System.Linq.Dynamic; using System.Linq.Dynamic.Core; using System.Linq.Expressions; using System.Threading.Tasks; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Abp.UI; using Abp.AutoMapper; using Abp.Authorization; using Abp.Linq.Extensions; using Abp.Domain.Repositories; using Abp.Application.Services; using Abp.Application.Services.Dto; using YMApp.ECommerce.ProductFields.Dtos; using YMApp.ECommerce.ProductFields; namespace YMApp.ECommerce.ProductFields { /// <summary> /// ProductField应用层服务的接口方法 ///</summary> public interface IProductFieldAppService : IApplicationService { /// <summary> /// 获取ProductField的分页列表信息 ///</summary> /// <param name="input"></param> /// <returns></returns> Task<PagedResultDto<ProductFieldListDto>> GetPaged(GetProductFieldsInput input); /// <summary> /// 通过指定id获取ProductFieldListDto信息 /// </summary> Task<ProductFieldListDto> GetById(EntityDto<long> input); /// <summary> /// 返回实体的EditDto /// </summary> /// <param name="input"></param> /// <returns></returns> Task<GetProductFieldForEditOutput> GetForEdit(NullableIdDto<long> input); /// <summary> /// 添加或者修改ProductField的公共方法 /// </summary> /// <param name="input"></param> /// <returns></returns> Task CreateOrUpdate(CreateOrUpdateProductFieldInput input); /// <summary> /// 删除ProductField信息的方法 /// </summary> /// <param name="input"></param> /// <returns></returns> Task Delete(EntityDto<long> input); /// <summary> /// 批量删除ProductField /// </summary> Task BatchDelete(List<long> input); Task<List<ProductFieldListDto>> GetProductFieldByProductType(long productType); /// <summary> /// 导出ProductField为excel表 /// </summary> /// <returns></returns> //Task<FileDto> GetToExcel(); } }
24.223529
88
0.642059
[ "MIT" ]
yannis123/YMApp
src/ymapp-aspnet-core/src/YMApp.Application/ECommerce/ProductFields/IProductFieldApplicationService.cs
2,175
C#
using System; using System.Runtime.InteropServices; namespace WIC { [ComImport] [Guid(IID.IWICPalette)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IWICPalette { void InitializePredefined( [In] WICBitmapPaletteType ePaletteType, [In] bool fAddTransparentColor); void InitializeCustom( [In, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 1)] int[] pColors, [In] int cCount); void InitializeFromBitmap( [In] IWICBitmapSource pISurface, [In] int cCount, [In] bool fAddTransparentColor); void InitializeFromPalette( [In] IWICPalette pIPalette); WICBitmapPaletteType GetType(); int GetColorCount(); void GetColors( [In] int cCount, [Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeParamIndex = 0)] int[] pColors, [Out] out int pcActualColors); bool IsBlackWhite(); bool IsGrayscale(); bool HasAlpha(); } }
26.465116
119
0.621265
[ "MIT" ]
Jimbobicus/WIC
WIC/Interfaces/IWICPalette.cs
1,140
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.Debugger.Interop; using MICore; using System.Diagnostics; using System.Globalization; // This file contains the various event objects that are sent to the debugger from the sample engine via IDebugEventCallback2::Event. // These are used in EngineCallback.cs. // The events are how the engine tells the debugger about what is happening in the debuggee process. // There are three base classe the other events derive from: AD7AsynchronousEvent, AD7StoppingEvent, and AD7SynchronousEvent. These // each implement the IDebugEvent2.GetAttributes method for the type of event they represent. // Most events sent the debugger are asynchronous events. namespace Microsoft.MIDebugEngine { #region Event base classes internal class AD7AsynchronousEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS; int IDebugEvent2.GetAttributes(out uint eventAttributes) { eventAttributes = Attributes; return Constants.S_OK; } } internal class AD7StoppingEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNC_STOP; int IDebugEvent2.GetAttributes(out uint eventAttributes) { eventAttributes = Attributes; return Constants.S_OK; } } internal class AD7SynchronousEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS; int IDebugEvent2.GetAttributes(out uint eventAttributes) { eventAttributes = Attributes; return Constants.S_OK; } } internal class AD7SynchronousStoppingEvent : IDebugEvent2 { public const uint Attributes = (uint)enum_EVENTATTRIBUTES.EVENT_STOPPING | (uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS; int IDebugEvent2.GetAttributes(out uint eventAttributes) { eventAttributes = Attributes; return Constants.S_OK; } } #endregion // The debug engine (DE) sends this interface to the session debug manager (SDM) when an instance of the DE is created. internal sealed class AD7EngineCreateEvent : AD7AsynchronousEvent, IDebugEngineCreateEvent2 { public const string IID = "FE5B734C-759D-4E59-AB04-F103343BDD06"; private IDebugEngine2 _engine; private AD7EngineCreateEvent(AD7Engine engine) { _engine = engine; } public static void Send(AD7Engine engine) { AD7EngineCreateEvent eventObject = new AD7EngineCreateEvent(engine); engine.Callback.Send(eventObject, IID, null, null); } int IDebugEngineCreateEvent2.GetEngine(out IDebugEngine2 engine) { engine = _engine; return Constants.S_OK; } } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program is attached to. internal sealed class AD7ProgramCreateEvent : AD7SynchronousEvent, IDebugProgramCreateEvent2 { public const string IID = "96CD11EE-ECD4-4E89-957E-B5D496FC4139"; internal static void Send(AD7Engine engine) { AD7ProgramCreateEvent eventObject = new AD7ProgramCreateEvent(); engine.Callback.Send(eventObject, IID, engine, null); } } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a module is loaded or unloaded. internal sealed class AD7ModuleLoadEvent : AD7AsynchronousEvent, IDebugModuleLoadEvent2 { public const string IID = "989DB083-0D7C-40D1-A9D9-921BF611A4B2"; private readonly AD7Module _module; private readonly bool _fLoad; public AD7ModuleLoadEvent(AD7Module module, bool fLoad) { _module = module; _fLoad = fLoad; } int IDebugModuleLoadEvent2.GetModule(out IDebugModule2 module, ref string debugMessage, ref int fIsLoad) { module = _module; if (_fLoad) { string symbolLoadStatus = _module.DebuggedModule.SymbolsLoaded ? ResourceStrings.ModuleLoadedWithSymbols : ResourceStrings.ModuleLoadedWithoutSymbols; debugMessage = string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ModuleLoadMessage, _module.DebuggedModule.Name, symbolLoadStatus); fIsLoad = 1; } else { debugMessage = string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ModuleUnloadMessage, _module.DebuggedModule.Name); fIsLoad = 0; } return Constants.S_OK; } } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program has run to completion // or is otherwise destroyed. internal sealed class AD7ProgramDestroyEvent : AD7SynchronousEvent, IDebugProgramDestroyEvent2 { public const string IID = "E147E9E3-6440-4073-A7B7-A65592C714B5"; private readonly uint _exitCode; public AD7ProgramDestroyEvent(uint exitCode) { _exitCode = exitCode; } #region IDebugProgramDestroyEvent2 Members int IDebugProgramDestroyEvent2.GetExitCode(out uint exitCode) { exitCode = _exitCode; return Constants.S_OK; } #endregion } internal sealed class AD7MessageEvent : IDebugEvent2, IDebugMessageEvent2 { public const string IID = "3BDB28CF-DBD2-4D24-AF03-01072B67EB9E"; private readonly OutputMessage _outputMessage; private readonly bool _isAsync; public AD7MessageEvent(OutputMessage outputMessage, bool isAsync) { _outputMessage = outputMessage; _isAsync = isAsync; } int IDebugEvent2.GetAttributes(out uint eventAttributes) { if (_isAsync) eventAttributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS; else eventAttributes = (uint)enum_EVENTATTRIBUTES.EVENT_IMMEDIATE; return Constants.S_OK; } int IDebugMessageEvent2.GetMessage(enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { return ConvertMessageToAD7(_outputMessage, pMessageType, out pbstrMessage, out pdwType, out pbstrHelpFileName, out pdwHelpId); } internal static int ConvertMessageToAD7(OutputMessage outputMessage, enum_MESSAGETYPE[] pMessageType, out string pbstrMessage, out uint pdwType, out string pbstrHelpFileName, out uint pdwHelpId) { const uint MB_ICONERROR = 0x00000010; const uint MB_ICONWARNING = 0x00000030; pMessageType[0] = outputMessage.MessageType; pbstrMessage = outputMessage.Message; pdwType = 0; if ((outputMessage.MessageType & enum_MESSAGETYPE.MT_TYPE_MASK) == enum_MESSAGETYPE.MT_MESSAGEBOX) { switch (outputMessage.SeverityValue) { case OutputMessage.Severity.Error: pdwType |= MB_ICONERROR; break; case OutputMessage.Severity.Warning: pdwType |= MB_ICONWARNING; break; } } pbstrHelpFileName = null; pdwHelpId = 0; return Constants.S_OK; } int IDebugMessageEvent2.SetResponse(uint dwResponse) { return Constants.S_OK; } } internal sealed class AD7ErrorEvent : IDebugEvent2, IDebugErrorEvent2 { public const string IID = "FDB7A36C-8C53-41DA-A337-8BD86B14D5CB"; private readonly OutputMessage _outputMessage; private readonly bool _isAsync; public AD7ErrorEvent(OutputMessage outputMessage, bool isAsync) { _outputMessage = outputMessage; _isAsync = isAsync; } int IDebugEvent2.GetAttributes(out uint eventAttributes) { if (_isAsync) eventAttributes = (uint)enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS; else eventAttributes = (uint)enum_EVENTATTRIBUTES.EVENT_IMMEDIATE; return Constants.S_OK; } int IDebugErrorEvent2.GetErrorMessage(enum_MESSAGETYPE[] pMessageType, out string errorFormat, out int hrErrorReason, out uint pdwType, out string helpFilename, out uint pdwHelpId) { hrErrorReason = unchecked((int)_outputMessage.ErrorCode); return AD7MessageEvent.ConvertMessageToAD7(_outputMessage, pMessageType, out errorFormat, out pdwType, out helpFilename, out pdwHelpId); } } internal sealed class AD7BreakpointErrorEvent : AD7AsynchronousEvent, IDebugBreakpointErrorEvent2 { public const string IID = "ABB0CA42-F82B-4622-84E4-6903AE90F210"; private AD7ErrorBreakpoint _error; public AD7BreakpointErrorEvent(AD7ErrorBreakpoint error) { _error = error; } public int GetErrorBreakpoint(out IDebugErrorBreakpoint2 ppErrorBP) { ppErrorBP = _error; return Constants.S_OK; } } internal sealed class AD7BreakpointUnboundEvent : AD7AsynchronousEvent, IDebugBreakpointUnboundEvent2 { public const string IID = "78d1db4f-c557-4dc5-a2dd-5369d21b1c8c"; private readonly enum_BP_UNBOUND_REASON _reason; private AD7BoundBreakpoint _bp; public AD7BreakpointUnboundEvent(AD7BoundBreakpoint bp, enum_BP_UNBOUND_REASON reason) { _reason = reason; _bp = bp; } public int GetBreakpoint(out IDebugBoundBreakpoint2 ppBP) { ppBP = _bp; return Constants.S_OK; } public int GetReason(enum_BP_UNBOUND_REASON[] pdwUnboundReason) { pdwUnboundReason[0] = _reason; return Constants.S_OK; } } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a thread is created in a program being debugged. internal sealed class AD7ThreadCreateEvent : AD7AsynchronousEvent, IDebugThreadCreateEvent2 { public const string IID = "2090CCFC-70C5-491D-A5E8-BAD2DD9EE3EA"; } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a thread has exited. internal sealed class AD7ThreadDestroyEvent : AD7AsynchronousEvent, IDebugThreadDestroyEvent2 { public const string IID = "2C3B7532-A36F-4A6E-9072-49BE649B8541"; private readonly uint _exitCode; public AD7ThreadDestroyEvent(uint exitCode) { _exitCode = exitCode; } #region IDebugThreadDestroyEvent2 Members int IDebugThreadDestroyEvent2.GetExitCode(out uint exitCode) { exitCode = _exitCode; return Constants.S_OK; } #endregion } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) when a program is loaded, but before any code is executed. internal sealed class AD7LoadCompleteEvent : AD7StoppingEvent, IDebugLoadCompleteEvent2 { public const string IID = "B1844850-1349-45D4-9F12-495212F5EB0B"; public AD7LoadCompleteEvent() { } } internal sealed class AD7EntryPointEvent : AD7StoppingEvent, IDebugEntryPointEvent2 { public const string IID = "E8414A3E-1642-48EC-829E-5F4040E16DA9"; public AD7EntryPointEvent() { } } internal sealed class AD7ExpressionCompleteEvent : AD7AsynchronousEvent, IDebugExpressionEvaluationCompleteEvent2 { private AD7Engine _engine; public const string IID = "C0E13A85-238A-4800-8315-D947C960A843"; public AD7ExpressionCompleteEvent(AD7Engine engine, IVariableInformation var, IDebugProperty2 prop = null) { _engine = engine; _var = var; _prop = prop; } public int GetExpression(out IDebugExpression2 expr) { expr = new AD7Expression(_engine, _var); return Constants.S_OK; } public int GetResult(out IDebugProperty2 prop) { prop = _prop != null ? _prop : new AD7Property(_engine, _var); return Constants.S_OK; } private IVariableInformation _var; private IDebugProperty2 _prop; } // This interface tells the session debug manager (SDM) that an exception has occurred in the debuggee. internal sealed class AD7ExceptionEvent : AD7StoppingEvent, IDebugExceptionEvent2 { public const string IID = "51A94113-8788-4A54-AE15-08B74FF922D0"; public AD7ExceptionEvent(string name, string description, uint code, Guid? exceptionCategory, ExceptionBreakpointState state) { _name = name; _code = code; _description = description ?? name; _category = exceptionCategory ?? EngineConstants.EngineId; switch (state) { case ExceptionBreakpointState.None: _state = enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE; break; case ExceptionBreakpointState.BreakThrown: _state = enum_EXCEPTION_STATE.EXCEPTION_STOP_FIRST_CHANCE | enum_EXCEPTION_STATE.EXCEPTION_STOP_USER_FIRST_CHANCE; break; case ExceptionBreakpointState.BreakUserHandled: _state = enum_EXCEPTION_STATE.EXCEPTION_STOP_USER_UNCAUGHT; break; default: Debug.Fail("Unexpected state value"); _state = enum_EXCEPTION_STATE.EXCEPTION_STOP_SECOND_CHANCE; break; } } #region IDebugExceptionEvent2 Members public int CanPassToDebuggee() { // Cannot pass it on return Constants.S_FALSE; } public int GetException(EXCEPTION_INFO[] pExceptionInfo) { EXCEPTION_INFO ex = new EXCEPTION_INFO(); ex.bstrExceptionName = _name; ex.dwCode = _code; ex.dwState = _state; ex.guidType = _category; pExceptionInfo[0] = ex; return Constants.S_OK; } public int GetExceptionDescription(out string pbstrDescription) { pbstrDescription = _description; return Constants.S_OK; } public int PassToDebuggee(int fPass) { return Constants.S_OK; } private string _name; private uint _code; private string _description; private Guid _category; private enum_EXCEPTION_STATE _state; #endregion } // This interface tells the session debug manager (SDM) that a step has completed internal sealed class AD7StepCompleteEvent : AD7StoppingEvent, IDebugStepCompleteEvent2 { public const string IID = "0f7f24c1-74d9-4ea6-a3ea-7edb2d81441d"; } // This interface tells the session debug manager (SDM) that an asynchronous break has been successfully completed. internal sealed class AD7AsyncBreakCompleteEvent : AD7StoppingEvent, IDebugBreakEvent2 { public const string IID = "c7405d1d-e24b-44e0-b707-d8a5a4e1641b"; } // This interface is sent by the debug engine (DE) to the session debug manager (SDM) to output a string for debug tracing. internal sealed class AD7OutputDebugStringEvent : AD7AsynchronousEvent, IDebugOutputStringEvent2 { public const string IID = "569c4bb1-7b82-46fc-ae28-4536ddad753e"; private string _str; public AD7OutputDebugStringEvent(string str) { _str = str; } #region IDebugOutputStringEvent2 Members int IDebugOutputStringEvent2.GetString(out string pbstrString) { pbstrString = _str; return Constants.S_OK; } #endregion } // This interface is sent by the debug engine (DE) to indicate the results of searching for symbols for a module in the debuggee internal sealed class AD7SymbolSearchEvent : AD7AsynchronousEvent, IDebugSymbolSearchEvent2 { public const string IID = "638F7C54-C160-4c7b-B2D0-E0337BC61F8C"; private AD7Module _module; private string _searchInfo; private enum_MODULE_INFO_FLAGS _symbolFlags; public AD7SymbolSearchEvent(AD7Module module, string searchInfo, enum_MODULE_INFO_FLAGS symbolFlags) { _module = module; _searchInfo = searchInfo; _symbolFlags = symbolFlags; } #region IDebugSymbolSearchEvent2 Members int IDebugSymbolSearchEvent2.GetSymbolSearchInfo(out IDebugModule3 pModule, ref string pbstrDebugMessage, enum_MODULE_INFO_FLAGS[] pdwModuleInfoFlags) { pModule = _module; pbstrDebugMessage = _searchInfo; pdwModuleInfoFlags[0] = _symbolFlags; return Constants.S_OK; } #endregion } // This interface is sent when a pending breakpoint has been bound in the debuggee. internal sealed class AD7BreakpointBoundEvent : AD7AsynchronousEvent, IDebugBreakpointBoundEvent2 { public const string IID = "1dddb704-cf99-4b8a-b746-dabb01dd13a0"; private AD7PendingBreakpoint _pendingBreakpoint; private AD7BoundBreakpoint _boundBreakpoint; public AD7BreakpointBoundEvent(AD7PendingBreakpoint pendingBreakpoint, AD7BoundBreakpoint boundBreakpoint) { _pendingBreakpoint = pendingBreakpoint; _boundBreakpoint = boundBreakpoint; } #region IDebugBreakpointBoundEvent2 Members int IDebugBreakpointBoundEvent2.EnumBoundBreakpoints(out IEnumDebugBoundBreakpoints2 ppEnum) { IDebugBoundBreakpoint2[] boundBreakpoints = new IDebugBoundBreakpoint2[1]; boundBreakpoints[0] = _boundBreakpoint; ppEnum = new AD7BoundBreakpointsEnum(boundBreakpoints); return Constants.S_OK; } int IDebugBreakpointBoundEvent2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBP) { ppPendingBP = _pendingBreakpoint; return Constants.S_OK; } #endregion } // This Event is sent when a breakpoint is hit in the debuggee internal sealed class AD7BreakpointEvent : AD7StoppingEvent, IDebugBreakpointEvent2 { public const string IID = "501C1E21-C557-48B8-BA30-A1EAB0BC4A74"; private IEnumDebugBoundBreakpoints2 _boundBreakpoints; public AD7BreakpointEvent(IEnumDebugBoundBreakpoints2 boundBreakpoints) { _boundBreakpoints = boundBreakpoints; } #region IDebugBreakpointEvent2 Members int IDebugBreakpointEvent2.EnumBreakpoints(out IEnumDebugBoundBreakpoints2 ppEnum) { ppEnum = _boundBreakpoints; return Constants.S_OK; } #endregion } internal sealed class AD7StopCompleteEvent : AD7StoppingEvent, IDebugStopCompleteEvent2 { public const string IID = "3DCA9DCD-FB09-4AF1-A926-45F293D48B2D"; } internal sealed class AD7CustomDebugEvent : AD7AsynchronousEvent, IDebugCustomEvent110 { public const string IID = "2615D9BC-1948-4D21-81EE-7A963F20CF59"; private readonly Guid _guidVSService; private readonly Guid _sourceId; private readonly int _messageCode; private readonly object _parameter1; private readonly object _parameter2; public AD7CustomDebugEvent(Guid guidVSService, Guid sourceId, int messageCode, object parameter1, object parameter2) { _guidVSService = guidVSService; _sourceId = sourceId; _messageCode = messageCode; _parameter1 = parameter1; _parameter2 = parameter2; } int IDebugCustomEvent110.GetCustomEventInfo(out Guid guidVSService, VsComponentMessage[] message) { guidVSService = _guidVSService; message[0].SourceId = _sourceId; message[0].MessageCode = (uint)_messageCode; message[0].Parameter1 = _parameter1; message[0].Parameter2 = _parameter2; return Constants.S_OK; } } }
34.631579
202
0.655585
[ "MIT" ]
benmcmorran/MIEngine
src/MIDebugEngine/AD7.Impl/AD7Events.cs
21,056
C#
using System; namespace Octokit.Reactive { public class ObservableGitHubClient : IObservableGitHubClient { readonly IGitHubClient _gitHubClient; public ObservableGitHubClient(ProductHeaderValue productInformation) : this(new GitHubClient(productInformation)) { } public ObservableGitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore) : this(new GitHubClient(productInformation, credentialStore)) { } public ObservableGitHubClient(ProductHeaderValue productInformation, Uri baseAddress) : this(new GitHubClient(productInformation, baseAddress)) { } public ObservableGitHubClient(ProductHeaderValue productInformation, ICredentialStore credentialStore, Uri baseAddress) : this(new GitHubClient(productInformation, credentialStore, baseAddress)) { } public ObservableGitHubClient(IGitHubClient gitHubClient) { Ensure.ArgumentNotNull(gitHubClient, "githubClient"); _gitHubClient = gitHubClient; Authorization = new ObservableAuthorizationsClient(gitHubClient); Activity = new ObservableActivitiesClient(gitHubClient); Issue = new ObservableIssuesClient(gitHubClient); Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous); Notification = new ObservableNotificationsClient(gitHubClient); Oauth = new ObservableOauthClient(gitHubClient); Organization = new ObservableOrganizationsClient(gitHubClient); PullRequest = new ObservablePullRequestsClient(gitHubClient); Repository = new ObservableRepositoriesClient(gitHubClient); SshKey = new ObservableSshKeysClient(gitHubClient); User = new ObservableUsersClient(gitHubClient); Release = new ObservableReleasesClient(gitHubClient); GitDatabase = new ObservableGitDatabaseClient(gitHubClient); Gist = new ObservableGistsClient(gitHubClient); Search = new ObservableSearchClient(gitHubClient); } public IConnection Connection { get { return _gitHubClient.Connection; } } public IObservableAuthorizationsClient Authorization { get; private set; } public IObservableActivitiesClient Activity { get; private set; } public IObservableIssuesClient Issue { get; private set; } public IObservableMiscellaneousClient Miscellaneous { get; private set; } public IObservableOauthClient Oauth { get; private set; } public IObservableOrganizationsClient Organization { get; private set; } public IObservablePullRequestsClient PullRequest { get; private set; } public IObservableRepositoriesClient Repository { get; private set; } public IObservableGistsClient Gist { get; private set; } public IObservableReleasesClient Release { get; private set; } public IObservableSshKeysClient SshKey { get; private set; } public IObservableUsersClient User { get; private set; } public IObservableNotificationsClient Notification { get; private set; } public IObservableGitDatabaseClient GitDatabase { get; private set; } public IObservableSearchClient Search { get; private set; } /// <summary> /// Gets the latest API Info - this will be null if no API calls have been made /// </summary> /// <returns><seealso cref="ApiInfo"/> representing the information returned as part of an Api call</returns> public ApiInfo GetLastApiInfo() { return _gitHubClient.Connection.GetLastApiInfo(); } } }
46.219512
127
0.693931
[ "MIT" ]
ROBISKMAGICIAN/Desainer.net
Octokit.Reactive/ObservableGitHubClient.cs
3,792
C#
using Microsoft.Extensions.Caching.Memory; using WebApi.Services; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); builder.Services.AddMemoryCache(); // -- without cached repository //builder.Services.AddScoped<IWeatherRepository, WeatherRepository>(); // -- with cached repository with .net DI only //builder.Services.AddScoped<WeatherRepository>(); //builder.Services.AddScoped<IWeatherRepository>(s => //{ // var memoryCache = s.GetRequiredService<IMemoryCache>(); // var repository = s.GetRequiredService<WeatherRepository>(); // return new CachedWeatherRepository(memoryCache, repository); //}); // -- with cached repository with scrutor builder.Services.AddScoped<IWeatherRepository, WeatherRepository>(); builder.Services.Decorate<IWeatherRepository, CachedWeatherRepository>(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseAuthorization(); app.MapControllers(); app.Run();
27.304348
88
0.769108
[ "MIT" ]
a-pedroso/DecoratedCachedRepositoryPattern
WebApi/Program.cs
1,256
C#
using Microsoft.AspNetCore.Hosting; using NLog; using NLog.Web; using LogLevel = NLog.LogLevel; namespace GR.Logger.Extensions { public static class LoggerExtension { public static IWebHostBuilder RegisterGearLoggingProviders(this IWebHostBuilder builder) { builder.ConfigureServices(services => { //var sp = services.BuildServiceProvider(); --> for inject some services var config = new NLog.Config.LoggingConfiguration(); var logConsole = new NLog.Targets.ConsoleTarget(); var customTarget = new GearLoggerTarget(); config.AddRule(LogLevel.Trace, LogLevel.Fatal, logConsole); config.AddRule(LogLevel.Trace, LogLevel.Fatal, customTarget); LogManager.Configuration = config; LogManager.Configuration.AddSentry(o => { // Optionally specify a separate format for message o.Layout = "${message}"; // Optionally specify a separate format for breadcrumbs o.BreadcrumbLayout = "${logger}: ${message}"; // Debug and higher are stored as breadcrumbs (default is Info) o.MinimumBreadcrumbLevel = LogLevel.Debug; // Error and higher is sent as event (default is Error) o.MinimumEventLevel = LogLevel.Error; // Send the logger name as a tag o.AddTag("logger", "${logger}"); // All Sentry Options are accessible here. }); }); builder.UseNLog() .UseSentry(); return builder; } } }
36.040816
96
0.555493
[ "MIT" ]
indrivo/GEAR
src/GR.Extensions/GR.Logger.Extension/GR.Logger/Extensions/LoggerExtension.cs
1,766
C#
/*---------------------------------------------------------------- Copyright (C) 2017 Senparc 文件名:BaseButton.cs 文件功能描述:所有菜单按钮基类 创建标识:Senparc - 20150313 修改标识:Senparc - 20150313 修改描述:整理接口 ----------------------------------------------------------------*/ namespace Senparc.Weixin.QY.Entities.Menu { public interface IBaseButton { string name { get; set; } } /// <summary> /// 所有按钮基类 /// </summary> public class BaseButton : IBaseButton { //public ButtonType type { get; set; } /// <summary> /// 按钮描述,既按钮名字,不超过16个字节,子菜单不超过40个字节 /// </summary> public string name { get; set; } } }
21.454545
67
0.446328
[ "Apache-2.0" ]
007008aabb/WeiXinMPSDK
src/Senparc.Weixin.QY/Senparc.Weixin.QY/Entities/Menu/BaseButton.cs
852
C#
using System.Collections.Generic; using System.Linq; using Myproject.Roles.Dto; using Myproject.Users.Dto; namespace Myproject.Web.Models.Users { public class EditUserModalViewModel { public UserDto User { get; set; } public IReadOnlyList<RoleDto> Roles { get; set; } public bool UserIsInRole(RoleDto role) { return User.Roles != null && User.Roles.Any(r => r == role.Name); } } }
23.578947
77
0.640625
[ "MIT" ]
ahmetkursatesim/ASPNETProject
src/Myproject.Web/Models/Users/EditUserModalViewModel.cs
450
C#
namespace Sudoku.CodeGenerating.Generators; /// <summary> /// Provides a generator that generates the deconstruction methods that are extension methods. /// </summary> [Generator] public sealed partial class ExtensionDeconstructMethodGenerator : ISourceGenerator { /// <inheritdoc/> public void Execute(GeneratorExecutionContext context) { var compilation = context.Compilation; var attributeSymbol = compilation .GetTypeByMetadataName(typeof(AutoDeconstructExtensionAttribute<>).FullName)! .ConstructUnboundGenericType(); foreach (var groupedResult in from attributeData in compilation.Assembly.GetAttributes() let a = attributeData.AttributeClass where a.IsGenericType let unboundAttribute = a.ConstructUnboundGenericType() where SymbolEqualityComparer.Default.Equals(unboundAttribute, attributeSymbol) let typeArgs = a.TypeArguments where !typeArgs.IsDefaultOrEmpty let typeArg = typeArgs[0] let typeArgConverted = typeArg as INamedTypeSymbol where typeArgConverted is not null let typeArgStr = typeArgConverted.ToDisplayString(TypeFormats.FullName) let arguments = attributeData.ConstructorArguments where !arguments.IsDefaultOrEmpty let argStrs = from arg in arguments[0].Values select ((string)arg.Value!).Trim() let n = attributeData.TryGetNamedArgument(nameof(AutoDeconstructExtensionAttribute<object>.Namespace), out var na) ? ((string)na.Value!).Trim() : null group (TypeArgument: typeArgConverted, Members: argStrs, Namespace: n) by typeArgStr) { var (typeArg, argStrs, n) = groupedResult.First(); string namespaceResult = n ?? typeArg.ContainingNamespace.ToDisplayString(); string typeResult = typeArg.Name; string deconstructionMethodsCode = string.Join("\r\n\r\n\t", q()); context.AddSource( typeArg.ToFileName(), GeneratedFileShortcuts.ExtensionDeconstructionMethod, $@"#nullable enable namespace {namespaceResult}; /// <summary> /// Provides the extension methods on this type. /// </summary> public static class {typeResult}_DeconstructionMethods {{ {deconstructionMethodsCode} }} " ); IEnumerable<string> q() { foreach (var (typeArgument, arguments, namedArgumentNamespace) in groupedResult) { typeArgument.DeconstructInfo( false, out _, out _, out _, out string genericParameterListWithoutConstraint, out _, out _, out _ ); string fullTypeNameWithoutConstraint = typeArgument.ToDisplayString(TypeFormats.FullNameWithConstraints); string constraint = fullTypeNameWithoutConstraint.IndexOf("where") is var index and not -1 ? fullTypeNameWithoutConstraint.Substring(index) : string.Empty; string inModifier = typeArgument.TypeKind == TypeKind.Struct ? "in " : string.Empty; string parameterList = string.Join( ", ", from member in arguments let memberFound = typeArgument.GetAllMembers().FirstOrDefault(m => m.Name == member) where memberFound is not null let memberType = memberFound.GetMemberType() where memberType is not null select $@"out {memberType} {member.ToCamelCase()}" ); string assignments = string.Join( "\r\n\t\t", from member in arguments select $"{member.ToCamelCase()} = @this.{member};" ); yield return $@"/// <summary> /// Deconstruct the instance to multiple elements. /// </summary> [global::System.CodeDom.Compiler.GeneratedCode(""{GetType().FullName}"", ""{VersionValue}"")] [global::System.Runtime.CompilerServices.CompilerGenerated] [global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public static void Deconstruct{genericParameterListWithoutConstraint}(this {inModifier}{fullTypeNameWithoutConstraint} @this, {parameterList}){constraint} {{ {assignments} }}"; } } } } /// <inheritdoc/> public void Initialize(GeneratorInitializationContext context) { } }
38.330097
155
0.743161
[ "MIT" ]
SunnieShine/Sudoku
src/Sudoku.CodeGenerating/Generators/ExtensionDeconstructMethodGenerator.cs
3,950
C#
using System.Collections.Generic; using DCL.Components; using DCL.Models; using UnityEngine; namespace DCL.Controllers { public interface IParcelScene { Transform GetSceneTransform(); Dictionary<string, IDCLEntity> entities { get; } Dictionary<string, ISharedComponent> disposableComponents { get; } T GetSharedComponent<T>() where T : class; ISharedComponent GetSharedComponent(string id); event System.Action<IDCLEntity> OnEntityAdded; event System.Action<IDCLEntity> OnEntityRemoved; LoadParcelScenesMessage.UnityParcelScene sceneData { get; } ContentProvider contentProvider { get; } bool isPersistent { get; } bool isTestScene { get; } float loadingProgress { get; } bool IsInsideSceneBoundaries(Bounds objectBounds); bool IsInsideSceneBoundaries(Vector2Int gridPosition, float height = 0f); bool IsInsideSceneBoundaries(Vector3 worldPosition, float height = 0f); void CalculateSceneLoadingState(); } }
37.5
81
0.705714
[ "Apache-2.0" ]
decentraland/com.decentraland.unity-renderer-test
unity-renderer/Assets/Scripts/MainScripts/DCL/WorldRuntime/Interfaces/IParcelScene.cs
1,052
C#
using System.Collections.ObjectModel; using System.Collections.Specialized; namespace Xce.TrackingItem.Fody.TestModel { public class ReferenceCollectionModel { private readonly TrackingManager trackingManager; public ReferenceCollectionModel() { trackingManager = TrackingManagerProvider.GetDefault(); TestCollection.CollectionChanged += OnTestCollectionCollectionChanged; } ~ReferenceCollectionModel() { TestCollection.CollectionChanged -= OnTestCollectionCollectionChanged; } private void OnTestCollectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) => trackingManager.AddActions(TrackingActionFactory.GetCollectionChangedTrackingActionLIst(TestCollection, e)); public ObservableCollection<int> TestCollection { get; } } public sealed class ReferenceCollectionModel2 { private readonly TrackingManager trackingManager; public ReferenceCollectionModel2() { trackingManager = TrackingManagerProvider.GetDefault(); TestCollection.CollectionChanged += OnTestCollectionCollectionChanged; } ~ReferenceCollectionModel2() { TestCollection.CollectionChanged -= OnTestCollectionCollectionChanged; } private void OnTestCollectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) => trackingManager.AddActions(TrackingActionFactory.GetCollectionChangedTrackingActionLIst(TestCollection, e)); public ObservableCollection<int> TestCollection { get; set; } } }
33.36
120
0.721223
[ "MIT" ]
xclemence/undo-redo-manager
src/Fody.Test/Xce.TrackingItem.Fody.TestModel/ReferenceCollectionModel.cs
1,670
C#
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // 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.Management.Automation; using System.Reflection; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.BaseCommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandInterfaces; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.GetAzureHDInsightClusters.Extensions; using Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.ServiceLocation; using Microsoft.WindowsAzure.Management.HDInsight.Logging; namespace Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets { /// <summary> /// Cmdlet that grants RDP access to an HDInsight cluster. /// </summary> [Cmdlet(VerbsSecurity.Grant, AzureHdInsightPowerShellConstants.AzureHdinsightRdpAccess)] public class GrantAzureHdinsightRdpAccessCmdlet : AzureHDInsightCmdlet, IManageAzureHDInsightRdpAccessBase { private readonly IManageAzureHDInsightRdpAccessCommand command; private bool enableRdpAccess = true; public GrantAzureHdinsightRdpAccessCmdlet() { this.command = ServiceLocator.Instance.Locate<IAzureHDInsightCommandFactory>().CreateManageRdpAccess(); } /// <inheritdoc /> [Parameter(Position = 3, Mandatory = false, HelpMessage = "The management certificate used to manage the Azure subscription.")] [Alias(AzureHdInsightPowerShellConstants.AliasCert)] public X509Certificate2 Certificate { get { return this.command.Certificate; } set { this.command.Certificate = value; } } /// <inheritdoc /> [Parameter(Position = 5, Mandatory = false, HelpMessage = "The HostedService to use when managing the HDInsight cluster.", ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)] [Alias(AzureHdInsightPowerShellConstants.AliasCloudServiceName)] public string HostedService { get { return this.command.HostedService; } set { this.command.HostedService = value; } } /// <inheritdoc /> [Parameter(Position = 3, Mandatory = true, HelpMessage = "The credentials to use when connecting to Azure HDInsight cluster using RDP.", ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)] public PSCredential RdpCredential { get { return this.command.RdpCredential; } set { this.command.RdpCredential = value; } } /// <inheritdoc /> [Parameter(Position = 3, Mandatory = true, HelpMessage = "The RDP access expiry for connecting to Azure HDInsight cluster.", ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)] public DateTime RdpAccessExpiry { get { return this.command.RdpAccessExpiry; } set { this.command.RdpAccessExpiry = value; } } /// <inheritdoc /> public bool Enable { get { return this.enableRdpAccess; } set { this.enableRdpAccess = value; } } /// <inheritdoc /> [Parameter(Position = 4, Mandatory = false, HelpMessage = "The Endpoint to use when connecting to Azure.", ParameterSetName = AzureHdInsightPowerShellConstants.ParameterSetClusterByNameWithSpecificSubscriptionCredentials)] public Uri Endpoint { get { return this.command.Endpoint; } set { this.command.Endpoint = value; } } /// <inheritdoc /> [Parameter(Position = 5, Mandatory = false, HelpMessage = "Rule for SSL errors with HDInsight client.")] public bool IgnoreSslErrors { get { return this.command.IgnoreSslErrors; } set { this.command.IgnoreSslErrors = value; } } /// <inheritdoc /> [Parameter(Position = 1, Mandatory = true, HelpMessage = "The Location of the HDInsight cluster to grant rdp access to.")] public string Location { get { return this.command.Location; } set { this.command.Location = value; } } /// <inheritdoc /> [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the HDInsight cluster to grant rdp access to.", ValueFromPipeline = true)] [Alias(AzureHdInsightPowerShellConstants.AliasClusterName, AzureHdInsightPowerShellConstants.AliasDnsName)] public string Name { get { return this.command.Name; } set { this.command.Name = value; } } /// <inheritdoc /> [Parameter(Position = 2, Mandatory = false, HelpMessage = "The subscription id for the Azure subscription.")] [Alias(AzureHdInsightPowerShellConstants.AliasSub)] public string Subscription { get { return this.command.Subscription; } set { this.command.Subscription = value; } } /// <summary> /// Finishes the execution of the cmdlet by listing the clusters. /// </summary> protected override void EndProcessing() { this.WriteWarning(string.Format(AzureHdInsightPowerShellConstants.AsmWarning, "Grant-AzureRmHDInsightRdpServicesAccess")); this.command.Enable = true; try { this.command.Logger = this.Logger; this.command.CurrentSubscription = this.GetCurrentSubscription(this.Subscription, this.Certificate); Task task = this.command.EndProcessing(); CancellationToken token = this.command.CancellationToken; while (!task.IsCompleted) { this.WriteDebugLog(); task.Wait(1000, token); } if (task.IsFaulted) { throw new AggregateException(task.Exception); } foreach (AzureHDInsightCluster output in this.command.Output) { this.WriteObject(output); } this.WriteDebugLog(); } catch (Exception ex) { Type type = ex.GetType(); this.Logger.Log(Severity.Error, Verbosity.Normal, this.FormatException(ex)); this.WriteDebugLog(); if (type == typeof(AggregateException) || type == typeof(TargetInvocationException) || type == typeof(TaskCanceledException)) { ex.Rethrow(); } else { throw; } } this.WriteDebugLog(); } /// <inheritdoc /> protected override void StopProcessing() { this.command.Cancel(); } } }
44.221622
145
0.613006
[ "MIT" ]
Andrean/azure-powershell
src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GrantAzureHdinsightRdpAccessCmdlet.cs
7,999
C#
using FilterLists.Data.Entities; using FilterLists.Data.Entities.Junctions; using FilterLists.Data.EntityTypeConfigurations; using FilterLists.Data.EntityTypeConfigurations.Junctions; using Microsoft.EntityFrameworkCore; namespace FilterLists.Data { public class FilterListsDbContext : DbContext { public FilterListsDbContext(DbContextOptions options) : base(options) { } public DbSet<FilterList> FilterLists { get; set; } public DbSet<Language> Languages { get; set; } public DbSet<License> Licenses { get; set; } public DbSet<Maintainer> Maintainers { get; set; } public DbSet<Rule> Rules { get; set; } public DbSet<Snapshot> Snapshots { get; set; } public DbSet<Software> Software { get; set; } public DbSet<Syntax> Syntaxes { get; set; } public DbSet<Tag> Tags { get; set; } public DbSet<Dependent> Dependents { get; set; } public DbSet<FilterListLanguage> FilterListLanguages { get; set; } public DbSet<FilterListMaintainer> FilterListMaintainers { get; set; } public DbSet<FilterListTag> FilterListTags { get; set; } public DbSet<Fork> Forks { get; set; } public DbSet<Merge> Merges { get; set; } public DbSet<SnapshotRule> SnapshotRules { get; set; } public DbSet<SoftwareSyntax> SoftwareSyntaxes { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); ApplyConfigurations(modelBuilder); } private static void ApplyConfigurations(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new FilterListTypeConfiguration()); modelBuilder.ApplyConfiguration(new LanguageTypeConfiguration()); modelBuilder.ApplyConfiguration(new LicenseTypeConfiguration()); modelBuilder.ApplyConfiguration(new MaintainerTypeConfiguration()); modelBuilder.ApplyConfiguration(new RuleTypeConfiguration()); modelBuilder.ApplyConfiguration(new SnapshotTypeConfiguration()); modelBuilder.ApplyConfiguration(new SoftwareTypeConfiguration()); modelBuilder.ApplyConfiguration(new SyntaxTypeConfiguration()); modelBuilder.ApplyConfiguration(new TagTypeConfiguration()); modelBuilder.ApplyConfiguration(new DependentTypeConfiguration()); modelBuilder.ApplyConfiguration(new FilterListLanguageTypeConfiguration()); modelBuilder.ApplyConfiguration(new FilterListMaintainerTypeConfiguration()); modelBuilder.ApplyConfiguration(new FilterListTagTypeConfiguration()); modelBuilder.ApplyConfiguration(new ForkTypeConfiguration()); modelBuilder.ApplyConfiguration(new MergeTypeConfiguration()); modelBuilder.ApplyConfiguration(new SnapshotRuleTypeConfiguration()); modelBuilder.ApplyConfiguration(new SoftwareSyntaxTypeConfiguration()); } } }
48.935484
89
0.703691
[ "MIT" ]
EnergizedProtection/FilterLists
src/FilterLists.Data/FilterListsDbContext.cs
3,036
C#
//----------------------------------------------------------------------- // <copyright file="SwaggerToTypeScriptClientGenerator.cs" company="NSwag"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using NJsonSchema; using NJsonSchema.CodeGeneration; using NJsonSchema.CodeGeneration.TypeScript; using NSwag.CodeGeneration.TypeScript.Models; namespace NSwag.CodeGeneration.TypeScript { /// <summary>Generates the CSharp service client code. </summary> public class SwaggerToTypeScriptClientGenerator : ClientGeneratorBase<TypeScriptOperationModel, TypeScriptParameterModel, TypeScriptResponseModel> { private readonly SwaggerDocument _document; private readonly TypeScriptTypeResolver _resolver; private readonly TypeScriptExtensionCode _extensionCode; /// <summary>Initializes a new instance of the <see cref="SwaggerToTypeScriptClientGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToTypeScriptClientGenerator(SwaggerDocument document, SwaggerToTypeScriptClientGeneratorSettings settings) : this(document, settings, new TypeScriptTypeResolver(settings.TypeScriptGeneratorSettings)) { } /// <summary>Initializes a new instance of the <see cref="SwaggerToTypeScriptClientGenerator" /> class.</summary> /// <param name="document">The Swagger document.</param> /// <param name="settings">The settings.</param> /// <param name="resolver">The resolver.</param> /// <exception cref="ArgumentNullException"><paramref name="document" /> is <see langword="null" />.</exception> public SwaggerToTypeScriptClientGenerator(SwaggerDocument document, SwaggerToTypeScriptClientGeneratorSettings settings, TypeScriptTypeResolver resolver) : base(document, settings.CodeGeneratorSettings, resolver) { Settings = settings; _document = document ?? throw new ArgumentNullException(nameof(document)); _resolver = resolver; _resolver.RegisterSchemaDefinitions(_document.Definitions); _extensionCode = new TypeScriptExtensionCode( Settings.TypeScriptGeneratorSettings.ExtensionCode, (Settings.TypeScriptGeneratorSettings.ExtendedClasses ?? new string[] { }).Concat(new[] { Settings.ConfigurationClass }).ToArray(), new[] { Settings.ClientBaseClass }); } /// <summary>Gets or sets the generator settings.</summary> public SwaggerToTypeScriptClientGeneratorSettings Settings { get; set; } /// <summary>Gets the base settings.</summary> public override ClientGeneratorBaseSettings BaseSettings => Settings; /// <summary>Gets the type.</summary> /// <param name="schema">The schema.</param> /// <param name="isNullable">Specifies whether the type is nullable..</param> /// <param name="typeNameHint">The type name hint.</param> /// <returns>The type name.</returns> public override string GetTypeName(JsonSchema4 schema, bool isNullable, string typeNameHint) { if (schema == null) return "void"; if (schema.ActualTypeSchema.IsBinary) return GetBinaryResponseTypeName(); if (schema.ActualTypeSchema.IsAnyType) return "any"; return _resolver.Resolve(schema.ActualSchema, isNullable, typeNameHint); } /// <summary>Gets the file response type name.</summary> /// <returns>The type name.</returns> public override string GetBinaryResponseTypeName() { return Settings.Template != TypeScriptTemplate.JQueryCallbacks && Settings.Template != TypeScriptTemplate.JQueryPromises ? "FileResponse" : "any"; } /// <summary>Generates the file.</summary> /// <param name="clientTypes">The client types.</param> /// <param name="dtoTypes">The DTO types.</param> /// <param name="outputType">Type of the output.</param> /// <returns>The code.</returns> protected override string GenerateFile(IEnumerable<CodeArtifact> clientTypes, IEnumerable<CodeArtifact> dtoTypes, ClientGeneratorOutputType outputType) { var model = new TypeScriptFileTemplateModel(clientTypes, dtoTypes, _document, _extensionCode, Settings, _resolver); var template = BaseSettings.CodeGeneratorSettings.TemplateFactory.CreateTemplate("TypeScript", "File", model); return template.Render(); } /// <summary>Generates the client class.</summary> /// <param name="controllerName">Name of the controller.</param> /// <param name="controllerClassName">Name of the controller class.</param> /// <param name="operations">The operations.</param> /// <returns>The code.</returns> protected override IEnumerable<CodeArtifact> GenerateClientTypes(string controllerName, string controllerClassName, IEnumerable<TypeScriptOperationModel> operations) { UpdateUseDtoClassAndDataConversionCodeProperties(operations); var model = new TypeScriptClientTemplateModel(controllerName, controllerClassName, operations, _extensionCode, _document, Settings); var template = Settings.CreateTemplate(model); yield return new CodeArtifact(model.Class, CodeArtifactType.Class, CodeArtifactLanguage.CSharp, CodeArtifactCategory.Client, template); } /// <summary>Generates all DTO types.</summary> /// <returns>The code artifact collection.</returns> protected override IEnumerable<CodeArtifact> GenerateDtoTypes() { var generator = new TypeScriptGenerator(_document, Settings.TypeScriptGeneratorSettings, _resolver); return generator.GenerateTypes(_extensionCode); } /// <summary>Creates an operation model.</summary> /// <param name="operation"></param> /// <param name="settings">The settings.</param> /// <returns>The operation model.</returns> protected override TypeScriptOperationModel CreateOperationModel(SwaggerOperation operation, ClientGeneratorBaseSettings settings) { return new TypeScriptOperationModel(operation, (SwaggerToTypeScriptClientGeneratorSettings)settings, this, Resolver); } private void UpdateUseDtoClassAndDataConversionCodeProperties(IEnumerable<TypeScriptOperationModel> operations) { // TODO: Remove this method => move to appropriate location foreach (var operation in operations) { foreach (var response in operation.Responses.Where(r => r.HasType)) { response.DataConversionCode = DataConversionGenerator.RenderConvertToClassCode(new DataConversionParameters { Variable = "result" + response.StatusCode, Value = "resultData" + response.StatusCode, Schema = response.ResolvableResponseSchema, IsPropertyNullable = response.IsNullable, TypeNameHint = string.Empty, Settings = Settings.TypeScriptGeneratorSettings, Resolver = _resolver, NullValue = TypeScriptNullValue.Null }); } if (operation.HasDefaultResponse && operation.DefaultResponse.HasType) { operation.DefaultResponse.DataConversionCode = DataConversionGenerator.RenderConvertToClassCode(new DataConversionParameters { Variable = "result" + operation.DefaultResponse.StatusCode, Value = "resultData" + operation.DefaultResponse.StatusCode, Schema = operation.DefaultResponse.ResolvableResponseSchema, IsPropertyNullable = operation.DefaultResponse.IsNullable, TypeNameHint = string.Empty, Settings = Settings.TypeScriptGeneratorSettings, Resolver = _resolver, NullValue = TypeScriptNullValue.Null }); } } } } }
52.311765
173
0.645676
[ "MIT" ]
OsvaldoJ/NSwag
src/NSwag.CodeGeneration.TypeScript/SwaggerToTypeScriptClientGenerator.cs
8,895
C#
using Net.FreeORM.Framework.Base; using System; using Net.FreeORM.Test_Odbc.Source.DL; namespace Net.FreeORM.Test_Odbc.Source.BO { public class MatchedPatientOrder : BaseBO { private string _OBJID; public string OBJID { set { _OBJID = value; OnPropertyChanged("OBJID"); } get { return _OBJID; } } private int _PatientId; public int PatientId { set { _PatientId = value; OnPropertyChanged("PatientId"); } get { return _PatientId; } } private int _OrderId; public int OrderId { set { _OrderId = value; OnPropertyChanged("OrderId"); } get { return _OrderId; } } private string _ParameterString; public string ParameterString { set { _ParameterString = value; OnPropertyChanged("ParameterString"); } get { return _ParameterString; } } private DateTime _CreatedDate; public DateTime CreatedDate { set { _CreatedDate = value; OnPropertyChanged("CreatedDate"); } get { return _CreatedDate; } } public override string GetTableName() { return "MatchedPatientOrder"; } public override string GetIdColumn() { return "OBJID"; } internal int Insert() { try { using(MatchedPatientOrderDL _matchedpatientorderdlDL = new MatchedPatientOrderDL()) { return _matchedpatientorderdlDL.Insert(this); } } catch { throw; } } internal int InsertAndGetId() { try { using(MatchedPatientOrderDL _matchedpatientorderdlDL = new MatchedPatientOrderDL()) { return _matchedpatientorderdlDL.InsertAndGetId(this); } } catch { throw; } } internal int Update() { try { using(MatchedPatientOrderDL _matchedpatientorderdlDL = new MatchedPatientOrderDL()) { return _matchedpatientorderdlDL.Update(this); } } catch { throw; } } internal int Delete() { try { using(MatchedPatientOrderDL _matchedpatientorderdlDL = new MatchedPatientOrderDL()) { return _matchedpatientorderdlDL.Delete(this); } } catch { throw; } } } }
17.75
87
0.665857
[ "Apache-2.0" ]
mustafasacli/Net.FreeORM.TestRepo
Net.FreeORM.Test/Net.FreeORM.Test/Net.FreeORM.Test_Odbc/Source/BO/MatchedPatientOrder.cs
2,059
C#
// *** 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.AzureNextGen.Network.Outputs { [OutputType] public sealed class ApplicationGatewayPrivateLinkIpConfigurationResponse { /// <summary> /// A unique read-only string that changes whenever the resource is updated. /// </summary> public readonly string Etag; /// <summary> /// Resource ID. /// </summary> public readonly string? Id; /// <summary> /// The name of application gateway private link ip configuration. /// </summary> public readonly string? Name; /// <summary> /// Whether the ip configuration is primary or not. /// </summary> public readonly bool? Primary; /// <summary> /// The private IP address of the IP configuration. /// </summary> public readonly string? PrivateIPAddress; /// <summary> /// The private IP address allocation method. /// </summary> public readonly string? PrivateIPAllocationMethod; /// <summary> /// The provisioning state of the application gateway private link IP configuration. /// </summary> public readonly string ProvisioningState; /// <summary> /// Reference to the subnet resource. /// </summary> public readonly Outputs.SubResourceResponse? Subnet; /// <summary> /// The resource type. /// </summary> public readonly string Type; [OutputConstructor] private ApplicationGatewayPrivateLinkIpConfigurationResponse( string etag, string? id, string? name, bool? primary, string? privateIPAddress, string? privateIPAllocationMethod, string provisioningState, Outputs.SubResourceResponse? subnet, string type) { Etag = etag; Id = id; Name = name; Primary = primary; PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; ProvisioningState = provisioningState; Subnet = subnet; Type = type; } } }
29.952941
92
0.591123
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/Network/Outputs/ApplicationGatewayPrivateLinkIpConfigurationResponse.cs
2,546
C#
using System.Collections.Generic; namespace Yorozu.GoogleDriveHelper.AppsScript { public static class AppsScriptUtil { /// <summary> /// シート名とRowのJsonに変換 /// </summary> internal static string ConvertPostJson(string sheetName, IList<string> rows, int skipRow = 0) { var json = new System.Text.StringBuilder(); json.AppendLine("{"); json.AppendFormat(" \"sheetName\": \"{0}\",\n", sheetName); json.AppendFormat(" \"skip\": {0},\n", skipRow); { json.AppendLine(" \"rows\": ["); json.AppendLine(" ["); for (var x = 0; x < rows.Count; x++) { json.AppendFormat(" \"{0}\"", rows[x]); if (x < rows.Count - 1) json.Append(","); json.AppendLine(); } json.AppendLine(" ]"); json.AppendLine(" ]"); // rows } json.AppendLine("}"); return json.ToString(); } } }
30.027027
101
0.444644
[ "MIT" ]
yayorozu/UnityGoogleDriveHelper
Script/AppsScript/AppsScriptUtil.cs
1,129
C#
namespace GoCardlessApi.Subscriptions { public static class IntervalUnit { public static readonly string Weekly = "weekly"; public static readonly string Monthly = "monthly"; public static readonly string Yearly = "yearly"; } }
29.333333
58
0.681818
[ "MIT" ]
john-hartley/GoCardless.Api
src/GoCardless.Api/Subscriptions/IntervalUnit.cs
266
C#
namespace AdventOfCode.Solutions.Year2020; /// <summary> /// Day 13: Shuttle Search /// https://adventofcode.com/2020/day/13 /// </summary> [Description("Shuttle Search")] public class Day13 { public static string Part1(string[] input, params object[]? _) => Solution1(input).ToString(); public static string Part2(string[] input, params object[]? _) => Solution2(input).ToString(); private static long Solution1(string[] input) { int arrivalTime = int.Parse(input[0]); int[] buses = input[1] .Split(',') .Where(b => b != "x") .Select(i => int.Parse(i)) .ToArray(); int busiD = 0; int currentTime = arrivalTime; bool lookingForBus = true; do { currentTime++; busiD = buses.Where(b => (currentTime % b) == 0).SingleOrDefault(); if (busiD != 0) { lookingForBus = false; break; } } while (lookingForBus); int timeToWait = currentTime - arrivalTime; return timeToWait * busiD; } record Bus(string BusNo, int Value, int Offset); private static long Solution2(string[] input) { Bus[] buses = input[1] .Split(',') .Select((busNo, i) => new Bus(busNo, 9999, i)) .Where(bus => bus.BusNo != "x") .Select(bus => bus with { Value = int.Parse(bus.BusNo) }) .ToArray(); long step = buses[0].Value; long time = step; for (int i = 1; i < buses.Length;) { time += step; if (Enumerable.Range(0, i + 1) .All(x => (time + buses[x].Offset) % (buses[x].Value) == 0)) { step *= buses[i].Value; i++; } } return time; } }
24.403226
95
0.613351
[ "MIT" ]
smabuk/AdventOfCode
Solutions/2020/Day13.cs
1,515
C#
using Moq; using NBitcoin; using Newtonsoft.Json; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web; using WalletWasabi.Tor.Http; using WalletWasabi.WebClients.Wasabi; using Xunit; namespace WalletWasabi.Tests.UnitTests.Clients { public class WasabiClientTests { [Fact] public async Task GetTransactionsTestAsync() { var mempool = Enumerable.Range(0, 1_100).Select(_ => CreateTransaction()).ToArray(); async Task<HttpResponseMessage> FakeServerCodeAsync(HttpMethod method, string relativeUri, HttpContent? content, CancellationToken cancellation) { string body = (content is { }) ? await content.ReadAsStringAsync(cancellation).ConfigureAwait(false) : ""; Uri baseUri = new("http://127.0.0.1"); Uri uri = new(baseUri, relativeUri); var parameters = HttpUtility.ParseQueryString(uri.Query); Assert.True(parameters.Count <= 10); IEnumerable<uint256> requestedTxIds = parameters["transactionIds"]!.Split(",").Select(x => uint256.Parse(x)); IEnumerable<string> result = mempool.Where(tx => requestedTxIds.Contains(tx.GetHash())).Select(tx => tx.ToHex()); var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(JsonConvert.SerializeObject(result)); return response; } var mockTorHttpClient = new Mock<IHttpClient>(); mockTorHttpClient.Setup(http => http.SendAsync(It.IsAny<HttpMethod>(), It.IsAny<string>(), It.IsAny<HttpContent?>(), It.IsAny<CancellationToken>())) .Returns(async (HttpMethod method, string relativeUri, HttpContent? content, CancellationToken cancellation) => await FakeServerCodeAsync(method, relativeUri, content, cancellation)); var client = new WasabiClient(mockTorHttpClient.Object); Assert.Empty(WasabiClient.TransactionCache); // Requests one transaction var searchedTxId = mempool[0].GetHash(); var txs = await client.GetTransactionsAsync(Network.Main, new[] { searchedTxId }, CancellationToken.None); Assert.Equal(searchedTxId, txs.First().GetHash()); Assert.NotEmpty(WasabiClient.TransactionCache); Assert.True(WasabiClient.TransactionCache.ContainsKey(searchedTxId)); // Requests 20 transaction var searchedTxIds = mempool[..20].Select(x => x.GetHash()); txs = await client.GetTransactionsAsync(Network.Main, searchedTxIds, CancellationToken.None); Assert.Equal(20, txs.Count()); // Requests 1100 transaction searchedTxIds = mempool.Select(x => x.GetHash()); txs = await client.GetTransactionsAsync(Network.Main, searchedTxIds, CancellationToken.None); Assert.Equal(1_100, txs.Count()); Assert.Equal(1_000, WasabiClient.TransactionCache.Count); Assert.Subset(WasabiClient.TransactionCache.Keys.ToHashSet(), txs.TakeLast(1_000).Select(x => x.GetHash()).ToHashSet()); // Requests transactions that are already in the cache mockTorHttpClient.Setup(http => http.SendAsync(It.IsAny<HttpMethod>(), It.IsAny<string>(), It.IsAny<HttpContent?>(), It.IsAny<CancellationToken>())) .ThrowsAsync(new InvalidOperationException("The transaction should already be in the client cache. Http request was unexpected.")); var expectedTobeCachedTxId = mempool.Last().GetHash(); txs = await client.GetTransactionsAsync(Network.Main, new[] { expectedTobeCachedTxId }, CancellationToken.None); Assert.Equal(expectedTobeCachedTxId, txs.Last().GetHash()); // Requests fails with Bad Request mockTorHttpClient.Setup(http => http.SendAsync(It.IsAny<HttpMethod>(), It.IsAny<string>(), It.IsAny<HttpContent?>(), It.IsAny<CancellationToken>())) .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent("\"Some RPC problem...\"") }); var ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await client.GetTransactionsAsync(Network.Main, new[] { RandomUtils.GetUInt256() }, CancellationToken.None)); Assert.Equal("Bad Request\nSome RPC problem...", ex.Message); } private static Transaction CreateTransaction() { var coins = Enumerable.Range(0, 10).Select(_ => new Coin(RandomUtils.GetUInt256(), 0u, Money.Coins(10), Script.Empty)).ToArray(); var tx = Network.RegTest.CreateTransaction(); foreach (var coin in coins) { tx.Inputs.Add(coin.Outpoint, Script.Empty, WitScript.Empty); } tx.Outputs.Add(Money.Coins(3), Script.Empty); tx.Outputs.Add(Money.Coins(2), Script.Empty); tx.Outputs.Add(Money.Coins(1), Script.Empty); return tx; } [Fact] public void ConstantsTests() { var min = int.Parse(WalletWasabi.Helpers.Constants.ClientSupportBackendVersionMin); var max = int.Parse(WalletWasabi.Helpers.Constants.ClientSupportBackendVersionMax); Assert.True(min <= max); int.Parse(WalletWasabi.Helpers.Constants.BackendMajorVersion); } } }
41.854701
187
0.739024
[ "MIT" ]
BTCparadigm/WalletWasabi
WalletWasabi.Tests/UnitTests/Clients/WasabiClientTests.cs
4,897
C#
using System; namespace AppJsonEvaluator { [Flags] public enum TextMarkerTypes { /// <summary> /// Use no marker /// </summary> None = 0x0000, /// <summary> /// Use squiggly underline marker /// </summary> SquigglyUnderline = 0x001, /// <summary> /// Normal underline. /// </summary> NormalUnderline = 0x002, /// <summary> /// Dotted underline. /// </summary> DottedUnderline = 0x004, /// <summary> /// Horizontal line in the scroll bar. /// </summary> LineInScrollBar = 0x0100, /// <summary> /// Small triangle in the scroll bar, pointing to the right. /// </summary> ScrollBarRightTriangle = 0x0400, /// <summary> /// Small triangle in the scroll bar, pointing to the left. /// </summary> ScrollBarLeftTriangle = 0x0800, /// <summary> /// Small circle in the scroll bar. /// </summary> CircleInScrollBar = 0x1000 } }
20.318182
62
0.624161
[ "MIT" ]
Black-Beard-Sdk/jslt
src/Black.Beard.JsltEvaluator/AvalonEdit/TextMarkerTypes.cs
896
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("8. AverageGrades")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("8. AverageGrades")] [assembly: AssemblyCopyright("Copyright © 2017")] [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("f8e7ae0c-8660-4375-8b67-c6f406b1c749")] // 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.837838
84
0.746429
[ "MIT" ]
boggroZZdev/SoftUniHomeWork
TechModule/ProgrammingFundamentals/10. Files-and-Exceptions-Exercises/8. AverageGrades/Properties/AssemblyInfo.cs
1,403
C#
using System; namespace DotNetGqlClient { public class GqlFieldNameAttribute : Attribute { public string Name { get; } public GqlFieldNameAttribute(string name) { this.Name = name; } } }
17.428571
50
0.590164
[ "MIT" ]
KODIKAS-NL/DotNetGraphQLQueryGen
src/DotNetGqlClientBase/GqlFieldNameAttribute.cs
244
C#
using System; using System.Collections; using System.Collections.Generic; using System.Threading; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; //using System.Threading.Tasks; public class RepeatLevelGameOne : MonoBehaviour { private int numberLevels = 1; private int currentLevel = -1; public GameObject NextLevelScreen; public GameObject waitting; public GameObject FinishScreen; public float interval = 0.9f; private float currentTime = 0f; public Sprite present; public string presentTag = "answer"; private bool dontRepeat = false; private RepeatLevelClass[] levels; // Use this for initialization private void Start() { waitting.SetActive(false); FinishScreen.SetActive(false); NextLevelScreen.SetActive(false); GameManegmentHelper.isLevelEnd = false; InitAnswers(); GameManegmentHelper.gameOneGivenAnswers = 0; GameManegmentHelper.CurrentLevelOverGameOne = false; //GetAndInitCorrectAnswers(); } /// <summary> /// /// </summary> private void InitAnswers() { levels = new RepeatLevelClass[numberLevels]; levels[0] = new RepeatLevelClass() { Level = 0, Answers = new Dictionary<string, KeyValuePair<string, bool>>() { {"1", new KeyValuePair<string,bool>("Chair",true) }, {"2",new KeyValuePair<string,bool>("They",false) }, {"3",new KeyValuePair<string,bool>("Table",true) }, {"4",new KeyValuePair<string,bool>("Cat",false) }, {"5",new KeyValuePair<string,bool>("Dog",false) }, }, Labels = new List<string>() { "Chair", "They", "Table", "Cat", "Dog" } }; //levels[1] = new RepeatLevelClass() //{ // Level = 1, // Answers = new Dictionary<string, KeyValuePair<string, bool>>() // { // {"1", new KeyValuePair<string,bool>("First",true) }, // {"2",new KeyValuePair<string,bool>("Second",false) }, // {"3",new KeyValuePair<string,bool>("Third",true) }, // {"4",new KeyValuePair<string,bool>("Fourth",false) }, // {"5",new KeyValuePair<string,bool>("Fifth",true) }, // }, // Labels = new List<string>() // { // "First", // "Second", // "Third", // "Fourth", // "Fifth" // } //}; //levels[2] = new RepeatLevelClass() //{ // Level = 2, // Answers = new Dictionary<string, KeyValuePair<string, bool>>() // { // {"1", new KeyValuePair<string,bool>("First",true) }, // {"2",new KeyValuePair<string,bool>("Second",false) }, // {"3",new KeyValuePair<string,bool>("Third",true) }, // {"4",new KeyValuePair<string,bool>("Fourth",false) }, // {"5",new KeyValuePair<string,bool>("Fifth",true) }, // }, // Labels = new List<string>() // { // "First", // "Second", // "Third", // "Fourth", // "Fifth" // } //}; //levels[3] = new RepeatLevelClass() //{ // Level = 3, // Answers = new Dictionary<string, KeyValuePair<string, bool>>() // { // {"1", new KeyValuePair<string,bool>("First",false) }, // {"2",new KeyValuePair<string,bool>("Second",false) }, // {"3",new KeyValuePair<string,bool>("Third",true) }, // {"4",new KeyValuePair<string,bool>("Fourth",false) }, // {"5",new KeyValuePair<string,bool>("Fifth",true) }, // }, // Labels = new List<string>() // { // "First", // "Second", // "Third", // "Fourth", // "Fifth" // } //}; //levels[4] = new RepeatLevelClass() //{ // Level = 4, // Answers = new Dictionary<string, KeyValuePair<string, bool>>() // { // {"1", new KeyValuePair<string,bool>("First",true) }, // {"2",new KeyValuePair<string,bool>("Second",true) }, // {"3",new KeyValuePair<string,bool>("Third",true) }, // {"4",new KeyValuePair<string,bool>("Fourth",false) }, // {"5",new KeyValuePair<string,bool>("Fifth",true) }, // }, // Labels = new List<string>() // { // "First", // "Second", // "Third", // "Fourth", // "Fifth" // } //}; } public void Update() { if (GameManegmentHelper.CurrentLevelOverGameOne) { currentTime += Time.deltaTime; if (currentTime > interval && dontRepeat == false) { currentTime = 0f; //Debug.Log("YessSSSSSSSSSSSSS "+changeQuestions.name); GameManegmentHelper.isUI = true; GameManegmentHelper.isLevelEnd = true; dontRepeat = true; if (currentLevel+1==numberLevels) { GameManegmentHelper.isUI = true; FinishScreen.SetActive(true); return; } NextLevelScreen.SetActive(true); } } else { currentTime = 0f; } } public void BackToMainMenu() { SceneManager.LoadScene("StartScene"); } public void NextLevel() { //Debug.Log("Starting"); waitting.SetActive(true); currentLevel++; GameManegmentHelper.GameOneAnswers.Clear(); foreach (var item in levels[currentLevel].Answers) { GameManegmentHelper.GameOneAnswers.Add(item.Key, item.Value.Value); //Debug.Log(item.Key + " " + item.Value.Value); } UpdateLabelsAsync(levels[currentLevel]); SetPresentStartSpritesAsync(levels[currentLevel]); GetAndInitCorrectAnswers(); ScaleAnswersSync(); GameManegmentHelper.GameOneLevel++; waitting.SetActive(false); NextLevelScreen.SetActive(false); GameManegmentHelper.isUI = false; dontRepeat = false; GameManegmentHelper.isLevelEnd = false; //StartCoroutine(ScaleAnswers()); } public void ScaleAnswersSync() { var answers = GameObject.FindGameObjectsWithTag("answer"); //Debug.Log("1 Scaled"); foreach (var item in answers) { //Debug.Log("2 Scaled"); Debug.Log(item.name); var comp = item.GetComponent<PresentController>(); Debug.Log(comp.isScaled); bool isScaled = comp.isScaled; if (isScaled == true) { Debug.Log("1 Scaled"); var scale = item.transform.localScale; scale.x = 2.1f; scale.y = 2.1f; item.transform.localScale = scale; comp.isScaled = false; //break; } } } private IEnumerator ScaleAnswers() { bool workDone = false; while (!workDone) { // Let the engine run for a frame. yield return null; var answers = GameObject.FindGameObjectsWithTag("answer"); //Debug.Log("1 Scaled"); foreach (var item in answers) { //Debug.Log("2 Scaled"); Debug.Log(item.name); var comp = item.GetComponent<PresentController>(); Debug.Log(comp.isScaled); bool isScaled = comp.isScaled; if (isScaled == true) { Debug.Log("1 Scaled"); var scale = item.transform.localScale; scale.x = 2.1f; scale.y = 2.1f; item.transform.localScale = scale; //break; } } workDone = true; } } private void SetPresentStartSprites(RepeatLevelClass level) { foreach (var item in level.Answers) { var go = GameObject.Find(item.Key); SpriteRenderer spriteRndr = go.GetComponent<SpriteRenderer>(); spriteRndr.sprite = this.present; } } private void SetPresentStartSpritesAsync(RepeatLevelClass level) { foreach (var item in level.Answers) { StartCoroutine(YieldingUpdateSprites(item)); } } IEnumerator YieldingUpdateSprites(KeyValuePair<string, KeyValuePair<string, bool>> item) { bool workDone = false; while (!workDone) { // Let the engine run for a frame. yield return null; var go = GameObject.Find(item.Key); SpriteRenderer spriteRndr = go.GetComponent<SpriteRenderer>(); spriteRndr.sprite = this.present; workDone = true; // Do Work... } } private void GetAndInitCorrectAnswers() { GameManegmentHelper.gameOneAllAnswers = 0; foreach (var item in GameManegmentHelper.GameOneAnswers) { if (item.Value) { GameManegmentHelper.gameOneAllAnswers++; } } //Debug.Log(GameManegmentHelper.gameOneAllAnswers); GameManegmentHelper.gameOneGivenAnswers = 0; GameManegmentHelper.CurrentLevelOverGameOne = false; } private void UpdateLabels(RepeatLevelClass level) { // Debug.Log("Labels"); foreach (var item in level.Answers) { var go = GameObject.Find(item.Key); //Debug.Log(go.name); var sl = go.transform.Find("LableText"); //Debug.Log(sl.name); var text = sl.transform.Find("Text"); //Debug.Log(text); var textComponent = text.gameObject.GetComponent<Text>(); //Debug.Log(textComponent.text); textComponent.text = item.Value.Key; } } private void UpdateLabelsAsync(RepeatLevelClass level) { //var options = new ParallelOptions(); // var task = new UnityEditor.VersionControl.Task(() => { }); // Debug.Log("Labels"); foreach (var item in level.Answers) { StartCoroutine(YieldingUpdateLableText(item)); } } IEnumerator YieldingUpdateLableText(KeyValuePair<string, KeyValuePair<string, bool>> item) { bool workDone = false; while (!workDone) { // Let the engine run for a frame. yield return null; var go = GameObject.Find(item.Key); var sl = go.transform.Find("LableText"); var text = sl.transform.Find("Text"); var textComponent = text.gameObject.GetComponent<Text>(); textComponent.text = item.Value.Key; workDone = true; } } }
32.047354
94
0.504216
[ "MIT" ]
angelvardin/english-learning-software
Assets/Scripts/AnswerManegments/NextLevel/RepeatLevelGameOne.cs
11,507
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18051 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace VBConverter.UI.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VBConverter.UI.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
44.59375
181
0.59986
[ "MIT" ]
wwdenis/vbconverter
UI/Properties/Resources.Designer.cs
2,856
C#
// // ErrorExpression.cs // // Author: // Mike Krüger <mkrueger@xamarin.com> // // Copyright (c) 2011 Xamarin 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. using System; using ICSharpCode.NRefactory.Cpp.Ast; namespace ICSharpCode.NRefactory.Cpp { public class ErrorExpression : Expression { TextLocation location; public override TextLocation StartLocation { get { return location; } } public override TextLocation EndLocation { get { return location; } } public ErrorExpression () { } public ErrorExpression (TextLocation location) { this.location = location; } public override S AcceptVisitor<T, S> (IAstVisitor<T, S> visitor, T data = default(T)) { // nothing return default(S); } protected internal override bool DoMatch (AstNode other, PatternMatching.Match match) { var o = other as ErrorExpression; return o != null; } } }
27.690141
88
0.72177
[ "MIT" ]
AlexAlbala/Alter-Native
NRefactory/ICSharpCode.NRefactory.Cpp/Ast/Expressions/ErrorExpression.cs
1,967
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpawnManager : MonoBehaviour { public Spawner[] Spawners; public List<SpawnEntity> SpawnEntities = new List<SpawnEntity>(); public List<SpawnEntity> processedSpawnEntity = new List<SpawnEntity>(); private float _tick = 0.0f; private void Start() { if(Spawners.Length == 0) { Spawners = FindObjectsOfType<Spawner>(); } if(Spawners.Length == 0) { Debug.LogWarning("There are no spawner in the game"); } for (int i = 0; i < Spawners.Length; i++) { Spawners[i].StartSpawner(); } } private void Update() { _tick += Time.deltaTime; var nextEntity = GetNextEntity(); if(nextEntity != null) { Spawners[nextEntity.SpawnerIndex].AddEntity(nextEntity); processedSpawnEntity.Add(nextEntity); SpawnEntities.Remove(nextEntity); } } private SpawnEntity GetNextEntity() { for (int i = 0; i < SpawnEntities.Count; i++) { if(_tick >= SpawnEntities[i].SpawnTime) { return SpawnEntities[i]; } } return null; } }
23.052632
76
0.555556
[ "MIT" ]
Labae-CK/CK_2-2-Game_Engine_Programming
Assets/Game/Scripts/Spawner/SpawnManager.cs
1,316
C#
using System; using System.Collections.Generic; namespace StrawberryShake.VisualStudio.Language { /// <summary> /// A GraphQL Input Object defines a set of input fields; the input fields are either /// scalars, enums, or other input objects. This allows arguments to accept arbitrarily /// complex structs. /// https://graphql.github.io/graphql-spec/June2018/#sec-Input-Objects /// </summary> public sealed class InputValueDefinitionNode : NamedSyntaxNode { public InputValueDefinitionNode( Location location, NameNode name, StringValueNode? description, ITypeNode type, IValueNode? defaultValue, IReadOnlyList<DirectiveNode> directives) : base(location, name, directives) { Description = description; Type = type ?? throw new ArgumentNullException(nameof(type)); DefaultValue = defaultValue; } public override NodeKind Kind { get; } = NodeKind.InputValueDefinition; public StringValueNode? Description { get; } public ITypeNode Type { get; } public IValueNode? DefaultValue { get; } public override IEnumerable<ISyntaxNode> GetNodes() { if (Description is { }) { yield return Description; } yield return Name; yield return Type; if (DefaultValue is { }) { yield return DefaultValue; } foreach (DirectiveNode directive in Directives) { yield return directive; } } public InputValueDefinitionNode WithLocation(Location location) { return new InputValueDefinitionNode( location, Name, Description, Type, DefaultValue, Directives); } public InputValueDefinitionNode WithName(NameNode name) { return new InputValueDefinitionNode( Location, name, Description, Type, DefaultValue, Directives); } public InputValueDefinitionNode WithDescription( StringValueNode? description) { return new InputValueDefinitionNode( Location, Name, description, Type, DefaultValue, Directives); } public InputValueDefinitionNode WithType(ITypeNode type) { return new InputValueDefinitionNode( Location, Name, Description, type, DefaultValue, Directives); } public InputValueDefinitionNode WithDefaultValue( IValueNode defaultValue) { return new InputValueDefinitionNode( Location, Name, Description, Type, defaultValue, Directives); } public InputValueDefinitionNode WithDirectives( IReadOnlyList<DirectiveNode> directives) { return new InputValueDefinitionNode( Location, Name, Description, Type, DefaultValue, directives); } } }
30.673077
91
0.582132
[ "MIT" ]
Asshiah/hotchocolate
src/StrawberryShake/VisualStudioWin/src/StrawberryShake.VisualStudio.Language/AST/InputValueDefinitionNode.cs
3,192
C#
using System.Net; using FluentAssertions; using IpData.Exceptions; using Xunit; namespace IpData.Tests.Exceptions { public class UnauthorizedExceptionTests { [Fact] public void UnauthorizedException_WhenCreate_ShouldReturnStatusCode() { // Act var sut = new UnauthorizedException(); // Assert sut.StatusCode.Should().Be(HttpStatusCode.Unauthorized); } [Fact] public void UnauthorizedException_WhenCreateWithoutParams_ShouldReturnApiError() { // Act var sut = new UnauthorizedException(); // Assert sut.ApiError.Should().NotBeNull(); } [Theory, AutoMoqData] public void UnauthorizedException_WhenCreateWithContent_ShouldReturnApiErrorWithMessage(string content) { // Act var sut = new UnauthorizedException(content); // Assert sut.ApiError.Message.Should().Be(content); } [Theory, AutoMoqData] public void UnauthorizedException_WhenCreateWithContent_ShouldBeMessage(string content) { // Act var sut = new UnauthorizedException(content); // Assert sut.Message.Should().Be(content); } } }
26.019608
111
0.600603
[ "MIT" ]
alexkhil/IpData
test/Unit/IpData.Tests/Exceptions/UnauthorizedExceptionTests.cs
1,329
C#
using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; namespace Hids.DurableFunctionSupport { /// <summary> /// Makes requests to the Function Host for Durable Function status /// </summary> public class DurableFunctionClient { /// <summary> /// Port this client will contact the function host on /// </summary> public int Port { get; private set; } /// <summary> /// Base URL for the function host. Typically http://localhost:{port} /// </summary> public string BaseUrl { get; private set; } private static HttpClient client; /// <summary> /// Constructs a new DurableFunctionClient with a base URL of http://localhost:{port} /// </summary> /// <param name="port">Port the function host is expected to be running on</param> public DurableFunctionClient(int port) { Port = port; client = new HttpClient(); BaseUrl = $"http://localhost:{port}"; } /// <summary> /// Gets the history of all Durable Functions on the function host. /// </summary> public async Task<IEnumerable<DurableFunctionStatus>> GetAllFunctionStatuses() { var url = $"{BaseUrl}/runtime/webhooks/durabletask/instances"; var request = new HttpRequestMessage( HttpMethod.Get, url ); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); var responseContent = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<IEnumerable<DurableFunctionStatus>>(responseContent); } /// <summary> /// Deletes the history of all Durable Functions on the function host. /// </summary> /// <remarks> /// This is useful in a test scenario when you expect only a single instance. Instead of /// having to search by name, status, or try to be clever based on execution times, the /// test can use this method to clear history, wait for an instance to show up in the /// history, then wait for that instance to finish. /// </remarks> /// <returns> /// True if instances were deleted, false otherwise /// </returns> public async Task<bool> PurgeInstanceHistoriesAsync() { var createdTimeFrom = "2000-01-01T00:00:00Z"; // Docs say this is optional, but it's not var url = $"{BaseUrl}/runtime/webhooks/durabletask/instances"; var uriBuilder = new UriBuilder(url); uriBuilder.Query = $"createdTimeFrom={createdTimeFrom}"; var request = new HttpRequestMessage( HttpMethod.Delete, uriBuilder.Uri ); var response = await client.SendAsync(request); var responseText = await response.Content.ReadAsStringAsync(); // Returns 404 if no instances found matching the criteria - expected if no functions have run yet return (response.StatusCode != System.Net.HttpStatusCode.NotFound); } } }
37.770115
110
0.606208
[ "MIT" ]
hi-digital-solutions/Durable_Function_Support
DurableFunctionSupport/DurableFunctionClient.cs
3,286
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections; using Microsoft.Build.Framework; using Shouldly; using Xunit; #nullable disable namespace Microsoft.Build.UnitTests { /// <summary> /// Verify the functioning of the ProjectStartedEventArgs class. /// </summary> public class ProjectStartedEventArgs_Tests { /// <summary> /// Default event to use in tests. /// </summary> private static ProjectStartedEventArgs s_baseProjectStartedEvent; /// <summary> /// Setup for text fixture, this is run ONCE for the entire test fixture /// </summary> public ProjectStartedEventArgs_Tests() { BuildEventContext parentBuildEventContext = new BuildEventContext(2, 3, 4, 5); s_baseProjectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, parentBuildEventContext); } /// <summary> /// Trivially exercise event args default ctors to boost Frameworks code coverage /// </summary> [Fact] public void EventArgsCtors() { ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs2(); projectStartedEvent.ShouldNotBeNull(); projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null); projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null); projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null); projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null); projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null, DateTime.Now); } /// <summary> /// Verify different Items and properties are not taken into account in the equals comparison. They should /// not be considered as part of the equals evaluation /// </summary> [Fact] public void ItemsAndPropertiesDifferentEquals() { ArrayList itemsList = new ArrayList(); ArrayList propertiesList = new ArrayList(); ProjectStartedEventArgs differentItemsAndProperties = new ProjectStartedEventArgs ( s_baseProjectStartedEvent.ProjectId, s_baseProjectStartedEvent.Message, s_baseProjectStartedEvent.HelpKeyword, s_baseProjectStartedEvent.ProjectFile, s_baseProjectStartedEvent.TargetNames, propertiesList, itemsList, s_baseProjectStartedEvent.ParentProjectBuildEventContext, s_baseProjectStartedEvent.Timestamp ); s_baseProjectStartedEvent.Properties.ShouldNotBe(propertiesList); s_baseProjectStartedEvent.Items.ShouldNotBe(itemsList); } /// <summary> /// Create a derived class so that we can test the default constructor in order to increase code coverage and /// verify this code path does not cause any exceptions. /// </summary> private class ProjectStartedEventArgs2 : ProjectStartedEventArgs { /// <summary> /// Default constructor /// </summary> public ProjectStartedEventArgs2() : base() { } } } }
43.968085
163
0.643358
[ "MIT" ]
AlexanderSemenyak/msbuild
src/Framework.UnitTests/ProjectStartedEventArgs_Tests.cs
4,135
C#
 using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; #pragma warning disable 1591 namespace Frends.Community.Pgp { #region PgpClearTextSignature public class PgpClearTextSignatureInput { /// <summary> /// Path to file being signed. /// </summary> [DefaultValue(@"C:\temp\message.txt")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to signed file that will be created. /// </summary> [DefaultValue(@"C:\temp\encryptedFile.pgp")] [DisplayFormat(DataFormatString = "Text")] public string OutputFile { get; set; } /// <summary> /// Path to private key file. /// </summary> [DefaultValue(@"C:\temp\publicKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PrivateKeyFile { get; set; } /// <summary> /// Password attached to private key. /// </summary> [PasswordPropertyText] public string Password { get; set; } /// <summary> /// Hash (digest) function, such as SHA256, SHA384, SHA512, MD5, RIPEMD160, SHA1. /// </summary> // public HashAlgorithmTag HashFunction { get; set; } [DefaultValue(PgpClearTextSignatureHashFunctionType.Sha256)] public PgpClearTextSignatureHashFunctionType HashFunction { get; set; } } /// <summary> /// Enum for choosing HashAlgorithm type. /// </summary> public enum PgpClearTextSignatureHashFunctionType { Md5, Sha1, RipeMd160, Sha224, Sha256, Sha384, Sha512 } public class PgpClearTextSignatureResult { /// <summary> /// Result class. /// </summary> public string FilePath { get; set; } } #endregion #region PgpDecryptFile public class PgpDecryptInput { /// <summary> /// Path to file to decrypt. /// </summary> [DefaultValue(@"C:\temp\encryptedFile.pgp")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to file that will be create. /// </summary> [DefaultValue(@"C:\temp\decrypted_file.txt")] [DisplayFormat(DataFormatString = "Text")] public string OutputFile { get; set; } /// <summary> /// Private key used to decrypt file. /// </summary> [DefaultValue(@"C:\temp\privateKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PrivateKeyFile { get; set; } /// <summary> /// Password for private key. /// </summary> [PasswordPropertyText] public string PassPhrase { get; set; } } public class PgpDecryptResult { /// <summary> /// Result class. /// </summary> public string FilePath { get; set; } } #endregion #region PgpEncrypt /// <summary> /// Input for Encrypt task /// </summary> public class PgpEncryptInput { /// <summary> /// Path to file being encrypted. /// </summary> [DefaultValue(@"C:\temp\message.txt")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to encrypted file that will be create. /// </summary> [DefaultValue(@"C:\temp\encryptedFile.pgp")] [DisplayFormat(DataFormatString = "Text")] public string OutputFile { get; set; } /// <summary> /// Path to recipients public key. /// </summary> [DefaultValue(@"C:\temp\publicKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PublicKeyFile { get; set; } /// <summary> /// Use ascii armor or not. /// </summary> [DefaultValue(true)] public bool UseArmor { get; set; } /// <summary> /// Check integrity of output file or not. /// </summary> [DefaultValue(true)] public bool UseIntegrityCheck { get; set; } /// <summary> /// Should compression be used? /// </summary> [DefaultValue(true)] public bool UseCompression { get; set; } /// <summary> /// Type of compression to use /// </summary> [DefaultValue(PgpEncryptCompressionType.Zip)] [UIHint(nameof(UseCompression), "", true)] public PgpEncryptCompressionType CompressionType { get; set; } /// <summary> /// Encryption algorithm to use /// </summary> [DefaultValue(PgpEncryptEncryptionAlgorithm.Cast5)] public PgpEncryptEncryptionAlgorithm EncryptionAlgorithm { get; set; } /// <summary> /// Should the encrypted file be signed with private key? /// </summary> public bool SignWithPrivateKey { get; set; } /// <summary> /// File signing related settings /// </summary> [UIHint(nameof(SignWithPrivateKey), "", true)] public PgpEncryptSigningSettings SigningSettings { get; set; } } /// <summary> /// Settings related to signing /// </summary> public class PgpEncryptSigningSettings { /// <summary> /// Path to private key to sign with /// </summary> [DefaultValue(@"C:\temp\privateKeyFile.gpg")] [DisplayFormat(DataFormatString = "Text")] public string PrivateKeyFile { get; set; } /// <summary> /// If the file should be signed with private key then password to private key has to be offered /// </summary> [PasswordPropertyText] public string PrivateKeyPassword { get; set; } /// <summary> /// Hash algorithm to use with signature /// </summary> [DefaultValue(PgpEncryptSignatureHashAlgorithm.Sha1)] public PgpEncryptSignatureHashAlgorithm SignatureHashAlgorithm { get; set; } } /// <summary> /// Result class. /// </summary> public class PgpEncryptResult { public string FilePath { get; set; } } /// <summary> /// Encryption algorithm to use /// </summary> public enum PgpEncryptEncryptionAlgorithm { Aes128, Aes192, Aes256, Blowfish, Camellia128, Camellia192, Camellia256, Cast5, Des, Idea, TripleDes, Twofish } /// <summary> /// Compression to use /// </summary> public enum PgpEncryptCompressionType { BZip2, Uncompressed, Zip, ZLib } /// <summary> /// Signature hash algorithm to use /// </summary> public enum PgpEncryptSignatureHashAlgorithm { Md2, Md5, RipeMd160, Sha1, Sha224, Sha256, Sha384, Sha512 } #endregion #region PgpSignature public class PgpSignatureInput { /// <summary> /// Path to file to sign. /// </summary> [DefaultValue(@"C:\temp\message.txt")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to signed file that will be created. /// </summary> [DefaultValue(@"C:\temp\signature.txt")] [DisplayFormat(DataFormatString = "Text")] public string OutputFile { get; set; } /// <summary> /// Path to private key file. /// </summary> [DefaultValue(@"C:\temp\publicKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PrivateKeyFile { get; set; } /// <summary> /// Password attached to private key. /// </summary> [PasswordPropertyText] public string Password { get; set; } /// <summary> /// Hash (digest) function, such as SHA256, SHA384, SHA512, MD5, RIPEMD160, SHA1. /// </summary> // public HashAlgorithmTag HashFunction { get; set; } [DefaultValue(PgpSignatureHashFunctionType.Sha256)] public PgpSignatureHashFunctionType HashFunction { get; set; } } /// <summary> /// Enum for choosing HashAlgorithm type. /// </summary> public enum PgpSignatureHashFunctionType { Md5, Sha1, RipeMd160, Sha224, Sha256, Sha384, Sha512 } public class PgpSignatureResult { /// <summary> /// Result class. /// </summary> public string FilePath { get; set; } } #endregion # region PgpVerifyClearTextSignature public class PgpVerifyClearTextSignatureInput { /// <summary> /// Path to file to verify. /// </summary> [DefaultValue(@"C:\temp\message.txt")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to public key file. /// </summary> [DefaultValue(@"C:\temp\publicKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PublicKeyFile { get; set; } /// <summary> /// Path for verified result file. /// </summary> [DefaultValue(@"C:\temp\message_out.txt")] [DisplayFormat(DataFormatString = "Text")] public string OutputFile { get; set; } } public class PgpVerifyClearTextSignatureResult { /// <summary> /// Path to verified file. /// </summary> public string FilePath { get; set; } /// <summary> /// False if verification fails /// </summary> [DefaultValue("false")] public Boolean Verified { get; set; } } #endregion #region PgpVerifySignature public class PgpVerifySignatureInput { /// <summary> /// Path to signed file. /// </summary> [DefaultValue(@"C:\temp\message.txt")] [DisplayFormat(DataFormatString = "Text")] public string InputFile { get; set; } /// <summary> /// Path to public key file. /// </summary> [DefaultValue(@"C:\temp\publicKey.asc")] [DisplayFormat(DataFormatString = "Text")] public string PublicKeyFile { get; set; } /// <summary> /// Folder where the verified file will be created. /// If empty, file will be created to same folder as InputFile /// </summary> [DefaultValue(@"")] [DisplayFormat(DataFormatString = "Text")] public string OutputFolder { get; set; } } public class PgpVerifySignatureResult { /// <summary> /// Path to verified file. /// </summary> public string FilePath { get; set; } /// <summary> /// False if verification fails /// </summary> [DefaultValue("false")] public Boolean Verified { get; set; } } #endregion }
27.674938
104
0.55707
[ "MIT" ]
CommunityHiQ/Frends.Community.PGP
Frends.Community.Pgp/Frends.Community.Pgp/Definitions.cs
11,155
C#
using System; using System.Diagnostics; using NUnit.Framework; using XeroApi.Integration; namespace XeroApi.Tests { public class PauseTimeTests { [Test] public void it_can_pause_time() { Stopwatch stopwatch = Stopwatch.StartNew(); PauseTime pauseTime = new PauseTime(); pauseTime.Pause(TimeSpan.FromMilliseconds(1000)); stopwatch.Stop(); // Time delta was 10ms and exception said 50ms. Fixing delta. Assert.AreEqual(1000, stopwatch.ElapsedMilliseconds, 50, "Actual elapsed timespan is not within 50ms of the expected timespan"); } } }
24.37037
140
0.644377
[ "MIT" ]
MatthewSteeples/XeroAPI.Net
source/XeroApi.Tests/PauseTimeTests.cs
660
C#
using System; using System.Linq; using System.Collections.Generic; using System.Runtime.InteropServices; using Torque3D.Engine; using Torque3D.Util; namespace Torque3D { public unsafe class GameBaseData : SimDataBlock { public GameBaseData(bool pRegister = false) : base(pRegister) { } public GameBaseData(string pName, bool pRegister = false) : this(false) { Name = pName; if (pRegister) registerObject(); } public GameBaseData(string pName, string pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(Sim.FindObject<SimObject>(pParent)); } public GameBaseData(string pName, SimObject pParent, bool pRegister = false) : this(pName, pRegister) { CopyFrom(pParent); } public GameBaseData(SimObject pObj) : base(pObj) { } public GameBaseData(IntPtr pObjPtr) : base(pObjPtr) { } protected override void CreateSimObjectPtr() { ObjectPtr = InternalUnsafeMethods.GameBaseData_create(); } #region UnsafeNativeMethods new internal struct InternalUnsafeMethods { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate IntPtr _GameBaseData_create(); private static _GameBaseData_create _GameBaseData_createFunc; internal static IntPtr GameBaseData_create() { if (_GameBaseData_createFunc == null) { _GameBaseData_createFunc = (_GameBaseData_create)Marshal.GetDelegateForFunctionPointer(Torque3D.DllLoadUtils.GetProcAddress(Torque3D.Torque3DLibHandle, "fn_GameBaseData_create"), typeof(_GameBaseData_create)); } return _GameBaseData_createFunc(); } } #endregion #region Functions #endregion #region Properties public string Category { get { return getFieldValue("Category"); } set { setFieldValue("Category", value); } } #endregion } }
22.021277
136
0.642995
[ "MIT" ]
lukaspj/T3D-CSharp-Tools
BaseLibrary/Torque3D/Engine/GameBaseData.cs
2,070
C#
using System; using System.Xml.Serialization; namespace Aop.Api.Domain { /// <summary> /// AlipayOpenMiniInnerappPluginuseconfigCancelModel Data Structure. /// </summary> [Serializable] public class AlipayOpenMiniInnerappPluginuseconfigCancelModel : AopObject { /// <summary> /// 来源 /// </summary> [XmlElement("app_origin")] public string AppOrigin { get; set; } /// <summary> /// 端id /// </summary> [XmlElement("bundle_id")] public string BundleId { get; set; } /// <summary> /// 小程序应用 ID /// </summary> [XmlElement("mini_app_id")] public string MiniAppId { get; set; } /// <summary> /// 插件研发版本 /// </summary> [XmlElement("plugin_dev_version")] public string PluginDevVersion { get; set; } /// <summary> /// 插件id /// </summary> [XmlElement("plugin_id")] public string PluginId { get; set; } } }
24.906977
78
0.51634
[ "Apache-2.0" ]
alipay/alipay-sdk-net
AlipaySDKNet.Standard/Domain/AlipayOpenMiniInnerappPluginuseconfigCancelModel.cs
1,103
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("EMU7800")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EMU7800")] [assembly: AssemblyCopyright("")] [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("b1f45280-2ae9-468c-8db8-4663fe6f2300")] // 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.027027
84
0.743066
[ "MIT" ]
ircluzar/BizhawkLegacy-Vanguard
EMU7800/Properties/AssemblyInfo.cs
1,372
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("SimplePdfReport.Reporting")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Michigan Medicine Radiation Oncology")] [assembly: AssemblyProduct("SimplePdfReport.Reporting")] [assembly: AssemblyCopyright("Copyright © Michigan Medicine Radiation Oncology 2017")] [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("9bb0ce8d-91c4-4e54-9afa-eb8d9797e8ea")] // 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")]
40.27027
86
0.75906
[ "MIT" ]
bcatt09/DVHAnalysis
src/SimplePdfReport.Reporting/Properties/AssemblyInfo.cs
1,493
C#
using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Text; using Xunit; using Serilog.Formatting.Json; using Serilog.Sinks.CustomFile.Tests.Support; using Serilog.Tests.Support; #pragma warning disable 618 namespace Serilog.Sinks.CustomFile.Tests { public class FileSinkTests { [Fact] public void FileIsWrittenIfNonexistent() { using (var tmp = TempFolder.ForCaller()) { var nonexistent = tmp.AllocateFilename("txt"); var evt = Some.LogEvent("Hello, world!"); using (var sink = new FileSink(nonexistent, new JsonFormatter(), null)) { sink.Emit(evt); } var lines = System.IO.File.ReadAllLines(nonexistent); Assert.Contains("Hello, world!", lines[0]); } } [Fact] public void FileIsAppendedToWhenAlreadyCreated() { using (var tmp = TempFolder.ForCaller()) { var path = tmp.AllocateFilename("txt"); var evt = Some.LogEvent("Hello, world!"); using (var sink = new FileSink(path, new JsonFormatter(), null)) { sink.Emit(evt); } using (var sink = new FileSink(path, new JsonFormatter(), null)) { sink.Emit(evt); } var lines = System.IO.File.ReadAllLines(path); Assert.Contains("Hello, world!", lines[0]); Assert.Contains("Hello, world!", lines[1]); } } [Fact] public void WhenLimitIsSpecifiedFileSizeIsRestricted() { const int maxBytes = 5000; const int eventsToLimit = 10; using (var tmp = TempFolder.ForCaller()) { var path = tmp.AllocateFilename("txt"); var evt = Some.LogEvent(new string('n', maxBytes / eventsToLimit)); using (var sink = new FileSink(path, new JsonFormatter(), maxBytes)) { for (var i = 0; i < eventsToLimit * 2; i++) { sink.Emit(evt); } } var size = new FileInfo(path).Length; Assert.True(size > maxBytes); Assert.True(size < maxBytes * 2); } } [Fact] public void WhenLimitIsNotSpecifiedFileSizeIsNotRestricted() { const int maxBytes = 5000; const int eventsToLimit = 10; using (var tmp = TempFolder.ForCaller()) { var path = tmp.AllocateFilename("txt"); var evt = Some.LogEvent(new string('n', maxBytes / eventsToLimit)); using (var sink = new FileSink(path, new JsonFormatter(), null)) { for (var i = 0; i < eventsToLimit * 2; i++) { sink.Emit(evt); } } var size = new FileInfo(path).Length; Assert.True(size > maxBytes * 2); } } [Fact] public void WhenLimitIsSpecifiedAndEncodingHasPreambleDataIsCorrectlyAppendedToFileSink() { long? maxBytes = 5000; var encoding = Encoding.UTF8; Assert.True(encoding.GetPreamble().Length > 0); WriteTwoEventsAndCheckOutputFileLength(maxBytes, encoding); } [Fact] public void WhenLimitIsNotSpecifiedAndEncodingHasPreambleDataIsCorrectlyAppendedToFileSink() { var encoding = Encoding.UTF8; Assert.True(encoding.GetPreamble().Length > 0); WriteTwoEventsAndCheckOutputFileLength(null, encoding); } [Fact] public void WhenLimitIsSpecifiedAndEncodingHasNoPreambleDataIsCorrectlyAppendedToFileSink() { long? maxBytes = 5000; var encoding = new UTF8Encoding(false); Assert.Empty(encoding.GetPreamble()); WriteTwoEventsAndCheckOutputFileLength(maxBytes, encoding); } [Fact] public void WhenLimitIsNotSpecifiedAndEncodingHasNoPreambleDataIsCorrectlyAppendedToFileSink() { var encoding = new UTF8Encoding(false); Assert.Empty(encoding.GetPreamble()); WriteTwoEventsAndCheckOutputFileLength(null, encoding); } [Fact] public void OnOpenedLifecycleHookCanWrapUnderlyingStream() { var gzipWrapper = new GZipHooks(); using (var tmp = TempFolder.ForCaller()) { var path = tmp.AllocateFilename("txt"); var evt = Some.LogEvent("Hello, world!"); using (var sink = new FileSink(path, new JsonFormatter(), null, null, false, gzipWrapper)) { sink.Emit(evt); sink.Emit(evt); } // Ensure the data was written through the wrapping GZipStream, by decompressing and comparing against // what we wrote List<string> lines; using (var textStream = new MemoryStream()) { using (var fs = System.IO.File.OpenRead(path)) using (var decompressStream = new GZipStream(fs, CompressionMode.Decompress)) { decompressStream.CopyTo(textStream); } textStream.Position = 0; lines = textStream.ReadAllLines(); } Assert.Equal(2, lines.Count); Assert.Contains("Hello, world!", lines[0]); } } [Fact] public static void OnOpenedLifecycleHookCanWriteFileHeader() { using (var tmp = TempFolder.ForCaller()) { var headerWriter = new FileHeaderWriter("This is the file header"); var path = tmp.AllocateFilename("txt"); using (new FileSink(path, new JsonFormatter(), null, new UTF8Encoding(false), false, headerWriter)) { // Open and write header } using (var sink = new FileSink(path, new JsonFormatter(), null, new UTF8Encoding(false), false, headerWriter)) { // Length check should prevent duplicate header here sink.Emit(Some.LogEvent()); } var lines = System.IO.File.ReadAllLines(path); Assert.Equal(2, lines.Length); Assert.Equal(headerWriter.Header, lines[0]); Assert.Equal('{', lines[1][0]); } } [Fact] public static void OnOpenedLifecycleHookCanCaptureFilePath() { using (var tmp = TempFolder.ForCaller()) { var capturePath = new CaptureFilePathHook(); var path = tmp.AllocateFilename("txt"); using (new FileSink(path, new JsonFormatter(), null, new UTF8Encoding(false), false, capturePath)) { // Open and capture the log file path } Assert.Equal(path, capturePath.Path); } } [Fact] public static void OnOpenedLifecycleHookCanEmptyTheFileContents() { using (var tmp = TempFolder.ForCaller()) { var emptyFileHook = new TruncateFileHook(); var path = tmp.AllocateFilename("txt"); using (var sink = new FileSink(path, new JsonFormatter(), fileSizeLimitBytes: null, encoding: new UTF8Encoding(false), buffered: false)) { sink.Emit(Some.LogEvent()); } using (var sink = new FileSink(path, new JsonFormatter(), fileSizeLimitBytes: null, encoding: new UTF8Encoding(false), buffered: false, hooks: emptyFileHook)) { // Hook will clear the contents of the file before emitting the log events sink.Emit(Some.LogEvent()); } var lines = System.IO.File.ReadAllLines(path); Assert.Single(lines); Assert.Equal('{', lines[0][0]); } } static void WriteTwoEventsAndCheckOutputFileLength(long? maxBytes, Encoding encoding) { using (var tmp = TempFolder.ForCaller()) { var path = tmp.AllocateFilename("txt"); var evt = Some.LogEvent("Irrelevant as it will be replaced by the formatter"); const string actualEventOutput = "x"; var formatter = new FixedOutputFormatter(actualEventOutput); var eventOuputLength = encoding.GetByteCount(actualEventOutput); using (var sink = new FileSink(path, formatter, maxBytes, encoding: encoding)) { sink.Emit(evt); } var size = new FileInfo(path).Length; Assert.Equal(encoding.GetPreamble().Length + eventOuputLength, size); //write a second event to the same file using (var sink = new FileSink(path, formatter, maxBytes, encoding: encoding)) { sink.Emit(evt); } size = new FileInfo(path).Length; Assert.Equal(encoding.GetPreamble().Length + eventOuputLength * 2, size); } } } }
34.918149
174
0.520689
[ "Apache-2.0" ]
OronDF343/serilog-sinks-file
test/Serilog.Sinks.CustomFile.Tests/FileSinkTests.cs
9,814
C#
#region Copyright /* -------------------------------------------------------------------------------- This source file is part of Xenocide by Project Xenocide Team For the latest info on Xenocide, see http://www.projectxenocide.com/ This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA. -------------------------------------------------------------------------------- */ /* * @file AircraftOrdersDialog.cs * @date Created: 2007/08/19 * @author File creator: dteviot * @author Credits: none */ #endregion #region Using Statements using System; using System.Collections.Generic; using System.Text; using CeGui; using ProjectXenocide.UI.Screens; using ProjectXenocide.Utils; using ProjectXenocide.Model.Geoscape; using ProjectXenocide.Model.Geoscape.Vehicles; using Xenocide.Resources; #endregion namespace ProjectXenocide.UI.Dialogs { /// <summary> /// Dialog that lets player change the orders given to an aircraft /// </summary> class AircraftOrdersDialog : Dialog { /// <summary> /// Constructor /// </summary> /// <param name="craft">Craft to give orders to</param> public AircraftOrdersDialog(Aircraft craft) : base("Content/Layouts/AircraftOrdersDialog.layout") { this.craft = craft; } #region Create the CeGui widgets /// <summary> /// add the buttons to the screen /// </summary> protected override void CreateCeguiWidgets() { CeGui.Widgets.StaticText txtDetails = (CeGui.Widgets.StaticText)WindowManager.Instance.GetWindow(txtDetailsName); txtDetails.Text = MakeDialogText(); } #endregion Create the CeGui widgets #region event handlers /// <summary>user wants craft to return to base</summary> /// <param name="sender">Not used</param> /// <param name="e">Not used</param> [GuiEvent()] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public void OnReturnClicked(object sender, CeGui.GuiEventArgs e) { SetReturnToBaseMission(); } /// <summary>user wants craft to go to new location</summary> /// <param name="sender">Not used</param> /// <param name="e">Not used</param> [GuiEvent()] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public void OnTargetClicked(object sender, CeGui.GuiEventArgs e) { NewTarget(); } /// <summary>no changes are wanted</summary> /// <param name="sender">Not used</param> /// <param name="e">Not used</param> [GuiEvent()] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public void OnCancelClicked(object sender, CeGui.GuiEventArgs e) { ScreenManager.CloseDialog(this); } /// <summary> /// Set the craft's mission to "return to home base" /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "FxCop false positive")] private void SetReturnToBaseMission() { craft.Mission.Abort(); craft.Mission = new PatrolMission(craft, craft.HomeBase.Position); craft.Mission.SetState(new ReturnToBaseState(craft.Mission)); ScreenManager.CloseDialog(this); } /// <summary> /// Let user pick a new Target for this Craft /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "FxCop false positive")] private void NewTarget() { GeoscapeScreen geoscapeScreen = new GeoscapeScreen(); geoscapeScreen.State = new GeoscapeScreen.TargetingScreenState(geoscapeScreen, craft); ScreenManager.ScheduleScreen(geoscapeScreen); ScreenManager.CloseDialog(this); } #endregion event handlers /// <summary> /// Create text to show on dialog /// </summary> /// <returns>text to show</returns> private String MakeDialogText() { StringBuilder sb = new StringBuilder(craft.Name); sb.Append(Util.Linefeed); sb.Append(Util.StringFormat(Strings.MSGBOX_AIRCRAFT_ORDERS_BASE, craft.HomeBase.Name)); sb.Append(Util.Linefeed); sb.Append(Util.StringFormat(Strings.MSGBOX_AIRCRAFT_ORDERS_SPEED, craft.MetersPerSecond)); sb.Append(Util.Linefeed); sb.Append(Util.StringFormat(Strings.MSGBOX_AIRCRAFT_ORDERS_FUEL, craft.FuelPercent)); sb.Append(Util.Linefeed); foreach (WeaponPod pod in craft.WeaponPods) { if (null != pod) { sb.Append(pod.PodInformationString()); sb.Append(Util.Linefeed); } } return sb.ToString(); } #region Fields /// <summary> /// Craft to give orders to /// </summary> private Aircraft craft; #endregion #region Constants private const string txtDetailsName = "txtDetails"; #endregion } }
33.693182
126
0.592074
[ "MIT" ]
astyanax/Project-Xenocide
xna/branches/Unreviewed_Patches_branch/Xenocide/Source/UI/Dialogs/AircraftOrdersDialog.cs
5,930
C#
// ***************************************************************************** // BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE) // © Component Factory Pty Ltd, 2006-2019, All rights reserved. // The software and associated documentation supplied hereunder are the // proprietary information of Component Factory Pty Ltd, 13 Swallows Close, // Mornington, Vic 3931, Australia and are supplied subject to license terms. // // Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV) 2017 - 2019. All rights reserved. (https://github.com/Wagnerp/Krypton-NET-5.490) // Version 5.490.0.0 www.ComponentFactory.com // ***************************************************************************** using System.ComponentModel; using System.Diagnostics; namespace ComponentFactory.Krypton.Toolkit { /// <summary> /// Implement storage for a KryptonDataGridView normal state. /// </summary> public class PaletteDataGridViewAll : PaletteDataGridViewCells { #region Instance Fields private readonly PaletteDouble _background; #endregion #region Identity /// <summary> /// Initialize a new instance of the PaletteDataGridViewAll class. /// </summary> /// <param name="inherit">Source for inheriting values.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public PaletteDataGridViewAll(PaletteDataGridViewRedirect inherit, NeedPaintHandler needPaint) : base(inherit, needPaint) { Debug.Assert(inherit != null); // Create storage that maps onto the inherit instances _background = new PaletteDouble(inherit.BackgroundDouble, needPaint); } #endregion #region IsDefault /// <summary> /// Gets a value indicating if all values are default. /// </summary> [Browsable(false)] public override bool IsDefault => (Background.IsDefault && base.IsDefault); #endregion #region PopulateFromBase /// <summary> /// Populate values from the base palette. /// </summary> /// <param name="state">The palette state to populate with.</param> /// <param name="common">Reference to common settings.</param> /// <param name="gridStyle">Grid style to use for populating.</param> public override void PopulateFromBase(KryptonPaletteCommon common, PaletteState state, GridStyle gridStyle) { base.PopulateFromBase(common, state, gridStyle); common.StateCommon.BackStyle = gridStyle == GridStyle.List ? PaletteBackStyle.GridBackgroundList : PaletteBackStyle.GridBackgroundSheet; _background.PopulateFromBase(state); } #endregion #region SetInherit /// <summary> /// Sets the inheritence parent. /// </summary> public override void SetInherit(PaletteDataGridViewRedirect inherit) { base.SetInherit(inherit); _background.SetInherit(inherit.BackgroundDouble); } #endregion #region Background /// <summary> /// Gets access to the data grid view background palette details. /// </summary> [KryptonPersist] [Category("Visuals")] [Description("Overrides for defining data grid view background appearance.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public virtual PaletteBack Background => _background.Back; private bool ShouldSerializeBackground() { return !_background.IsDefault; } #endregion } }
38.821782
157
0.602142
[ "BSD-3-Clause" ]
Smurf-IV/Krypton-Toolkit-Suite-NET-Core
Source/Krypton Components/ComponentFactory.Krypton.Toolkit/Palette Controls/PaletteDataGridViewAll.cs
3,924
C#
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ using Microsoft.AspNetCore.Components; namespace BootstrapBlazor.Components { /// <summary> /// Spinner 组件基类 /// </summary> public abstract class SpinnerBase : BootstrapComponentBase { /// <summary> /// 获取Spinner样式 /// </summary> protected string? ClassName => CssBuilder.Default("spinner") .AddClass($"spinner-{spinner}") .AddClass($"text-{Color.ToDescriptionString()}", Color != Color.None) .AddClass($"spinner-border-{Size.ToDescriptionString()}", Size != Size.None) .AddClass(Class) .AddClassFromAttributes(AdditionalAttributes) .Build(); /// <summary> /// 获得/设置 Spinner样式 /// </summary> [Parameter] public string? Class { get; set; } /// <summary> /// 获得/设置 Spinner颜色 /// </summary> [Parameter] public Color Color { get; set; } /// <summary> /// 获得 / 设置 Spinner大小 /// </summary> [Parameter] public Size Size { get; set; } /// <summary> /// 获得/设置 Spinner类型 /// </summary> [Parameter] public SpinnerType SpinnerType { get; set; } = SpinnerType.Border; /// <summary> /// 获取 Spinner类型 /// </summary> protected virtual string? spinner => SpinnerType switch { SpinnerType.Border => "border", SpinnerType.Grow => "grow", _ => "" }; } }
29.316667
111
0.54747
[ "Apache-2.0" ]
5118234/BootstrapBlazor
src/BootstrapBlazor/Components/Spinner/SpinnerBase.cs
1,833
C#
using System.Reactive.Concurrency; using ReactiveUI.Validation.Helpers; namespace ReactiveUI.Validation.Tests.Models { /// <summary> /// Mocked ViewModel for INotifyDataErrorInfo testing. /// </summary> public class IndeiTestViewModel : ReactiveValidationObject<IndeiTestViewModel> { private string _name; private string _otherName; /// <summary> /// Initializes a new instance of the <see cref="IndeiTestViewModel"/> class. /// </summary> public IndeiTestViewModel() : base(ImmediateScheduler.Instance) { } /// <summary> /// Gets or sets get the Name. /// </summary> public string Name { get => _name; set => this.RaiseAndSetIfChanged(ref _name, value); } /// <summary> /// Gets or sets get the Name. /// </summary> public string OtherName { get => _otherName; set => this.RaiseAndSetIfChanged(ref _otherName, value); } } }
26.170732
85
0.5685
[ "MIT" ]
dorisoy/ReactiveUI.Validation
src/ReactiveUI.Validation.Tests/Models/IndeiTestViewModel.cs
1,073
C#
// Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0 // Changes may cause incorrect behavior and will be lost if the code is // regenerated. namespace OpenShift.DotNet.Service.Models { using System; using System.Linq; using System.Collections.Generic; using Newtonsoft.Json; using Microsoft.Rest; using Microsoft.Rest.Serialization; /// <summary> /// ResourceQuota sets aggregate quota restrictions enforced per namespace /// </summary> public partial class Iok8sapicorev1ResourceQuota { /// <summary> /// Initializes a new instance of the Iok8sapicorev1ResourceQuota /// class. /// </summary> public Iok8sapicorev1ResourceQuota() { } /// <summary> /// Initializes a new instance of the Iok8sapicorev1ResourceQuota /// class. /// </summary> public Iok8sapicorev1ResourceQuota(string apiVersion = default(string), string kind = default(string), Iok8sapimachinerypkgapismetav1ObjectMeta metadata = default(Iok8sapimachinerypkgapismetav1ObjectMeta), Iok8sapicorev1ResourceQuotaSpec spec = default(Iok8sapicorev1ResourceQuotaSpec), Iok8sapicorev1ResourceQuotaStatus status = default(Iok8sapicorev1ResourceQuotaStatus)) { ApiVersion = apiVersion; Kind = kind; Metadata = metadata; Spec = spec; Status = status; } /// <summary> /// APIVersion defines the versioned schema of this representation of /// an object. Servers should convert recognized schemas to the /// latest internal value, and may reject unrecognized values. More /// info: /// https://git.k8s.io/community/contributors/devel/api-conventions.md#resources /// </summary> [JsonProperty(PropertyName = "apiVersion")] public string ApiVersion { get; set; } /// <summary> /// Kind is a string value representing the REST resource this object /// represents. Servers may infer this from the endpoint the client /// submits requests to. Cannot be updated. In CamelCase. More info: /// https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds /// </summary> [JsonProperty(PropertyName = "kind")] public string Kind { get; set; } /// <summary> /// Standard object's metadata. More info: /// https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata /// </summary> [JsonProperty(PropertyName = "metadata")] public Iok8sapimachinerypkgapismetav1ObjectMeta Metadata { get; set; } /// <summary> /// Spec defines the desired quota. /// https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status /// </summary> [JsonProperty(PropertyName = "spec")] public Iok8sapicorev1ResourceQuotaSpec Spec { get; set; } /// <summary> /// Status defines the actual enforced quota and its current usage. /// https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status /// </summary> [JsonProperty(PropertyName = "status")] public Iok8sapicorev1ResourceQuotaStatus Status { get; set; } /// <summary> /// Validate the object. Throws ValidationException if validation fails. /// </summary> public virtual void Validate() { if (this.Metadata != null) { this.Metadata.Validate(); } } } }
40.1
381
0.638404
[ "MIT" ]
gbraad/OpenShift.Vsix
OpenShift.DotNet.Service.Netfx/OpenShift API (with Kubernetes)/Models/Iok8sapicorev1ResourceQuota.cs
3,611
C#
using System.Collections.Generic; using Lens.Resolver; using NUnit.Framework; namespace Lens.Test.Features { /// <summary> /// These tests contain descriptions of known problems which are not yet fixed. /// Corresponding Github issues are also mentioned. /// </summary> [Ignore("To be fixed later")] [TestFixture] internal class KnownIssues : TestBase { /// <summary> /// https://github.com/impworks/lens/issues/180 /// </summary> [Test] public void ClosureAndOrdinaryAccess() { var src = @" var x = 0 while x < 5 do (-> Console::WriteLine x) () x += 1 "; Test(src, null); } } }
23.433333
83
0.58037
[ "MIT" ]
impworks/lens
Lens.Test/Features/KnownIssues.cs
703
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Fuzzy_Health : MonoBehaviour { private const string labelText = "{0} TRUE"; public AnimationCurve Healthy; public AnimationCurve Hurt; public AnimationCurve Critical; public InputField HealthInput; public Text HealthyLabel; public Text HurtLabel; public Text CriticalLabel; private float HealthyVal = 0f; private float HurtVal = 0f; private float CriticalVal = 0f; void Start() { HealthInput.characterLimit = 5; SetLabel(); } public void EvaluteStatements(){ if(string.IsNullOrEmpty(HealthInput.text)){ return; } float InputValue = float.Parse(HealthInput.text); if(!(InputValue >= 0 && InputValue <= 100)){ Debug.Log("A vida deve estar entre 0 - 100!"); return; } HealthyVal = Healthy.Evaluate(InputValue); HurtVal = Hurt.Evaluate(InputValue); CriticalVal = Critical.Evaluate(InputValue); SetLabel(); } private void SetLabel(){ HealthyLabel.text = string.Format(labelText, HealthyVal); HurtLabel.text = string.Format(labelText, HurtVal); CriticalLabel.text = string.Format(labelText, CriticalVal); } }
25.055556
67
0.645233
[ "MIT" ]
CaosMen/FUZZYLOGIC
Assets/Script/Fuzzy_Health/Fuzzy_Health.cs
1,355
C#
// Released under the MIT License. // // Copyright (c) 2018 Ntreev Soft co., Ltd. // Copyright (c) 2020 Jeesu Choi // // 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. // // Forked from https://github.com/NtreevSoft/Crema // Namespaces and files starting with "Ntreev" have been renamed to "JSSoft". using JSSoft.Library.Commands; namespace JSSoft.Crema.WindowsServiceHost { class Settings { [CommandProperty("path")] public string BasePath { get; set; } [CommandProperty("port")] public int Port { get; set; } [CommandProperty("repo-module")] public string RepositoryModule { get; set; } } }
35.8
121
0.682123
[ "MIT" ]
s2quake/JSSoft.Crema
server/JSSoft.Crema.WindowsServiceHost/Settings.cs
1,792
C#
// Copyright 2021 Google LLC // // 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 // // https://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. // Generated code. DO NOT EDIT! namespace Google.Cloud.CloudDms.V1.Snippets { using Google.Cloud.CloudDms.V1; using Google.LongRunning; using Google.Protobuf.WellKnownTypes; using System.Threading.Tasks; public sealed partial class GeneratedDataMigrationServiceClientStandaloneSnippets { /// <summary>Snippet for DeleteMigrationJobAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task DeleteMigrationJobResourceNamesAsync() { // Create client DataMigrationServiceClient dataMigrationServiceClient = await DataMigrationServiceClient.CreateAsync(); // Initialize request argument(s) MigrationJobName name = MigrationJobName.FromProjectLocationMigrationJob("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"); // Make the request Operation<Empty, OperationMetadata> response = await dataMigrationServiceClient.DeleteMigrationJobAsync(name); // Poll until the returned long-running operation is complete Operation<Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation<Empty, OperationMetadata> retrievedResponse = await dataMigrationServiceClient.PollOnceDeleteMigrationJobAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } } } }
45.724138
148
0.696078
[ "Apache-2.0" ]
googleapis/googleapis-gen
google/cloud/clouddms/v1/google-cloud-clouddms-v1-csharp/Google.Cloud.CloudDms.V1.StandaloneSnippets/DataMigrationServiceClient.DeleteMigrationJobResourceNamesAsyncSnippet.g.cs
2,652
C#
using Antlr4.Runtime; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Vectorize.Domain.Parser; namespace Vectorize.Interpreter { public class Interpreter { public Result Run(FileInfo file) { using (var stream = file.OpenRead()) { return new Context(stream).Execute(); } } public Result Run(string code) { using (var stream = new MemoryStream(Encoding.Default.GetBytes(code))) { return new Context(stream).Execute(); } } private class Context : IAntlrErrorListener<int>, IAntlrErrorListener<IToken> { private readonly Stream stream; private readonly List<string> syntaxErrors; public Context(Stream stream) { this.stream = stream; syntaxErrors = new List<string>(); } public Result Execute() { var input = new AntlrInputStream(stream); var lexer = new VectorizeLexer(input); lexer.AddErrorListener(this); var tokens = new CommonTokenStream(lexer); var parser = new VectorizeParser(tokens); parser.AddErrorListener(this); var state = new State(); var program = parser.program(); if (!syntaxErrors.Any()) { state.Run(program); return state.ToResult(); } else { return new Result("", syntaxErrors); } } public void SyntaxError(TextWriter output, IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e) { syntaxErrors.Add($"{line}:{charPositionInLine}: {msg}"); } public void SyntaxError(TextWriter output, IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e) { syntaxErrors.Add($"{line}:{charPositionInLine}: {msg}"); } } } }
31.175676
172
0.53186
[ "MIT" ]
vectorize-dsl/antlr
Vectorize.Interpreter/Interpreter.cs
2,309
C#
using DemoApi; namespace InheritedWebApplicationFactoryTests { public class DummyServiceTest : IDummyService { public string DoSomething() => nameof(DummyServiceTest); } }
19.4
64
0.726804
[ "Unlicense" ]
satano/IntegrationTestsContentRoot
InheritedWebApplicationFactoryTests/DummyServiceTest.cs
196
C#
using System; using System.Collections.Generic; using System.Text; namespace BrokenFaxMobile.Models { public class GroupData { public int Id { get; set; } public string Name { get; set; } } }
17.076923
40
0.648649
[ "MIT" ]
milenazmajchek/BrokenFaxMobile
BrokenFaxMobile/BrokenFaxMobile/Models/GroupData.cs
224
C#
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // </auto-generated> namespace Microsoft.Azure.Management.Compute.Fluent.Models { using System.Linq; /// <summary> /// Describes a Virtual Machine Scale Set VM Reimage Parameters. /// </summary> public partial class VirtualMachineScaleSetVMReimageParameters : VirtualMachineReimageParameters { /// <summary> /// Initializes a new instance of the /// VirtualMachineScaleSetVMReimageParameters class. /// </summary> public VirtualMachineScaleSetVMReimageParameters() { CustomInit(); } /// <summary> /// Initializes a new instance of the /// VirtualMachineScaleSetVMReimageParameters class. /// </summary> /// <param name="tempDisk">Specifies whether to reimage temp disk. /// Default value: false. Note: This temp disk reimage parameter is /// only supported for VM/VMSS with Ephemeral OS disk.</param> public VirtualMachineScaleSetVMReimageParameters(bool? tempDisk = default(bool?)) : base(tempDisk) { CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); } }
32.787234
100
0.644387
[ "MIT" ]
Azure/azure-libraries-for-net
src/ResourceManagement/Compute/Generated/Models/VirtualMachineScaleSetVMReimageParameters.cs
1,541
C#
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team // // 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.Reflection; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("PackageManagement.Cmdlets.Tests")] [assembly: AssemblyDescription("Package Management PowerShell Cmdlets Unit Tests")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]
49.46875
93
0.773215
[ "MIT" ]
TetradogOther/SharpDevelop
src/AddIns/Misc/PackageManagement/Cmdlets/Test/Configuration/AssemblyInfo.cs
1,585
C#
namespace csmatio.common { /// <summary> /// MAT-file data types /// </summary> /// <author>David Zier (david.zier@gmail.com)</author> public class MatDataTypes { /// <summary>Unknown data type</summary> public const int miUNKNOWN = 0; /// <summary>8-bit, signed</summary> public const int miINT8 = 1; /// <summary>8-bit, unsigned</summary> public const int miUINT8 = 2; /// <summary>16-bit, signed</summary> public const int miINT16 = 3; /// <summary>16-bit, unsigned</summary> public const int miUINT16 = 4; /// <summary>32-bit, signed</summary> public const int miINT32 = 5; /// <summary>32-bit, unsigned</summary> public const int miUINT32 = 6; /// <summary>IEEE 754 single format</summary> public const int miSINGLE = 7; /// <summary>IEEE 754 double format</summary> public const int miDOUBLE = 9; /// <summary>64-bit, signed</summary> public const int miINT64 = 12; /// <summary>64-bit, unsigned</summary> public const int miUINT64 = 13; /// <summary>MATLAB array</summary> public const int miMATRIX = 14; /// <summary>Compressed data</summary> public const int miCOMPRESSED = 15; /// <summary>Unicode UTF-8 Encoded Character Data</summary> public const int miUTF8 = 16; /// <summary>Unicode UTF-16 Encoded Character Data</summary> public const int miUTF16 = 17; /// <summary>Unicode UTF-12 Encoded Character Data</summary> public const int miUTF32 = 18; /// <summary>Size of 64-bit, signed int in bytes</summary> public const int miSIZE_INT64 = 8; /// <summary>Size of 32-bit, signed int in bytes</summary> public const int miSIZE_INT32 = 4; /// <summary>Size of 16-bit, signed int in bytes</summary> public const int miSIZE_INT16 = 2; /// <summary>Size of 8-bit, signed int in bytes</summary> public const int miSIZE_INT8 = 1; /// <summary>Size of 64-bit, unsigned int in bytes</summary> public const int miSIZE_UINT64 = 8; /// <summary>Size of 32-bit, unsigned int in bytes</summary> public const int miSIZE_UINT32 = 4; /// <summary>Size of 16-bit, unsigned int in bytes</summary> public const int miSIZE_UINT16 = 2; /// <summary>Size of 8-bit, unsigned int in bytes</summary> public const int miSIZE_UINT8 = 1; /// <summary>Size of IEEE 754 double in bytes</summary> public const int miSIZE_DOUBLE = 8; /// <summary>Size of IEEE 754 single in bytes</summary> public const int miSIZE_SINGLE = 4; /// <summary>Size of an 8-bit char in bytes</summary> public const int miSIZE_CHAR = 1; /// <summary> /// Size of an 8-bit UTF character /// </summary> public const int miSIZE_UTF8 = 1; /// <summary> /// Size of a 16-bit UTF character /// </summary> public const int miSIZE_UTF16 = 2; /// <summary> /// Size of a 32-bit UTF character /// </summary> public const int miSIZE_UTF32 = 4; /// <summary> /// Return the number of bytes for a given type. /// </summary> /// <param name="type">MatDataTypes</param> /// <returns>Size of the type.</returns> public static int SizeOf( int type ) { switch( type ) { case miINT8: return miSIZE_INT8; case miUINT8: return miSIZE_UINT8; case miINT16: return miSIZE_INT16; case miUINT16: return miSIZE_UINT16; case miINT32: return miSIZE_INT32; case miUINT32: return miSIZE_UINT32; case miINT64: return miSIZE_INT64; case miUINT64: return miSIZE_UINT64; case miDOUBLE: return miSIZE_DOUBLE; case miSINGLE: return miSIZE_SINGLE; case miUTF8: return miSIZE_UTF8; case miUTF16: return miSIZE_UTF16; case miUTF32: return miSIZE_UTF32; default: return 1; } } /// <summary> /// Get a string representation of a data type /// </summary> /// <param name="type">A MatDataTypes data type</param> /// <returns>String representation.</returns> public static string TypeToString( int type ) { switch( type ) { case miUNKNOWN: return "unknown"; case miINT8: return "int8"; case miINT16: return "int16"; case miINT32: return "int32"; case miUINT8: return "uint8"; case miUINT16: return "uint16"; case miUINT32: return "uint32"; case miSINGLE: return "single"; case miDOUBLE: return "double"; case miINT64: return "int64"; case miUINT64: return "uint64"; case miMATRIX: return "matrix"; case miCOMPRESSED: return "compressed"; case miUTF8: return "utf8"; case miUTF16: return "utf16"; case miUTF32: return "utf32"; default: return "unknown"; } } } }
30.676829
63
0.600875
[ "BSD-2-Clause" ]
damageboy/csmatio
src/common/MatDataTypes.cs
5,031
C#