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 RarelySimple.AvatarScriptLink.Objects;
using RarelySimple.AvatarScriptLink.Objects.Advanced;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace RarelySimple.AvatarScriptLink.Helpers
{
public static partial class OptionObjectHelpers
{
/// <summary>
/// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject"/> as unlocked.
/// </summary>
/// <param name="optionObject"></param>
/// <param name="fieldObjects"></param>
/// <returns></returns>
public static IOptionObject SetUnlockedFields(IOptionObject optionObject, List<FieldObject> fieldObjects)
{
if (optionObject == null)
throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
return SetFieldObjects(optionObject, FieldAction.Unlock, fieldObjects);
}
/// <summary>
/// Sets the <see cref="IFieldObject"/> in a <see cref="IOptionObject"/> as unlocked by FieldNumbers.
/// </summary>
/// <param name="optionObject"></param>
/// <param name="fieldNumbers"></param>
/// <returns></returns>
public static IOptionObject SetUnlockedFields(IOptionObject optionObject, List<string> fieldNumbers)
{
if (optionObject == null)
throw new ArgumentNullException(nameof(optionObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
return SetFieldObjects(optionObject, FieldAction.Unlock, fieldNumbers);
}
/// <summary>
/// Sets the <see cref="IFieldObject"/> in a <see cref="IFormObject"/> as unlocked by FieldNumbers.
/// </summary>
/// <param name="formObject"></param>
/// <param name="fieldNumbers"></param>
/// <returns></returns>
public static IFormObject SetUnlockedFields(IFormObject formObject, List<string> fieldNumbers)
{
if (formObject == null)
throw new ArgumentNullException(nameof(formObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
return SetFieldObjects(formObject, FieldAction.Unlock, fieldNumbers);
}
/// <summary>
/// Sets the <see cref="IFieldObject"/> in a <see cref="IRowObject"/> as unlocked by FieldNumbers.
/// </summary>
/// <param name="rowObject"></param>
/// <param name="fieldNumbers"></param>
/// <returns></returns>
public static IRowObject SetUnlockedFields(IRowObject rowObject, List<string> fieldNumbers)
{
if (rowObject == null)
throw new ArgumentNullException(nameof(rowObject), ScriptLinkHelpers.GetLocalizedString("parameterCannotBeNull", CultureInfo.CurrentCulture));
return SetFieldObjects(rowObject, FieldAction.Unlock, fieldNumbers);
}
}
}
| 49.606557 | 161 | 0.657634 | [
"MIT"
] | rarelysimple/RarelySimple.AvatarScriptLink | RarelySimple.AvatarScriptLink/Helpers/OptionObject/SetUnlockedFields.cs | 3,028 | 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 kinesisanalyticsv2-2018-05-23.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.KinesisAnalyticsV2.Model
{
/// <summary>
/// For a SQL-based Kinesis Data Analytics application, provides the bucket name and object
/// key name that stores the reference data.
/// </summary>
public partial class S3ReferenceDataSourceDescription
{
private string _bucketARN;
private string _fileKey;
private string _referenceRoleARN;
/// <summary>
/// Gets and sets the property BucketARN.
/// <para>
/// The Amazon Resource Name (ARN) of the S3 bucket.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=2048)]
public string BucketARN
{
get { return this._bucketARN; }
set { this._bucketARN = value; }
}
// Check to see if BucketARN property is set
internal bool IsSetBucketARN()
{
return this._bucketARN != null;
}
/// <summary>
/// Gets and sets the property FileKey.
/// <para>
/// Amazon S3 object key name.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1, Max=1024)]
public string FileKey
{
get { return this._fileKey; }
set { this._fileKey = value; }
}
// Check to see if FileKey property is set
internal bool IsSetFileKey()
{
return this._fileKey != null;
}
/// <summary>
/// Gets and sets the property ReferenceRoleARN.
/// <para>
/// The ARN of the IAM role that Kinesis Data Analytics can assume to read the Amazon
/// S3 object on your behalf to populate the in-application reference table.
/// </para>
/// <note>
/// <para>
/// Provided for backward compatibility. Applications that are created with the current
/// API version have an application-level service execution role rather than a resource-level
/// role.
/// </para>
/// </note>
/// </summary>
[AWSProperty(Min=1, Max=2048)]
public string ReferenceRoleARN
{
get { return this._referenceRoleARN; }
set { this._referenceRoleARN = value; }
}
// Check to see if ReferenceRoleARN property is set
internal bool IsSetReferenceRoleARN()
{
return this._referenceRoleARN != null;
}
}
} | 32.401869 | 117 | 0.586963 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/KinesisAnalyticsV2/Generated/Model/S3ReferenceDataSourceDescription.cs | 3,467 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.ML;
using Microsoft.Data.DataView;
using Microsoft.ML.Data;
using Microsoft.ML.Calibrators;
using Microsoft.ML.Trainers;
using myMLNET.Common.Models;
using myMLNET.Common.Utils;
namespace myMLNET
{
class MultipleLinearRegression
{
private static readonly string TrainDataPath = Path.Combine(Environment.CurrentDirectory, "data", "chocolate-data-multiple-linear-regression.txt");
static void Main(string[] args)
{
var mlContext = new MLContext();
var reader = mlContext.Data.CreateTextLoader(
columns: new TextLoader.Column[]
{
new TextLoader.Column("Weight", DataKind.Single, 0),
new TextLoader.Column("CocoaPercent", DataKind.Single, 1),
new TextLoader.Column("Cost", DataKind.Single, 2),
new TextLoader.Column("Label", DataKind.Single, 3)
},
// First line of the file is a header, not a data row
hasHeader: true
);
var trainingData = reader.Load(TrainDataPath);
var preview = trainingData.Preview();
Console.WriteLine($"******************************************");
Console.WriteLine($"Loaded training data: {preview.ToString()}");
Console.WriteLine($"******************************************");
var pipeline =
// Features to include in the prediction
mlContext.Transforms.Concatenate("Features", "Weight", "CocoaPercent", "Cost")
// Specify the regression trainer
.Append(mlContext.Regression.Trainers.PoissonRegression());
// Train the model
var model = pipeline.Fit(trainingData);
// The model's feature weight coefficients
var regressionModel = model.LastTransformer.Model;
var weights = regressionModel.Weights;
var intercept = regressionModel.Bias;
Console.WriteLine($"Coefficients: Weight={weights[0]:0.##}, CocoaPercent={weights[1]:0.##}, Cost={weights[2]:0.##}");
/* Build the graph */
var featureColumn = reader.GetOutputSchema().GetColumnOrNull("CocoaPercent").Value;
ChartGeneratorUtil.PlotRegressionChart(new PlotChartGeneratorModel
{
Title = "Chocolate Consumer Happiness Prediction",
LabelX = featureColumn.Name,
LabelY = "Customer Happiness",
ImageName = "FeatureToHappiness.png",
PointsList = new List<PlotChartPointsList>
{
new PlotChartPointsList { Points = ChartGeneratorUtil.GetChartPointsFromFile(TrainDataPath, featureColumn.Index, 3).ToList()}
},
MinLimitX = ChartGeneratorUtil.GetMinColumnValueFromFile(TrainDataPath, featureColumn.Index),
MaxLimitX = ChartGeneratorUtil.GetMaxColumnValueFromFile(TrainDataPath, featureColumn.Index) + 0.25,
MaxLimitY = ChartGeneratorUtil.GetMaxColumnValueFromFile(TrainDataPath, 3) + 5
});
// Compute the quality metrics of our prediction model
var predictions = model.Transform(trainingData);
PrintMetrics(mlContext, predictions);
Console.ReadKey();
}
private static void PrintMetrics(MLContext mlContext, IDataView predictions)
{
// Compute the quality metrics of our prediction model
var metrics = mlContext.Regression.Evaluate(predictions, "Label", "Score");
Console.WriteLine();
Console.WriteLine($"Model quality metrics evaluation");
// RSquared is another evaluation metric of the regression models. RSquared takes values between 0 and 1. The closer its value is to 1, the better the model is
Console.WriteLine($"R2 Score: {metrics.RSquared:0.##}");
}
public class ChocolateInput
{
public float Weight { get; set; }
public float CocoaPercent { get; set; }
public float Cost { get; set; }
}
public class ChocolateOutput
{
[ColumnName("Score")]
public float CustomerHappiness { get; set; }
}
}
}
| 42.018868 | 171 | 0.594522 | [
"MIT"
] | Bhaskers-Blu-Org2/AISchoolTutorials | MLNETCrashCourse/00.CompleteExamples/03.MultipleLinearRegression/Program.cs | 4,456 | C# |
//! \file BitStream.cs
//! \date Sat Aug 22 2015
//! \brief Bit stream on top of the IO.Stream
//
// Copyright (C) 2015 by morkt
//
// 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.Diagnostics;
using System.IO;
namespace GameRes.Formats
{
public class BitStream : IDisposable
{
protected Stream m_input;
private bool m_should_dispose;
protected int m_bits = 0;
protected int m_cached_bits = 0;
public Stream Input { get { return m_input; } }
public int CacheSize { get { return m_cached_bits; } }
protected BitStream (Stream file, bool leave_open)
{
m_input = file;
m_should_dispose = !leave_open;
}
public void Reset ()
{
m_cached_bits = 0;
}
#region IDisposable Members
bool m_disposed = false;
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (!m_disposed)
{
if (disposing && m_should_dispose && null != m_input)
m_input.Dispose();
m_disposed = true;
}
}
#endregion
}
public interface IBitStream
{
int GetBits (int count);
int GetNextBit ();
void Reset ();
}
public class MsbBitStream : BitStream, IBitStream
{
public MsbBitStream (Stream file, bool leave_open = false)
: base (file, leave_open)
{
}
public int GetBits (int count)
{
Debug.Assert (count <= 24, "MsbBitStream does not support sequences longer than 24 bits");
while (m_cached_bits < count)
{
int b = m_input.ReadByte();
if (-1 == b)
return -1;
m_bits = (m_bits << 8) | b;
m_cached_bits += 8;
}
int mask = (1 << count) - 1;
m_cached_bits -= count;
return (m_bits >> m_cached_bits) & mask;
}
public int GetNextBit ()
{
return GetBits (1);
}
}
public class LsbBitStream : BitStream, IBitStream
{
public LsbBitStream (Stream file, bool leave_open = false)
: base (file, leave_open)
{
}
public int GetBits (int count)
{
Debug.Assert (count <= 32, "LsbBitStream does not support sequences longer than 32 bits");
int value;
if (m_cached_bits >= count)
{
int mask = (1 << count) - 1;
value = m_bits & mask;
m_bits = (int)((uint)m_bits >> count);
m_cached_bits -= count;
}
else
{
value = m_bits & ((1 << m_cached_bits) - 1);
count -= m_cached_bits;
int shift = m_cached_bits;
m_cached_bits = 0;
while (count >= 8)
{
int b = m_input.ReadByte();
if (-1 == b)
return -1;
value |= b << shift;
shift += 8;
count -= 8;
}
if (count > 0)
{
int b = m_input.ReadByte();
if (-1 == b)
return -1;
value |= (b & ((1 << count) - 1)) << shift;
m_bits = b >> count;
m_cached_bits = 8 - count;
}
}
return value;
}
public int GetNextBit ()
{
return GetBits (1);
}
}
}
| 30.177914 | 102 | 0.512706 | [
"MIT"
] | poddav/GARbro | ArcFormats/BitStream.cs | 4,919 | C# |
using torque.Common.Models.Contracts.DatabaseObjects;
namespace torque.Models.DatabaseObjects
{
public struct Index : IComparableEntity
{
public string Schema { get; set; }
public string Name { get; set; }
public string TableName { get; set; }
public string Definition { get; set; }
public bool Equals(IComparableEntity other)
{
if (other is null)
return false;
return this.Name == other.Name
&& this.Schema == other.Schema
&& this.Definition == other.Definition;
}
public override bool Equals(object obj) => Equals(obj as IComparableEntity);
public override int GetHashCode() => (Name, Schema, Definition).GetHashCode();
}
}
| 27.241379 | 86 | 0.598734 | [
"MIT"
] | jhart0/torque | torque.Common/Models/DatabaseObjects/Index.cs | 792 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("03. TakeOrSkip Rope")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("03. TakeOrSkip Rope")]
[assembly: System.Reflection.AssemblyTitleAttribute("03. TakeOrSkip Rope")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
| 41.958333 | 80 | 0.647468 | [
"Apache-2.0"
] | Vladimir-Dodnikov/C-Fundamentals-May-2019 | Lists - More exercises/03. TakeOrSkip Rope/obj/Debug/netcoreapp2.2/03. TakeOrSkip Rope.AssemblyInfo.cs | 1,007 | C# |
using System.Text;
namespace Microsoft.TemplateEngine.Core.Contracts
{
public interface IOperationProvider
{
string Id { get; }
IOperation GetOperation(Encoding encoding, IProcessorState processorState);
}
}
| 20.75 | 84 | 0.686747 | [
"MIT"
] | ChadNedzlek/templating | src/Microsoft.TemplateEngine.Core.Contracts/IOperationProvider.cs | 238 | C# |
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Verse;
using Verse.Sound;
using AbilityUser;
namespace TorannMagic
{
public class Verb_SniperShot : Verb_UseAbility
{
protected override bool TryCastShot()
{
if (TM_Calc.IsUsingRanged(this.CasterPawn))
{
Thing wpn = this.CasterPawn.equipment.Primary;
ThingDef newProjectile = wpn.def.Verbs.FirstOrDefault().defaultProjectile;
Type oldThingclass = newProjectile.thingClass;
newProjectile.thingClass = this.Projectile.thingClass;
bool flag = false;
SoundInfo info = SoundInfo.InMap(new TargetInfo(this.CasterPawn.Position, this.CasterPawn.Map, false), MaintenanceType.None);
SoundDef.Named(wpn.def.Verbs.FirstOrDefault().soundCast.ToString()).PlayOneShot(info);
bool? flag4 = this.TryLaunchProjectile(newProjectile, this.currentTarget);
bool hasValue = flag4.HasValue;
if (hasValue)
{
bool flag5 = flag4 == true;
if (flag5)
{
flag = true;
}
bool flag6 = flag4 == false;
if (flag6)
{
flag = false;
}
}
this.PostCastShot(flag, out flag);
bool flag7 = !flag;
if (flag7)
{
this.Ability.Notify_AbilityFailed(this.UseAbilityProps.refundsPointsAfterFailing);
}
newProjectile.thingClass = oldThingclass;
this.burstShotsLeft = 0;
return flag;
}
else
{
Messages.Message("MustHaveRangedWeapon".Translate(
this.CasterPawn.LabelCap
), MessageTypeDefOf.RejectInput);
return false;
}
}
}
}
| 34.590164 | 141 | 0.51564 | [
"BSD-3-Clause"
] | CaptainMuscles/TMagic | Source/TMagic/TMagic/Verb_SniperShot.cs | 2,112 | 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.AzureNative.Compute.V20190301.Inputs
{
/// <summary>
/// Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration
/// </summary>
public sealed class VirtualMachineScaleSetPublicIPAddressConfigurationArgs : Pulumi.ResourceArgs
{
/// <summary>
/// The dns settings to be applied on the publicIP addresses .
/// </summary>
[Input("dnsSettings")]
public Input<Inputs.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettingsArgs>? DnsSettings { get; set; }
/// <summary>
/// The idle timeout of the public IP address.
/// </summary>
[Input("idleTimeoutInMinutes")]
public Input<int>? IdleTimeoutInMinutes { get; set; }
[Input("ipTags")]
private InputList<Inputs.VirtualMachineScaleSetIpTagArgs>? _ipTags;
/// <summary>
/// The list of IP tags associated with the public IP address.
/// </summary>
public InputList<Inputs.VirtualMachineScaleSetIpTagArgs> IpTags
{
get => _ipTags ?? (_ipTags = new InputList<Inputs.VirtualMachineScaleSetIpTagArgs>());
set => _ipTags = value;
}
/// <summary>
/// The publicIP address configuration name.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
/// <summary>
/// The PublicIPPrefix from which to allocate publicIP addresses.
/// </summary>
[Input("publicIPPrefix")]
public Input<Inputs.SubResourceArgs>? PublicIPPrefix { get; set; }
public VirtualMachineScaleSetPublicIPAddressConfigurationArgs()
{
}
}
}
| 34.59322 | 121 | 0.642822 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/Compute/V20190301/Inputs/VirtualMachineScaleSetPublicIPAddressConfigurationArgs.cs | 2,041 | C# |
// <auto-generated />
namespace IronJS.Tests.UnitTests.Sputnik.Conformance.NativeECMAScriptObjects.DateObjects.PropertiesOfTheDatePrototypeObject
{
using System;
using NUnit.Framework;
[TestFixture]
public class DatePrototypeSetUTCMillisecondsTests : SputnikTestFixture
{
public DatePrototypeSetUTCMillisecondsTests()
: base(@"Conformance\15_Native_ECMA_Script_Objects\15.9_Date_Objects\15.9.5_Properties_of_the_Date_Prototype_Object\15.9.5.29_Date.prototype.setUTCMilliseconds")
{
}
[Test]
[Category("Sputnik Conformance")]
[Category("ECMA 15.9.5.29")]
[TestCase("S15.9.5.29_A1_T1.js", Description = "The Date.prototype property \"setUTCMilliseconds\" has { DontEnum } attributes")]
[TestCase("S15.9.5.29_A1_T2.js", Description = "The Date.prototype property \"setUTCMilliseconds\" has { DontEnum } attributes")]
[TestCase("S15.9.5.29_A1_T3.js", Description = "The Date.prototype property \"setUTCMilliseconds\" has { DontEnum } attributes")]
public void TheDatePrototypePropertySetUTCMillisecondsHasDontEnumAttributes(string file)
{
RunFile(file);
}
[Test]
[Category("Sputnik Conformance")]
[Category("ECMA 15.9.5.29")]
[TestCase("S15.9.5.29_A2_T1.js", Description = "The \"length\" property of the \"setUTCMilliseconds\" is 1")]
public void TheLengthPropertyOfTheSetUTCMillisecondsIs1(string file)
{
RunFile(file);
}
[Test]
[Category("Sputnik Conformance")]
[Category("ECMA 15.9.5.29")]
[TestCase("S15.9.5.29_A3_T1.js", Description = "The Date.prototype.setUTCMilliseconds property \"length\" has { ReadOnly, DontDelete, DontEnum } attributes")]
[TestCase("S15.9.5.29_A3_T2.js", Description = "The Date.prototype.setUTCMilliseconds property \"length\" has { ReadOnly, DontDelete, DontEnum } attributes")]
[TestCase("S15.9.5.29_A3_T3.js", Description = "The Date.prototype.setUTCMilliseconds property \"length\" has { ReadOnly, DontDelete, DontEnum } attributes")]
public void TheDatePrototypeSetUTCMillisecondsPropertyLengthHasReadOnlyDontDeleteDontEnumAttributes(string file)
{
RunFile(file);
}
}
} | 50.043478 | 173 | 0.685925 | [
"Apache-2.0"
] | Varshit07/IronJS | Src/Tests/UnitTests/Sputnik/Conformance/NativeECMAScriptObjects/DateObjects/PropertiesOfTheDatePrototypeObject/DatePrototypeSetUTCMillisecondsTests.cs | 2,302 | C# |
using System;
using System.Threading.Tasks;
namespace Rivets
{
public enum NavigationResult {
// Indicates that the navigation failed and no app was opened.
Failed,
// Indicates that the navigation succeeded by opening the URL in the browser.
Web,
// Indicates that the navigation succeeded by opening the URL in an app on the device.
App
}
}
| 22.5 | 88 | 0.744444 | [
"Apache-2.0"
] | xamarin/Rivets | Rivets/NavigationResult.cs | 360 | C# |
using VXDesign.Store.DevTools.Common.Core.HTTP;
namespace VXDesign.Store.DevTools.Common.Core.Extensions
{
public static class ResponseExtensions
{
public static bool IsWithoutErrors(this IResponse response) => response.Status < 400;
public static dynamic ToLog(this IResponse response) => new
{
response.Status,
response.Reason,
response.Output
};
}
} | 27.625 | 93 | 0.642534 | [
"MIT"
] | GUSAR1T0/VXDS-DEV-TOOLS | DevTools/Common/Core/Extensions/ResponseExtensions.cs | 442 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HazardVolume : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
PlayerShip playerShip = other.gameObject.GetComponent<PlayerShip>();
if (playerShip != null)
{
playerShip.Damage(10);
}
}
}
| 20.777778 | 76 | 0.668449 | [
"MIT"
] | whroberts/ScriptingForGames_I | RobertsHenry_P01_SpaceExplorer_V1/Assets/Scripts/HazardVolume.cs | 376 | C# |
using Microsoft.EntityFrameworkCore.Migrations;
namespace Mohkazv.Library.WebApp.Data.Migrations
{
public partial class AlterAuthors : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FirstName",
table: "Authors");
migrationBuilder.DropColumn(
name: "LastName",
table: "Authors");
migrationBuilder.AddColumn<string>(
name: "FullName",
table: "Authors",
type: "nvarchar(100)",
maxLength: 100,
nullable: false,
defaultValue: "");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "FullName",
table: "Authors");
migrationBuilder.AddColumn<string>(
name: "FirstName",
table: "Authors",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "LastName",
table: "Authors",
type: "nvarchar(50)",
maxLength: 50,
nullable: false,
defaultValue: "");
}
}
}
| 28.9 | 71 | 0.488581 | [
"MIT"
] | AlirezaRezaeeIR/Library | src/Library.WebApp/Data/Migrations/20210115140519_AlterAuthors.cs | 1,447 | C# |
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Ordering.Infrastructure.Persistence;
#nullable disable
namespace Ordering.Infrastructure.Migrations
{
[DbContext(typeof(OrderContext))]
partial class OrderContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Ordering.Domain.Entities.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("AddressLine")
.HasColumnType("nvarchar(max)");
b.Property<string>("CVV")
.HasColumnType("nvarchar(max)");
b.Property<string>("CardName")
.HasColumnType("nvarchar(max)");
b.Property<string>("CardNumber")
.HasColumnType("nvarchar(max)");
b.Property<string>("Country")
.HasColumnType("nvarchar(max)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2");
b.Property<string>("EmailAddress")
.HasColumnType("nvarchar(max)");
b.Property<string>("Expiration")
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.HasColumnType("nvarchar(max)");
b.Property<string>("LastModifiedBy")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("LastModifiedDate")
.HasColumnType("datetime2");
b.Property<string>("LastName")
.HasColumnType("nvarchar(max)");
b.Property<int>("PaymentMethod")
.HasColumnType("int");
b.Property<string>("State")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("TotalPrice")
.HasColumnType("decimal(18,2)");
b.Property<string>("UserName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ZipCode")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Orders");
});
#pragma warning restore 612, 618
}
}
}
| 34.340206 | 103 | 0.509457 | [
"MIT"
] | h-sharafi/aspnetmicoservices | src/Services/Ordering/Ordering.Infrastructure/Migrations/OrderContextModelSnapshot.cs | 3,333 | C# |
using ServiceStack.ServiceHost;
namespace ServiceStack.Razor.Tests
{
public class CheckBoxService : ServiceInterface.Service
{
public CheckBoxData Get(GetCheckBox request)
{
return new CheckBoxData
{
BooleanValue = true
};
}
public CheckBoxData Post(CheckBoxData request)
{
return Get(new GetCheckBox());
}
}
[Route("/checkbox", "GET")]
public class GetCheckBox
{
}
[Route("/checkbox", "POST")]
public class CheckBoxData
{
public bool BooleanValue { get; set; }
}
} | 22.09375 | 60 | 0.500707 | [
"BSD-3-Clause"
] | GSerjo/ServiceStack | tests/ServiceStack.Razor.Tests/CheckBoxService.cs | 678 | C# |
using System;
using Xunit;
namespace P1Project.Tests
{
public class UnitTest1
{
[Fact]
public void Test1()
{
}
}
}
| 9.266667 | 25 | 0.597122 | [
"MIT"
] | 06012021-dotnet-uta/BrianCorbettP0 | P1Project/P1Project.Tests/UnitTest1.cs | 139 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProfilerViewer.Structures
{
public static class Settings
{
private static int[] _scale;
private const int Paddings = 200;
public static int AxisX
{
get { return (int)System.Windows.SystemParameters.PrimaryScreenWidth - Paddings; }
}
public static int AxisY
{
get { return 400; }
}
public static int[] Scale
{
get
{
if(_scale == null)
{
_scale = new int[] { AxisX / 8, AxisX / 4, AxisX / 2, AxisX };
}
return _scale;
}
}
}
}
| 21.594595 | 94 | 0.503129 | [
"MIT"
] | WounderedT/TTank2.0 | ProfilerViewer/Structures/Settings.cs | 801 | C# |
using System;
using Newtonsoft.Json;
using Ripple.WebSocketClient.Json.Converters;
namespace Ripple.WebSocketClient.Model.Ledger.Objects
{
public class PayChannelLedgerObject : BaseRippleLedgerObject
{
public PayChannelLedgerObject()
{
LedgerEntryType = LedgerEntryType.PayChannel;
}
public uint Flags { get; set; }
public string Account { get; set; }
public string Destination { get; set; }
public string Amount { get; set; }
public string Balance { get; set; }
public string PublicKey { get; set; }
public uint SettleDelay { get; set; }
public string OwnerNode { get; set; }
[JsonProperty("PreviousTxnID")]
public string PreviousTransactionId { get; set; }
[JsonProperty("PreviousTxnLgrSeq")]
public uint PreviousTransactionLedgerSequence { get; set; }
[JsonConverter(typeof(RippleDateTimeConverter))]
public DateTime? Expiration { get; set; }
[JsonConverter(typeof(RippleDateTimeConverter))]
public DateTime? CancelAfter { get; set; }
public uint SourceTag { get; set; }
public uint DestinationTag { get; set; }
}
}
| 26.106383 | 67 | 0.642217 | [
"Apache-2.0"
] | MaintenanceExperts/Ripple.NET.WebSocketClient | src/RippleDotNet/Model/Ledger/Objects/PayChannelLedgerObject.cs | 1,229 | C# |
namespace TrafficManager.Patch._VehicleAI._TramBaseAI {
using System.Reflection;
using ColossalFramework;
using HarmonyLib;
using JetBrains.Annotations;
using Manager.Impl;
using State;
using UnityEngine;
using Util;
[UsedImplicitly]
[HarmonyPatch]
public class CalculateSegmentPositionPatch2 {
private delegate void CalculatePositionDelegate(ushort vehicleID,
ref Vehicle vehicleData,
PathUnit.Position nextPosition,
PathUnit.Position position,
uint laneID,
byte offset,
PathUnit.Position prevPos,
uint prevLaneID,
byte prevOffset,
int index,
out Vector3 pos,
out Vector3 dir,
out float maxSpeed);
[UsedImplicitly]
public static MethodBase TargetMethod() => TranspilerUtil.DeclaredMethod<CalculatePositionDelegate>(typeof(TramBaseAI), "CalculateSegmentPosition");
[UsedImplicitly]
public static bool Prefix(TrolleybusAI __instance,
ushort vehicleID,
ref Vehicle vehicleData,
PathUnit.Position nextPosition,
PathUnit.Position position,
uint laneID,
byte offset,
PathUnit.Position prevPos,
uint prevLaneID,
byte prevOffset,
int index,
out Vector3 pos,
out Vector3 dir,
out float maxSpeed) {
NetManager netManager = Singleton<NetManager>.instance;
ushort prevSourceNodeId;
ushort prevTargetNodeId;
NetSegment[] segBuffer = netManager.m_segments.m_buffer;
if (offset < position.m_offset) {
prevSourceNodeId = segBuffer[position.m_segment].m_startNode;
prevTargetNodeId = segBuffer[position.m_segment].m_endNode;
} else {
prevSourceNodeId = segBuffer[position.m_segment].m_endNode;
prevTargetNodeId = segBuffer[position.m_segment].m_startNode;
}
ushort refTargetNodeId = prevOffset == 0
? segBuffer[prevPos.m_segment].m_startNode
: segBuffer[prevPos.m_segment].m_endNode;
Vehicle.Frame lastFrameData = vehicleData.GetLastFrameData();
float sqrVelocity = lastFrameData.m_velocity.sqrMagnitude;
netManager.m_lanes.m_buffer[laneID].CalculatePositionAndDirection(
Constants.ByteToFloat(offset),
out pos,
out dir);
Vector3 b = netManager.m_lanes.m_buffer[prevLaneID].CalculatePosition(
Constants.ByteToFloat(prevOffset));
Vector3 a = lastFrameData.m_position;
Vector3 a2 = lastFrameData.m_position;
Vector3 b2 = lastFrameData.m_rotation * new Vector3(
0f,
0f,
__instance.m_info.m_generatedInfo.m_wheelBase * 0.5f);
a += b2;
a2 -= b2;
float crazyValue = 0.5f * sqrVelocity / __instance.m_info.m_braking;
float a3 = Vector3.Distance(a, b);
float b3 = Vector3.Distance(a2, b);
if (Mathf.Min(a3, b3) >= crazyValue - 1f) {
if (prevSourceNodeId == refTargetNodeId) {
if (!VehicleBehaviorManager.Instance.MayChangeSegment(
vehicleID,
ref vehicleData,
sqrVelocity,
ref prevPos,
ref segBuffer[prevPos.m_segment],
refTargetNodeId,
prevLaneID,
ref position,
prevSourceNodeId,
ref netManager.m_nodes.m_buffer[
prevSourceNodeId],
laneID,
ref nextPosition,
prevTargetNodeId,
out maxSpeed)) {
maxSpeed = 0;
return false;
}
ExtVehicleManager.Instance.UpdateVehiclePosition(
vehicleID,
ref vehicleData);
}
}
NetInfo info = segBuffer[position.m_segment].Info;
VehicleAICommons.CustomCalculateTargetSpeed(
__instance,
vehicleID,
ref vehicleData,
position,
laneID,
info,
out maxSpeed);
// NON-STOCK CODE END
return false;
}
}
} | 45.629032 | 156 | 0.446271 | [
"MIT"
] | CitiesSkylinesMods/TMPE | TLM/TLM/Patch/_VehicleAI/_TramBaseAI/CalculateSegmentPositionPatch2.cs | 5,658 | C# |
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using Xunit;
using Stride.TextureConverter.Requests;
using Stride.TextureConverter.TexLibraries;
namespace Stride.TextureConverter.Tests
{
public class PvrttTexLibTest : IDisposable
{
private readonly PvrttTexLib library = new PvrttTexLib();
public PvrttTexLibTest()
{
Assert.False(library.SupportBGRAOrder());
}
public void Dispose()
{
library.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_BGRA8888.dds")]
[InlineData("TextureCube_WMipMaps_BGRA8888.dds")]
public void StartLibraryTest(string file)
{
TexImage image = new TexImage();
var dxtLib = new DxtTexLib();
dxtLib.Execute(image, new LoadingRequest(Module.PathToInputImages + file, false));
image.CurrentLibrary = dxtLib;
dxtLib.EndLibrary(image);
TexLibraryTest.StartLibraryTest(image, library);
image.Dispose();
}
[Fact(Skip = "Need check")]
public void CanHandleRequestTest()
{
TexImage image = TestTools.Load(library, "TextureArray_WMipMaps_PVRTC2_4bpp.pvr");
Assert.True(library.CanHandleRequest(image, new DecompressingRequest(false)));
Assert.True(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", false)));
Assert.True(library.CanHandleRequest(image, new MipMapsGenerationRequest(Filter.MipMapGeneration.Linear)));
Assert.True(library.CanHandleRequest(image, new NormalMapGenerationRequest(0.5f)));
Assert.True(library.CanHandleRequest(image, new SwitchingBRChannelsRequest()));
Assert.True(library.CanHandleRequest(image, new FlippingRequest(Orientation.Horizontal)));
Assert.True(library.CanHandleRequest(image, new FixedRescalingRequest(512, 512, Filter.Rescaling.Nearest)));
Assert.True(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", 0)));
Assert.False(library.CanHandleRequest(image, new GammaCorrectionRequest(1)));
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_PVRTC2_4bpp.pvr")]
[InlineData("TextureCube_WMipMaps_PVRTC2_4bpp.pvr")]
public void DecompressTest(string file)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.DecompressTest(image, library);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Stride.Graphics.PixelFormat.ETC2_RGBA)]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr", Stride.Graphics.PixelFormat.ETC2_RGBA)]
public void CompressTest(string file, Stride.Graphics.PixelFormat format)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.CompressTest(image, library, format);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WOMipMaps_PVRTC2_4bpp.pvr", Filter.MipMapGeneration.Box)]
[InlineData("TextureCube_WOMipMaps_PVRTC2_4bpp.pvr", Filter.MipMapGeneration.Cubic)]
public void GenerateMipMapTest(string file, Filter.MipMapGeneration filter)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.GenerateMipMapTest(image, library, filter);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", "PvrttTexLib_GenerateNormalMapTest_TextureArray_WOMipMaps_PVRTC2_4bpp.pvr")]
[InlineData("TextureCube_WMipMaps_PVRTC2_4bpp.pvr", "PvrttTexLib_GenerateNormalMapTest_TextureCube_WOMipMaps_PVRTC2_4bpp.pvr")]
public void GenerateNormalMapTest(string file, string outFile)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.GenerateNormalMapTest(image, library);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Bicubic)]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Bilinear)]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Nearest)]
public void FixedRescaleTest(string file, Filter.Rescaling filter)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.FixedRescaleTest(image, library, filter);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Bicubic)]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Bilinear)]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Filter.Rescaling.Box)]
public void FactorRescaleTest(string file, Filter.Rescaling filter)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.FactorRescaleTest(image, library, filter);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_PVRTC2_4bpp.pvr")]
[InlineData("TextureCube_WMipMaps_PVRTC2_4bpp.pvr")]
public void ExportTest(String file)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.ExportTest(image, library, file);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", 16)]
[InlineData("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", 512)]
[InlineData("TextureCube_WMipMaps_PVRTC2_4bpp.pvr", 8)]
[InlineData("TextureCube_WMipMaps_PVRTC2_4bpp.pvr", 4)]
public void ExportMinMipMapTest(String file, int minMipMapSize)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.ExportMinMipMapTest(image, library, minMipMapSize);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr")]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr")]
public void SwitchChannelsTest(string file)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.SwitchChannelsTest(image, library);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr", Orientation.Horizontal)]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr", Orientation.Vertical)]
public void FlipTest(String file, Orientation orientation)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.FlipTest(image, library, orientation);
image.Dispose();
}
[Theory(Skip = "Need check")]
[InlineData("TextureArray_WMipMaps_RGBA8888.pvr")]
[InlineData("TextureCube_WMipMaps_RGBA8888.pvr")]
public void PreMultiplyAlphaTest(String file)
{
TexImage image = TestTools.Load(library, file);
TexLibraryTest.PreMultiplyAlphaTest(image, library);
image.Dispose();
}
}
}
| 37.287805 | 137 | 0.661041 | [
"MIT"
] | Aggror/Stride | sources/tests/tools/Stride.TextureConverter.Tests/PvrttTexLibTest.cs | 7,644 | C# |
using CursoCore.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
namespace CursoCore.Domain.Interfaces.Services
{
public interface IServicePedidos : IDisposable
{
void Adicionar(Pedido obj);
void Atualizar(Pedido obj);
void Remover(Pedido obj);
IEnumerable<Pedido> ObterTodos();
IEnumerable<Pedido> Buscar(Expression<Func<Pedido, bool>> predicado);
Pedido ObterPorId(int id);
}
}
| 26.736842 | 77 | 0.708661 | [
"MIT"
] | marciomonzon/projetodddcore2 | src/CursoCore.Domain/Interfaces/Services/IServicePedidos.cs | 510 | C# |
using Xunit;
using static LanguageExt.Prelude;
namespace LanguageExt.Tests.Transformer.Traverse.Stck.Sync
{
public class Identity
{
[Fact]
public void RightEmptyIsEmpty()
{
var ma = Id<Stck<int>>(Empty);
var mb = ma.Traverse(identity);
var mc = Stack<Identity<int>>();
Assert.Equal(mc, mb);
}
[Fact]
public void RightStackIsStackRight()
{
var ma = Id(Stack(1, 2, 3, 4));
var mb = ma.Traverse(identity);
var mc = Stack(Id(4), Id(3), Id(2), Id(1));
Assert.Equal(mc, mb);
}
}
}
| 22.482759 | 58 | 0.507669 | [
"MIT"
] | TysonMN/language-ext | LanguageExt.Tests/Transformer/Traverse/Stck/Sync/Identity.cs | 654 | C# |
using FFImageLoading.Forms;
using Xamarin.Forms;
namespace InfiniteChatSample
{
public partial class OtherUserMessageCell
{
public OtherUserMessageCell()
{
InitializeComponent();
}
protected override CachedImage UserImage => ProfilePicture;
}
} | 20.2 | 67 | 0.666667 | [
"MIT"
] | gagikkyurkchyan/xamarin-samples | InfiniteChatSample/InfiniteChatSample/InfiniteChatSample/OtherUserMessageCell.xaml.cs | 305 | C# |
using Git.Data;
using Git.ViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Git.Services
{
public interface IRepositoriesService
{
void Create(string name, string repositoryType, string creatorName);
IEnumerable<AllRepositoriesViewModel> GetAll();
void Delete(string repositoryId);
List<string> GetRepositoriesIdsByUserId(string userId);
string GetRepositoryNameById(string repositoryId);
}
}
| 22.272727 | 76 | 0.732653 | [
"MIT"
] | Drakojan/SoftUni_C-_Web_Basics | Live exam/Apps/Git/Services/IRepositoriesService.cs | 492 | C# |
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Rhinobyte.Extensions.TestTools.Tests;
[TestClass]
public class WaitConfigurationCompositeItemTests
{
[TestMethod]
public void AssignMissingValues_returns_false_for_a_null_itemToCopyFrom_argument()
{
new WaitConfigurationCompositeItem().AssignMissingValues(itemToCopyFrom: null!, "SomeKey").Should().BeFalse();
}
}
| 27.266667 | 112 | 0.836186 | [
"MIT"
] | RhinobyteSoftware/DependencyInjectionExtensions | tests/Rhinobyte.Extensions.TestTools.Tests/WaitConfigurationCompositeItemTests.cs | 411 | C# |
using System;
using HotChocolate.Language;
using HotChocolate.Types.Filters.Expressions;
using HotChocolate.Utilities;
using Snapshooter.Xunit;
using Xunit;
namespace HotChocolate.Types.Filters
{
public class ExpressionVisitorConventionComparableTests
: ExpressionVisitorConventionTestBase
{
[Fact]
public void Override_ShortEqual_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.Equals,
ComparableOperationHandlers.Equals);
}
[Fact]
public void Override_ShortNotEqual_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotEquals,
ComparableOperationHandlers.NotEquals);
}
[Fact]
public void Override_ShortGreaterThan_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_gt",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.GreaterThan,
ComparableOperationHandlers.GreaterThan);
}
[Fact]
public void Override_ShortNotGreaterThan_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not_gt",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotGreaterThan,
ComparableOperationHandlers.NotGreaterThan);
}
[Fact]
public void Override_ShortGreaterThanOrEquals_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_gte",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.GreaterThanOrEquals,
ComparableOperationHandlers.GreaterThanOrEquals);
}
[Fact]
public void Override_ShortNotGreaterThanOrEquals_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not_gte",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotGreaterThanOrEquals,
ComparableOperationHandlers.NotGreaterThanOrEquals);
}
[Fact]
public void Override_ShortLowerThan_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_lt",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.LowerThan,
ComparableOperationHandlers.LowerThan);
}
[Fact]
public void Override_ShortNotLowerThan_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not_lt",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotLowerThan,
ComparableOperationHandlers.NotLowerThan);
}
[Fact]
public void Override_ShortLowerThanOrEquals_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_lte",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.LowerThanOrEquals,
ComparableOperationHandlers.LowerThanOrEquals);
}
[Fact]
public void Override_ShortNotLowerThanOrEquals_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not_lte",
new IntValueNode(12)));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotLowerThanOrEquals,
ComparableOperationHandlers.NotLowerThanOrEquals);
}
[Fact]
public void Override_ShortIn_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_in",
new ListValueNode(new[]
{
new IntValueNode(13),
new IntValueNode(14)
}))
);
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.In,
ComparableOperationHandlers.In);
}
[Fact]
public void Override_ShortNotIn_Expression()
{
// arrange
var value = new ObjectValueNode(
new ObjectFieldNode("barShort_not_in",
new ListValueNode(new[] { new IntValueNode(13), new IntValueNode(14) })));
AssertOperation<Foo>(
value,
FilterKind.Comparable,
FilterOperationKind.NotIn,
ComparableOperationHandlers.NotIn);
}
public class Foo
{
public short BarShort { get; set; }
public int BarInt { get; set; }
public long BarLong { get; set; }
public float BarFloat { get; set; }
public double BarDouble { get; set; }
public decimal BarDecimal { get; set; }
}
}
}
| 30.784689 | 90 | 0.533416 | [
"MIT"
] | DaanAcohen/hotchocolate | src/HotChocolate/Filters/test/Types.Filters.Tests/Conventions/ExpressionVisitor/ExpressionVisitiorConventionComparableTests.cs | 6,434 | C# |
using System;
using System.Globalization;
namespace JsonCs
{
/// <summary>
/// Builds a string, by performing a fast forward only read from a <see cref="JsonStream"/>
/// into an internal buffer. Any reads, will advance the reading position within the
/// <see cref="JsonStream"/>.
/// </summary>
public sealed class JsonString
{
public JsonString()
{
_buffer = new char[DefaultBufferSize];
_bufferSize = DefaultBufferSize;
}
/// <summary>
/// Attempts to read any string character from the <see cref="JsonStream"/> in sequence, until the
/// first end of string character is reached, or the stream is exhausted.
/// </summary>
/// <param name="stream">The <see cref="JsonStream"/> to read from.</param>
/// <returns>
/// The contents of the internal buffer as a string, as defined by the JSON
/// <a href="https://tools.ietf.org/html/rfc7159#section-8">RFC7591</a> specification.
/// </returns>
/// <exception cref="UnexpectedJsonException">
/// The <see cref="JsonStream"/> contains an unexpected unicode escape character and can't
/// be read any further.
/// </exception>
public string Read(JsonStream stream)
{
_readPosition = 0;
while (NotAtEndOfString(stream.Peek()))
{
if (EndOfBufferReached())
{
ExpandBufferAndPreserveContent();
}
if (StartOfEscapeSequence(stream.Peek()))
{
_buffer[_readPosition++] = ReadEscapeCharacter(stream);
}
else
{
_buffer[_readPosition++] = stream.Read();
}
}
return new string(_buffer, 0, _readPosition);
}
private static bool NotAtEndOfString(char character) => character != '"' && character != JsonStream.NullTerminator;
private bool EndOfBufferReached() => _readPosition == _bufferSize;
private void ExpandBufferAndPreserveContent()
{
var expandedBufferLength = _bufferSize*2;
var expandedBuffer = new char[expandedBufferLength];
Array.BlockCopy(_buffer, 0, expandedBuffer, 0, expandedBufferLength - _readPosition);
_buffer = expandedBuffer;
_bufferSize = expandedBufferLength;
}
private static bool StartOfEscapeSequence(char character) => character == EscapeCharacter;
private static char ReadEscapeCharacter(JsonStream stream)
{
stream.Expect(EscapeCharacter);
switch (stream.Read())
{
case '"':
return '\u0022';
case '\\':
return '\u005c';
case '/':
return '\u002f';
case 'b':
return '\u0008';
case 'f':
return '\u000c';
case 'n':
return '\u000a';
case 'r':
return '\u000d';
case 't':
return '\u0009';
case 'u':
return ParseUnicode(stream);
default:
throw new UnexpectedJsonException();
}
}
private static char ParseUnicode(JsonStream stream)
{
char unicodeCharacter;
try
{
unicodeCharacter = Convert.ToChar(int.Parse(new string(stream.Read(4)), NumberStyles.HexNumber));
}
catch
{
throw new UnexpectedJsonException();
}
return unicodeCharacter;
}
private char[] _buffer;
private int _readPosition;
private int _bufferSize;
private const int DefaultBufferSize = 1024;
private const char EscapeCharacter = '\\';
}
}
| 32.412698 | 123 | 0.520568 | [
"MIT"
] | forki/json-fs | src/JsonCs/JsonString.cs | 4,086 | C# |
using Eto.Forms;
using Eto.Drawing;
using Eto.IO;
using SD = System.Drawing;
using SWF = System.Windows.Forms;
using Eto.WinForms.Drawing;
using Eto.WinForms.Forms;
using Eto.WinForms.Forms.Printing;
using Eto.WinForms.Forms.Controls;
using Eto.WinForms.IO;
using Eto.Forms.ThemedControls;
using Eto.WinForms.Forms.Cells;
using Eto.WinForms.Forms.Menu;
using Eto.WinForms.Forms.ToolBar;
using Eto.Shared.Forms;
using System.Diagnostics;
namespace Eto.WinForms
{
public class Platform : Eto.Platform
{
public override bool IsDesktop { get { return true; } }
public override bool IsWinForms { get { return true; } }
public override string ID => "WinForms";
public override PlatformFeatures SupportedFeatures =>
PlatformFeatures.DrawableWithTransparentContent;
static Platform()
{
EmbeddedAssemblyLoader.Register("Eto.WinForms.CustomControls.Assemblies");
}
public Platform()
{
AddTo(this);
// use WebView2 by default as it is more modern than IE
UseWebView2();
}
public static void AddTo(Eto.Platform p)
{
// Drawing
p.Add<Bitmap.IHandler>(() => new BitmapHandler());
p.Add<FontFamily.IHandler>(() => new FontFamilyHandler());
p.Add<Font.IHandler>(() => new FontHandler());
p.Add<Fonts.IHandler>(() => new FontsHandler());
p.Add<Graphics.IHandler>(() => new GraphicsHandler());
p.Add<GraphicsPath.IHandler>(() => new GraphicsPathHandler());
p.Add<Icon.IHandler>(() => new IconHandler());
p.Add<IconFrame.IHandler>(() => new IconFrameHandler());
p.Add<IndexedBitmap.IHandler>(() => new IndexedBitmapHandler());
p.Add<Matrix.IHandler>(() => new MatrixHandler());
p.Add<Pen.IHandler>(() => new PenHandler());
p.Add<SolidBrush.IHandler>(() => new SolidBrushHandler());
p.Add<TextureBrush.IHandler>(() => new TextureBrushHandler());
p.Add<LinearGradientBrush.IHandler>(() => new LinearGradientBrushHandler());
p.Add<RadialGradientBrush.IHandler>(() => new RadialGradientBrushHandler());
p.Add<SystemColors.IHandler>(() => new SystemColorsHandler());
p.Add<FormattedText.IHandler>(() => new FormattedTextHandler());
// Forms.Cells
p.Add<CheckBoxCell.IHandler>(() => new CheckBoxCellHandler());
p.Add<ComboBoxCell.IHandler>(() => new ComboBoxCellHandler());
p.Add<ImageTextCell.IHandler>(() => new ImageTextCellHandler());
p.Add<ImageViewCell.IHandler>(() => new ImageViewCellHandler());
p.Add<TextBoxCell.IHandler>(() => new TextBoxCellHandler());
p.Add<DrawableCell.IHandler>(() => new DrawableCellHandler());
p.Add<ProgressCell.IHandler>(() => new ProgressCellHandler());
p.Add<CustomCell.IHandler>(() => new CustomCellHandler());
// Forms.Controls
p.Add<Button.IHandler>(() => new ButtonHandler());
p.Add<Calendar.IHandler>(() => new CalendarHandler());
p.Add<CheckBox.IHandler>(() => new CheckBoxHandler());
p.Add<DropDown.IHandler>(() => new DropDownHandler());
p.Add<ComboBox.IHandler>(() => new ComboBoxHandler());
p.Add<ColorPicker.IHandler>(() => new ColorPickerHandler());
p.Add<FontPicker.IHandler>(() => new ThemedFontPickerHandler());
p.Add<DateTimePicker.IHandler>(() => new DateTimePickerHandler());
p.Add<Drawable.IHandler>(() => new DrawableHandler());
p.Add<Expander.IHandler>(() => new ThemedExpanderHandler());
p.Add<GridColumn.IHandler>(() => new GridColumnHandler());
p.Add<GridView.IHandler>(() => new GridViewHandler());
p.Add<GroupBox.IHandler>(() => new GroupBoxHandler());
p.Add<ImageView.IHandler>(() => new ImageViewHandler());
p.Add<Label.IHandler>(() => new LabelHandler());
p.Add<LinkButton.IHandler>(() => new LinkButtonHandler());
p.Add<ListBox.IHandler>(() => new ListBoxHandler());
p.Add<NumericStepper.IHandler>(() => new NumericStepperHandler());
p.Add<Panel.IHandler>(() => new PanelHandler());
p.Add<PasswordBox.IHandler>(() => new PasswordBoxHandler());
p.Add<ProgressBar.IHandler>(() => new ProgressBarHandler());
p.Add<RadioButton.IHandler>(() => new RadioButtonHandler());
p.Add<Scrollable.IHandler>(() => new ScrollableHandler());
p.Add<SearchBox.IHandler>(() => new SearchBoxHandler());
p.Add<Slider.IHandler>(() => new SliderHandler());
p.Add<Spinner.IHandler>(() => new ThemedSpinnerHandler());
p.Add<Splitter.IHandler>(() => new SplitterHandler());
p.Add<TabControl.IHandler>(() => new TabControlHandler());
p.Add<TabPage.IHandler>(() => new TabPageHandler());
p.Add<TextArea.IHandler>(() => new TextAreaHandler());
p.Add<TextBox.IHandler>(() => new TextBoxHandler());
p.Add<TreeGridView.IHandler>(() => new TreeGridViewHandler());
#pragma warning disable CS0618 // Type or member is obsolete
p.Add<TreeView.IHandler>(() => new TreeViewHandler());
#pragma warning restore CS0618 // Type or member is obsolete
p.Add<RichTextArea.IHandler>(() => new RichTextAreaHandler());
p.Add<Stepper.IHandler>(() => new ThemedStepperHandler());
p.Add<TextStepper.IHandler>(() => new TextStepperHandler());
p.Add<FilePicker.IHandler>(() => new ThemedFilePickerHandler());
p.Add<DocumentControl.IHandler>(() => new ThemedDocumentControlHandler());
p.Add<DocumentPage.IHandler>(() => new ThemedDocumentPageHandler());
p.Add<SegmentedButton.IHandler>(() => new ThemedSegmentedButtonHandler());
p.Add<ButtonSegmentedItem.IHandler>(() => new ThemedButtonSegmentedItemHandler());
p.Add<MenuSegmentedItem.IHandler>(() => new ThemedMenuSegmentedItemHandler());
p.Add<ToggleButton.IHandler>(() => new ToggleButtonHandler());
p.Add<PropertyGrid.IHandler>(() => new ThemedPropertyGridHandler());
p.Add<CollectionEditor.IHandler>(() => new ThemedCollectionEditorHandler());
// Forms.Menu
p.Add<CheckMenuItem.IHandler>(() => new CheckMenuItemHandler());
p.Add<ContextMenu.IHandler>(() => new ContextMenuHandler());
p.Add<ButtonMenuItem.IHandler>(() => new ButtonMenuItemHandler());
p.Add<MenuBar.IHandler>(() => new MenuBarHandler());
p.Add<RadioMenuItem.IHandler>(() => new RadioMenuItemHandler());
p.Add<SeparatorMenuItem.IHandler>(() => new SeparatorMenuItemHandler());
p.Add<SubMenuItem.IHandler>(() => new SubMenuItemHandler());
// Forms.Printing
p.Add<PrintDialog.IHandler>(() => new PrintDialogHandler());
p.Add<PrintPreviewDialog.IHandler>(() => new PrintPreviewDialogHandler());
p.Add<PrintDocument.IHandler>(() => new PrintDocumentHandler());
p.Add<PrintSettings.IHandler>(() => new PrintSettingsHandler());
// Forms.ToolBar
p.Add<CheckToolItem.IHandler>(() => new CheckToolItemHandler());
p.Add<RadioToolItem.IHandler>(() => new RadioToolItemHandler());
p.Add<SeparatorToolItem.IHandler>(() => new SeparatorToolBarItemHandler());
p.Add<ButtonToolItem.IHandler>(() => new ButtonToolItemHandler());
p.Add<ToolBar.IHandler>(() => new ToolBarHandler());
// Forms
p.Add<AboutDialog.IHandler>(() => new ThemedAboutDialogHandler());
p.Add<Application.IHandler>(() => new ApplicationHandler());
p.Add<Clipboard.IHandler>(() => new ClipboardHandler());
p.Add<ColorDialog.IHandler>(() => new ColorDialogHandler());
p.Add<Cursor.IHandler>(() => new CursorHandler());
p.Add<Dialog.IHandler>(() => new DialogHandler());
p.Add<FontDialog.IHandler>(() => new FontDialogHandler());
p.Add<Form.IHandler>(() => new FormHandler());
p.Add<FloatingForm.IHandler>(() => new FloatingFormHandler());
p.Add<MessageBox.IHandler>(() => new MessageBoxHandler());
p.Add<OpenFileDialog.IHandler>(() => new OpenFileDialogHandler());
p.Add<OpenWithDialog.IHandler>(() => new OpenWithDialogHandler());
p.Add<PixelLayout.IHandler>(() => new PixelLayoutHandler());
p.Add<SaveFileDialog.IHandler>(() => new SaveFileDialogHandler());
if (Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialog.IsPlatformSupported)
p.Add<SelectFolderDialog.IHandler>(() => new VistaSelectFolderDialogHandler());
else
p.Add<SelectFolderDialog.IHandler>(() => new SelectFolderDialogHandler());
p.Add<TableLayout.IHandler>(() => new TableLayoutHandler());
p.Add<UITimer.IHandler>(() => new UITimerHandler());
p.Add<Mouse.IHandler>(() => new MouseHandler());
p.Add<Screen.IScreensHandler>(() => new ScreensHandler());
p.Add<Keyboard.IHandler>(() => new KeyboardHandler());
p.Add<FixedMaskedTextProvider.IHandler>(() => new FixedMaskedTextProviderHandler());
p.Add<TrayIndicator.IHandler>(() => new TrayIndicatorHandler());
p.Add<Notification.IHandler>(() => new NotificationHandler());
p.Add<DataObject.IHandler>(() => new DataObjectHandler());
p.Add<DataFormats.IHandler>(() => new DataFormatsHandler());
p.Add<Taskbar.IHandler>(() => new TaskbarHandler());
// IO
p.Add<SystemIcons.IHandler>(() => new SystemIconsHandler());
// General
p.Add<EtoEnvironment.IHandler>(() => new EtoEnvironmentHandler());
}
/// <summary>
/// Uses the WinForms WebBrowser control for Eto's WebView
/// </summary>
public void UseSwfWebView()
{
Add<WebView.IHandler>(() => new WebViewHandler());
}
/// <summary>
/// Uses the Microsoft.Web.WebView2 control for Eto's WebView (default if included with your app)
/// </summary>
public void UseWebView2()
{
Add<WebView.IHandler>(Create_WebView2);
}
private WebView.IHandler Create_WebView2()
{
try
{
return WebView2Loader.Create();
}
catch
{
Debug.WriteLine("Warning: Could not create WebView2 handler. Add Microsoft.Web.WebView2 nuget package to your project to take advantage of the latest web control.");
// switch to SWF version for subsequent controls
UseSwfWebView();
return new WebViewHandler();
}
}
}
}
| 44.578704 | 169 | 0.692491 | [
"BSD-3-Clause"
] | AkiSakurai/Eto | src/Eto.WinForms/Platform.cs | 9,629 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestructionEndLevel : MonoBehaviour
{
[SerializeField] int nbWallToDestroy = 4;
[SerializeField] TextMesh textMesh;
int currentWallDestroy = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void IsBroken()
{
currentWallDestroy++;
if (currentWallDestroy >= nbWallToDestroy)
{
textMesh.text = "Amazing";
GameManager.Instance.LevelFinished();
}
}
}
| 19.235294 | 52 | 0.611621 | [
"MIT"
] | SynysterRev/BeSiege-project | BeSiegeLike/Assets/Scripts/EndLevel/DestructionEndLevel.cs | 656 | C# |
using System;
using System.Runtime.InteropServices;
namespace SharpVk
{
internal partial struct CommandCacheStruct
{
private static T GetDelegate<T>(IntPtr functionPointer)
where T : Delegate
{
if (functionPointer == IntPtr.Zero)
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer<T>(functionPointer);
}
}
}
}
| 21.909091 | 81 | 0.537344 | [
"MIT"
] | FacticiusVir/SharpVk | src/SharpVk/CommandCacheStruct.cs | 484 | C# |
using System.Windows.Forms;
using LogJoint.UI.Presenters.FormatsWizard.FormatDeleteConfirmPage;
namespace LogJoint.UI
{
public partial class FormatDeleteConfirmPage : UserControl, IView
{
public FormatDeleteConfirmPage()
{
InitializeComponent();
}
void IView.SetEventsHandler(IViewEvents eventsHandler)
{
}
void IView.Update(string messageLabelText, string descriptionTextBoxValue, string fileNameTextBoxValue, string dateTextBoxValue)
{
messageLabel.Text = messageLabelText;
descriptionTextBox.Text = descriptionTextBoxValue;
fileNameTextBox.Text = fileNameTextBoxValue;
dateTextBox.Text = dateTextBoxValue;
}
}
}
| 26.115385 | 131 | 0.762887 | [
"MIT"
] | logjointfork/logjoint | trunk/platforms/windows/logjoint.winforms/ui/FormatsWizard/FormatDeleteConfirmPage.cs | 679 | C# |
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Onion.Domain.Entities;
using Onion.Identity.Models;
namespace Onion.Identity.Contexts
{
/// <summary>
/// Application identity database context.
/// </summary>
public class IdentityDbContext : IdentityDbContext<ApplicationUser, ApplicationRole, string>
{
/// <summary>
/// Initializes a new instance of the <see cref="IdentityDbContext"/> class.
/// </summary>
/// <param name="options">The options to be used by a <see cref="DbContext"/>.</param>
public IdentityDbContext(DbContextOptions<IdentityDbContext> options)
: base(options)
{
}
/// <summary>
/// Gets or sets user refresh tokens table.
/// </summary>
public DbSet<RefreshToken> RefreshToken { get; set; } = null!;
/// <inheritdoc />
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.HasDefaultSchema("identity");
builder.Entity<ApplicationUser>(entity => { entity.ToTable(name: "User"); });
builder.Entity<ApplicationUser>().Property(u => u.Id).ValueGeneratedOnAdd();
builder.Entity<ApplicationRole>(entity => { entity.ToTable(name: "Role"); });
builder.Entity<IdentityUserRole<string>>(entity => { entity.ToTable("UserRoles"); });
builder.Entity<IdentityUserClaim<string>>(entity => { entity.ToTable("UserClaims"); });
builder.Entity<IdentityUserLogin<string>>(entity => { entity.ToTable("UserLogins"); });
builder.Entity<IdentityRoleClaim<string>>(entity => { entity.ToTable("RoleClaims"); });
builder.Entity<IdentityUserToken<string>>(entity => { entity.ToTable("UserTokens"); });
}
}
} | 38.52 | 99 | 0.639148 | [
"MIT"
] | tahq69/Onion | Onion.Identity/Contexts/IdentityDbContext.cs | 1,928 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using TDocumentGeneration.Models;
using Xunit;
namespace TDocumentGeneration.Test
{
public class GeneratorTest : IDisposable
{
private readonly Generator _generator;
private readonly string _resources;
public GeneratorTest()
{
_generator = new Generator();
_resources = @$"{AppDomain.CurrentDomain.SetupInformation.ApplicationBase}\Resources\";
}
[Fact]
public void ShouldCreateEmptyPdf()
{
// Given
var data = new Data(new FileData(Path.Combine(_resources, "template.docx"), "test.pdf", _resources));
// When
_generator.Generate(data);
// Then
Assert.True(File.Exists(Path.Combine(_resources, "test.pdf")));
}
[Fact]
public void ExampleWith_Placeholders_BarCodes_Tables()
{
// Template and document information
var templateLocation = Path.Combine(_resources, "example-template.docx");
const string nameOfThePdfToBe = "example.pdf";
var locationOfThePdfToBe = _resources;
var fileData = new FileData(templateLocation, nameOfThePdfToBe, locationOfThePdfToBe);
// Simple values to replace placeholders with
var simplePlaceholdersToReplace = new List<PlaceholderData>
{
new PlaceholderData("FirstNamePlaceholder", "Nusreta"),
new PlaceholderData("LastNamePlaceholder", "Sinanovic")
};
// Bar codes
var barCodesToDraw = new List<BarCodeData>
{
new BarCodeData("BarCodeBookmark1", "Nusreta"),
new BarCodeData("BarCodeBookmark2", "Sinanovic")
};
// Tables
var cell11Style = new CellStyleData("PaleGreen");
var cellsInTheRow0 = new List<CellData>
{
new CellData(0, "ROW-0 COL-0"), new CellData(1, "ROW-0 COL-1"), new CellData(2, "ROW-0 COL-2")
};
var cellsInTheRow1 = new List<CellData>
{
new CellData(0, "ROW-1 COL-0"), new CellData(1, "ROW-1 COL-1", cell11Style), new CellData(2, "ROW-1 COL-2")
};
var tableRows = new List<RowData>
{
new RowData(0, cellsInTheRow0),
new RowData(1, cellsInTheRow1),
};
var tables = new List<TableData>
{
new TableData("TableBookmark", tableRows)
};
// Data to send to pdf generator
var dataToSendToPdfGenerator = new Data(
fileData,
simplePlaceholdersToReplace,
barCodesToDraw,
tables);
// Call generator to create the document filled out with data
_generator.Generate(dataToSendToPdfGenerator);
}
public void Dispose() => File.Delete(Path.Combine(_resources, "test.pdf"));
}
}
| 32.505263 | 123 | 0.56671 | [
"Apache-2.0"
] | nusreta/TDocumentGeneration | TDocumentGeneration.Test/GeneratorTest.cs | 3,088 | C# |
using DLC.Multiagent;
using DLC.Scientific.Acquisition.Core.Agents;
using DLC.Scientific.Acquisition.Core.UI;
using System;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DLC.Scientific.Acquisition.Agents.ShutdownAgent.UI
{
public partial class ShutdownUI
: AcquisitionStickyForm
{
public ShutdownUI()
: base()
{
InitializeComponent();
}
private new IShutdownAgent ParentAgent { get { return (IShutdownAgent) base.ParentAgent; } }
private async void btnReboot_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "Are you sure you want to restart all connected machines?", "Restart Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
await Task.WhenAll(AgentBroker.Instance.TryExecuteOnAll<IShutdownAgent>(
a =>
{
if (a.Id != this.ParentAgent.Id)
a.RebootMachine();
}).ThrowOnError())
.ContinueWith(t => this.ParentAgent.RebootMachine(), TaskContinuationOptions.OnlyOnRanToCompletion);
}
}
private async void btnShutdown_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "Are you sure you want to shutdown all connected machines?", "Shutdown Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
await Task.WhenAll(AgentBroker.Instance.TryExecuteOnAll<IShutdownAgent>(
a =>
{
if (a.Id != this.ParentAgent.Id)
a.ShutdownMachine();
}).ThrowOnError())
.ContinueWith(t => this.ParentAgent.ShutdownMachine(), TaskContinuationOptions.OnlyOnRanToCompletion);
}
}
}
} | 32.612245 | 185 | 0.728411 | [
"MIT"
] | slorion/multiagent-system-example | DLC.Scientific/DLC.Scientific.Acquisition/Agents/ShutdownAgent/UI/ShutdownUI.cs | 1,598 | C# |
using System;
using Advanced.Algorithms.DataStructures;
namespace Advanced.Algorithms.Tests.DataStructures
{
internal static class BTreeTester
{
/// <summary>
/// find max height by recursively visiting children
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
internal static int GetMaxHeight<T>(BNode<T> node) where T : IComparable
{
var max = 0;
for (int i = 0; i <= node.KeyCount; i++)
{
if (node.GetChildren()[i] != null)
{
max = Math.Max(GetMaxHeight(node.GetChildren()[i]) + 1, max);
}
}
return max;
}
/// <summary>
/// find max height by recursively visiting children
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
internal static int GetMinHeight<T>(BNode<T> node) where T : IComparable
{
var min = int.MaxValue;
if(node.GetChildren()[0]==null)
{
min = 0;
}
for (int i = 0; i <= node.KeyCount; i++)
{
if (node.GetChildren()[i] != null)
{
min = Math.Min(GetMinHeight(node.GetChildren()[i]) + 1, min);
}
}
return min;
}
}
}
| 26.072727 | 81 | 0.456067 | [
"MIT"
] | rocksdanister/Advanced-Algorithms | tests/Advanced.Algorithms.Tests/DataStructures/Tree/TestHelpers/BTreeTester.cs | 1,436 | 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 workdocs-2016-05-01.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.WorkDocs.Model
{
/// <summary>
/// Describes the users or user groups.
/// </summary>
public partial class Participants
{
private List<GroupMetadata> _groups = new List<GroupMetadata>();
private List<UserMetadata> _users = new List<UserMetadata>();
/// <summary>
/// Gets and sets the property Groups.
/// <para>
/// The list of user groups.
/// </para>
/// </summary>
public List<GroupMetadata> Groups
{
get { return this._groups; }
set { this._groups = value; }
}
// Check to see if Groups property is set
internal bool IsSetGroups()
{
return this._groups != null && this._groups.Count > 0;
}
/// <summary>
/// Gets and sets the property Users.
/// <para>
/// The list of users.
/// </para>
/// </summary>
public List<UserMetadata> Users
{
get { return this._users; }
set { this._users = value; }
}
// Check to see if Users property is set
internal bool IsSetUsers()
{
return this._users != null && this._users.Count > 0;
}
}
} | 28.381579 | 106 | 0.603153 | [
"Apache-2.0"
] | ChristopherButtars/aws-sdk-net | sdk/src/Services/WorkDocs/Generated/Model/Participants.cs | 2,157 | C# |
using Output.Providers;
using Output.UnitTests.Models.Recursion;
using Xunit;
namespace Output.UnitTests
{
public class CircularReferenceTest : TestBase<MappingProvider>
{
[Fact]
public void CircularPropertyTest()
{
// Arrange
var user = new User();
// Act
var dto = Mapper.Map<UserDto>(user);
// Assert
Assert.Equal(user.Email, dto.Email);
Assert.Equal(user.Password, dto.Password);
Assert.Equal(user.Person.Id, dto.Person.Id);
Assert.Equal(user.Person.Name, dto.Person.Name);
Assert.Equal(dto.Person, dto.Person.User.Person);
}
[Fact]
public void CircularPropertyInCollectionTest()
{
// Arrange
var model = new Pattern();
// Act
var dto = Mapper.Map<PatternDto>(model);
// Assert
Assert.Equal(model.Colors.Count, dto.Colors.Count);
Assert.Equal(dto, dto.Colors[0].Patterns[0]);
}
}
} | 26.8 | 66 | 0.551306 | [
"MIT"
] | alexandretperez/Output | source/Output.UnitTests/CircularReferenceTest.cs | 1,074 | 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.Collections.Generic;
using System.Linq;
using Xunit;
namespace Microsoft.Net.Http.Headers
{
public class StringWithQualityHeaderValueTest
{
[Fact]
public void Ctor_StringOnlyOverload_MatchExpectation()
{
var value = new StringWithQualityHeaderValue("token");
Assert.Equal("token", value.Value);
Assert.Null(value.Quality);
Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue(null));
Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue(""));
Assert.Throws<FormatException>(() => new StringWithQualityHeaderValue("in valid"));
}
[Fact]
public void Ctor_StringWithQualityOverload_MatchExpectation()
{
var value = new StringWithQualityHeaderValue("token", 0.5);
Assert.Equal("token", value.Value);
Assert.Equal(0.5, value.Quality);
Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue(null, 0.1));
Assert.Throws<ArgumentException>(() => new StringWithQualityHeaderValue("", 0.1));
Assert.Throws<FormatException>(() => new StringWithQualityHeaderValue("in valid", 0.1));
Assert.Throws<ArgumentOutOfRangeException>(() => new StringWithQualityHeaderValue("t", 1.1));
Assert.Throws<ArgumentOutOfRangeException>(() => new StringWithQualityHeaderValue("t", -0.1));
}
[Fact]
public void ToString_UseDifferentValues_AllSerializedCorrectly()
{
var value = new StringWithQualityHeaderValue("token");
Assert.Equal("token", value.ToString());
value = new StringWithQualityHeaderValue("token", 0.1);
Assert.Equal("token; q=0.1", value.ToString());
value = new StringWithQualityHeaderValue("token", 0);
Assert.Equal("token; q=0.0", value.ToString());
value = new StringWithQualityHeaderValue("token", 1);
Assert.Equal("token; q=1.0", value.ToString());
// Note that the quality value gets rounded
value = new StringWithQualityHeaderValue("token", 0.56789);
Assert.Equal("token; q=0.568", value.ToString());
}
[Fact]
public void GetHashCode_UseSameAndDifferentValues_SameOrDifferentHashCodes()
{
var value1 = new StringWithQualityHeaderValue("t", 0.123);
var value2 = new StringWithQualityHeaderValue("t", 0.123);
var value3 = new StringWithQualityHeaderValue("T", 0.123);
var value4 = new StringWithQualityHeaderValue("t");
var value5 = new StringWithQualityHeaderValue("x", 0.123);
var value6 = new StringWithQualityHeaderValue("t", 0.5);
var value7 = new StringWithQualityHeaderValue("t", 0.1234);
var value8 = new StringWithQualityHeaderValue("T");
var value9 = new StringWithQualityHeaderValue("x");
Assert.Equal(value1.GetHashCode(), value2.GetHashCode());
Assert.Equal(value1.GetHashCode(), value3.GetHashCode());
Assert.NotEqual(value1.GetHashCode(), value4.GetHashCode());
Assert.NotEqual(value1.GetHashCode(), value5.GetHashCode());
Assert.NotEqual(value1.GetHashCode(), value6.GetHashCode());
Assert.NotEqual(value1.GetHashCode(), value7.GetHashCode());
Assert.Equal(value4.GetHashCode(), value8.GetHashCode());
Assert.NotEqual(value4.GetHashCode(), value9.GetHashCode());
}
[Fact]
public void Equals_UseSameAndDifferentRanges_EqualOrNotEqualNoExceptions()
{
var value1 = new StringWithQualityHeaderValue("t", 0.123);
var value2 = new StringWithQualityHeaderValue("t", 0.123);
var value3 = new StringWithQualityHeaderValue("T", 0.123);
var value4 = new StringWithQualityHeaderValue("t");
var value5 = new StringWithQualityHeaderValue("x", 0.123);
var value6 = new StringWithQualityHeaderValue("t", 0.5);
var value7 = new StringWithQualityHeaderValue("t", 0.1234);
var value8 = new StringWithQualityHeaderValue("T");
var value9 = new StringWithQualityHeaderValue("x");
Assert.False(value1.Equals(null), "t; q=0.123 vs. <null>");
Assert.True(value1.Equals(value2), "t; q=0.123 vs. t; q=0.123");
Assert.True(value1.Equals(value3), "t; q=0.123 vs. T; q=0.123");
Assert.False(value1.Equals(value4), "t; q=0.123 vs. t");
Assert.False(value4.Equals(value1), "t vs. t; q=0.123");
Assert.False(value1.Equals(value5), "t; q=0.123 vs. x; q=0.123");
Assert.False(value1.Equals(value6), "t; q=0.123 vs. t; q=0.5");
Assert.False(value1.Equals(value7), "t; q=0.123 vs. t; q=0.1234");
Assert.True(value4.Equals(value8), "t vs. T");
Assert.False(value4.Equals(value9), "t vs. T");
}
[Fact]
public void Parse_SetOfValidValueStrings_ParsedCorrectly()
{
CheckValidParse("text", new StringWithQualityHeaderValue("text"));
CheckValidParse("text;q=0.5", new StringWithQualityHeaderValue("text", 0.5));
CheckValidParse("text ; q = 0.5", new StringWithQualityHeaderValue("text", 0.5));
CheckValidParse("\r\n text ; q = 0.5 ", new StringWithQualityHeaderValue("text", 0.5));
CheckValidParse(" text ", new StringWithQualityHeaderValue("text"));
CheckValidParse(" \r\n text \r\n ; \r\n q = 0.123", new StringWithQualityHeaderValue("text", 0.123));
CheckValidParse(" text ; q = 0.123 ", new StringWithQualityHeaderValue("text", 0.123));
CheckValidParse("text;q=1 ", new StringWithQualityHeaderValue("text", 1));
CheckValidParse("*", new StringWithQualityHeaderValue("*"));
CheckValidParse("*;q=0.7", new StringWithQualityHeaderValue("*", 0.7));
CheckValidParse(" t", new StringWithQualityHeaderValue("t"));
CheckValidParse("t;q=0.", new StringWithQualityHeaderValue("t", 0));
CheckValidParse("t;q=1.", new StringWithQualityHeaderValue("t", 1));
CheckValidParse("t;q=1.000", new StringWithQualityHeaderValue("t", 1));
CheckValidParse("t;q=0.12345678", new StringWithQualityHeaderValue("t", 0.12345678));
CheckValidParse("t ; q = 0", new StringWithQualityHeaderValue("t", 0));
CheckValidParse("iso-8859-5", new StringWithQualityHeaderValue("iso-8859-5"));
CheckValidParse("unicode-1-1; q=0.8", new StringWithQualityHeaderValue("unicode-1-1", 0.8));
}
[Theory]
[InlineData("text,")]
[InlineData("\r\n text ; q = 0.5, next_text ")]
[InlineData(" text,next_text ")]
[InlineData(" ,, text, , ,next")]
[InlineData(" ,, text, , ,")]
[InlineData(", \r\n text \r\n ; \r\n q = 0.123")]
[InlineData("teäxt")]
[InlineData("text会")]
[InlineData("会")]
[InlineData("t;q=会")]
[InlineData("t;q=")]
[InlineData("t;q")]
[InlineData("t;会=1")]
[InlineData("t;q会=1")]
[InlineData("t y")]
[InlineData("t;q=1 y")]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
[InlineData(" ,,")]
[InlineData("t;q=-1")]
[InlineData("t;q=1.00001")]
[InlineData("t;")]
[InlineData("t;;q=1")]
[InlineData("t;q=a")]
[InlineData("t;qa")]
[InlineData("t;q1")]
[InlineData("integer_part_too_long;q=01")]
[InlineData("integer_part_too_long;q=01.0")]
[InlineData("decimal_part_too_long;q=0.123456789")]
[InlineData("decimal_part_too_long;q=0.123456789 ")]
[InlineData("no_integer_part;q=.1")]
public void Parse_SetOfInvalidValueStrings_Throws(string input)
{
Assert.Throws<FormatException>(() => StringWithQualityHeaderValue.Parse(input));
}
[Fact]
public void TryParse_SetOfValidValueStrings_ParsedCorrectly()
{
CheckValidTryParse("text", new StringWithQualityHeaderValue("text"));
CheckValidTryParse("text;q=0.5", new StringWithQualityHeaderValue("text", 0.5));
CheckValidTryParse("text ; q = 0.5", new StringWithQualityHeaderValue("text", 0.5));
CheckValidTryParse("\r\n text ; q = 0.5 ", new StringWithQualityHeaderValue("text", 0.5));
CheckValidTryParse(" text ", new StringWithQualityHeaderValue("text"));
CheckValidTryParse(" \r\n text \r\n ; \r\n q = 0.123", new StringWithQualityHeaderValue("text", 0.123));
}
[Fact]
public void TryParse_SetOfInvalidValueStrings_ReturnsFalse()
{
CheckInvalidTryParse("text,");
CheckInvalidTryParse("\r\n text ; q = 0.5, next_text ");
CheckInvalidTryParse(" text,next_text ");
CheckInvalidTryParse(" ,, text, , ,next");
CheckInvalidTryParse(" ,, text, , ,");
CheckInvalidTryParse(", \r\n text \r\n ; \r\n q = 0.123");
CheckInvalidTryParse("teäxt");
CheckInvalidTryParse("text会");
CheckInvalidTryParse("会");
CheckInvalidTryParse("t;q=会");
CheckInvalidTryParse("t;q=");
CheckInvalidTryParse("t;q");
CheckInvalidTryParse("t;会=1");
CheckInvalidTryParse("t;q会=1");
CheckInvalidTryParse("t y");
CheckInvalidTryParse("t;q=1 y");
CheckInvalidTryParse(null);
CheckInvalidTryParse(string.Empty);
CheckInvalidTryParse(" ");
CheckInvalidTryParse(" ,,");
}
[Fact]
public void ParseList_SetOfValidValueStrings_ParsedCorrectly()
{
var inputs = new[]
{
"",
"text1",
"text2,",
"textA,textB",
"text3;q=0.5",
"text4;q=0.5,",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results = StringWithQualityHeaderValue.ParseList(inputs);
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("textA"),
new StringWithQualityHeaderValue("textB"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void ParseStrictList_SetOfValidValueStrings_ParsedCorrectly()
{
var inputs = new[]
{
"",
"text1",
"text2,",
"textA,textB",
"text3;q=0.5",
"text4;q=0.5,",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results = StringWithQualityHeaderValue.ParseStrictList(inputs);
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("textA"),
new StringWithQualityHeaderValue("textB"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void TryParseList_SetOfValidValueStrings_ParsedCorrectly()
{
var inputs = new[]
{
"",
"text1",
"text2,",
"textA,textB",
"text3;q=0.5",
"text4;q=0.5,",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results;
Assert.True(StringWithQualityHeaderValue.TryParseList(inputs, out results));
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("textA"),
new StringWithQualityHeaderValue("textB"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void TryParseStrictList_SetOfValidValueStrings_ParsedCorrectly()
{
var inputs = new[]
{
"",
"text1",
"text2,",
"textA,textB",
"text3;q=0.5",
"text4;q=0.5,",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results;
Assert.True(StringWithQualityHeaderValue.TryParseStrictList(inputs, out results));
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("textA"),
new StringWithQualityHeaderValue("textB"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void ParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
{
var inputs = new[]
{
"",
"text1",
"text 1",
"text2",
"\"text 2\",",
"text3;q=0.5",
"text4;q=0.5, extra stuff",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
var results = StringWithQualityHeaderValue.ParseList(inputs);
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("stuff"),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void ParseStrictList_WithSomeInvlaidValues_Throws()
{
var inputs = new[]
{
"",
"text1",
"text 1",
"text2",
"\"text 2\",",
"text3;q=0.5",
"text4;q=0.5, extra stuff",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
Assert.Throws<FormatException>(() => StringWithQualityHeaderValue.ParseStrictList(inputs));
}
[Fact]
public void TryParseList_WithSomeInvlaidValues_IgnoresInvalidValues()
{
var inputs = new[]
{
"",
"text1",
"text 1",
"text2",
"\"text 2\",",
"text3;q=0.5",
"text4;q=0.5, extra stuff",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results;
Assert.True(StringWithQualityHeaderValue.TryParseList(inputs, out results));
var expectedResults = new[]
{
new StringWithQualityHeaderValue("text1"),
new StringWithQualityHeaderValue("1"),
new StringWithQualityHeaderValue("text2"),
new StringWithQualityHeaderValue("text3", 0.5),
new StringWithQualityHeaderValue("text4", 0.5),
new StringWithQualityHeaderValue("stuff"),
new StringWithQualityHeaderValue("text5", 0.5),
new StringWithQualityHeaderValue("text6", 0.05),
new StringWithQualityHeaderValue("text7"),
new StringWithQualityHeaderValue("text8", 0.5),
new StringWithQualityHeaderValue("text9"),
new StringWithQualityHeaderValue("text10", 0.5),
}.ToList();
Assert.Equal(expectedResults, results);
}
[Fact]
public void TryParseStrictList_WithSomeInvlaidValues_ReturnsFalse()
{
var inputs = new[]
{
"",
"text1",
"text 1",
"text2",
"\"text 2\",",
"text3;q=0.5",
"text4;q=0.5, extra stuff",
" text5 ; q = 0.50 ",
"\r\n text6 ; q = 0.05 ",
"text7,text8;q=0.5",
" text9 , text10 ; q = 0.5 ",
};
IList<StringWithQualityHeaderValue> results;
Assert.False(StringWithQualityHeaderValue.TryParseStrictList(inputs, out results));
}
#region Helper methods
private void CheckValidParse(string input, StringWithQualityHeaderValue expectedResult)
{
var result = StringWithQualityHeaderValue.Parse(input);
Assert.Equal(expectedResult, result);
}
private void CheckValidTryParse(string input, StringWithQualityHeaderValue expectedResult)
{
StringWithQualityHeaderValue result = null;
Assert.True(StringWithQualityHeaderValue.TryParse(input, out result));
Assert.Equal(expectedResult, result);
}
private void CheckInvalidTryParse(string input)
{
StringWithQualityHeaderValue result = null;
Assert.False(StringWithQualityHeaderValue.TryParse(input, out result));
Assert.Null(result);
}
#endregion
}
}
| 42.54509 | 116 | 0.551578 | [
"Apache-2.0"
] | benaadams/HttpAbstractions | test/Microsoft.Net.Http.Headers.Tests/StringWithQualityHeaderValueTest.cs | 21,252 | C# |
using System;
using System.IO;
namespace Org.BouncyCastle.Bcpg
{
public abstract class OutputStreamPacket
{
private readonly BcpgOutputStream bcpgOut;
internal OutputStreamPacket(
BcpgOutputStream bcpgOut)
{
if (bcpgOut == null)
throw new ArgumentNullException("bcpgOut");
this.bcpgOut = bcpgOut;
}
public abstract BcpgOutputStream Open();
public abstract void Close();
}
}
| 18.72 | 51 | 0.641026 | [
"BSD-3-Clause"
] | GaloisInc/hacrypto | src/C#/BouncyCastle/BouncyCastle-1.7/crypto/src/bcpg/OutputStreamPacket.cs | 468 | C# |
/*
* LambdaSharp (λ#)
* Copyright (C) 2018-2021
* lambdasharp.net
*
* 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;
namespace LambdaSharp.Exceptions {
/// <summary>
/// The <see cref="LambdaConfigBadValueException"/> exception is thrown when a configuration value fails to validate.
/// </summary>
public class LambdaConfigBadValueException : ALambdaConfigException {
//--- Constructors ---
/// <summary>
/// Initializes a <see cref="LambdaConfigBadValueException"/> instance with the specified exception message and configuration key path.
/// </summary>
/// <param name="innerException">The inner exception instance.</param>
/// <param name="path">The configuration key path.</param>
public LambdaConfigBadValueException(Exception innerException, string path) : base(innerException, "error while validating config key value: '{0}'", path) { }
}
}
| 38.394737 | 166 | 0.703907 | [
"Apache-2.0"
] | LambdaSharp/LambdaSharpTool | src/LambdaSharp/Exceptions/LambdaConfigBadValueException.cs | 1,460 | C# |
using System;
using Aop.Api.Domain;
using System.Collections.Generic;
using Aop.Api.Response;
namespace Aop.Api.Request
{
/// <summary>
/// AOP API: alipay.pcredit.huabei.auth.agreement.close
/// </summary>
public class AlipayPcreditHuabeiAuthAgreementCloseRequest : IAopRequest<AlipayPcreditHuabeiAuthAgreementCloseResponse>
{
/// <summary>
/// 花呗先享会员协议关闭接口
/// </summary>
public string BizContent { get; set; }
#region IAopRequest Members
private bool needEncrypt=false;
private string apiVersion = "1.0";
private string terminalType;
private string terminalInfo;
private string prodCode;
private string notifyUrl;
private string returnUrl;
private AopObject bizModel;
public void SetNeedEncrypt(bool needEncrypt){
this.needEncrypt=needEncrypt;
}
public bool GetNeedEncrypt(){
return this.needEncrypt;
}
public void SetNotifyUrl(string notifyUrl){
this.notifyUrl = notifyUrl;
}
public string GetNotifyUrl(){
return this.notifyUrl;
}
public void SetReturnUrl(string returnUrl){
this.returnUrl = returnUrl;
}
public string GetReturnUrl(){
return this.returnUrl;
}
public void SetTerminalType(String terminalType){
this.terminalType=terminalType;
}
public string GetTerminalType(){
return this.terminalType;
}
public void SetTerminalInfo(String terminalInfo){
this.terminalInfo=terminalInfo;
}
public string GetTerminalInfo(){
return this.terminalInfo;
}
public void SetProdCode(String prodCode){
this.prodCode=prodCode;
}
public string GetProdCode(){
return this.prodCode;
}
public string GetApiName()
{
return "alipay.pcredit.huabei.auth.agreement.close";
}
public void SetApiVersion(string apiVersion){
this.apiVersion=apiVersion;
}
public string GetApiVersion(){
return this.apiVersion;
}
public IDictionary<string, string> GetParameters()
{
AopDictionary parameters = new AopDictionary();
parameters.Add("biz_content", this.BizContent);
return parameters;
}
public AopObject GetBizModel()
{
return this.bizModel;
}
public void SetBizModel(AopObject bizModel)
{
this.bizModel = bizModel;
}
#endregion
}
}
| 23.9 | 122 | 0.610118 | [
"Apache-2.0"
] | Varorbc/alipay-sdk-net-all | AlipaySDKNet/Request/AlipayPcreditHuabeiAuthAgreementCloseRequest.cs | 2,653 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Denis Kuzmin <x-3F@outlook.com> github/3F
// Copyright (c) IeXod contributors https://github.com/3F/IeXod/graphs/contributors
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using net.r_eg.IeXod.Framework;
using net.r_eg.IeXod.Shared;
namespace net.r_eg.IeXod.Tasks
{
/// <summary>
/// Finds the app.config file, if any, in the provided lists.
/// For compat reasons, it has to follow a particular arbitrary algorithm.
/// It also adds the TargetPath metadata.
/// </summary>
public class FindAppConfigFile : TaskExtension
{
// The list to search through
private ITaskItem[] _primaryList;
private ITaskItem[] _secondaryList;
// The target path metadata value to add to the found item
// The item found, if any
// What we're looking for
private const string appConfigFile = "app.config";
/// <summary>
/// The primary list to search through
/// </summary>
[Required]
public ITaskItem[] PrimaryList
{
get
{
ErrorUtilities.VerifyThrowArgumentNull(_primaryList, nameof(PrimaryList));
return _primaryList;
}
set => _primaryList = value;
}
/// <summary>
/// The secondary list to search through
/// </summary>
[Required]
public ITaskItem[] SecondaryList
{
get
{
ErrorUtilities.VerifyThrowArgumentNull(_secondaryList, nameof(SecondaryList));
return _secondaryList;
}
set => _secondaryList = value;
}
/// <summary>
/// The value to add as TargetPath metadata
/// </summary>
[Required]
public string TargetPath { get; set; }
/// <summary>
/// The first matching item found in the list, if any
/// </summary>
[Output]
public ITaskItem AppConfigFile { get; set; }
/// <summary>
/// Find the app config
/// </summary>
public override bool Execute()
{
// Look at the whole item spec first -- ie,
// we want to prefer app.config files that are directly in the project folder.
if (ConsultLists(true))
{
return true;
}
// If that fails, fall back to app.config files anywhere in the project cone.
if (ConsultLists(false))
{
return true;
}
// Not found
return true;
}
private bool ConsultLists(bool matchWholeItemSpec)
{
// Look at primary list first, then secondary list
// We walk backwards on the list to find the last match (for historical reasons)
for (int i = PrimaryList.Length - 1; i >= 0; i--)
{
if (IsMatchingItem(PrimaryList[i], matchWholeItemSpec))
{
return true;
}
}
for (int i = SecondaryList.Length - 1; i >= 0; i--)
{
if (IsMatchingItem(SecondaryList[i], matchWholeItemSpec))
{
return true;
}
}
return false;
}
/// <summary>
/// Examines the item to see if it matches what we are looking for.
/// If it does, returns true.
/// </summary>
private bool IsMatchingItem(ITaskItem item, bool matchWholeItemSpec)
{
try
{
string filename = (matchWholeItemSpec ? item.ItemSpec : Path.GetFileName(item.ItemSpec));
if (String.Equals(filename, appConfigFile, StringComparison.OrdinalIgnoreCase))
{
AppConfigFile = item;
// Originally the app.config was found in such a way that it's "OriginalItemSpec"
// metadata was cleared out. Although it doesn't really matter, for compatibility,
// we'll clear it out here.
AppConfigFile.SetMetadata("OriginalItemSpec", item.ItemSpec);
AppConfigFile.SetMetadata(ItemMetadataNames.targetPath, TargetPath);
Log.LogMessageFromResources(MessageImportance.Low, "FindInList.Found", AppConfigFile.ItemSpec);
return true;
}
}
catch (ArgumentException ex)
{
// Just log this: presumably this item spec is not intended to be
// a file path
Log.LogMessageFromResources(MessageImportance.Low, "FindInList.InvalidPath", item.ItemSpec, ex.Message);
}
return false;
}
}
}
| 33.033113 | 120 | 0.543504 | [
"MIT"
] | 3F/IeXod | src/Tasks/FindAppConfigFile.cs | 4,990 | C# |
using System;
using System.ComponentModel;
namespace Tizen.NUI.XamlBinding
{
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
[Xaml.ProvideCompiled("Tizen.NUI.XamlC.UriTypeConverter")]
[Xaml.TypeConversion(typeof(Uri))]
public class UriTypeConverter : TypeConverter
{
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public override object ConvertFromInvariantString(string value)
{
if (string.IsNullOrWhiteSpace(value))
return null;
return new Uri(value, UriKind.RelativeOrAbsolute);
}
bool CanConvert(Type type)
{
if (type == typeof(string))
return true;
if (type == typeof(Uri))
return true;
return false;
}
}
}
| 32.03125 | 113 | 0.627317 | [
"Apache-2.0"
] | sungraejo/TizenFX | src/Tizen.NUI.Xaml/src/public/XamlBinding/UriTypeConverter.cs | 1,027 | C# |
using System;
using System.Runtime.Serialization;
namespace Identory.Models.Enum
{
[Serializable]
public enum DefaultDesktopScreenSize
{
[EnumMember(Value = "1024x768")]
Size_1024x768,
[EnumMember(Value = "1280x720")]
Size_1280x720,
[EnumMember(Value = "1280x800")]
Size_1280x800,
[EnumMember(Value = "1280x1024")]
Size_1280x1024,
[EnumMember(Value = "1360x768")]
Size_1360x768,
[EnumMember(Value = "1366x768")]
Size_1366x768,
[EnumMember(Value = "1440x900")]
Size_1440x900,
[EnumMember(Value = "1536x864")]
Size_1536x864,
[EnumMember(Value = "1600x900")]
Size_1600x900,
[EnumMember(Value = "1680x1050")]
Size_1680x1050,
[EnumMember(Value = "1920x1080")]
Size_1920x1080,
[EnumMember(Value = "1920x1200")]
Size_1920x1200,
[EnumMember(Value = "2048x1152")]
Size_2048x1152,
[EnumMember(Value = "2560x1080")]
Size_2560x1080,
[EnumMember(Value = "2560x1440")]
Size_2560x1440,
[EnumMember(Value = "3440x1440")]
Size_3440x1440,
[EnumMember(Value = "3840x2160")]
Size_3840x2160
}
}
| 28.088889 | 41 | 0.589399 | [
"MIT"
] | hakunamarihuana/Identory | Identory/Models/Enum/DefaultDesktopScreenSize.cs | 1,266 | C# |
namespace Reception.App.Constants
{
public static class ConnectionStatus
{
public const string OFFLINE = nameof(OFFLINE);
public const string ONLINE = nameof(ONLINE);
}
} | 24.875 | 54 | 0.678392 | [
"MIT"
] | kirichenec/ReceptionNetCore | src/Reception.App/Constants/ConnectionStatus.cs | 201 | C# |
using System.Diagnostics.CodeAnalysis;
using NUnit.Framework;
using Shouldly;
using TestNinjaOther;
namespace TestNinja.Tests
{
[TestFixture]
[ExcludeFromCodeCoverage]
public class FizzBuzzTests
{
private string _result;
[Test]
public void GetOutput_InputIsDivisibleBy3And5_ReturnFizzBuzz()
{
_result = FizzBuzz.GetOutput(15);
_result.ShouldBe("FizzBuzz");
}
[Test]
public void GetOutput_InputIsDivisibleBy3Only_ReturnFizz()
{
_result = FizzBuzz.GetOutput(3);
_result.ShouldBe("Fizz");
}
[Test]
public void GetOutput_InputIsDivisibleBy5Only_ReturnBuzz()
{
_result = FizzBuzz.GetOutput(5);
_result.ShouldBe("Buzz");
}
[Test]
public void GetOutput_InputIsNotDivisibleBy3Or5_ReturnTheSameNumber()
{
_result = FizzBuzz.GetOutput(1);
_result.ShouldBe("1");
}
}
}
| 24.162791 | 77 | 0.588065 | [
"MIT"
] | mdaniyalkhann/SampleTests | TestNinja.UnitTests/FizzBuzzTests.cs | 1,039 | C# |
using Microsoft.Management.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using SimCim.Core;
namespace SimCim.Root.Virtualization.V2
{
public abstract class EventConsumer : IndicationRelated
{
protected EventConsumer()
{
}
protected EventConsumer(IInfrastructureObjectScope scope, CimInstance instance): base(scope, instance)
{
}
public System.Byte[] CreatorSID
{
get
{
System.Byte[] result;
this.GetProperty("CreatorSID", out result);
return result;
}
}
public System.String MachineName
{
get
{
System.String result;
this.GetProperty("MachineName", out result);
return result;
}
set
{
this.SetProperty("MachineName", value);
}
}
public System.UInt32? MaximumQueueSize
{
get
{
System.UInt32? result;
this.GetProperty("MaximumQueueSize", out result);
return result;
}
set
{
this.SetProperty("MaximumQueueSize", value);
}
}
}
} | 23.983051 | 111 | 0.474205 | [
"Apache-2.0"
] | simonferquel/simcim | SimCim.Root.Virtualization.V2/ClassEventConsumer.cs | 1,417 | C# |
// Copyright 2022 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.
// [START retail_search_product_with_facet_spec]
using Google.Cloud.Retail.V2;
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Search with facet spec sample class.
/// </summary>
public class SearchWithFacetSpecSample
{
/// <summary>Get search request.</summary>
private SearchRequest GetSearchRequest(string query, string facetKeyParam, string projectNumber)
{
string defaultSearchPlacement = $"projects/{projectNumber}/locations/global/catalogs/default_catalog/placements/default_search";
var facetKey = new SearchRequest.Types.FacetSpec.Types.FacetKey
{
Key = facetKeyParam
};
// Put the intervals here:
// Set only if values should be bucketized into intervals. Must be set for facets with numerical values.
var searchRequest = new SearchRequest
{
Placement = defaultSearchPlacement, // Placement is used to identify the Serving Config name
Query = query,
VisitorId = "123456", // A unique identifier to track visitors
PageSize = 10,
FacetSpecs =
{
new SearchRequest.Types.FacetSpec
{
FacetKey = facetKey
}
}
};
Console.WriteLine("Search. request:");
Console.WriteLine($"Placement: {searchRequest.Placement}");
Console.WriteLine($"Query: {searchRequest.Query}");
Console.WriteLine($"VisitorId: {searchRequest.VisitorId}");
Console.WriteLine($"PageSize: {searchRequest.PageSize}");
Console.WriteLine($"FacetSpecs: {searchRequest.FacetSpecs}");
Console.WriteLine();
return searchRequest;
}
/// <summary>
/// Call the retail search.
/// </summary>
/// <param name="projectNumber">Current project number.</param>
/// <returns></returns>
public IEnumerable<SearchResponse> Search(string projectNumber)
{
// Try different facets here:
string facetKey = "colorFamilies";
string query = "Tee";
SearchServiceClient client = SearchServiceClient.Create();
SearchRequest searchRequest = GetSearchRequest(query, facetKey, projectNumber);
IEnumerable<SearchResponse> searchResultPages = client.Search(searchRequest).AsRawResponses();
SearchResponse firstPage = searchResultPages.FirstOrDefault();
if (firstPage is null)
{
Console.WriteLine("The search operation returned no matching results.");
}
else
{
Console.WriteLine("Search results:");
Console.WriteLine($"AttributionToken: {firstPage.AttributionToken},");
Console.WriteLine($"NextPageToken: {firstPage.NextPageToken},");
Console.WriteLine($"Facets: {firstPage.Facets}");
Console.WriteLine($"TotalSize: {firstPage.TotalSize},");
Console.WriteLine("Items found in first page:");
foreach (SearchResponse.Types.SearchResult item in firstPage)
{
Console.WriteLine(item);
}
}
return searchResultPages;
}
}
// [END retail_search_product_with_facet_spec]
/// <summary>
/// Search with facet spec tutorial.
/// </summary>
public static class SearchWithFacetSpecTutorial
{
[Runner.Attributes.Example]
public static IEnumerable<SearchResponse> Search()
{
var projectNumber = Environment.GetEnvironmentVariable("PROJECT_NUMBER");
var sample = new SearchWithFacetSpecSample();
return sample.Search(projectNumber);
}
} | 36.008475 | 136 | 0.657566 | [
"Apache-2.0"
] | Rishabh-V/dotnet-docs-samples | retail/interactive-tutorial/RetailSearch.Samples/SearchWithFacetSpecSample.cs | 4,251 | C# |
#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2022 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
/*----------------------------------------------------------------
Copyright (C) 2022 Senparc
文件名:JsCode2JsonResult.cs
文件功能描述:JsCode2Json接口结果
创建标识:Senparc - 20170827
修改标识:Senparc - 20190524
修改描述:JsCode2Json 返回结果增加 unionid
----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Senparc.Weixin.Entities;
namespace Senparc.Weixin.Open.WxaAPIs.Sns
{
/// <summary>
/// JsCode2Json接口结果
/// </summary>
public class JsCode2JsonResult : WxJsonResult
{
/// <summary>
/// 用户唯一标识
/// </summary>
public string openid { get; set; }
/// <summary>
/// 会话密钥
/// </summary>
public string session_key { get; set; }
/// <summary>
/// 用户在开放平台的唯一标识符,在满足 UnionID 下发条件的情况下会返回
/// </summary>
public string unionid { get; set; }
}
}
| 30.370968 | 90 | 0.590016 | [
"Apache-2.0"
] | AaronWu666/WeiXinMPSDK | src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/Sns/SnsJson/JsCode2JsonResult.cs | 2,041 | C# |
using NUnit.Framework;
using System;
using TechTalk.SpecFlow;
using Verdure.Domain.Entities;
using Verdure.Domain.Interfaces;
namespace Verdure.Domain.Tests.Entities
{
[Binding]
public class FoodItemSteps
{
IFoodItem _foodItem;
string _foodItemName;
long _calories;
[Given(@"I have eaten a food item with calories and name")]
public void GivenIHaveEatenAFoodItemWithCaloriesAndName()
{
_foodItemName = "Hamburger";
_calories = 420;
}
[When(@"I create a food item")]
public void WhenICreateAFoodItem()
{
_foodItem = new FoodItem(_foodItemName, _calories);
}
[Then(@"my food item has the same calories and name")]
public void ThenMyFoodItemHasTheSameCaloriesAndName()
{
Assert.AreEqual(_foodItem.Calories, _calories);
Assert.AreEqual(_foodItem.Name, _foodItemName);
Assert.IsNotNull(_foodItem.Id);
Assert.AreEqual(_foodItem.CreatedDate.Day, DateTime.UtcNow.Day);
Assert.AreEqual(_foodItem.CreatedDate.Month, DateTime.UtcNow.Month);
Assert.AreEqual(_foodItem.CreatedDate.Year, DateTime.UtcNow.Year);
Assert.AreEqual(_foodItem.ModifiedDate.Day, DateTime.UtcNow.Day);
Assert.AreEqual(_foodItem.ModifiedDate.Month, DateTime.UtcNow.Month);
Assert.AreEqual(_foodItem.ModifiedDate.Year, DateTime.UtcNow.Year);
}
[Given(@"I have a food item to be deleted")]
public void GivenIHaveAFoodItemToBeDeleted()
{
_foodItem = new FoodItem("Hotdog", 120);
Assert.IsFalse(_foodItem.Deleted);
}
[When(@"I delete the food item")]
public void WhenIDeleteTheFoodItem()
{
_foodItem.Delete();
}
[Then(@"my food item is deleted")]
public void ThenMyFoodItemIsDeleted()
{
Assert.IsTrue(_foodItem.Deleted);
}
}
}
| 32.238095 | 81 | 0.618907 | [
"BSD-3-Clause"
] | TechPriestJon/VerdureApp | Verdure/Verdure.Domain.Tests/Entities/FoodItemTestsSteps.cs | 2,033 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace MvcExplorer.Models
{
public class CustomerWithOrders : Customer
{
public List<Order> Orders { get; set; }
}
} | 18.909091 | 47 | 0.697115 | [
"MIT"
] | GrapeCity/ComponentOne-ASPNET-MVC-Samples | MvcExplorer/src/MvcExplorer/Models/CustomerWithOrders.cs | 210 | C# |
//this source code was auto-generated by tolua#, do not modify it
using System;
using LuaInterface;
public class LuaInterface_LuaPropertyWrap
{
public static void Register(LuaState L)
{
L.BeginClass(typeof(LuaInterface.LuaProperty), typeof(System.Object));
L.RegFunction("Get", new LuaCSFunction(Get));
L.RegFunction("Set", new LuaCSFunction(Set));
L.RegFunction("__tostring", new LuaCSFunction(ToLua.op_ToString));
L.EndClass();
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int Get(IntPtr L)
{
try
{
LuaProperty obj = (LuaProperty)ToLua.CheckObject<LuaProperty>(L, 1);
return obj.Get(L);
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int Set(IntPtr L)
{
try
{
LuaProperty obj = (LuaProperty)ToLua.CheckObject<LuaProperty>(L, 1);
return obj.Set(L);
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
}
| 24.511111 | 93 | 0.635539 | [
"MIT"
] | NewbieGameCoder/tolua | Assets/ToLua/BaseType/LuaInterface_LuaPropertyWrap.cs | 1,105 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** 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.Aws.WafV2.Outputs
{
[OutputType]
public sealed class WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchSingleHeader
{
/// <summary>
/// The name of the query header to inspect. This setting must be provided as lower case characters.
/// </summary>
public readonly string Name;
[OutputConstructor]
private WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchSingleHeader(string name)
{
Name = name;
}
}
}
| 36.571429 | 189 | 0.753906 | [
"ECL-2.0",
"Apache-2.0"
] | RafalSumislawski/pulumi-aws | sdk/dotnet/WafV2/Outputs/WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchSingleHeader.cs | 1,024 | C# |
namespace TestModule
{
public class TestMisc
{
public static string TestNameof()
{
int variable = 10;
return nameof(variable);
}
public static int TestSizeof()
{
return sizeof(int);
}
}
}
| 15.157895 | 41 | 0.482639 | [
"MIT"
] | SkutteOleg/dotnow-interpreter | UnitTest/dotnow.Tests/TestModule/TestMisc.cs | 290 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace tomenglertde.ResXManager.View.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ResourceFilter {
get {
return ((string)(this["ResourceFilter"]));
}
set {
this["ResourceFilter"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("en=en-US")]
public string NeutralCultureCountyOverrides {
get {
return ((string)(this["NeutralCultureCountyOverrides"]));
}
set {
this["NeutralCultureCountyOverrides"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(".")]
public string VisibleCommentColumns {
get {
return ((string)(this["VisibleCommentColumns"]));
}
set {
this["VisibleCommentColumns"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string HiddenLanguageColumns {
get {
return ((string)(this["HiddenLanguageColumns"]));
}
set {
this["HiddenLanguageColumns"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool IsIndexColumnVisible {
get {
return ((bool)(this["IsIndexColumnVisible"]));
}
set {
this["IsIndexColumnVisible"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool IsCellSelectionEnabled {
get {
return ((bool)(this["IsCellSelectionEnabled"]));
}
set {
this["IsCellSelectionEnabled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool AreAllFilesSelected {
get {
return ((bool)(this["AreAllFilesSelected"]));
}
set {
this["AreAllFilesSelected"] = value;
}
}
}
}
| 39.684685 | 152 | 0.559591 | [
"MIT"
] | stefanlenselink/ResXResourceManager | ResXManager.View/Properties/Settings.Designer.cs | 4,407 | C# |
namespace SimpleFactoryPattern;
public class Operation
{
public double NumberA { get; set; }
public double NumberB { get; set; }
public virtual double GetResult()
{
return 0;
}
}
public class OperationAdd : Operation
{
public override double GetResult()
{
return NumberA + NumberB;
}
}
public class OpertaionSub : Operation
{
public override double GetResult()
{
return NumberA - NumberB;
}
}
public class OperationMul : Operation
{
public override double GetResult()
{
return NumberA * NumberB;
}
}
public class OperationDiv : Operation
{
public override double GetResult()
{
if (NumberB == 0)
{
throw new Exception("除数不能为0");
}
return NumberA / NumberB;
}
}
| 16.55102 | 42 | 0.605425 | [
"MIT"
] | WeihanLi/DesignPatterns | CreatePattern/SimpleFactoryPattern/Operation.cs | 823 | C# |
using System.Threading.Tasks;
namespace AElf.OS.Network.Application
{
public interface IPeerDiscoveryService
{
Task<NodeList> DiscoverNodesAsync();
Task<NodeList> GetNodesAsync(int maxCount);
}
} | 22.4 | 51 | 0.714286 | [
"MIT"
] | tomatopunk/AElf | src/AElf.OS.Core/Network/Application/IPeerDiscoveryService.cs | 224 | C# |
// Copyright (c) 2022 TrakHound Inc., All Rights Reserved.
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using MTConnect.Devices.DataItems.Samples;
namespace MTConnect.Observations.Samples.Values
{
/// <summary>
/// Measured dimension of an entity relative to the Y direction of the referenced coordinate system.
/// </summary>
public class YDimensionValue : SampleValue
{
public YDimensionValue(double nativeValue, string nativeUnits = YDimensionDataItem.DefaultUnits)
{
Value = nativeValue;
_units = YDimensionDataItem.DefaultUnits;
_nativeUnits = nativeUnits;
}
}
}
| 32.130435 | 104 | 0.692828 | [
"Apache-2.0"
] | TrakHound/MTConnect | src/MTConnect.NET-Common/Observations/Samples/Values/YDimensionValue.cs | 739 | C# |
using System;
using System.Linq;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores;
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
namespace BizHawk.Client.Common
{
[ImporterFor("DeSmuME", ".dsm")]
internal class DsmImport : MovieImporter
{
private static readonly ControllerDefinition DeSmuMEControllerDef = new ControllerDefinition("NDS Controller")
{
BoolButtons =
{
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
}
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96) //TODO verify direction against hardware
.AddAxis("Mic Volume", 0.RangeTo(100), 0)
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0)
.MakeImmutable();
protected override void RunImport()
{
Result.Movie.HeaderEntries[HeaderKeys.Platform] = VSystemID.Raw.NDS;
var syncSettings = new NDS.NDSSyncSettings();
using var sr = SourceFile.OpenText();
string line;
while ((line = sr.ReadLine()) != null)
{
if (string.IsNullOrWhiteSpace(line))
{
continue;
}
if (line[0] == '|')
{
ImportInputFrame(line);
}
else if (line.StartsWith("rerecordCount"))
{
Result.Movie.Rerecords = (ulong) (int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount) ? rerecordCount : default);
}
else if (line.StartsWith("firmNickname"))
{
syncSettings.FirmwareUsername = ParseHeader(line, "firmNickname");
}
else if (line.StartsWith("firmFavColour"))
{
syncSettings.FirmwareFavouriteColour = (NDS.NDSSyncSettings.Color)byte.Parse(ParseHeader(line, "firmFavColour"));
}
else if (line.StartsWith("firmBirthDay"))
{
syncSettings.FirmwareBirthdayDay = byte.Parse(ParseHeader(line, "firmBirthDay"));
}
else if (line.StartsWith("firmBirthMonth"))
{
syncSettings.FirmwareBirthdayMonth = (NDS.NDSSyncSettings.Month)byte.Parse(ParseHeader(line, "firmBirthMonth"));
}
else if (line.StartsWith("rtcStartNew"))
{
//TODO: what is this format?? 2010-JAN-01 00:00:00:000
//var time = DateTime.Parse(ParseHeader(line, "rtcStartNew"));
//syncSettings.TimeAtBoot = (uint)new DateTimeOffset(time.ToLocalTime()).ToUnixTimeSeconds();
}
else if (line.StartsWith("comment author"))
{
Result.Movie.HeaderEntries[HeaderKeys.Author] = ParseHeader(line, "comment author");
}
else if (line.StartsWith("comment"))
{
Result.Movie.Comments.Add(ParseHeader(line, "comment"));
}
else if (line.ToLower().StartsWith("guid"))
{
// We no longer care to keep this info
}
else
{
Result.Movie.Comments.Add(line); // Everything not explicitly defined is treated as a comment.
}
Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(syncSettings);
}
Result.Movie.HeaderEntries[HeaderKeys.Core] = CoreNames.MelonDS;
}
private readonly string[] _buttons = { "Right", "Left", "Down", "Up", "Start", "Select", "B", "A", "Y", "X", "L", "R", };
private void ImportInputFrame(string line)
{
SimpleController controller = new(DeSmuMEControllerDef);
controller["LidOpen"] = false;
controller["LidClose"] = false;
controller["Power"] = false;
string[] sections = line.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
if (sections.Length > 0)
{
ProcessCmd(sections[0], controller);
}
if (sections.Length > 1)
{
var mnemonics = sections[1].Take(_buttons.Length).ToList();
controller["Right"] = mnemonics[0] != '.';
controller["Left"] = mnemonics[1] != '.';
controller["Down"] = mnemonics[2] != '.';
controller["Up"] = mnemonics[3] != '.';
controller["Start"] = mnemonics[5] != '.'; // shoutouts to desmume doing start/select as select/start countary to docs
controller["Select"] = mnemonics[4] != '.';
controller["B"] = mnemonics[6] != '.';
controller["A"] = mnemonics[7] != '.';
controller["Y"] = mnemonics[8] != '.';
controller["X"] = mnemonics[9] != '.';
controller["L"] = mnemonics[10] != '.';
controller["R"] = mnemonics[11] != '.';
controller["Touch"] = sections[1].Substring(21, 1) != "0";
var touchX = int.Parse(sections[1].Substring(13, 3));
var touchY = int.Parse(sections[1].Substring(17, 3));
controller.AcceptNewAxes(new[]
{
("Touch X", touchX),
("Touch Y", touchY),
("Mic Volume", 0),
("GBA Light Sensor", 0),
});
}
Result.Movie.AppendFrame(controller);
}
private void ProcessCmd(string cmd, SimpleController controller)
{
// TODO
}
}
}
| 32.375839 | 141 | 0.624171 | [
"MIT"
] | Ortheore/BizHawk | src/BizHawk.Client.Common/movie/import/DsmImport.cs | 4,826 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletType4 : Bullet
{
void Start()
{
speed = Cards.cardProperties["TowerType4"].speed;
damage = Cards.cardProperties["TowerType4"].damage;
}
protected override void HitTarget()
{
base.HitTarget();
target.GetComponent<Enemy>().WalkBack(true);
}
}
| 20.947368 | 59 | 0.658291 | [
"MIT"
] | gameholics-usc/DefendTommyTrojan | Assets/Scripts/Towers/BulletType4.cs | 400 | C# |
using System;
using System.Data.Common;
using System.Data.Entity;
using Tralus.Framework.Data;
using Mahan.Infrastructure.BusinessModel;
namespace Mahan.Infrastructure.Data {
public class InfrastructureDbContext : DbContextBase<InfrastructureDbContext>
{
public InfrastructureDbContext(String connectionString): base(connectionString)
{
}
public InfrastructureDbContext(DbConnection connection): base(connection, false)
{
}
public InfrastructureDbContext()
{
}
//public virtual DbSet<Aircraft> Aircrafts { get; set; }
//public virtual DbSet<AircraftRegister> AircraftRegisters { get; set; }
//public virtual DbSet<AircraftRegisterNonAvailableSeat> AircraftRegisterNonAvailableSeats { get; set; }
//public virtual DbSet<AircraftRegisterSeatInfo> AircraftRegisterSeatInfos { get; set; }
//public virtual DbSet<AircraftType> AircraftTypes { get; set; }
//public virtual DbSet<Airline> GI_Airline { get; set; }
//public virtual DbSet<Airport> GI_Airport { get; set; }
//public virtual DbSet<City> GI_City { get; set; }
//public virtual DbSet<CityOffsetDst> GI_City_OffsetDST { get; set; }
//public virtual DbSet<CityOffsetUtc> GI_City_OffsetUTC { get; set; }
//public virtual DbSet<Company> GI_Company { get; set; }
//public virtual DbSet<Continent> GI_Continent { get; set; }
//public virtual DbSet<Country> GI_Country { get; set; }
//public virtual DbSet<Currency> GI_Currency { get; set; }
//public virtual DbSet<IataCountryCode> GI_IATA_CountryCode { get; set; }
//public virtual DbSet<IataRegionCode> GI_IATA_RegionCode { get; set; }
//public virtual DbSet<LirRegisterGroup> GI_LIRRegisterGroup { get; set; }
//public virtual DbSet<LocalityType> GI_LOOKUP_LocalityType { get; set; }
//public virtual DbSet<Person> GI_Person { get; set; }
//public virtual DbSet<RouteLegAirports> GI_Route_Leg_Airports { get; set; }
//public virtual DbSet<Unit> GI_Unit { get; set; }
}
} | 47.886364 | 112 | 0.69103 | [
"Apache-2.0"
] | mehrandvd/Tralus | Samples/Infrastructure/Source/Mahan.Tralus.Infrastructure.Data/Database/InfrastructureDbContext.cs | 2,107 | C# |
// Copyright 2016-2020, Pulumi Corporation
namespace Pulumi.Pulumi.Kubernetes.Crds.Operators.Infinispan{
/// <summary>
/// A base class for all Kubernetes resources.
/// </summary>
public abstract class KubernetesResource : CustomResource
{
/// <summary>
/// Standard constructor passing arguments to <see cref="CustomResource"/>.
/// </summary>
internal KubernetesResource(string type, string name, ResourceArgs? args, CustomResourceOptions? options = null)
: base(type, name, args, options)
{
}
/// <summary>
/// Additional constructor for dynamic arguments received from YAML-based sources.
/// </summary>
internal KubernetesResource(string type, string name, DictionaryResourceArgs? args, CustomResourceOptions? options = null)
: base(type, name, args, options)
{
}
}
}
| 36.76 | 130 | 0.63765 | [
"Apache-2.0"
] | pulumi/pulumi-kubernetes-crds | operators/infinispan/dotnet/KubernetesResource.cs | 919 | C# |
using AutoMapper;
using MediatR;
using Microsoft.Extensions.Logging;
using Ordering.Application.Contracts.Persistence;
using Ordering.Application.Exceptions;
using Ordering.Domain.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Ordering.Application.Features.Orders.Commands.UpdateOrder
{
public class UpdateOrderCommandHandler : IRequestHandler<UpdateOrderCommand>
{
private readonly IOrderRepository _orderRepository;
private readonly IMapper _mapper;
private readonly ILogger<UpdateOrderCommandHandler> _logger;
public UpdateOrderCommandHandler(IOrderRepository orderRepository, IMapper mapper, ILogger<UpdateOrderCommandHandler> logger)
{
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task<Unit> Handle(UpdateOrderCommand request, CancellationToken cancellationToken)
{
var orderToUpdate = await _orderRepository.GetByIdAsync(request.Id);
if (orderToUpdate == null)
{
throw new NotFoundException(nameof(Order), request.Id);
}
_mapper.Map(request, orderToUpdate, typeof(UpdateOrderCommand), typeof(Order));
await _orderRepository.UpdateAsync(orderToUpdate);
_logger.LogInformation($"Order {orderToUpdate.Id} is successfully updated.");
return Unit.Value;
}
}
}
| 35.8125 | 133 | 0.717277 | [
"MIT"
] | neigrando/AspnetMicroservices | src/Services/Ordering/Ordering.Application/Features/Orders/Commands/UpdateOrder/UpdateOrderCommandHandler.cs | 1,721 | C# |
// <auto-generated />
using System;
using GR.Crm.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace GR.Crm.Migrations
{
[DbContext(typeof(CrmDbContext))]
[Migration("20200310080749_CrmDbContext_OrganizationAddNewFields")]
partial class CrmDbContext_OrganizationAddNewFields
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Crm")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
.HasAnnotation("ProductVersion", "2.2.6-servicing-10079")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
modelBuilder.Entity("GR.Audit.Abstractions.Models.TrackAudit", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("DatabaseContextName");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid>("RecordId");
b.Property<Guid?>("TenantId");
b.Property<int>("TrackEventType");
b.Property<string>("TypeFullName");
b.Property<string>("UserName");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("TrackAudits");
});
modelBuilder.Entity("GR.Audit.Abstractions.Models.TrackAuditDetails", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("PropertyName");
b.Property<string>("PropertyType");
b.Property<Guid?>("TenantId");
b.Property<Guid>("TrackAuditId");
b.Property<string>("Value");
b.HasKey("Id");
b.HasIndex("TrackAuditId");
b.ToTable("TrackAuditDetails");
});
modelBuilder.Entity("GR.Crm.Abstractions.Models.Currency", b =>
{
b.Property<string>("Code")
.ValueGeneratedOnAdd();
b.Property<int>("DecimalDigits");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("NativeSymbol")
.IsRequired();
b.Property<string>("PluralName");
b.Property<decimal>("Rounding");
b.Property<string>("Symbol")
.IsRequired();
b.HasKey("Code");
b.ToTable("Currencies");
b.HasData(
new
{
Code = "USD",
DecimalDigits = 0,
Name = "US Dollar",
NativeSymbol = "$",
Rounding = 0m,
Symbol = "$"
},
new
{
Code = "CAD",
DecimalDigits = 0,
Name = "Canadian Dollar",
NativeSymbol = "$",
PluralName = "Canadian dollars",
Rounding = 0m,
Symbol = "CA$"
},
new
{
Code = "EUR",
DecimalDigits = 0,
Name = "Euro",
NativeSymbol = "€",
PluralName = "euros",
Rounding = 0m,
Symbol = "€"
},
new
{
Code = "AED",
DecimalDigits = 0,
Name = "United Arab Emirates Dirham",
NativeSymbol = "د.إ.",
PluralName = "UAE dirhams",
Rounding = 0m,
Symbol = "AED"
},
new
{
Code = "AFN",
DecimalDigits = 0,
Name = "Afghan Afghani",
NativeSymbol = "؋",
PluralName = "Afghan Afghanis",
Rounding = 0m,
Symbol = "Af"
},
new
{
Code = "ALL",
DecimalDigits = 0,
Name = "Albanian Lek",
NativeSymbol = "Lek",
PluralName = "Albanian lekë",
Rounding = 0m,
Symbol = "ALL"
},
new
{
Code = "AMD",
DecimalDigits = 0,
Name = "Armenian Dram",
NativeSymbol = "դր.",
PluralName = "Armenian drams",
Rounding = 0m,
Symbol = "AMD"
},
new
{
Code = "ARS",
DecimalDigits = 0,
Name = "Argentine Peso",
NativeSymbol = "$",
PluralName = "Argentine pesos",
Rounding = 0m,
Symbol = "AR$"
},
new
{
Code = "AUD",
DecimalDigits = 0,
Name = "Australian Dollar",
NativeSymbol = "$",
PluralName = "Australian dollars",
Rounding = 0m,
Symbol = "AU$"
},
new
{
Code = "AZN",
DecimalDigits = 0,
Name = "Azerbaijani Manat",
NativeSymbol = "ман.",
PluralName = "Azerbaijani manats",
Rounding = 0m,
Symbol = "man."
},
new
{
Code = "BAM",
DecimalDigits = 0,
Name = "Bosnia-Herzegovina Convertible Mark",
NativeSymbol = "KM",
PluralName = "Bosnia-Herzegovina convertible marks",
Rounding = 0m,
Symbol = "KM"
},
new
{
Code = "BDT",
DecimalDigits = 0,
Name = "Bangladeshi Taka",
NativeSymbol = "৳",
PluralName = "Bangladeshi takas",
Rounding = 0m,
Symbol = "Tk"
},
new
{
Code = "BGN",
DecimalDigits = 0,
Name = "Bulgarian Lev",
NativeSymbol = "лв.",
PluralName = "Bulgarian leva",
Rounding = 0m,
Symbol = "BGN"
},
new
{
Code = "BHD",
DecimalDigits = 0,
Name = "Bahraini Dinar",
NativeSymbol = "د.ب.",
PluralName = "Bahraini dinars",
Rounding = 0m,
Symbol = "BD"
},
new
{
Code = "BIF",
DecimalDigits = 0,
Name = "Burundian Franc",
NativeSymbol = "FBu",
PluralName = "Burundian francs",
Rounding = 0m,
Symbol = "FBu"
},
new
{
Code = "BND",
DecimalDigits = 0,
Name = "Brunei Dollar",
NativeSymbol = "$",
PluralName = "Brunei dollars",
Rounding = 0m,
Symbol = "BN$"
},
new
{
Code = "BOB",
DecimalDigits = 0,
Name = "Bolivian Boliviano",
NativeSymbol = "Bs",
PluralName = "Bolivian bolivianos",
Rounding = 0m,
Symbol = "Bs"
},
new
{
Code = "BRL",
DecimalDigits = 0,
Name = "Brazilian Real",
NativeSymbol = "R$",
PluralName = "Brazilian reals",
Rounding = 0m,
Symbol = "R$"
},
new
{
Code = "BWP",
DecimalDigits = 0,
Name = "Botswanan Pula",
NativeSymbol = "P",
PluralName = "Botswanan pulas",
Rounding = 0m,
Symbol = "BWP"
},
new
{
Code = "BYR",
DecimalDigits = 0,
Name = "Belarusian Ruble",
NativeSymbol = "BYR",
PluralName = "Belarusian rubles",
Rounding = 0m,
Symbol = "BYR"
},
new
{
Code = "BZD",
DecimalDigits = 0,
Name = "Belize Dollar",
NativeSymbol = "$",
PluralName = "Belize dollars",
Rounding = 0m,
Symbol = "BZ$"
},
new
{
Code = "CDF",
DecimalDigits = 0,
Name = "Congolese Franc",
NativeSymbol = "FrCD",
PluralName = "Congolese francs",
Rounding = 0m,
Symbol = "CDF"
},
new
{
Code = "CHF",
DecimalDigits = 0,
Name = "Swiss Franc",
NativeSymbol = "CHF",
PluralName = "Swiss francs",
Rounding = 0.05m,
Symbol = "CHF"
},
new
{
Code = "CLP",
DecimalDigits = 0,
Name = "Chilean Peso",
NativeSymbol = "$",
PluralName = "Chilean pesos",
Rounding = 0m,
Symbol = "CL$"
},
new
{
Code = "CNY",
DecimalDigits = 0,
Name = "Chinese Yuan",
NativeSymbol = "CN¥",
PluralName = "Chinese yuan",
Rounding = 0m,
Symbol = "CN¥"
},
new
{
Code = "COP",
DecimalDigits = 0,
Name = "Colombian Peso",
NativeSymbol = "$",
PluralName = "Colombian pesos",
Rounding = 0m,
Symbol = "CO$"
},
new
{
Code = "CRC",
DecimalDigits = 0,
Name = "Costa Rican Colón",
NativeSymbol = "₡",
PluralName = "Costa Rican colóns",
Rounding = 0m,
Symbol = "₡"
},
new
{
Code = "CVE",
DecimalDigits = 0,
Name = "Cape Verdean Escudo",
NativeSymbol = "CV$",
PluralName = "Cape Verdean escudos",
Rounding = 0m,
Symbol = "CV$"
},
new
{
Code = "CZK",
DecimalDigits = 0,
Name = "Czech Republic Koruna",
NativeSymbol = "Kč",
PluralName = "Czech Republic korunas",
Rounding = 0m,
Symbol = "Kč"
},
new
{
Code = "DJF",
DecimalDigits = 0,
Name = "Djiboutian Franc",
NativeSymbol = "Fdj",
PluralName = "Djiboutian francs",
Rounding = 0m,
Symbol = "Fdj"
},
new
{
Code = "DKK",
DecimalDigits = 0,
Name = "Danish Krone",
NativeSymbol = "kr",
PluralName = "Danish kroner",
Rounding = 0m,
Symbol = "Dkr"
},
new
{
Code = "DOP",
DecimalDigits = 0,
Name = "Dominican Peso",
NativeSymbol = "RD$",
PluralName = "Dominican pesos",
Rounding = 0m,
Symbol = "RD$"
},
new
{
Code = "DZD",
DecimalDigits = 0,
Name = "Algerian Dinar",
NativeSymbol = "د.ج.",
PluralName = "Algerian dinars",
Rounding = 0m,
Symbol = "DA"
},
new
{
Code = "EEK",
DecimalDigits = 0,
Name = "Estonian Kroon",
NativeSymbol = "kr",
PluralName = "Estonian kroons",
Rounding = 0m,
Symbol = "Ekr"
},
new
{
Code = "EGP",
DecimalDigits = 0,
Name = "Egyptian Pound",
NativeSymbol = "ج.م.",
PluralName = "Egyptian pounds",
Rounding = 0m,
Symbol = "EGP"
},
new
{
Code = "ERN",
DecimalDigits = 0,
Name = "Eritrean Nakfa",
NativeSymbol = "Nfk",
PluralName = "Eritrean nakfas",
Rounding = 0m,
Symbol = "Nfk"
},
new
{
Code = "ETB",
DecimalDigits = 0,
Name = "Ethiopian Birr",
NativeSymbol = "Br",
PluralName = "Ethiopian birrs",
Rounding = 0m,
Symbol = "Br"
},
new
{
Code = "GBP",
DecimalDigits = 0,
Name = "British Pound Sterling",
NativeSymbol = "£",
PluralName = "British pounds sterling",
Rounding = 0m,
Symbol = "£"
},
new
{
Code = "GEL",
DecimalDigits = 0,
Name = "Georgian Lari",
NativeSymbol = "GEL",
PluralName = "Georgian laris",
Rounding = 0m,
Symbol = "GEL"
},
new
{
Code = "GHS",
DecimalDigits = 0,
Name = "Ghanaian Cedi",
NativeSymbol = "GH₵",
PluralName = "Ghanaian cedis",
Rounding = 0m,
Symbol = "GH₵"
},
new
{
Code = "GNF",
DecimalDigits = 0,
Name = "Guinean Franc",
NativeSymbol = "FG",
PluralName = "Guinean francs",
Rounding = 0m,
Symbol = "FG"
},
new
{
Code = "GTQ",
DecimalDigits = 0,
Name = "Guatemalan Quetzal",
NativeSymbol = "Q",
PluralName = "Guatemalan quetzals",
Rounding = 0m,
Symbol = "GTQ"
},
new
{
Code = "HKD",
DecimalDigits = 0,
Name = "Hong Kong Dollar",
NativeSymbol = "$",
PluralName = "Hong Kong dollars",
Rounding = 0m,
Symbol = "HK$"
},
new
{
Code = "HNL",
DecimalDigits = 0,
Name = "Honduran Lempira",
NativeSymbol = "L",
PluralName = "Honduran lempiras",
Rounding = 0m,
Symbol = "HNL"
},
new
{
Code = "HRK",
DecimalDigits = 0,
Name = "Croatian Kuna",
NativeSymbol = "kn",
PluralName = "Croatian kunas",
Rounding = 0m,
Symbol = "kn"
},
new
{
Code = "HUF",
DecimalDigits = 0,
Name = "Hungarian Forint",
NativeSymbol = "Ft",
PluralName = "Hungarian forints",
Rounding = 0m,
Symbol = "Ft"
},
new
{
Code = "IDR",
DecimalDigits = 0,
Name = "Indonesian Rupiah",
NativeSymbol = "Rp",
PluralName = "Indonesian rupiahs",
Rounding = 0m,
Symbol = "Rp"
},
new
{
Code = "ILS",
DecimalDigits = 0,
Name = "Israeli New Sheqel",
NativeSymbol = "₪",
PluralName = "Israeli new sheqels",
Rounding = 0m,
Symbol = "₪"
},
new
{
Code = "INR",
DecimalDigits = 0,
Name = "Indian Rupee",
NativeSymbol = "টকা",
PluralName = "Indian rupees",
Rounding = 0m,
Symbol = "Rs"
},
new
{
Code = "IQD",
DecimalDigits = 0,
Name = "Iraqi Dinar",
NativeSymbol = "د.ع.",
PluralName = "Iraqi dinars",
Rounding = 0m,
Symbol = "IQD"
},
new
{
Code = "IRR",
DecimalDigits = 0,
Name = "Iranian Rial",
NativeSymbol = "﷼",
PluralName = "Iranian rials",
Rounding = 0m,
Symbol = "IRR"
},
new
{
Code = "ISK",
DecimalDigits = 0,
Name = "Icelandic Króna",
NativeSymbol = "kr",
PluralName = "Icelandic krónur",
Rounding = 0m,
Symbol = "Ikr"
},
new
{
Code = "JMD",
DecimalDigits = 0,
Name = "Jamaican Dollar",
NativeSymbol = "$",
PluralName = "Jamaican dollars",
Rounding = 0m,
Symbol = "J$"
},
new
{
Code = "JOD",
DecimalDigits = 0,
Name = "Jordanian Dinar",
NativeSymbol = "د.أ.",
PluralName = "Jordanian dinars",
Rounding = 0m,
Symbol = "JD"
},
new
{
Code = "JPY",
DecimalDigits = 0,
Name = "Japanese Yen",
NativeSymbol = "¥",
PluralName = "Japanese yen",
Rounding = 0m,
Symbol = "¥"
},
new
{
Code = "KES",
DecimalDigits = 0,
Name = "Kenyan Shilling",
NativeSymbol = "Ksh",
PluralName = "Kenyan shillings",
Rounding = 0m,
Symbol = "Ksh"
},
new
{
Code = "KHR",
DecimalDigits = 0,
Name = "Cambodian Riel",
NativeSymbol = "៛",
PluralName = "Cambodian riels",
Rounding = 0m,
Symbol = "KHR"
},
new
{
Code = "KMF",
DecimalDigits = 0,
Name = "Comorian Franc",
NativeSymbol = "FC",
PluralName = "Comorian francs",
Rounding = 0m,
Symbol = "CF"
},
new
{
Code = "KRW",
DecimalDigits = 0,
Name = "South Korean Won",
NativeSymbol = "₩",
PluralName = "South Korean won",
Rounding = 0m,
Symbol = "₩"
},
new
{
Code = "KWD",
DecimalDigits = 0,
Name = "Kuwaiti Dinar",
NativeSymbol = "د.ك.",
PluralName = "Kuwaiti dinars",
Rounding = 0m,
Symbol = "KD"
},
new
{
Code = "KZT",
DecimalDigits = 0,
Name = "Kazakhstani Tenge",
NativeSymbol = "тңг.",
PluralName = "Kazakhstani tenges",
Rounding = 0m,
Symbol = "KZT"
},
new
{
Code = "LBP",
DecimalDigits = 0,
Name = "Lebanese Pound",
NativeSymbol = "ل.ل.",
PluralName = "Lebanese pounds",
Rounding = 0m,
Symbol = "LB£"
},
new
{
Code = "LKR",
DecimalDigits = 0,
Name = "Sri Lankan Rupee",
NativeSymbol = "SL Re",
PluralName = "Sri Lankan rupees",
Rounding = 0m,
Symbol = "SLRs"
},
new
{
Code = "LTL",
DecimalDigits = 0,
Name = "Lithuanian Litas",
NativeSymbol = "Lt",
PluralName = "Lithuanian litai",
Rounding = 0m,
Symbol = "Lt"
},
new
{
Code = "LVL",
DecimalDigits = 0,
Name = "Latvian Lats",
NativeSymbol = "Ls",
PluralName = "Latvian lati",
Rounding = 0m,
Symbol = "Ls"
},
new
{
Code = "LYD",
DecimalDigits = 0,
Name = "Libyan Dinar",
NativeSymbol = "د.ل.",
PluralName = "Libyan dinars",
Rounding = 0m,
Symbol = "LD"
},
new
{
Code = "MAD",
DecimalDigits = 0,
Name = "Moroccan Dirham",
NativeSymbol = "د.م.",
PluralName = "Moroccan dirhams",
Rounding = 0m,
Symbol = "MAD"
},
new
{
Code = "MDL",
DecimalDigits = 0,
Name = "Moldovan Leu",
NativeSymbol = "MDL",
PluralName = "Moldovan lei",
Rounding = 0m,
Symbol = "MDL"
},
new
{
Code = "MGA",
DecimalDigits = 0,
Name = "Malagasy Ariary",
NativeSymbol = "MGA",
PluralName = "Malagasy Ariaries",
Rounding = 0m,
Symbol = "MGA"
},
new
{
Code = "MKD",
DecimalDigits = 0,
Name = "Macedonian Denar",
NativeSymbol = "MKD",
PluralName = "Macedonian denari",
Rounding = 0m,
Symbol = "MKD"
},
new
{
Code = "MMK",
DecimalDigits = 0,
Name = "Myanma Kyat",
NativeSymbol = "K",
PluralName = "Myanma kyats",
Rounding = 0m,
Symbol = "MMK"
},
new
{
Code = "MOP",
DecimalDigits = 0,
Name = "Macanese Pataca",
NativeSymbol = "MOP$",
PluralName = "Macanese patacas",
Rounding = 0m,
Symbol = "MOP$"
},
new
{
Code = "MUR",
DecimalDigits = 0,
Name = "Mauritian Rupee",
NativeSymbol = "MURs",
PluralName = "Mauritian rupees",
Rounding = 0m,
Symbol = "MURs"
},
new
{
Code = "MXN",
DecimalDigits = 0,
Name = "Mexican Peso",
NativeSymbol = "$",
PluralName = "Mexican pesos",
Rounding = 0m,
Symbol = "MX$"
},
new
{
Code = "MYR",
DecimalDigits = 0,
Name = "Malaysian Ringgit",
NativeSymbol = "RM",
PluralName = "Malaysian ringgits",
Rounding = 0m,
Symbol = "RM"
},
new
{
Code = "MZN",
DecimalDigits = 0,
Name = "Mozambican Metical",
NativeSymbol = "MTn",
PluralName = "Mozambican meticals",
Rounding = 0m,
Symbol = "MTn"
},
new
{
Code = "NAD",
DecimalDigits = 0,
Name = "Namibian Dollar",
NativeSymbol = "N$",
PluralName = "Namibian dollars",
Rounding = 0m,
Symbol = "N$"
},
new
{
Code = "NGN",
DecimalDigits = 0,
Name = "Nigerian Naira",
NativeSymbol = "₦",
PluralName = "Nigerian nairas",
Rounding = 0m,
Symbol = "₦"
},
new
{
Code = "NIO",
DecimalDigits = 0,
Name = "Nicaraguan Córdoba",
NativeSymbol = "C$",
PluralName = "Nicaraguan córdobas",
Rounding = 0m,
Symbol = "C$"
},
new
{
Code = "NOK",
DecimalDigits = 0,
Name = "Norwegian Krone",
NativeSymbol = "kr",
PluralName = "Norwegian kroner",
Rounding = 0m,
Symbol = "Nkr"
},
new
{
Code = "NPR",
DecimalDigits = 0,
Name = "Nepalese Rupee",
NativeSymbol = "नेरू",
PluralName = "Nepalese rupees",
Rounding = 0m,
Symbol = "NPRs"
},
new
{
Code = "NZD",
DecimalDigits = 0,
Name = "New Zealand Dollar",
NativeSymbol = "$",
PluralName = "New Zealand dollars",
Rounding = 0m,
Symbol = "NZ$"
},
new
{
Code = "OMR",
DecimalDigits = 0,
Name = "Omani Rial",
NativeSymbol = "ر.ع.",
PluralName = "Omani rials",
Rounding = 0m,
Symbol = "OMR"
},
new
{
Code = "PAB",
DecimalDigits = 0,
Name = "Panamanian Balboa",
NativeSymbol = "B/.",
PluralName = "Panamanian balboas",
Rounding = 0m,
Symbol = "B/."
},
new
{
Code = "PEN",
DecimalDigits = 0,
Name = "Peruvian Nuevo Sol",
NativeSymbol = "S/.",
PluralName = "Peruvian nuevos soles",
Rounding = 0m,
Symbol = "S/."
},
new
{
Code = "PHP",
DecimalDigits = 0,
Name = "Philippine Peso",
NativeSymbol = "₱",
PluralName = "Philippine pesos",
Rounding = 0m,
Symbol = "₱"
},
new
{
Code = "PKR",
DecimalDigits = 0,
Name = "Pakistani Rupee",
NativeSymbol = "₨",
PluralName = "Pakistani rupees",
Rounding = 0m,
Symbol = "PKRs"
},
new
{
Code = "PLN",
DecimalDigits = 0,
Name = "Polish Zloty",
NativeSymbol = "zł",
PluralName = "Polish zlotys",
Rounding = 0m,
Symbol = "zł"
},
new
{
Code = "PYG",
DecimalDigits = 0,
Name = "Paraguayan Guarani",
NativeSymbol = "₲",
PluralName = "Paraguayan guaranis",
Rounding = 0m,
Symbol = "₲"
},
new
{
Code = "QAR",
DecimalDigits = 0,
Name = "Qatari Rial",
NativeSymbol = "ر.ق.",
PluralName = "Qatari rials",
Rounding = 0m,
Symbol = "QR"
},
new
{
Code = "RON",
DecimalDigits = 0,
Name = "Romanian Leu",
NativeSymbol = "RON",
PluralName = "Romanian lei",
Rounding = 0m,
Symbol = "RON"
},
new
{
Code = "RSD",
DecimalDigits = 0,
Name = "Serbian Dinar",
NativeSymbol = "дин.",
PluralName = "Serbian dinars",
Rounding = 0m,
Symbol = "din."
},
new
{
Code = "RUB",
DecimalDigits = 0,
Name = "Russian Ruble",
NativeSymbol = "руб.",
PluralName = "Russian rubles",
Rounding = 0m,
Symbol = "RUB"
},
new
{
Code = "RWF",
DecimalDigits = 0,
Name = "Rwandan Franc",
NativeSymbol = "FR",
PluralName = "Rwandan francs",
Rounding = 0m,
Symbol = "RWF"
},
new
{
Code = "SAR",
DecimalDigits = 0,
Name = "Saudi Riyal",
NativeSymbol = "ر.س.",
PluralName = "Saudi riyals",
Rounding = 0m,
Symbol = "SR"
},
new
{
Code = "SDG",
DecimalDigits = 0,
Name = "Sudanese Pound",
NativeSymbol = "SDG",
PluralName = "Sudanese pounds",
Rounding = 0m,
Symbol = "SDG"
},
new
{
Code = "SEK",
DecimalDigits = 0,
Name = "Swedish Krona",
NativeSymbol = "kr",
PluralName = "Swedish kronor",
Rounding = 0m,
Symbol = "Skr"
},
new
{
Code = "SGD",
DecimalDigits = 0,
Name = "Singapore Dollar",
NativeSymbol = "$",
PluralName = "Singapore dollars",
Rounding = 0m,
Symbol = "S$"
},
new
{
Code = "SOS",
DecimalDigits = 0,
Name = "Somali Shilling",
NativeSymbol = "Ssh",
PluralName = "Somali shillings",
Rounding = 0m,
Symbol = "Ssh"
},
new
{
Code = "SYP",
DecimalDigits = 0,
Name = "Syrian Pound",
NativeSymbol = "ل.س.",
PluralName = "Syrian pounds",
Rounding = 0m,
Symbol = "SY£"
},
new
{
Code = "THB",
DecimalDigits = 0,
Name = "Thai Baht",
NativeSymbol = "฿",
PluralName = "Thai baht",
Rounding = 0m,
Symbol = "฿"
},
new
{
Code = "TND",
DecimalDigits = 0,
Name = "Tunisian Dinar",
NativeSymbol = "د.ت.",
PluralName = "Tunisian dinars",
Rounding = 0m,
Symbol = "DT"
},
new
{
Code = "TOP",
DecimalDigits = 0,
Name = "Tongan Paʻanga",
NativeSymbol = "T$",
PluralName = "Tongan paʻanga",
Rounding = 0m,
Symbol = "T$"
},
new
{
Code = "TRY",
DecimalDigits = 0,
Name = "Turkish Lira",
NativeSymbol = "TL",
PluralName = "Turkish Lira",
Rounding = 0m,
Symbol = "TL"
},
new
{
Code = "TTD",
DecimalDigits = 0,
Name = "Trinidad and Tobago Dollar",
NativeSymbol = "$",
PluralName = "Trinidad and Tobago dollars",
Rounding = 0m,
Symbol = "TT$"
},
new
{
Code = "TWD",
DecimalDigits = 0,
Name = "New Taiwan Dollar",
NativeSymbol = "NT$",
PluralName = "New Taiwan dollars",
Rounding = 0m,
Symbol = "NT$"
},
new
{
Code = "TZS",
DecimalDigits = 0,
Name = "Tanzanian Shilling",
NativeSymbol = "TSh",
PluralName = "Tanzanian shillings",
Rounding = 0m,
Symbol = "TSh"
},
new
{
Code = "UAH",
DecimalDigits = 0,
Name = "Ukrainian Hryvnia",
NativeSymbol = "₴",
PluralName = "Ukrainian hryvnias",
Rounding = 0m,
Symbol = "₴"
},
new
{
Code = "UGX",
DecimalDigits = 0,
Name = "Ugandan Shilling",
NativeSymbol = "USh",
PluralName = "Ugandan shillings",
Rounding = 0m,
Symbol = "USh"
},
new
{
Code = "UYU",
DecimalDigits = 0,
Name = "Uruguayan Peso",
NativeSymbol = "$",
PluralName = "Uruguayan pesos",
Rounding = 0m,
Symbol = "$U"
},
new
{
Code = "UZS",
DecimalDigits = 0,
Name = "Uzbekistan Som",
NativeSymbol = "UZS",
PluralName = "Uzbekistan som",
Rounding = 0m,
Symbol = "UZS"
},
new
{
Code = "VEF",
DecimalDigits = 0,
Name = "Venezuelan Bolívar",
NativeSymbol = "Bs.F.",
PluralName = "Venezuelan bolívars",
Rounding = 0m,
Symbol = "Bs.F."
},
new
{
Code = "VND",
DecimalDigits = 0,
Name = "Vietnamese Dong",
NativeSymbol = "₫",
PluralName = "Vietnamese dong",
Rounding = 0m,
Symbol = "₫"
},
new
{
Code = "XAF",
DecimalDigits = 0,
Name = "CFA Franc BEAC",
NativeSymbol = "FCFA",
PluralName = "CFA francs BEAC",
Rounding = 0m,
Symbol = "FCFA"
},
new
{
Code = "XOF",
DecimalDigits = 0,
Name = "CFA Franc BCEAO",
NativeSymbol = "CFA",
PluralName = "CFA francs BCEAO",
Rounding = 0m,
Symbol = "CFA"
},
new
{
Code = "YER",
DecimalDigits = 0,
Name = "Yemeni Rial",
NativeSymbol = "ر.ي.",
PluralName = "Yemeni rials",
Rounding = 0m,
Symbol = "YR"
},
new
{
Code = "ZAR",
DecimalDigits = 0,
Name = "South African Rand",
NativeSymbol = "R",
PluralName = "South African rand",
Rounding = 0m,
Symbol = "R"
},
new
{
Code = "ZMK",
DecimalDigits = 0,
Name = "Zambian Kwacha",
NativeSymbol = "ZK",
PluralName = "Zambian kwachas",
Rounding = 0m,
Symbol = "ZK"
});
});
modelBuilder.Entity("GR.Crm.Abstractions.Models.JobPosition", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("JobPositions");
});
modelBuilder.Entity("GR.Crm.Contracts.Abstractions.Models.ContractSection", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<Guid>("ContractTemplateId");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("TemplateValue");
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.HasIndex("ContractTemplateId");
b.ToTable("ContractSections");
});
modelBuilder.Entity("GR.Crm.Contracts.Abstractions.Models.ContractTemplate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("Description")
.HasMaxLength(200);
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("ContractTemplates");
});
modelBuilder.Entity("GR.Crm.Leads.Abstractions.Models.Lead", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("CurrencyCode");
b.Property<DateTime?>("DeadLine");
b.Property<bool>("IsDeleted");
b.Property<Guid>("LeadStateId");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<Guid>("OrganizationId");
b.Property<Guid>("PipeLineId");
b.Property<DateTime?>("StageDeadLine");
b.Property<Guid>("StageId");
b.Property<DateTime>("StartDate");
b.Property<Guid?>("TeamId");
b.Property<Guid?>("TenantId");
b.Property<decimal>("Value");
b.Property<int>("Version");
b.HasKey("Id");
b.HasIndex("CurrencyCode");
b.HasIndex("LeadStateId");
b.HasIndex("OrganizationId");
b.HasIndex("PipeLineId");
b.HasIndex("StageId");
b.HasIndex("TeamId");
b.ToTable("Leads");
});
modelBuilder.Entity("GR.Crm.Leads.Abstractions.Models.LeadState", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<int>("Order");
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("States");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.City", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("RegionId")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.HasIndex("RegionId");
b.ToTable("Cities");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Contact", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("Description");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(128);
b.Property<bool>("IsDeleted");
b.Property<Guid?>("JobPositionId");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("ModifiedBy");
b.Property<Guid>("OrganizationId");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(50);
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.HasIndex("JobPositionId");
b.HasIndex("OrganizationId");
b.ToTable("Contacts");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.ContactWebProfile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<Guid>("ContactId");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid?>("TenantId");
b.Property<string>("Url")
.IsRequired()
.HasMaxLength(50);
b.Property<string>("UserName")
.IsRequired()
.HasMaxLength(50);
b.Property<int>("Version");
b.Property<Guid>("WebProfileId");
b.HasKey("Id");
b.HasIndex("ContactId");
b.HasIndex("WebProfileId");
b.ToTable("ContactWebProfiles");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Employee", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("Interval")
.IsRequired();
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("Employees");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Industry", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("Industries");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Organization", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Afiliat")
.HasMaxLength(128);
b.Property<string>("Author");
b.Property<string>("Bank");
b.Property<string>("Brand")
.HasMaxLength(128);
b.Property<DateTime>("Changed");
b.Property<int>("ClientType");
b.Property<string>("CodSwift");
b.Property<string>("CodTva");
b.Property<DateTime>("Created");
b.Property<string>("Description");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50);
b.Property<int>("Employees");
b.Property<string>("FiscalCode")
.IsRequired()
.HasMaxLength(13);
b.Property<int>("GeoPosition");
b.Property<string>("IBANCode")
.HasMaxLength(128);
b.Property<Guid?>("IndustryId");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(50);
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.Property<string>("WebSite")
.HasMaxLength(50);
b.HasKey("Id");
b.HasIndex("IndustryId");
b.ToTable("Organizations");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.OrganizationAddress", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<Guid>("CityId");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid>("OrganizationId");
b.Property<string>("Street")
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.Property<string>("Zip")
.HasMaxLength(28);
b.HasKey("Id");
b.HasIndex("CityId");
b.HasIndex("OrganizationId");
b.ToTable("OrganizationAddresses");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.OrganizationWorkCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid>("OrganizationId");
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.Property<Guid>("WorkCategoryId");
b.HasKey("Id");
b.HasIndex("OrganizationId");
b.HasIndex("WorkCategoryId");
b.ToTable("OrganizationWorkCategories");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Region", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<int>("GeoPosition");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("Regions");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.WebProfile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<byte[]>("Icon");
b.Property<string>("IconName");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("ProviderName")
.IsRequired()
.HasMaxLength(50);
b.Property<Guid?>("TenantId");
b.Property<string>("Url")
.HasMaxLength(50);
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("WebProfiles");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.WorkCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("Description");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("WorkCategories");
});
modelBuilder.Entity("GR.Crm.PipeLines.Abstractions.Models.PipeLine", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<string>("Description");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50);
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.Property<Guid?>("WorkFlowId");
b.HasKey("Id");
b.ToTable("PipeLines");
});
modelBuilder.Entity("GR.Crm.PipeLines.Abstractions.Models.Stage", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<int>("Order");
b.Property<Guid>("PipeLineId");
b.Property<Guid?>("TenantId");
b.Property<int?>("Term");
b.Property<int>("Version");
b.Property<Guid?>("WorkFlowStateId");
b.HasKey("Id");
b.HasIndex("PipeLineId");
b.ToTable("Stages");
});
modelBuilder.Entity("GR.Crm.Teams.Abstractions.Models.Team", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("Teams");
});
modelBuilder.Entity("GR.Crm.Teams.Abstractions.Models.TeamMember", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<Guid>("TeamId");
b.Property<Guid?>("TeamRoleId")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<Guid>("UserId");
b.Property<int>("Version");
b.HasKey("Id");
b.HasIndex("TeamId");
b.HasIndex("TeamRoleId");
b.ToTable("TeamMembers");
});
modelBuilder.Entity("GR.Crm.Teams.Abstractions.Models.TeamRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author");
b.Property<DateTime>("Changed");
b.Property<DateTime>("Created");
b.Property<bool>("IsDeleted");
b.Property<string>("ModifiedBy");
b.Property<string>("Name")
.IsRequired();
b.Property<Guid?>("TenantId");
b.Property<int>("Version");
b.HasKey("Id");
b.ToTable("TeamRoles");
});
modelBuilder.Entity("GR.Audit.Abstractions.Models.TrackAuditDetails", b =>
{
b.HasOne("GR.Audit.Abstractions.Models.TrackAudit")
.WithMany("AuditDetailses")
.HasForeignKey("TrackAuditId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Contracts.Abstractions.Models.ContractSection", b =>
{
b.HasOne("GR.Crm.Contracts.Abstractions.Models.ContractTemplate", "ContractTemplate")
.WithMany("Sections")
.HasForeignKey("ContractTemplateId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Leads.Abstractions.Models.Lead", b =>
{
b.HasOne("GR.Crm.Abstractions.Models.Currency", "Currency")
.WithMany()
.HasForeignKey("CurrencyCode");
b.HasOne("GR.Crm.Leads.Abstractions.Models.LeadState", "LeadState")
.WithMany()
.HasForeignKey("LeadStateId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Organization", "Organization")
.WithMany()
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.PipeLines.Abstractions.Models.PipeLine", "PipeLine")
.WithMany()
.HasForeignKey("PipeLineId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.PipeLines.Abstractions.Models.Stage", "Stage")
.WithMany()
.HasForeignKey("StageId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Teams.Abstractions.Models.Team", "Team")
.WithMany()
.HasForeignKey("TeamId");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.City", b =>
{
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Region", "Region")
.WithMany("Cities")
.HasForeignKey("RegionId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Contact", b =>
{
b.HasOne("GR.Crm.Abstractions.Models.JobPosition", "JobPosition")
.WithMany()
.HasForeignKey("JobPositionId");
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Organization", "Organization")
.WithMany("Contacts")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.ContactWebProfile", b =>
{
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Contact", "Contact")
.WithMany("ContactWebProfiles")
.HasForeignKey("ContactId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Organizations.Abstractions.Models.WebProfile", "WebProfile")
.WithMany()
.HasForeignKey("WebProfileId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.Organization", b =>
{
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Industry", "Industry")
.WithMany()
.HasForeignKey("IndustryId");
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.OrganizationAddress", b =>
{
b.HasOne("GR.Crm.Organizations.Abstractions.Models.City", "City")
.WithMany()
.HasForeignKey("CityId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Organization", "Organization")
.WithMany("Addresses")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Organizations.Abstractions.Models.OrganizationWorkCategory", b =>
{
b.HasOne("GR.Crm.Organizations.Abstractions.Models.Organization", "Organization")
.WithMany("OrganizationWorkCategories")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Organizations.Abstractions.Models.WorkCategory", "WorkCategory")
.WithMany()
.HasForeignKey("WorkCategoryId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.PipeLines.Abstractions.Models.Stage", b =>
{
b.HasOne("GR.Crm.PipeLines.Abstractions.Models.PipeLine", "PipeLine")
.WithMany("Stages")
.HasForeignKey("PipeLineId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("GR.Crm.Teams.Abstractions.Models.TeamMember", b =>
{
b.HasOne("GR.Crm.Teams.Abstractions.Models.Team", "Team")
.WithMany("TeamMembers")
.HasForeignKey("TeamId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("GR.Crm.Teams.Abstractions.Models.TeamRole", "TeamRole")
.WithMany()
.HasForeignKey("TeamRoleId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
| 36.878955 | 108 | 0.311937 | [
"MIT"
] | indrivo/bizon360_crm | src/GR.Extensions/GR.Crm.Extension/GR.Crm/Migrations/20200310080749_CrmDbContext_OrganizationAddNewFields.Designer.cs | 80,606 | C# |
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
using Microsoft.Extensions.DependencyInjection;
using Swashbuckle.AspNetCore.Swagger;
using System.Collections.Generic;
using WalkingTec.Mvvm.ReactDemo.Models;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.TagHelpers.LayUI;
namespace WalkingTec.Mvvm.ReactDemo
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureServices(x =>
{
var pris = new List<IDataPrivilege>
{
new DataPrivilegeInfo<FrameworkRole>("测试角色", y => y.RoleName),
};
x.AddFrameworkService(dataPrivilegeSettings: pris);
x.AddLayui();
x.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
c.AddSecurityDefinition("Bearer", new ApiKeyScheme()
{
Description = "JWT Bearer",
Name = "Authorization",
In = "header",
Type = "apiKey"
});
c.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>>
{
{ "Bearer", new string[] { } }
});
});
x.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/build";
});
})
.Configure(x =>
{
var env = x.ApplicationServices.GetService<IHostingEnvironment>();
x.UseSwagger();
x.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
});
x.UseSpaStaticFiles();
x.UseFrameworkService();
x.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
});
})
.Build();
}
}
| 37.013158 | 92 | 0.443299 | [
"MIT"
] | 331378731/WTM | demo/WalkingTec.Mvvm.ReactDemo/Program.cs | 2,821 | C# |
//Copyright (c) Microsoft Corporation. All rights reserved.
using System.Collections.ObjectModel;
using Microsoft.WindowsAPICodePack.Shell;
namespace Microsoft.WindowsAPICodePack.Dialogs
{
/// <summary>
/// Provides a strongly typed collection for file dialog filters.
/// </summary>
public class CommonFileDialogFilterCollection : Collection<CommonFileDialogFilter>
{
// Make the default constructor internal so users can't instantiate this
// collection by themselves.
internal CommonFileDialogFilterCollection() { }
internal ShellNativeMethods.FilterSpec[] GetAllFilterSpecs()
{
ShellNativeMethods.FilterSpec[] filterSpecs = new ShellNativeMethods.FilterSpec[this.Count];
for (int i = 0; i < this.Count; i++)
{
filterSpecs[i] = this[i].GetFilterSpec();
}
return filterSpecs;
}
}
}
| 32.266667 | 105 | 0.640496 | [
"Apache-2.0"
] | manuth/EnhanceForm | Microsoft.WindowsAPICodePack.Shell/CommonFileDialogs/CommonFileDialogFilterCollection.cs | 968 | C# |
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using SpreadCommander.Common.Extensions;
namespace SpreadCommander.Common.DBMS.SQLite.Functions.Math
{
[SQLiteFunction(Name = "Sqrt", Arguments = 1, FuncType = FunctionType.Scalar)]
public class SqrtFunction : SQLiteFunction
{
public override object Invoke(object[] args)
{
if (args == null || args.Length != 1)
return null;
if (args[0] == null)
return null;
try
{
double value = Convert.ToDouble(args[0]);
if (double.IsNaN(value))
return null;
double result = System.Math.Sqrt(value);
return result;
}
catch (Exception)
{
return null;
}
}
}
}
| 25.564103 | 82 | 0.551655 | [
"Apache-2.0"
] | VassilievVV/SpreadCommander | SpreadCommander.Common/DBMS/SQLite/Functions/Math/SqrtFunction.cs | 999 | C# |
using System.Collections.Generic;
using System.Text;
namespace ADLCore.Epub
{
public class Manifest
{
public List<Item> items;
public Manifest() =>
items = new List<Item>();
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("<manifest>");
foreach (Item it in items)
sb.Append(it.ToString());
sb.AppendLine("</manifest>");
return sb.ToString();
}
}
}
| 22.25 | 51 | 0.533708 | [
"BSD-3-Clause"
] | vrienstudios/anime-dl | CS/ADLCore/Epub/Manifest.cs | 536 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Storage
{
#if false || false || false || false
#if false || false || false || false
[global::Uno.NotImplemented]
#endif
public enum NameCollisionOption
{
#if false || false || false || false
GenerateUniqueName,
#endif
#if false || false || false || false
ReplaceExisting,
#endif
#if false || false || false || false
FailIfExists,
#endif
}
#endif
}
| 21.521739 | 49 | 0.672727 | [
"Apache-2.0"
] | nv-ksavaria/Uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Storage/NameCollisionOption.cs | 495 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/wingdi.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using NUnit.Framework;
using System.Runtime.InteropServices;
namespace TerraFX.Interop.Windows.UnitTests;
/// <summary>Provides validation of the <see cref="BITMAPFILEHEADER" /> struct.</summary>
public static unsafe partial class BITMAPFILEHEADERTests
{
/// <summary>Validates that the <see cref="BITMAPFILEHEADER" /> struct is blittable.</summary>
[Test]
public static void IsBlittableTest()
{
Assert.That(Marshal.SizeOf<BITMAPFILEHEADER>(), Is.EqualTo(sizeof(BITMAPFILEHEADER)));
}
/// <summary>Validates that the <see cref="BITMAPFILEHEADER" /> struct has the right <see cref="LayoutKind" />.</summary>
[Test]
public static void IsLayoutSequentialTest()
{
Assert.That(typeof(BITMAPFILEHEADER).IsLayoutSequential, Is.True);
}
/// <summary>Validates that the <see cref="BITMAPFILEHEADER" /> struct has the correct size.</summary>
[Test]
public static void SizeOfTest()
{
Assert.That(sizeof(BITMAPFILEHEADER), Is.EqualTo(14));
}
}
| 37.285714 | 145 | 0.717241 | [
"MIT"
] | IngmarBitter/terrafx.interop.windows | tests/Interop/Windows/Windows/um/wingdi/BITMAPFILEHEADERTests.cs | 1,307 | C# |
using System;
using System.Collections.Generic;
namespace Awesome.FeedParser.Interfaces.RSS
{
/// <summary>
/// Interface to access RSS 1.0 specified properties
/// </summary>
public interface IRSS_1_0_Feed : IRSS_0_92_Feed
{
#region Required
/// <summary>
/// Url to information about feed.
/// </summary>
public Uri? About { get; }
#endregion Required
#region Optional
/// <summary>
/// An RDF Sequence is used to contain all the items to denote item order for rendering and reconstruction.
/// </summary>
public IReadOnlyList<Uri>? ItemsSequence { get; }
/// <summary>
/// RSS 1.0 feed items
/// </summary>
public new IEnumerable<IRSS_1_0_Item> Items { get; }
#endregion Optional
}
} | 24.882353 | 115 | 0.591017 | [
"MIT"
] | SirJohnK/Awesome.FeedParser | Awesome.FeedParser/Interfaces/RSS/IRSS_1_0_Feed.cs | 848 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER)
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true)]
internal sealed class NotNullIfNotNullAttribute : Attribute
{
public NotNullIfNotNullAttribute(string parameterName)
{
ParameterName = parameterName;
}
public string ParameterName { get; }
}
}
#endif
| 30.142857 | 129 | 0.731438 | [
"MIT"
] | AraHaan/efcore | src/ef/NotNullIfNotNullAttribute.cs | 635 | C# |
using Newtonsoft.Json;
namespace GLTF.Schema
{
/// <summary>
/// Texture sampler properties for filtering and wrapping modes.
/// </summary>
public class Sampler : GLTFChildOfRootProperty
{
/// <summary>
/// Magnification filter.
/// Valid values correspond to WebGL enums: `9728` (NEAREST) and `9729` (LINEAR).
/// </summary>
public MagFilterMode MagFilter = MagFilterMode.Linear;
/// <summary>
/// Minification filter. All valid values correspond to WebGL enums.
/// </summary>
public MinFilterMode MinFilter = MinFilterMode.NearestMipmapLinear;
/// <summary>
/// s wrapping mode. All valid values correspond to WebGL enums.
/// </summary>
public WrapMode WrapS = WrapMode.Repeat;
/// <summary>
/// t wrapping mode. All valid values correspond to WebGL enums.
/// </summary>
public WrapMode WrapT = WrapMode.Repeat;
public static Sampler Deserialize(GLTFRoot root, JsonReader reader)
{
var sampler = new Sampler();
while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
{
var curProp = reader.Value.ToString();
switch (curProp)
{
case "magFilter":
sampler.MagFilter = (MagFilterMode) reader.ReadAsInt32();
break;
case "minFilter":
sampler.MinFilter = (MinFilterMode)reader.ReadAsInt32();
break;
case "wrapS":
sampler.WrapS = (WrapMode)reader.ReadAsInt32();
break;
case "wrapT":
sampler.WrapT = (WrapMode)reader.ReadAsInt32();
break;
default:
sampler.DefaultPropertyDeserializer(root, reader);
break;
}
}
return sampler;
}
public override void Serialize(JsonWriter writer)
{
writer.WriteStartObject();
if (MagFilter != MagFilterMode.Linear)
{
writer.WritePropertyName("magFilter");
writer.WriteValue((int)MagFilter);
}
if (MinFilter != MinFilterMode.NearestMipmapLinear)
{
writer.WritePropertyName("minFilter");
writer.WriteValue((int)MinFilter);
}
if (WrapS != WrapMode.Repeat)
{
writer.WritePropertyName("WrapS");
writer.WriteValue((int)WrapS);
}
if (WrapT != WrapMode.Repeat)
{
writer.WritePropertyName("WrapT");
writer.WriteValue((int)WrapT);
}
base.Serialize(writer);
writer.WriteEndObject();
}
}
/// <summary>
/// Magnification filter mode.
/// </summary>
public enum MagFilterMode
{
None = 0,
Nearest = 9728,
Linear = 9729,
}
/// <summary>
/// Minification filter mode.
/// </summary>
public enum MinFilterMode
{
None = 0,
Nearest = 9728,
Linear = 9729,
NearestMipmapNearest = 9984,
LinearMipmapNearest = 9985,
NearestMipmapLinear = 9986,
LinearMipmapLinear = 9987
}
/// <summary>
/// Texture wrap mode.
/// </summary>
public enum WrapMode
{
None = 0,
ClampToEdge = 33071,
MirroredRepeat = 33648,
Repeat = 10497
}
}
| 21.740458 | 83 | 0.658708 | [
"MIT"
] | Plattar/Sketchfab-UnityGLTF | GLTFSerialization/GLTFSerialization/Schema/Sampler.cs | 2,848 | C# |
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using NetMicro.Cache.Abstractions;
namespace NetMicro.Cache.Provider.StackExchange
{
internal static class RedisExtensions
{
internal static HashEntry[] GetHashEntry<T>(this T entity, PropertyInfo[] propertyInfos)
{
return (from propertyInfo in propertyInfos
let value = propertyInfo.GetValue(entity).ToString()
let filedName = propertyInfo.Name
select new HashEntry(filedName, value)).ToArray();
}
internal static RedisKey[] ToRedisKeyArray(this string[] keys)
{
var arrayKey = new RedisKey[keys.Length];
for (int i = 0, j = keys.Length; i < j; i++)
{
arrayKey[i] = keys[i];
}
return arrayKey;
}
internal static RedisValue[] ToRedisValueArray(this string[] values)
{
var arrayValue = new RedisValue[values.Length];
for (int i = 0, j = values.Length; i < j; i++)
{
arrayValue[i] = values[i];
}
return arrayValue;
}
internal static KeyValuePair<RedisKey, RedisValue>[] ToKeyValuePairArray(this IDictionary<string, string> kvs)
{
return kvs.Select(a => new KeyValuePair<RedisKey, RedisValue>(a.Key, a.Value)).ToArray();
}
internal static KeyValuePair<string, string>[] ToHashPairs(this IEnumerable<HashEntry> entries)
{
return entries == null ? null : ToHashPairs(entries.ToArray());
}
internal static KeyValuePair<string, string>[] ToHashPairs(this HashEntry[] entries)
{
if (entries == null)
return null;
var result = new KeyValuePair<string, string>[entries.Length];
for (int i = 0, j = result.Length; i < j; i++)
{
result[i] = new KeyValuePair<string, string>(entries[i].Name, entries[i].Value.HasValue ? (string)entries[i].Value : null);
}
return result;
}
internal static KeyValuePair<string, double>[] ToSortedPairs(this IEnumerable<SortedSetEntry> entries)
{
return entries == null ? null : ToSortedPairs(entries.ToArray());
}
internal static KeyValuePair<string, double>[] ToSortedPairs(this SortedSetEntry[] entries)
{
if (entries == null)
return null;
var result = new KeyValuePair<string, double>[entries.Length];
for (int i = 0, j = result.Length; i < j; i++)
{
result[i] = new KeyValuePair<string, double>(entries[i].Element, entries[i].Score);
}
return result;
}
internal static SortedSetEntry[] ToSortedSetEntry(this IDictionary<string, double> members)
{
return members?.Select(a => new SortedSetEntry(a.Key, a.Value)).ToArray();
}
internal static TimeSpan? ToRedisTimeSpan(this int seconds)
{
return seconds <= 0 ? (TimeSpan?)null : TimeSpan.FromSeconds(seconds);
}
#region 枚举转换
internal static SetOperation ToSetOperation(this RedisSetOperation operation)
{
switch (operation)
{
case RedisSetOperation.Union:
return SetOperation.Union;
case RedisSetOperation.Intersect:
return SetOperation.Intersect;
case RedisSetOperation.Difference:
return SetOperation.Difference;
default:
throw new Exception("RedisProxy 非法的集合运算");
}
}
internal static Aggregate ToAggregate(this RedisAggregate aggregate)
{
switch (aggregate)
{
case RedisAggregate.Sum:
return Aggregate.Sum;
case RedisAggregate.Max:
return Aggregate.Max;
case RedisAggregate.Min:
return Aggregate.Min;
default:
throw new Exception("RedisProxy 非法的聚合运算");
}
}
internal static Order ToOrder(this RedisOrder order)
{
switch (order)
{
case RedisOrder.Ascending:
return Order.Ascending;
case RedisOrder.Descending:
return Order.Descending;
default:
throw new Exception("RedisProxy 非法顺序");
}
}
internal static Exclude ToExclude(this RedisExclude exclude)
{
return (Exclude)(int)exclude;
}
internal static RedisItemType ToType(this RedisType type)
{
return (RedisItemType)(int)type;
}
#endregion
}
}
| 30.646341 | 139 | 0.548349 | [
"MIT"
] | LittleMaoTou/NetMicro | src/cache/NetMicro.Cache.Provider/StackExchange/RedisExtensions.cs | 5,072 | C# |
using System;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Orleans;
using Orleans.TestingHost;
namespace TestExtensions
{
public abstract class TestClusterPerTest : OrleansTestingBase, IDisposable, Xunit.IAsyncLifetime
{
private readonly ExceptionDispatchInfo preconditionsException;
static TestClusterPerTest()
{
TestDefaultConfiguration.InitializeDefaults();
}
protected TestCluster HostedCluster { get; private set; }
internal IInternalClusterClient InternalClient => (IInternalClusterClient)this.Client;
public IClusterClient Client => this.HostedCluster.Client;
protected IGrainFactory GrainFactory => this.Client;
protected ILogger Logger => this.logger;
protected ILogger logger;
protected TestClusterPerTest()
{
try
{
CheckPreconditionsOrThrow();
}
catch (Exception ex)
{
this.preconditionsException = ExceptionDispatchInfo.Capture(ex);
return;
}
var builder = new TestClusterBuilder();
TestDefaultConfiguration.ConfigureTestCluster(builder);
this.ConfigureTestCluster(builder);
var testCluster = builder.Build();
if (testCluster.Primary == null)
{
testCluster.Deploy();
}
this.HostedCluster = testCluster;
this.logger = this.Client.ServiceProvider.GetRequiredService<ILoggerFactory>().CreateLogger("Application");
}
public void EnsurePreconditionsMet()
{
this.preconditionsException?.Throw();
}
protected virtual void CheckPreconditionsOrThrow() { }
protected virtual void ConfigureTestCluster(TestClusterBuilder builder)
{
}
public virtual void Dispose()
{
this.HostedCluster?.StopAllSilos();
}
public virtual Task InitializeAsync()
{
return Task.CompletedTask;
}
public virtual async Task DisposeAsync()
{
try
{
if (this.HostedCluster is TestCluster cluster)
{
await cluster.StopAllSilosAsync();
}
}
finally
{
this.HostedCluster?.Dispose();
}
}
}
} | 28.362637 | 119 | 0.592406 | [
"MIT"
] | Abramalin/orleans | test/TestInfrastructure/TestExtensions/TestClusterPerTest.cs | 2,581 | C# |
using System;
using System.Collections.Concurrent;
namespace QuickView.UI.UWP.Core.Helpers
{
public static class Singleton<T>
where T : new()
{
private static ConcurrentDictionary<Type, T> _instances = new ConcurrentDictionary<Type, T>();
public static T Instance
{
get
{
return _instances.GetOrAdd(typeof(T), (t) => new T());
}
}
}
}
| 22.1 | 102 | 0.563348 | [
"MIT"
] | smithderekm/quickview | src/QuickView.UI.UWP.Core/Helpers/Singleton.cs | 444 | C# |
// <copyright file="PamConversationHandler.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.InteropServices;
using FubarDev.PamSharp.Interop;
using FubarDev.PamSharp.Messages;
namespace FubarDev.PamSharp
{
/// <summary>
/// The default implementation of a <see cref="IPamMessageHandler"/>.
/// </summary>
public class PamConversationHandler : IPamConversationHandler
{
private readonly IPamMessageHandler _messageHandler;
/// <summary>
/// Initializes a new instance of the <see cref="PamConversationHandler"/> class.
/// </summary>
/// <param name="messageHandler">The message handler that gets the messages.</param>
public PamConversationHandler(IPamMessageHandler messageHandler)
{
_messageHandler = messageHandler ?? throw new ArgumentNullException(nameof(messageHandler));
}
private interface IPamResponse
{
PamStatus Status { get; }
void WriteTo(IntPtr dest);
}
/// <inheritdoc />
public PamStatus Handle(int messageCount, IntPtr messages, out IntPtr responseArrayPtr, IntPtr appDataPtr)
{
var internalMessages = ReadMessages(messageCount, messages);
var responseItems = new List<IPamResponse>();
var responses = ProcessMessages(internalMessages, _messageHandler);
foreach (var response in responses)
{
if (response.Status != PamStatus.PAM_SUCCESS)
{
responseArrayPtr = IntPtr.Zero;
return response.Status;
}
responseItems.Add(response);
}
responseArrayPtr = WriteResponses(responseItems);
return PamStatus.PAM_SUCCESS;
}
private static IntPtr WriteResponses(IReadOnlyList<IPamResponse> responses)
{
var responseSize = Marshal.SizeOf<BinaryResponseContainer>();
var responseArraySize = responseSize * responses.Count;
var responseArray = Marshal.AllocHGlobal(responseArraySize);
for (var i = 0; i != responses.Count; ++i)
{
var response = responses[i];
response.WriteTo(responseArray + (responseSize * i));
}
return responseArray;
}
/// <summary>
/// Sends the messages to the <see cref="IPamMessageHandler"/>.
/// </summary>
/// <param name="messages">The messages to process.</param>
/// <param name="messageHandler">The message handler that gets the messages.</param>
/// <returns>The responses for the messages.</returns>
private static IEnumerable<IPamResponse> ProcessMessages(IEnumerable<IPamMessage> messages, IPamMessageHandler messageHandler)
{
foreach (var message in messages)
{
switch (message)
{
case PamMessage<string> msg when msg.MessageStyle == PamMessageStyle.PAM_TEXT_INFO:
yield return new PamNoResponse(messageHandler.TextInfo(msg.Payload));
break;
case PamMessage<string> msg when msg.MessageStyle == PamMessageStyle.PAM_ERROR_MSG:
yield return new PamNoResponse(messageHandler.ErrorMsg(msg.Payload));
break;
case PamMessage<string> msg when msg.MessageStyle == PamMessageStyle.PAM_PROMPT_ECHO_OFF:
yield return new PamTextResponse(messageHandler.PromptEchoOff(msg.Payload));
break;
case PamMessage<string> msg when msg.MessageStyle == PamMessageStyle.PAM_PROMPT_ECHO_ON:
yield return new PamTextResponse(messageHandler.PromptEchoOn(msg.Payload));
break;
case PamMessage<string> msg when msg.MessageStyle == PamMessageStyle.PAM_RADIO_TYPE:
yield return new PamTextResponse(messageHandler.RadioType(msg.Payload));
break;
case PamMessage<PamBinaryData> msg when msg.MessageStyle == PamMessageStyle.PAM_BINARY_PROMPT:
yield return new PamBinaryResponse(messageHandler.BinaryPrompt(msg.Payload));
break;
default:
throw new NotSupportedException($"Message style {message.MessageStyle.ToString()} not supported.");
}
}
}
/// <summary>
/// Deserializes all messages.
/// </summary>
/// <param name="messageCount">The number of messages to deserialize.</param>
/// <param name="messages">The pointer to the messages.</param>
/// <returns>A list of messages read from <paramref name="messages"/>.</returns>
private static unsafe IReadOnlyList<IPamMessage> ReadMessages(int messageCount, IntPtr messages)
{
var result = new List<IPamMessage>();
for (var i = 0; i != messageCount; ++i)
{
var messagePtrPtr = messages + (i * IntPtr.Size);
var message = *(PamMessage**)messagePtrPtr;
var messageStyle = message->MsgStyle;
switch (messageStyle)
{
case PamMessageStyle.PAM_TEXT_INFO:
result.Add(ReadTextInfo(message, payload => new PamTextInfoMessage(payload)));
break;
case PamMessageStyle.PAM_ERROR_MSG:
result.Add(ReadTextInfo(message, payload => new PamErrorMessage(payload)));
break;
case PamMessageStyle.PAM_PROMPT_ECHO_OFF:
result.Add(ReadTextInfo(message, payload => new PamPromptEchoOffMessage(payload)));
break;
case PamMessageStyle.PAM_PROMPT_ECHO_ON:
result.Add(ReadTextInfo(message, payload => new PamPromptEchoOnMessage(payload)));
break;
case PamMessageStyle.PAM_RADIO_TYPE:
result.Add(ReadTextInfo(message, payload => new PamRadioTypeMessage(payload)));
break;
case PamMessageStyle.PAM_BINARY_PROMPT:
result.Add(ReadBinaryInfo(message));
break;
default:
throw new NotSupportedException($"Message style {messageStyle.ToString()} not supported.");
}
}
return result;
}
private static unsafe IPamMessage ReadBinaryInfo(PamMessage* messagePtr)
{
var binaryPtr = messagePtr->Message;
var binary = (PamBinaryMessageData*)binaryPtr;
var length = IPAddress.NetworkToHostOrder((int)binary->Length);
var control = binary->Type;
var data = new byte[length - 5];
Marshal.Copy(binaryPtr + 5, data, 0, length - 5);
return new PamBinaryPromptMessage(control, data);
}
private static unsafe IPamMessage ReadTextInfo(PamMessage* messagePtr, Func<string, IPamMessage> createMessageFunc)
{
var text = Marshal.PtrToStringUTF8(messagePtr->Message) ?? string.Empty;
return createMessageFunc(text);
}
private static void WriteTextResponse(IntPtr dest, string? message)
{
var response = new TextResponseContainer(message);
Marshal.StructureToPtr(response, dest, false);
}
private static unsafe void WriteBinaryResponse(IntPtr dest, byte control, ReadOnlyMemory<byte> data)
{
var totalLength = data.Length + 5;
var binaryBuffer = Marshal.AllocHGlobal(totalLength);
var bufferSpan = new Span<byte>(binaryBuffer.ToPointer(), totalLength);
var lengthBytes = BitConverter.GetBytes(IPAddress.HostToNetworkOrder(totalLength));
lengthBytes.AsSpan().CopyTo(bufferSpan);
bufferSpan[4] = control;
data.Span.CopyTo(bufferSpan.Slice(5));
var response = new BinaryResponseContainer(binaryBuffer);
Marshal.StructureToPtr(response, dest, false);
}
private class PamNoResponse : IPamResponse
{
public PamNoResponse(PamStatus status)
{
Status = status;
}
public PamStatus Status { get; }
public void WriteTo(IntPtr dest)
{
WriteTextResponse(dest, null);
}
}
private class PamTextResponse : IPamResponse
{
private readonly PamResponse<string> _response;
public PamTextResponse(PamResponse<string> response)
{
_response = response;
}
public PamStatus Status => _response.Status;
public void WriteTo(IntPtr dest)
{
WriteTextResponse(dest, _response.Payload);
}
}
private class PamBinaryResponse : IPamResponse
{
private readonly PamResponse<PamBinaryData> _response;
public PamBinaryResponse(PamResponse<PamBinaryData> response)
{
_response = response;
}
public PamStatus Status => _response.Status;
public void WriteTo(IntPtr dest)
{
WriteBinaryResponse(dest, _response.Payload.Type, _response.Payload.Data);
}
}
}
}
| 41.338912 | 134 | 0.583198 | [
"MIT"
] | FubarDevelopment/PamSharp | src/FubarDev.PamSharp/PamConversationHandler.cs | 9,880 | C# |
using System.ComponentModel.DataAnnotations;
namespace CleanArchitectureApp.Application.DTOs.Authentication
{
public class RevokeTokenRequest
{
[Required(ErrorMessage = "Token is Required")]
public virtual string Token { get; set; }
}
} | 26.6 | 62 | 0.721805 | [
"MIT"
] | iamstan13y/CleanArchitectureApp | CleanArchitectureApp.Application/DTOs/Authentication/RevokeTokenRequest.cs | 266 | C# |
[CompilerGeneratedAttribute] // RVA: 0x159690 Offset: 0x159791 VA: 0x159690
private sealed class SystemTextGenerator.<impl_AddSystemMessage>d__6 : IEnumerator<object>, IEnumerator, IDisposable // TypeDefIndex: 8754
{
// Fields
private int <>1__state; // 0x10
private object <>2__current; // 0x18
public SystemTextGenerator <>4__this; // 0x20
public string text; // 0x28
// Properties
private object System.Collections.Generic.IEnumerator<System.Object>.Current { get; }
private object System.Collections.IEnumerator.Current { get; }
// Methods
[DebuggerHiddenAttribute] // RVA: 0x1B4660 Offset: 0x1B4761 VA: 0x1B4660
// RVA: 0x1C69C10 Offset: 0x1C69D11 VA: 0x1C69C10
public void .ctor(int <>1__state) { }
[DebuggerHiddenAttribute] // RVA: 0x1B4670 Offset: 0x1B4771 VA: 0x1B4670
// RVA: 0x1C69F20 Offset: 0x1C6A021 VA: 0x1C69F20 Slot: 5
private void System.IDisposable.Dispose() { }
// RVA: 0x1C69F30 Offset: 0x1C6A031 VA: 0x1C69F30 Slot: 6
private bool MoveNext() { }
[DebuggerHiddenAttribute] // RVA: 0x1B4680 Offset: 0x1B4781 VA: 0x1B4680
// RVA: 0x1C6A0C0 Offset: 0x1C6A1C1 VA: 0x1C6A0C0 Slot: 4
private object System.Collections.Generic.IEnumerator<System.Object>.get_Current() { }
[DebuggerHiddenAttribute] // RVA: 0x1B4690 Offset: 0x1B4791 VA: 0x1B4690
// RVA: 0x1C6A0D0 Offset: 0x1C6A1D1 VA: 0x1C6A0D0 Slot: 8
private void System.Collections.IEnumerator.Reset() { }
[DebuggerHiddenAttribute] // RVA: 0x1B46A0 Offset: 0x1B47A1 VA: 0x1B46A0
// RVA: 0x1C6A130 Offset: 0x1C6A231 VA: 0x1C6A130 Slot: 7
private object System.Collections.IEnumerator.get_Current() { }
}
| 40.125 | 138 | 0.757632 | [
"MIT"
] | SinsofSloth/RF5-global-metadata | _no_namespace/SystemTextGenerator.--impl_AddSystemMessage--d__6.cs | 1,605 | C# |
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://floralicense.org/license/
*
* 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 Xamarin.Forms;
namespace Tizen.Wearable.CircularUI.Forms
{
/// <summary>
/// FlatViewCell contains a developer-defined Xamarin.Forms.View.
/// It has no fish-eye effect while ViewCell has fish-eye effect.
/// </summary>
public class FlatViewCell : ViewCell
{
}
}
| 32.862069 | 76 | 0.695698 | [
"SHL-0.51"
] | Samsung/Tizen.CircularUI | src/Tizen.Wearable.CircularUI.Forms/FlatViewCell.cs | 955 | C# |
namespace NEventStore
{
using System.Collections.Generic;
public sealed class CommitEqualityComparer : IEqualityComparer<ICommit>
{
public bool Equals(ICommit x, ICommit y)
{
if (ReferenceEquals(x, y))
{
return true;
}
if (ReferenceEquals(x, null))
{
return false;
}
if (ReferenceEquals(y, null))
{
return false;
}
if (x.GetType() != y.GetType())
{
return false;
}
return string.Equals(x.BucketId, y.BucketId) && string.Equals(x.StreamId, y.StreamId) && string.Equals(x.CommitId, y.CommitId) ;
}
public int GetHashCode(ICommit obj)
{
unchecked
{
int hashCode = (obj.BucketId != null ? obj.BucketId.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (obj.StreamId != null ? obj.StreamId.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ obj.CommitId.GetHashCode();
return hashCode;
}
}
}
} | 30.076923 | 140 | 0.480818 | [
"MIT"
] | 9swampy/NEventStore | src/NEventStore/CommitEqualityComparer.cs | 1,173 | C# |
/*****************************************************************************
* Copyright 2016 Aurora Solutions
*
* http://www.aurorasolutions.io
*
* Aurora Solutions is an innovative services and product company at
* the forefront of the software industry, with processes and practices
* involving Domain Driven Design(DDD), Agile methodologies to build
* scalable, secure, reliable and high performance products.
*
* TradeSharp is a C# based data feed and broker neutral Algorithmic
* Trading Platform that lets trading firms or individuals automate
* any rules based trading strategies in stocks, forex and ETFs.
* TradeSharp allows users to connect to providers like Tradier Brokerage,
* IQFeed, FXCM, Blackwood, Forexware, Integral, HotSpot, Currenex,
* Interactive Brokers and more.
* Key features: Place and Manage Orders, Risk Management,
* Generate Customized Reports etc
*
* 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TradeHub.Common.Core.DomainModels;
using TradeHub.Common.Core.DomainModels.OrderDomain;
using TradeHub.Common.Core.ValueObjects.MarketData;
namespace TradeHub.SimulatedExchange.Common.Interfaces
{
/// <summary>
/// Interface to be implemented by class responsible for communication with connecting modules
/// </summary>
public interface ICommunicationController
{
event Action MarketDataLoginRequest;
event Action MarketDataLogoutRequest;
event Action OrderExecutionLoginRequest;
event Action OrderExecutionLogoutRequest;
event Action<Subscribe> TickDataRequest;
event Action<BarDataRequest> BarDataRequest;
event Action<HistoricDataRequest> HistoricDataRequest;
event Action<MarketOrder> MarketOrderRequest;
event Action<LimitOrder> LimitOrderRequest;
/// <summary>
/// Starts MQ Server
/// </summary>
void Connect();
/// <summary>
/// Stop MQ Server
/// </summary>
void Disconnect();
/// <summary>
/// Publishes Admin Level request response for Market Data
/// </summary>
void PublishMarketAdminMessageResponse(string response);
/// <summary>
/// Publishes Admin Level request response for Order Executions
/// </summary>
void PublishOrderAdminMessageResponse(string response);
/// <summary>
/// Publishes Tick Data
/// </summary>
void PublishTickData(Tick tick);
/// <summary>
/// Publishes Bar Data
/// </summary>
void PublishBarData(Bar bar);
/// <summary>
/// Publishes Bar Data
/// </summary>
void PublishHistoricData(HistoricBarData historicBarData);
/// <summary>
/// Publishes New Order status message
/// </summary>
void PublishNewOrder(Order order);
/// <summary>
/// Publishes Order Rejection
/// </summary>
void PublishOrderRejection(Rejection rejection);
/// <summary>
/// Publishes Order Executions
/// </summary>
void PublishExecutionOrder(Execution execution);
}
}
| 34.900901 | 98 | 0.654879 | [
"Apache-2.0"
] | TradeNexus/tradesharp-core | Backend/Simulator/TradeHub.SimulatedExchange.Common/Interfaces/ICommunicationController.cs | 3,876 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TreasureGuide.Entities
{
using System;
using System.Collections.Generic;
public partial class Notification
{
public int Id { get; set; }
public string UserId { get; set; }
public NotificationEventType EventType { get; set; }
public Nullable<int> EventId { get; set; }
public System.DateTimeOffset ReceivedDate { get; set; }
public virtual UserProfile UserProfile { get; set; }
}
}
| 34.346154 | 85 | 0.543113 | [
"MIT"
] | NakamaNetwork/nakama.legacy | Source/TreasureGuide.Entities/Notification.cs | 893 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ProvideApplicationPartFactoryAttribute("Microsoft.AspNetCore.Mvc.ApplicationParts.CompiledRazorAssemblyApplicationPartFac" +
"tory, Microsoft.AspNetCore.Mvc.Razor")]
[assembly: System.Reflection.AssemblyCompanyAttribute("RandomPasscode")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyProductAttribute("RandomPasscode")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyTitleAttribute("RandomPasscode.Views")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
| 47.28 | 177 | 0.691201 | [
"MIT"
] | ZhouSusan/CodingDojoCSharp | c#_.Net_Core/ASP_Net/RandomPasscode/obj/Debug/netcoreapp3.1/RandomPasscode.RazorTargetAssemblyInfo.cs | 1,182 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GobangClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
| 39.518519 | 151 | 0.582006 | [
"MIT"
] | D15190304050/WpfGames | GobangClient/Properties/Settings.Designer.cs | 1,069 | C# |
#region Apache License
//
// 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.
//
#endregion
using System;
using System.Collections;
using log4net.Core;
namespace log4net.Appender
{
/// <summary>
/// Stores logging events in an array.
/// </summary>
/// <remarks>
/// <para>
/// The memory appender stores all the logging events
/// that are appended in an in-memory array.
/// </para>
/// <para>
/// Use the <see cref="M:PopAllEvents()"/> method to get
/// and clear the current list of events that have been appended.
/// </para>
/// <para>
/// Use the <see cref="M:GetEvents()"/> method to get the current
/// list of events that have been appended. Note there is a
/// race-condition when calling <see cref="M:GetEvents()"/> and
/// <see cref="M:Clear()"/> in pairs, you better use <see
/// mref="M:PopAllEvents()"/> in that case.
/// </para>
/// <para>
/// Use the <see cref="M:Clear()"/> method to clear the
/// current list of events. Note there is a
/// race-condition when calling <see cref="M:GetEvents()"/> and
/// <see cref="M:Clear()"/> in pairs, you better use <see
/// mref="M:PopAllEvents()"/> in that case.
/// </para>
/// </remarks>
/// <author>Julian Biddle</author>
/// <author>Nicko Cadell</author>
/// <author>Gert Driesen</author>
public class MemoryAppender : AppenderSkeleton
{
#region Public Instance Constructors
/// <summary>
/// Initializes a new instance of the <see cref="MemoryAppender" /> class.
/// </summary>
/// <remarks>
/// <para>
/// Default constructor.
/// </para>
/// </remarks>
public MemoryAppender() : base()
{
m_eventsList = new ArrayList();
}
#endregion Protected Instance Constructors
#region Public Instance Properties
/// <summary>
/// Gets the events that have been logged.
/// </summary>
/// <returns>The events that have been logged</returns>
/// <remarks>
/// <para>
/// Gets the events that have been logged.
/// </para>
/// </remarks>
virtual public LoggingEvent[] GetEvents()
{
lock (m_eventsList.SyncRoot)
{
return (LoggingEvent[]) m_eventsList.ToArray(typeof(LoggingEvent));
}
}
/// <summary>
/// Gets or sets a value indicating whether only part of the logging event
/// data should be fixed.
/// </summary>
/// <value>
/// <c>true</c> if the appender should only fix part of the logging event
/// data, otherwise <c>false</c>. The default is <c>false</c>.
/// </value>
/// <remarks>
/// <para>
/// Setting this property to <c>true</c> will cause only part of the event
/// data to be fixed and stored in the appender, hereby improving performance.
/// </para>
/// <para>
/// See <see cref="M:LoggingEvent.FixVolatileData(bool)"/> for more information.
/// </para>
/// </remarks>
[Obsolete("Use Fix property. Scheduled removal in v10.0.0.")]
virtual public bool OnlyFixPartialEventData
{
get { return (Fix == FixFlags.Partial); }
set
{
if (value)
{
Fix = FixFlags.Partial;
}
else
{
Fix = FixFlags.All;
}
}
}
/// <summary>
/// Gets or sets the fields that will be fixed in the event
/// </summary>
/// <remarks>
/// <para>
/// The logging event needs to have certain thread specific values
/// captured before it can be buffered. See <see cref="LoggingEvent.Fix"/>
/// for details.
/// </para>
/// </remarks>
virtual public FixFlags Fix
{
get { return m_fixFlags; }
set { m_fixFlags = value; }
}
#endregion Public Instance Properties
#region Override implementation of AppenderSkeleton
/// <summary>
/// This method is called by the <see cref="M:AppenderSkeleton.DoAppend(LoggingEvent)"/> method.
/// </summary>
/// <param name="loggingEvent">the event to log</param>
/// <remarks>
/// <para>Stores the <paramref name="loggingEvent"/> in the events list.</para>
/// </remarks>
override protected void Append(LoggingEvent loggingEvent)
{
// Because we are caching the LoggingEvent beyond the
// lifetime of the Append() method we must fix any
// volatile data in the event.
loggingEvent.Fix = this.Fix;
lock (m_eventsList.SyncRoot)
{
m_eventsList.Add(loggingEvent);
}
}
#endregion Override implementation of AppenderSkeleton
#region Public Instance Methods
/// <summary>
/// Clear the list of events
/// </summary>
/// <remarks>
/// Clear the list of events
/// </remarks>
virtual public void Clear()
{
lock (m_eventsList.SyncRoot)
{
m_eventsList.Clear();
}
}
/// <summary>
/// Gets the events that have been logged and clears the list of events.
/// </summary>
/// <returns>The events that have been logged</returns>
/// <remarks>
/// <para>
/// Gets the events that have been logged and clears the list of events.
/// </para>
/// </remarks>
virtual public LoggingEvent[] PopAllEvents()
{
lock (m_eventsList.SyncRoot)
{
LoggingEvent[] tmp = (LoggingEvent[]) m_eventsList.ToArray(typeof (LoggingEvent));
m_eventsList.Clear();
return tmp;
}
}
#endregion Public Instance Methods
#region Protected Instance Fields
/// <summary>
/// The list of events that have been appended.
/// </summary>
protected ArrayList m_eventsList;
/// <summary>
/// Value indicating which fields in the event should be fixed
/// </summary>
/// <remarks>
/// By default all fields are fixed
/// </remarks>
protected FixFlags m_fixFlags = FixFlags.All;
#endregion Protected Instance Fields
}
}
| 28.880531 | 99 | 0.629845 | [
"MIT"
] | PersianDnn/Dnn.Platform | DNN Platform/DotNetNuke.Log4net/log4net/Appender/MemoryAppender.cs | 6,527 | C# |
using System.Web;
using System.Web.Mvc;
namespace RottenReviewsWeb
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
| 19.214286 | 80 | 0.66171 | [
"MIT"
] | 1804-Apr-USFdotnet/john-dominguez-project1 | RottenReviews/RottenReviewsWeb/App_Start/FilterConfig.cs | 271 | 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("AWSSDK.ApiGatewayManagementApi")]
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - AmazonApiGatewayManagementApi. This is the initial SDK release for the Amazon API Gateway Management API, which allows you to directly manage runtime aspects of your APIs. This release makes it easy to send data directly to clients connected to your WebSocket-based APIs.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[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)]
// 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("3.3")]
[assembly: AssemblyFileVersion("3.7.0.65")] | 50.875 | 351 | 0.759828 | [
"Apache-2.0"
] | wdolek/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/ApiGatewayManagementApi/Properties/AssemblyInfo.cs | 1,628 | C# |
using System;
using System.Xml;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// The list of a Tableau Server Site's groups we have downloaded
/// </summary>
class DownloadGroupsList : TableauServerSignedInRequestBase
{
/// <summary>
/// URL manager
/// </summary>
private readonly TableauServerUrls _onlineUrls;
/// <summary>
/// Groups we've parsed from server results
/// </summary>
private List<SiteGroup> _groups;
public IEnumerable<SiteGroup> Groups
{
get
{
var ds = _groups;
if (ds == null) return null;
return ds.AsReadOnly();
}
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="onlineUrls"></param>
/// <param name="login"></param>
public DownloadGroupsList(TableauServerUrls onlineUrls, TableauServerSignIn login)
: base(login)
{
_onlineUrls = onlineUrls;
}
/// <summary>
/// Request the data from Online
/// </summary>
/// <param name="serverName"></param>
public void ExecuteRequest()
{
var siteGroups = new List<SiteGroup>();
int numberPages = 1; //Start with 1 page (we will get an updated value from server)
//Get subsequent pages
for (int thisPage = 1; thisPage <= numberPages; thisPage++)
{
try
{
ExecuteRequest_ForPage(siteGroups, thisPage, out numberPages);
}
catch (Exception exPageRequest)
{
StatusLog.AddError("Groups error during page request: " + exPageRequest.Message);
}
}
_groups = siteGroups;
}
/// <summary>
/// Get a page's worth of Groups
/// </summary>
/// <param name="onlineGroups"></param>
/// <param name="pageToRequest">Page # we are requesting (1 based)</param>
/// <param name="totalNumberPages">Total # of pages of data that Server can return us</param>
private void ExecuteRequest_ForPage(
List<SiteGroup> onlineGroups,
int pageToRequest,
out int totalNumberPages)
{
int pageSize = _onlineUrls.PageSize;
//Create a web request, in including the users logged-in auth information in the request headers
var urlQuery = _onlineUrls.Url_GroupsList(_onlineSession, pageSize, pageToRequest);
var webRequest = CreateLoggedInWebRequest(urlQuery);
webRequest.Method = "GET";
_onlineSession.StatusLog.AddStatus("Web request: " + urlQuery, -10);
var response = GetWebReponseLogErrors(webRequest, "get groups list");
var xmlDoc = GetWebResponseAsXml(response);
//Get all the group nodes
var nsManager = XmlHelper.CreateTableauXmlNamespaceManager("iwsOnline");
var groups = xmlDoc.SelectNodes("//iwsOnline:group", nsManager);
//Get information for each of the data sources
foreach (XmlNode itemXml in groups)
{
SiteGroup thisGroup = null;
try
{
thisGroup = new SiteGroup(
itemXml,
null); //We'll get and add the list of users later (see below)
onlineGroups.Add(thisGroup);
SanityCheckGroup(thisGroup, itemXml);
}
catch(Exception exGetGroup)
{
AppDiagnostics.Assert(false, "Group parse error");
_onlineSession.StatusLog.AddError("Error parsing group: " + itemXml.OuterXml + ", " + exGetGroup.Message);
}
//==============================================================
//Get the set of users in the group
//==============================================================
if (thisGroup != null)
{
try
{
var downloadUsersInGroup = new DownloadUsersListInGroup(
_onlineUrls,
_onlineSession,
thisGroup.Id);
downloadUsersInGroup.ExecuteRequest();
thisGroup.AddUsers(downloadUsersInGroup.Users);
}
catch (Exception exGetUsers)
{
_onlineSession.StatusLog.AddError("Error parsing group's users: " + exGetUsers.Message);
}
}
} //end: foreach
//-------------------------------------------------------------------
//Get the updated page-count
//-------------------------------------------------------------------
totalNumberPages = DownloadPaginationHelper.GetNumberOfPagesFromPagination(
xmlDoc.SelectSingleNode("//iwsOnline:pagination", nsManager),
pageSize);
}
/// <summary>
/// Does sanity checking and error logging on missing data in groups
/// </summary>
/// <param name="group"></param>
private void SanityCheckGroup(SiteGroup group, XmlNode xmlNode)
{
if(string.IsNullOrWhiteSpace(group.Id))
{
_onlineSession.StatusLog.AddError(group.Name + " is missing a group ID. Not returned from server! xml=" + xmlNode.OuterXml);
}
}
/// <summary>
/// Finds a group with matching name
/// </summary>
/// <param name="findName"></param>
/// <returns></returns>
public SiteGroup FindGroupWithName(string findName)
{
foreach(var thisGroup in _groups)
{
if (thisGroup.Name == findName)
{
return thisGroup;
}
}
return null; //Not found
}
/// <summary>
///
/// </summary>
/// <param name="groupId"></param>
/// <returns></returns>
SiteGroup FindGroupWithId(string groupId)
{
foreach(var thisGroup in _groups)
{
if (thisGroup.Id == groupId) { return thisGroup; }
}
return null;
}
/// <summary>
/// Adds to the list
/// </summary>
/// <param name="newGroup"></param>
internal void AddGroup(SiteGroup newGroup)
{
_groups.Add(newGroup);
}
}
| 31.48731 | 136 | 0.5399 | [
"MIT"
] | BiniamD/TabMigrate | TabRESTMigrate/RESTRequests/DownloadGroupsList.cs | 6,205 | C# |
// This file is part of Silk.NET.
//
// You may modify and distribute Silk.NET under the terms
// of the MIT license. See the LICENSE file for details.
using System;
using System.Runtime.InteropServices;
using System.Text;
using Silk.NET.OpenGL;
using Silk.NET.Core.Loader;
using Silk.NET.Core.Native;
using Silk.NET.Core.Attributes;
using Ultz.SuperInvoke;
#pragma warning disable 1591
namespace Silk.NET.OpenGL.Extensions.NV
{
[Extension("NV_bindless_multi_draw_indirect_count")]
public abstract unsafe partial class NVBindlessMultiDrawIndirectCount : NativeExtension<GL>
{
public const string ExtensionName = "NV_bindless_multi_draw_indirect_count";
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawArraysIndirectBindlessCountNV")]
public abstract unsafe void MultiDrawArraysIndirectBindlessCount([Flow(FlowDirection.In)] NV mode, [Flow(FlowDirection.In)] void* indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount);
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawArraysIndirectBindlessCountNV")]
public abstract void MultiDrawArraysIndirectBindlessCount<T0>([Flow(FlowDirection.In)] NV mode, [Flow(FlowDirection.In)] Span<T0> indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount) where T0 : unmanaged;
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="type">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawElementsIndirectBindlessCountNV")]
public abstract unsafe void MultiDrawElementsIndirectBindlessCount([Flow(FlowDirection.In)] NV mode, [Flow(FlowDirection.In)] NV type, [Flow(FlowDirection.In)] void* indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount);
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="type">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawElementsIndirectBindlessCountNV")]
public abstract void MultiDrawElementsIndirectBindlessCount<T0>([Flow(FlowDirection.In)] NV mode, [Flow(FlowDirection.In)] NV type, [Flow(FlowDirection.In)] Span<T0> indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount) where T0 : unmanaged;
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawArraysIndirectBindlessCountNV")]
public abstract unsafe void MultiDrawArraysIndirectBindlessCount([Flow(FlowDirection.In)] PrimitiveType mode, [Flow(FlowDirection.In)] void* indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount);
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawArraysIndirectBindlessCountNV")]
public abstract void MultiDrawArraysIndirectBindlessCount<T0>([Flow(FlowDirection.In)] PrimitiveType mode, [Flow(FlowDirection.In)] Span<T0> indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount) where T0 : unmanaged;
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="type">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawElementsIndirectBindlessCountNV")]
public abstract unsafe void MultiDrawElementsIndirectBindlessCount([Flow(FlowDirection.In)] PrimitiveType mode, [Flow(FlowDirection.In)] DrawElementsType type, [Flow(FlowDirection.In)] void* indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount);
/// <summary>
/// To be added.
/// </summary>
/// <param name="mode">
/// To be added.
/// </param>
/// <param name="type">
/// To be added.
/// </param>
/// <param name="indirect">
/// To be added.
/// </param>
/// <param name="drawCount">
/// To be added.
/// </param>
/// <param name="maxDrawCount">
/// To be added.
/// </param>
/// <param name="stride">
/// To be added.
/// </param>
/// <param name="vertexBufferCount">
/// To be added.
/// </param>
[NativeApi(EntryPoint = "glMultiDrawElementsIndirectBindlessCountNV")]
public abstract void MultiDrawElementsIndirectBindlessCount<T0>([Flow(FlowDirection.In)] PrimitiveType mode, [Flow(FlowDirection.In)] DrawElementsType type, [Flow(FlowDirection.In)] Span<T0> indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount) where T0 : unmanaged;
public NVBindlessMultiDrawIndirectCount(ref NativeApiContext ctx)
: base(ref ctx)
{
}
}
}
| 39.360515 | 401 | 0.563406 | [
"MIT"
] | AzyIsCool/Silk.NET | src/OpenGL/Extensions/Silk.NET.OpenGL.Extensions.NV/NVBindlessMultiDrawIndirectCount.gen.cs | 9,171 | C# |
using System;
using System.Threading;
using System.Threading.Tasks;
using Cemiyet.Core.Exceptions;
using Cemiyet.Persistence.Application.Contexts;
using MediatR;
namespace Cemiyet.Application.Commands.Authors
{
public class DeleteOneCommandHandler : IRequestHandler<DeleteOneCommand>
{
private readonly AppDataContext _context;
public DeleteOneCommandHandler(AppDataContext context)
{
_context = context;
}
public async Task<Unit> Handle(DeleteOneCommand request, CancellationToken cancellationToken)
{
var author = await _context.Authors.FindAsync(request.Id);
if (author == null)
throw new AuthorNotFoundException(request.Id);
_context.Remove(author);
var success = await _context.SaveChangesAsync(cancellationToken) > 0;
if (success) return Unit.Value;
throw new Exception("Problem saving changes.");
}
}
}
| 27.388889 | 101 | 0.673428 | [
"Apache-2.0"
] | cemiyet/backend | src/Cemiyet.Application/Commands/Authors/DeleteOneCommandHandler.cs | 986 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BulkDeleteCommand.cs" company="Kephas Software SRL">
// Copyright (c) Kephas Software SRL. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// <summary>
// Implements the bulk delete command class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Kephas.Data.Commands
{
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Kephas.Diagnostics.Contracts;
using Kephas.Logging;
using Kephas.Reflection;
using Kephas.Threading.Tasks;
/// <summary>
/// Base class for bulk delete commands.
/// </summary>
[DataContextType(typeof(DataContextBase))]
public class BulkDeleteCommand : BulkOperationCommandBase<IBulkDeleteContext, IBulkDataOperationResult>, IBulkDeleteCommand
{
/// <summary>
/// Gets the generic method of <see cref="BulkDeleteAsync{T}"/>.
/// </summary>
private static readonly MethodInfo BulkDeleteAsyncMethod =
ReflectionHelper.GetGenericMethodOf(_ => ((BulkDeleteCommand)null!).BulkDeleteAsync<string>(default, default));
/// <summary>
/// Initializes a new instance of the <see cref="BulkDeleteCommand"/> class.
/// </summary>
/// <param name="logManager">Optional. Manager for log.</param>
public BulkDeleteCommand(ILogManager? logManager = null)
: base(logManager)
{
}
/// <summary>
/// Executes the data command asynchronously.
/// </summary>
/// <param name="operationContext">The operation context.</param>
/// <param name="cancellationToken">Optional. The cancellation token.</param>
/// <returns>
/// A promise of a <see cref="IBulkDataOperationResult"/>.
/// </returns>
public override async Task<IBulkDataOperationResult> ExecuteAsync(IBulkDeleteContext operationContext, CancellationToken cancellationToken = default)
{
operationContext = operationContext ?? throw new ArgumentNullException(nameof(operationContext));
Requires.NotNull(operationContext.DataContext, nameof(operationContext.DataContext));
Requires.NotNull(operationContext.EntityType, nameof(operationContext.EntityType));
Requires.NotNull(operationContext.Criteria, nameof(operationContext.Criteria));
var opAsync = BulkDeleteAsyncMethod.MakeGenericMethod(operationContext.EntityType);
var asyncResult = (Task<IBulkDataOperationResult>)opAsync.Call(this, operationContext, cancellationToken);
var result = await asyncResult.PreserveThreadContext();
return result;
}
/// <summary>
/// Deletes the entities matching the provided criteria and returns the number of affected entities.
/// </summary>
/// <typeparam name="T">The type of the entity.</typeparam>
/// <param name="bulkDeleteContext">The bulk delete context.</param>
/// <param name="cancellationToken">Optional. The cancellation token.</param>
/// <returns>
/// A promise of the number of deleted entities.
/// </returns>
protected virtual async Task<IBulkDataOperationResult> BulkDeleteAsync<T>(
IBulkDeleteContext bulkDeleteContext,
CancellationToken cancellationToken)
where T : class
{
var dataContext = bulkDeleteContext.DataContext;
var criteria = this.GetMatchingCriteria<T>(bulkDeleteContext);
var localCache = this.TryGetLocalCache(dataContext);
var localCacheCount = 0L;
if (localCache != null)
{
var compiledCriteria = criteria.Compile();
var toDeleteFromCache = localCache.Values.Where(v => v.Entity is T entity && compiledCriteria(entity)).ToList();
toDeleteFromCache.ForEach(p => localCache.Remove(p));
localCacheCount = toDeleteFromCache.Count;
}
var count = await this.BulkDeleteCoreAsync(bulkDeleteContext, criteria, cancellationToken).PreserveThreadContext();
return this.GetBulkOperationResult(bulkDeleteContext, count, localCacheCount, criteria);
}
/// <summary>
/// Deletes the entities matching the provided criteria and returns the number of affected entities.
/// </summary>
/// <typeparam name="T">The type of the entity.</typeparam>
/// <param name="bulkDeleteContext">The bulk delete context.</param>
/// <param name="criteria">The criteria for finding the entities to operate on.</param>
/// <param name="cancellationToken">Optional. The cancellation token.</param>
/// <returns>
/// A promise of the number of deleted entities.
/// </returns>
protected virtual Task<long> BulkDeleteCoreAsync<T>(
IBulkDeleteContext bulkDeleteContext,
Expression<Func<T, bool>> criteria,
CancellationToken cancellationToken)
where T : class
{
throw new NotSupportedException(
$"The {nameof(BulkDeleteCommand)}.{nameof(this.BulkDeleteCoreAsync)}(context, criteria, cancellationToken) must be overridden to provide a meaningful execution.");
}
}
} | 48.220339 | 179 | 0.630228 | [
"MIT"
] | kephas-software/kephas | src/Kephas.Data/Commands/BulkDeleteCommand.cs | 5,692 | C# |
using System;
using System.Collections.Generic;
using NHapi.Base.Log;
using NHapi.Model.V231.Group;
using NHapi.Model.V231.Segment;
using NHapi.Model.V231.Datatype;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V231.Message
{
///<summary>
/// Represents a RQC_I06 message structure (see chapter [AAA]). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (MSH - message header segment) </li>
///<li>1: QRD (QRD - original-style query definition segment) </li>
///<li>2: QRF (QRF - original style query filter segment) optional </li>
///<li>3: RQC_I06_PROVIDER (a Group object) repeating</li>
///<li>4: PID (PID - patient identification segment) </li>
///<li>5: NK1 (NK1 - next of kin / associated parties segment-) optional repeating</li>
///<li>6: GT1 (GT1 - guarantor segment) optional </li>
///<li>7: NTE (NTE - notes and comments segment) optional repeating</li>
///</ol>
///</summary>
[Serializable]
public class RQC_I06 : AbstractMessage {
///<summary>
/// Creates a new RQC_I06 Group with custom IModelClassFactory.
///</summary>
public RQC_I06(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new RQC_I06 Group with DefaultModelClassFactory.
///</summary>
public RQC_I06() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for RQC_I06. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(QRD), true, false);
this.add(typeof(QRF), false, false);
this.add(typeof(RQC_I06_PROVIDER), true, true);
this.add(typeof(PID), true, false);
this.add(typeof(NK1), false, true);
this.add(typeof(GT1), false, false);
this.add(typeof(NTE), false, true);
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RQC_I06 - this is probably a bug in the source code generator.", e);
}
}
public override string Version
{
get{
return Constants.VERSION;
}
}
///<summary>
/// Returns MSH (MSH - message header segment) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns QRD (QRD - original-style query definition segment) - creates it if necessary
///</summary>
public QRD QRD {
get{
QRD ret = null;
try {
ret = (QRD)this.GetStructure("QRD");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns QRF (QRF - original style query filter segment) - creates it if necessary
///</summary>
public QRF QRF {
get{
QRF ret = null;
try {
ret = (QRF)this.GetStructure("QRF");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of RQC_I06_PROVIDER (a Group object) - creates it if necessary
///</summary>
public RQC_I06_PROVIDER GetPROVIDER() {
RQC_I06_PROVIDER ret = null;
try {
ret = (RQC_I06_PROVIDER)this.GetStructure("PROVIDER");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of RQC_I06_PROVIDER
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public RQC_I06_PROVIDER GetPROVIDER(int rep) {
return (RQC_I06_PROVIDER)this.GetStructure("PROVIDER", rep);
}
/**
* Returns the number of existing repetitions of RQC_I06_PROVIDER
*/
public int PROVIDERRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("PROVIDER").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the RQC_I06_PROVIDER results
*/
public IEnumerable<RQC_I06_PROVIDER> PROVIDERs
{
get
{
for (int rep = 0; rep < PROVIDERRepetitionsUsed; rep++)
{
yield return (RQC_I06_PROVIDER)this.GetStructure("PROVIDER", rep);
}
}
}
///<summary>
///Adds a new RQC_I06_PROVIDER
///</summary>
public RQC_I06_PROVIDER AddPROVIDER()
{
return this.AddStructure("PROVIDER") as RQC_I06_PROVIDER;
}
///<summary>
///Removes the given RQC_I06_PROVIDER
///</summary>
public void RemovePROVIDER(RQC_I06_PROVIDER toRemove)
{
this.RemoveStructure("PROVIDER", toRemove);
}
///<summary>
///Removes the RQC_I06_PROVIDER at the given index
///</summary>
public void RemovePROVIDERAt(int index)
{
this.RemoveRepetition("PROVIDER", index);
}
///<summary>
/// Returns PID (PID - patient identification segment) - creates it if necessary
///</summary>
public PID PID {
get{
PID ret = null;
try {
ret = (PID)this.GetStructure("PID");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of NK1 (NK1 - next of kin / associated parties segment-) - creates it if necessary
///</summary>
public NK1 GetNK1() {
NK1 ret = null;
try {
ret = (NK1)this.GetStructure("NK1");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of NK1
/// * (NK1 - next of kin / associated parties segment-) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public NK1 GetNK1(int rep) {
return (NK1)this.GetStructure("NK1", rep);
}
/**
* Returns the number of existing repetitions of NK1
*/
public int NK1RepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("NK1").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the NK1 results
*/
public IEnumerable<NK1> NK1s
{
get
{
for (int rep = 0; rep < NK1RepetitionsUsed; rep++)
{
yield return (NK1)this.GetStructure("NK1", rep);
}
}
}
///<summary>
///Adds a new NK1
///</summary>
public NK1 AddNK1()
{
return this.AddStructure("NK1") as NK1;
}
///<summary>
///Removes the given NK1
///</summary>
public void RemoveNK1(NK1 toRemove)
{
this.RemoveStructure("NK1", toRemove);
}
///<summary>
///Removes the NK1 at the given index
///</summary>
public void RemoveNK1At(int index)
{
this.RemoveRepetition("NK1", index);
}
///<summary>
/// Returns GT1 (GT1 - guarantor segment) - creates it if necessary
///</summary>
public GT1 GT1 {
get{
GT1 ret = null;
try {
ret = (GT1)this.GetStructure("GT1");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of NTE (NTE - notes and comments segment) - creates it if necessary
///</summary>
public NTE GetNTE() {
NTE ret = null;
try {
ret = (NTE)this.GetStructure("NTE");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of NTE
/// * (NTE - notes and comments segment) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public NTE GetNTE(int rep) {
return (NTE)this.GetStructure("NTE", rep);
}
/**
* Returns the number of existing repetitions of NTE
*/
public int NTERepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("NTE").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the NTE results
*/
public IEnumerable<NTE> NTEs
{
get
{
for (int rep = 0; rep < NTERepetitionsUsed; rep++)
{
yield return (NTE)this.GetStructure("NTE", rep);
}
}
}
///<summary>
///Adds a new NTE
///</summary>
public NTE AddNTE()
{
return this.AddStructure("NTE") as NTE;
}
///<summary>
///Removes the given NTE
///</summary>
public void RemoveNTE(NTE toRemove)
{
this.RemoveStructure("NTE", toRemove);
}
///<summary>
///Removes the NTE at the given index
///</summary>
public void RemoveNTEAt(int index)
{
this.RemoveRepetition("NTE", index);
}
}
}
| 28.568123 | 146 | 0.633042 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | afaonline/nHapi | src/NHapi.Model.V231/Message/RQC_I06.cs | 11,113 | C# |
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;
using static CoberturaConverter.Core.CoberturaConverter;
namespace CoberturaConverter.CommandLine
{
class Program
{
static async Task Main(string[] args)
{
HeadingInfo.Default.WriteMessage("Based on https://github.com/danielpalme/OpenCoverToCoberturaConverter");
HeadingInfo.Default.WriteMessage("Find out more at github.com/GeorgDangl/CoberturaConverter");
var parsedOptions = Parser.Default.ParseArguments<CoberturaConverterOptions>(args);
if (parsedOptions.Tag == ParserResultType.Parsed)
{
var converterOptions = (Parsed<CoberturaConverterOptions>) parsedOptions;
try
{
await PerformConversion(converterOptions.Value);
Console.WriteLine("Conversion finished");
}
catch (Exception e)
{
DisplayExceptionDetails(e);
}
}
}
private static void DisplayExceptionDetails(Exception e)
{
Console.Write(e.ToString());
Console.WriteLine();
}
private static Task PerformConversion(CoberturaConverterOptions options)
{
switch (options.Target)
{
case SourceReportFormat.DotCover:
return DotCoverToCobertura(options);
case SourceReportFormat.OpenCover:
return OpenCoverToCobertura(options);
default:
throw new NotImplementedException("The specified source report format is not currently implemented");
}
}
private static async Task OpenCoverToCobertura(CoberturaConverterOptions options)
{
using (var inputStream = File.OpenRead(options.InputFilePath))
{
using (var coberturaStream = ConvertOpenCoverToCobertura(inputStream))
{
using (var outputStream = File.Create(options.OutputFilePath))
{
await coberturaStream.CopyToAsync(outputStream);
}
}
}
}
private static async Task DotCoverToCobertura(CoberturaConverterOptions options)
{
using (var inputStream = File.OpenRead(options.InputFilePath))
{
using (var coberturaStream = ConvertDotCoverToCobertura(inputStream))
{
using (var outputStream = File.Create(options.OutputFilePath))
{
await coberturaStream.CopyToAsync(outputStream);
}
}
}
}
}
}
| 35.790123 | 121 | 0.569162 | [
"MIT"
] | GeorgDangl/CoberturaConverter | src/CoberturaConverter.CommandLine/Program.cs | 2,901 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Trifolia.Web.Models.GreenManagement
{
public class GreenDataTypeViewModel
{
#region Public Properties
public int datatypeId { get; set; }
public string datatype { get; set; }
#endregion
}
} | 18.5 | 45 | 0.675676 | [
"Apache-2.0"
] | BOBO41/trifolia | Trifolia.Web/Models/GreenManagement/GreenDataTypeViewModel.cs | 335 | C# |
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using HuaweiCloud.SDK.Core;
namespace HuaweiCloud.SDK.Vpc.V2.Model
{
/// <summary>
///
/// </summary>
public class SecurityGroupRule
{
/// <summary>
/// 安全组规则ID
/// </summary>
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public string Id { get; set; }
/// <summary>
/// 功能说明:安全组规则描述 取值范围:0-255个字符,支持数字、字母、中文字符
/// </summary>
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public string Description { get; set; }
/// <summary>
/// 安全组ID
/// </summary>
[JsonProperty("security_group_id", NullValueHandling = NullValueHandling.Ignore)]
public string SecurityGroupId { get; set; }
/// <summary>
/// 功能说明:出入控制方向 取值范围: - egress:出方向 - ingress:入方向
/// </summary>
[JsonProperty("direction", NullValueHandling = NullValueHandling.Ignore)]
public string Direction { get; set; }
/// <summary>
/// 功能说明:IP协议类型 取值范围:IPv4,IPv6
/// </summary>
[JsonProperty("ethertype", NullValueHandling = NullValueHandling.Ignore)]
public string Ethertype { get; set; }
/// <summary>
/// 功能说明:协议类型 取值范围:tcp、udp、icmp或IP协议编号(0~255) 约束:为空表示支持所有协议
/// </summary>
[JsonProperty("protocol", NullValueHandling = NullValueHandling.Ignore)]
public string Protocol { get; set; }
/// <summary>
/// 功能说明:起始端口值 取值范围:1~65535 约束:不能大于port_range_max的值,为空表示所有端口,如果协议是icmp类型,取值范围请参见 [安全组规则icmp协议名称对应关系表](https://support.huaweicloud.com/api-vpc/vpc_api_0009.html)
/// </summary>
[JsonProperty("port_range_min", NullValueHandling = NullValueHandling.Ignore)]
public int? PortRangeMin { get; set; }
/// <summary>
/// 功能说明:结束端口值 取值范围:1~65535 约束:取值不能小于port_range_min的值,为空表示所有端口,如果协议是icmp类型,取值范围请参见 [安全组规则icmp协议名称对应关系表](https://support.huaweicloud.com/api-vpc/vpc_api_0009.html)
/// </summary>
[JsonProperty("port_range_max", NullValueHandling = NullValueHandling.Ignore)]
public int? PortRangeMax { get; set; }
/// <summary>
/// 功能说明:远端IP地址,当direction是egress时为虚拟机访问端的地址,当direction是ingress时为访问虚拟机的地址 取值范围:IP地址,或者cidr格式 约束:和remote_group_id互斥
/// </summary>
[JsonProperty("remote_ip_prefix", NullValueHandling = NullValueHandling.Ignore)]
public string RemoteIpPrefix { get; set; }
/// <summary>
/// 功能说明:对端安全组ID 约束:和remote_ip_prefix互斥
/// </summary>
[JsonProperty("remote_group_id", NullValueHandling = NullValueHandling.Ignore)]
public string RemoteGroupId { get; set; }
/// <summary>
/// 安全组所属项目ID
/// </summary>
[JsonProperty("tenant_id", NullValueHandling = NullValueHandling.Ignore)]
public string TenantId { get; set; }
/// <summary>
/// Get the string
/// </summary>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class SecurityGroupRule {\n");
sb.Append(" id: ").Append(Id).Append("\n");
sb.Append(" description: ").Append(Description).Append("\n");
sb.Append(" securityGroupId: ").Append(SecurityGroupId).Append("\n");
sb.Append(" direction: ").Append(Direction).Append("\n");
sb.Append(" ethertype: ").Append(Ethertype).Append("\n");
sb.Append(" protocol: ").Append(Protocol).Append("\n");
sb.Append(" portRangeMin: ").Append(PortRangeMin).Append("\n");
sb.Append(" portRangeMax: ").Append(PortRangeMax).Append("\n");
sb.Append(" remoteIpPrefix: ").Append(RemoteIpPrefix).Append("\n");
sb.Append(" remoteGroupId: ").Append(RemoteGroupId).Append("\n");
sb.Append(" tenantId: ").Append(TenantId).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
public override bool Equals(object input)
{
return this.Equals(input as SecurityGroupRule);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
public bool Equals(SecurityGroupRule input)
{
if (input == null)
return false;
return
(
this.Id == input.Id ||
(this.Id != null &&
this.Id.Equals(input.Id))
) &&
(
this.Description == input.Description ||
(this.Description != null &&
this.Description.Equals(input.Description))
) &&
(
this.SecurityGroupId == input.SecurityGroupId ||
(this.SecurityGroupId != null &&
this.SecurityGroupId.Equals(input.SecurityGroupId))
) &&
(
this.Direction == input.Direction ||
(this.Direction != null &&
this.Direction.Equals(input.Direction))
) &&
(
this.Ethertype == input.Ethertype ||
(this.Ethertype != null &&
this.Ethertype.Equals(input.Ethertype))
) &&
(
this.Protocol == input.Protocol ||
(this.Protocol != null &&
this.Protocol.Equals(input.Protocol))
) &&
(
this.PortRangeMin == input.PortRangeMin ||
(this.PortRangeMin != null &&
this.PortRangeMin.Equals(input.PortRangeMin))
) &&
(
this.PortRangeMax == input.PortRangeMax ||
(this.PortRangeMax != null &&
this.PortRangeMax.Equals(input.PortRangeMax))
) &&
(
this.RemoteIpPrefix == input.RemoteIpPrefix ||
(this.RemoteIpPrefix != null &&
this.RemoteIpPrefix.Equals(input.RemoteIpPrefix))
) &&
(
this.RemoteGroupId == input.RemoteGroupId ||
(this.RemoteGroupId != null &&
this.RemoteGroupId.Equals(input.RemoteGroupId))
) &&
(
this.TenantId == input.TenantId ||
(this.TenantId != null &&
this.TenantId.Equals(input.TenantId))
);
}
/// <summary>
/// Get hash code
/// </summary>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Id != null)
hashCode = hashCode * 59 + this.Id.GetHashCode();
if (this.Description != null)
hashCode = hashCode * 59 + this.Description.GetHashCode();
if (this.SecurityGroupId != null)
hashCode = hashCode * 59 + this.SecurityGroupId.GetHashCode();
if (this.Direction != null)
hashCode = hashCode * 59 + this.Direction.GetHashCode();
if (this.Ethertype != null)
hashCode = hashCode * 59 + this.Ethertype.GetHashCode();
if (this.Protocol != null)
hashCode = hashCode * 59 + this.Protocol.GetHashCode();
if (this.PortRangeMin != null)
hashCode = hashCode * 59 + this.PortRangeMin.GetHashCode();
if (this.PortRangeMax != null)
hashCode = hashCode * 59 + this.PortRangeMax.GetHashCode();
if (this.RemoteIpPrefix != null)
hashCode = hashCode * 59 + this.RemoteIpPrefix.GetHashCode();
if (this.RemoteGroupId != null)
hashCode = hashCode * 59 + this.RemoteGroupId.GetHashCode();
if (this.TenantId != null)
hashCode = hashCode * 59 + this.TenantId.GetHashCode();
return hashCode;
}
}
}
}
| 39.847222 | 170 | 0.522482 | [
"Apache-2.0"
] | Huaweicloud-SDK/huaweicloud-sdk-net-v3 | Services/Vpc/V2/Model/SecurityGroupRule.cs | 9,247 | C# |
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Lab19_CreateAnApi.Migrations
{
public partial class UpdateSeedAgain : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 2,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 35, 38, 623, DateTimeKind.Local));
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 3,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 35, 38, 623, DateTimeKind.Local));
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 4,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 35, 38, 623, DateTimeKind.Local));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 2,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 30, 8, 76, DateTimeKind.Local));
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 3,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 30, 8, 76, DateTimeKind.Local));
migrationBuilder.UpdateData(
table: "ToDos",
keyColumn: "ID",
keyValue: 4,
column: "DateCreated",
value: new DateTime(2018, 11, 4, 22, 30, 8, 76, DateTimeKind.Local));
}
}
}
| 33.77193 | 87 | 0.503896 | [
"MIT"
] | rh24/Lab19-CreateAnAPI | Lab19-CreateAnApi/Migrations/20181105063539_UpdateSeedAgain.cs | 1,927 | C# |
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls;
using Windows.UI.Composition;
using Windows.UI.Xaml.Hosting;
using Windows.UI;
namespace DynamicWallpaper.Views
{
public sealed partial class PageHeader : UserControl
{
public Action ToggleThemeAction { get; set; }
public TeachingTip TeachingTip1 => ToggleThemeTeachingTip1;
public TeachingTip TeachingTip2 => ToggleThemeTeachingTip2;
public TeachingTip TeachingTip3 => ToggleThemeTeachingTip3;
public object Title
{
get { return GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public static readonly DependencyProperty TitleProperty =
DependencyProperty.Register("Title", typeof(object), typeof(PageHeader), new PropertyMetadata(null));
public Thickness HeaderPadding
{
get { return (Thickness)GetValue(HeaderPaddingProperty); }
set { SetValue(HeaderPaddingProperty, value); }
}
// Using a DependencyProperty as the backing store for BackgroundColorOpacity. This enables animation, styling, binding, etc...
public static readonly DependencyProperty HeaderPaddingProperty =
DependencyProperty.Register("HeaderPadding", typeof(Thickness), typeof(PageHeader), new PropertyMetadata((Thickness)App.Current.Resources["PageHeaderDefaultPadding"]));
public double BackgroundColorOpacity
{
get { return (double)GetValue(BackgroundColorOpacityProperty); }
set { SetValue(BackgroundColorOpacityProperty, value); }
}
// Using a DependencyProperty as the backing store for BackgroundColorOpacity. This enables animation, styling, binding, etc...
public static readonly DependencyProperty BackgroundColorOpacityProperty =
DependencyProperty.Register("BackgroundColorOpacity", typeof(double), typeof(PageHeader), new PropertyMetadata(0.0));
public double AcrylicOpacity
{
get { return (double)GetValue(AcrylicOpacityProperty); }
set { SetValue(AcrylicOpacityProperty, value); }
}
// Using a DependencyProperty as the backing store for BackgroundColorOpacity. This enables animation, styling, binding, etc...
public static readonly DependencyProperty AcrylicOpacityProperty =
DependencyProperty.Register("AcrylicOpacity", typeof(double), typeof(PageHeader), new PropertyMetadata(0.3));
public double ShadowOpacity
{
get { return (double)GetValue(ShadowOpacityProperty); }
set { SetValue(ShadowOpacityProperty, value); }
}
// Using a DependencyProperty as the backing store for BackgroundColorOpacity. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ShadowOpacityProperty =
DependencyProperty.Register("ShadowOpacity", typeof(double), typeof(PageHeader), new PropertyMetadata(0.0));
public CommandBar TopCommandBar
{
get { return topCommandBar; }
}
public UIElement TitlePanel
{
get { return pageTitle; }
}
public PageHeader()
{
this.InitializeComponent();
this.InitializeDropShadow(ShadowHost, TitleTextBlock.GetAlphaMask());
}
public void OnThemeButtonClick(object sender, RoutedEventArgs e)
{
ToggleThemeAction?.Invoke();
}
private void ToggleThemeTeachingTip2_ActionButtonClick(Microsoft.UI.Xaml.Controls.TeachingTip sender, object args)
{
ShellPage.Current.PageHeader.ToggleThemeAction?.Invoke();
}
/// <summary>
/// This method will be called when a <see cref="ItemPage"/> gets unloaded.
/// Put any code in here that should be done when a <see cref="ItemPage"/> gets unloaded.
/// </summary>
/// <param name="sender">The sender (the ItemPage)</param>
/// <param name="e">The <see cref="RoutedEventArgs"/> of the ItemPage that was unloaded.</param>
public void Event_ItemPage_Unloaded(object sender, RoutedEventArgs e)
{
}
private void InitializeDropShadow(UIElement shadowHost, CompositionBrush shadowTargetBrush)
{
Visual hostVisual = ElementCompositionPreview.GetElementVisual(shadowHost);
Compositor compositor = hostVisual.Compositor;
// Create a drop shadow
var dropShadow = compositor.CreateDropShadow();
dropShadow.Color = Color.FromArgb(102, 0, 0, 0);
dropShadow.BlurRadius = 4.0f;
// Associate the shape of the shadow with the shape of the target element
dropShadow.Mask = shadowTargetBrush;
// Create a Visual to hold the shadow
var shadowVisual = compositor.CreateSpriteVisual();
shadowVisual.Shadow = dropShadow;
// Add the shadow as a child of the host in the visual tree
ElementCompositionPreview.SetElementChildVisual(shadowHost, shadowVisual);
// Make sure size of shadow host and shadow visual always stay in sync
var bindSizeAnimation = compositor.CreateExpressionAnimation("hostVisual.Size");
bindSizeAnimation.SetReferenceParameter("hostVisual", hostVisual);
shadowVisual.StartAnimation("Size", bindSizeAnimation);
}
}
}
| 40.482993 | 180 | 0.65636 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | samtholiya/DynaDesktop | DynamicWallpaper/Views/PageHeader.xaml.cs | 5,953 | C# |
using System;
using System.Globalization;
namespace Microsoft.Maui.Controls
{
[Xaml.ProvideCompiled("Microsoft.Maui.Controls.XamlC.RectangleTypeConverter")]
[Xaml.TypeConversion(typeof(Rectangle))]
public class RectangleTypeConverter : TypeConverter
{
public override object ConvertFromInvariantString(string value)
{
if (value != null)
{
string[] xywh = value.Split(',');
if (xywh.Length == 4
&& double.TryParse(xywh[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double x)
&& double.TryParse(xywh[1], NumberStyles.Number, CultureInfo.InvariantCulture, out double y)
&& double.TryParse(xywh[2], NumberStyles.Number, CultureInfo.InvariantCulture, out double w)
&& double.TryParse(xywh[3], NumberStyles.Number, CultureInfo.InvariantCulture, out double h))
return new Rectangle(x, y, w, h);
}
throw new InvalidOperationException(string.Format("Cannot convert \"{0}\" into {1}", value, typeof(Rectangle)));
}
public override string ConvertToInvariantString(object value)
{
if (!(value is Rectangle r))
throw new NotSupportedException();
return $"{r.X.ToString(CultureInfo.InvariantCulture)}, {r.Y.ToString(CultureInfo.InvariantCulture)}, {r.Width.ToString(CultureInfo.InvariantCulture)}, {r.Height.ToString(CultureInfo.InvariantCulture)}";
}
}
} | 40.272727 | 205 | 0.737397 | [
"MIT"
] | Eilon/maui | src/Controls/src/Core/RectangleTypeConverter.cs | 1,329 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.