content
stringlengths
23
1.05M
using Abp.Authorization; using Abp.Localization; namespace Satrabel.Starter.Web.Authorization { public class AuthorizationProvider : Abp.Authorization.AuthorizationProvider { public override void SetPermissions(IPermissionDefinitionContext context) { context.CreatePermission(PermissionNames.Pages_Home, L("Home")); context.CreatePermission(PermissionNames.Pages_About, L("About")); } private static ILocalizableString L(string name) { return new LocalizableString(name, AppConsts.LocalizationSourceName); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NUnit.Framework; using Nylog.Utils; using Ploeh.AutoFixture; namespace Tests.Utils { [TestFixture] public class ObjectToDictionaryTests { private IFixture fixture = new Fixture(); [SetUp] public void Initialize() { fixture = new Fixture(); } [Test] public void Convert_returns_a_dictionary_with_items() { var data = new { text = fixture.Create<string>(), value = fixture.Create<int>(), time = fixture.Create<DateTimeOffset>(), flag = fixture.Create<bool>() }; var dictionary = ObjectToDictionary.Convert(data); Assert.That(dictionary, Is.Not.Null); Assert.That(dictionary[nameof(data.text)], Is.EqualTo(data.text)); Assert.That(dictionary[nameof(data.value)], Is.EqualTo(data.value)); Assert.That(dictionary[nameof(data.time)], Is.EqualTo(data.time)); Assert.That(dictionary[nameof(data.flag)], Is.EqualTo(data.flag)); } [Test] public void Convert_uses_cache_to_spare_calls() { var data = new { text = fixture.Create<string>(), value = fixture.Create<int>(), time = fixture.Create<DateTimeOffset>(), flag = fixture.Create<bool>() }; var dictionary = ObjectToDictionary.Convert(data); Assert.That(ObjectToDictionary.Cache, Is.Not.Empty); Assert.That(ObjectToDictionary.Cache[data.GetType()], Is.Not.Null); } [Test] public void Convert_returns_empty_dictionary_when_null() { var dictionary = ObjectToDictionary.Convert(null); Assert.That(dictionary, Is.Not.Null); Assert.That(dictionary, Is.Empty); } [Test] public void Convert_returns_original_object_if_dictionary() { var data = fixture.Create<Dictionary<string, object>>(); var dictionary = ObjectToDictionary.Convert(data); Assert.That(dictionary, Is.SameAs(data)); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace X.Models { /// <summary> /// 邮件发送设置 /// </summary> public class EmailConfig { public EmailConfig() { Port = 25; } /// <summary> /// STMP服务器 /// </summary> public string EmailSmtp { get; set; } /// <summary> /// SSL加密连接 /// </summary> public int IsSsl { get; set; } /// <summary> /// SMTP端口 /// </summary> public int Port { get; set; } /// <summary> /// 发件人地址 /// </summary> public string EmailFrom { get; set; } /// <summary> /// 邮箱账号 /// </summary> public string AccountName { get; set; } /// <summary> /// 邮箱密码 /// </summary> public string Password { get; set; } /// <summary> /// 发件人昵称 /// </summary> public string NickName { get; set; } } }
using System.Linq; using UnityEngine; public class GameState : MonoBehaviour { [SerializeField] private PieceSpawner pieceSpawner = default; [SerializeField] private GameObject pieces = default; public void MovePiece(Piece movedPiece, Vector3 newPosition) { // Check if there is already a piece at the new position and if so, destroy it. var attackedPiece = FindPiece(newPosition); if (attackedPiece != null) { Destroy(attackedPiece.gameObject); } // Update the movedPiece's GameObject. movedPiece.transform.position = newPosition; } public void ResetGame() { // Destroy all GameObjects. foreach (var piece in pieces.GetComponentsInChildren<Piece>()) { Destroy(piece.gameObject); } // Recreate the GameObjects. pieceSpawner.CreateGameObjects(pieces); } private void Awake() { pieceSpawner.CreateGameObjects(pieces); } private Piece FindPiece(Vector3 position) { return pieces.GetComponentsInChildren<Piece>() .FirstOrDefault(piece => piece.transform.position == position); } }
using System; using System.Collections.Generic; using Ccf.Ck.Models.NodeSet; using Ccf.Ck.SysPlugins.Interfaces; using Ccf.Ck.Utilities.Generic; using Ccf.Ck.SysPlugins.Interfaces.ContextualBasket; namespace Ccf.Ck.SysPlugins.Iterators.DataNodes { internal class DataIteratorContext { public DataIteratorContext() { Datastack = new ListStack<Dictionary<string, object>>(); OverrideAction = new Stack<string>(); } public IPluginAccessor<IDataLoaderPlugin> DataLoaderPluginAccessor { get; internal set; } public IPluginAccessor<INodePlugin> CustomPluginAccessor { get; internal set; } public IPluginServiceManager PluginServiceManager { get; internal set; } public LoadedNodeSet LoadedNodeSet { get; internal set; } public IProcessingContext ProcessingContext { get; internal set; } public ListStack<Dictionary<string, object>> Datastack { get; private set; } public Stack<string> OverrideAction { get; private set; } internal void CheckNulls() { if (DataLoaderPluginAccessor == null) { throw new NullReferenceException(nameof(DataLoaderPluginAccessor)); } if (PluginServiceManager == null) { throw new NullReferenceException(nameof(PluginServiceManager)); } if (LoadedNodeSet == null) { throw new NullReferenceException(nameof(LoadedNodeSet)); } if (ProcessingContext == null) { throw new NullReferenceException(nameof(ProcessingContext)); } } } }
using System.Threading.Tasks; namespace FaucetSite.Lib { public interface IWalletUtils { Task<Transaction> SendCoin(string address); } }
using System; using System.Collections.Generic; using System.Text; using System.Xml.Serialization; namespace SoonLearning.Assessment.Data { [XmlInclude(typeof(MCQuestion))] [XmlInclude(typeof(MRQuestion))] [XmlInclude(typeof(MAQuestion))] [XmlInclude(typeof(FIBQuestion))] [XmlInclude(typeof(TFQuestion))] [XmlInclude(typeof(TableQuestion))] [XmlInclude(typeof(ESQuestion))] [XmlInclude(typeof(VerticalFormQuestion))] [XmlInclude(typeof(CPQuestion))] public abstract class Question : BaseObject, ICloneable { private QuestionContent questionContent = new QuestionContent(); private DateTime createTime = DateTime.Now.ToUniversalTime(); private string creator = string.Empty; private QuestionContent solution = new QuestionContent(); private int dificultyLevel = 3; // 1 - 5, 5 is the hardest. public QuestionContent Content { get { return this.questionContent; } set { this.questionContent = value; } } public int DifficultyLevel { get { return this.dificultyLevel; } set { this.dificultyLevel = value; base.OnPropertyChanged("DifficultyLevel"); } } public QuestionContent Solution { get { return this.solution; } set { this.solution = value; } } public string Tip { get; set; } public DateTime CreateTime { get { return this.createTime; } set { this.createTime = value; } } public string Creator { get { return this.creator; } set { this.creator = value; } } public DateTime ModifyTime { get; set; } // UserId public string ModifyBy { get; set; } public abstract QuestionType Type { get; } public object Clone() { Question newQuestion = this.InternalClone() as Question; newQuestion.Content = this.Content.Clone() as QuestionContent; newQuestion.CreateTime = this.CreateTime; newQuestion.Creator = this.Creator; newQuestion.DifficultyLevel = this.DifficultyLevel; newQuestion.Id = this.Id; newQuestion.ModifyBy = this.ModifyBy; newQuestion.ModifyTime = this.ModifyTime; newQuestion.Solution = this.Solution.Clone() as QuestionContent; newQuestion.Tip = this.Tip; return newQuestion; } protected abstract object InternalClone(); } }
namespace Chest.Models.v2.Audit { public enum AuditDataType { Locale, LocalizedValue, } }
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Perspex.Media { public enum BrushMappingMode { Absolute, RelativeToBoundingBox } }
using System; using Microsoft.Extensions.Caching.Memory; namespace Memoization.MemCache { public static class MemoryCacheMemoizer { /// <summary> /// Memoizes provided function. Function should provide deterministic results. /// For the same input it should return the same result. /// Memoized function for the specific input will be called once, further calls will use cache. /// </summary> /// <param name="func">function to be memoized</param> /// <typeparam name="TInput">Type of the function input value</typeparam> /// <typeparam name="TResult">Type of the function result</typeparam> /// <returns></returns> public static Func<TInput, TResult> Memoize<TInput, TResult>(this Func<TInput, TResult> func) { // create cache ("memo") var memo = new MemoryCache( new MemoryCacheOptions { // Set cache size limit. // Note: this is not size in bytes, // but sum of all entries' sizes. // Entry size is declared on adding to cache // in the factory method SizeLimit = 100 }); // wrap provided function with cache handling // get a value from cache if it exists // if not, call factory method // MemCache will handle that internally return input => memo.GetOrCreate(input, entry => { // you can set different options like e.g. // sliding expiration - time between now and last time // and the last time the entry was accessed entry.SlidingExpiration = TimeSpan.FromSeconds(3); // this value is used to calculate total SizeLimit entry.Size = 1; return func(input); }); } } }
using System.Collections.Generic; using TwilightImperiumMasterCompanion.Core.DataAccess.Interfaces; using TwilightImperiumMasterCompanion.Core.Services.Interfaces; namespace TwilightImperiumMasterCompanion.Core.Services { public class PlanetService : IPlanetService { readonly IPlanetDataAccess planetDataAccess; public PlanetService(IPlanetDataAccess planetDataAccess) { this.planetDataAccess = planetDataAccess; } public List<Planet> GetPlanets() { return planetDataAccess.GetPlanets(); } } }
using NAudio.Wave; using NAudio.Wave.SampleProviders; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MusicalInstrument { public partial class Form1 : Form { SignalGenerator sine = new SignalGenerator() { Type = SignalGeneratorType.Sin, Gain = 0.2 }; WaveOutEvent player = new WaveOutEvent(); public Form1() { InitializeComponent(); player.Init(sine); trackFrequency.ValueChanged += (s, e) => sine.Frequency = trackFrequency.Value; trackFrequency.Value = 600; trackVolume.ValueChanged += (s,e) => player.Volume = trackVolume.Value / 100F; trackVolume.Value = 50; } private System.Drawing.Point CursorPositionOnMouseDown; private bool ButtonIsDown = false; private void TheMouseDown(object sender, MouseEventArgs e) { player.Play(); CursorPositionOnMouseDown = e.Location; ButtonIsDown = true; } private void TheMouseUp(object sender, MouseEventArgs e) { player.Stop(); ButtonIsDown = false; } private void panel_MouseMove(object sender, MouseEventArgs e) { var dX = e.X - CursorPositionOnMouseDown.X; // var vol = var dY = CursorPositionOnMouseDown.Y - e.Y; // var freq = if (ButtonIsDown) { } Text = $"Musical Instrument! ({dX},{dY}) (vol, freq)"; } } }
using Microsoft.AspNetCore.Mvc; using OraEmp.Application.Services; using OraEmp.Domain.Entities; namespace Api.Controllers; [ApiController] [Route("[controller]")] public class DepartmentController : ControllerBase { private readonly IDepartmentService _service; public DepartmentController(IDepartmentService service) { _service = service; } [HttpGet(Name = "GetDepartments")] public async Task<IEnumerable<Department>> Get() { return await _service.GetAllAsync(); } }
/* * Copyright (c) Adam Chapweske * * Licensed under MIT (https://github.com/achapweske/silvernote/blob/master/LICENSE) */ using DOM; using DOM.CSS; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Media.TextFormatting; namespace SilverNote.Editor { public class GenericTextParagraphProperties : TextParagraphProperties, ICloneable { #region Fields bool _AlwaysCollapsible; double _DefaultIncrementalTab; TextRunProperties _DefaultTextRunProperties; bool _FirstLineInParagraph; FlowDirection _FlowDirection; double _Indent; double _LineHeight; double _ParagraphIndent; IList<TextTabProperties> _Tabs; TextAlignment _TextAlignment; TextDecorationCollection _TextDecorations; TextMarkerProperties _TextMarkerProperties; TextWrapping _TextWrapping; #endregion #region Constructors public GenericTextParagraphProperties() { _DefaultIncrementalTab = Double.NaN; _FlowDirection = FlowDirection.LeftToRight; _TextAlignment = TextAlignment.Left; _TextWrapping = TextWrapping.Wrap; } public GenericTextParagraphProperties(TextParagraphProperties copy) { _AlwaysCollapsible = copy.AlwaysCollapsible; _DefaultIncrementalTab = copy.DefaultIncrementalTab; _DefaultTextRunProperties = copy.DefaultTextRunProperties; _FirstLineInParagraph = copy.FirstLineInParagraph; _FlowDirection = copy.FlowDirection; _Indent = copy.Indent; _LineHeight = copy.LineHeight; _ParagraphIndent = copy.ParagraphIndent; _Tabs = copy.Tabs; _TextAlignment = copy.TextAlignment; _TextDecorations = copy.TextDecorations; _TextMarkerProperties = copy.TextMarkerProperties; _TextWrapping = copy.TextWrapping; if (_DefaultTextRunProperties is ICloneable) { _DefaultTextRunProperties = (TextRunProperties)((ICloneable)_DefaultTextRunProperties).Clone(); } if (_TextDecorations != null && !_TextDecorations.IsFrozen) { _TextDecorations = _TextDecorations.Clone(); } } #endregion #region Properties public override bool AlwaysCollapsible { get { return _AlwaysCollapsible; } } public override double DefaultIncrementalTab { get { if (!Double.IsNaN(_DefaultIncrementalTab)) { return _DefaultIncrementalTab; } else { return 4 * DefaultTextRunProperties.FontRenderingEmSize; } } } public override TextRunProperties DefaultTextRunProperties { get { return _DefaultTextRunProperties; } } public override bool FirstLineInParagraph { get { return _FirstLineInParagraph; } } public override FlowDirection FlowDirection { get { return _FlowDirection; } } public override double Indent { get { return _Indent; } } public override double LineHeight { get { return _LineHeight; } } public override double ParagraphIndent { get { return _ParagraphIndent; } } public override IList<TextTabProperties> Tabs { get { return _Tabs; } } public override TextAlignment TextAlignment { get { return _TextAlignment; } } public override TextDecorationCollection TextDecorations { get { return _TextDecorations; } } public override TextMarkerProperties TextMarkerProperties { get { return _TextMarkerProperties; } } public override TextWrapping TextWrapping { get { return _TextWrapping; } } #endregion #region Methods public void SetAlwaysCollapsible(bool alwaysCollapsible) { _AlwaysCollapsible = alwaysCollapsible; } public void SetDefaultIncrementalTab(double defaultIncrementalTab) { _DefaultIncrementalTab = defaultIncrementalTab; } public void SetDefaultTextRunProperties(TextRunProperties defaultTextRunProperties) { _DefaultTextRunProperties = defaultTextRunProperties; } /// <summary> /// Not a "real" property - used internally by the formatter to maintain state /// </summary> /// <param name="firstLineInParagraph"></param> public void SetFirstLineInParagraph(bool firstLineInParagraph) { _FirstLineInParagraph = firstLineInParagraph; } public void SetFlowDirection(FlowDirection flowDirection) { _FlowDirection = flowDirection; } public void SetIndent(double indent) { _Indent = indent; } public void SetLineHeight(double lineHeight) { _LineHeight = lineHeight; } public void SetParagraphIndent(double paragraphIndent) { _ParagraphIndent = paragraphIndent; } public void SetTabs(IList<TextTabProperties> tabs) { _Tabs = tabs; } public void SetTextAlignment(TextAlignment textAlignment) { _TextAlignment = textAlignment; } public void SetTextDecorations(TextDecorationCollection textDecorations) { _TextDecorations = textDecorations; } public void SetTextMarkerProperties(TextMarkerProperties textMarkerProperties) { _TextMarkerProperties = textMarkerProperties; } public void SetTextWrapping(TextWrapping textWrapping) { _TextWrapping = textWrapping; } #endregion #region ICloneable public virtual object Clone() { return new GenericTextParagraphProperties(this); } #endregion } }
using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace Maple.Core { /// <summary> /// Object的扩展方法 /// </summary> public static class PropertyInfoExtensions { public static bool HasAttribute<T>(this PropertyInfo info, bool inherit) where T : Attribute { return GetAttribute<T>(info, inherit) != null; } public static T GetAttribute<T>(this PropertyInfo info, bool inherit) where T : Attribute { var ts = GetAttributes<T>(info, inherit); if (ts != null && ts.Length > 0) return ts[0]; return null; } public static T[] GetAttributes<T>(this PropertyInfo info, bool inherit) where T : Attribute { var os = info.GetCustomAttributes(typeof(T), inherit); return (T[])os; } /// <summary> /// PropertyInfo对应的类型是否为Nullable /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool IsIncludingNullable(this PropertyInfo info) { return info.PropertyType.IsIncludingNullable(); } /// <summary> /// 获取PropertyInfo对应的类型是否为基元类型或Nullable的基元类型 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool IsPrimitiveExtendedIncludingNullableOrEnum(this PropertyInfo info) { return info.PropertyType.IsEnum || info.PropertyType.IsPrimitiveExtendedIncludingNullable(); } } }
namespace XF.ChartLibrary.Utils { public class ChartColor { #if __IOS__ || __TVOS__ public readonly UIKit.UIColor Value; public ChartColor(UIKit.UIColor value) { Value = value; } public ChartColor(double r, double g, double b, double a) { Value = new UIKit.UIColor((float)r, (float)g, (float)b, (float)a); } #elif NETSTANDARD public readonly SkiaSharp.SKColor Value; public ChartColor(SkiaSharp.SKColor value) { Value = value; } #endif } }
using System; using System.Collections.Concurrent; using Mono.Cecil; using Mono.Cecil.Cil; namespace OpenToolkit.Rewrite.Methods.Processors { /// <summary> /// Provides functionality for additional (epilogue) processing that is dependent /// on an earlier (prologue) rewriting step. /// </summary> /// <typeparam name="T"> /// The type of the variable that will be passed from the prologue to the epilogue rewriting step. /// </typeparam> public abstract class EpilogueProcessor<T> : IMethodProcessor { /// <summary> /// Gets a dictionary of variables from the prologue processing step that can be used in the epilogue /// <see cref="ProcessEpilogue(ILProcessor, MethodDefinition, MethodDefinition, T)"/>. /// </summary> public ConcurrentDictionary<MethodDefinition, T> RewriteVariables { get; } /// <summary> /// Initializes a new instance of the <see cref="EpilogueProcessor{T}"/> class. /// </summary> public EpilogueProcessor() { RewriteVariables = new ConcurrentDictionary<MethodDefinition, T>(); } /// <inheritdoc/> public void Process(ILProcessor cilProcessor, MethodDefinition wrapper, MethodDefinition native) { if (!RewriteVariables.TryRemove(wrapper, out T variable)) { throw new InvalidOperationException(); } ProcessEpilogue(cilProcessor, wrapper, native, variable); } /// <summary> /// Implements the actual epilogue rewriting step. /// </summary> /// <param name="cilProcessor">The IL processor for the wrapper method definition.</param> /// <param name="wrapper">The method definition for the managed wrapper method.</param> /// <param name="native">The method definition for the native function.</param> /// <param name="argument">Additional information that was created in the epilogue rewriting step.</param> protected abstract void ProcessEpilogue ( ILProcessor cilProcessor, MethodDefinition wrapper, MethodDefinition native, T argument ); } }
using Bonsai.RazorPages.Error.Services.LanguageDictionary; using Bonsai.RazorPages.Error.Services.LanguageDictionary.Languages; using Bonsai.Services.Interfaces; using DasContract.Editor.AppLogic.Facades; using DasContract.Editor.AppLogic.Facades.Interfaces; using DasContract.Editor.DataPersistence.DbContexts; using DasContract.Editor.DataPersistence.Repositories; using DasContract.Editor.DataPersistence.Repositories.Interfaces; using DasContract.Editor.Pages.Main.Services.FilePathProvider.SpecificFilePathProviders; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.ResponseCompression; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.Linq; namespace DasContract.Editor.Server { public class Startup { public Startup(IConfiguration configuration, IWebHostEnvironment environment) { Configuration = configuration; Environment = environment; } public IConfiguration Configuration { get; } public IWebHostEnvironment Environment { get; } public void ConfigureServices(IServiceCollection services) { //Add controllers services.AddMvc(); services.AddControllers(); //Add contract editor db if(Environment.IsDevelopment()) { services.AddDbContext<ContractEditorDb>(options => options.UseSqlServer(Configuration.GetConnectionString("ContractEditorDbLocal"))); } else { services.AddDbContext<ContractEditorDb>(options => options.UseSqlite(Configuration.GetConnectionString("ContractEditorDbSQLite"))); using var serviceScope = services.BuildServiceProvider().CreateScope(); var dbContext = serviceScope.ServiceProvider.GetService<ContractEditorDb>(); dbContext.Database.EnsureCreated(); } //Add contract editor services services.AddTransient<IContractFileSessionRepository, ContractFileSessionRepository>(); services.AddTransient<IContractFileSessionFacade, ContractFileSessionFacade>(); //Controllers view builder var controllersViewBuilder = services.AddControllersWithViews(); if (Environment.IsDevelopment()) controllersViewBuilder.AddRazorRuntimeCompilation(); //Razor pages builder var razorPagesBuilder = services.AddRazorPages(); if (Environment.IsDevelopment()) razorPagesBuilder.AddRazorRuntimeCompilation(); //HTTPS //services.AddHttpsRedirection(options => options.HttpsPort = 443); //Response compression services.AddResponseCompression(opts => { opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( new[] { "application/octet-stream" }); }); //File provider if (Environment.IsDevelopment()) services.AddSingleton<IFilePathProvider, RegularFilePathProvider>(); else services.AddSingleton<IFilePathProvider, VersionedFilePathProvider>(); //Error pages services services.AddSingleton<IErrorLanguageDictionary, EnglishErrorLanguageDictionary>(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseResponseCompression(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBlazorDebugging(); } else { app.UseStatusCodePagesWithReExecute("/error", "?code={0}"); } //app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseClientSideBlazorFiles<Pages.Main.Program>(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); endpoints.MapControllers(); endpoints.MapRazorPages(); endpoints.MapFallbackToClientSideBlazor<Pages.Main.Program>("index.html"); }); } } }
using System.Collections.Generic; using TersoSolutions.Jetstream.Sdk.Objects.Events; namespace TersoSolutions.Jetstream.ServiceBase { /// <summary> /// Sort events by time /// </summary> public class EventComparer : IComparer<EventDto> { /// <summary> /// Compare the times /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public int Compare(EventDto x, EventDto y) { return x.EventTime < y.EventTime ? -1 : 1; } } }
using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; using Plethora.Collections; namespace Plethora.Test.Collections { [TestFixture] public class ListIndexIterator_Test { private List<int> list; [SetUp] public void SetUp() { list = Enumerable.Range(0, 10).ToList(); } [Test] public void ctor_Fail_NullList() { bool isCaught = false; try { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(null, 3, 4); } catch (ArgumentNullException ex) { isCaught = true; } Assert.IsTrue(isCaught); } [Test] public void ctor_Fail_StartLessThan0() { bool isCaught = false; try { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, -2, 4); } catch (ArgumentOutOfRangeException ex) { isCaught = true; } Assert.IsTrue(isCaught); } [Test] public void ctor_Fail_CountLessThan0() { bool isCaught = false; try { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, -2); } catch (ArgumentOutOfRangeException ex) { isCaught = true; } Assert.IsTrue(isCaught); } [Test] public void ctor_Fail_CountPlusStartGreaterThanListLength() { bool isCaught = false; try { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 20); } catch (ArgumentException ex) { isCaught = true; } Assert.IsTrue(isCaught); } [Test] public void Empty() { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 0); //Test Assert.AreEqual(0, itterator.Count()); } [Test] public void SingleElement() { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 1); //Test Assert.AreEqual(1, itterator.Count()); bool areEqual = itterator.SequenceEqual(new[] {3}); Assert.IsTrue(areEqual); } [Test] public void MultipleElements() { //Exec ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Test Assert.AreEqual(4, itterator.Count()); bool areEqual = itterator.SequenceEqual(new[] { 3, 4, 5, 6 }); Assert.IsTrue(areEqual); } [Test] public void Contains_True() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec bool result = itterator.Contains(5); //Test Assert.IsTrue(result); } [Test] public void Contains_False() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec bool result = itterator.Contains(1); //Test Assert.IsFalse(result); } [Test] public void Contains_EdgeCases() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec bool beforeStart = itterator.Contains(2); bool atStart = itterator.Contains(3); bool atEnd = itterator.Contains(6); bool afterEnd = itterator.Contains(7); //Test Assert.IsFalse(beforeStart); Assert.IsTrue(atStart); Assert.IsTrue(atEnd); Assert.IsFalse(afterEnd); } [Test] public void CopyTo_ZeroIndex() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec int[] array = new int[10]; itterator.CopyTo(array, 0); //Test Assert.AreEqual(3, array[0]); Assert.AreEqual(4, array[1]); Assert.AreEqual(5, array[2]); Assert.AreEqual(6, array[3]); } [Test] public void CopyTo_NonZeroIndex() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec int[] array = new int[10]; itterator.CopyTo(array, 5); //Test Assert.AreEqual(3, array[5]); Assert.AreEqual(4, array[6]); Assert.AreEqual(5, array[7]); Assert.AreEqual(6, array[8]); } [Test] public void Count() { //Setup ListIndexIterator<int> itterator = new ListIndexIterator<int>(list, 3, 4); //Exec var count = itterator.Count; //Test Assert.AreEqual(4, count); } } }
using System; using System.Collections.Generic; using System.Text; using TMDbApiDom.Dto.SidewayClasses.AbstractClasses; namespace TMDbApiDom.Dto.Authentication { public class RequestToken : BaseToken { } }
namespace BullsAndCows.Web.ViewModels { using BullsAndCows.Models; using BullsAndCows.Web.ViewModels.Validation; using System; using System.ComponentModel.DataAnnotations; using System.Linq.Expressions; public class GuessViewModel { public static Expression<Func<Guess, GuessViewModel>> FromGuess { get { return guess => new GuessViewModel { Id = guess.Id, Number = guess.Number, BullsCount = guess.BullsCount, CowsCount = guess.CowsCount, DateCreated = guess.DateCreated }; } } public int Id { get; set; } [Required] [MinLength(4, ErrorMessage = "Number must contain 4 digits!")] [MaxLength(4, ErrorMessage = "Number must contain 4 digits!")] [DistinctCharacters(ErrorMessage = "All digits must be distinct!")] [RegularExpression("^[1-9]*$", ErrorMessage = "Use only digits from 1 to 9")] public string Number { get; set; } public int BullsCount { get; set; } public int CowsCount { get; set; } public DateTime DateCreated { get; set; } } }
using AutoMapper; using AutoMapper.QueryableExtensions; using Microsoft.EntityFrameworkCore; using Pokebook.core.Data; using Pokebook.core.Models; using Pokebook.core.Models.DTO; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Pokebook.core.Repositories.Specific { public class ChatRepository : MappingRepository<Chat>, IChatRepository { public ChatRepository(PokebookContext context, IMapper mapper) : base(context, mapper) { } public IEnumerable<UserChat> GetUserChats() { return PokebookContext.UserChats .Include(uc => uc.Chat).ThenInclude(c => c.UserChats) .Include(uc => uc.User).ThenInclude(u => u.UserChats) .ToList(); } public IEnumerable<ChatSimpleDTO> GetChatSimples() { return PokebookContext.Chats.ProjectTo<ChatSimpleDTO>(mapper.ConfigurationProvider).ToList(); } public IEnumerable<Chat> FindChatsForUser(Guid Id) { var userChats = GetUserChats(); return userChats.Where(uc => uc.User.Id == Id) .Select(uc => uc.Chat) .ToList(); } public IEnumerable<Chat> FindChatsForUser(string username) { var userChats = GetUserChats(); return userChats.Where(uc => uc.User.UserName == username) .Select(uc => uc.Chat) .ToList(); } public IEnumerable<string> FindChatNamesForUser(Guid Id) { IEnumerable<Chat> chatList = FindChatsForUser(Id); return chatList.Select(x => x.Name) .ToList(); } public PokebookContext PokebookContext { get { return db as PokebookContext; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Oranikle.Studio.Controls { public interface IMsysBusinessBase { bool HasDataConflict { get; set; } bool CanAddObject(); bool CanDeleteObject(); bool CanEditObject(); bool CanGetObject(); System.Collections.Generic.List<Csla.Validation.BrokenRule> GetFullBrokenRules(); string GetHumanReadableName(); } }
using Newtonsoft.Json; namespace PayU.Models.Base.Subcomponents { /// <summary> /// Describes the details of the Payer for the transaction. /// </summary> public class Payer { /// <summary> /// The Payer's identifier of the buyer in the shop’s system. /// </summary> [JsonProperty("merchantPayerId")] public string MerchantPayerId { get; set; } /// <summary> /// The Payer's full name. /// </summary> [JsonProperty("fullName")] public string FullName { get; set; } /// <summary> /// The Payer's email. /// </summary> [JsonProperty("emailAddress")] public string EmailAddress { get; set; } /// <summary> /// The Payer's contact phone. /// </summary> [JsonProperty("contactPhone")] public string ContactPhone { get; set; } /// <summary> /// The Payer's date of birth. /// </summary> [JsonProperty("birthDate")] public string BirthDate { get; set; } /// <summary> /// The type of identification number of the Payer. /// See http://developers.payulatam.com/en/api/variables_table.html for available types. /// </summary> [JsonProperty("dniType")] public string DNIType { get; set; } /// <summary> /// The Payer's national identification number. /// For Brazil, an algorithm must be used to validate the CPF, and must be formatted XXX.XXX.XXX-XX. /// For example: 811.807.405-64 /// </summary> [JsonProperty("dniNumber")] public string DNINumber { get; set; } /// <summary> /// The Payer's shipping address. /// </summary> [JsonProperty("billingAddress")] public Address BillingAddress { get; set; } } }
// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschränkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace Squidex.Config.Authentication { public static class AuthenticationServices { public static void AddMyAuthentication(this IServiceCollection services, IConfiguration config) { var identityOptions = config.GetSection("identity").Get<MyIdentityOptions>(); services.AddAuthentication() .AddMyExternalGoogleAuthentication(identityOptions) .AddMyExternalMicrosoftAuthentication(identityOptions) .AddMyExternalOdic(identityOptions) .AddMyIdentityServerAuthentication(identityOptions, config) .AddCookie(); } } }
using LagoaVista.DeviceSimulator.Services; using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace LagoaVista.DeviceSimulator.UWP.Services { public class SocketClient : ISocketClient { TcpClient _client; public Task CloseAsync() { if(_client != null) { _client.Dispose(); _client = null; } return Task.FromResult(default(object)); } public async Task Connect(string host, int port) { _client = new TcpClient(AddressFamily.InterNetwork); await _client.ConnectAsync(host, port); } public Task<int> ReadAsync(byte[] buffer) { return _client.GetStream().ReadAsync(buffer, 0, buffer.Length); } public Task WriteAsync(byte[] buffer, int start, int length) { return _client.GetStream().WriteAsync(buffer, start, length); } public Task WriteAsync(byte[] buffer) { return _client.GetStream().WriteAsync(buffer, 0, buffer.Length); } public Task WriteAsync(string output) { var buffer = System.Text.ASCIIEncoding.ASCII.GetBytes(output); return _client.GetStream().WriteAsync(buffer, 0, buffer.Length); } public void Dispose() { CloseAsync(); } } }
using System.Collections.Generic; namespace Windar.PlayerPlugin { class PlaydarResults { int _pollInterval; int _pollLimit; bool _solved; List<PlayItem> _playItems; public int PollInterval { get { return _pollInterval; } set { _pollInterval = value; } } public int PollLimit { get { return _pollLimit; } set { _pollLimit = value; } } public bool Solved { get { return _solved; } set { _solved = value; } } public List<PlayItem> PlayItems { get { return _playItems; } set { _playItems = value; } } public PlaydarResults() { PlayItems = new List<PlayItem>(); } } }
using Akka.Actor; using Durian.IO; using System.Net; namespace Durian.Authentication { public class SessionService : ReceiveActor { IActorRef server; public SessionService() { // TODO configure server settings server = Context.ActorOf(Server.Props(null)); Context.Watch(server); // TODO configure server settings server.Tell(new Bind(new IPEndPoint(IPAddress.Loopback, 1000))); Receive<Connected>(m => { //Context.ActorOf() }); } } }
// ReSharper disable once CheckNamespace namespace OpenPoseDotNet { public enum PoseCar12Part { FrontRightWheel = 0, FrontLeftWheel = 1, BackRightWheel = 2, BackLeftWheel = 3, FrontRightLight = 4, FrontLeftLight = 5, BackRightLight = 6, BackLeftLight = 7, FrontRightTop = 8, FrontLeftTop = 9, BackRightTop = 10, BackLeftTop = 11, Background = 12 } }
using Lidgren.Network; using System; using System.ComponentModel.DataAnnotations; namespace Gem.Network { /// <summary> /// How a message is sent /// </summary> public class PackageConfig { #region Required Fields [Required] public int SequenceChannel { get; set; } [Required] public NetDeliveryMethod DeliveryMethod { get; set; } #endregion #region Predefined PackagesConfigs public static PackageConfig TCP { get { return new PackageConfig { SequenceChannel = 0, DeliveryMethod = NetDeliveryMethod.ReliableSequenced }; } } public static PackageConfig UDP { get { return new PackageConfig { SequenceChannel = 0, DeliveryMethod = NetDeliveryMethod.Unreliable }; } } public static PackageConfig UDPSequenced { get { return new PackageConfig { SequenceChannel = 0, DeliveryMethod = NetDeliveryMethod.UnreliableSequenced }; } } #endregion } }
using System; public class AutocompletionSettings { public Func<int, string, string[]> Match; public AutocompletionSettings (Func<string, string[]> match) { Match = (Func<int, string, string[]>) delegate(int index, string key) { if (index == 0) { return match(key); } return null; }; } public AutocompletionSettings(Func<int, string, string[]> match) { Match = match; } public static bool MatchContains = true; } public static class StringAutocompletionExtensions { public static bool AutocompletionMatch(this string text, string match) { if (AutocompletionSettings.MatchContains) { return text.Contains (match); } else { return text.StartsWith (match); } } }
namespace Leeax.Web { public enum Unit { Pixel, Percent, EM, REM, ViewportWidth, ViewportHeight } }
using System; using System.Collections.Generic; //using System.Linq; using System.Text; using Bio; using Bio.IO; using Bio.IO.FastA; namespace AlphabetSoup { class Program { static void Main(string[] args) { string filename = @"c:\users\mark\desktop\data\Simple_GenBank_DNA.genbank"; //ISequenceParser parser = // SequenceParsers.FindParserByFileName(filename); using (ISequenceParser parser = new FastAParser(filename)) { if (parser != null) { IEnumerable<ISequence> sequences = parser.Parse(); foreach (ISequence sequence in sequences) { Console.WriteLine("{0}: {1}", sequence.ID, sequence); } } } } static void UseOurOwnSequences() { ISequenceParser parser; Sequence newSequence = new Sequence(Alphabets.RNA, "ACGU---GG--UU--CC--AA"); Console.WriteLine( newSequence.ConvertToString(0, newSequence.Count)); foreach (byte symbol in newSequence) { Console.WriteLine(symbol); } } static void TestAlphabet() { //IAlphabet dnaAlphabet = Alphabets.DNA; foreach (var alphabet in Alphabets.All) { Console.WriteLine("{0} - {1}, HasGaps={2}, HasTerminators={3}, HasAmbiguities={4}", alphabet.Name, alphabet, alphabet.HasGaps, alphabet.HasTerminations, alphabet.HasAmbiguity); foreach (byte symbol in alphabet) Console.WriteLine("\t{0} - {1}", (char) symbol, symbol); } } } }
/*===========================================================================*/ /* * * FileName : DestroyOtherBackground.cs * * * Author : Hiroki_Kitahara. */ /*===========================================================================*/ using UnityEngine; using System.Collections; public class DestroyOtherBackground : MonoBehaviour { // Use this for initialization void Awake () { if (ReferenceManager.Instance == null) { return; } var backgroundTransform = ReferenceManager.Instance.BackgroundLayer.transform; for( int i=0; i<backgroundTransform.childCount; i++ ) { Destroy( backgroundTransform.GetChild( i ).gameObject ); } } }
namespace Fumbbl.Ffb.Dto { public abstract class Report : ReflectedGenerator<string> { public Report(string key) : base(key) { } } }
using HarmonyLib; using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; /// <summary> /// See https://github.com/pardeike/Harmony/wiki for a full reference on Harmony. /// </summary> namespace PentaSaber.HarmonyPatches { [HarmonyPatch(typeof(ColorManager), nameof(ColorManager.ColorForSaberType), new Type[] { typeof(SaberType)})] public class ColorManager_ColorForSaberType { static void Postfix(ColorManager __instance, ref SaberType type, ref Color __result) { PentaSaberController? controller = PentaSaberController.Instance; if (controller == null) return; PentaNoteType noteType = controller.GetCurrentSaberType(type); __result = Plugin.Config.GetColor(noteType); } } }
using System; using System.Runtime.Serialization; using ChineseDuck.Bot.Interfaces.Data; using Newtonsoft.Json; namespace ChineseDuck.Bot.Rest.Model { /// <summary> /// /// </summary> [DataContract] public class Score : BaseModel, IScore { /// <summary> /// Gets or Sets OriginalWordCount /// </summary> [DataMember (Name = "originalWordCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "originalWordCount")] public int OriginalWordCount { get; set; } /// <summary> /// Gets or Sets OriginalWordSuccessCount /// </summary> [DataMember (Name = "originalWordSuccessCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "originalWordSuccessCount")] public int OriginalWordSuccessCount { get; set; } /// <summary> /// Gets or Sets LastView /// </summary> [DataMember (Name = "lastView", EmitDefaultValue = false)] [JsonProperty (PropertyName = "lastView")] public DateTime LastView { get; set; } /// <summary> /// Gets or Sets LastLearned /// </summary> [DataMember (Name = "lastLearned", EmitDefaultValue = false)] [JsonProperty (PropertyName = "lastLearned")] public DateTime? LastLearned { get; set; } /// <summary> /// Gets or Sets LastLearnMode /// </summary> [DataMember (Name = "lastLearnMode", EmitDefaultValue = false)] [JsonProperty (PropertyName = "lastLearnMode")] public string LastLearnMode { get; set; } /// <summary> /// Gets or Sets RightAnswerNumber /// </summary> [DataMember (Name = "rightAnswerNumber", EmitDefaultValue = false)] [JsonProperty (PropertyName = "rightAnswerNumber")] public short? RightAnswerNumber { get; set; } /// <summary> /// Gets or Sets PronunciationCount /// </summary> [DataMember (Name = "pronunciationCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "pronunciationCount")] public int PronunciationCount { get; set; } /// <summary> /// Gets or Sets PronunciationSuccessCount /// </summary> [DataMember (Name = "pronunciationSuccessCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "pronunciationSuccessCount")] public int PronunciationSuccessCount { get; set; } /// <summary> /// Gets or Sets TranslationCount /// </summary> [DataMember (Name = "translationCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "translationCount")] public int TranslationCount { get; set; } /// <summary> /// Gets or Sets TranslationSuccessCount /// </summary> [DataMember (Name = "translationSuccessCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "translationSuccessCount")] public int TranslationSuccessCount { get; set; } /// <summary> /// Gets or Sets ViewCount /// </summary> [DataMember (Name = "viewCount", EmitDefaultValue = false)] [JsonProperty (PropertyName = "viewCount")] public int ViewCount { get; set; } /// <summary> /// Gets or Sets Name /// </summary> [DataMember (Name = "name", EmitDefaultValue = false)] [JsonProperty (PropertyName = "name")] public string Name { get; set; } } }
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using com.eforceglobal.DBAdmin.Utils; public partial class Top : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) imgLogo.ImageUrl = UIManager.GetThemedURL(this, @"/img/app/SQLDBAdminLogo.jpg"); } protected void lnkDisconnect_Click(object sender, EventArgs e) { SessionManager.ClearAll(); FormsAuthentication.SignOut(); string redirectUrl = FormsAuthentication.LoginUrl; string js = string.Format("javascript:window.parent.navigate('{0}');", redirectUrl); ScriptManager.RegisterClientScriptBlock(this, GetType(), "Redirect_To_Home", js, true); } }
using System; namespace Playground.Features.Userfy { public class PermissionAttribute : Attribute { public Permissions Permission { get; } public PermissionAttribute(Permissions permission) { Permission = permission; } } }
using System.ComponentModel.DataAnnotations.Schema; namespace api.Models { public class Topside { public Guid Id { get; set; } public string Name { get; set; } = string.Empty!; public Project Project { get; set; } = null!; public Guid ProjectId { get; set; } public TopsideCostProfile? CostProfile { get; set; } public TopsideCessationCostProfile? CessationCostProfile { get; set; } public double DryWeight { get; set; } public double OilCapacity { get; set; } public double GasCapacity { get; set; } public double FacilitiesAvailability { get; set; } public ArtificialLift ArtificialLift { get; set; } public Maturity Maturity { get; set; } public Currency Currency { get; set; } public double FuelConsumption { get; set; } public double FlaredGas { get; set; } public double CO2ShareOilProfile { get; set; } public double CO2ShareGasProfile { get; set; } public double CO2ShareWaterInjectionProfile { get; set; } public double CO2OnMaxOilProfile { get; set; } public double CO2OnMaxGasProfile { get; set; } public double CO2OnMaxWaterInjectionProfile { get; set; } public int CostYear { get; set; } public DateTimeOffset? ProspVersion { get; set; } public DateTimeOffset LastChangedDate { get; set; } public Source Source { get; set; } } public class TopsideCostProfile : TimeSeriesCost { [ForeignKey("Topside.Id")] public Topside Topside { get; set; } = null!; } public class TopsideCessationCostProfile : TimeSeriesCost { [ForeignKey("Topside.Id")] public Topside Topside { get; set; } = null!; } }
using System; using System.ComponentModel; namespace DeltaCompressionDotNet.PatchApi { public sealed class PatchApiCompression : IDeltaCompression { public void CreateDelta(string oldFilePath, string newFilePath, string deltaFilePath) { const int optionFlags = 0; var optionData = IntPtr.Zero; if (!NativeMethods.CreatePatchFile(oldFilePath, newFilePath, deltaFilePath, optionFlags, optionData)) throw new Win32Exception(); } public void ApplyDelta(string deltaFilePath, string oldFilePath, string newFilePath) { const int applyOptionFlags = 0; if (!NativeMethods.ApplyPatchToFile(deltaFilePath, oldFilePath, newFilePath, applyOptionFlags)) throw new Win32Exception(); } } }
using Gunnsoft.Cqs.Events; using MongoDB.Bson; namespace Stubbl.Api.Events.TeamUpdated.Version1 { public class TeamUpdatedEvent : IEvent { public TeamUpdatedEvent(ObjectId teamId, string name) { TeamId = teamId; Name = name; } public string Name { get; } public ObjectId TeamId { get; } } }
using System; namespace Yggdrasil.Scheduling { /// <summary> /// An exception that happened while executing a scheduled callback. /// </summary> public class CallbackException : Exception { /// <summary> /// Creates new exception. /// </summary> /// <param name="innerException"></param> public CallbackException(Exception innerException) : base(innerException.Message, innerException) { } } }
using System; using System.Collections.Generic; using WinDbgDebug.WinDbg.Data; namespace WinDbgDebug.WinDbg.Results { public class StackTraceMessageResult : MessageResult { public StackTraceMessageResult(IEnumerable<StackTraceFrame> frames) { if (frames == null) throw new ArgumentNullException(nameof(frames)); Frames = frames; } public IEnumerable<StackTraceFrame> Frames { get; private set; } } }
using System; using System.Collections.Generic; using System.Text; namespace Shared.Models { public class ClassDetailsModel { public string Name { get; set; } public string Accessifier { get; set; } public Type Details { get; set; } public List<MethodDetailsModel> Methods { get; set; } public string Description { get; set; } } }
using System; using System.Collections.Generic; using System.Numerics; using System.Text; using System.Threading.Tasks; using MineCase.Algorithm; using MineCase.Algorithm.Game.Entity.Ai.MobAi; using MineCase.Algorithm.World.Biomes; using MineCase.Engine; using MineCase.Graphics; using MineCase.Server.Components; using MineCase.Server.Game.BlockEntities; using MineCase.Server.World; using MineCase.Server.World.EntitySpawner; using MineCase.Server.World.EntitySpawner.Ai; using MineCase.Server.World.EntitySpawner.Ai.Action; using MineCase.Server.World.EntitySpawner.Ai.MobAi; using MineCase.World; using MineCase.World.Biomes; using MineCase.World.Generation; using Orleans; namespace MineCase.Server.Game.Entities.Components { internal class MobSpawnerComponent : Component<PlayerGrain> { private Random random; public MobSpawnerComponent(string name = "mobSpawner") : base(name) { random = new Random(); } protected override void OnAttached() { Register(); } protected override void OnDetached() { Unregister(); } private void Register() { AttachedObject.GetComponent<GameTickComponent>() .Tick += OnGameTick; } private void Unregister() { AttachedObject.GetComponent<GameTickComponent>() .Tick -= OnGameTick; } private async Task OnGameTick(object sender, GameTickArgs e) { if (e.WorldAge % 512 == 0 && e.TimeOfDay > 12000 && e.TimeOfDay < 24000) { EntityWorldPos playerPosition = AttachedObject.GetValue(EntityWorldPositionComponent.EntityWorldPositionProperty); int x = random.Next(9) - 4 + (int)playerPosition.X; int z = random.Next(9) - 4 + (int)playerPosition.Z; BlockWorldPos monsterBlockPos = new BlockWorldPos(x, 0, z); ChunkWorldPos monsterChunkPos = monsterBlockPos.ToChunkWorldPos(); var chunkAccessor = AttachedObject.GetComponent<ChunkAccessorComponent>(); BiomeId biomeId = await chunkAccessor.GetBlockBiome(monsterBlockPos); IWorld world = AttachedObject.GetValue(WorldComponent.WorldProperty); GeneratorSettings setting = await world.GetGeneratorSettings(); Biome biome = Biome.GetBiome((int)biomeId, setting); IChunkColumn chunk = await chunkAccessor.GetChunk(monsterChunkPos); // TODO biome.SpawnMonster(world, GrainFactory, await chunk.GetState(), random, monsterBlockPos); } } } }
using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Razor.TagHelpers; using System; using System.IO; using System.Text.Encodings.Web; namespace Polygon.TagHelpers { public class IndentHtmlContentBuilderWrapper : IHtmlContentBuilder, IDisposable { private readonly TagHelperContent _content; private int _count; public IndentHtmlContentBuilderWrapper(TagHelperContent content) { _content = content; _count = 0; } void IDisposable.Dispose() { _count--; } public IndentHtmlContentBuilderWrapper Dispose() { _count--; return this; } public IndentHtmlContentBuilderWrapper Indent() { _count++; return this; } public IndentHtmlContentBuilderWrapper L() { _content.AppendHtml("\n"); for (int i = 0; i < _count; i++) _content.AppendHtml(" "); return this; } public IndentHtmlContentBuilderWrapper H(string encoded) { _content.AppendHtml(encoded); return this; } public IndentHtmlContentBuilderWrapper Encode(string unencoded) { _content.Append(unencoded); return this; } public IndentHtmlContentBuilderWrapper H(int encoded) { _content.AppendHtml(encoded.ToString()); return this; } public IndentHtmlContentBuilderWrapper H(double encoded) { _content.AppendHtml(encoded.ToString()); return this; } IHtmlContentBuilder IHtmlContentBuilder.Append(string unencoded) => _content.Append(unencoded); IHtmlContentBuilder IHtmlContentBuilder.AppendHtml(IHtmlContent content) => _content.AppendHtml(content); IHtmlContentBuilder IHtmlContentBuilder.AppendHtml(string encoded) => _content.AppendHtml(encoded); IHtmlContentBuilder IHtmlContentBuilder.Clear() => _content.Clear(); void IHtmlContentContainer.CopyTo(IHtmlContentBuilder builder) => _content.CopyTo(builder); void IHtmlContentContainer.MoveTo(IHtmlContentBuilder builder) => _content.MoveTo(builder); void IHtmlContent.WriteTo(TextWriter writer, HtmlEncoder encoder) => _content.WriteTo(writer, encoder); } }
using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; namespace OPSMBackend.DataEntities { public partial class OPSMContext : DbContext { public OPSMContext() { } public OPSMContext(DbContextOptions<OPSMContext> options) : base(options) { } public virtual DbSet<Abbrevations> Abbrevations { get; set; } public virtual DbSet<Dealers> Dealers { get; set; } public virtual DbSet<EmployeeCategories> EmployeeCategories { get; set; } public virtual DbSet<EmployeeRoles> EmployeeRoles { get; set; } public virtual DbSet<Employees> Employees { get; set; } public virtual DbSet<Genders> Genders { get; set; } public virtual DbSet<HdlRegistration> HdlRegistration { get; set; } public virtual DbSet<Initials> Initials { get; set; } public virtual DbSet<Inventories> Inventories { get; set; } public virtual DbSet<OtherTests> OtherTests { get; set; } public virtual DbSet<Patient> Patient { get; set; } public virtual DbSet<ReagentBillEntries> ReagentBillEntries { get; set; } public virtual DbSet<Reagents> Reagents { get; set; } public virtual DbSet<RegistrationCategories> RegistrationCategories { get; set; } public virtual DbSet<RegistrationTypes> RegistrationTypes { get; set; } public virtual DbSet<RoleTypes> RoleTypes { get; set; } public virtual DbSet<Salary> Salary { get; set; } public virtual DbSet<SignaturePrototypes> SignaturePrototypes { get; set; } public virtual DbSet<TestGroups> TestGroups { get; set; } public virtual DbSet<TestReagentRelation> TestReagentRelation { get; set; } public virtual DbSet<TestResults> TestResults { get; set; } public virtual DbSet<TestResultsView> TestResultsView { get; set; } public virtual DbSet<TestTitles> TestTitles { get; set; } public virtual DbSet<UserRights> UserRights { get; set; } public virtual DbSet<Users> Users { get; set; } public virtual DbSet<FieldOptions> FieldOptions { get; set; } public virtual DbSet<Fields> Fields { get; set; } public virtual DbSet<AccountHead> AccountHead { get; set; } public virtual DbSet<OtherIncome> OtherIncome { get; set; } public virtual DbSet<Expenses> Expenses { get; set; } public virtual DbSet<ExpensesAccountHead> ExpensesAccountHead { get; set; } public virtual DbSet<SalaryPayment> SalaryPayment { get; set; } public virtual DbSet<PatientCounts> PatientCounts { get; set; } public virtual DbSet<MonthlyRateList> MonthlyRateList { get; set; } public virtual DbSet<ReferringRateList> ReferringRateList { get; set; } public virtual DbSet<SpecializedLabRateList> SpecializedLabRateList { get; set; } public virtual DbSet<SpecializedLabSamples> SpecializedLabSamples { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Abbrevations>(entity => { entity.ToTable("abbrevations"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Abbreavation) .IsRequired() .HasColumnName("abbreavation") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.Interpretation) .IsRequired() .HasColumnName("interpretation") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.SerialNo).HasColumnName("serial_no"); entity.Property(e => e.OtherTestId).HasColumnName("other_test_id"); entity.HasOne(d => d.OtherTest) .WithMany(p => p.Abbrevations) .HasForeignKey(d => d.OtherTestId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__abbrevati__other__3A179ED3"); }); modelBuilder.Entity<Dealers>(entity => { entity.ToTable("dealers"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Address) .HasColumnName("address") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.Email) .HasColumnName("email") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.Fax) .HasColumnName("fax") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.MobileNo) .HasColumnName("mobile_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.PhoneNo) .HasColumnName("phone_no") .HasMaxLength(13) .IsUnicode(false); }); modelBuilder.Entity<EmployeeCategories>(entity => { entity.ToTable("employee_categories"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.EmployeeCategory) .IsRequired() .HasColumnName("employee_category") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<EmployeeRoles>(entity => { entity.ToTable("employee_roles"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.EmployeeRole) .IsRequired() .HasColumnName("employee_role") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<Employees>(entity => { entity.ToTable("employees"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Address) .IsRequired() .HasColumnName("address") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.DateOfBirth) .HasColumnName("date_of_birth") .HasColumnType("datetime"); entity.Property(e => e.Email) .HasColumnName("email") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.EmpCategoryId).HasColumnName("emp_category_id"); entity.Property(e => e.EmployeeRoleId).HasColumnName("employee_role_id"); entity.Property(e => e.FieldOptionsId).HasColumnName("field_options_id"); entity.Property(e => e.FirstName) .IsRequired() .HasColumnName("first_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.GenderId).HasColumnName("gender_id"); entity.Property(e => e.LastName) .HasColumnName("last_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MiddleName) .HasColumnName("middle_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MobileNo) .HasColumnName("mobile_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.PhoneNo) .HasColumnName("phone_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.Supervisor).HasColumnName("supervisor"); entity.HasOne(d => d.EmpCategory) .WithMany(p => p.Employees) .HasForeignKey(d => d.EmpCategoryId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__employees__emp_c__4C364F0E"); entity.HasOne(d => d.EmployeeRole) .WithMany(p => p.Employees) .HasForeignKey(d => d.EmployeeRoleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__employees__emplo__4E1E9780"); entity.HasOne(d => d.FieldOptions) .WithMany(p => p.Employees) .HasForeignKey(d => d.FieldOptionsId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__employees__field__4D2A7347"); entity.HasOne(d => d.Gender) .WithMany(p => p.Employees) .HasForeignKey(d => d.GenderId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__employees__gende__4B422AD5"); }); modelBuilder.Entity<Formulas>(entity => { entity.ToTable("formulas"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Formula) .IsRequired() .HasColumnName("formula") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.GroupId).HasColumnName("group_id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.TestId).HasColumnName("test_id"); entity.Property(e => e.TitleId).HasColumnName("title_id"); entity.HasOne(d => d.Group) .WithMany(p => p.Formulas) .HasForeignKey(d => d.GroupId) .HasConstraintName("FK__formulas__group___09746778"); entity.HasOne(d => d.Test) .WithMany(p => p.Formulas) .HasForeignKey(d => d.TestId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__formulas__test_i__756D6ECB"); entity.HasOne(d => d.Title) .WithMany(p => p.Formulas) .HasForeignKey(d => d.TitleId) .HasConstraintName("FK__formulas__title___0880433F"); }); modelBuilder.Entity<Genders>(entity => { entity.ToTable("genders"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Gender) .HasColumnName("gender") .HasMaxLength(10) .IsUnicode(false); }); modelBuilder.Entity<HdlRegistration>(entity => { entity.ToTable("hdl_registration"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AdditionalNotes) .HasColumnName("additional_notes") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.Address) .HasColumnName("address") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.Email) .HasColumnName("email") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MobileNo) .HasColumnName("mobile_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .HasColumnName("name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.PhoneNo) .HasColumnName("phone_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.RegistrationCategoryId).HasColumnName("registration_category_id"); entity.Property(e => e.RegistrationTypeId).HasColumnName("registration_type_id"); entity.HasOne(d => d.RegistrationCategory) .WithMany(p => p.HdlRegistration) .HasForeignKey(d => d.RegistrationCategoryId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__hdl_regis__regis__4BAC3F29"); entity.HasOne(d => d.RegistrationType) .WithMany(p => p.HdlRegistration) .HasForeignKey(d => d.RegistrationTypeId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__hdl_regis__regis__4AB81AF0"); }); modelBuilder.Entity<Initials>(entity => { entity.ToTable("initials"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Initial) .IsRequired() .HasColumnName("initial") .HasMaxLength(10) .IsUnicode(false); }); modelBuilder.Entity<Inventories>(entity => { entity.ToTable("inventories"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Comment) .HasColumnName("comment") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.Description) .HasColumnName("description") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ItemName) .IsRequired() .HasColumnName("item_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ItemType).HasColumnName("item_type"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Quantity).HasColumnName("quantity"); }); modelBuilder.Entity<OtherTests>(entity => { entity.ToTable("other_tests"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.DefaultValue) .HasColumnName("default_value") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.DescriptiveResult).HasColumnName("descriptive_result"); entity.Property(e => e.DisplayInBoldFontInReport).HasColumnName("display_in_bold_font_in_report"); entity.Property(e => e.DisplayInTestResult).HasColumnName("display_in_test_result"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Options) .HasColumnName("options") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.OrderBy).HasColumnName("order_by"); entity.Property(e => e.TestGroupId).HasColumnName("test_group_id"); entity.Property(e => e.TestTitleId).HasColumnName("test_title_id"); entity.Property(e => e.Unit) .HasColumnName("unit") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.ValChild) .HasColumnName("val_child") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ValFemale) .HasColumnName("val_female") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ValMale) .HasColumnName("val_male") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ValNoenatal) .HasColumnName("val_noenatal") .HasMaxLength(300) .IsUnicode(false); entity.HasOne(d => d.TestGroup) .WithMany(p => p.OtherTests) .HasForeignKey(d => d.TestGroupId) .OnDelete(DeleteBehavior.Cascade) .HasConstraintName("FK__other_tes__test___3B75D760"); entity.HasOne(d => d.TestTitle) .WithMany(p => p.OtherTests) .HasForeignKey(d => d.TestTitleId) .OnDelete(DeleteBehavior.Cascade) .HasConstraintName("FK__other_tes__test___3C69FB99"); }); modelBuilder.Entity<Patient>(entity => { entity.ToTable("patient"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Address) .HasColumnName("address") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.AgeInDays).HasColumnName("age_in_days"); entity.Property(e => e.AgeInMonths).HasColumnName("age_in_months"); entity.Property(e => e.AgeInYears).HasColumnName("age_in_years"); entity.Property(e => e.CivilStatus).HasColumnName("civil_status"); entity.Property(e => e.IsFinished).HasColumnName("is_finished"); entity.Property(e => e.Email) .HasColumnName("email") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.FirstName) .IsRequired() .HasColumnName("first_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.Gender).HasColumnName("gender"); entity.Property(e => e.InitialId).HasColumnName("initial_id"); entity.Property(e => e.LastName) .HasColumnName("last_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MiddleName) .HasColumnName("middle_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MobileNo) .HasColumnName("mobile_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Occupation) .HasColumnName("occupation") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.PatientCode) .IsRequired() .HasColumnName("patient_code") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.PhoneNo) .HasColumnName("phone_no") .HasMaxLength(13) .IsUnicode(false); entity.Property(e => e.ReferredBy) .HasColumnName("referred_by") .HasDefaultValueSql("((0))"); entity.Property(e => e.RegistrationDate) .HasColumnName("registration_date") .HasColumnType("datetime"); entity.HasOne(d => d.CivilStatusNavigation) .WithMany(p => p.Patient) .HasForeignKey(d => d.CivilStatus) .HasConstraintName("FK__patient__civil_s__79FD19BE"); entity.HasOne(d => d.GenderNavigation) .WithMany(p => p.Patient) .HasForeignKey(d => d.Gender) .HasConstraintName("FK__patient__gender__2E1BDC42"); entity.HasOne(d => d.Initial) .WithMany(p => p.Patient) .HasForeignKey(d => d.InitialId) .HasConstraintName("FK__patient__initial__2D27B809"); }); modelBuilder.Entity<ReagentBillEntries>(entity => { entity.ToTable("reagent_bill_entries"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Amount) .HasColumnName("amount") .HasColumnType("money"); entity.Property(e => e.BillDate) .HasColumnName("bill_date") .HasColumnType("datetime"); entity.Property(e => e.BillNo).HasColumnName("bill_no"); entity.Property(e => e.DealerId).HasColumnName("dealer_id"); entity.Property(e => e.DeliveryDate) .HasColumnName("delivery_date") .HasColumnType("datetime"); entity.Property(e => e.ExpiryDate) .HasColumnName("expiry_date") .HasColumnType("datetime"); entity.Property(e => e.IsPaid).HasColumnName("is_paid"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Quantity).HasColumnName("quantity"); entity.Property(e => e.Rate).HasColumnName("rate"); entity.Property(e => e.ReagentId).HasColumnName("reagent_id"); entity.HasOne(d => d.Dealer) .WithMany(p => p.ReagentBillEntries) .HasForeignKey(d => d.DealerId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__reagent_b__deale__72C60C4A"); entity.HasOne(d => d.Reagent) .WithMany(p => p.ReagentBillEntries) .HasForeignKey(d => d.ReagentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__reagent_b__reage__73BA3083"); }); modelBuilder.Entity<Reagents>(entity => { entity.ToTable("reagents"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AdditionalNotes) .HasColumnName("additional_notes") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.ExpiryDate) .HasColumnName("expiry_date") .HasColumnType("datetime"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.PackingSize).HasColumnName("packing_size"); entity.Property(e => e.PurchaseDate) .HasColumnName("purchase_date") .HasColumnType("datetime"); entity.Property(e => e.ReorderLevel).HasColumnName("reorder_level"); entity.Property(e => e.UnitInStock).HasColumnName("unit_in_stock"); entity.Property(e => e.UnitPrice).HasColumnName("unit_price"); }); modelBuilder.Entity<RegistrationCategories>(entity => { entity.ToTable("registration_categories"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.RegistrationCategory) .IsRequired() .HasColumnName("registration_category") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<RegistrationTypes>(entity => { entity.ToTable("registration_types"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.RegistrationType) .IsRequired() .HasColumnName("registration_type") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<RoleTypes>(entity => { entity.ToTable("role_types"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Role) .IsRequired() .HasColumnName("role") .HasMaxLength(50) .IsUnicode(false); }); modelBuilder.Entity<Salary>(entity => { entity.ToTable("salary"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AccountNo).HasColumnName("account_no"); entity.Property(e => e.BankName) .IsRequired() .HasColumnName("bank_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.BasicSalary).HasColumnName("basic_salary"); entity.Property(e => e.CommunicationAllowance).HasColumnName("communication_allowance"); entity.Property(e => e.EmployeeId).HasColumnName("employee_id"); entity.Property(e => e.Hra).HasColumnName("hra"); entity.Property(e => e.LearningAllowance).HasColumnName("learning_allowance"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.SalaryAmount).HasColumnName("salary_amount"); entity.Property(e => e.TransportationAllowance).HasColumnName("transportation_allowance"); entity.HasOne(d => d.Employee) .WithMany(p => p.Salaries) .HasForeignKey(d => d.EmployeeId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__salary__employee__3552E9B6"); }); modelBuilder.Entity<SignaturePrototypes>(entity => { entity.ToTable("signature_prototypes"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Degree) .IsRequired() .HasColumnName("degree") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.DoctorName) .IsRequired() .HasColumnName("doctor_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.Specialization) .IsRequired() .HasColumnName("specialization") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<TestGroups>(entity => { entity.ToTable("test_groups"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.Notes) .HasColumnName("notes") .HasMaxLength(300) .IsUnicode(false); entity.Property(e => e.OrderNo).HasColumnName("order_no"); entity.Property(e => e.ShowTitleInReports).HasColumnName("show_title_in_reports"); }); modelBuilder.Entity<PatientBill>(entity => { entity.ToTable("patient_bill"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AmountPaid).HasColumnName("amount_paid"); entity.Property(e => e.Balance).HasColumnName("balance"); entity.Property(e => e.BillDate) .HasColumnName("bill_date") .HasColumnType("datetime"); entity.Property(e => e.BillNo).HasColumnName("bill_no"); entity.Property(e => e.Discount).HasColumnName("discount"); entity.Property(e => e.DiscountedAmount).HasColumnName("discounted_amount"); entity.Property(e => e.Gst).HasColumnName("gst"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.PatientId).HasColumnName("patient_id"); entity.Property(e => e.TotalCharges).HasColumnName("total_charges"); entity.HasOne(d => d.Patient) .WithMany(p => p.PatientBill) .HasForeignKey(d => d.PatientId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__patient_b__patie__1B9317B3"); }); modelBuilder.Entity<TestReagentRelation>(entity => { entity.ToTable("test_reagent_relation"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.OtherTestId).HasColumnName("other_test_id"); entity.Property(e => e.QtyPerTest).HasColumnName("qty_per_test"); entity.Property(e => e.ReagentId).HasColumnName("reagent_id"); entity.Property(e => e.Unit).HasColumnName("unit"); entity.HasOne(d => d.OtherTest) .WithMany(p => p.TestReagentRelation) .HasForeignKey(d => d.OtherTestId) .HasConstraintName("FK__test_reag__other__2CBDA3B5"); entity.HasOne(d => d.Reagent) .WithMany(p => p.TestReagentRelation) .HasForeignKey(d => d.ReagentId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__test_reag__reage__4316F928"); }); modelBuilder.Entity<TestResults>(entity => { entity.ToTable("test_results"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.GroupId).HasColumnName("group_id"); entity.Property(e => e.LargeTestResult) .HasColumnName("large_test_result") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.TestId).HasColumnName("test_id"); entity.Property(e => e.TestResult) .HasColumnName("test_result") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.PatientCode) .HasColumnName("patient_code") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.PatientId).HasColumnName("patient_id"); entity.Property(e => e.TitleId).HasColumnName("title_id"); entity.HasOne(d => d.Group) .WithMany(p => p.TestResults) .HasForeignKey(d => d.GroupId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__test_resu__group__4F47C5E3"); entity.HasOne(d => d.Test) .WithMany(p => p.TestResults) .HasForeignKey(d => d.TestId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__test_resu__test___51300E55"); entity.HasOne(d => d.Title) .WithMany(p => p.TestResults) .HasForeignKey(d => d.TitleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__test_resu__title__503BEA1C"); entity.HasOne(d => d.Patient) .WithMany(p => p.TestResultsCollection) .HasForeignKey(d => d.PatientId) .HasConstraintName("FK__test_resu__patie__55009F39"); }); modelBuilder.Entity<TestResultsView>(entity => { entity.HasNoKey(); entity.ToView("test_results_view"); entity.Property(e => e.GroupId).HasColumnName("group_id"); entity.Property(e => e.GroupName) .IsRequired() .HasColumnName("group_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.LargeTestResult) .HasColumnName("large_test_result") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.OtherTestId).HasColumnName("other_test_id"); entity.Property(e => e.PatientId).HasColumnName("patient_id"); entity.Property(e => e.TestName) .IsRequired() .HasColumnName("test_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.TestResult) .HasColumnName("test_result") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.TitleId).HasColumnName("title_id"); entity.Property(e => e.TestResultId).HasColumnName("test_result_id"); entity.Property(e => e.TitleName) .IsRequired() .HasColumnName("title_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Unit) .HasColumnName("unit") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.NormalRange) .HasColumnName("normal_range") .HasMaxLength(300) .IsUnicode(false); }); modelBuilder.Entity<TestTitles>(entity => { entity.ToTable("test_titles"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Charges).HasColumnName("charges"); entity.Property(e => e.OrderBy).HasColumnName("order_by"); entity.Property(e => e.FooterNote) .HasColumnName("footer_note") .IsUnicode(false); entity.Property(e => e.GroupId).HasColumnName("group_id"); entity.Property(e => e.HeaderNote) .HasColumnName("header_note") .IsUnicode(false); entity.Property(e => e.ModifiedBy) .IsRequired() .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ShowNormalRangeHeader).HasColumnName("show_normal_range_header"); entity.Property(e => e.WordFormatResult).HasColumnName("word_format_result"); entity.HasOne(d => d.Group) .WithMany(p => p.TestTitles) .HasForeignKey(d => d.GroupId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__test_titl__group__37A5467C"); }); modelBuilder.Entity<UserRights>(entity => { entity.ToTable("user_rights"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.About).HasColumnName("about"); entity.Property(e => e.AddOption).HasColumnName("add_option"); entity.Property(e => e.DeleteOption).HasColumnName("delete_option"); entity.Property(e => e.EditOption).HasColumnName("edit_option"); entity.Property(e => e.Finance).HasColumnName("finance"); entity.Property(e => e.Help).HasColumnName("help"); entity.Property(e => e.IncludeDigitalSignature).HasColumnName("include_digital_signature"); entity.Property(e => e.Maintenance).HasColumnName("maintenance"); entity.Property(e => e.Navigation).HasColumnName("navigation"); entity.Property(e => e.Registration).HasColumnName("registration"); entity.Property(e => e.Report).HasColumnName("report"); entity.Property(e => e.RoleTypeId).HasColumnName("role_type_id"); entity.Property(e => e.TestResult).HasColumnName("test_result"); entity.Property(e => e.Tools).HasColumnName("tools"); entity.Property(e => e.UserManagement).HasColumnName("user_management"); entity.Property(e => e.Windows).HasColumnName("windows"); entity.HasOne(d => d.RoleType) .WithMany(p => p.UserRights) .HasForeignKey(d => d.RoleTypeId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__user_righ__role___7F2BE32F"); }); modelBuilder.Entity<Users>(entity => { entity.ToTable("users"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Degree) .HasColumnName("degree") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.EmailId) .HasColumnName("email_id") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.FirstName) .IsRequired() .HasColumnName("first_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.LastName) .IsRequired() .HasColumnName("last_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.MiddleName) .HasColumnName("middle_name") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Password) .IsRequired() .HasColumnName("password") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.RoleId).HasColumnName("role_id"); entity.Property(e => e.Specialization) .HasColumnName("specialization") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.UserName) .IsRequired() .HasColumnName("user_name") .HasMaxLength(100) .IsUnicode(false); entity.HasOne(d => d.Role) .WithMany(p => p.Users) .HasForeignKey(d => d.RoleId) .HasConstraintName("FK__users__role_id__145C0A3F"); }); modelBuilder.Entity<FieldOptions>(entity => { entity.ToTable("field_options"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.FieldId).HasColumnName("field_id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(500) .IsUnicode(false); entity.HasOne(d => d.Field) .WithMany(p => p.FieldOptions) .HasForeignKey(d => d.FieldId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__field_opt__field__318258D2"); }); modelBuilder.Entity<Fields>(entity => { entity.ToTable("fields"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<AccountHead>(entity => { entity.ToTable("account_head"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(100) .IsUnicode(false); }); modelBuilder.Entity<OtherIncome>(entity => { entity.ToTable("other_income"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AccountHeadId).HasColumnName("account_head_id"); entity.Property(e => e.Amount) .HasColumnName("amount") .HasColumnType("money"); entity.Property(e => e.BankName) .HasColumnName("bank_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.Branch) .HasColumnName("branch") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.CardMode).HasColumnName("card_mode"); entity.Property(e => e.CardNo) .HasColumnName("card_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.CashMode).HasColumnName("cash_mode"); entity.Property(e => e.ChequeDate) .HasColumnName("cheque_date") .HasColumnType("datetime"); entity.Property(e => e.ChequeMode).HasColumnName("cheque_mode"); entity.Property(e => e.ChequeNo) .HasColumnName("cheque_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.IncomeDate) .HasColumnName("income_date") .HasColumnType("datetime"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.NatureOfWork) .IsRequired() .HasColumnName("nature_of_work") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.PaidBy) .HasColumnName("paid_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ReceiptNo).HasColumnName("receipt_no"); entity.HasOne(d => d.AccountHead) .WithMany(p => p.OtherIncome) .HasForeignKey(d => d.AccountHeadId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__other_inc__accou__56B3DD81"); }); modelBuilder.Entity<Expenses>(entity => { entity.ToTable("expenses"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AccountHeadId).HasColumnName("account_head_id"); entity.Property(e => e.Amount) .HasColumnName("amount") .HasColumnType("money"); entity.Property(e => e.BankName) .HasColumnName("bank_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.BillNo).HasColumnName("bill_no"); entity.Property(e => e.Branch) .HasColumnName("branch") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.CardMode).HasColumnName("card_mode"); entity.Property(e => e.CardNo) .HasColumnName("card_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.CashMode).HasColumnName("cash_mode"); entity.Property(e => e.ChequeDate) .HasColumnName("cheque_date") .HasColumnType("datetime"); entity.Property(e => e.ChequeMode).HasColumnName("cheque_mode"); entity.Property(e => e.ChequeNo) .HasColumnName("cheque_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.DeliveryDate) .HasColumnName("delivery_date") .HasColumnType("datetime"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.NatureOfWork) .IsRequired() .HasColumnName("nature_of_work") .HasMaxLength(500) .IsUnicode(false); entity.Property(e => e.OrderDate) .HasColumnName("order_date") .HasColumnType("datetime"); entity.Property(e => e.PaidBy) .HasColumnName("paid_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.VoucherNo) .HasColumnName("voucher_no") .HasMaxLength(50) .IsUnicode(false); entity.HasOne(d => d.AccountHead) .WithMany(p => p.Expenses) .HasForeignKey(d => d.AccountHeadId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__expenses__accoun__69C6B1F5"); }); modelBuilder.Entity<ExpensesAccountHead>(entity => { entity.ToTable("expenses_account_head"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Name) .IsRequired() .HasColumnName("name") .HasMaxLength(200) .IsUnicode(false); }); modelBuilder.Entity<SalaryPayment>(entity => { entity.ToTable("salary_payment"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.BankName) .HasColumnName("bank_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.BranchName) .HasColumnName("branch_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.CardMode).HasColumnName("card_mode"); entity.Property(e => e.CardNo) .HasColumnName("card_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.CashMode).HasColumnName("cash_mode"); entity.Property(e => e.ChequeDate) .HasColumnName("cheque_date") .HasColumnType("datetime"); entity.Property(e => e.ChequeMode).HasColumnName("cheque_mode"); entity.Property(e => e.ChequeNo) .HasColumnName("cheque_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.EmpId).HasColumnName("emp_id"); entity.Property(e => e.LoanDeduction) .HasColumnName("loan_deduction") .HasColumnType("money"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(100) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.MonthName) .IsRequired() .HasColumnName("month_name") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.ProfessionalTax) .HasColumnName("professional_tax") .HasColumnType("money"); entity.Property(e => e.ProvidentFund) .HasColumnName("provident_fund") .HasColumnType("money"); entity.Property(e => e.SalaryDate) .HasColumnName("salary_date") .HasColumnType("datetime"); entity.Property(e => e.SalaryPayable) .HasColumnName("salary_payable") .HasColumnType("money"); entity.Property(e => e.WorkDays).HasColumnName("work_days"); entity.Property(e => e.YearName).HasColumnName("year_name"); entity.HasOne(d => d.Emp) .WithMany(p => p.SalaryPayment) .HasForeignKey(d => d.EmpId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__salary_pa__emp_i__6CA31EA0"); }); modelBuilder.Entity<PatientBillPayment>(entity => { entity.ToTable("patient_bill_payment"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Balance) .HasColumnName("balance") .HasColumnType("money"); entity.Property(e => e.BankName) .HasColumnName("bank_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.BillId).HasColumnName("bill_id"); entity.Property(e => e.BillPaidBy) .HasColumnName("bill_paid_by") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.BranchName) .HasColumnName("branch_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.CardMode).HasColumnName("card_mode"); entity.Property(e => e.CardNo) .HasColumnName("card_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.CashMode).HasColumnName("cash_mode"); entity.Property(e => e.ChequeDate) .HasColumnName("cheque_date") .HasColumnType("datetime"); entity.Property(e => e.ChequeMode).HasColumnName("cheque_mode"); entity.Property(e => e.ChequeNo) .HasColumnName("cheque_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.PaymentAmount) .HasColumnName("payment_amount") .HasColumnType("money"); entity.Property(e => e.PaymentDate) .HasColumnName("payment_date") .HasColumnType("datetime"); entity.Property(e => e.ReceiptNo).HasColumnName("receipt_no"); entity.Property(e => e.PaymentType).HasColumnName("payment_type"); entity.HasOne(d => d.PaymentTypeNavigation) .WithMany(p => p.PatientBillPayment) .HasForeignKey(d => d.PaymentType) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__patient_b__payme__7720AD13"); entity.HasOne(d => d.Bill) .WithMany(p => p.PatientBillPayment) .HasForeignKey(d => d.BillId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__patient_b__bill___762C88DA"); }); modelBuilder.Entity<PatientCounts>(entity => { entity.ToTable("patient_counts"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.MonthName).HasColumnName("month_name"); entity.Property(e => e.PatientCount).HasColumnName("patient_count"); entity.Property(e => e.YearName).HasColumnName("year_name"); }); modelBuilder.Entity<MonthlyRateList>(entity => { entity.ToTable("monthly_rate_list"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Charges).HasColumnName("charges"); entity.Property(e => e.HdlId).HasColumnName("hdl_id"); entity.Property(e => e.TestTitleId).HasColumnName("test_title_id"); entity.HasOne(d => d.Hdl) .WithMany(p => p.MonthlyRateList) .HasForeignKey(d => d.HdlId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__monthly_r__hdl_i__37FA4C37"); entity.HasOne(d => d.TestTitle) .WithMany(p => p.MonthlyRateList) .HasForeignKey(d => d.TestTitleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__monthly_r__test___38EE7070"); }); modelBuilder.Entity<ReferringRateList>(entity => { entity.ToTable("referring_rate_list"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.HdlId).HasColumnName("hdl_id"); entity.Property(e => e.ReferringAmount).HasColumnName("referring_amount"); entity.Property(e => e.ReferringPercentage).HasColumnName("referring_percentage"); entity.Property(e => e.TestTitleId).HasColumnName("test_title_id"); entity.HasOne(d => d.Hdl) .WithMany(p => p.ReferringRateList) .HasForeignKey(d => d.HdlId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__referring__hdl_i__3429BB53"); entity.HasOne(d => d.TestTitle) .WithMany(p => p.ReferringRateList) .HasForeignKey(d => d.TestTitleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__referring__test___351DDF8C"); }); modelBuilder.Entity<SpecializedLabRateList>(entity => { entity.ToTable("specialized_lab_rate_list"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Charges).HasColumnName("charges"); entity.Property(e => e.HdlId).HasColumnName("hdl_id"); entity.Property(e => e.TestTitleId).HasColumnName("test_title_id"); entity.HasOne(d => d.Hdl) .WithMany(p => p.SpecializedLabRateList) .HasForeignKey(d => d.HdlId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__specializ__hdl_i__3BCADD1B"); entity.HasOne(d => d.TestTitle) .WithMany(p => p.SpecializedLabRateList) .HasForeignKey(d => d.TestTitleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__specializ__test___3CBF0154"); }); modelBuilder.Entity<HdlBill>(entity => { entity.ToTable("hdl_bill"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.AmountPaid) .HasColumnName("amount_paid") .HasColumnType("money"); entity.Property(e => e.Balance) .HasColumnName("balance") .HasColumnType("money"); entity.Property(e => e.BillDate) .HasColumnName("bill_date") .HasColumnType("datetime"); entity.Property(e => e.BillNo).HasColumnName("bill_no"); entity.Property(e => e.Discount).HasColumnName("discount"); entity.Property(e => e.FromDate) .HasColumnName("from_date") .HasColumnType("datetime"); entity.Property(e => e.Gst).HasColumnName("gst"); entity.Property(e => e.HdlId).HasColumnName("hdl_id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.ToDate) .HasColumnName("to_date") .HasColumnType("datetime"); entity.Property(e => e.TotalCharges) .HasColumnName("total_charges") .HasColumnType("money"); entity.HasOne(d => d.Hdl) .WithMany(p => p.HdlBill) .HasForeignKey(d => d.HdlId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__hdl_bill__hdl_id__5A4F643B"); }); modelBuilder.Entity<HdlBillPayment>(entity => { entity.ToTable("hdl_bill_payment"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.Balance) .HasColumnName("balance") .HasColumnType("money"); entity.Property(e => e.BankName) .HasColumnName("bank_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.BillId).HasColumnName("bill_id"); entity.Property(e => e.BillPaidBy) .HasColumnName("bill_paid_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.BranchName) .HasColumnName("branch_name") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.CardMode).HasColumnName("card_mode"); entity.Property(e => e.CardNo) .HasColumnName("card_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.CashMode).HasColumnName("cash_mode"); entity.Property(e => e.ChequeDate) .HasColumnName("cheque_date") .HasColumnType("datetime"); entity.Property(e => e.ChequeMode).HasColumnName("cheque_mode"); entity.Property(e => e.ChequeNo) .HasColumnName("cheque_no") .HasMaxLength(20) .IsUnicode(false); entity.Property(e => e.FromDate) .HasColumnName("from_date") .HasColumnType("datetime"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(200) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.PaymentAmount) .HasColumnName("payment_amount") .HasColumnType("money"); entity.Property(e => e.PaymentDate) .HasColumnName("payment_date") .HasColumnType("datetime"); entity.Property(e => e.PaymentType).HasColumnName("payment_type"); entity.Property(e => e.ReceiptNo).HasColumnName("receipt_no"); entity.Property(e => e.ToDate) .HasColumnName("to_date") .HasColumnType("datetime"); entity.HasOne(d => d.Bill) .WithMany(p => p.HdlBillPayment) .HasForeignKey(d => d.BillId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__hdl_bill___bill___5D2BD0E6"); entity.HasOne(d => d.PaymentTypeNavigation) .WithMany(p => p.HdlBillPayment) .HasForeignKey(d => d.PaymentType) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__hdl_bill___payme__5E1FF51F"); }); modelBuilder.Entity<SpecializedLabSamples>(entity => { entity.ToTable("specialized_lab_samples"); entity.Property(e => e.Id).HasColumnName("id"); entity.Property(e => e.LabId).HasColumnName("lab_id"); entity.Property(e => e.ModifiedBy) .HasColumnName("modified_by") .HasMaxLength(50) .IsUnicode(false); entity.Property(e => e.ModifiedDate) .HasColumnName("modified_date") .HasColumnType("datetime"); entity.Property(e => e.PatientId).HasColumnName("patient_id"); entity.Property(e => e.TestTitleId).HasColumnName("test_title_id"); entity.HasOne(d => d.Lab) .WithMany(p => p.SpecializedLabSamples) .HasForeignKey(d => d.LabId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__specializ__lab_i__00750D23"); entity.HasOne(d => d.Patient) .WithMany(p => p.SpecializedLabSamples) .HasForeignKey(d => d.PatientId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__specializ__patie__0169315C"); entity.HasOne(d => d.TestTitle) .WithMany(p => p.SpecializedLabSamples) .HasForeignKey(d => d.TestTitleId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK__specializ__test___119F9925"); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using week6.Model; namespace week6.Service { public class CountryService : EntityService<Country>, ICountryService { new IContext _context; public CountryService(IContext context) : base(context) { _context = context; _dbset = _context.Set<Country>(); } public Country GetById(int Id) { return _dbset.FirstOrDefault(x => x.Id == Id); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RubiksCubeSolver { /// <summary> /// identifies the position of an edge on a side /// </summary> public enum RelativeEdgePosition { Left, Top, Right, Bottom, NotExisting } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using Valve.VR; public class ThrowingActionCanvas : ActionCanvasBase { public ActionCanvasElementBoolean prime; public ActionCanvasElementBoolean fire; public ActionCanvasElementSingle gripSqueeze; public ActionCanvasElementSingle pinchSqueeze; protected override void Awake() { base.Awake(); prime.Initialize(this); fire.Initialize(this); gripSqueeze.Initialize(this); pinchSqueeze.Initialize(this); } protected override void Update() { base.Update(); prime.Update(); fire.Update(); gripSqueeze.Update(); pinchSqueeze.Update(); } }
using System.Data.SqlClient; namespace Hotel { class DBConnConfig { public static SqlConnection GetDBConnection() { return new SqlConnection(); } } }
using System; using System.Collections.Generic; using UnityEngine; namespace UnityEngine.Ucg.Matchmaking { [Serializable] public class MatchmakingPlayer { [SerializeField] string id; [SerializeField] string properties; public string Id => id; public string Properties { get { return properties; } set { properties = value; } } internal MatchmakingPlayer(string id) { this.id = id; } } [Serializable] public class MatchmakingRequest { [SerializeField] List<MatchmakingPlayer> players; [SerializeField] string properties; public List<MatchmakingPlayer> Players { get { return players; } set { players = value; } } public string Properties { get { return properties; } set { properties = value; } } public MatchmakingRequest() { this.players = new List<MatchmakingPlayer>(); } } class MatchmakingResult { [SerializeField] internal bool success; [SerializeField] internal string error; } [Serializable] class AssignmentRequest { [SerializeField] string id; public string Id => id; internal AssignmentRequest(string id) { this.id = id; } } [Serializable] class ConnectionInfo { [SerializeField] string connection_string; public string ConnectionString => connection_string; } }
/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers * for more information concerning the license and the contributors participating to this project. */ using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Logging; namespace Mvc.Client { public class Startup { public Startup(IConfiguration configuration, IHostingEnvironment hostingEnvironment) { Configuration = configuration; HostingEnvironment = hostingEnvironment; } private IConfiguration Configuration { get; } private IHostingEnvironment HostingEnvironment { get; } public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(options => { options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; }) .AddCookie(options => { options.LoginPath = "/signin"; options.LogoutPath = "/signout"; }) .AddGoogle(options => { options.ClientId = "560027070069-37ldt4kfuohhu3m495hk2j4pjp92d382.apps.googleusercontent.com"; options.ClientSecret = "n2Q-GEw9RQjzcRbU3qhfTj8f"; }) .AddTwitter(options => { options.ConsumerKey = "6XaCTaLbMqfj6ww3zvZ5g"; options.ConsumerSecret = "Il2eFzGIrYhz6BWjYhVXBPQSfZuS4xoHpSSyD9PI"; }) .AddGitHub(options => { options.ClientId = "49e302895d8b09ea5656"; options.ClientSecret = "98f1bf028608901e9df91d64ee61536fe562064b"; options.Scope.Add("user:email"); }) /* .AddApple(options => { options.ClientId = Configuration["AppleClientId"]; options.KeyId = Configuration["AppleKeyId"]; options.TeamId = Configuration["AppleTeamId"]; options.UsePrivateKey( (keyId) => HostingEnvironment.ContentRootFileProvider.GetFileInfo($"AuthKey_{keyId}.p8")); }) */ .AddDropbox(options => { options.ClientId = "jpk24g2uxfxe939"; options.ClientSecret = "qbxvkjk5la7mjp6"; }); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app) { if (HostingEnvironment.IsDevelopment()) { IdentityModelEventSource.ShowPII = true; } // Required to serve files with no extension in the .well-known folder var options = new StaticFileOptions() { ServeUnknownFileTypes = true, }; app.UseStaticFiles(options); app.UseAuthentication(); app.UseMvc(); } } }
using System.Collections.Generic; using System.Threading; using Edelstein.WvsGame.Fields.Objects.Users; namespace Edelstein.WvsGame.Fields { public class FieldObjPool { private int _runningObjectID = 1; private readonly List<FieldObj> _objects; public IEnumerable<FieldObj> Objects => _objects.AsReadOnly(); public FieldObjPool() { _objects = new List<FieldObj>(); } public void Enter(FieldObj obj) { if (obj is FieldUser user) obj.ID = user.Character.ID; else { Interlocked.Increment(ref _runningObjectID); if (_runningObjectID == int.MinValue) Interlocked.Exchange(ref _runningObjectID, 1); obj.ID = _runningObjectID; } _objects.Add(obj); } public void Leave(FieldObj obj) => _objects.Remove(obj); } }
// // StreamHeader.cs: Provides tagging and properties support for the DSD // (Direct Stream Digital) DSF properties. // // Author: // Helmut Wahrmann // // Copyright (C) 2014 Helmut Wahrmann // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License version // 2.1 as published by the Free Software Foundation. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA // using System; using System.Globalization; namespace TagLib.Dsf { /// <summary> /// This struct implements <see cref="IAudioCodec" /> to provide /// support for reading DSF stream properties. /// </summary> public struct StreamHeader : IAudioCodec, ILosslessAudioCodec { #region Private Fields /// <summary> /// Contains the version. /// </summary> /// <remarks> /// This value is stored in bytes (12-15). /// Currently only value of 1 is valid. /// </remarks> private ushort version; /// <summary> /// The Format Id. /// </summary> /// <remarks> /// This value is stored in bytes (16-19). /// 0: DSD Raw /// </remarks> private ushort format_id; /// <summary> /// The Channel Type. /// </summary> /// <remarks> /// This value is stored in bytes (20-23). /// 1: mono /// 2:stereo /// 3:3 channels /// 4: quad /// 5: 4 channels /// 6: 5 channels /// 7: 5.1 channels /// </remarks> private ushort channel_type; /// <summary> /// Contains the number of channels. /// </summary> /// <remarks> /// This value is stored in bytes (24-27). /// 1 is monophonic, 2 is stereo, 4 means 4 channels, etc.. /// up to 6 channels may be represented /// </remarks> private ushort channels; /// <summary> /// Contains the sample rate. /// </summary> /// <remarks> /// This value is stored in bytes (28-31). /// the sample rate at which the sound is to be played back, /// in Hz: 2822400, 5644800 /// </remarks> private ulong sample_rate; /// <summary> /// Contains the number of bits per sample. /// </summary> /// <remarks> /// This value is stored in bytes (32-35). /// It can be any number from 1 to 8. /// </remarks> private ushort bits_per_sample; /// <summary> /// Contains the number of sample frames per channel. /// </summary> /// <remarks> /// This value is stored in bytes (36-43). /// </remarks> private ulong sample_count; /// <summary> /// Contains the Block size per channel. /// </summary> /// <remarks> /// This value is stored in bytes (44-47). /// Always: 4096 /// </remarks> private uint channel_blksize; /// <summary> /// Contains the length of the audio stream. /// </summary> /// <remarks> /// This value is provided by the constructor. /// </remarks> private long stream_length; #endregion #region Public Static Fields /// <summary> /// The size of an DSF Format chunk /// </summary> public const uint Size = 52; /// <summary> /// The identifier used to recognize a DSF file. /// Altough an DSF file start with "DSD ", we're interested /// in the Format chunk only, which contains the properties we need. /// </summary> /// <value> /// "fmt " /// </value> public static readonly ReadOnlyByteVector FileIdentifier = "fmt "; #endregion #region Constructors /// <summary> /// Constructs and initializes a new instance of <see /// cref="StreamHeader" /> for a specified header block and /// stream length. /// </summary> /// <param name="data"> /// A <see cref="ByteVector" /> object containing the stream /// header data. /// </param> /// <param name="streamLength"> /// A <see cref="long" /> value containing the length of the /// DSF Audio stream in bytes. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="data" /> is <see langword="null" />. /// </exception> /// <exception cref="CorruptFileException"> /// <paramref name="data" /> does not begin with <see /// cref="FileIdentifier" /> /// </exception> public StreamHeader(ByteVector data, long streamLength) { if (data == null) throw new ArgumentNullException("data"); if (!data.StartsWith(FileIdentifier)) throw new CorruptFileException( "Data does not begin with identifier."); stream_length = streamLength; // The first 12 bytes contain the Format chunk identifier "fmt " // And the size of the format chunk, which is always 52 version = data.Mid(12, 4).ToUShort(false); format_id = data.Mid(16, 4).ToUShort(false); channel_type = data.Mid(20, 4).ToUShort(false); channels = data.Mid(24, 4).ToUShort(false); sample_rate = data.Mid(28, 4).ToULong(false); bits_per_sample = data.Mid(32, 4).ToUShort(false); sample_count = data.Mid(36, 8).ToULong(false); channel_blksize = data.Mid(44, 4).ToUShort(false); } #endregion #region Public Properties /// <summary> /// Gets the duration of the media represented by the current /// instance. /// </summary> /// <value> /// A <see cref="TimeSpan" /> containing the duration of the /// media represented by the current instance. /// </value> public TimeSpan Duration { get { if (sample_rate <= 0 || sample_count <= 0) return TimeSpan.Zero; return TimeSpan.FromSeconds( (double) sample_count / (double) sample_rate); } } /// <summary> /// Gets the types of media represented by the current /// instance. /// </summary> /// <value> /// Always <see cref="MediaTypes.Audio" />. /// </value> public MediaTypes MediaTypes { get { return MediaTypes.Audio; } } /// <summary> /// Gets a text description of the media represented by the /// current instance. /// </summary> /// <value> /// A <see cref="string" /> object containing a description /// of the media represented by the current instance. /// </value> public string Description { get { return "DSF Audio"; } } /// <summary> /// Gets the bitrate of the audio represented by the current /// instance. /// </summary> /// <value> /// A <see cref="int" /> value containing a bitrate of the /// audio represented by the current instance. /// </value> public int AudioBitrate { get { TimeSpan d = Duration; if (d <= TimeSpan.Zero) return 0; return (int) ((stream_length*8L)/ d.TotalSeconds)/1000; } } /// <summary> /// Gets the sample rate of the audio represented by the /// current instance. /// </summary> /// <value> /// A <see cref="int" /> value containing the sample rate of /// the audio represented by the current instance. /// </value> public int AudioSampleRate { get { return (int) sample_rate; } } /// <summary> /// Gets the number of channels in the audio represented by /// the current instance. /// </summary> /// <value> /// A <see cref="int" /> value containing the number of /// channels in the audio represented by the current /// instance. /// </value> public int AudioChannels { get { return channels; } } /// <summary> /// Gets the number of bits per sample in the audio /// represented by the current instance. /// </summary> /// <value> /// A <see cref="int" /> value containing the number of bits /// per sample in the audio represented by the current /// instance. /// </value> public int BitsPerSample { get { return bits_per_sample; } } #endregion } }
using Microsoft.AspNetCore.Mvc; using Proyecto_Fia.Models; namespace Proyecto_Fia.Controllers { public class ProductosController : Controller { public IActionResult Lista() { return View(); } public IActionResult Ver(int id) { return View(); } } }
using System.Threading.Tasks; namespace ComposableAsync { /// <summary> /// Asynchronous version of IDisposable /// For reference see discussion: https://github.com/dotnet/roslyn/issues/114 /// </summary> public interface IAsyncDisposable { /// <summary> /// Performs asynchronously application-defined tasks associated with freeing, /// releasing, or resetting unmanaged resources. /// </summary> Task DisposeAsync(); } }
using DataLibrary.Enums; using DataLibrary.Models; using SeriesMVC.Models; namespace SeriesMVC.Factory { public interface IObjectFactory { ISeries CreateSeries(); ISeries CreateSeries(Gender gender, string title, string description, int year); ISeries CreateSeries(int id, Gender gender, string title, string description, int year); IViewSeries CreateViewSeries(); IViewSeries CreateViewSeries(int id, Gender gender, string title, string description, int year); } }
using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; namespace IfacesEnumsStructsClasses { #region IOleControl Interface //MIDL_INTERFACE("B196B288-BAB4-101A-B69C-00AA00341D07") //IOleControl : public IUnknown //{ //public: // virtual HRESULT STDMETHODCALLTYPE GetControlInfo( // /* [out] */ CONTROLINFO *pCI) = 0; // virtual HRESULT STDMETHODCALLTYPE OnMnemonic( // /* [in] */ MSG *pMsg) = 0; // virtual HRESULT STDMETHODCALLTYPE OnAmbientPropertyChange( // /* [in] */ DISPID dispID) = 0; // virtual HRESULT STDMETHODCALLTYPE FreezeEvents( // /* [in] */ BOOL bFreeze) = 0; //} [ComImport, ComVisible(true)] [Guid("B196B288-BAB4-101A-B69C-00AA00341D07")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IOleControl { //struct tagCONTROLINFO //{ // ULONG cb; uint32 // HACCEL hAccel; intptr // USHORT cAccel; ushort // DWORD dwFlags; uint32 //} void GetControlInfo(out object pCI); void OnMnemonic([In, MarshalAs(UnmanagedType.Struct)]ref tagMSG pMsg); void OnAmbientPropertyChange([In] int dispID); void FreezeEvents([In, MarshalAs(UnmanagedType.Bool)] bool bFreeze); } #endregion }
using System; using System.IO; using System.Reflection; using OptionKit.Exceptions; namespace OptionKit.Mapping { public abstract class MappingBase { protected internal object Object; protected internal string Usage = null; protected internal Options ExtractedOptions; protected internal readonly IOptionMappingStringFormatter OptionFormatter = new OptionMappingStringFormatter(); protected internal ExecutionMode? Mode = null; public enum ExecutionMode { Extract, Usage } protected MappingBase() { var programName = Path.GetFileName( Assembly.GetEntryAssembly().Location ); Usage = string.Format( "\nUsage: {0} <operations> [options] <args>\n\n", programName ); } internal object BuildModelFromOptions( Options extractedOptions ) { ExtractedOptions = extractedOptions; Mode = ExecutionMode.Extract; Process(); return Object; } internal string Help() { Mode = ExecutionMode.Usage; Process(); return Usage; } protected abstract void Process(); // TODO add support for trailing protected internal string[] GetArgumentsForMapping( OptionMapping mapping ) { string[] toReturn = null; var extractedOptions = ExtractedOptions.ExtractedOptions; if( mapping.LongKey != null && extractedOptions.ContainsKey( mapping.LongKey ) ) { toReturn = extractedOptions[mapping.LongKey].ToArray(); } if( mapping.ShortKey != null && extractedOptions.ContainsKey( mapping.ShortKey ) ) { toReturn = extractedOptions[mapping.ShortKey].ToArray(); } if( mapping.Required && toReturn == null ) { throw new MissingOptionException( mapping.OptionKeys ); } return toReturn; } protected void Map<TProp>( PropertyInfo property, OptionMapping mapping, Func<string[], TProp> convertorFunc ) { switch( Mode ) { case ExecutionMode.Extract: string[] arguments = GetArgumentsForMapping( mapping ); var value = arguments != null ? convertorFunc( arguments ) : mapping.DefaultValue; property.GetSetMethod().Invoke( Object, new[] { value } ); break; case ExecutionMode.Usage: Usage += ( OptionFormatter.Format( mapping, property.PropertyType ) + "\n" ); break; } } } }
using BuckarooSdk.Transaction; namespace BuckarooSdk.Services.Giftcards.VVVGiftcard { /// <summary> /// The Transaction class of payment method type: VVV giftcards. /// </summary> public class VVVGiftcardTransaction { private ConfiguredTransaction ConfiguredTransaction { get; } internal VVVGiftcardTransaction(ConfiguredTransaction configuredTransaction) { this.ConfiguredTransaction = configuredTransaction; } /// <summary> /// The pay function creates a configured transaction with an VVV Giftcards PayRequest, /// that is ready to be executed. /// </summary> /// <param name="request">An VVV Giftcards PayRequest</param> /// <returns></returns> public ConfiguredServiceTransaction Pay(VVVGiftcardPayRequest request) { var parameters = ServiceHelper.CreateServiceParameters(request); var configuredServiceTransaction = new ConfiguredServiceTransaction(this.ConfiguredTransaction.BaseTransaction); configuredServiceTransaction.BaseTransaction.AddService("vvvgiftcard", parameters, "pay"); return configuredServiceTransaction; } /// <summary> /// The refund function creates a configured transaction with an VVV Giftcards RefundRequest, /// that is ready to be executed. /// </summary> /// <param name="request">An VVV Giftcards RefundRequest</param> /// <returns></returns> public ConfiguredServiceTransaction Refund(VVVGiftcardRefundRequest request) { var parameters = ServiceHelper.CreateServiceParameters(request); var configuredServiceTransaction = new ConfiguredServiceTransaction(this.ConfiguredTransaction.BaseTransaction); configuredServiceTransaction.BaseTransaction.AddService("vvvgiftcard", parameters, "refund"); return configuredServiceTransaction; } } }
using System; using System.Collections.Generic; using System.Management.Automation; using System.Xml.Serialization; using TerritoryTools.Alba.Controllers.Kml; using TerritoryTools.Alba.Controllers.Models; namespace TerritoryTools.Alba.PowerShell { [Cmdlet(VerbsData.ConvertTo,"Kml")] [OutputType(typeof(GoogleMapsKml))] public class ConvertToKml : PSCmdlet { AlbaTerritoryBorderToKmlConverter converter; readonly List<AlbaTerritoryBorder> territories = new List<AlbaTerritoryBorder>(); [Parameter( Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)] public AlbaTerritoryBorder Input { get; set; } protected override void BeginProcessing() { converter = new AlbaTerritoryBorderToKmlConverter(); base.BeginProcessing(); } protected override void ProcessRecord() { try { territories.Add(Input); } catch(Exception e) { throw new Exception($"Error converting AlbaTerritoryBorder into KML: {e.StackTrace}", e); } } protected override void EndProcessing() { var kml = converter.KmlFrom(territories); var serializer = new XmlSerializer(typeof(GoogleMapsKml)); using (var textWriter = new StringWriterUtf8()) { serializer.Serialize(textWriter, kml); WriteObject(textWriter.ToString()); } base.EndProcessing(); } } }
using System; using UnityEditor; using UnityEngine; namespace WeChat { class WXStandardLitParser : WXMaterialParser { enum RenderMode { Opaque = 0, Cutout = 1, Transparent = 2, Custom = 3 } public override void onParse (WXMaterial wxbb_material) { Material material = this.m_material; SetEffect ("@system/standardLit"); // diffuse texture AddTexture ("_MainTex", "_MainTex"); // diffuse texture scale offset Vector2 textureScale = material.GetTextureScale ("_MainTex"); Vector2 textureOffset = material.GetTextureOffset ("_MainTex"); AddShaderParam ("_MainTex_ST", new float[4] { textureScale.x, textureScale.y, textureOffset.x, textureOffset.y }); // color AddShaderParam ("_Color", material.GetColor ("_Color"), true); // normal map if (material.GetTexture ("_NormalMap") != null) { AddTexture ("_NormalMap", "_NormalMap"); AddShaderDefination ("USE_NORMALMAP", true); } // WorkFlow bool isSpecularWorkFlow = (double)material.GetFloat ("_WorkflowMode") == 0.0; if (isSpecularWorkFlow) { AddShaderDefination ("_SPECULAR_SETUP", true); } // hasGlossMap bool hasGlossMap = false; if (isSpecularWorkFlow) hasGlossMap = material.GetTexture ("_SpecGlossMap"); else hasGlossMap = material.GetTexture ("_MetallicGlossMap"); if (hasGlossMap) { AddShaderDefination ("USE_METALLICSPECGLOSSMAP", true); } AddShaderParam ("_Glossiness", material.GetFloat ("_Glossiness")); AddShaderParam ("_GlossMapScale", material.GetFloat ("_GlossMapScale")); // Specular Gloss Map AddShaderParam ("_Specular", material.GetColor ("_Specular"), true); if (hasGlossMap && isSpecularWorkFlow) { AddShaderDefination ("USE_SPECGLOSSMAP", true); AddTexture ("_SpecGlossMap", "_SpecGlossMap"); } // Metallic Gloss Map AddShaderParam ("_Metallic", material.GetFloat ("_Metallic")); if (hasGlossMap && !isSpecularWorkFlow) { AddShaderDefination ("USE_METALLICGLOSSMAP", true); AddTexture ("_MetallicGlossMap", "_MetallicGlossMap"); } // Gloss Channel if (material.HasProperty ("_SmoothnessTextureChannel")) { MaterialProperty smoothnessMapChannel; bool smoothnessChannelAlbedoA = (double)material.GetFloat("_SmoothnessTextureChannel") == 1.0; if(smoothnessChannelAlbedoA){ AddShaderDefination ("_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", smoothnessChannelAlbedoA); } } // AO Map if (material.GetTexture ("_OcclusionMap") != null) { AddTexture ("_OcclusionMap", "_OcclusionMap"); AddShaderDefination ("USE_AOMAP", true); } // Emission Map if (material.GetTexture ("_EmissionMap") != null) { AddTexture ("_EmissionMap", "_EmissionMap"); AddShaderDefination ("USE_EMISSIONMAP", true); } AddShaderParam ("_EmissionColor", material.GetColor ("_EmissionColor"), true); AddShaderParam ("_Cutoff", material.GetFloat ("_Cutoff")); AddShaderDefination ("USE_LIGHTING", (double) material.GetFloat ("_Lighting") == 0.0 ? true : false); // laya里面,这个shader属性是写反了的 AddShaderDefination ("USE_FOG", (double) material.GetFloat ("_Fog") == 1.0 ? false : true); // alpha test if (material.IsKeywordEnabled ("_ALPHATEST_ON")) { AddShaderDefination ("USE_ALPHA_TEST", true); } // alpha blend if (material.IsKeywordEnabled ("_ALPHABLEND_ON")) { SetBlendOn (true); SetBlendFactor (ConvertBlendFactor (material.GetInt ("_SrcBlend")), ConvertBlendFactor (material.GetInt ("_DstBlend"))); } else { SetBlendOn (false); } // depth write SetDepthWrite (material.GetInt ("_ZWrite") == 1 ? true : false); // depth test SetDepthTest (ConvertCompareFunc (material.GetInt ("_ZTest"))); // cull SetCullMode (ConvertCullMode (material.GetInt ("_Cull"))); // Render Mode RenderMode mode = (RenderMode) material.GetFloat ("_Mode"); switch (mode) { case RenderMode.Opaque: break; case RenderMode.Cutout: AddShaderDefination ("ENABLE_ALPHA_CUTOFF", true); break; case RenderMode.Transparent: break; case RenderMode.Custom: if (material.IsKeywordEnabled ("_ALPHABLEND_ON")) { AddShaderDefination ("ENABLE_ALPHA_CUTOFF", true); } break; default: break; } } protected override void SetEffect (String effect) { m_mainJson.SetField ("effect", effect); } } }
using Abp.Modules; using System; using System.Collections.Generic; namespace Cinotam.FileManager { public class FileManagerModule : AbpModule { public static List<Type> FileManagerServiceProviders = new List<Type>(); protected FileManagerModule() { } } }
namespace MaxLib.Ini.Parser { public interface ITokenParser { IIniElement Parse(string source, ParsingOptions options); } public interface ITokenParser<T> : ITokenParser where T : IIniElement { new T Parse(string source, ParsingOptions options); } }
// <copyright file="Constants.cs" company="GeneGenie.com"> // Copyright (c) GeneGenie.com. All Rights Reserved. // Licensed under the GNU Affero General Public License v3.0. See LICENSE in the project root for license information. // </copyright> // <author> Copyright (C) 2016 Ryan O'Neill r@genegenie.com </author> namespace GeneGenie.Gedcom { /// <summary> /// General GEDCOM related constants. /// </summary> public class Constants { /// <summary> /// The default name for an individual when they have not been given one. /// </summary> public const string UnknownName = "unknown /unknown/"; /// <summary> /// The unknown name part /// </summary> public const string UnknownNamePart = "unknown"; /// <summary> /// The unknown soundex /// </summary> public const string UnknownSoundex = "u525"; } }
using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.OData.Query; using Microsoft.AspNetCore.OData.Routing.Controllers; using Microsoft.EntityFrameworkCore; using ODataExample.Entities; using ODataExample.EntityFramework; using ODataExample.Utilities; namespace ODataExample.Controllers { public class BooksController : ODataController { private readonly BookStoreContext _db; public BooksController(BookStoreContext context) { _db = context; _db.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; if (!context.Books.Any()) { foreach (var b in DataSource.GetBooks()) { context.Books.Add(b); context.Presses.Add(b.Press); } context.SaveChanges(); } } [EnableQuery(PageSize = 10)] public IActionResult Get() { return Ok(_db.Books); } [EnableQuery] public IActionResult Get(int key) { return Ok(_db.Books.FirstOrDefault(c => c.Id == key)); } [EnableQuery] public IActionResult Post([FromBody]Book book) { _db.Books.Add(book); _db.SaveChanges(); return Created(book); } [EnableQuery] public IActionResult Delete([FromBody] int key) { Book b = _db.Books.FirstOrDefault(c => c.Id == key); if (b == null) { return NotFound(); } _db.Books.Remove(b); _db.SaveChanges(); return Ok(); } } }
using System; using ProtoBuf; namespace HarmonyIOLoader.NPC { [ProtoContract] [Serializable] public class SerializedNPCSpawner { [ProtoMember(1)] public int npcType; [ProtoMember(2)] public int respawnMin; [ProtoMember(3)] public int respawnMax; [ProtoMember(4)] public VectorData position; [ProtoMember(5)] public string category; } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using fxCoreLink; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using Common; namespace fxCoreLink.Tests { [TestClass()] public class AccumulatorMgrTests { Logger log = Logger.LogManager("AccumulatorMgrTests"); string pair = "AUD/JPY"; [TestMethod()] public void rollTest() { AccumulatorMgr accumulatorMgr = new AccumulatorMgr(); accumulatorMgr.Debug = false; accumulatorMgr.Snapshot = "..\\..\\testdata1"; accumulatorMgr.read(); // load history for (int m = 1; m <= 2; m++) // days for (int k = 0; k < 24; k++) // hours for (int j = 0; j < 60; j++) // minutes { DateTime now = new DateTime(); for (int i = 1; i < 3; i++) // two data elements per minute period { now = new DateTime(2000, 1, m, k, j, i); accumulatorMgr.accumulate(pair, now, m * 1000000 + k * 10000 + j * 100 + i + 0.1, // bid m * 1000000 + k * 10000 + j * 100 + i + 0.2); // ask } accumulatorMgr.roll(now); } accumulatorMgr.roll(new DateTime(2000, 1, 1, 0, 1, 0)); string after = accumulatorMgr.writeString(); string afterCmp = File.ReadAllText("..\\..\\testdata1Result.json"); Assert.AreEqual(after.Trim(), afterCmp.Trim(), "roll failed"); } } }
namespace GrandPrix.Models.Drivers { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GrandPrix.Models.Cars; public class AggressiveDriver : Driver { private const double A_D_FUEL_CONSUMPTION_PER_KM = 2.7; private const double AGGRESSIVE_DRIVER_SPEED_INCREASE= 1.3; public AggressiveDriver(string name, Car car, double fuelConsumptionPerKm) : base(name, car, fuelConsumptionPerKm) { this.FuelConsumptionPerKm = A_D_FUEL_CONSUMPTION_PER_KM; } public override double Speed => base.Speed * AGGRESSIVE_DRIVER_SPEED_INCREASE; } }
using System; using System.Collections.Generic; namespace BackwardCompatibilityChecker.Infrastructure.Diagnostics { /// <summary> /// Create a static instance of each class where you want to use tracing. /// It does basically encapsulate the typename and enables fast trace filters. /// </summary> public class TypeHashes { string myFullTypeName; internal int[] myTypeHashes; internal string FullQualifiedTypeName { get { return this.myFullTypeName; } } static char[] mySep = new char[] { '.' }; /// <summary> /// Initializes a new instance of the <see cref="TypeHandle"/> class. /// </summary> /// <param name="typeName">Name of the type.</param> public TypeHashes(string typeName) { if (String.IsNullOrEmpty(typeName)) { throw new ArgumentException("typeName"); } this.myFullTypeName = typeName; // Generate from the full qualified type name substring for each part between the . characters. // Each substring is then hashed so we can later compare not strings but integer arrays which are super // fast! Since this is done only once for a type we can afford doing a little more work here and spare // huge amount of comparison time later. // If by a rare incident the hash values would collide with another named type we would have enabled // tracing by accident for one more type than intended. List<int> hashes = new List<int>(); foreach (string substr in this.myFullTypeName.ToLower().Split(mySep)) { hashes.Add(substr.GetHashCode()); } this.myTypeHashes = hashes.ToArray(); } /// <summary> /// Create a TypeHandle which is used by the Tracer class. /// </summary> /// <param name="t">Type of your enclosing class.</param> public TypeHashes(Type t) : this(CheckInput(t)) { } static string CheckInput(Type t) { if (t == null) { throw new ArgumentNullException("t"); } return String.Join(".", new string[] { t.Namespace, t.Name }); ; } } }
namespace Shuttle.Abacus { public class SystemPermissions { public static class Manage { public const string Arguments = "abacus://arguments/manage"; public const string Formulas = "abacus://formulas/manage"; public const string Matrices = "abacus://matrices/manage"; public const string Tests = "abacus://tests/manage"; } } }
namespace TriangulatedPolygonAStar.UI { public interface ILocationMarker : IDrawable { /// <summary> /// The position where this marker is currently put. /// </summary> IVector CurrentLocation { get; } /// <summary> /// Sets the position of this marker. /// </summary> /// <param name="position">The position to move this marker to</param> void SetLocation(IVector position); /// <summary> /// Determines, whether the specified position is under the marker sign. /// </summary> /// <param name="position">The position in the same coordinate-system as the location</param> /// <returns>true if the specified position falls under the marker, otherwise false</returns> bool IsPositionUnderMarker(IVector position); } }
using System; using System.Collections.Generic; using System.IO; using System.Text.Json; namespace TestDrivenDesign { enum FieldType { FloatingPoint, Integer, String, TimeOfDay, Boolean, BitField, Last = BitField, } interface AbstractField { void ReadAndPrint(string str, JsonElement message); } class FloatingPointField : AbstractField { public void ReadAndPrint(string str, JsonElement message) { Console.WriteLine(message.GetProperty(str).GetDouble()); } } public class Process { public static void Start() { var messagesJson = File.ReadAllText(AppContext.BaseDirectory + "data/messages.json"); var messages = JsonSerializer.Deserialize<List<JsonElement>>(messagesJson); if (messages is null) { throw new Exception("messages cannot be null."); } var descriptionJson = File.ReadAllText(AppContext.BaseDirectory + "data/description.json"); var description = JsonSerializer.Deserialize<JsonElement>(descriptionJson); var field = new AbstractField[(int)FieldType.Last]; field[(int)FieldType.FloatingPoint] = new FloatingPointField(); foreach (var message in messages) { var msgId = message.GetProperty("id").GetInt32(); var fieldDescription = description.GetProperty(msgId.ToString()); var numFieldsInMessage = fieldDescription.GetProperty("numFields").GetInt32(); var fieldIdx = 1; while (fieldIdx <= numFieldsInMessage) { var fieldValue = fieldDescription.GetProperty(fieldIdx.ToString()); var fieldName = fieldValue.GetProperty("fieldName").GetString() ?? ""; var fieldType = fieldValue.GetProperty("fieldType").GetInt32(); var concreteField = field[fieldType]; concreteField.ReadAndPrint(fieldName, message); fieldIdx++; } } } } }
namespace UserService.Core.Entity { public enum UserState { Active, Unactive, Lock, } }
/* Copyright (C) 2004 - 2011 Versant Inc. http://www.db4o.com */ using Db4objects.Db4o.Internal; namespace Db4objects.Db4o.CS.Caching { public interface IClientSlotCache { void Add(Transaction transaction, int id, ByteArrayBuffer slot); ByteArrayBuffer Get(Transaction transaction, int id); } }
using AForge; using AForge.Imaging; using AForge.Imaging.Filters; using AForge.Math.Geometry; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; namespace e_Clinica.ManejoImagen { public class Filter { public bool _elipse = false; public double _brightness = 0; public int _quantity; public int _tone; public Bitmap GrayScale(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin.Clone(); Grayscale _filterGray = new Grayscale(0.2125, 0.7154, 0.0721); Threshold filter = new Threshold(100); //filter.ApplyInPlace(bmp); bmp = _filterGray.Apply(bmp); return bmp; } public Bitmap SobelEdges(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin; SobelEdgeDetector _filterSobel = new SobelEdgeDetector(); _filterSobel.ApplyInPlace(bmp); return bmp; } public Bitmap GetBrightness(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin.Clone(); int px = 0; for (int i = 0; i < bmp.Height; i++) { for (int j = 0; j < bmp.Width; j++) { Color c = bmp.GetPixel(j, i); double b = 0.2126 * c.R + 0.7152 * c.G + 0.0722 * c.B; //double b = c.GetBrightness(); _brightness += b; px++; } } _brightness = _brightness / px; int difBright = 150 - (int)_brightness; BrightnessCorrection _filterB = new BrightnessCorrection(difBright); _filterB.ApplyInPlace(bmp); return bmp; } public Bitmap BlurImage(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin; GaussianBlur _filterS = new GaussianBlur(); _filterS.ApplyInPlace(bmp); return bmp; } public Bitmap Binarizacion(System.Drawing.Image imgOrigin) { Bitmap bmp = new Bitmap(imgOrigin); for (int i = 0; i < bmp.Width; i++) { for (int j = 0; j < bmp.Height; j++) { // Color del pixel Color col = bmp.GetPixel(i, j); // Escala de grises byte gris = (byte)(col.R * 0.3f + col.G * 0.59f + col.B * 0.11f); // Blanco o negro byte value = 0; if (gris > 150) { value = 255; } // Asginar nuevo color Color nuevoColor = System.Drawing.Color.FromArgb(value, value, value); bmp.SetPixel(i, j, nuevoColor); } } return bmp; } public Bitmap DetectElipse(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin; Bitmap bmpAux = bmp.Clone(new Rectangle(0, 0, bmp.Width, bmp.Height), PixelFormat.Format32bppRgb); BitmapData bmData = bmpAux.LockBits( new Rectangle(0, 0, bmpAux.Width, bmpAux.Height), ImageLockMode.ReadWrite, bmpAux.PixelFormat); //Turn background to black ColorFiltering cFilter = new ColorFiltering(); cFilter.Red = new IntRange(0, 60); cFilter.Green = new IntRange(0, 60); cFilter.Blue = new IntRange(0, 60); cFilter.FillOutsideRange = false; cFilter.ApplyInPlace(bmData); //cFilter.Apply(bmData); //Blob --> finding shapes BlobCounter _blob = new BlobCounter(); //Investigar a fondo _blob.FilterBlobs = true; _blob.MinHeight = 30; _blob.MinWidth = 30; //Process the image, with magic _blob.ProcessImage(bmData); //Found shapes Blob[] _blobs = _blob.GetObjectsInformation(); bmpAux.UnlockBits(bmData); //Check found shapes SimpleShapeChecker shapeChecker = new SimpleShapeChecker(); shapeChecker.MinAcceptableDistortion = 0.7f; shapeChecker.RelativeDistortionLimit = 0.08f; //color shapes Graphics g = Graphics.FromImage(bmpAux); Pen yellowPen = new Pen(Color.Yellow, 2); if (_blobs.Length != 0) _elipse = true; for (int i = 0; i < _blobs.Length; i++) { //Obtains the edges of the shape List<IntPoint> edgePoints = _blob.GetBlobsEdgePoints(_blobs[i]); //Points to the center of the shape AForge.Point center; float radius; if (shapeChecker.IsCircle(edgePoints, out center, out radius)) { //Draw founded shape g.DrawEllipse(yellowPen, (float)(center.X - radius), (float)(center.Y - radius), (float)(radius * 2), (float)(radius * 2)); } } yellowPen.Dispose(); g.Dispose(); return bmpAux; } public Color PredominantColor(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin; GetBrightness(bmp); List<Color> colors = new List<Color>(); List<int> red = new List<int>(); int r = 0; int g = 0; int b = 0; int total = 0; for (int x = 0; x < bmp.Width; x++) { for (int y = 0; y < bmp.Height; y++) { Color clr = bmp.GetPixel(x, y); if (clr.R < 180 && clr.G < 100 && clr.B < 80) { r += clr.R; g += clr.G; b += clr.B; total++; if (!red.Contains(clr.R)) { red.Add(clr.R); colors.Add(clr); } } } } r /= total; g /= total; b /= total; _quantity = colors.Count; _tone = r; return Color.FromArgb(r, g, b); } public Bitmap CutImage(System.Drawing.Image imgOrigin) { Bitmap bmp = (Bitmap)imgOrigin; GetBrightness(bmp); Bitmap bmpAux = bmp.Clone(new Rectangle(0, 0, bmp.Width, bmp.Height), PixelFormat.Format32bppRgb); ColorFiltering cFilter = new ColorFiltering(); cFilter.Red = new IntRange(170, 255); cFilter.Green = new IntRange(100, 255); cFilter.Blue = new IntRange(80, 255); cFilter.FillOutsideRange = false; cFilter.ApplyInPlace(bmpAux); return bmpAux; } public Bitmap getCut(System.Drawing.Point inP, System.Drawing.Point finP, System.Drawing.Image imgOrigin) { Crop cut = null; Bitmap bmp = (Bitmap)imgOrigin; if (inP.X < finP.X && inP.Y < finP.Y) cut = new Crop(new Rectangle(inP.X, inP.Y, finP.X - inP.X, finP.Y - inP.Y)); else if (inP.X > finP.X && inP.Y > finP.Y) cut = new Crop(new Rectangle(finP.X, finP.Y, inP.X - finP.X, inP.Y - finP.Y)); else if (inP.X < finP.X && inP.Y > finP.Y) cut = new Crop(new Rectangle(inP.X, finP.Y, finP.X - inP.X, inP.Y - finP.Y)); else if (inP.X > finP.X && inP.Y < finP.Y) cut = new Crop(new Rectangle(finP.X, inP.Y, inP.X - finP.X, finP.Y - inP.Y)); bmp = cut.Apply(bmp); ResizeNearestNeighbor filter = new ResizeNearestNeighbor(bmp.Width * 2, bmp.Height * 2); bmp = filter.Apply(bmp); return bmp; } } }
using System; using System.Collections.Generic; using System.Text; using Microsoft.Scripting; namespace Dlrsoft.VBScript.Compiler { public class VBScriptSyntaxError { public VBScriptSyntaxError(string fileName, SourceSpan span, int errCode, string errorDesc) { this.FileName = fileName; this.Span = span; this.ErrorCode = errCode; this.ErrorDescription = errorDesc; } public string FileName { get; set; } public SourceSpan Span { get; set; } public int ErrorCode { get; set; } public string ErrorDescription { get; set; } } }
using System.Reflection; using Basics.Containers; namespace FullStackTraining.CallMeBack.Repository { public static class ContainerSetup { public static void Register(IContainerBuilder builder) { builder.RegisterByConvention(new[] { Assembly.GetExecutingAssembly() }, type => type.Name.EndsWith("Repository")); } } }
using System; using System.Linq; using UnityEditor.Experimental.GraphView; using UnityEditor.Graphing; using UnityEngine; using UnityEngine.UIElements; using ContextualMenuManipulator = UnityEngine.UIElements.ContextualMenuManipulator; using ContextualMenuPopulateEvent = UnityEngine.UIElements.ContextualMenuPopulateEvent; using VisualElementExtensions = UnityEngine.UIElements.VisualElementExtensions; namespace UnityEditor.ShaderGraph { sealed class ShaderGroup : Group { GraphData m_Graph; public new GroupData userData { get => (GroupData)base.userData; set => base.userData = value; } public ShaderGroup() { VisualElementExtensions.AddManipulator(this, new ContextualMenuManipulator(BuildContextualMenu)); style.backgroundColor = new StyleColor(new Color(25/255f, 25/255f, 25/255f, 25/255f)); capabilities |= Capabilities.Ascendable; } public void BuildContextualMenu(ContextualMenuPopulateEvent evt) { } public override bool AcceptsElement(GraphElement element, ref string reasonWhyNotAccepted) { if (element is StackNode stackNode) { reasonWhyNotAccepted = "Vertex and Pixel Stacks cannot be grouped"; return false; } var nodeView = element as IShaderNodeView; if (nodeView == null) { // sticky notes are not nodes, but still groupable return true; } if (nodeView.node is BlockNode) { reasonWhyNotAccepted = "Block Nodes cannot be grouped"; return false; } return true; } } }
namespace Tailviewer.Archiver.Plugins.Description { public interface IChange { /// <summary> /// A required short one sentence summary of the change. /// </summary> string Summary { get; } /// <summary> /// An optional (possibly longer) description of the change. /// </summary> string Description { get; } } }
using CampanhaBrinquedo.Domain.Entities.Child; using CampanhaBrinquedo.Domain.Interfaces; using System.Collections.Generic; using System.Threading.Tasks; namespace CampanhaBrinquedo.Domain.Repositories { public interface IChildRepository : IRepository<Child> { Task<IEnumerable<Child>> GetCriancasPorCampanha(int year); } }
using System.Collections.Generic; using System.Net; using System.Threading.Tasks; using AutoMapper; using Lykke.Service.SellOutEngine.Client.Api; using Lykke.Service.SellOutEngine.Client.Models.Balances; using Lykke.Service.SellOutEngine.Domain; using Lykke.Service.SellOutEngine.Domain.Services; using Microsoft.AspNetCore.Mvc; namespace Lykke.Service.SellOutEngine.Controllers { [Route("/api/[controller]")] public class BalancesController : Controller, IBalancesApi { private readonly IBalanceService _balanceService; public BalancesController(IBalanceService balanceService) { _balanceService = balanceService; } /// <inheritdoc/> /// <response code="200">A collection of balances.</response> [HttpGet] [ProducesResponseType(typeof(IReadOnlyCollection<BalanceModel>), (int) HttpStatusCode.OK)] public async Task<IReadOnlyCollection<BalanceModel>> GetAllAsync() { IReadOnlyCollection<Balance> balances = await _balanceService.GetAsync(); return Mapper.Map<BalanceModel[]>(balances); } /// <inheritdoc/> /// <response code="200">The balance of asset.</response> [HttpGet("{assetId}")] [ProducesResponseType(typeof(BalanceModel), (int) HttpStatusCode.OK)] public async Task<BalanceModel> GetByAssetIdAsync(string assetId) { Balance balance = await _balanceService.GetByAssetIdAsync(assetId); return Mapper.Map<BalanceModel>(balance); } } }
namespace Kigg.EF.Repository { using System; using Infrastructure; public class UnitOfWork : DisposableResource, IUnitOfWork { private readonly IDatabase _database; private bool _isDisposed; public UnitOfWork(IDatabase database) { Check.Argument.IsNotNull(database, "database"); _database = database; } public UnitOfWork(IDatabaseFactory factory) : this(factory.Create()) { } #if(DEBUG) public virtual void Commit() #else public void Commit() #endif { if (_isDisposed) { throw new ObjectDisposedException(GetType().Name); } _database.SubmitChanges(); } protected override void Dispose(bool disposing) { if (!_isDisposed) { _isDisposed = true; } base.Dispose(disposing); } } }
using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace PKO.Models { public class Insurrance : BaseModel { public int Id { get; set; } [ForeignKey("Clinic")] public int ClinicId { get; set; } [Required] [MaxLength(20)] public string Code { get; set; } [ForeignKey("Patient")] public long PatientId { get; set; } [Required] public DateTime StartDate { get; set; } [Required] public DateTime EndDate { get; set; } public int HospitalRegis { get; set; } public DateTime? InputCard { get; set; } } }
using System; using System.Globalization; using System.Windows.Data; using Waves.Core.Base; namespace Waves.UI.WPF.Converters.Base { /// <inheritdoc /> public class WavesColorToHexStringConverter : IValueConverter { /// <inheritdoc /> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var color = (Color?) value; return color?.ToHexString(); } /// <inheritdoc /> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { var text = (string) value; var parse = Color.TryParseFromHex(text, out var color, out var hasAlpha); return parse ? (object) color : null; } } }
using System; using HotChocolate.Types; namespace HotChocolate.Internal { internal readonly struct TypeInfo { public TypeInfo(Type nativeNamedType, Func<IType, IType> typeFactory) { NativeNamedType = nativeNamedType; TypeFactory = typeFactory; } public Type NativeNamedType { get; } public Func<IType, IType> TypeFactory { get; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Text; using System.Windows.Forms; using NilremUserManagement.CustomSteps; namespace NilremUserManagement { partial class UserManagementForm : Form { private List<User> users; private const int iconSize = 62; public UserManagementForm(IEnumerable<User> users) { InitializeComponent(); grdUsers.Columns[0].Width = iconSize; this.users = new List<User>(users); refreshUserTable(); } /// <summary> /// Repopulates the table of users. /// </summary> private void refreshUserTable() { grdUsers.Rows.Clear(); foreach (User user in users) { var row = new DataGridViewRow(); var pictureCell = new DataGridViewImageCell(); pictureCell.Value = user.Picture; pictureCell.ImageLayout = DataGridViewImageCellLayout.Zoom; row.MinimumHeight = iconSize; var userIdCell = new DataGridViewTextBoxCell(); userIdCell.Value = user.UserId; var nameCell = new DataGridViewTextBoxCell(); nameCell.Value = user.FullName.ToString(); var roleCell = new DataGridViewTextBoxCell(); roleCell.Value = user.Role.ToString(); row.Cells.AddRange(new DataGridViewCell[]{pictureCell, userIdCell, nameCell, roleCell}); grdUsers.Rows.Add(row); } } private void btnNewUser_Click(object sender, EventArgs e) { User newUser = NewUserWizard.RunNewUserWizard(); if (newUser != null) { users.Add(newUser); } refreshUserTable(); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static Oire.Notika.Helpers.Tr; namespace Oire.Notika { public partial class MainForm: Form { private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); public MainForm() { InitializeComponent(); } } }
using System; using System.Collections.Generic; //using System.Linq; using System.Text; namespace MyAss.Framework.BuiltIn.Procedures { public static class RandomGenerators { private static Dictionary<int, Random> generators = new Dictionary<int, Random>(); public static Random GetRandom(int stream) { Random rand; if (RandomGenerators.generators.TryGetValue(stream, out rand)) { return rand; } else { rand = stream == 0 ? new Random() : new Random(stream); RandomGenerators.generators.Add(stream, rand); return rand; } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Linq; namespace NHazm.Test { [TestClass] public class LemmatizerTest { [TestMethod] public void LemmatizeTest() { Lemmatizer lemmatizer = new Lemmatizer(); string input, expected, actual, p; List<string> inputs = new List<string>() { "کتاب‌ها", "آتشفشان", "می‌روم", "گفته شده است", "نچشیده است", "مردم", "اجتماعی" }; List<string> expecteds = new List<string>() { "کتاب", "آتشفشان", "رفت#رو", "گفت#گو", "چشید#چش", "مردم", "اجتماعی" }; List<string> pos = new List<string>() { null, null, null, null, null, "N", "AJ" }; for (var i = 0; i < inputs.Count; i++) { input = inputs[i]; expected = expecteds[i]; p = pos[i]; if (p == null) actual = lemmatizer.Lemmatize(input); else actual = lemmatizer.Lemmatize(input, p); Assert.AreEqual(expected, actual, "Failed to lematize of '" + input + "' word"); } } [TestMethod] public void ConjugationsTest() { Lemmatizer lemmatizer = new Lemmatizer(); string input; string[] expected, actual; input = "خورد#خور"; expected = new string[] { "خوردم", "خوردی", "خورد", "خوردیم", "خوردید", "خوردند", "نخوردم", "نخوردی", "نخورد", "نخوردیم", "نخوردید", "نخوردند", "خورم", "خوری", /*"خورد",*/ "خوریم", "خورید", "خورند", "نخورم", "نخوری", /*"نخورد",*/ "نخوریم", "نخورید", "نخورند", "می‌خوردم", "می‌خوردی", /*"می‌خورد",*/ "می‌خوردیم", "می‌خوردید", "می‌خوردند", "نمی‌خوردم", "نمی‌خوردی", "نمی‌خورد", "نمی‌خوردیم", "نمی‌خوردید", "نمی‌خوردند", "خورده‌ام", "خورده‌ای", "خورده", "خورده‌ایم", "خورده‌اید", "خورده‌اند", "نخورده‌ام", "نخورده‌ای", "نخورده", "نخورده‌ایم", "نخورده‌اید", "نخورده‌اند", "می‌خورم", "می‌خوری", "می‌خورد", "می‌خوریم", "می‌خورید", "می‌خورند", "نمی‌خورم", "نمی‌خوری", /*"نمی‌خورد",*/ "نمی‌خوریم", "نمی‌خورید", "نمی‌خورند", "بخورم", "بخوری", "بخورد", "بخوریم", "بخورید", "بخورند", "بخور", "نخور" }; actual = lemmatizer.Conjugations(input).ToArray(); Assert.AreEqual(expected.Length, actual.Length, "Failed to generate conjugations of '" + input + "' verb"); for (int i = 0; i < expected.Length; i++) { if (!actual.Contains(expected[i])) Assert.AreEqual(expected[i], actual[i], "Failed to generate conjugations of '" + input + "' verb"); } input = "آورد#آور"; expected = new string[] { "آوردم", "آوردی", "آورد", "آوردیم", "آوردید", "آوردند", "نیاوردم", "نیاوردی", "نیاورد", "نیاوردیم", "نیاوردید", "نیاوردند", "آورم", "آوری", /*"آورد",*/ "آوریم", "آورید", "آورند", "نیاورم", "نیاوری", /*"نیاورد",*/ "نیاوریم", "نیاورید", "نیاورند", "می‌آوردم", "می‌آوردی", /*"می‌آورد",*/ "می‌آوردیم", "می‌آوردید", "می‌آوردند", "نمی‌آوردم", "نمی‌آوردی", "نمی‌آورد", "نمی‌آوردیم", "نمی‌آوردید", "نمی‌آوردند", "آورده‌ام", "آورده‌ای", "آورده", "آورده‌ایم", "آورده‌اید", "آورده‌اند", "نیاورده‌ام", "نیاورده‌ای", "نیاورده", "نیاورده‌ایم", "نیاورده‌اید", "نیاورده‌اند", "می‌آورم", "می‌آوری", "می‌آورد", "می‌آوریم", "می‌آورید", "می‌آورند", "نمی‌آورم", "نمی‌آوری", /*"نمی‌آورد",*/ "نمی‌آوریم", "نمی‌آورید", "نمی‌آورند", "بیاورم", "بیاوری", "بیاورد", "بیاوریم", "بیاورید", "بیاورند", "بیاور", "نیاور" }; actual = lemmatizer.Conjugations(input).ToArray(); Assert.AreEqual(expected.Length, actual.Length, "Failed to generate conjugations of '" + input + "' verb"); for (int i = 0; i < expected.Length; i++) { if (!actual.Contains(expected[i])) Assert.AreEqual(expected[i], actual[i], "Failed to generate conjugations of '" + input + "' verb"); } } } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using Smp.Web.Models; using Smp.Web.Repositories; namespace Smp.Web.Services { public interface IPostsService { Task CreatePost(Post post); Task<IList<Post>> GetPostsByReceiverId(Guid receiverId, int count); } public class PostsService : IPostsService { private readonly IPostsRepository _postsRepository; public PostsService(IPostsRepository postsRepository) { _postsRepository = postsRepository; } public async Task CreatePost(Post post) => await _postsRepository.CreatePost(post); public async Task<IList<Post>> GetPostsByReceiverId(Guid receiverId, int count) => await _postsRepository.GetPostsByReceiverId(receiverId, count); } }
using System.Collections.Generic; using System.Linq; using UnityEngine; namespace Eflatun.UI.TabView { /// <summary> /// Manager for a tabbed UI view. /// </summary> public class TabView : MonoBehaviour { [Header("Highlighter")] [SerializeField] private RectTransform _highlighter; [SerializeField] private bool _highlightOnX, _highlightOnY; [Header("Tabs")] [SerializeField] private List<HandleTabPair> _handleTabPairs; private void Awake() { foreach (var pair in _handleTabPairs) { pair.BindHandle(SwitchTab); } } /// <summary> /// Registers a new tab to this instance. /// Also binds handle to tab. /// </summary> public void Register(Panel tab, EventButton handle) { var newPair = new HandleTabPair(tab, handle); newPair.BindHandle(SwitchTab); _handleTabPairs.Add(newPair); } /// <summary> /// Unregisters a tab from this instance. /// Also unbinds handle from tab. /// </summary> public void Unregister(Panel tab) { var pair = _handleTabPairs.Single(a => a.Tab == tab); pair.UnbindHandle(); _handleTabPairs.Remove(pair); } /// <summary> /// Switches the active tab. /// </summary> public void SwitchTab(Panel switchTo) { foreach (var pair in _handleTabPairs) { var tab = pair.Tab; if (tab == switchTo) { tab.Show(); if (_highlightOnX || _highlightOnY) { Highlight(pair.Handle); } } else { tab.Hide(); } } } private void Highlight(EventButton handle) { var position = new Vector2(); if (_highlightOnX) { position.x = handle.transform.position.x; } if (_highlightOnY) { position.y = handle.transform.position.y; } _highlighter.position = position; } } }
using System.IO; namespace Assets.Scripts.LfdReader { /// <summary> /// Other record. Not really doing anything with this, so just read and move on. /// </summary> public class BmapRecord : LfdRecord { public byte[] Data { get; protected set; } protected override void ReadRecordData(BinaryReader reader) { Data = reader.ReadBytes(DataLength); } } }
// File: GAFAnimationAssetEditor.cs // Version: 5.2 // Last changed: 2017/3/31 09:57 // Author: Nikitin Nikolay, Nikitin Alexey // Copyright: © 2017 GAFMedia // Project: GAF Unity plugin using UnityEditor; using GAF.Assets; using GAF.Core; using GAFEditorInternal.Assets; using UnityEngine; using System.Linq; using UnityEditor.Animations; namespace GAFEditor.Assets { [CanEditMultipleObjects] [CustomEditor(typeof(GAFAnimationAsset))] public class GAFAnimationAssetEditor : GAFAnimationAssetInternalEditor<GAFTexturesResource> { #region Implementation protected override void drawCreationMenu(int _TimelineID, ClipCreationOptions _Option) { switch(_Option) { case ClipCreationOptions.NotBakedMovieClip: drawCreateClip<GAFMovieClip>(_TimelineID, false, false); break; case ClipCreationOptions.BakedMovieClip: drawCreateClip<GAFBakedMovieClip>(_TimelineID, true, false); break; } } #endregion // Implementation } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace EmptyKeys.UserInterface.Designer { public static class AnimatedImageBrush { private static Type typeOfThis = typeof(AnimatedImageBrush); /// <summary> /// The frame width property /// </summary> public static readonly DependencyProperty FrameWidthProperty = DependencyProperty.RegisterAttached("FrameWidth", typeof(int), typeOfThis, new FrameworkPropertyMetadata(0)); /// <summary> /// Gets the width of the frame. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static int GetFrameWidth(DependencyObject obj) { return (int)obj.GetValue(FrameWidthProperty); } /// <summary> /// Sets the width of the frame. /// </summary> /// <param name="obj">The object.</param> /// <param name="value">The value.</param> public static void SetFrameWidth(DependencyObject obj, int value) { obj.SetValue(FrameWidthProperty, value); } /// <summary> /// The frame height property /// </summary> public static readonly DependencyProperty FrameHeightProperty = DependencyProperty.RegisterAttached("FrameHeight", typeof(int), typeOfThis, new FrameworkPropertyMetadata(0)); /// <summary> /// Gets the height of the frame. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static int GetFrameHeight(DependencyObject obj) { return (int)obj.GetValue(FrameHeightProperty); } /// <summary> /// Sets the height of the frame. /// </summary> /// <param name="obj">The object.</param> /// <param name="value">The value.</param> public static void SetFrameHeight(DependencyObject obj, int value) { obj.SetValue(FrameHeightProperty, value); } /// <summary> /// The frames per second property /// </summary> public static readonly DependencyProperty FramesPerSecondProperty = DependencyProperty.RegisterAttached("FramesPerSecond", typeof(int), typeOfThis, new FrameworkPropertyMetadata(60)); /// <summary> /// Gets the frames per second. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static int GetFramesPerSecond(DependencyObject obj) { return (int)obj.GetValue(FramesPerSecondProperty); } /// <summary> /// Sets the frames per second. /// </summary> /// <param name="obj">The object.</param> /// <param name="value">The value.</param> public static void SetFramesPerSecond(DependencyObject obj, int value) { obj.SetValue(FramesPerSecondProperty, value); } /// <summary> /// The animate property /// </summary> public static readonly DependencyProperty AnimateProperty = DependencyProperty.RegisterAttached("Animate", typeof(bool), typeOfThis, new FrameworkPropertyMetadata(false)); /// <summary> /// Gets the animate. /// </summary> /// <param name="obj">The object.</param> /// <returns></returns> public static bool GetAnimate(DependencyObject obj) { return (bool)obj.GetValue(AnimateProperty); } /// <summary> /// Sets the animate. /// </summary> /// <param name="obj">The object.</param> /// <param name="value">The value.</param> public static void SetAnimate(DependencyObject obj, bool value) { obj.SetValue(AnimateProperty, value); } } }
using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class UIPlayerPrefsText : MonoBehaviour { [SerializeField] string _key; // Start is called before the first frame update private void OnEnable() { int value = PlayerPrefs.GetInt(_key); GetComponent<TMP_Text>().SetText(value.ToString()); } }
namespace Tralus.Framework.Migration.Migrations { using System; using System.Data.Entity.Migrations; public partial class KpiModuleAdded : DbMigration { public override void Up() { CreateTable( "dbo.KpiDefinitions", c => new { ID = c.Int(nullable: false, identity: true), Name = c.String(), Active = c.Boolean(nullable: false), TargetObjectTypeFullName = c.String(), Criteria = c.String(), Expression = c.String(), GreenZone = c.Single(nullable: false), RedZone = c.Single(nullable: false), Compare = c.Boolean(nullable: false), RangeName = c.String(), RangeToCompareName = c.String(), MeasurementFrequency = c.Int(nullable: false), MeasurementMode = c.Int(nullable: false), Direction = c.Int(nullable: false), ChangedOn = c.DateTime(nullable: false), SuppressedSeries = c.String(), EnableCustomizeRepresentation = c.Boolean(nullable: false), }) .PrimaryKey(t => t.ID); CreateTable( "dbo.KpiInstances", c => new { ID = c.Int(nullable: false, identity: true), ForceMeasurementDateTime = c.DateTime(), Settings = c.String(), KpiDefinition_ID = c.Int(nullable: false), }) .PrimaryKey(t => t.ID) .ForeignKey("dbo.KpiDefinitions", t => t.KpiDefinition_ID, cascadeDelete: true) .Index(t => t.KpiDefinition_ID); CreateTable( "dbo.KpiHistoryItems", c => new { ID = c.Int(nullable: false, identity: true), RangeStart = c.DateTime(nullable: false), RangeEnd = c.DateTime(nullable: false), Value = c.Single(nullable: false), KpiInstance_ID = c.Int(nullable: false), }) .PrimaryKey(t => t.ID) .ForeignKey("dbo.KpiInstances", t => t.KpiInstance_ID, cascadeDelete: true) .Index(t => t.KpiInstance_ID); CreateTable( "dbo.KpiScorecards", c => new { ID = c.Int(nullable: false, identity: true), Name = c.String(), }) .PrimaryKey(t => t.ID); CreateTable( "dbo.KpiInstanceKpiScorecards", c => new { KpiInstance_ID = c.Int(nullable: false), KpiScorecard_ID = c.Int(nullable: false), }) .PrimaryKey(t => new { t.KpiInstance_ID, t.KpiScorecard_ID }) .ForeignKey("dbo.KpiInstances", t => t.KpiInstance_ID, cascadeDelete: true) .ForeignKey("dbo.KpiScorecards", t => t.KpiScorecard_ID, cascadeDelete: true) .Index(t => t.KpiInstance_ID) .Index(t => t.KpiScorecard_ID); } public override void Down() { DropForeignKey("dbo.KpiInstances", "KpiDefinition_ID", "dbo.KpiDefinitions"); DropForeignKey("dbo.KpiInstanceKpiScorecards", "KpiScorecard_ID", "dbo.KpiScorecards"); DropForeignKey("dbo.KpiInstanceKpiScorecards", "KpiInstance_ID", "dbo.KpiInstances"); DropForeignKey("dbo.KpiHistoryItems", "KpiInstance_ID", "dbo.KpiInstances"); DropIndex("dbo.KpiInstanceKpiScorecards", new[] { "KpiScorecard_ID" }); DropIndex("dbo.KpiInstanceKpiScorecards", new[] { "KpiInstance_ID" }); DropIndex("dbo.KpiHistoryItems", new[] { "KpiInstance_ID" }); DropIndex("dbo.KpiInstances", new[] { "KpiDefinition_ID" }); DropTable("dbo.KpiInstanceKpiScorecards"); DropTable("dbo.KpiScorecards"); DropTable("dbo.KpiHistoryItems"); DropTable("dbo.KpiInstances"); DropTable("dbo.KpiDefinitions"); } } }