content
stringlengths
23
1.05M
using System; using Newtonsoft.Json; namespace DogHouseApi.Models { public class PageDataDto { public int Number { get; private set; } public int Size { get; private set; } [JsonIgnore] public int PerPage { get; private set; } public int TotalPages { get; private set; } public int TotalElements { get; private set; } public PageDataDto(int number, int size, int perPage, int totalElements) { Number = number; Size = size; PerPage = perPage; TotalElements = totalElements; TotalPages = Math.Max((totalElements + perPage - 1) / perPage, 1); } } }
using System; using System.Collections.Generic; using System.Text; using NativeView = Microsoft.UI.Xaml.FrameworkElement; using Microsoft.Maui.Controls.Compatibility.Platform.UWP; using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls.Compatibility { public partial class RendererToHandlerShim { protected override NativeView CreateNativeView() { return VisualElementRenderer.ContainerElement; } IVisualElementRenderer CreateRenderer(IView view) { return Internals.Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(view) ?? new DefaultRenderer(); } public override Size GetDesiredSize(double widthConstraint, double heightConstraint) { if (widthConstraint < 0 || heightConstraint < 0) return Size.Zero; return VisualElementRenderer.GetDesiredSize(widthConstraint, heightConstraint); } } }
using System; using Microsoft.Extensions.Logging; using NBitcoin; using UnnamedCoin.Bitcoin.Consensus; using UnnamedCoin.Bitcoin.Consensus.Rules; namespace UnnamedCoin.Bitcoin.Features.Consensus.Rules.CommonRules { /// <summary> /// A rule that will validate the signature of a PoS block. /// </summary> public class PosBlockSignatureRule : IntegrityValidationConsensusRule { /// <inheritdoc /> /// <exception cref="ConsensusErrors.BadBlockSignature">The block signature is invalid.</exception> public override void Run(RuleContext context) { var block = context.ValidationContext.BlockToValidate; if (!(block is PosBlock posBlock)) { this.Logger.LogTrace("(-)[INVALID_CAST]"); throw new InvalidCastException(); } // Check proof-of-stake block signature. if (!CheckBlockSignature(posBlock)) { this.Logger.LogTrace("(-)[BAD_SIGNATURE]"); ConsensusErrors.BadBlockSignature.Throw(); } } /// <summary> /// Checks if block signature is valid. /// </summary> /// <param name="block">The block.</param> /// <returns><c>true</c> if the signature is valid, <c>false</c> otherwise.</returns> bool CheckBlockSignature(PosBlock block) { if (BlockStake.IsProofOfWork(block)) { var res = block.BlockSignature.IsEmpty(); this.Logger.LogTrace("(-)[POW]:{0}", res); return res; } var consensusRules = (PosConsensusRuleEngine) this.Parent; return consensusRules.StakeValidator.CheckStakeSignature(block.BlockSignature, block.GetHash(), block.Transactions[1]); } } }
using Jets.Infrastructure; using Microsoft.AspNetCore.Mvc; namespace WebAPISample.Controllers { [Route("api/jets")] [ApiController] public class JetsController : ControllerBase { private IJetsDataAccess _jetsDA; public JetsController(IJetsDataAccess jetsDA) { _jetsDA = jetsDA; } [HttpGet] public IActionResult Get() { return Ok(_jetsDA.GetLookUps()); } [HttpGet("{id}")] public IActionResult GetLookUp(int id) { var lookUp = _jetsDA.GetLookUp(id); if (lookUp == null) return NotFound(); return Ok(lookUp); } } }
namespace SciHub.Web.Areas.Book.Controllers { using System.Linq; using System.Web.Mvc; using Common.Constants; using Infrastructure.Mapping; using Microsoft.AspNet.Identity; using Services.Data.Contracts; using SciHub.Services.Data.Contracts.Comment; using ViewModels.Books; using SciHub.Web.Areas.Book.ViewModels.Comments; using Web.Controllers; public class BooksController : BaseController { private readonly IBooksService books; private readonly IBookCommentsService comments; public BooksController(IBooksService books, IBookCommentsService comments) { this.books = books; this.comments = comments; } [HttpGet] public ActionResult Index(int id = 1, string order = "newest", string criteria = "") { if (order != "newest" && order != "top") { this.Response.StatusCode = 412; return this.Content("Order not right"); } var page = id; var pagedBooks = this.books.GetAllWithPaging(page, WebConstants.AllBooksPageSize, order, criteria); var cachedViewModel = this.Cache.Get("booksPaged", () => new BooksPageableListViewModel() { CurrentPage = page, AllItemsCount = pagedBooks.AllItemsCount, TotalPages = pagedBooks.TotalPages, Books = pagedBooks.Books.To<AllBooksBookViewModel>().ToList() }, WebConstants.BooksCacheTime); return this.View(cachedViewModel); } [HttpGet] public ActionResult Details(int id) { var book = this.books.GetById(id); var viewModel = this.Mapper.Map(book, new BookDetailsViewModel()); if (book == null) { return this.Content("Book with this id was not found"); } return this.View(viewModel); } [Authorize] [HttpPost] public ActionResult Details(int id, float value) { if (value > 5) { value = 5; } if (value < 1) { value = 1; } this.books.Rate(id, value, this.User.Identity.GetUserId()); return this.RedirectToAction("Details"); } [HttpGet] public ActionResult BooksByAuthor(int id) { var topBooks = this.books.GetAuthorBooks(id).ToList(); var viewModel = new BooksByAuthorListViewModel { Books = topBooks }; return this.View(viewModel); } [HttpGet] public ActionResult BooksByTag(int id) { var topBooks = this.books.GetTagBooks(id).ToList(); var viewModel = new BooksByAuthorListViewModel { Books = topBooks }; return this.View(viewModel); } [HttpGet] public ActionResult AddComment(int id) { var viewModel = new BookCommentInputModel() { Content = string.Empty, BookId = id }; return this.PartialView("_AddComment", viewModel); } [HttpPost] [ValidateAntiForgeryToken] public ActionResult AddComment(BookCommentInputModel comment) { if (!this.User.Identity.IsAuthenticated) { this.Response.StatusCode = 401; return this.Content("Access is denied"); } if (comment == null || !this.ModelState.IsValid) { this.Response.StatusCode = 400; return this.Content("Bad request"); } var newComment = this.comments.Add(comment.Content, comment.BookId, this.User.Identity.GetUserId()); if (newComment == null) { this.Response.StatusCode = 400; return this.Content("Bad request."); } var viewModel = this.Mapper.Map<BookCommentViewModel>(newComment); return this.PartialView("_BookComment", viewModel); } } }
using Nancy.Hosting.Self; using System; namespace Infocode.Nancy.Metadata.OpenApi.DemoApplication.net45 { public class Program { private static void Main() { string url = "http://localhost:5000"; //var hostConfigs = new HostConfiguration() //{ // UrlReservations = new UrlReservations() { CreateAutomatically = true } //}; NancyHost host = new NancyHost(new Uri(url)); host.Start(); Console.WriteLine("Nancy host is listening at {0}", url); Console.WriteLine("Press <Enter> to exit"); Console.ReadLine(); } } }
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; public partial class User_Controls_Request_ucRequestHeader : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } public void DisplayRequestHeader(int RequestID) { Cls_Request objRequest = new Cls_Request(); try { string strMake = ""; string strModel = ""; string strSeries = ""; objRequest.RequestId = RequestID; DataTable dtReqHeader = objRequest.GetRequestHeaderInfo(); DataList1.RepeatColumns = 1; if (dtReqHeader.Rows.Count > 0) { strMake = dtReqHeader.Rows[0]["Make"].ToString(); strModel = dtReqHeader.Rows[0]["Model"].ToString(); strSeries = dtReqHeader.Rows[0]["Series"].ToString(); } StringBuilder MakeModelSeries = new StringBuilder(); MakeModelSeries.Append(strMake); if (strModel != "") { MakeModelSeries.Append("," + strModel); } if (strSeries != "") { MakeModelSeries.Append("," + strSeries); } if (dtReqHeader.Rows[0]["Series_1"].ToString() != String.Empty) { MakeModelSeries.Append(" (" + dtReqHeader.Rows[0]["Series_1"].ToString() + ")"); } //Postal code and suburb Label lblSub1 = (Label)this.Parent.FindControl("lblSub1"); Label lblPCode = (Label)this.Parent.FindControl("lblPCode1"); if (lblSub1 != null && lblPCode != null) { if (dtReqHeader.Rows[0]["suburb"].ToString() == null || dtReqHeader.Rows[0]["suburb"].ToString() == "") lblSub1.Text = "--"; else lblSub1.Text = dtReqHeader.Rows[0]["suburb"].ToString(); if (dtReqHeader.Rows[0]["pcode"].ToString() == null || dtReqHeader.Rows[0]["pcode"].ToString() == "") lblPCode.Text = "--"; else lblPCode.Text = dtReqHeader.Rows[0]["pcode"].ToString(); } DataTable dt = new DataTable(); dt.Columns.Add("Header"); dt.Columns.Add("Details"); DataRow dRow = null; dRow = dt.NewRow(); dRow["Header"] = "Make,Model,Series"; dRow["Details"] = MakeModelSeries.ToString(); dt.Rows.Add(dRow); DataList1.DataSource = dt; DataList1.DataBind(); DataTable dt1 = new DataTable(); dt1.Columns.Add("Header"); dt1.Columns.Add("Details"); DataRow dRow1 = null; DataList2.RepeatColumns = 1; DataTable dtReqParams = objRequest.GetRequestParameters(); if (dtReqParams.Rows.Count > 0) { foreach (DataRow drParam in dtReqParams.Rows) { dRow1 = dt1.NewRow(); dRow1["Header"] = drParam["Parameter"].ToString(); if (drParam["ParamValue"].ToString() == "") { dRow1["Details"] = "-"; } else { dRow1["Details"] = drParam["ParamValue"].ToString(); } //dRow1["Details"] = drParam["ParamValue"].ToString(); dt1.Rows.Add(dRow1); } } DataList2.DataSource = dt1; DataList2.DataBind(); } catch (Exception ex) { throw; } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(InputField))] public class RoomNameInputField : MonoBehaviour { [HideInInspector] public string roomName; public InputField inputField; void Start() { roomName = string.Empty; } public void SetRoomName(string value) { if(string.IsNullOrEmpty(value)) return; roomName = value; } public void LimitCharacter() { inputField.characterLimit = 20; } }
using System.Reflection; using UnityEngine; namespace UnityEditor.ShaderGraph { [Title("UV", "Polar Coordinates")] class PolarCoordinatesNode : CodeFunctionNode { public PolarCoordinatesNode() { name = "Polar Coordinates"; } protected override MethodInfo GetFunctionToConvert() { return GetType().GetMethod("Unity_PolarCoordinates", BindingFlags.Static | BindingFlags.NonPublic); } static string Unity_PolarCoordinates( [Slot(0, Binding.MeshUV0)] Vector2 UV, [Slot(1, Binding.None, 0.5f, 0.5f, 0.5f, 0.5f)] Vector2 Center, [Slot(2, Binding.None, 1.0f, 1.0f, 1.0f, 1.0f)] Vector1 RadialScale, [Slot(3, Binding.None, 1.0f, 1.0f, 1.0f, 1.0f)] Vector1 LengthScale, [Slot(4, Binding.None)] out Vector2 Out) { Out = Vector2.zero; return @" { $precision2 delta = UV - Center; $precision radius = length(delta) * 2 * RadialScale; $precision angle = atan2(delta.x, delta.y) * 1.0/6.28 * LengthScale; Out = $precision2(radius, angle); } "; } } }
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class AbilityBar : MonoBehaviour { [SerializeField] private RectTransform abilityBar; [SerializeField] private AbilityButton abilityButtonPrefab; [SerializeField] private Queue<AbilityButton> abPool = new Queue<AbilityButton>(); private LinkedList<AbilityButton> activeButtons = new LinkedList<AbilityButton>(); private BattleManager battle; public void SetBattle(BattleManager battle) { if (this.battle != null) { Deregister(); } this.battle = battle; Register(); } private void OnEnable() { Register(); } private void OnDisable() { Deregister(); } private void Register() { if (battle == null) return; battle.onTurnStarted += OnTurnStarted; battle.onTurnEnded += OnTurnEnded; battle.onTargettingStarted += OnTargettingStarted; battle.onTargettingCancelled += OnTargettingCancelled; battle.onAbilityActivated += OnAbilityActivated; } private void Deregister() { if (battle == null) return; battle.onTurnStarted -= OnTurnStarted; battle.onTurnEnded -= OnTurnEnded; battle.onTargettingStarted -= OnTargettingStarted; battle.onTargettingCancelled -= OnTargettingCancelled; battle.onAbilityActivated -= OnAbilityActivated; } private void SetCombatant(Combatant combatant) { foreach (AbilityButton button in activeButtons) { ReturnAbilityButton(button); } if (combatant == null) return; foreach (AbilityData ability in combatant.Abilities) { AbilityButton ab = GetAbilityButton(); ab.Assign(ability); ab.UpdateClickable(); } } private AbilityButton GetAbilityButton() { if (abPool.Count < 1) abPool.Enqueue(Instantiate(abilityButtonPrefab, abilityBar)); AbilityButton abilityButton = abPool.Dequeue(); activeButtons.AddLast(abilityButton); abilityButton.gameObject.SetActive(true); abilityButton.ForceInactive = false; abilityButton.transform.SetAsLastSibling(); return abilityButton; } private void ReturnAbilityButton(AbilityButton abilityButton, bool removeFromActiveList = true) { abilityButton.gameObject.SetActive(false); abilityButton.ForceInactive = false; if (removeFromActiveList) activeButtons.Remove(abilityButton); abPool.Enqueue(abilityButton); } private void OnTurnStarted(Combatant combatant, uint turn, uint turnInBattle) { SetCombatant(combatant); } private void OnTurnEnded(Combatant combatant, uint turn, uint turnInBattle) { SetCombatant(null); } private void OnTargettingStarted(AbilityData ability) { foreach (AbilityButton abilityButton in activeButtons) { abilityButton.ForceInactive = true; } } private void OnTargettingCancelled(AbilityData ability) { foreach (AbilityButton abilityButton in activeButtons) { abilityButton.ForceInactive = false; } } private void OnAbilityActivated(AbilityData activatedAbility, Combatant target) { foreach (AbilityButton abilityButton in activeButtons) { ReturnAbilityButton(abilityButton, false); } activeButtons.Clear(); } }
using Assets.Scripts.Action.Core; using Assets.Scripts.Tools.Component; using ParadoxNotion.Design; using System; using UnityEngine; namespace Assets.Scripts.Action { [Category("obsolete/Camera"), Name("Rotate Camera self")] public class CameraRotateSelfAction : DevisableAction { public Vector3 Rotate; public float Time; public bool IgnoreTimeScale; private DateTime startDataTime; private float RunTime { get { if (this.IgnoreTimeScale) { return (float)(DateTime.Now - this.startDataTime).TotalSeconds; } return base.elapsedTime; } } protected override void OnExecute() { if (this.IgnoreTimeScale) { this.startDataTime = DateTime.Now; } iTween.RotateAdd(Main3DCamera.Instance.Level1.gameObject, iTween.Hash(new object[] { "time", this.Time, "x", this.Rotate.x, "y", this.Rotate.y, "z", this.Rotate.z, "ignoretimescale", this.IgnoreTimeScale })); } protected override void OnUpdate() { float runTime = this.RunTime; if (this.Time <= runTime) { base.EndAction(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AspNetCoreRateLimit; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; namespace REST.API.Controllers.V1 { /// <summary> /// https://codeburst.io/rate-limiting-api-endpoints-in-asp-net-core-926e31428017 /// </summary> [ApiVersion("1.0")] [Route("api/v{version:apiVersion}/iprates")] [ApiController] public class IpRatesController : ControllerBase { private readonly IpRateLimitOptions _options; private readonly IIpPolicyStore _ipPolicyStore; public IpRatesController(IOptions<IpRateLimitOptions> optionsAccessor, IIpPolicyStore ipPolicyStore) { _options = optionsAccessor.Value; _ipPolicyStore = ipPolicyStore; } [HttpGet] public async Task<IpRateLimitPolicies> Get() { return await _ipPolicyStore.GetAsync(_options.IpPolicyPrefix); } [HttpPost] public async Task Post() { var pol = await _ipPolicyStore.GetAsync(_options.IpPolicyPrefix); pol.IpRules.Add(new IpRateLimitPolicy { Ip = "8.8.4.4", Rules = new List<RateLimitRule>(new RateLimitRule[] { new RateLimitRule { Endpoint = "*:/api/testupdate", Limit = 100, Period = "1d" } }) }); await _ipPolicyStore.SetAsync(_options.IpPolicyPrefix, pol); } } }
using Disqus.Core.Helpers; namespace Disqus.Core.Authentication { public enum DisqusAuthenticationType { [ArgumentValue("access_token")] OAuth, [ArgumentValue("remote_auth")] RemoteAuth, } }
using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; using XamUI.ViewModels.About; namespace XamUI.Views { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class AboutShrinkHeaderPage : ContentPage { private AboutPageViewModel viewModel; public AboutShrinkHeaderPage() { InitializeComponent(); this.BindingContext = viewModel = new AboutPageViewModel(); MainScrollView.Scrolled += MainScrollView_Scrolled; } private void MainScrollView_Scrolled(object sender, ScrolledEventArgs e) { double progress = Math.Min(e.ScrollY, viewModel.HeaderBounds.Height) / viewModel.HeaderBounds.Height; MainHeaderImage.Scale = 1 + progress; MainHeaderImage.Opacity = 1 - progress; } } }
// Copyright (c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not // use this file except in compliance with the License. You may obtain a copy // of the License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, // MERCHANTABLITY OR NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing // permissions and limitations under the License. namespace Microsoft.Hadoop.Avro.Tests { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.Serialization; [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Used by reflection."), DataContract(Name = "WriterClass")] internal class WriterClass : IEquatable<WriterClass> { [DataMember] public bool BoolA = Utilities.GetRandom<bool>(false); [DataMember] public bool BoolB = Utilities.GetRandom<bool>(false); [DataMember] public float FloatA = Utilities.GetRandom<float>(false); [DataMember] public float FloatB = Utilities.GetRandom<float>(false); [DataMember] public double DoubleA = Utilities.GetRandom<double>(false); [DataMember] public double DoubleB = Utilities.GetRandom<double>(false); [DataMember] public int IntA = Utilities.GetRandom<int>(false); [DataMember] public int IntB = Utilities.GetRandom<int>(false); [DataMember] public long LongA = Utilities.GetRandom<int>(false); [DataMember] public long LongB = Utilities.GetRandom<int>(false); [DataMember] public string StringA = Utilities.GetRandom<string>(false); [DataMember] public string StringB = Utilities.GetRandom<string>(false); [DataMember] public byte[] ByteArrayA = Utilities.GetRandom<byte[]>(false); [DataMember] public byte[] ByteArrayB = Utilities.GetRandom<byte[]>(false); [DataMember] public double[] DoubleArrayA = Utilities.GetRandom<double[]>(false); [DataMember] public double[] DoubleArrayB = Utilities.GetRandom<double[]>(false); [DataMember] public ClassOfInt[] SimpleClassArrayA = { ClassOfInt.Create(true), ClassOfInt.Create(true) }; [DataMember] public List<Recursive> RecursiveListA = new List<Recursive> { Recursive.Create(), Recursive.Create() }; [DataMember] public Dictionary<Uri, Recursive> RecursiveDictionaryA = new Dictionary<Uri, Recursive> { { Utilities.GetRandom<Uri>(false), Recursive.Create() }, { Utilities.GetRandom<Uri>(false), Recursive.Create() } }; [DataMember] public Suit Suit { get; set; } [DataMember] public Guid Guid { get; set; } public bool Equals(WriterClass other) { if (other == null) { return false; } return this.BoolA == other.BoolA && this.BoolB == other.BoolB && this.FloatA == other.FloatA && this.FloatB == other.FloatB && this.DoubleA == other.DoubleA && this.DoubleB == other.DoubleB && this.IntA == other.IntA && this.IntB == other.IntB && this.LongA == other.LongA && this.LongB == other.LongB && this.StringA == other.StringA && this.StringB == other.StringB && this.ByteArrayA.SequenceEqual(other.ByteArrayA) && this.ByteArrayB.SequenceEqual(other.ByteArrayB) && this.DoubleArrayA.SequenceEqual(other.DoubleArrayA) && this.DoubleArrayB.SequenceEqual(other.DoubleArrayB) && this.SimpleClassArrayA.SequenceEqual(other.SimpleClassArrayA) && this.RecursiveListA.SequenceEqual(other.RecursiveListA) && Utilities.DictionaryEquals(this.RecursiveDictionaryA, other.RecursiveDictionaryA) && this.Suit == other.Suit && this.Guid == other.Guid; } public override bool Equals(object obj) { return this.Equals(obj as WriterClass); } public override int GetHashCode() { throw new NotImplementedException(); } } [DataContract(Name = "WriterClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "It is created by deserialzer.")] internal class EmptyClass { } [DataContract(Name = "WriterClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "It is created by deserialzer.")] internal class WriterClassWithPermutatedFields { [DataMember] public double DoubleB = 0; [DataMember] public float FloatB = 0; [DataMember] public float FloatA = 0; [DataMember] public bool BoolB = false; [DataMember] public bool BoolA = false; [DataMember] public double DoubleA = 0; } [DataContract(Name = "WriterClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "It is created by deserialzer.")] internal class WriterClassWithMissingAndAddedFields { [DataMember] public bool BoolC = false; [DataMember] public bool BoolB = false; [DataMember] public float FloatA = 0; [DataMember] public float FloatC = 0; [DataMember] public double DoubleC = 0; [DataMember] public double DoubleB = 0; [DataMember] public int IntB = 0; [DataMember] public long LongB = 0; [DataMember] public string StringB = string.Empty; [DataMember] public byte[] ByteArrayB = { }; [DataMember] public double[] DoubleArrayB = { 1, 6, 7, 8 }; } [DataContract] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class ClassWithPromotionalFields { private static readonly Random Random = new Random(13); [DataMember] public int IntToLongField = Random.Next(); [DataMember] public int IntToFloatField = Random.Next(); [DataMember] public int IntToDoubleField = Random.Next(); [DataMember] public long LongToFloatField = Random.Next(); [DataMember] public long LongToDoubleField = Random.Next(); [DataMember] public float FloatToDoubleField = (float)Random.NextDouble(); } [DataContract(Name = "ClassWithPromotionalFields")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class ReaderClassWithPromotionalFields { [DataMember] public long IntToLongField = 0; [DataMember] public float IntToFloatField = 0; [DataMember] public double IntToDoubleField = 0; [DataMember] public float LongToFloatField = 0; [DataMember] public double LongToDoubleField = 0; [DataMember] public double FloatToDoubleField = 0; } [DataContract(Name = "ClassWithPromotionalInt", Namespace = "test")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "It is created by deserializer.")] internal class ClassWithPromotionalInt { [DataMember] internal int A = 0; [DataMember] public int B = 0; [DataMember] public int C = 0; } [DataContract(Name = "ClassWithPromotionalInt")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "It is created by deserialzer.")] internal class ClassWithPromotionalInt4MatchCase { [DataMember] public long A = 11; [DataMember] public float B = 21; [DataMember] public double C = 31; } [DataContract(Name = "SimpleIntClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleIntClassWithExtraFields { [DataMember] public int ExtraFieldInt { get; set; } [DataMember] public float ExtraFieldFloat { get; set; } [DataMember] public long ExtraFieldLong { get; set; } [DataMember] public int IntField { get; set; } [DataMember] public double ExtraFieldDouble { get; set; } [DataMember] public string ExtraFieldString { get; set; } [DataMember] public bool ExtraFieldBool { get; set; } } [DataContract(Name = "Suit")] internal enum SuitWithExtraFields { [EnumMember] Spades, [EnumMember] Hearts, [EnumMember] Diamonds, [EnumMember] Clubs, [EnumMember] ExtraField1, [EnumMember] ExtraField2, [EnumMember] ExtraField3 } [DataContract(Name = "Suit")] internal enum SuitAllCaps { [EnumMember] HEARTS, [EnumMember] SPADES, [EnumMember] DIAMONDS, [EnumMember] CLUBS } [DataContract(Name = "Suit")] internal enum SuitMissingSymbols { [EnumMember] Spades, [EnumMember] Hearts, [EnumMember] Diamonds } [DataContract] internal enum Suit { [EnumMember] Spades, [EnumMember] Hearts, [EnumMember] Diamonds, [EnumMember] Clubs } [DataContract(Name = "SimpleIntClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleIntClassWithStringFieldType { [DataMember] public string IntField { get; set; } } [DataContract(Name = "SimpleIntClass")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleIntClassWithDifferentFieldName { [DataMember] public string IntFieldChanged { get; set; } } [DataContract(Name = "SimpleMap")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleMap { [DataMember] public Dictionary<string, string> Values { get; set; } } [DataContract(Name = "SimpleMap")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleMapWithLongValues { [DataMember] public Dictionary<string, long> Values { get; set; } } [DataContract(Name = "SimpleMap")] [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Type is used by serializer.")] internal class SimpleMapWithReaderClassWithPromotionalFields { [DataMember] public Dictionary<string, ReaderClassWithPromotionalFields> Values { get; set; } } }
namespace ArcticCodeReview { partial class ReviewMessageDialog { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.buttonNewReview = new System.Windows.Forms.Button(); this.buttonHide = new System.Windows.Forms.Button(); this.buttonAppend = new System.Windows.Forms.Button(); this.webBrowserReviews = new System.Windows.Forms.WebBrowser(); this.richTextBoxReviewComment = new System.Windows.Forms.RichTextBox(); this.wysiwygEditorControl = new ArcticCodeReview.WysiwygEditorControl(); this.labelComment = new System.Windows.Forms.Label(); this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.splitContainer4 = new System.Windows.Forms.SplitContainer(); this.panel2 = new System.Windows.Forms.Panel(); this.buttonCancel = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).BeginInit(); this.splitContainer4.Panel1.SuspendLayout(); this.splitContainer4.Panel2.SuspendLayout(); this.splitContainer4.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // buttonNewReview // this.buttonNewReview.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonNewReview.Dock = System.Windows.Forms.DockStyle.Right; this.buttonNewReview.Location = new System.Drawing.Point(449, 0); this.buttonNewReview.Name = "buttonNewReview"; this.buttonNewReview.Size = new System.Drawing.Size(76, 31); this.buttonNewReview.TabIndex = 4; this.buttonNewReview.Text = "New Review"; this.buttonNewReview.UseVisualStyleBackColor = true; this.buttonNewReview.Click += new System.EventHandler(this.buttonNewReview_Click); // // buttonHide // this.buttonHide.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonHide.Dock = System.Windows.Forms.DockStyle.Right; this.buttonHide.Location = new System.Drawing.Point(525, 0); this.buttonHide.Name = "buttonHide"; this.buttonHide.Size = new System.Drawing.Size(75, 31); this.buttonHide.TabIndex = 3; this.buttonHide.Text = "Hide"; this.buttonHide.UseVisualStyleBackColor = true; this.buttonHide.Click += new System.EventHandler(this.buttonHide_Click); // // buttonAppend // this.buttonAppend.Dock = System.Windows.Forms.DockStyle.Left; this.buttonAppend.Location = new System.Drawing.Point(0, 0); this.buttonAppend.Name = "buttonAppend"; this.buttonAppend.Size = new System.Drawing.Size(75, 31); this.buttonAppend.TabIndex = 1; this.buttonAppend.Text = "Append"; this.buttonAppend.UseVisualStyleBackColor = true; this.buttonAppend.Click += new System.EventHandler(this.buttonAppend_Click); // // webBrowserReviews // this.webBrowserReviews.Dock = System.Windows.Forms.DockStyle.Fill; this.webBrowserReviews.Location = new System.Drawing.Point(0, 0); this.webBrowserReviews.MinimumSize = new System.Drawing.Size(20, 20); this.webBrowserReviews.Name = "webBrowserReviews"; this.webBrowserReviews.Size = new System.Drawing.Size(600, 251); this.webBrowserReviews.TabIndex = 0; // // richTextBoxReviewComment // this.richTextBoxReviewComment.Dock = System.Windows.Forms.DockStyle.Fill; this.richTextBoxReviewComment.Location = new System.Drawing.Point(0, 0); this.richTextBoxReviewComment.Name = "richTextBoxReviewComment"; this.richTextBoxReviewComment.Size = new System.Drawing.Size(600, 76); this.richTextBoxReviewComment.TabIndex = 2; this.richTextBoxReviewComment.Text = ""; // // wysiwygEditorControl // this.wysiwygEditorControl.Dock = System.Windows.Forms.DockStyle.Fill; this.wysiwygEditorControl.DocumentText = null; this.wysiwygEditorControl.Location = new System.Drawing.Point(0, 0); this.wysiwygEditorControl.Name = "wysiwygEditorControl"; this.wysiwygEditorControl.Size = new System.Drawing.Size(600, 177); this.wysiwygEditorControl.TabIndex = 3; // // labelComment // this.labelComment.AutoSize = true; this.labelComment.Dock = System.Windows.Forms.DockStyle.Top; this.labelComment.Location = new System.Drawing.Point(0, 0); this.labelComment.Name = "labelComment"; this.labelComment.Size = new System.Drawing.Size(51, 13); this.labelComment.TabIndex = 1; this.labelComment.Text = "Comment"; // // splitContainer3 // this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer3.Location = new System.Drawing.Point(0, 13); this.splitContainer3.Name = "splitContainer3"; this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer3.Panel1 // this.splitContainer3.Panel1.Controls.Add(this.richTextBoxReviewComment); // // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); this.splitContainer3.Size = new System.Drawing.Size(600, 512); this.splitContainer3.SplitterDistance = 76; this.splitContainer3.TabIndex = 2; // // splitContainer4 // this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer4.Location = new System.Drawing.Point(0, 0); this.splitContainer4.Name = "splitContainer4"; this.splitContainer4.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer4.Panel1 // this.splitContainer4.Panel1.Controls.Add(this.wysiwygEditorControl); // // splitContainer4.Panel2 // this.splitContainer4.Panel2.Controls.Add(this.panel2); this.splitContainer4.Panel2.Controls.Add(this.webBrowserReviews); this.splitContainer4.Size = new System.Drawing.Size(600, 432); this.splitContainer4.SplitterDistance = 177; this.splitContainer4.TabIndex = 0; // // panel2 // this.panel2.Controls.Add(this.buttonNewReview); this.panel2.Controls.Add(this.buttonCancel); this.panel2.Controls.Add(this.buttonAppend); this.panel2.Controls.Add(this.buttonHide); this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(600, 31); this.panel2.TabIndex = 0; // // buttonCancel // this.buttonCancel.Dock = System.Windows.Forms.DockStyle.Left; this.buttonCancel.Location = new System.Drawing.Point(75, 0); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 31); this.buttonCancel.TabIndex = 1; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // // ReviewMessageDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(600, 525); this.Controls.Add(this.splitContainer3); this.Controls.Add(this.labelComment); this.Name = "ReviewMessageDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Review"; this.TopMost = true; this.splitContainer3.Panel1.ResumeLayout(false); this.splitContainer3.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); this.splitContainer3.ResumeLayout(false); this.splitContainer4.Panel1.ResumeLayout(false); this.splitContainer4.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).EndInit(); this.splitContainer4.ResumeLayout(false); this.panel2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button buttonAppend; private System.Windows.Forms.WebBrowser webBrowserReviews; private System.Windows.Forms.RichTextBox richTextBoxReviewComment; private System.Windows.Forms.Button buttonNewReview; private System.Windows.Forms.Button buttonHide; private WysiwygEditorControl wysiwygEditorControl; private System.Windows.Forms.Label labelComment; private System.Windows.Forms.SplitContainer splitContainer3; private System.Windows.Forms.SplitContainer splitContainer4; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Button buttonCancel; } }
<link href="~/Content/plugins/toastr/toastr.css" rel="stylesheet" /> <script src="~/Content/plugins/toastr/toastr.js"></script> <script> toastr.options = { "closeButton": true, "debug": false, "newestOnTop": true, "progressBar": false, "positionClass": "toast-bottom-right", "preventDuplicates": false, "onclick": null, "showDuration": "500", "hideDuration": "1000", "timeOut": "5000", "extendedTimeOut": "1000", "showEasing": "linear", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" } </script> @if (TempData["notification"] != null) { var notifyType = TempData["notificationType"].ToString(); var notifyTitle = TempData["notificationTitle"].ToString(); <script> toastr["@notifyType"]("@TempData["notification"].ToString()", "@notifyTitle"); </script> } else if (ViewData["notification"] != null) { var notifyType = ViewData["notificationType"].ToString(); var notifyTitle = ViewData["notificationTitle"].ToString(); <script> toastr["@notifyType"]("@ViewData["notification"].ToString()", "@notifyTitle"); </script> }
using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Xunit; namespace Tmds.DBus.Tests { public class ConnectionTests { [Fact] public async Task Method() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IStringOperations>("servicename", StringOperations.Path); await conn2.RegisterObjectAsync(new StringOperations()); var reply = await proxy.ConcatAsync("hello ", "world"); Assert.Equal("hello world", reply); } [Fact] public async Task Signal() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IPingPong>("servicename", PingPong.Path); var tcs = new TaskCompletionSource<string>(); await proxy.WatchPongAsync(message => tcs.SetResult(message)); await conn2.RegisterObjectAsync(new PingPong()); await proxy.PingAsync("hello world"); var reply = await tcs.Task; Assert.Equal("hello world", reply); } [Fact] public async Task SignalNoArg() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IPingPong>("servicename", PingPong.Path); var tcs = new TaskCompletionSource<string>(); await proxy.WatchPongNoArgAsync(() => tcs.SetResult(null)); await conn2.RegisterObjectAsync(new PingPong()); await proxy.PingAsync("hello world"); var reply = await tcs.Task; Assert.Equal(null, reply); } [Fact] public async Task SignalWithException() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IPingPong>("servicename", PingPong.Path); var tcs = new TaskCompletionSource<string>(); await proxy.WatchPongWithExceptionAsync(message => tcs.SetResult(message), null); await conn2.RegisterObjectAsync(new PingPong()); await proxy.PingAsync("hello world"); var reply = await tcs.Task; Assert.Equal("hello world", reply); } [Fact] public async Task Properties() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IPropertyObject>("servicename", PropertyObject.Path); var dictionary = new Dictionary<string, object>{{"key1", 1}, {"key2", 2}}; await conn2.RegisterObjectAsync(new PropertyObject(dictionary)); var properties = await proxy.GetAllAsync(); Assert.Equal(dictionary, properties); var val1 = await proxy.GetAsync("key1"); Assert.Equal(1, val1); var tcs = new TaskCompletionSource<PropertyChanges>(); await proxy.WatchPropertiesAsync(_ => tcs.SetResult(_)); await proxy.SetAsync("key1", "changed"); var val1Changed = await proxy.GetAsync("key1"); Assert.Equal("changed", val1Changed); var changes = await tcs.Task; Assert.Equal(1, changes.Changed.Length); Assert.Equal("key1", changes.Changed.First().Key); Assert.Equal("changed", changes.Changed.First().Value); Assert.Equal(0, changes.Invalidated.Length); } [InlineData("tcp:host=localhost,port=1")] [InlineData("unix:path=/does/not/exist")] [Theory] public async Task UnreachableAddress(string address) { using (var connection = new Connection(address)) { await Assert.ThrowsAsync<ConnectException>(() => connection.ConnectAsync()); } } [DBusInterface("tmds.dbus.tests.Throw")] public interface IThrow : IDBusObject { Task ThrowAsync(); } public class Throw : IThrow { public static readonly ObjectPath Path = new ObjectPath("/tmds/dbus/tests/throw"); public static readonly string ExceptionMessage = "throwing"; public ObjectPath ObjectPath => Path; public Task ThrowAsync() { throw new Exception(ExceptionMessage); } } [Fact] public async Task PassException() { var connections = await PairedConnection.CreateConnectedPairAsync(); var conn1 = connections.Item1; var conn2 = connections.Item2; var proxy = conn1.CreateProxy<IThrow>("servicename", Throw.Path); await conn2.RegisterObjectAsync(new Throw()); var exception = await Assert.ThrowsAsync<DBusException>(proxy.ThrowAsync); Assert.Equal(Throw.ExceptionMessage, exception.ErrorMessage); } } }
using Blazor.FlexGrid.DataSet; using Blazor.FlexGrid.Permission; using Microsoft.Extensions.Logging; using System; namespace Blazor.FlexGrid.Components.Renderers { public class GridBodySimpleRenderer : GridCompositeRenderer { private readonly ILogger<GridBodySimpleRenderer> logger; public GridBodySimpleRenderer(ILogger<GridBodySimpleRenderer> logger) { this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); } protected override void BuildRenderTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext) { using (new MeasurableScope(sw => logger.LogInformation($"Grid body rendering duration {sw.ElapsedMilliseconds}ms"))) { rendererContext.OpenElement(HtmlTagNames.TableBody, rendererContext.CssClasses.TableBody); try { foreach (var item in rendererContext.TableDataSet.Items) { rendererContext.ActualItem = item; foreach (var renderer in gridPartRenderers) renderer.BuildRendererTree(rendererContext, permissionContext); } } catch (Exception ex) { logger.LogError($"Error occured during rendering grid view body. Ex: {ex}"); } rendererContext.CloseElement(); } } public override bool CanRender(GridRendererContext rendererContext) => rendererContext.TableDataSet.HasItems(); } }
namespace JakePerry.Unity.ScriptableData { public static class Constants { public const string kPluginVersion = "1.0.0.0"; public const string kPackageName = "ScriptableData"; public const string kPackageAuthor = "Jake Perry"; } }
// Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information. #if !NETCOREAPP1_0 namespace Aqua.Tests.Serialization { using System.IO; using System.Runtime.Serialization.Formatters.Binary; public static class BinarySerializationHelper { public static T Serialize<T>(this T graph) { if (graph == null) { return graph; } var serializer = new BinaryFormatter(); using (var stream = new MemoryStream()) { serializer.Serialize(stream, graph); stream.Seek(0, SeekOrigin.Begin); return (T)serializer.Deserialize(stream); } } } } #endif
using System; using System.Globalization; using System.Threading.Tasks; using FluentAssertions; using Microsoft.AspNetCore.Http; using Moq; using UrbanSolution.Data; using UrbanSolution.Models; using UrbanSolution.Services.Implementations; using UrbanSolution.Services.Tests.Mocks; using Xunit; namespace UrbanSolution.Services.Tests { public class UserIssuesServiceTests { private int issueId; private int resolvedId; private const double DefaultLocation = 45.289; private const int DefaultImageId = 458962; private readonly UrbanSolutionDbContext db; public UserIssuesServiceTests() { this.db = InMemoryDatabase.Get(); AutomapperInitializer.Initialize(); } [Fact] public async Task UploadAsyncShould() { const string UserId = "rt8856dse45e12ds2"; const string Title = "dssfrfsfsd"; const string Description = "Description"; const string Address = "Address"; const string Latitude = "42.36"; const string Longitude = "41.458"; string issueType = UrbanSolution.Models.IssueType.DangerousTrees.ToString(); string region = RegionType.Western.ToString(); //Arrange var pictureService = IPictureServiceMock.New(DefaultImageId); var service = new UserIssuesService(this.db, pictureService.Object); var picFile = new Mock<IFormFile>(); //Act var result = await service.UploadAsync(UserId, Title, Description, picFile.Object, issueType, region, Address, Latitude, Longitude); //Assert result.Should().BeOfType(typeof(int)); pictureService.Verify(p => p.UploadImageAsync(It.IsAny<string>(), It.IsAny<IFormFile>()), Times.Once); var savedIssue = this.db.Find<UrbanIssue>(result); savedIssue.Id.Should().Be(result); savedIssue.Title.Should().Match(Title); savedIssue.Description.Should().Match(Description); savedIssue.Latitude.Should().Be(double.Parse(Latitude.Trim(), CultureInfo.InvariantCulture)); savedIssue.Longitude.Should().Be(double.Parse(Longitude.Trim(), CultureInfo.InvariantCulture)); savedIssue.AddressStreet.Should().Match(Address); savedIssue.PublisherId.Should().Match(UserId); savedIssue.Type.Should().Be(Enum.Parse<IssueType>(issueType)); savedIssue.Region.Should().Be(Enum.Parse<RegionType>(region)); savedIssue.CloudinaryImageId.Should().Be(DefaultImageId); } private CloudinaryImage CreateImage(string userId) { return new CloudinaryImage { Id = DefaultImageId, Length = long.MaxValue, UploaderId = userId, PictureThumbnailUrl = Guid.NewGuid().ToString(), PicturePublicId = Guid.NewGuid().ToString(), PictureUrl = Guid.NewGuid().ToString() }; } private ResolvedIssue CreateResolvedIssue(string publisherId) { return new ResolvedIssue { Id = ++resolvedId, CloudinaryImageId = DefaultImageId, Description = Guid.NewGuid().ToString(), PublisherId = publisherId, ResolvedOn = DateTime.UtcNow }; } private User CreateUser() { return new User { Id = Guid.NewGuid().ToString(), UserName = Guid.NewGuid().ToString() }; } private UrbanIssue CreateIssue(bool isApproved, string publisherId, RegionType? region) { return new UrbanIssue { Id = ++issueId, AddressStreet = Guid.NewGuid().ToString(), CloudinaryImageId = DefaultImageId, Description = Guid.NewGuid().ToString(), IsApproved = isApproved, Latitude = DefaultLocation, Longitude = DefaultLocation, PublishedOn = DateTime.UtcNow, PublisherId = publisherId, Region = region ?? RegionType.All }; } } }
using DeftPack.TestAutomation.Selenium.PageObjects.MetaInformation; using OpenQA.Selenium; namespace DeftPack.TestAutomation.Selenium.PageObjects.Elements { /// <summary> /// HTML: textarea and input [url, text, search, password, email] /// </summary> [HtmlTag("textarea")] [HtmlInput(InputTypes.Url)] [HtmlInput(InputTypes.Text)] [HtmlInput(InputTypes.Search)] [HtmlInput(InputTypes.Password)] [HtmlInput(InputTypes.Email)] public class TextBox : Element, IEditable { public TextBox(IWebElement proxyObject) : base(proxyObject) { } public void Enter(string text) { ProxyObject.SendKeys(text); } public string Text { get { return ProxyObject.Text; } } } }
using System; using ScooterBear.GTD.Application.UserProject; namespace ScooterBear.GTD.AWS.DynamoDb.Projects { public class ReadOnlyProject : IProject { public ReadOnlyProject(string id, string userId, string name, int count, bool isDeleted, int countOverDue, int versionNumber, DateTime dateCreated) { Id = id; UserId = userId; Name = name; Count = count; IsDeleted = isDeleted; CountOverDue = countOverDue; VersionNumber = versionNumber; DateCreated = dateCreated; } public string Id { get; } public string Name { get; } public string UserId { get; } public int Count { get; } public bool IsDeleted { get; } public int CountOverDue { get; } public int VersionNumber { get; } public DateTime DateCreated { get; } } }
using System; using System.Collections.Generic; using System.Net; using System.Net.Http; using EncompassREST.Exceptions; namespace EncompassREST { public class Session { private readonly string _clientId; private readonly string _clientSecret; private readonly string _instanceId; private readonly string _userId; private readonly string _password; //private string _SessionKey; private AccessToken _accessToken; private const string _apiUrl = "https://api.elliemae.com"; private readonly HttpClient _client; private DateTime _tokenExpires; private DateTime _tokenLastCall; #region Properties public AccessToken AccessToken { get { return _accessToken; } private set { _accessToken = value; _tokenLastCall = DateTime.Now; IEnumerable<string> vals; if (_client.DefaultRequestHeaders.TryGetValues("Authorization", out vals)) _client.DefaultRequestHeaders.Remove("Authorization"); _client.DefaultRequestHeaders.Add("Authorization", _accessToken.AuthenticationString); } } public Loans Loans { get; } public Schemas Schemas { get; } public Webhooks Webhooks { get; } public Reports Reports { get; } public Pipeline Pipeline { get; } public HttpClient RESTClient { get { if (_accessToken == null) throw new SessionNotOpenException(); var now = DateTime.Now; if ((now - _tokenLastCall).TotalMinutes > 12 || (_tokenExpires - now).TotalMinutes < 10) { ClearAccessToken(); StartSession(); } _tokenLastCall = now; return _client; } } #endregion public Session(string clientId, string clientSecret, string instanceId, string userId, string password) { _clientId = clientId; _clientSecret = clientSecret; _instanceId = instanceId; _userId = userId; _password = password; _client = new HttpClient() { BaseAddress = new Uri(_apiUrl) }; ServicePointManager.DefaultConnectionLimit = 100; _accessToken = null; Loans = new Loans(this); Schemas = new Schemas(this); Webhooks = new Webhooks(this); Reports = new Reports(this); Pipeline = new Pipeline(this); } public void StartSession() { var t = new AccessToken(_clientId, _clientSecret, _instanceId, this); t.GetTokenAsync(_userId, _password).Wait(); AccessToken = t; var validate = t.GetTokenValidationAsync().Result; _tokenExpires = validate.GetExpirationDate(); } internal void ClearAccessToken() { _accessToken = null; _client.DefaultRequestHeaders.Remove("Authorization"); Console.WriteLine("Session Cleared"); } } }
namespace Fluxera.Extensions.Hosting.Modules.Persistence { using JetBrains.Annotations; /// <summary> /// A class containing the supported repository providers. /// </summary> [PublicAPI] public static class RepositoryProviderNames { /// <summary> /// The in-memory repository provider. /// </summary> public const string InMemory = "InMemory"; /// <summary> /// The EFCore repository provider. /// </summary> public const string EntityFrameworkCore = "EntityFrameworkCore"; /// <summary> /// The LiteDB repository provider. /// </summary> public const string LiteDB = "LiteDB"; /// <summary> /// The MongoDB repository provider. /// </summary> public const string MongoDB = "MongoDB"; ///// <summary> ///// The OData repository provider. ///// </summary> //public const string OData = "OData"; } }
namespace HotChocolate.Language.Utilities { public interface ISyntaxWriter { void Indent(); void Unindent(); void Write(char c); void Write(string s); void WriteLine(bool condition = true); void WriteSpace(bool condition = true); void WriteIndent(bool condition = true); } }
using FubuCore.Descriptions; namespace FubuMVC.Core.Runtime.Conditionals { [Title("Never")] public class Never : IConditional { public bool ShouldExecute(IFubuRequestContext context) { return false; } } }
using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; using Stock.Infrastructure.Database.Abstractions; using Stock.Infrastructure.Database.MongoDb.Repositories; using Stock.Infrastructure.Database.MongoDb.Settings; namespace Stock.Infrastructure.Database.MongoDb { /// <summary> /// Extension methods for <see cref="IServiceCollection"/>. /// </summary> public static class ServiceCollectionExtension { /// <summary> /// Add MongoDB database implementation dependencies into <see cref="IServiceCollection"/>. /// </summary> /// <param name="services">Dependency injection container.</param> public static void AddInfrastructureDatabaseMongoDb(this IServiceCollection services) { DatabaseMapping.RegisterMapping(); services.AddSingleton((serviceProvider) => { IStockDatabaseSettings settings = serviceProvider.GetRequiredService<IStockDatabaseSettings>(); return new MongoClient(settings.ConnectionString); }); services.AddSingleton<IStockRepository, StockRepository>(); services.AddSingleton<IStockHistoryRepository, StockHistoryRepository>(); } } }
namespace HalftoneFx { public struct Range<T> { public Range(T min, T max) { this.MinValue = min; this.MaxValue = max; } public T MinValue { get; set; } public T MaxValue { get; set; } } }
using System; using System.Threading.Tasks; namespace Zwyssigly.Functional { public static class OptionTaskExtensions { public static async Task<Option<TResult>> AndThenAsync<T, TResult>( this Task<Option<T>> self, Func<T, Task<Option<TResult>>> onSome) { var option = await self.ConfigureAwait(false); return await option.Match( s => onSome(s), () => Task.FromResult(Option.None<TResult>())).ConfigureAwait(false); } public static async Task<Option<TResult>> AndThen<T, TResult>( this Task<Option<T>> self, Func<T, Option<TResult>> onSome) { var option = await self.ConfigureAwait(false); return option.AndThen(onSome); } public static Task<Option<TResult>> AndThenAsync<T, TResult>( this Option<T> self, Func<T, Task<Option<TResult>>> onSome) { return self.Match( s => onSome(s), () => Task.FromResult(Option.None<TResult>())); } public static async Task<TResult> MatchAsync<T, TResult>( this Task<Option<T>> self, Func<T, Task<TResult>> onSome, Func<Task<TResult>> onNone) { var option = await self.ConfigureAwait(false); return await option.Match( s => onSome(s), () => onNone()).ConfigureAwait(false); } public static async Task<TResult> Match<T, TResult>( this Task<Option<T>> self, Func<T, TResult> onSome, Func<TResult> onNone) { var option = await self.ConfigureAwait(false); return option.Match(onSome, onNone); } public static async Task MatchAsync<T>( this Task<Option<T>> self, Func<T, Task> onSome, Func<Task> onNone) { var option = await self.ConfigureAwait(false); await option.Match( s => onSome(s), () => onNone()).ConfigureAwait(false); } public static async Task Match<T>( this Task<Option<T>> self, Action<T> onSome, Action onNone) { var option = await self.ConfigureAwait(false); option.Match(onSome, onNone); } public static async Task IfSomeAsync<T>(this Task<Option<T>> self, Func<T, Task> onSome) { var option = await self.ConfigureAwait(false); await option.IfSomeAsync(onSome); } public static async Task IfSome<T>(this Task<Option<T>> self, Action<T> onSome) { var option = await self.ConfigureAwait(false); option.IfSome(onSome); } public static Task IfSomeAsync<T>(this Option<T> self, Func<T, Task> onSome) { return self.Match(s => onSome(s), () => Task.FromResult(0)); } public static async Task IfNoneAsync<T>(this Task<Option<T>> self, Func<Task> onNone) { var option = await self.ConfigureAwait(false); await option.IfNoneAsync(onNone); } public static async Task IfSome<T>(this Task<Option<T>> self, Action onNone) { var option = await self.ConfigureAwait(false); option.IfNone(onNone); } public static Task IfNoneAsync<T>(this Option<T> self, Func<Task> onNone) { return self.Match(_ => Task.FromResult(0), () => onNone()); } public static Task<Option<TResult>> CastOrNone<T, TResult>(this Task<Option<T>> self) { return self.AndThen(s => s is TResult res ? Option.Some(res) : Option.None<TResult>()); } } }
using System; using System.Net; namespace RedisTribute.Io.Net { interface IServerEndpointFactory { Uri EndpointIdentifier { get; } EndPoint CreateEndpoint(); } }
using System.Linq; namespace Site.Areas.Admin.Models { public interface ITitleOfPageRepository { IQueryable<TitleOfPage> TitleOfPages { get; } //void AddTitleOfPage(TitleOfPage titleOfPage); } }
// <copyright file="TableStorageOperations.cs" company="3M"> // Copyright (c) 3M. All rights reserved. // </copyright> using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Table; namespace Mmm.Iot.Functions.DeploymentSync.Shared { public class TableStorageOperations { private static TableStorageOperations instance = null; private static SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1, 1); private readonly CloudTableClient client = null; private TableStorageOperations(CloudTableClient cloudTableClient) { this.client = cloudTableClient; } public static async Task<TableStorageOperations> GetClientAsync() { await semaphoreSlim.WaitAsync(); try { return instance ?? (instance = CreateInstance()); } finally { semaphoreSlim.Release(); } } public async Task<T> InsertAsync<T>(string tableName, T entity) where T : ITableEntity { CloudTable table = await this.GetTableAsync(tableName); TableOperation insertOperation = TableOperation.Insert(entity); return await this.ExecuteTableOperationAsync<T>(table, insertOperation); } public async Task<T> InsertOrReplaceAsync<T>(string tableName, T entity) where T : ITableEntity { CloudTable table = await this.GetTableAsync(tableName); TableOperation insertOrReplaceOperation = TableOperation.InsertOrReplace(entity); return await this.ExecuteTableOperationAsync<T>(table, insertOrReplaceOperation); } public async Task<T> InsertOrMergeAsync<T>(string tableName, T entity) where T : ITableEntity { CloudTable table = await this.GetTableAsync(tableName); TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(entity); return await this.ExecuteTableOperationAsync<T>(table, insertOrMergeOperation); } public async Task<T> RetrieveAsync<T>(string tableName, string partitionKey, string rowKey) where T : ITableEntity { CloudTable table = await this.GetTableAsync(tableName); TableOperation readOperation = TableOperation.Retrieve<T>(partitionKey, rowKey); return await this.ExecuteTableOperationAsync<T>(table, readOperation); } public async Task<T> DeleteAsync<T>(string tableName, T entity) where T : ITableEntity { CloudTable table = await this.GetTableAsync(tableName); TableOperation deleteOperation = TableOperation.Delete(entity); return await this.ExecuteTableOperationAsync<T>(table, deleteOperation); } public async Task<List<T>> QueryAsync<T>( string tableName, TableQuery<T> query, CancellationToken cancellationToken = default(CancellationToken)) where T : ITableEntity, new() { CloudTable table = await this.GetTableAsync(tableName); var items = new List<T>(); TableContinuationToken token = null; do { // combine query segments until the full query has been executed or cancelled TableQuerySegment<T> seg = await table.ExecuteQuerySegmentedAsync<T>(query, token); token = seg.ContinuationToken; items.AddRange(seg); } while (token != null && !cancellationToken.IsCancellationRequested); return items; } private static TableStorageOperations CreateInstance() { string connectionString = Environment.GetEnvironmentVariable("tableStorageConnectionString", EnvironmentVariableTarget.Process); CloudTableClient tableClient = CreateClient(connectionString); return new TableStorageOperations(tableClient); } private static CloudTableClient CreateClient(string tableStorageConnectionString) { var storageAccount = CloudStorageAccount.Parse(tableStorageConnectionString); return storageAccount.CreateCloudTableClient(); } private async Task<T> ExecuteTableOperationAsync<T>(CloudTable table, TableOperation operation) where T : ITableEntity { try { TableResult result = await table.ExecuteAsync(operation); try { return (T)result.Result; } catch (Exception e) { throw new Exception($"Unable to transform the table result {result.ToString()} to the requested entity type", e); } } catch (StorageException se) { throw new Exception($"Unable to perform the requested table operation {operation.OperationType}", se); } } private async Task<CloudTable> GetTableAsync(string tableName) { try { CloudTable table = this.client.GetTableReference(tableName); try { await table.CreateIfNotExistsAsync(); } catch (StorageException e) { throw new Exception($"An error occurred during table.CreateIfNotExistsAsync for the {tableName} table.", e); } return table; } catch (StorageException se) { throw new Exception($"An error occurred while attempting to get the {tableName} table and checking if it needed to be created.", se); } } } }
namespace Lopla.Tests.Libs { using Language.Binary; using Language.Compiler.Mnemonics; using Language.Processing; using Lopla.Libs; using Xunit; public class IOSpecs { public void Aaaaa() { var sut = new IO(); sut.Write(new ValueNumber(new Number((decimal) 3.145)), new Runtime(new Processors())); } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; namespace Nether.Ingest { /// <summary> /// Enables reading of results from arbitrary sources. /// </summary> public interface IResultsReader { /// <summary> /// Retrieves the latest result set from the underlying source. /// </summary> /// <returns>Returns an enumrable list of <see cref="Message"/>.</returns> IEnumerable<Message> GetLatest(); } }
using AventStack.ExtentReports.Gherkin.Model; using NUnit.Framework; namespace AventStack.ExtentReports.Tests.APITests { [TestFixture] public class BddLevelsTests : Base { [Test] public void VerifyLevelsUsingGherkinKeyword() { var feature = _extent.CreateTest(TestContext.CurrentContext.Test.Name); var scenario = feature.CreateNode(new GherkinKeyword("Scenario"), "Child"); var given = scenario.CreateNode(new GherkinKeyword("Given"), "Given").Info("Info"); var and = scenario.CreateNode(new GherkinKeyword("And"), "And").Info("Info"); var when = scenario.CreateNode(new GherkinKeyword("When"), "When").Info("Info"); var then = scenario.CreateNode(new GherkinKeyword("Then"), "Then").Pass("Pass"); Assert.AreEqual(feature.Model.Level, 0); Assert.AreEqual(scenario.Model.Level, 1); Assert.AreEqual(given.Model.Level, 2); Assert.AreEqual(and.Model.Level, 2); Assert.AreEqual(when.Model.Level, 2); Assert.AreEqual(then.Model.Level, 2); } [Test] public void VerifyLevelsUsingClass() { var feature = _extent.CreateTest(TestContext.CurrentContext.Test.Name); var scenario = feature.CreateNode<Scenario>("Child"); var given = scenario.CreateNode<Given>("Given").Info("Info"); var and = scenario.CreateNode<And>("And").Info("Info"); var when = scenario.CreateNode<When>("When").Info("Info"); var then = scenario.CreateNode<Then>("Then").Pass("Pass"); Assert.AreEqual(feature.Model.Level, 0); Assert.AreEqual(scenario.Model.Level, 1); Assert.AreEqual(given.Model.Level, 2); Assert.AreEqual(and.Model.Level, 2); Assert.AreEqual(when.Model.Level, 2); Assert.AreEqual(then.Model.Level, 2); } } }
using EasyAbp.EShop.Orders.Orders; using Volo.Abp.EventBus.Distributed; namespace EasyAbp.EShop.Products.Products { public interface IOrderPaidEventHandler : IDistributedEventHandler<OrderPaidEto> { } }
using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using ShittyLINQ; using ShittyTests.TestHelpers; namespace ShittyTests { [TestClass] public class ToLookupTests { [TestMethod] public void ToLookup_Numbers() { IEnumerable<int> numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var result = numbers.ToLookup(x => x, x => true); Assert.AreEqual(result.Count, 9); foreach (int number in numbers) { Assert.IsTrue(result.ContainsKey(number)); } } [TestMethod] public void ToLookup_Person() { var adam = new Person("Adam", 20, "Arquitech", "Amber"); var brian = new Person("Brian", 45, "Arquitech", "Blue"); var charles = new Person("Charles", 33, "Arquitech", "Cyan"); var dani = new Person("Dani", 33, "Developer", "Deep Purple"); IEnumerable<Person> people = new[] { adam, brian, charles, dani }; var result = people.ToLookup(person => person.Age); Assert.AreEqual(result.TryGetValue(brian.Age, out var expectedBrian), true); Assert.IsNotNull(expectedBrian); } } }
 //Code began with and then was modifed from Vassili Kaplan's CSCS. //https://msdn.microsoft.com/en-us/magazine/mt632273.aspx namespace CombatScript { public class Constants { public const char START_ARG = '('; public const char END_ARG = ')'; public const char END_LINE = '\n'; public const char NEXT_ARG = ','; public const char QUOTE = '"'; public const char START_GROUP = '{'; public const char END_GROUP = '}'; public const char END_STATEMENT = ';'; public const char VAR_PREFIX = '$'; public const string IF = "if"; public const string ELSE = "else"; public const string ELSE_IF = "elif"; public const string WHILE = "while"; public const string BREAK = "break"; public const string CONTINUE = "continue"; public const string COMMENT = "//"; public const string ABS = "abs"; public const string APPEND = "append"; public const string CD = "cd"; public const string CD__ = "cd.."; public const string DIR = "dir"; public const string ENV = "env"; public const string EXP = "exp"; public const string FINDFILES = "findfiles"; public const string FINDSTR = "findstr"; public const string INDEX_OF = "indexof"; public const string KILL = "kill"; public const string PI = "pi"; public const string POW = "pow"; public const string PRINT = "print"; public const string PSINFO = "psinfo"; public const string PSTIME = "pstime"; public const string PWD = "pwd"; public const string RUN = "run"; public const string SETENV = "setenv"; public const string SET = "set"; public const string SIN = "sin"; public const string SIZE = "size"; public const string SQRT = "sqrt"; public const string SUBSTR = "substr"; public const string TOLOWER = "tolower"; public const string TOUPPER = "toupper"; public static char[] NEXT_ARG_ARRAY = NEXT_ARG.ToString().ToCharArray(); public static char[] END_ARG_ARRAY = END_ARG.ToString().ToCharArray(); public static char[] END_LINE_ARRAY = END_LINE.ToString().ToCharArray(); public static char[] QUOTE_ARRAY = QUOTE.ToString().ToCharArray(); public static char[] COMPARE_ARRAY = "<>=)".ToCharArray(); public static char[] IF_ARG_ARRAY = "&|)".ToCharArray(); public static char[] END_PARSE_ARRAY = ";)}\n".ToCharArray(); public static char[] NEXT_OR_END_ARRAY = { NEXT_ARG, END_ARG, END_STATEMENT }; public static char[] TOKEN_SEPARATION = ("<>=+-*/&^|!\n\t " + START_ARG + END_ARG + START_GROUP + NEXT_ARG + END_STATEMENT).ToCharArray(); } }
namespace Sitecore.Feature.Accounts.Services { using System; using System.Web; using Sitecore.Foundation.DependencyInjection; using Sitecore.Foundation.SitecoreExtensions.Extensions; [Service(typeof(IGetRedirectUrlService))] public class GetRedirectUrlService : IGetRedirectUrlService { private readonly IAccountsSettingsService accountsSettingsService; private const string ReturnUrlQuerystring = "ReturnUrl"; public GetRedirectUrlService(IAccountsSettingsService accountsSettingsService) { this.accountsSettingsService = accountsSettingsService; } public string GetRedirectUrl(AuthenticationStatus status, string returnUrl = null) { var redirectUrl = this.GetDefaultRedirectUrl(status); if (!string.IsNullOrEmpty(returnUrl)) { redirectUrl = this.AddReturnUrl(redirectUrl, returnUrl); } return redirectUrl; } private string AddReturnUrl(string baseUrl, string returnUrl) { return baseUrl + "?" + ReturnUrlQuerystring + "=" + HttpUtility.UrlEncode(returnUrl); } public string GetDefaultRedirectUrl(AuthenticationStatus status) { switch (status) { case AuthenticationStatus.Unauthenticated: return this.accountsSettingsService.GetPageLinkOrDefault(Context.Item, Templates.AccountsSettings.Fields.LoginPage, Context.Site.GetStartItem()); case AuthenticationStatus.Authenticated: return this.accountsSettingsService.GetPageLinkOrDefault(Context.Item, Templates.AccountsSettings.Fields.AfterLoginPage, Context.Site.GetStartItem()); default: throw new ArgumentOutOfRangeException(nameof(status), status, null); } } } }
using System; using Xunit; using Xunit.Abstractions; namespace UnitTestCourse.Test { /* Output */ public class TransactionTestV7 { readonly ITestOutputHelper _output; public TransactionTestV7(ITestOutputHelper output) { _output = output; } [Fact] public void ShouldReturnAmount200() { // Arrange var transaction = new Transaction(Guid.NewGuid().ToString(), DateTime.Now, 100); // Act transaction.Sum(100); // Assert Assert.Equal(200, transaction.Amount); _output.WriteLine($"Final amount was {transaction.Amount}"); } } }
namespace RemoteService.Model { public class Config { public string Server { get; set; } public string Domain { get; set; } public string Username { get; set; } public string Password { get; set; } public string Query { get; set; } public string AutoStart { get; set; } public string Notification { get; set; } public string Minimized { get; set; } public int Duration { get; set; } } }
using System; using Bridge; namespace Bridge.Html5 { /// <summary> /// /// </summary> [Ignore] [Name("XMLHttpRequestUpload")] public class XMLHttpRequestUpload : XMLHttpRequestEventTarget { internal XMLHttpRequestUpload () { } } }
using System; using TrueCraft.API.Logic; using TrueCraft.API.Windows; using TrueCraft.API; using NUnit.Framework; using TrueCraft.Core.Windows; using Moq; namespace TrueCraft.Core.Test.Windows { [TestFixture] public class CraftingWindowAreaTest { [Test] public void TestCraftingWindowArea() { var recipe = new Mock<ICraftingRecipe>(); recipe.Setup(r => r.Output).Returns(new ItemStack(10)); var repository = new Mock<ICraftingRepository>(); repository.Setup(r => r.GetRecipe(It.IsAny<IWindowArea>())).Returns(recipe.Object); var area = new CraftingWindowArea(repository.Object, 0); area[0] = new ItemStack(11); Assert.AreEqual(new ItemStack(10), area[CraftingWindowArea.CraftingOutput]); } } }
using System; using Equinor.ProCoSys.IPO.Domain.AggregateModels.PersonAggregate; using Equinor.ProCoSys.IPO.Domain.Audit; using Equinor.ProCoSys.IPO.Domain.Time; namespace Equinor.ProCoSys.IPO.Domain.AggregateModels.InvitationAggregate { public class Participant : PlantEntityBase, ICreationAuditable, IModificationAuditable { public const int FunctionalRoleCodeMaxLength = 255; protected Participant() : base(null) { } public Participant( string plant, Organization organization, IpoParticipantType type, string functionalRoleCode, string firstName, string lastName, string userName, string email, Guid? azureOid, int sortKey) : base(plant) { Organization = organization; Type = type; FunctionalRoleCode = functionalRoleCode; FirstName = firstName; LastName = lastName; UserName = userName; Email = email; AzureOid = azureOid; SortKey = sortKey; } public Organization Organization { get; set; } public IpoParticipantType Type { get; set; } public string FunctionalRoleCode { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string UserName { get; set; } public string Email { get; set; } public Guid? AzureOid { get; set; } public int SortKey { get; set; } public bool Attended { get; set; } public string Note { get; set; } public DateTime? SignedAtUtc { get; set; } public int? SignedBy { get; set; } public DateTime? ModifiedAtUtc { get; private set; } public int? ModifiedById { get; private set; } public DateTime CreatedAtUtc { get; private set; } public int CreatedById { get; private set; } public void SetCreated(Person createdBy) { CreatedAtUtc = TimeService.UtcNow; if (createdBy == null) { throw new ArgumentNullException(nameof(createdBy)); } CreatedById = createdBy.Id; } public void SetModified(Person modifiedBy) { ModifiedAtUtc = TimeService.UtcNow; if (modifiedBy == null) { throw new ArgumentNullException(nameof(modifiedBy)); } ModifiedById = modifiedBy.Id; } } }
using System; using System.ServiceModel; namespace Sample.Services { [ServiceContract()] public interface IService91 { [OperationContract] [FaultContract(typeof(Byte[]))] int M001_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M002_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M003_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M004_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M005_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M006_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M007_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M008_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M009_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M010_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M011_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M012_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M013_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M014_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M015_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M016_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M017_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M018_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M019_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M020_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M021_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M022_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M023_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M024_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M025_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M026_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M027_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M028_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M029_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M030_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M031_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M032_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M033_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M034_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M035_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M036_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M037_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M038_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M039_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M040_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M041_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M042_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M043_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M044_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M045_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M046_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M047_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M048_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M049_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M050_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M051_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M052_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M053_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M054_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M055_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M056_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M057_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M058_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M059_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M060_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M061_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M062_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M063_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M064_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M065_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M066_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M067_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M068_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M069_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M070_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M071_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M072_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M073_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M074_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M075_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M076_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M077_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M078_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M079_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M080_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M081_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M082_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M083_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M084_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M085_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M086_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M087_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M088_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M089_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M090_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M091_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M092_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M093_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M094_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M095_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M096_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M097_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M098_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M099_91(int num); [OperationContract] [FaultContract(typeof(Byte[]))] int M100_91(int num); } }
using UnityEngine; namespace Inputs.TouchHandlers { public interface ITouchDragHandler { void OnStartDrag(Vector3 position); void OnDrag(Vector3 position); void OnEndDrag(); // For the end drag, use the ITouchUpHandler. } }
using UnityEngine; using System.Collections; #if (UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5) public class AnalogWrite : Uniduino.Examples.AnalogWrite { } // for unity 3.x #endif namespace Uniduino.Examples { public class AnalogWrite : MonoBehaviour { public Arduino arduino; public int pin = 9; public int brightness = 0; public int fadeAmount = 1; void Start () { arduino = Arduino.global; arduino.Log = (s) => Debug.Log("Arduino: " +s); arduino.Setup(ConfigurePins); } void ConfigurePins () { arduino.pinMode(pin, PinMode.PWM); } void Update () { if (brightness <= 0 || brightness >= 255) { fadeAmount = -fadeAmount; } brightness += fadeAmount; arduino.analogWrite(pin, brightness); } } }
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated> using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; #nullable disable namespace CSETWebCore.DataLayer.Model { /// <summary> /// A collection of FINANCIAL_DETAILS records /// </summary> public partial class FINANCIAL_DETAILS { public FINANCIAL_DETAILS() { FINANCIAL_FFIEC_MAPPINGS = new HashSet<FINANCIAL_FFIEC_MAPPINGS>(); FINANCIAL_QUESTIONS = new HashSet<FINANCIAL_QUESTIONS>(); FINANCIAL_REQUIREMENTS = new HashSet<FINANCIAL_REQUIREMENTS>(); FINANCIAL_TIERS = new HashSet<FINANCIAL_TIERS>(); } [StringLength(255)] public string Label { get; set; } [Key] public int StmtNumber { get; set; } public int FinancialGroupId { get; set; } [Column("Binary Criteria ID")] public double? Binary_Criteria_ID { get; set; } [Column("Maturity Target")] [StringLength(255)] public string Maturity_Target { get; set; } [Column("CSC Organizational (17-20)")] [StringLength(255)] public string CSC_Organizational__17_20_ { get; set; } [Column("CSC Foundational (7-16)")] [StringLength(255)] public string CSC_Foundational___7_16_ { get; set; } [Column("CSC Basic (1-6)")] [StringLength(255)] public string CSC_Basic__1_6_ { get; set; } [Column("CSC Mapping")] [StringLength(255)] public string CSC_Mapping { get; set; } [Column("NCUA R&R 748 Mapping")] [StringLength(255)] public string NCUA_R_R_748_Mapping { get; set; } [Column("NCUA R&R 749 Mapping")] [StringLength(255)] public string NCUA_R_R_749_Mapping { get; set; } [Column("FFIEC Booklets Mapping")] [StringLength(255)] public string FFIEC_Booklets_Mapping { get; set; } [ForeignKey(nameof(FinancialGroupId))] [InverseProperty(nameof(FINANCIAL_GROUPS.FINANCIAL_DETAILS))] public virtual FINANCIAL_GROUPS FinancialGroup { get; set; } [InverseProperty("StmtNumberNavigation")] public virtual ICollection<FINANCIAL_FFIEC_MAPPINGS> FINANCIAL_FFIEC_MAPPINGS { get; set; } [InverseProperty("StmtNumberNavigation")] public virtual ICollection<FINANCIAL_QUESTIONS> FINANCIAL_QUESTIONS { get; set; } [InverseProperty("StmtNumberNavigation")] public virtual ICollection<FINANCIAL_REQUIREMENTS> FINANCIAL_REQUIREMENTS { get; set; } [InverseProperty("StmtNumberNavigation")] public virtual ICollection<FINANCIAL_TIERS> FINANCIAL_TIERS { get; set; } } }
#region Header Block // About this Program // // Programmer: Jacob Brookhouse // Class: CITP 280 - 70591 // Application: KeyBit ID - Password Manager // Description: KeyBit ID is a password manager that allows a user to save sensitive // information, such as passwords and account information. // #endregion #region About this file // // This file is a basic struct that has a property and // a single method. The main purpose of this file is // to pass a string (URL) and open it via Process.Start() // #endregion namespace KeyBit_ID.Structs { struct OpenLink { // property that gets and sets the string of URI public string URI { get; set; } // Method that can be called public void OpenURL() { // decalare a string and make it equal to URI property string URL = URI; // execute the string, since it will be a URL // this should open in the users default browser System.Diagnostics.Process.Start(URL); } } }
using MasterDevs.ChromeDevTools; using Newtonsoft.Json; using System.Collections.Generic; namespace MasterDevs.ChromeDevTools.Protocol.Page { [CommandResponse(ProtocolName.Page.AddScriptToEvaluateOnLoad)] public class AddScriptToEvaluateOnLoadCommandResponse { /// <summary> /// Gets or sets Identifier of the added script. /// </summary> public string Identifier { get; set; } } }
using AutoMapper; using Microsoft.Extensions.DependencyInjection; using Moq; using Sample.Framework.Common.ServiceProvider; using Sample.ServiceBus.Contract; using Sample.UserManagement.Configuration; using Sample.UserManagement.Controllers; using Sample.UserManagement.Service.Repository; using Sample.UserManagement.Service.Service; using Sample.UserManagement.Service.Service.Contract; using System; using System.Collections.Generic; using System.Text; namespace Sample.UserManagement.Host.Test.Controllers { public class UserControllerFixture { public IServiceCollection Services { get; private set; } public IServicesProvider ServicesProvider { get; private set; } public UserController UserController { get; private set; } public UserController MockUserController { get; private set; } public IUserService UserService { get; private set; } public Mock<IUserService> MockUserService { get; private set; } public IMapper Mapper { get; private set; } public UserControllerFixture() { Initiate(); } private void Initiate() { Services = new Microsoft.Extensions.DependencyInjection.ServiceCollection(); Services.AddConfig(); ServicesProvider = new ServicesProvider(Services.BuildServiceProvider()); UserService = ServicesProvider.GetService<IUserService>(); Mapper = ServicesProvider.GetService<IMapper>(); UserController = new UserController(UserService, Mapper); MockUserService = new Mock<IUserService>(); var mockMapper = new Mock<IMapper>(); MockUserController = new Mock<UserController>(MockUserService.Object,mockMapper.Object).Object; } } }
using System.Collections.Generic; namespace CustomTypes.OnlineShop.Part3 { public interface IOnlineShop { bool Checkout(Dictionary<string, decimal> basket); } }
using System; namespace ddd.DomainService { class UserService { public UserService() { } public bool Exists(User user) { return true; } } }
namespace Ryujinx.Graphics.Shader.Decoders { enum ImageDimensions { Image1D, ImageBuffer, Image1DArray, Image2D, Image2DArray, Image3D } }
@{ ViewData["Title"] = "Images Page"; } @section Scripts{ <script src="/js/images.js"></script> } @section Styles { <style> /* body{margin: 10px;} */ .flow-default li{ width:16%; float:left; padding:2%; } .flow-default li img{ width:100%; } </style> } <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> <legend>信息流 - 滚动加载</legend> </fieldset> <ul class="flow-default" id="LAY_demo1"></ul>
// <snippet1> using System; using System.ServiceModel; [ServiceContract] public interface IHttpFetcher { [OperationContract] string GetWebPage(string address); } //<snippet6> // These classes have the invariant that: // this.slow.GetWebPage(this.cachedAddress) == this.cachedWebPage. // When you read cached values you can assume they are valid. When // you write the cached values, you must guarantee that they are valid. //</snippet6> // <snippet2> // With ConcurrencyMode.Single, WCF does not call again into the object // so long as the method is running. After the operation returns the object // can be called again, so you must make sure state is consistent before // returning. [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)] class SingleCachingHttpFetcher : IHttpFetcher { string cachedWebPage; string cachedAddress; readonly IHttpFetcher slow; public string GetWebPage(string address) { // <-- Can assume cache is valid. if (this.cachedAddress == address) { return this.cachedWebPage; } // <-- Cache is no longer valid because we are changing // one of the values. this.cachedAddress = address; string webPage = slow.GetWebPage(address); this.cachedWebPage = webPage; // <-- Cache is valid again here. return this.cachedWebPage; // <-- Must guarantee that the cache is valid because we are returning. } } // </snippet2> // <snippet3> // With ConcurrencyMode.Reentrant, WCF makes sure that only one // thread runs in your code at a time. However, when you call out on a // channel, the operation can get called again on another thread. Therefore // you must confirm that state is consistent both before channel calls and // before you return. [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)] class ReentrantCachingHttpFetcher : IHttpFetcher { string cachedWebPage; string cachedAddress; readonly SlowHttpFetcher slow; public ReentrantCachingHttpFetcher() { this.slow = new SlowHttpFetcher(); } public string GetWebPage(string address) { // <-- Can assume that cache is valid. if (this.cachedAddress == address) { return this.cachedWebPage; } // <-- Must guarantee that the cache is valid, because // the operation can be called again before we return. string webPage = slow.GetWebPage(address); // <-- Can assume cache is valid. // <-- Cache is no longer valid because we are changing // one of the values. this.cachedAddress = address; this.cachedWebPage = webPage; // <-- Cache is valid again here. return this.cachedWebPage; // <-- Must guarantee that cache is valid because we are returning. } } // </snippet3> // <snippet4> // With ConcurrencyMode.Multiple, threads can call an operation at any time. // It is your responsibility to guard your state with locks. If // you always guarantee you leave state consistent when you leave // the lock, you can assume it is valid when you enter the lock. [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] class MultipleCachingHttpFetcher : IHttpFetcher { string cachedWebPage; string cachedAddress; readonly SlowHttpFetcher slow; readonly object ThisLock = new object(); public MultipleCachingHttpFetcher() { this.slow = new SlowHttpFetcher(); } public string GetWebPage(string address) { lock (this.ThisLock) { // <-- Can assume cache is valid. if (this.cachedAddress == address) { return this.cachedWebPage; // <-- Must guarantee that cache is valid because // the operation returns and releases the lock. } // <-- Must guarantee that cache is valid here because // the operation releases the lock. } string webPage = slow.GetWebPage(address); lock (this.ThisLock) { // <-- Can assume cache is valid. // <-- Cache is no longer valid because the operation // changes one of the values. this.cachedAddress = address; this.cachedWebPage = webPage; // <-- Cache is valid again here. // <-- Must guarantee that cache is valid because // the operation releases the lock. } return webPage; } } // </snippet4> // </snippet1> //<snippet5> // This class has the invariant that: // this.slow.GetWebPage(this.cachedAddress) == this.cachedWebPage. // When you read cached values you can assume they are valid. When // you write the cached values, you must guarantee that they are valid. //</snippet5> public class SlowHttpFetcher { public string GetWebPage(string address) { return "The return value."; } }
/* * @(#)Unit.cs 4.1.0 2017-05-14 * * You may use this software under the condition of "Simplified BSD License" * * Copyright 2010-2019 MARIUSZ GROMADA. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY <MARIUSZ GROMADA> ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of MARIUSZ GROMADA. * * If you have any questions/bugs feel free to contact: * * Mariusz Gromada * mariuszgromada.org@gmail.com * http://mathparser.org * http://mathspace.pl * http://janetsudoku.mariuszgromada.org * http://github.com/mariuszgromada/MathParser.org-mXparser * http://mariuszgromada.github.io/MathParser.org-mXparser * http://mxparser.sourceforge.net * http://bitbucket.org/mariuszgromada/mxparser * http://mxparser.codeplex.com * http://github.com/mariuszgromada/Janet-Sudoku * http://janetsudoku.codeplex.com * http://sourceforge.net/projects/janetsudoku * http://bitbucket.org/mariuszgromada/janet-sudoku * http://github.com/mariuszgromada/MathParser.org-mXparser * http://scalarmath.org/ * https://play.google.com/store/apps/details?id=org.mathparser.scalar.lite * https://play.google.com/store/apps/details?id=org.mathparser.scalar.pro * * Asked if he believes in one God, a mathematician answered: * "Yes, up to isomorphism." */ using System; namespace org.mariuszgromada.math.mxparser.parsertokens { /** * Units - mXparser tokens definition. * * @author <b>Mariusz Gromada</b><br> * <a href="mailto:mariuszgromada.org@gmail.com">mariuszgromada.org@gmail.com</a><br> * <a href="http://mathspace.pl" target="_blank">MathSpace.pl</a><br> * <a href="http://mathparser.org" target="_blank">MathParser.org - mXparser project page</a><br> * <a href="http://github.com/mariuszgromada/MathParser.org-mXparser" target="_blank">mXparser on GitHub</a><br> * <a href="http://mxparser.sourceforge.net" target="_blank">mXparser on SourceForge</a><br> * <a href="http://bitbucket.org/mariuszgromada/mxparser" target="_blank">mXparser on Bitbucket</a><br> * <a href="http://mxparser.codeplex.com" target="_blank">mXparser on CodePlex</a><br> * <a href="http://janetsudoku.mariuszgromada.org" target="_blank">Janet Sudoku - project web page</a><br> * <a href="http://github.com/mariuszgromada/Janet-Sudoku" target="_blank">Janet Sudoku on GitHub</a><br> * <a href="http://janetsudoku.codeplex.com" target="_blank">Janet Sudoku on CodePlex</a><br> * <a href="http://sourceforge.net/projects/janetsudoku" target="_blank">Janet Sudoku on SourceForge</a><br> * <a href="http://bitbucket.org/mariuszgromada/janet-sudoku" target="_blank">Janet Sudoku on BitBucket</a><br> * <a href="https://play.google.com/store/apps/details?id=org.mathparser.scalar.lite" target="_blank">Scalar Free</a><br> * <a href="https://play.google.com/store/apps/details?id=org.mathparser.scalar.pro" target="_blank">Scalar Pro</a><br> * <a href="http://scalarmath.org/" target="_blank">ScalarMath.org</a><br> * * @version 4.1.0 */ public sealed class Unit { /* * Unit - token type id. */ public const int TYPE_ID = 12; public const String TYPE_DESC = "Unit"; /* * Unit - tokens id. */ /* Ratio, Fraction */ public const int PERC_ID = 1; public const int PROMIL_ID = 2; /* Metric prefixes */ public const int YOTTA_ID = 101; public const int ZETTA_ID = 102; public const int EXA_ID = 103; public const int PETA_ID = 104; public const int TERA_ID = 105; public const int GIGA_ID = 106; public const int MEGA_ID = 107; public const int KILO_ID = 108; public const int HECTO_ID = 109; public const int DECA_ID = 110; public const int DECI_ID = 111; public const int CENTI_ID = 112; public const int MILLI_ID = 113; public const int MICRO_ID = 114; public const int NANO_ID = 115; public const int PICO_ID = 116; public const int FEMTO_ID = 117; public const int ATTO_ID = 118; public const int ZEPTO_ID = 119; public const int YOCTO_ID = 120; /* Units of length / distance */ public const int METRE_ID = 201; public const int KILOMETRE_ID = 202; public const int CENTIMETRE_ID = 203; public const int MILLIMETRE_ID = 204; public const int INCH_ID = 205; public const int YARD_ID = 206; public const int FEET_ID = 207; public const int MILE_ID = 208; public const int NAUTICAL_MILE_ID = 209; /* Units of area */ public const int METRE2_ID = 301; public const int CENTIMETRE2_ID = 302; public const int MILLIMETRE2_ID = 303; public const int ARE_ID = 304; public const int HECTARE_ID = 305; public const int ACRE_ID = 306; public const int KILOMETRE2_ID = 307; /* Units of volume */ public const int MILLIMETRE3_ID = 401; public const int CENTIMETRE3_ID = 402; public const int METRE3_ID = 403; public const int KILOMETRE3_ID = 404; public const int MILLILITRE_ID = 405; public const int LITRE_ID = 406; public const int GALLON_ID = 407; public const int PINT_ID = 408; /* Units of time */ public const int SECOND_ID = 501; public const int MILLISECOND_ID = 502; public const int MINUTE_ID = 503; public const int HOUR_ID = 504; public const int DAY_ID = 505; public const int WEEK_ID = 506; public const int JULIAN_YEAR_ID = 507; /* Units of mass */ public const int KILOGRAM_ID = 508; public const int GRAM_ID = 509; public const int MILLIGRAM_ID = 510; public const int DECAGRAM_ID = 511; public const int TONNE_ID = 512; public const int OUNCE_ID = 513; public const int POUND_ID = 514; /* Units of information */ public const int BIT_ID = 601; public const int KILOBIT_ID = 602; public const int MEGABIT_ID = 603; public const int GIGABIT_ID = 604; public const int TERABIT_ID = 605; public const int PETABIT_ID = 606; public const int EXABIT_ID = 607; public const int ZETTABIT_ID = 608; public const int YOTTABIT_ID = 609; public const int BYTE_ID = 610; public const int KILOBYTE_ID = 611; public const int MEGABYTE_ID = 612; public const int GIGABYTE_ID = 613; public const int TERABYTE_ID = 614; public const int PETABYTE_ID = 615; public const int EXABYTE_ID = 616; public const int ZETTABYTE_ID = 617; public const int YOTTABYTE_ID = 618; /* Units of energy */ public const int JOULE_ID = 701; public const int ELECTRONO_VOLT_ID = 702; public const int KILO_ELECTRONO_VOLT_ID = 703; public const int MEGA_ELECTRONO_VOLT_ID = 704; public const int GIGA_ELECTRONO_VOLT_ID = 705; public const int TERA_ELECTRONO_VOLT_ID = 706; /* Units of speed */ public const int METRE_PER_SECOND_ID = 801; public const int KILOMETRE_PER_HOUR_ID = 802; public const int MILE_PER_HOUR_ID = 803; public const int KNOT_ID = 804; /* Units of acceleration */ public const int METRE_PER_SECOND2_ID = 901; public const int KILOMETRE_PER_HOUR2_ID = 902; public const int MILE_PER_HOUR2_ID = 903; /* Units of angle */ public const int RADIAN_ARC_ID = 1001; public const int DEGREE_ARC_ID = 1002; public const int MINUTE_ARC_ID = 1003; public const int SECOND_ARC_ID = 1004; /* * Unit - tokens key words. */ /* Ratio, Fraction */ public const String PERC_STR = "[%]"; public const String PROMIL_STR = "[%%]"; /* Metric prefixes */ public const String YOTTA_STR = "[Y]"; public const String YOTTA_SEPT_STR = "[sept]"; public const String ZETTA_STR = "[Z]"; public const String ZETTA_SEXT_STR = "[sext]"; public const String EXA_STR = "[E]"; public const String EXA_QUINT_STR = "[quint]"; public const String PETA_STR = "[P]"; public const String PETA_QUAD_STR = "[quad]"; public const String TERA_STR = "[T]"; public const String TERA_TRIL_STR = "[tril]"; public const String GIGA_STR = "[G]"; public const String GIGA_BIL_STR = "[bil]"; public const String MEGA_STR = "[M]"; public const String MEGA_MIL_STR = "[mil]"; public const String KILO_STR = "[k]"; public const String KILO_TH_STR = "[th]"; public const String HECTO_STR = "[hecto]"; public const String HECTO_HUND_STR = "[hund]"; public const String DECA_STR = "[deca]"; public const String DECA_TEN_STR = "[ten]"; public const String DECI_STR = "[deci]"; public const String CENTI_STR = "[centi]"; public const String MILLI_STR = "[milli]"; public const String MICRO_STR = "[mic]"; public const String NANO_STR = "[n]"; public const String PICO_STR = "[p]"; public const String FEMTO_STR = "[f]"; public const String ATTO_STR = "[a]"; public const String ZEPTO_STR = "[z]"; public const String YOCTO_STR = "[y]"; /* Units of length / distance */ public const String METRE_STR = "[m]"; public const String KILOMETRE_STR = "[km]"; public const String CENTIMETRE_STR = "[cm]"; public const String MILLIMETRE_STR = "[mm]"; public const String INCH_STR = "[inch]"; public const String YARD_STR = "[yd]"; public const String FEET_STR = "[ft]"; public const String MILE_STR = "[mile]"; public const String NAUTICAL_MILE_STR = "[nmi]"; /* Units of area */ public const String METRE2_STR = "[m2]"; public const String CENTIMETRE2_STR = "[cm2]"; public const String MILLIMETRE2_STR = "[mm2]"; public const String ARE_STR = "[are]"; public const String HECTARE_STR = "[ha]"; public const String ACRE_STR = "[acre]"; public const String KILOMETRE2_STR = "[km2]"; /* Units of volume */ public const String MILLIMETRE3_STR = "[mm3]"; public const String CENTIMETRE3_STR = "[cm3]"; public const String METRE3_STR = "[m3]"; public const String KILOMETRE3_STR = "[km3]"; public const String MILLILITRE_STR = "[ml]"; public const String LITRE_STR = "[l]"; public const String GALLON_STR = "[gall]"; public const String PINT_STR = "[pint]"; /* Units of time */ public const String SECOND_STR = "[s]"; public const String MILLISECOND_STR = "[ms]"; public const String MINUTE_STR = "[min]"; public const String HOUR_STR = "[h]"; public const String DAY_STR = "[day]"; public const String WEEK_STR = "[week]"; public const String JULIAN_YEAR_STR = "[yearj]"; /* Units of mass */ public const String KILOGRAM_STR = "[kg]"; public const String GRAM_STR = "[gr]"; public const String MILLIGRAM_STR = "[mg]"; public const String DECAGRAM_STR = "[dag]"; public const String TONNE_STR = "[t]"; public const String OUNCE_STR = "[oz]"; public const String POUND_STR = "[lb]"; /* Units of information */ public const String BIT_STR = "[b]"; public const String KILOBIT_STR = "[kb]"; public const String MEGABIT_STR = "[Mb]"; public const String GIGABIT_STR = "[Gb]"; public const String TERABIT_STR = "[Tb]"; public const String PETABIT_STR = "[Pb]"; public const String EXABIT_STR = "[Eb]"; public const String ZETTABIT_STR = "[Zb]"; public const String YOTTABIT_STR = "[Yb]"; public const String BYTE_STR = "[B]"; public const String KILOBYTE_STR = "[kB]"; public const String MEGABYTE_STR = "[MB]"; public const String GIGABYTE_STR = "[GB]"; public const String TERABYTE_STR = "[TB]"; public const String PETABYTE_STR = "[PB]"; public const String EXABYTE_STR = "[EB]"; public const String ZETTABYTE_STR = "[ZB]"; public const String YOTTABYTE_STR = "[YB]"; /* Units of energy */ public const String JOULE_STR = "[J]"; public const String ELECTRONO_VOLT_STR = "[eV]"; public const String KILO_ELECTRONO_VOLT_STR = "[keV]"; public const String MEGA_ELECTRONO_VOLT_STR = "[MeV]"; public const String GIGA_ELECTRONO_VOLT_STR = "[GeV]"; public const String TERA_ELECTRONO_VOLT_STR = "[TeV]"; /* Units of speed */ public const String METRE_PER_SECOND_STR = "[m/s]"; public const String KILOMETRE_PER_HOUR_STR = "[km/h]"; public const String MILE_PER_HOUR_STR = "[mi/h]"; public const String KNOT_STR = "[knot]"; /* Units of acceleration */ public const String METRE_PER_SECOND2_STR = "[m/s2]"; public const String KILOMETRE_PER_HOUR2_STR = "[km/h2]"; public const String MILE_PER_HOUR2_STR = "[mi/h2]"; /* Units of angle */ public const String RADIAN_ARC_STR = "[rad]"; public const String DEGREE_ARC_STR = "[deg]"; public const String MINUTE_ARC_STR = "[']"; public const String SECOND_ARC_STR = "['']"; /* * Unit - syntax. */ /* Ratio, Fraction */ public const String PERC_SYN = PERC_STR; public const String PROMIL_SYN = PROMIL_STR; /* Metric prefixes */ public const String YOTTA_SYN = YOTTA_STR; public const String YOTTA_SEPT_SYN = YOTTA_SEPT_STR; public const String ZETTA_SYN = ZETTA_STR; public const String ZETTA_SEXT_SYN = ZETTA_SEXT_STR; public const String EXA_SYN = EXA_STR; public const String EXA_QUINT_SYN = EXA_QUINT_STR; public const String PETA_SYN = PETA_STR; public const String PETA_QUAD_SYN = PETA_QUAD_STR; public const String TERA_SYN = TERA_STR; public const String TERA_TRIL_SYN = TERA_TRIL_STR; public const String GIGA_SYN = GIGA_STR; public const String GIGA_BIL_SYN = GIGA_BIL_STR; public const String MEGA_SYN = MEGA_STR; public const String MEGA_MIL_SYN = MEGA_MIL_STR; public const String KILO_SYN = KILO_STR; public const String KILO_TH_SYN = KILO_TH_STR; public const String HECTO_SYN = HECTO_STR; public const String HECTO_HUND_SYN = HECTO_HUND_STR; public const String DECA_SYN = DECA_STR; public const String DECA_TEN_SYN = DECA_TEN_STR; public const String DECI_SYN = DECI_STR; public const String CENTI_SYN = CENTI_STR; public const String MILLI_SYN = MILLI_STR; public const String MICRO_SYN = MICRO_STR; public const String NANO_SYN = NANO_STR; public const String PICO_SYN = PICO_STR; public const String FEMTO_SYN = FEMTO_STR; public const String ATTO_SYN = ATTO_STR; public const String ZEPTO_SYN = ZEPTO_STR; public const String YOCTO_SYN = YOCTO_STR; /* Units of length / distance */ public const String METRE_SYN = METRE_STR; public const String KILOMETRE_SYN = KILOMETRE_STR; public const String CENTIMETRE_SYN = CENTIMETRE_STR; public const String MILLIMETRE_SYN = MILLIMETRE_STR; public const String INCH_SYN = INCH_STR; public const String YARD_SYN = YARD_STR; public const String FEET_SYN = FEET_STR; public const String MILE_SYN = MILE_STR; public const String NAUTICAL_MILE_SYN = NAUTICAL_MILE_STR; /* Units of area */ public const String METRE2_SYN = METRE2_STR; public const String CENTIMETRE2_SYN = CENTIMETRE2_STR; public const String MILLIMETRE2_SYN = MILLIMETRE2_STR; public const String ARE_SYN = ARE_STR; public const String HECTARE_SYN = HECTARE_STR; public const String ACRE_SYN = ACRE_STR; public const String KILOMETRE2_SYN = KILOMETRE2_STR; /* Units of volume */ public const String MILLIMETRE3_SYN = MILLIMETRE3_STR; public const String CENTIMETRE3_SYN = CENTIMETRE3_STR; public const String METRE3_SYN = METRE3_STR; public const String KILOMETRE3_SYN = KILOMETRE3_STR; public const String MILLILITRE_SYN = MILLILITRE_STR; public const String LITRE_SYN = LITRE_STR; public const String GALLON_SYN = GALLON_STR; public const String PINT_SYN = PINT_STR; /* Units of time */ public const String SECOND_SYN = SECOND_STR; public const String MILLISECOND_SYN = MILLISECOND_STR; public const String MINUTE_SYN = MINUTE_STR; public const String HOUR_SYN = HOUR_STR; public const String DAY_SYN = DAY_STR; public const String WEEK_SYN = WEEK_STR; public const String JULIAN_YEAR_SYN = JULIAN_YEAR_STR; /* Units of mass */ public const String KILOGRAM_SYN = KILOGRAM_STR; public const String GRAM_SYN = GRAM_STR; public const String MILLIGRAM_SYN = MILLIGRAM_STR; public const String DECAGRAM_SYN = DECAGRAM_STR; public const String TONNE_SYN = TONNE_STR; public const String OUNCE_SYN = OUNCE_STR; public const String POUND_SYN = POUND_STR; /* Units of information */ public const String BIT_SYN = BIT_STR; public const String KILOBIT_SYN = KILOBIT_STR; public const String MEGABIT_SYN = MEGABIT_STR; public const String GIGABIT_SYN = GIGABIT_STR; public const String TERABIT_SYN = TERABIT_STR; public const String PETABIT_SYN = PETABIT_STR; public const String EXABIT_SYN = EXABIT_STR; public const String ZETTABIT_SYN = ZETTABIT_STR; public const String YOTTABIT_SYN = YOTTABIT_STR; public const String BYTE_SYN = BYTE_STR; public const String KILOBYTE_SYN = KILOBYTE_STR; public const String MEGABYTE_SYN = MEGABYTE_STR; public const String GIGABYTE_SYN = GIGABYTE_STR; public const String TERABYTE_SYN = TERABYTE_STR; public const String PETABYTE_SYN = PETABYTE_STR; public const String EXABYTE_SYN = EXABYTE_STR; public const String ZETTABYTE_SYN = ZETTABYTE_STR; public const String YOTTABYTE_SYN = YOTTABYTE_STR; /* Units of energy */ public const String JOULE_SYN = JOULE_STR; public const String ELECTRONO_VOLT_SYN = ELECTRONO_VOLT_STR; public const String KILO_ELECTRONO_VOLT_SYN = KILO_ELECTRONO_VOLT_STR; public const String MEGA_ELECTRONO_VOLT_SYN = MEGA_ELECTRONO_VOLT_STR; public const String GIGA_ELECTRONO_VOLT_SYN = GIGA_ELECTRONO_VOLT_STR; public const String TERA_ELECTRONO_VOLT_SYN = TERA_ELECTRONO_VOLT_STR; /* Units of speed */ public const String METRE_PER_SECOND_SYN = METRE_PER_SECOND_STR; public const String KILOMETRE_PER_HOUR_SYN = KILOMETRE_PER_HOUR_STR; public const String MILE_PER_HOUR_SYN = MILE_PER_HOUR_STR; public const String KNOT_SYN = KNOT_STR; /* Units of acceleration */ public const String METRE_PER_SECOND2_SYN = METRE_PER_SECOND2_STR; public const String KILOMETRE_PER_HOUR2_SYN = KILOMETRE_PER_HOUR2_STR; public const String MILE_PER_HOUR2_SYN = MILE_PER_HOUR2_STR; /* Units of angle */ public const String RADIAN_ARC_SYN = RADIAN_ARC_STR; public const String DEGREE_ARC_SYN = DEGREE_ARC_STR; public const String MINUTE_ARC_SYN = MINUTE_ARC_STR; public const String SECOND_ARC_SYN = SECOND_ARC_STR; /* * Unit - tokens description. */ /* Ratio, Fraction */ public const String PERC_DESC = "<Ratio, Fraction> Percentage = 0.01"; public const String PROMIL_DESC = "<Ratio, Fraction> Promil, Per mille = 0.001"; /* Metric prefixes */ public const String YOTTA_DESC = "<Metric prefix> Septillion / Yotta = 10^24"; public const String ZETTA_DESC = "<Metric prefix> Sextillion / Zetta = 10^21"; public const String EXA_DESC = "<Metric prefix> Quintillion / Exa = 10^18"; public const String PETA_DESC = "<Metric prefix> Quadrillion / Peta = 10^15"; public const String TERA_DESC = "<Metric prefix> Trillion / Tera = 10^12"; public const String GIGA_DESC = "<Metric prefix> Billion / Giga = 10^9"; public const String MEGA_DESC = "<Metric prefix> Million / Mega = 10^6"; public const String KILO_DESC = "<Metric prefix> Thousand / Kilo = 10^3"; public const String HECTO_DESC = "<Metric prefix> Hundred / Hecto = 10^2"; public const String DECA_DESC = "<Metric prefix> Ten / Deca = 10"; public const String DECI_DESC = "<Metric prefix> Tenth / Deci = 0.1"; public const String CENTI_DESC = "<Metric prefix> Hundredth / Centi = 0.01"; public const String MILLI_DESC = "<Metric prefix> Thousandth / Milli = 0.001"; public const String MICRO_DESC = "<Metric prefix> Millionth / Micro = 10^-6"; public const String NANO_DESC = "<Metric prefix> Billionth / Nano = 10^-9"; public const String PICO_DESC = "<Metric prefix> Trillionth / Pico = 10^-12"; public const String FEMTO_DESC = "<Metric prefix> Quadrillionth / Femto = 10^-15"; public const String ATTO_DESC = "<Metric prefix> Quintillionth / Atoo = 10^-18"; public const String ZEPTO_DESC = "<Metric prefix> Sextillionth / Zepto = 10^-21"; public const String YOCTO_DESC = "<Metric prefix> Septillionth / Yocto = 10^-24"; /* Units of length / distance */ public const String METRE_DESC = "<Unit of length> Metre / Meter (m=1)"; public const String KILOMETRE_DESC = "<Unit of length> Kilometre / Kilometer (m=1)"; public const String CENTIMETRE_DESC = "<Unit of length> Centimetre / Centimeter (m=1)"; public const String MILLIMETRE_DESC = "<Unit of length> Millimetre / Millimeter (m=1)"; public const String INCH_DESC = "<Unit of length> Inch (m=1)"; public const String YARD_DESC = "<Unit of length> Yard (m=1)"; public const String FEET_DESC = "<Unit of length> Feet (m=1)"; public const String MILE_DESC = "<Unit of length> Mile (m=1)"; public const String NAUTICAL_MILE_DESC = "<Unit of length> Nautical mile (m=1)"; /* Units of area */ public const String METRE2_DESC = "<Unit of area> Square metre / Square meter (m=1)"; public const String CENTIMETRE2_DESC = "<Unit of area> Square centimetre / Square centimeter (m=1)"; public const String MILLIMETRE2_DESC = "<Unit of area> Square millimetre / Square millimeter (m=1)"; public const String ARE_DESC = "<Unit of area> Are (m=1)"; public const String HECTARE_DESC = "<Unit of area> Hectare (m=1)"; public const String ACRE_DESC = "<Unit of area> Acre (m=1)"; public const String KILOMETRE2_DESC = "<Unit of area> Square kilometre / Square kilometer (m=1)"; /* Units of volume */ public const String MILLIMETRE3_DESC = "<Unit of volume> Cubic millimetre / Cubic millimeter (m=1)"; public const String CENTIMETRE3_DESC = "<Unit of volume> Cubic centimetre / Cubic centimeter (m=1)"; public const String METRE3_DESC = "<Unit of volume> Cubic metre / Cubic meter (m=1)"; public const String KILOMETRE3_DESC = "<Unit of volume> Cubic kilometre / Cubic kilometer (m=1)"; public const String MILLILITRE_DESC = "<Unit of volume> Millilitre / Milliliter (m=1)"; public const String LITRE_DESC = "<Unit of volume> Litre / Liter (m=1)"; public const String GALLON_DESC = "<Unit of volume> Gallon (m=1)"; public const String PINT_DESC = "<Unit of volume> Pint (m=1)"; /* Units of time */ public const String SECOND_DESC = "<Unit of time> Second (s=1)"; public const String MILLISECOND_DESC = "<Unit of time> Millisecond (s=1)"; public const String MINUTE_DESC = "<Unit of time> Minute (s=1)"; public const String HOUR_DESC = "<Unit of time> Hour (s=1)"; public const String DAY_DESC = "<Unit of time> Day (s=1)"; public const String WEEK_DESC = "<Unit of time> Week (s=1)"; public const String JULIAN_YEAR_DESC = "<Unit of time> Julian year = 365.25 days (s=1)"; /* Units of mass */ public const String KILOGRAM_DESC = "<Unit of mass> Kilogram (kg=1)"; public const String GRAM_DESC = "<Unit of mass> Gram (kg=1)"; public const String MILLIGRAM_DESC = "<Unit of mass> Milligram (kg=1)"; public const String DECAGRAM_DESC = "<Unit of mass> Decagram (kg=1)"; public const String TONNE_DESC = "<Unit of mass> Tonne (kg=1)"; public const String OUNCE_DESC = "<Unit of mass> Ounce (kg=1)"; public const String POUND_DESC = "<Unit of mass> Pound (kg=1)"; /* Units of information */ public const String BIT_DESC = "<Unit of information> Bit (bit=1)"; public const String KILOBIT_DESC = "<Unit of information> Kilobit (bit=1)"; public const String MEGABIT_DESC = "<Unit of information> Megabit (bit=1)"; public const String GIGABIT_DESC = "<Unit of information> Gigabit (bit=1)"; public const String TERABIT_DESC = "<Unit of information> Terabit (bit=1)"; public const String PETABIT_DESC = "<Unit of information> Petabit (bit=1)"; public const String EXABIT_DESC = "<Unit of information> Exabit (bit=1)"; public const String ZETTABIT_DESC = "<Unit of information> Zettabit (bit=1)"; public const String YOTTABIT_DESC = "<Unit of information> Yottabit (bit=1)"; public const String BYTE_DESC = "<Unit of information> Byte (bit=1)"; public const String KILOBYTE_DESC = "<Unit of information> Kilobyte (bit=1)"; public const String MEGABYTE_DESC = "<Unit of information> Megabyte (bit=1)"; public const String GIGABYTE_DESC = "<Unit of information> Gigabyte (bit=1)"; public const String TERABYTE_DESC = "<Unit of information> Terabyte (bit=1)"; public const String PETABYTE_DESC = "<Unit of information> Petabyte (bit=1)"; public const String EXABYTE_DESC = "<Unit of information> Exabyte (bit=1)"; public const String ZETTABYTE_DESC = "<Unit of information> Zettabyte (bit=1)"; public const String YOTTABYTE_DESC = "<Unit of information> Yottabyte (bit=1)"; /* Units of energy */ public const String JOULE_DESC = "<Unit of energy> Joule (m=1, kg=1, s=1)"; public const String ELECTRONO_VOLT_DESC = "<Unit of energy> Electronovolt (m=1, kg=1, s=1)"; public const String KILO_ELECTRONO_VOLT_DESC= "<Unit of energy> Kiloelectronovolt (m=1, kg=1, s=1)"; public const String MEGA_ELECTRONO_VOLT_DESC= "<Unit of energy> Megaelectronovolt (m=1, kg=1, s=1)"; public const String GIGA_ELECTRONO_VOLT_DESC= "<Unit of energy> Gigaelectronovolt (m=1, kg=1, s=1)"; public const String TERA_ELECTRONO_VOLT_DESC= "<Unit of energy> Teraelectronovolt (m=1, kg=1, s=1)"; /* Units of speed */ public const String METRE_PER_SECOND_DESC = "<Unit of speed> Metre / Meter per second (m=1, s=1)"; public const String KILOMETRE_PER_HOUR_DESC = "<Unit of speed> Kilometre / Kilometer per hour (m=1, s=1)"; public const String MILE_PER_HOUR_DESC = "<Unit of speed> Mile per hour (m=1, s=1)"; public const String KNOT_DESC = "<Unit of speed> Knot (m=1, s=1)"; /* Units of acceleration */ public const String METRE_PER_SECOND2_DESC = "<Unit of acceleration> Metre / Meter per square second (m=1, s=1)"; public const String KILOMETRE_PER_HOUR2_DESC= "<Unit of acceleration> Kilometre / Kilometer per square hour (m=1, s=1)"; public const String MILE_PER_HOUR2_DESC = "<Unit of acceleration> Mile per square hour (m=1, s=1)"; /* Units of angle */ public const String RADIAN_ARC_DESC = "<Unit of angle> Radian (rad=1)"; public const String DEGREE_ARC_DESC = "<Unit of angle> Degree of arc (rad=1)"; public const String MINUTE_ARC_DESC = "<Unit of angle> Minute of arc (rad=1)"; public const String SECOND_ARC_DESC = "<Unit of angle> Second of arc (rad=1)"; /* * Unit - since. */ /* Ratio, Fraction */ public const String PERC_SINCE = mXparser.NAMEv40; public const String PROMIL_SINCE = mXparser.NAMEv40; /* Metric prefixes */ public const String YOTTA_SINCE = mXparser.NAMEv40; public const String YOTTA_SEPT_SINCE = mXparser.NAMEv40; public const String ZETTA_SINCE = mXparser.NAMEv40; public const String ZETTA_SEXT_SINCE = mXparser.NAMEv40; public const String EXA_SINCE = mXparser.NAMEv40; public const String EXA_QUINT_SINCE = mXparser.NAMEv40; public const String PETA_SINCE = mXparser.NAMEv40; public const String PETA_QUAD_SINCE = mXparser.NAMEv40; public const String TERA_SINCE = mXparser.NAMEv40; public const String TERA_TRIL_SINCE = mXparser.NAMEv40; public const String GIGA_SINCE = mXparser.NAMEv40; public const String GIGA_BIL_SINCE = mXparser.NAMEv40; public const String MEGA_SINCE = mXparser.NAMEv40; public const String MEGA_MIL_SINCE = mXparser.NAMEv40; public const String KILO_SINCE = mXparser.NAMEv40; public const String KILO_TH_SINCE = mXparser.NAMEv40; public const String HECTO_SINCE = mXparser.NAMEv40; public const String HECTO_HUND_SINCE = mXparser.NAMEv40; public const String DECA_SINCE = mXparser.NAMEv40; public const String DECA_TEN_SINCE = mXparser.NAMEv40; public const String DECI_SINCE = mXparser.NAMEv40; public const String CENTI_SINCE = mXparser.NAMEv40; public const String MILLI_SINCE = mXparser.NAMEv40; public const String MICRO_SINCE = mXparser.NAMEv40; public const String NANO_SINCE = mXparser.NAMEv40; public const String PICO_SINCE = mXparser.NAMEv40; public const String FEMTO_SINCE = mXparser.NAMEv40; public const String ATTO_SINCE = mXparser.NAMEv40; public const String ZEPTO_SINCE = mXparser.NAMEv40; public const String YOCTO_SINCE = mXparser.NAMEv40; /* Units of length / distance */ public const String METRE_SINCE = mXparser.NAMEv40; public const String KILOMETRE_SINCE = mXparser.NAMEv40; public const String CENTIMETRE_SINCE = mXparser.NAMEv40; public const String MILLIMETRE_SINCE = mXparser.NAMEv40; public const String INCH_SINCE = mXparser.NAMEv40; public const String YARD_SINCE = mXparser.NAMEv40; public const String FEET_SINCE = mXparser.NAMEv40; public const String MILE_SINCE = mXparser.NAMEv40; public const String NAUTICAL_MILE_SINCE = mXparser.NAMEv40; /* Units of area */ public const String METRE2_SINCE = mXparser.NAMEv40; public const String CENTIMETRE2_SINCE = mXparser.NAMEv40; public const String MILLIMETRE2_SINCE = mXparser.NAMEv40; public const String ARE_SINCE = mXparser.NAMEv40; public const String HECTARE_SINCE = mXparser.NAMEv40; public const String ACRE_SINCE = mXparser.NAMEv40; public const String KILOMETRE2_SINCE = mXparser.NAMEv40; /* Units of volume */ public const String MILLIMETRE3_SINCE = mXparser.NAMEv40; public const String CENTIMETRE3_SINCE = mXparser.NAMEv40; public const String METRE3_SINCE = mXparser.NAMEv40; public const String KILOMETRE3_SINCE = mXparser.NAMEv40; public const String MILLILITRE_SINCE = mXparser.NAMEv40; public const String LITRE_SINCE = mXparser.NAMEv40; public const String GALLON_SINCE = mXparser.NAMEv40; public const String PINT_SINCE = mXparser.NAMEv40; /* Units of time */ public const String SECOND_SINCE = mXparser.NAMEv40; public const String MILLISECOND_SINCE = mXparser.NAMEv40; public const String MINUTE_SINCE = mXparser.NAMEv40; public const String HOUR_SINCE = mXparser.NAMEv40; public const String DAY_SINCE = mXparser.NAMEv40; public const String WEEK_SINCE = mXparser.NAMEv40; public const String JULIAN_YEAR_SINCE = mXparser.NAMEv40; /* Units of mass */ public const String KILOGRAM_SINCE = mXparser.NAMEv40; public const String GRAM_SINCE = mXparser.NAMEv40; public const String MILLIGRAM_SINCE = mXparser.NAMEv40; public const String DECAGRAM_SINCE = mXparser.NAMEv40; public const String TONNE_SINCE = mXparser.NAMEv40; public const String OUNCE_SINCE = mXparser.NAMEv40; public const String POUND_SINCE = mXparser.NAMEv40; /* Units of information */ public const String BIT_SINCE = mXparser.NAMEv40; public const String KILOBIT_SINCE = mXparser.NAMEv40; public const String MEGABIT_SINCE = mXparser.NAMEv40; public const String GIGABIT_SINCE = mXparser.NAMEv40; public const String TERABIT_SINCE = mXparser.NAMEv40; public const String PETABIT_SINCE = mXparser.NAMEv40; public const String EXABIT_SINCE = mXparser.NAMEv40; public const String ZETTABIT_SINCE = mXparser.NAMEv40; public const String YOTTABIT_SINCE = mXparser.NAMEv40; public const String BYTE_SINCE = mXparser.NAMEv40; public const String KILOBYTE_SINCE = mXparser.NAMEv40; public const String MEGABYTE_SINCE = mXparser.NAMEv40; public const String GIGABYTE_SINCE = mXparser.NAMEv40; public const String TERABYTE_SINCE = mXparser.NAMEv40; public const String PETABYTE_SINCE = mXparser.NAMEv40; public const String EXABYTE_SINCE = mXparser.NAMEv40; public const String ZETTABYTE_SINCE = mXparser.NAMEv40; public const String YOTTABYTE_SINCE = mXparser.NAMEv40; /* Units of energy */ public const String JOULE_SINCE = mXparser.NAMEv40; public const String ELECTRONO_VOLT_SINCE = mXparser.NAMEv40; public const String KILO_ELECTRONO_VOLT_SINCE = mXparser.NAMEv40; public const String MEGA_ELECTRONO_VOLT_SINCE = mXparser.NAMEv40; public const String GIGA_ELECTRONO_VOLT_SINCE = mXparser.NAMEv40; public const String TERA_ELECTRONO_VOLT_SINCE = mXparser.NAMEv40; /* Units of speed */ public const String METRE_PER_SECOND_SINCE = mXparser.NAMEv40; public const String KILOMETRE_PER_HOUR_SINCE = mXparser.NAMEv40; public const String MILE_PER_HOUR_SINCE = mXparser.NAMEv40; public const String KNOT_SINCE = mXparser.NAMEv40; /* Units of acceleration */ public const String METRE_PER_SECOND2_SINCE = mXparser.NAMEv40; public const String KILOMETRE_PER_HOUR2_SINCE = mXparser.NAMEv40; public const String MILE_PER_HOUR2_SINCE = mXparser.NAMEv40; /* Units of angle */ public const String RADIAN_ARC_SINCE = mXparser.NAMEv40; public const String DEGREE_ARC_SINCE = mXparser.NAMEv40; public const String MINUTE_ARC_SINCE = mXparser.NAMEv40; public const String SECOND_ARC_SINCE = mXparser.NAMEv40; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CooldownRefresh : MonoBehaviour { public GameObject LocalPlayer; public PowerUpsHud playerscript; void Start() { gameObject.GetComponent<ParticleSystem>().startColor = Color.green; } void OnTriggerEnter (Collider c) { Debug.LogWarning("Something collided with the powerup"); playerscript = c.GetComponent<PowerUpsHud>(); if (c.gameObject.tag == "Player" ) { GameObject g; if (c.name == "bottom") { g = c.transform.parent.gameObject; } else { g = c.gameObject; } if (g == LocalPlayer && !playerscript.OnePowerUp) { Debug.LogWarning ("Doing CooldownRefresh on " + g); playerscript.DoUpdate("2"); g.transform.Find("Canvas/PowerCanvas/Cooldown").gameObject.GetComponent<Image>().enabled = true; } else { Debug.LogWarning ("Someone else collided with the powerup, removing it"); } Destroy (gameObject); } } }
using System; using System.ComponentModel.DataAnnotations; namespace Odco.PointOfSales.Application.Finance.Payments.PaymentTypes { public class ChequeDto { [StringLength(25)] public string ChequeNumber { get; set; } public Guid BankId { get; set; } [StringLength(100)] public string Bank { get; set; } public Guid? BranchId { get; set; } [StringLength(100)] public string Branch { get; set; } public DateTime ChequeReturnDate { get; set; } public decimal ChequeAmount { get; set; } } }
namespace CsvHelper.Excel.Specs.Parser { public class ParseUsingPathSpec : ExcelParserSpec { public ParseUsingPathSpec() : base("parse_by_path") { using var parser = new ExcelParser(Path); Run(parser); } } }
using System.Runtime.InteropServices; namespace Corsair.Native { // ReSharper disable once InconsistentNaming /// <summary> /// CUE-SDK: contains information about led and its color /// </summary> [StructLayout(LayoutKind.Sequential)] public class CorsairLedColor { /// <summary> /// CUE-SDK: identifier of LED to set /// </summary> public int ledId; /// <summary> /// CUE-SDK: red brightness[0..255] /// </summary> public int r; /// <summary> /// CUE-SDK: green brightness[0..255] /// </summary> public int g; /// <summary> /// CUE-SDK: blue brightness[0..255] /// </summary> public int b; }; }
using System.Linq; using CHC.Consent.EFCore.Consent; using CHC.Consent.EFCore.Entities; namespace CHC.Consent.EFCore.Identity { public class HasConsentForStudyCriteria : ICriteria<PersonEntity> { private readonly long studyId; /// <inheritdoc /> public HasConsentForStudyCriteria(long studyId) { this.studyId = studyId; } /// <inheritdoc /> public IQueryable<PersonEntity> ApplyTo(IQueryable<PersonEntity> queryable, ConsentContext context) { return from person in queryable join consent in context.Set<ConsentEntity>() on person.Id equals consent.StudySubject.Person.Id where consent.StudySubject.Study.Id == studyId select person; } } }
using System; using System.Collections.Generic; using System.Text; using Zoo.Interfaces; namespace Zoo.Classes { public class Lizard : RepHasLegs, ICanAlsoFly { public bool ChangesColor { get; set; } = true; public override bool NeedsOxy { get; set; } = true; /// <summary> /// Makes turn green /// </summary> public void TurnGreen() { Console.WriteLine("Lizard turns green"); } /// <summary> /// Makes climb /// </summary> public override void Climb() { base.Climb(); } /// <summary> /// Makes fly /// </summary> public string ICanFly() { Console.WriteLine("I'm flying!"); return "I'm flying!"; } } }
/* Copyright (c) 2019 Rick (rick 'at' gibbed 'dot' us) * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would * be appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not * be misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ using System; using System.Collections.Generic; using System.Linq; using Gibbed.Unreflect.Core; using Newtonsoft.Json; using Dataminer = BorderlandsEnhancedDatamining.Dataminer; namespace DumpEmergencyTeleportOutposts { internal class Program { private static void Main(string[] args) { new Dataminer().Run(args, Go); } private static void Go(Engine engine) { dynamic outpostLookupClass = engine.GetClass("WillowGame.EmergencyTeleportOutpostLookup"); dynamic willowGlobalsClass = engine.GetClass("WillowGame.WillowGlobals"); dynamic dlcPackageClass = engine.GetClass("WillowGame.DLCPackageDefinition"); if (outpostLookupClass == null || willowGlobalsClass == null || dlcPackageClass == null) { throw new InvalidOperationException(); } var sourceLookup = new Dictionary<string, string>(); dynamic willowGlobals = engine.Objects.Single( o => o.IsA(willowGlobalsClass) == true && o.GetName().StartsWith("Default__") == false); dynamic masterLookup = willowGlobals.MasterRegistrationStationList; var outpostOrder = new List<string>(); foreach (dynamic lookupObject in masterLookup.OutpostLookupList) { outpostOrder.Add(lookupObject.OutpostName); } foreach (dynamic dlcPackage in engine.Objects.Where( o => o.IsA(dlcPackageClass) == true && o.GetName().StartsWith("Default__") == false)) { sourceLookup.Add(dlcPackage.TeleportLookupObject.GetPath(), dlcPackage.GetPath()); } using (var output = Dataminer.NewDump("Emergency Teleport Outposts.json")) using (var writer = new JsonTextWriter(output)) { writer.Indentation = 2; writer.IndentChar = ' '; writer.Formatting = Formatting.Indented; var outpostNames = new List<string>(); writer.WriteStartObject(); foreach (dynamic lookup in engine.Objects .Where( o => o.IsA(outpostLookupClass) && o.GetName().StartsWith("Default__") == false) .OrderBy(o => o.GetPath()) .Distinct()) { // The master list has every single station, we don't want to write it too. if (lookup == masterLookup) { continue; } writer.WritePropertyName(lookup.GetPath()); writer.WriteStartObject(); string source; if (sourceLookup.TryGetValue((string)lookup.GetPath(), out source) == true && source != "None") { writer.WritePropertyName("dlc_package"); writer.WriteValue(source); } writer.WritePropertyName("outposts"); writer.WriteStartArray(); foreach (dynamic lookupObject in ((UnrealObject[])lookup.OutpostLookupList) .Cast<dynamic>() .OrderBy(l => outpostOrder.IndexOf(l.OutpostName))) { var outpostName = (string)lookupObject.OutpostName; if (outpostNames.Contains(outpostName) == true) { Console.WriteLine($"Skipping duplicate outpost {outpostName}."); continue; } outpostNames.Add(outpostName); writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteValue(outpostName); writer.WritePropertyName("path"); writer.WriteValue(lookupObject.OutpostPathName); var isInitiallyActive = (bool)lookupObject.bInitiallyActive; if (isInitiallyActive == true) { writer.WritePropertyName("is_initially_active"); writer.WriteValue(true); } var isCheckpointOnly = (bool)lookupObject.bCheckpointOnly; if (isCheckpointOnly == true) { writer.WritePropertyName("is_checkpoint_only"); writer.WriteValue(true); } var displayName = (string)lookupObject.OutpostDisplayName; if (string.IsNullOrEmpty(displayName) == false) { writer.WritePropertyName("display_name"); writer.WriteValue(displayName); } var description = (string)lookupObject.OutpostDescription; if (string.IsNullOrEmpty(description) == false && description != "No Description") { writer.WritePropertyName("description"); writer.WriteValue(description); } var previousOutpost = (string)lookupObject.PreviousOutpost; if (string.IsNullOrEmpty(previousOutpost) == false && previousOutpost != "None") { writer.WritePropertyName("previous_outpost"); writer.WriteValue(previousOutpost); } if (lookupObject.MissionDependencies != null && lookupObject.MissionDependencies.Length > 0) { writer.WritePropertyName("mission_dependencies"); writer.WriteStartObject(); foreach (var missionDependency in lookupObject.MissionDependencies) { writer.WritePropertyName(missionDependency.MissionDefinition.GetPath()); writer.WriteValue(((MissionStatus)missionDependency.MissionStatus).ToString()); } writer.WriteEndObject(); } var outpostIndex = outpostOrder.IndexOf(outpostName); if (outpostIndex < 0) { throw new InvalidOperationException(); } writer.WritePropertyName("sort_order"); writer.WriteValue(outpostIndex); writer.WriteEndObject(); } writer.WriteEndArray(); writer.WriteEndObject(); } writer.WriteEndObject(); writer.Flush(); } } } }
using System; namespace RockPaperScissors.ApiModels { public class GameStateModel { public Guid GameId { get; set; } public string CurrentPlayer { get; set; } public string Opponent { get; set; } public string Winner { get; set; } public bool GameFinished { get; set; } public string CurrentPlayerMove { get; set; } public string OpponentPlayerMove { get; set; } public GameStateModel() {} public GameStateModel(GameState gameState) { GameId = gameState.Id; CurrentPlayer = gameState.CurrentPlayer.Name; Opponent = gameState.Opponent.Name; Winner = gameState.Winner?.Name; GameFinished = gameState.GameFinished; CurrentPlayerMove = gameState.CurrentPlayerMove.Name; OpponentPlayerMove = gameState.OpponentPlayerMove.Name; } } }
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Models.Common; using Models.WebApplicationModels.CommonModels; using Newtonsoft.Json; using Services.UserServices.Interfaces; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace WebApplication.Middlewares { /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> public class JwtMiddleware { /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> private readonly RequestDelegate _next; /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> private readonly AppSettings _appSettings; /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> /// <param name="next"></param> /// <param name="appSettings"></param> public JwtMiddleware( RequestDelegate next, IOptions<AppSettings> appSettings ) { _next = next; _appSettings = appSettings.Value; } /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> /// <param name="context"></param> /// <param name="userService"></param> /// <returns></returns> public async Task Invoke(HttpContext context, IUserService userService) { var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last(); var isAttachUserToContext = token != null; if (isAttachUserToContext) await attachUserToContext(context, userService, token); await _next(context); } /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> /// <param name="context"></param> /// <param name="userService"></param> /// <param name="token"></param> /// <returns></returns> private async Task attachUserToContext(HttpContext context, IUserService userService, string token) { try { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.Secret); tokenHandler.ValidateToken(token, new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false, ClockSkew = TimeSpan.Zero }, out SecurityToken validatedToken); var jwtToken = (JwtSecurityToken)validatedToken; var userId = Guid.Parse(jwtToken.Claims.First(x => x.Type == "id").Value); context.Items["User"] = userId; } catch (Exception exception) { await HandleException(context, exception); } } /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> /// <param name="context"></param> /// <param name="exception"></param> /// <returns></returns> private Task HandleException(HttpContext context, Exception exception) { string jsonString = string.Empty; context.Response.StatusCode = (int)HttpStatusCode.BadRequest; jsonString = JsonConvert.SerializeObject(new Exception("Invalid Token")); return GenerateResponse(context, jsonString); } /// <summary> /// Creater: Wai Khai Sheng /// Created: 20211227 /// UpdatedBy: /// Updated: /// </summary> /// <param name="context"></param> /// <param name="jsonString"></param> /// <returns></returns> private async Task GenerateResponse(HttpContext context, string jsonString) { context.Response.ContentType = "application/json"; await context.Response.WriteAsync(jsonString, Encoding.UTF8); } } }
//////////////////////////////////////////////////////////////////////// // Copyright (c) 2011-2013 by Rob Jellinghaus. // // Licensed under the Microsoft Public License (MS-PL). // //////////////////////////////////////////////////////////////////////// using Holofunk.SceneGraphs; using SharpDX; using SharpDX.Toolkit; using SharpDX.Toolkit.Graphics; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; namespace Holofunk.Tests { /// <summary>Mocking class that logs drawing messages.</summary> public class MockSpriteBatch // : ISpriteBatch { Logger m_logger; public MockSpriteBatch(Logger logger) { m_logger = logger; } #region ISpriteBatch Members public void Draw(Texture2D texture, Rectangle rect, Color color) { m_logger.Log("[Draw " + texture.Width + "x" + texture.Height + " @ (" + rect.Left + "," + rect.Top + ")-(" + rect.Right + "," + rect.Bottom + ") in " + color.ToString() + "]"); } #endregion } }
using System.Collections.Generic; namespace MTGAHelper.Web.UI.Model.Response.Dto { public class DeckDto { public string OriginalDeckId { get; set; } public string Id { get; set; } public uint Hash { get; set; } public string Name { get; set; } public string Url { get; set; } public string ScraperTypeId { get; set; } public ICollection<DeckCardDto> CardsMain { get; set; } public ICollection<DeckCardDto> CardsMainOther { get; set; } public ICollection<DeckCardDto> CardsSideboard { get; set; } public string MtgaImportFormat { get; set; } public ICollection<DeckCompareResultDto> CompareResults { get; set; } public ICollection<DeckManaCurveDto> ManaCurve { get; set; } } public class DeckCompareResultDto { public string Set { get; set; } public int NbMissing { get; set; } public float MissingWeightTotal { get; set; } } public class DeckManaCurveDto { public int ManaCost { get; set; } public int NbCards { get; set; } public int PctHeight { get; set; } } }
using System.Runtime.Serialization; namespace Lykke.Service.EthereumSamurai.Responses { [DataContract] public class BalanceResponse { [DataMember(Name = "amount")] public string Amount { get; set; } } }
using System; using System.Buffers; using System.Text; using System.Threading; using System.Threading.Tasks; using MirrorSharp.Internal.Handlers.Shared; using MirrorSharp.Internal.Results; namespace MirrorSharp.Internal.Handlers { internal class ReplaceTextHandler : ICommandHandler { public char CommandId => CommandIds.ReplaceText; private readonly ISignatureHelpSupport _signatureHelp; private readonly ICompletionSupport _completion; private readonly ITypedCharEffects _typedCharEffects; private readonly ArrayPool<char> _charArrayPool; public ReplaceTextHandler( ISignatureHelpSupport signatureHelp, ICompletionSupport completion, ITypedCharEffects typedCharEffects, ArrayPool<char> charArrayPool ) { _signatureHelp = signatureHelp; _completion = completion; _typedCharEffects = typedCharEffects; _charArrayPool = charArrayPool; } public async Task ExecuteAsync(AsyncData data, WorkSession session, ICommandResultSender sender, CancellationToken cancellationToken) { var first = data.GetFirst(); var partStart = 0; int? start = null; int? length = null; int? cursorPosition = null; string? reason = null; for (var i = 0; i < first.Length; i++) { if (first.Span[i] != (byte)':') continue; var part = first.Slice(partStart, i - partStart); if (start == null) { start = FastConvert.Utf8BytesToInt32(part.Span); partStart = i + 1; continue; } if (length == null) { length = FastConvert.Utf8BytesToInt32(part.Span); partStart = i + 1; continue; } if (cursorPosition == null) { cursorPosition = FastConvert.Utf8BytesToInt32(part.Span); partStart = i + 1; continue; } reason = part.Length > 0 ? Encoding.UTF8.GetString(part.Span) : string.Empty; partStart = i + 1; break; } if (start == null || length == null || cursorPosition == null || reason == null) throw new FormatException("Command arguments must be 'start:length:cursor:reason:text'."); var text = await AsyncDataConvert.ToUtf8StringAsync(data, partStart, _charArrayPool).ConfigureAwait(false); session.ReplaceText(text, start.Value, length.Value); session.CursorPosition = cursorPosition.Value; await _signatureHelp.ApplyCursorPositionChangeAsync(session, sender, cancellationToken).ConfigureAwait(false); await _completion.ApplyReplacedTextAsync(reason, _typedCharEffects, session, sender, cancellationToken).ConfigureAwait(false); } } }
using SceneKit; using UIKit; namespace ARKitFun.Nodes { public class TextNode : SCNNode { public TextNode(string text, float extrusionDepth, UIColor color) { SCNNode node = new SCNNode { Geometry = CreateGeometry(text, extrusionDepth, color) }; AddChildNode(node); } SCNGeometry CreateGeometry(string text, float extrusionDepth, UIColor color) { SCNText geometry = SCNText.Create(text, extrusionDepth); geometry.Font = UIFont.FromName("Arial", 0.15f); geometry.Flatness = 0; geometry.FirstMaterial.DoubleSided = true; geometry.FirstMaterial.Diffuse.Contents = color; return geometry; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Profanity.API.Helper { public struct EndPoints { public const string CheckProfanity = "check-text-for-profanity"; public const string AddWordToProfanity = "add-text-to-profanity"; public const string RemoveWordFromProfanity = "remove-word-from-profanity-list"; public const string GetProfanitites = "get-profanity"; public const string ClearAllProfanities = "clear-all-profanity"; public const string ClearSpecificProfanitites = "clear-profanity"; public const string HealthQuickCheck = "health"; public const string HealthService = "health/services"; public const string HealthDatabase = "health/database"; } }
using System; using System.Collections.Generic; namespace NTC.Global.System { public static class SimpleExt { public static bool IsNull<T>(this List<T> list) => list.Count == 0; public static bool IsNull<T>(this HashSet<T> hashSet) => hashSet.Count == 0; public static bool IsNull<T>(this T[] array) => array.Length == 0; public static bool IsEqual(this string s1, string s2) => s1 == s2; public static bool IsEqual(this float f1, float f2) => f1 == f2; public static bool IsEqual(this int i1, int i2) => i1 == i2; public static void SetNull(this Action action) => action = null; public static void SetNull<T>(this Action<T> action) => action = null; } }
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using DebuggerApi; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Debugger.Interop; using System; using System.Diagnostics; using System.IO; using System.Threading.Tasks; using YetiCommon.CastleAspects; using YetiCommon.PerformanceTracing; using YetiVSI.DebugEngine.Variables; using YetiVSI.Metrics; namespace YetiVSI.DebugEngine { public interface IAsyncExpressionEvaluator { Task<EvaluationResult> EvaluateExpressionAsync(); } public class EvaluationResult { public IDebugProperty2 Result { get; } public int Status { get; } public static EvaluationResult Fail() => new EvaluationResult(null, VSConstants.E_FAIL); public static EvaluationResult FromResult(IDebugProperty2 result) => new EvaluationResult(result, VSConstants.S_OK); EvaluationResult(IDebugProperty2 result, int status) { Result = result; Status = status; } } public class AsyncExpressionEvaluator : SimpleDecoratorSelf<IAsyncExpressionEvaluator>, IAsyncExpressionEvaluator { public class Factory { readonly IGgpDebugPropertyFactory _propertyFactory; readonly VarInfoBuilder _varInfoBuilder; readonly VsExpressionCreator _vsExpressionCreator; readonly ErrorDebugProperty.Factory _errorDebugPropertyFactory; readonly IDebugEngineCommands _debugEngineCommands; readonly IExtensionOptions _extensionOptions; readonly ExpressionEvaluationRecorder _expressionEvaluationRecorder; readonly ITimeSource _timeSource; [Obsolete("This constructor only exists to support mocking libraries.", error: true)] protected Factory() { } public Factory(IGgpDebugPropertyFactory propertyFactory, VarInfoBuilder varInfoBuilder, VsExpressionCreator vsExpressionCreator, ErrorDebugProperty.Factory errorDebugPropertyFactory, IDebugEngineCommands debugEngineCommands, IExtensionOptions extensionOptions, ExpressionEvaluationRecorder expressionEvaluationRecorder, ITimeSource timeSource) { _propertyFactory = propertyFactory; _varInfoBuilder = varInfoBuilder; _vsExpressionCreator = vsExpressionCreator; _errorDebugPropertyFactory = errorDebugPropertyFactory; _debugEngineCommands = debugEngineCommands; _extensionOptions = extensionOptions; _expressionEvaluationRecorder = expressionEvaluationRecorder; _timeSource = timeSource; } public virtual IAsyncExpressionEvaluator Create(RemoteFrame frame, string text) { // Get preferred expression evaluation option. This is performed here to // pick up configuration changes in runtime (e.g. the user can enable and // disable lldb-eval during a single debug session). var expressionEvaluationStrategy = _extensionOptions.ExpressionEvaluationStrategy; return new AsyncExpressionEvaluator(frame, text, _vsExpressionCreator, _varInfoBuilder, _propertyFactory, _errorDebugPropertyFactory, _debugEngineCommands, expressionEvaluationStrategy, _expressionEvaluationRecorder, _timeSource); } } const ExpressionEvaluationContext _expressionEvaluationContext = ExpressionEvaluationContext.FRAME; readonly VsExpressionCreator _vsExpressionCreator; readonly VarInfoBuilder _varInfoBuilder; readonly IGgpDebugPropertyFactory _propertyFactory; readonly ErrorDebugProperty.Factory _errorDebugPropertyFactory; readonly IDebugEngineCommands _debugEngineCommands; readonly RemoteFrame _frame; readonly string _text; readonly ExpressionEvaluationStrategy _expressionEvaluationStrategy; readonly ExpressionEvaluationRecorder _expressionEvaluationRecorder; readonly ITimeSource _timeSource; AsyncExpressionEvaluator(RemoteFrame frame, string text, VsExpressionCreator vsExpressionCreator, VarInfoBuilder varInfoBuilder, IGgpDebugPropertyFactory propertyFactory, ErrorDebugProperty.Factory errorDebugPropertyFactory, IDebugEngineCommands debugEngineCommands, ExpressionEvaluationStrategy expressionEvaluationStrategy, ExpressionEvaluationRecorder expressionEvaluationRecorder, ITimeSource timeSource) { _frame = frame; _text = text; _vsExpressionCreator = vsExpressionCreator; _varInfoBuilder = varInfoBuilder; _propertyFactory = propertyFactory; _errorDebugPropertyFactory = errorDebugPropertyFactory; _debugEngineCommands = debugEngineCommands; _expressionEvaluationStrategy = expressionEvaluationStrategy; _expressionEvaluationRecorder = expressionEvaluationRecorder; _timeSource = timeSource; } public async Task<EvaluationResult> EvaluateExpressionAsync() { VsExpression vsExpression = await _vsExpressionCreator.CreateAsync(_text, EvaluateSizeSpecifierExpressionAsync); IDebugProperty2 result; if (vsExpression.Value.StartsWith(".")) { EvaluateCommand(vsExpression.Value, out result); return EvaluationResult.FromResult(result); } RemoteValue remoteValue = await CreateValueFromExpressionAsync(vsExpression.Value); if (remoteValue == null) { return EvaluationResult.Fail(); } string displayName = vsExpression.ToString(); IVariableInformation varInfo = _varInfoBuilder.Create(remoteValue, displayName, vsExpression.FormatSpecifier); result = _propertyFactory.Create(varInfo); return EvaluationResult.FromResult(result); } async Task<uint> EvaluateSizeSpecifierExpressionAsync(string expression) { RemoteValue value = await CreateValueFromExpressionAsync(expression); var err = value.GetError(); if (err.Fail()) { throw new ExpressionEvaluationFailed(err.GetCString()); } if (!uint.TryParse(value.GetValue(ValueFormat.Default), out uint size)) { throw new ExpressionEvaluationFailed("Expression isn't a uint"); } return size; } void EvaluateCommand(string command, out IDebugProperty2 debugProperty) { debugProperty = _errorDebugPropertyFactory.Create(command, "", "Invalid Command"); command = command.Trim(); if (command == ".natvisreload") { debugProperty = new CommandDebugProperty(".natvisreload", "", () => { Trace.WriteLine("Reloading Natvis - triggered by .natvisreload command."); var writer = new StringWriter(); Trace.WriteLine( _debugEngineCommands.ReloadNatvis(writer, out string resultDescription) ? $".natvisreload result: {writer}" : $"Unable to reload Natvis. {resultDescription}"); return resultDescription; }); } } async Task<RemoteValue> CreateValueFromExpressionAsync(string expression) { var stepsRecorder = new ExpressionEvaluationRecorder.StepsRecorder(_timeSource); long startTimestampUs = _timeSource.GetTimestampUs(); RemoteValue remoteValue = await CreateValueFromExpressionWithMetricsAsync(expression, stepsRecorder); long endTimestampUs = _timeSource.GetTimestampUs(); _expressionEvaluationRecorder.Record(_expressionEvaluationStrategy, _expressionEvaluationContext, stepsRecorder, startTimestampUs, endTimestampUs); return remoteValue; } /// <summary> /// Asynchronously creates RemoteValue from the expression. Returns null in case of error. /// </summary> async Task<RemoteValue> CreateValueFromExpressionWithMetricsAsync( string expression, ExpressionEvaluationRecorder.StepsRecorder stepsRecorder) { if (_text.StartsWith(ExpressionConstants.RegisterPrefix)) { // If text is prefixed by '$', check if it refers to a register by trying to find // a register named expression[1:]. If we can't, simply return false to prevent // LLDB scratch variables, which also start with '$', from being accessible. return _frame.FindValue(expression.Substring(1), DebuggerApi.ValueType.Register); } if (_expressionEvaluationStrategy == ExpressionEvaluationStrategy.LLDB_EVAL || _expressionEvaluationStrategy == ExpressionEvaluationStrategy.LLDB_EVAL_WITH_FALLBACK) { RemoteValue value; LldbEvalErrorCode errorCode; using (var step = stepsRecorder.NewStep(ExpressionEvaluationEngine.LLDB_EVAL)) { value = await _frame.EvaluateExpressionLldbEvalAsync(expression); // Convert an error code to the enum value. errorCode = (LldbEvalErrorCode)Enum.ToObject( typeof(LldbEvalErrorCode), value.GetError().GetError()); step.Finalize(errorCode); } if (errorCode == LldbEvalErrorCode.Ok) { return value; } if (errorCode == LldbEvalErrorCode.InvalidNumericLiteral || errorCode == LldbEvalErrorCode.InvalidOperandType || errorCode == LldbEvalErrorCode.UndeclaredIdentifier) { // Evaluation failed with a well-known error. Don't fallback to LLDB native // expression evaluator, since it will fail too. return value; } if (_expressionEvaluationStrategy != ExpressionEvaluationStrategy.LLDB_EVAL_WITH_FALLBACK) { // Don't fallback to LLDB native expression evaluator if that option is // disabled. return value; } } else { RemoteValue value; using (var step = stepsRecorder.NewStep(ExpressionEvaluationEngine.LLDB_VARIABLE_PATH)) { value = EvaluateWithLldbVariablePath(expression); step.Finalize(ToErrorCodeLLDB(value)); } if (value != null) { return value; } } // Evaluate the expression using LLDB. { RemoteValue value; using (var step = stepsRecorder.NewStep(ExpressionEvaluationEngine.LLDB)) { value = await _frame.EvaluateExpressionAsync(expression); step.Finalize(ToErrorCodeLLDB(value)); } return value; } LLDBErrorCode ToErrorCodeLLDB(RemoteValue v) { if (v == null) { return LLDBErrorCode.ERROR; } return v.GetError().Success() ? LLDBErrorCode.OK : LLDBErrorCode.ERROR; } } RemoteValue EvaluateWithLldbVariablePath(string expression) { // Variables created via RemoteFrame::EvaluateExpression() don't return a valid, // non-contextual fullname so we attempt to use // RemoteFrame::GetValueForVariablePath() and RemoteFrame::FindValue() first. This // ensures some UI elements (ex variable tooltips) show a human readable expression // that can be re-evaluated across debug sessions. // RemoteFrame::GetValueForVariablePath() was not returning the proper address of // reference types. ex. "&myIntRef". if (!_text.Contains("&")) { RemoteValue remoteValue = _frame.GetValueForVariablePath(expression); if (remoteValue != null) { return remoteValue; } } // Resolve static class variables because GetValueForVariablePath() doesn't. return _frame.FindValue(expression, DebuggerApi.ValueType.VariableGlobal); } } }
namespace NumericPolicies { public interface INumericPolicy<T> { T FromInt64(long v); T Add(T a, T b); T Substract(T a, T b); T Multiply(T a, T b); T Div(T a, T b); } }
namespace piper.cli.Persistence { public class Snippet { public string Name { get; set; } public string Html { get; set; } } }
using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameManager : MonoBehaviour { public static GameManager instance; public static Dictionary<int, PlayerManager> players = new Dictionary<int, PlayerManager>(); public GameObject rotatingPlatform; public GameObject localPlayerPrefab; public GameObject playerPrefab; public static long tick; public static Vector3 playerPosition = Vector3.zero; private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Debug.Log("Instance already exists, destroying objects!"); Destroy(this); } } public void SpawnPlayer(int id, string username, Vector3 position, Quaternion rotation) { GameObject player; if(id == Client.instance.myId) { player = Instantiate(localPlayerPrefab, position, rotation); } else { player = Instantiate(playerPrefab, position, rotation); player.GetComponentInChildren<Text>().text = username; } player.GetComponent<PlayerManager>().id = id; player.GetComponent<PlayerManager>().username = username; players.Add(id, player.GetComponent<PlayerManager>()); } }
//////////////////////////////////////////////////////////////////////////////// //EF Core Provider for LCPI OLE DB. // IBProvider and Contributors. 14.05.2018. using System; using System.Diagnostics; using System.Collections.Generic; using System.Globalization; using System.Data; using System.Reflection; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore.Update; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations.Operations; using com_lib=lcpi.lib.com; namespace Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb{ //////////////////////////////////////////////////////////////////////////////// //using using Structure_ADP =Structure.Structure_ADP; using Structure_MethodId =Structure.Structure_MethodId; using Structure_MemberId =Structure.Structure_MemberId; //////////////////////////////////////////////////////////////////////////////// //class ThrowError static class ThrowError { public static void ArgErr__BadValueType(ErrSourceID errSrcID, string methodName, string paramName, Type paramValueType, Type expectedType) { // [2020-10-14] Tested. Debug.Assert(!string.IsNullOrEmpty(methodName)); Debug.Assert(!string.IsNullOrEmpty(paramName)); Debug.Assert(!Object.ReferenceEquals(paramValueType,null)); Debug.Assert(!Object.ReferenceEquals(expectedType,null)); Debug.Assert(paramValueType!=expectedType); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_INVALIDARG, errSrcID, ErrMessageID.common_err__bad_argument_type_4); errRec .push(methodName) .push(paramName) .push(paramValueType) .push(expectedType); ThrowSysError.invalid_arg (errRec, paramName); }//ArgErr__BadValueType //----------------------------------------------------------------------- public static void ArgErr__StringLiteralContainsZeroChar (ErrSourceID errSrcID, string paramName, int position) { // [2020-10-14] Tested. Debug.Assert(!string.IsNullOrEmpty(paramName)); Debug.Assert(position>=0); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_INVALIDARG, errSrcID, ErrMessageID.common_err__zero_symbol_in_string_literal_1); errRec .push(position); ThrowSysError.invalid_arg (errRec, paramName); }//ArgErr__StringLiteralContainsZeroChar //----------------------------------------------------------------------- public static void ArgErr__BadListSize(ErrSourceID errSrcID, string methodName, string paramName, int actualListSize) { Debug.Assert(!string.IsNullOrEmpty(methodName)); Debug.Assert(methodName.Trim()==methodName); Debug.Assert(!string.IsNullOrEmpty(paramName)); Debug.Assert(paramName.Trim()==paramName); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_INVALIDARG, errSrcID, ErrMessageID.common_err__bad_argument_list_size_3); errRec .push(methodName) .push(paramName) .push(actualListSize); ThrowSysError.invalid_arg (errRec, paramName); }//ArgErr__BadListSize //----------------------------------------------------------------------- public static void ArgErr__BadListSize(ErrSourceID errSrcID, string methodName, string paramName, int actualListSize, int expectedListSize) { // [2020-10-21] Tested. Debug.Assert(!string.IsNullOrEmpty(methodName)); Debug.Assert(methodName.Trim()==methodName); Debug.Assert(!string.IsNullOrEmpty(paramName)); Debug.Assert(paramName.Trim()==paramName); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_INVALIDARG, errSrcID, ErrMessageID.common_err__bad_argument_list_size_4); errRec .push(methodName) .push(paramName) .push(actualListSize) .push(expectedListSize); ThrowSysError.invalid_arg (errRec, paramName); }//ArgErr__BadListSize //----------------------------------------------------------------------- public static void FeatureNotSupported(ErrSourceID errSrcID, string featureName) { // [2021-11-29] Tested. Debug.Assert(!string.IsNullOrEmpty(featureName)); Debug.Assert(featureName.Trim()==featureName); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.common_err__feature_not_supported__1); errRec .push(featureName); ThrowSysError.not_supported (errRec); }//FeatureNotSupported //----------------------------------------------------------------------- public static void FeatureNotSupported__DesignTimeServices (ErrSourceID errSrcID) { // [2021-11-29] Tested. FeatureNotSupported (errSrcID, LcpiOleDb__Common___FeatureNames.DesignTimeServices); }//FeatureNotSupported__DesignTimeServices //----------------------------------------------------------------------- public static void InvalidOp__DirectCallOfLinqMethodNotAllowed (ErrSourceID errSrcID, string methodSign) { // [2020-10-14] Tested. Debug.Assert(!string.IsNullOrEmpty(methodSign)); Debug.Assert(methodSign.Trim()==methodSign); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__direct_call_of_linq_method_not_allowed_1); errRec .push(methodSign); ThrowSysError.invalid_operation (errRec); }//InvalidOp__DirectCallOfLinqMethodNotAllowed //----------------------------------------------------------------------- public static void NoSourceForLoadCnInfo(ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__no_source_for_load_connection_info_0); ThrowSysError.invalid_operation(errRec); }//NoSourceForLoadCnInfo //----------------------------------------------------------------------- public static void UnknownDbmsName(ErrSourceID errSrcID, string DbmsName) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__unknown_dbms_name_1); exc .push(DbmsName) .raise(); }//UnknownDbmsName //----------------------------------------------------------------------- public static void UnsupportedDbmsVersion(ErrSourceID errSrcID, string DbmsName, Version DbmsVersion) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__unsupported_dbms_version_2); exc .push(DbmsName) .push(DbmsVersion) .raise(); }//UnsupportedDbmsVersion //----------------------------------------------------------------------- public static void UnsupportedConnectionDialect(ErrSourceID errSrcID, int connectionDialect) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__unsupported_connection_dialect_1); exc .push(connectionDialect) .raise(); }//UnsupportedConnectionDialect //----------------------------------------------------------------------- public static void EmptyObjectName(ErrSourceID errSrcID) { // [2020-10-15] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__empty_object_name_0); ThrowSysError.invalid_operation (errRec); }//EmptyObjectName //----------------------------------------------------------------------- public static void BadSymbolInUnquotedObjectName(ErrSourceID errSrcID, string name, int position) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(name,null)); Debug.Assert(position<name.Length); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__bad_symbol_in_unquoted_object_name_2); errRec .push(position) .push((int)name[position]); ThrowSysError.invalid_operation (errRec); }//BadSymbolInUnquotedObjectName //----------------------------------------------------------------------- public static void BadSymbolInQuotedObjectName(ErrSourceID errSrcID, string name, int position) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(name,null)); Debug.Assert(position<name.Length); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__bad_symbol_in_quoted_object_name_2); errRec .push(position) .push((int)name[position]); ThrowSysError.invalid_operation (errRec); }//BadSymbolInQuotedObjectName //----------------------------------------------------------------------- public static void NotDefinedNamedParameterPrefix(ErrSourceID errSrcID) { // [2020-10-14] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__not_defined_cmd_parameter_prefix_0); ThrowSysError.invalid_operation (errRec); }//NotDefinedNamedParameterPrefix //----------------------------------------------------------------------- public static void BadFormatOfCmdParameterName(ErrSourceID errSrcID, string cmdParameterName) { // [2021-09-02] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__bad_cmd_parameter_name_format_1); errRec.push(cmdParameterName); ThrowSysError.invalid_operation (errRec); }//BadFormatOfCmdParameterName //----------------------------------------------------------------------- public static void BadFormatOfCmdParameterName_IncorrectPrefix (ErrSourceID errSrcID, string cmdParameterName) { // [2021-09-02] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__bad_cmd_parameter_name_format__incorrect_prefix_1); errRec.push(cmdParameterName); ThrowSysError.invalid_operation (errRec); }//BadFormatOfCmdParameterName_IncorrectPrefix //----------------------------------------------------------------------- public static void NoProviderConfigured(ErrSourceID errSrcID) { // [2020-10-14] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__no_provider_configured_0); ThrowSysError.invalid_operation (errRec); }//NoProviderConfigured //----------------------------------------------------------------------- public static void MultipleProviderConfigured(ErrSourceID errSrcID) { // [2020-10-14] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__multiple_provider_configured_0); ThrowSysError.invalid_operation (errRec); }//MultipleProviderConfigured //----------------------------------------------------------------------- public static void UnkColumnName(ErrSourceID SrcID, System.Data.DataTable Table, string ColumnName) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(Table,null)); Debug.Assert(!Object.ReferenceEquals(ColumnName,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, SrcID, ErrMessageID.common_err__unk_column_name__2); exc .push(Table.TableName) .push(ColumnName) .raise(); }//UnkColumnName //----------------------------------------------------------------------- public static void InvalidColumnValue(ErrSourceID SrcID, System.Data.DataRow Row, int ColumnIndex) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(Row,null)); Debug.Assert(!Object.ReferenceEquals(Row.Table,null)); Debug.Assert(!Object.ReferenceEquals(Row.Table.Columns,null)); Debug.Assert(ColumnIndex>=0); Debug.Assert(ColumnIndex<Row.Table.Columns.Count); Debug.Assert(!Object.ReferenceEquals(Row.Table.Columns[ColumnIndex],null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, SrcID, ErrMessageID.common_err__invalid_column_value__4); exc .push(Row.Table.TableName) .push(ColumnIndex) .push(Row.Table.Columns[ColumnIndex].ColumnName) .push_object(Row[ColumnIndex]) .raise(); }//InvalidColumnValue //----------------------------------------------------------------------- public static void InvalidColumnValueType(ErrSourceID SrcID, System.Data.DataRow Row, int ColumnIndex, Type ExpectedType) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(Row,null)); Debug.Assert(!Object.ReferenceEquals(Row.Table,null)); Debug.Assert(!Object.ReferenceEquals(Row.Table.Columns,null)); Debug.Assert(ColumnIndex>=0); Debug.Assert(ColumnIndex<Row.Table.Columns.Count); Debug.Assert(!Object.ReferenceEquals(ExpectedType,null)); Debug.Assert(!Object.ReferenceEquals(Row[ColumnIndex],null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, SrcID, ErrMessageID.common_err__invalid_column_value_type__5); exc .push(Row.Table.TableName) .push(ColumnIndex) .push(Row.Table.Columns[ColumnIndex].ColumnName) .push(Row[ColumnIndex].GetType()) .push(ExpectedType) .raise(); }//InvalidColumnValueType //----------------------------------------------------------------------- public static void UnsupportedDataTypesConversion (ErrSourceID errSrcID, Type sourceType, Type targetType) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(sourceType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_UNSUPPORTEDCONVERSION, errSrcID, ErrMessageID.common_err__unsupported_datatypes_conversion_2); errRec .push(sourceType) .push(targetType); ThrowSysError.invalid_operation(errRec); }//UnsupportedDataTypesConversion //----------------------------------------------------------------------- public static void FailedToConvertValueBetweenTypes__overflow (ErrSourceID errSrcID, Type sourceType, Type targetType, Exception innerException) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(sourceType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_DATAOVERFLOW, errSrcID, ErrMessageID.common_err__cant_convert_value_between_types_2); errRec .push(sourceType) .push(targetType); ThrowSysError.overflow (errRec, innerException); }//FailedToConvertValueBetweenTypes__overflow //----------------------------------------------------------------------- public static void FailedToConvertValueBetweenTypes (ErrSourceID errSrcID, Type sourceType, Type targetType, Exception innerException) { Debug.Assert(!Object.ReferenceEquals(sourceType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_CANTCONVERTVALUE, errSrcID, ErrMessageID.common_err__cant_convert_value_between_types_2); errRec .push(sourceType) .push(targetType); ThrowSysError.invalid_operation (errRec, innerException); }//FailedToConvertValueBetweenTypes //----------------------------------------------------------------------- public static void FailedToConvertValueBetweenTypes (ErrSourceID errSrcID, Type sourceType, Type targetType) { FailedToConvertValueBetweenTypes (errSrcID, sourceType, targetType, /*innerException*/null); }//FailedToConvertValueBetweenTypes //----------------------------------------------------------------------- public static void FailedToConvertValueBetweenTypes__OverflowInCalcOfNumberScale (ErrSourceID errSrcID, Type sourceType, Type targetType) { var errRec1 =new Core.Core_ExceptionRecord (lcpi.lib.com.HResultCode.DB_E_DATAOVERFLOW, errSrcID, ErrMessageID.common_err__overflow_in_number_scale_calculation_0); var exc1 =new lcpi.lib.structure.exceptions.t_overflow_exception (errRec1); FailedToConvertValueBetweenTypes__overflow (errSrcID, sourceType, targetType, /*innerException*/exc1); }//FailedToConvertValueBetweenTypes__OverflowInCalcOfNumberScale //----------------------------------------------------------------------- public static void FailedToConvertValueBetweenTypes__overflow (ErrSourceID errSrcID, Type sourceType, Type targetType) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(sourceType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); FailedToConvertValueBetweenTypes__overflow (errSrcID, sourceType, targetType, /*innerException*/null); }//FailedToConvertValueBetweenTypes__overflow //----------------------------------------------------------------------- public static void TargetPropertyNotAcceptNullValue (ErrSourceID errSrcID) { // [2020-10-14] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_BADVALUES, errSrcID, ErrMessageID.common_err__target_property_not_accept_null_value_0); ThrowSysError.invalid_operation (errRec); }//TargetPropertyNotAcceptNullValue //----------------------------------------------------------------------- public static void FailedToProcessValue(ErrSourceID errSrcID, string valueName, Exception innerException) { // [2020-10-19] Tested. Debug.Assert(!string.IsNullOrEmpty(valueName)); Debug.Assert(valueName.Trim()==valueName); Debug.Assert(!Object.ReferenceEquals(innerException,null)); var exc =new LcpiOleDb__DataToolException (innerException); exc.add_error (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__failed_to_process_value_1); exc.push(valueName); exc.raise(); }//FailedToProcessValue //----------------------------------------------------------------------- public static void IndexOutOfRange<TA1,TA2> (ErrSourceID errSrcID, TA1 index, TA2 countOfElements) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__index_out_of_range__2); errRec .push_object(index) .push_object(countOfElements); ThrowSysError.invalid_operation (errRec); }//IndexOutOfRange //----------------------------------------------------------------------- public static void EmptyListOfValues (ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__empty_list_of_values__0); ThrowSysError.invalid_operation (errRec); }//EmptyListOfValues //----------------------------------------------------------------------- public static void MethodNotSupported (ErrSourceID srcID, System.Type declaringType, string methodName, System.Type[] parameterTypes) { Debug.Assert(!Object.ReferenceEquals(declaringType,null)); Debug.Assert(!Object.ReferenceEquals(methodName,null)); Debug.Assert(!Object.ReferenceEquals(parameterTypes,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, srcID, ErrMessageID.common_err__type_not_support_method_3); errRec .push(declaringType) .push(methodName) .push(Structure_ADP.BuildParamsSign(parameterTypes)); ThrowSysError.invalid_operation (errRec); }//MethodNotSupported //----------------------------------------------------------------------- public static void CantRemapNormalMethodCall (ErrSourceID errSrcID, MethodInfo method, System.Type new_DeclaringType, System.Type[] new_Parameters) { Debug.Assert(!Object.ReferenceEquals(method,null)); Debug.Assert(!Object.ReferenceEquals(new_DeclaringType,null)); Debug.Assert(!Object.ReferenceEquals(new_Parameters,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__cant_remap_normal_method_3); errRec .push(method) .push(new_DeclaringType) .push(Structure_ADP.BuildParamsSign(new_Parameters)); ThrowSysError.invalid_operation(errRec); }//CantRemapNormalMethodCall //----------------------------------------------------------------------- public static void CantRemapGenericMethodCall (ErrSourceID errSrcID, MethodInfo method, System.Type new_DeclaringType, System.Type[] new_Parameters, System.Type[] new_GenericArgs) { Debug.Assert(!Object.ReferenceEquals(method,null)); Debug.Assert(!Object.ReferenceEquals(new_DeclaringType,null)); Debug.Assert(!Object.ReferenceEquals(new_Parameters,null)); Debug.Assert(!Object.ReferenceEquals(new_GenericArgs,null)); Debug.Assert(new_GenericArgs.Length>0); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__cant_remap_generic_method_4); errRec .push(method) .push(new_DeclaringType) .push(Structure_ADP.BuildParamsSign(new_Parameters)) .push(Structure_ADP.BuildParamsSign(new_GenericArgs)); ThrowSysError.invalid_operation (errRec); }//CantRemapGenericMethodCall //----------------------------------------------------------------------- public static void TypeMappingErr__CantMapClrTypeToProviderDatatype (ErrSourceID errSrcID, Type clrType) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(clrType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__cant_map_clr_type_to_provider_data_type_1); errRec .push(clrType); ThrowSysError.invalid_operation (errRec); }//TypeMappingErr__CantMapClrTypeToProviderDatatype //----------------------------------------------------------------------- public static void TypeMappingErr__CantMapInfoToProviderDatatype (ErrSourceID errSrcID, Type clrType, string baseTypeName) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(clrType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__cant_map_info_to_provider_data_type_2); errRec .push(clrType) .push(baseTypeName); ThrowSysError.invalid_operation (errRec); }//TypeMappingErr__CantMapInfoToProviderDatatype //----------------------------------------------------------------------- public static void TypeMappingErr__UnknownStoreTypeName (ErrSourceID errSrcID, string storeTypeName) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(storeTypeName,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unknown_StoreTypeName_1); exc .push(storeTypeName) .raise(); }//TypeMappingErr__UnknownStoreTypeName //----------------------------------------------------------------------- public static void TypeMappingErr__UnknownStoreTypeName (ErrSourceID errSrcID, string storeTypeName, string columnSign) { // [2021-11-30] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unknown_StoreTypeName_2); exc .push(storeTypeName) .push(columnSign) .raise(); }//TypeMappingErr__UnknownStoreTypeName //----------------------------------------------------------------------- public static void TypeMappingErr__UnknownStoreTypeName (ErrSourceID errSrcID, string storeTypeName, string columnName, string tableName, string schema) { // [2021-11-30] Tested. var columnSign='{'+columnName+'}'; if(!Object.ReferenceEquals(tableName,null)) { columnSign='{'+tableName+"}."+columnSign; if(!Object.ReferenceEquals(schema,null)) { columnSign='{'+schema+"}."+columnSign; }//if }//if TypeMappingErr__UnknownStoreTypeName (errSrcID, storeTypeName, columnSign); }//TypeMappingErr__UnknownStoreTypeName //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedStoreTypeName (ErrSourceID errSrcID, string actualName, string expectedName) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(actualName,null)); Debug.Assert(!Object.ReferenceEquals(expectedName,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_StoreTypeName_2); exc .push(actualName) .push(expectedName) .raise(); }//TypeMappingErr__UnexpectedStoreTypeName //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedStoreTypeNameBase (ErrSourceID errSrcID, string actualName, string expectedName) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(actualName,null)); Debug.Assert(!Object.ReferenceEquals(expectedName,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_StoreTypeNameBase_2); exc .push(actualName) .push(expectedName) .raise(); }//TypeMappingErr__UnexpectedStoreTypeNameBase //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedSize (ErrSourceID errSrcID, int size) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_Size_1); exc .push(size) .raise(); }//TypeMappingErr__UnexpectedSize //----------------------------------------------------------------------- public static void TypeMappingErr__NotDefinedSize (ErrSourceID errSrcID) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_defined_Size_0); exc.raise(); }//TypeMappingErr__NotDefinedSize //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargeSize (ErrSourceID errSrcID, int actualSize, int maxSize) { // [2020-10-14] Tested. Debug.Assert(maxSize<actualSize); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_Size_2); exc .push(actualSize) .push(maxSize) .raise(); }//TypeMappingErr__TooLargeSize //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedIsFixedLength (ErrSourceID errSrcID, bool actualValue, bool expectedValue) { Debug.Assert(actualValue!=expectedValue); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_IsFixedLength_2); exc .push(actualValue) .push(expectedValue) .raise(); }//TypeMappingErr__UnexpectedIsFixedLength //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedIsUnicode (ErrSourceID errSrcID, bool actualValue, bool expectedValue) { // [2020-10-14] Tested. Debug.Assert(actualValue!=expectedValue); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_IsUnicode_2); exc .push(actualValue) .push(expectedValue) .raise(); }//TypeMappingErr__UnexpectedIsUnicode //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedClrType (ErrSourceID errSrcID, Type actualClrType, Type expectedClrType) { // [2020-10-14] Tested. Debug.Assert(!Object.ReferenceEquals(actualClrType,null)); Debug.Assert(!Object.ReferenceEquals(expectedClrType,null)); Debug.Assert(actualClrType!=expectedClrType); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_ClrType_2); exc .push(actualClrType) .push(expectedClrType) .raise(); }//TypeMappingErr__UnexpectedClrType //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedIsRowVersion (ErrSourceID errSrcID, bool actualValue, bool expectedValue) { // [2020-10-14] Tested. Debug.Assert(actualValue!=expectedValue); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_IsRowVersion_2); exc .push(actualValue) .push(expectedValue) .raise(); }//TypeMappingErr__UnexpectedIsRowVersion //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedPrecision (ErrSourceID errSrcID, int precision) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_Precision_1); exc .push(precision) .raise(); }//TypeMappingErr__UnexpectedPrecision //----------------------------------------------------------------------- public static void TypeMappingErr__NotDefinedPrecision (ErrSourceID errSrcID) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_defined_Precision_0); exc.raise(); }//TypeMappingErr__NotDefinedPrecision //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargePrecision (ErrSourceID errSrcID, int actualPrecision, int maxPrecision) { // [2020-10-14] Tested. Debug.Assert(maxPrecision<actualPrecision); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_Precision_2); exc .push(actualPrecision) .push(maxPrecision) .raise(); }//TypeMappingErr__TooLargePrecision //----------------------------------------------------------------------- public static void TypeMappingErr__NotAllowedDefinitionOfScaleWithoutPrecision (ErrSourceID errSrcID, int scale) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_allowed_definition_of_Scale_without_Precision_1); exc .push(scale) .raise(); }//TypeMappingErr__NotAllowedDefinitionOfScaleWithoutPrecision //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedScale (ErrSourceID errSrcID, int scale) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_Scale_1); exc .push(scale) .raise(); }//TypeMappingErr__UnexpectedScale //----------------------------------------------------------------------- public static void TypeMappingErr__NotDefinedScale (ErrSourceID errSrcID) { // [2020-10-14] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_defined_Scale_0); exc.raise(); }//TypeMappingErr__NotDefinedScale //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargeScale (ErrSourceID errSrcID, int actualScale, int maxScale) { // [2020-10-14] Tested. Debug.Assert(maxScale<actualScale); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_Scale_2); exc .push(actualScale) .push(maxScale) .raise(); }//TypeMappingErr__TooLargeScale //----------------------------------------------------------------------- public static void TypeMappingErr__CantConvertTimeSpanToDatabaseFormat__OutOfRange (ErrSourceID errSrcID, System.TimeSpan actualValue, string databaseTypeName, System.TimeSpan minValidValue, System.TimeSpan maxValidValue) { // [2021-09-29] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__cant_convert_TimeSpan_to_database_format__out_of_range__4); exc .push(actualValue) .push(databaseTypeName) .push(minValidValue) .push(maxValidValue) .raise(); }//TypeMappingErr__CantConvertTimeSpanToDatabaseFormat__OutOfRange //----------------------------------------------------------------------- public static void TypeMappingErr__CantConvertDatabaseValueToTimeSpan__OutOfRange (ErrSourceID errSrcID, System.Decimal actualValue, string databaseTypeName, System.Decimal minValidValue, System.Decimal maxValidValue) { // [2021-09-29] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__cant_convert_database_value_to_TimeSpan__out_of_range__4); exc .push(actualValue) .push(databaseTypeName) .push(minValidValue) .push(maxValidValue) .raise(); }//TypeMappingErr__CantConvertDatabaseValueToTimeSpan__OutOfRange //----------------------------------------------------------------------- public static void TypeMappingErr__CnDialectNotAllowUsageTypeInDDL (ErrSourceID errSrcID, long connectionDialect, string databaseTypeName) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__cn_dialect_does_not_support_usage_of_type_in_DDL_query_2); exc .push(connectionDialect) .push(databaseTypeName) .raise(); }//TypeMappingErr__CnDialectNotAllowUsageTypeInDDL //----------------------------------------------------------------------- public static void TypeMappingErr__MultipleDefinitionOfTypeProperty (ErrSourceID errSrcID, string propertyName, object propertyValue1, object propertyValue2) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(propertyName,null)); Debug.Assert(propertyName.Length>0); Debug.Assert(propertyName.Trim()==propertyName); var errRec =ErrorRecordCreator.TypeMappingErr__MultipleDefinitionOfTypeProperty (errSrcID, propertyName, propertyValue1, propertyValue2); var exc =new LcpiOleDb__DataToolException (errRec); exc.raise(); }//TypeMappingErr__MultipleDefinitionOfTypeProperty //----------------------------------------------------------------------- public static void TypeMappingErr__FailedToParseDataTypeLength (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__failed_to_parse_datatype_length_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__FailedToParseDataTypeLength //----------------------------------------------------------------------- public static void TypeMappingErr__FailedToParseDataTypePrecision (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__failed_to_parse_datatype_precision_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__FailedToParseDataTypePrecision //----------------------------------------------------------------------- public static void TypeMappingErr__FailedToParseDataTypeScale (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__failed_to_parse_datatype_scale_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__FailedToParseDataTypeScale //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargeLengthOfDataType (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_length_of_datatype_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__TooLargeLengthOfDataType //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargePrecisionOfDataType (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_precision_of_datatype_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__TooLargePrecisionOfDataType //----------------------------------------------------------------------- public static void TypeMappingErr__TooLargeScaleOfDataType (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__too_large_scale_of_datatype_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__TooLargeScaleOfDataType //----------------------------------------------------------------------- public static void TypeMappingErr__IncompletedDataTypeDefinition (ErrSourceID errSrcID) { // [2021-10-22] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__incompleted_datatype_definition_0); exc .raise(); }//TypeMappingErr__IncompletedDataTypeDefinition //----------------------------------------------------------------------- public static void TypeMappingErr__IncompletedDataTypeDefinition (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__incompleted_datatype_definition_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__IncompletedDataTypeDefinition //----------------------------------------------------------------------- public static void TypeMappingErr__BadDataTypeDefinition (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var errRec =ErrorRecordCreator.TypeMappingErr__BadDataTypeDefinition (errSrcID, dataTypeSign); Debug.Assert(!Object.ReferenceEquals(errRec,null)); var exc =new LcpiOleDb__DataToolException (errRec); exc.raise(); }//TypeMappingErr__BadDataTypeDefinition //----------------------------------------------------------------------- public static void TypeMappingErr__NoCharSetName (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_defined_charset_name_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__NoCharSetName //----------------------------------------------------------------------- public static void TypeMappingErr__NoSubTypeName (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__not_defined_subtype_name_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__NoSubTypeName //----------------------------------------------------------------------- public static void TypeMappingErr__UnknownBlobSubType (ErrSourceID errSrcID, string blobSubType) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(blobSubType,null)); Debug.Assert(blobSubType.Length>0); Debug.Assert(blobSubType.Trim()==blobSubType); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unknown_blob_subtype_1); exc .push(blobSubType) .raise(); }//TypeMappingErr__UnknownBlobSubType //----------------------------------------------------------------------- public static void TypeMappingErr__DefinitionOfBlobCharsetAllowedOnlyForSubTypeText (ErrSourceID errSrcID) { // [2021-10-22] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__definition_of_blob_charset_allowed_only_for_subtype_text_0); exc.raise(); }//TypeMappingErr__DefinitionOfBlobCharsetAllowedOnlyForSubTypeText //----------------------------------------------------------------------- public static void TypeMappingErr__UnexpectedDataAtEndOfDataTypeDefinition (ErrSourceID errSrcID, string dataTypeSign) { // [2021-10-22] Tested. Debug.Assert(!Object.ReferenceEquals(dataTypeSign,null)); Debug.Assert(dataTypeSign.Length>0); Debug.Assert(dataTypeSign.Trim()==dataTypeSign); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.type_mapping_err__unexpected_data_at_end_of_datatype_definition_1); exc .push(dataTypeSign) .raise(); }//TypeMappingErr__UnexpectedDataAtEndOfDataTypeDefinition //----------------------------------------------------------------------- public static void UnexpectedCommandParameterDirection (ErrSourceID errSrcID, string parameterName, ParameterDirection parameterDirection) { //[2020-10-18] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__unexpected_command_param_direction_2); errRec .push(parameterName) .push(parameterDirection); ThrowSysError.invalid_operation (errRec); }//UnexpectedCommandParameterDirection //----------------------------------------------------------------------- public static void NoCommandParameterValue(ErrSourceID errSrcID, string parameterName) { //[2020-10-18] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__no_command_param_value_1); errRec .push(parameterName); ThrowSysError.invalid_operation (errRec); }//NoCommandParameterValue //----------------------------------------------------------------------- // public static void NoConnectionObject(ErrSourceID errSrcID) // { // var exc=new LcpiOleDb__DataToolException // (com_lib.HResultCode.E_FAIL, // errSrcID, // ErrMessageID.common_err__no_connection_object__0); // // exc.raise(); // }//NoConnectionObject // //----------------------------------------------------------------------- // public static void UnexpectedConnectionObjectType // (ErrSourceID errSrcID, // object connectionObj) // { // Debug.Assert(!Object.ReferenceEquals(connectionObj,null)); // // var exc=new LcpiOleDb__DataToolException // (com_lib.HResultCode.E_FAIL, // errSrcID, // ErrMessageID.common_err__unexpected_connection_object_type__2); // // exc.push(connectionObj.GetType()) // .push(Structure_TypeCache.TypeOf__LcpiDataOleDb__OleDbConnection) // .raise(); // }//UnexpectedConnectionObjectType // //----------------------------------------------------------------------- // public static void UnknownTableType(ErrSourceID errSrcID, // string tableId, // string tableType) // { // Debug.Assert(!Object.ReferenceEquals(tableId,null)); // Debug.Assert(!Object.ReferenceEquals(tableType,null)); // // var exc=new LcpiOleDb__DataToolException // (com_lib.HResultCode.E_FAIL, // errSrcID, // ErrMessageID.schema_err__unknown_table_type__2); // // exc.push(tableId) // .push(tableType) // .raise(); // }//UnknownTableType //----------------------------------------------------------------------- public static void LocalEvalErr__MemberNotSupported (ErrSourceID errSrcID, Structure_MemberId memberId) { Debug.Assert(!Object.ReferenceEquals(memberId,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__member_not_supported_2); errRec .push(memberId.ObjectType) .push(memberId.MemberName); ThrowSysError.invalid_operation(errRec); }//LocalEvalErr__MemberNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__UnaryOperatorNotSupported (ErrSourceID errSrcID, ExpressionType nodeType) { // [2021-04-30] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__unary_operator_not_supported_1); errRec .push(nodeType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__UnaryOperatorNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__UnaryOperatorNotSupported (ErrSourceID errSrcID, ExpressionType nodeType, Type opType) { // [2021-04-30] Tested. Debug.Assert(!Object.ReferenceEquals(opType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__unary_operator_not_supported_2); errRec .push(nodeType) .push(opType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__UnaryOperatorNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__BinaryOperatorNotSupported (ErrSourceID errSrcID, ExpressionType nodeType, Type leftType, Type rightType) { // [2021-04-30] Tested. Debug.Assert(!Object.ReferenceEquals(leftType,null)); Debug.Assert(!Object.ReferenceEquals(rightType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__binary_operator_not_supported_3); errRec .push(nodeType) .push(leftType) .push(rightType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__BinaryOperatorNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__BinaryOperatorNotSupported (ErrSourceID errSrcID, LcpiOleDb__ExpressionType nodeType, System.Type leftType, System.Type rightType) { // [2021-12-10] Tested. Debug.Assert(!Object.ReferenceEquals(leftType,null)); Debug.Assert(!Object.ReferenceEquals(rightType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__binary_operator_not_supported_3); errRec .push(nodeType) .push(leftType) .push(rightType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__BinaryOperatorNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__MethodNotSupported (ErrSourceID errSrcID, MethodInfo methodInfo) { // [2021-04-30] Tested. Debug.Assert(!Object.ReferenceEquals(methodInfo,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.local_eval_err__method_not_supported_1); errRec .push(methodInfo); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__MethodNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__UnexpectedResultTypeOfLogicalExpression (ErrSourceID errSrcID, Type resultType) { // [2021-04-30] Tested. Debug.Assert(!Object.ReferenceEquals(resultType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__unexpected_result_type_of_logical_expression_1); errRec .push(resultType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__UnexpectedResultTypeOfLogicalExpression //----------------------------------------------------------------------- public static void LocalEvalErr__CantRemapMethodCall (ErrSourceID errSrcID, MethodInfo method, Expression newObject, Expression[] newArguments) { // [2021-06-07] Tested. Debug.Assert(!Object.ReferenceEquals(method,null)); Debug.Assert(!Object.ReferenceEquals(newArguments,null)); if(Object.ReferenceEquals(newObject,null)) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__cant_remap_static_method_2); errRec .push(method) .push(Helper__BuildCommaSepTypeList(newArguments)); ThrowSysError.invalid_operation (errRec); }//if Debug.Assert(!Object.ReferenceEquals(newObject,null)); Debug.Assert(!Object.ReferenceEquals(newObject.Type,null)); { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__cant_remap_instance_method_3); errRec .push(method) .push(newObject.Type) .push(Helper__BuildCommaSepTypeList(newArguments)); ThrowSysError.invalid_operation (errRec); }//local }//LocalEvalErr__CantRemapMethodCall //----------------------------------------------------------------------- // public static void LocalEvalErr__AmbiguousRemapMethodCall // (ErrSourceID errSrcID, // MethodInfo method, // Expression[] newArguments, // MethodInfo[] variants) // { // Debug.Assert(!Object.ReferenceEquals(method,null)); // Debug.Assert(!Object.ReferenceEquals(newArguments,null)); // Debug.Assert(!Object.ReferenceEquals(variants,null)); // // var exc=new LcpiOleDb__DataToolException // (com_lib.HResultCode.E_FAIL, // errSrcID, // ErrMessageID.local_eval_err__ambiguous_remap_method_3); // // exc.push(method) // .push(Helper__BuildCommaSepTypeList(newArguments)); // // var sb=new System.Text.StringBuilder(); // // for(int i=0;i!=variants.Length;++i) // { // sb.Append("\n") // .Append(i+1) // .Append(". ") // .Append(Structure_ADP.BuildMethodSign(variants[i])); // }//for i // // exc.push(sb.ToString()); // // exc.raise(); // }//LocalEvalErr__AmbiguousRemapMethodCall //----------------------------------------------------------------------- public static void LocalEvalErr__CantRemapObjectCreation (ErrSourceID errSrcID, System.Type originalType, System.Type targetType, Expression[] targetArguments) { // [2021-04-30] Tested. Debug.Assert(!Object.ReferenceEquals(originalType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); Debug.Assert(!Object.ReferenceEquals(targetArguments,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__cant_remap_object_construction_3); errRec .push(originalType) .push(targetType) .push(Helper__BuildCommaSepTypeList(targetArguments)); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__CantRemapNew //----------------------------------------------------------------------- public static void LocalEvalErr__ComparisonOfArraysWithDifferentLengthNotSupported (ErrSourceID errSrcID, int length1, int length2) { // [2021-12-02] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__comparison_of_arrays_with_different_length_not_supported_2); errRec .push(length1) .push(length2); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__ComparisonOfArraysWithDifferentLengthNotSupported //----------------------------------------------------------------------- public static void LocalEvalErr__FailedToCompareElementOfArrays (ErrSourceID errSrcID, IReadOnlyCollection<int> elementIndex, Exception innerException) { // [2021-12-02] Tested. Debug.Assert(!Object.ReferenceEquals(elementIndex,null)); Debug.Assert(!Object.ReferenceEquals(innerException,null)); Debug.Assert(elementIndex.Count>0); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.local_eval_err__failed_to_compare_element_of_arrays_1); errRec .push(Helper__BuildCommaSepList(elementIndex)); ThrowSysError.invalid_operation (errRec, innerException); }//LocalEvalErr__FailedToCompareElementOfArrays //----------------------------------------------------------------------- public static void LocalEvalErr__CantConvertArrayElementValueToRequiredType (ErrSourceID errSrcID, IReadOnlyCollection<int> elementIndex, System.Type elementValueType, System.Type requiredType) { Debug.Assert(!Object.ReferenceEquals(elementIndex,null)); Debug.Assert(!Object.ReferenceEquals(elementValueType,null)); Debug.Assert(!Object.ReferenceEquals(requiredType,null)); Debug.Assert(elementIndex.Count>0); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_UNSUPPORTEDCONVERSION, errSrcID, ErrMessageID.local_eval_err__cant_convert_array_element_value_to_required_type_3); errRec .push(Helper__BuildCommaSepList(elementIndex)) .push(elementValueType) .push(requiredType); ThrowSysError.invalid_operation (errRec); }//LocalEvalErr__CantConvertArrayElementValueToRequiredType //----------------------------------------------------------------------- public static void CsUtf16Err__BadSequence(ErrSourceID errSrcID, string checkPoint, int offset) { // [2020-10-19] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.cs_utf16_err__bad_sequence__2); exc .push(checkPoint) .push(offset) .raise(); }//CsUtf16Err__BadSequence //----------------------------------------------------------------------- public static void SqlTranslatorErr__MethodNotSupported (ErrSourceID errSrcID, Structure_MethodId methodId) { Debug.Assert(!Object.ReferenceEquals(methodId,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__method_not_supported_1); errRec .push(methodId.ToString()); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__MethodNotSupported //----------------------------------------------------------------------- public static void SqlTranslatorErr__MemberNotSupported (ErrSourceID errSrcID, Structure_MemberId memberId) { Debug.Assert(!Object.ReferenceEquals(memberId,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__member_not_supported_2); errRec .push(memberId.ObjectType) .push(memberId.MemberName); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__MemberNotSupported //----------------------------------------------------------------------- public static void SqlTranslatorErr__UnsupportedBinaryOperatorType (ErrSourceID errSrcID, ExpressionType operatorType) { // [2020-12-28] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__unsupported_binary_operator_type_1); errRec .push(operatorType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__UnsupportedBinaryOperatorType //----------------------------------------------------------------------- public static void SqlTranslatorErr__UnsupportedBinaryOperatorType (ErrSourceID errSrcID, LcpiOleDb__ExpressionType operatorType, System.Type leftType, System.Type rightType) { Debug.Assert(!Object.ReferenceEquals(leftType,null)); Debug.Assert(!Object.ReferenceEquals(rightType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__unsupported_binary_operator_type_3); errRec .push(operatorType) .push(leftType) .push(rightType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__UnsupportedBinaryOperatorType //----------------------------------------------------------------------- public static void SqlTranslatorErr__UnsupportedUnaryOperatorType (ErrSourceID errSrcID, ExpressionType operatorType) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__unsupported_unary_operator_type_1); errRec .push(operatorType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__UnsupportedUnaryOperatorType //----------------------------------------------------------------------- public static void SqlTranslatorErr__UnsupportedUnaryOperatorType (ErrSourceID errSrcID, LcpiOleDb__ExpressionType operatorType) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__unsupported_unary_operator_type_1); errRec .push(operatorType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__UnsupportedUnaryOperatorType //----------------------------------------------------------------------- public static void SqlTranslatorErr__UnsupportedUnaryOperatorType (ErrSourceID errSrcID, LcpiOleDb__ExpressionType operatorType, System.Type operandType, System.Type resultType) { Debug.Assert(!Object.ReferenceEquals(operandType,null)); Debug.Assert(!Object.ReferenceEquals(resultType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_translator_err__unsupported_unary_operator_type_3); errRec .push(operatorType) .push(operandType) .push(resultType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__UnsupportedUnaryOperatorType //----------------------------------------------------------------------- public static void SqlTranslatorErr__CantPresentSqlUnaryOperationAsSqlUnaryExpression (ErrSourceID errSrcID, ExpressionType operationID, System.Type operandType, System.Type clrResultType) { Debug.Assert(!Object.ReferenceEquals(operandType,null)); Debug.Assert(!Object.ReferenceEquals(clrResultType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.sql_translator_err__cant_present_unary_operation_as_SqlUnaryExpression_3); errRec .push(operationID) .push(operandType) .push(clrResultType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__CantPresentSqlUnaryOperationAsSqlUnaryExpression //----------------------------------------------------------------------- public static void SqlTranslatorErr__CantPresentSqlBinaryOperationAsSqlBinaryExpression (ErrSourceID errSrcID, ExpressionType operationID, System.Type leftClrType, System.Type rightClrType) { Debug.Assert(!Object.ReferenceEquals(leftClrType,null)); Debug.Assert(!Object.ReferenceEquals(rightClrType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.sql_translator_err__cant_present_binary_operation_as_SqlBinaryExpression_3); errRec .push(operationID) .push(leftClrType) .push(rightClrType); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__CantPresentSqlBinaryOperationAsSqlBinaryExpression //----------------------------------------------------------------------- public static void SqlTranslatorErr__CantPresentSqlFunctionAsSqlFunctionExpression (ErrSourceID errSrcID, string functionName) { Debug.Assert(!Object.ReferenceEquals(functionName,null)); Debug.Assert(functionName.Length>=0); Debug.Assert(functionName.Trim()==functionName); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.sql_translator_err__cant_present_function_as_SqlFunctionExpression_1); errRec .push(functionName); ThrowSysError.invalid_operation (errRec); }//SqlTranslatorErr__CantPresentSqlFunctionAsSqlFunctionExpression //----------------------------------------------------------------------- public static void SqlGenErr__UnsupportedCastAsBetweenTypes (ErrSourceID errSrcID, System.Type sourceType, System.Type targetType) { // [2020-10-18] Tested. Debug.Assert(!Object.ReferenceEquals(sourceType,null)); Debug.Assert(!Object.ReferenceEquals(targetType,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_UNSUPPORTEDCONVERSION, errSrcID, ErrMessageID.sql_gen_err__unsupported_cast_as_between_types_2); errRec .push(sourceType) .push(targetType); ThrowSysError.invalid_operation (errRec); }//SqlGenErr__UnsupportedCastAsBetweenTypes //----------------------------------------------------------------------- public static void SqlGenErr__DefinitionOfValueInSqlNotSupported (ErrSourceID errSrcID, string sqlTypeName) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_gen_err__definition_of_value_in_sql_not_supported__1); errRec .push(sqlTypeName); ThrowSysError.not_supported (errRec); }//SqlGenErr__DefinitionOfValueInSqlNotSupported //----------------------------------------------------------------------- // removing from public surface private static void SqlGenErr__NotSupportedSqlOperator (ErrSourceID errSrcID, string sqlOperatorSign) { Debug.Assert(!Object.ReferenceEquals(sqlOperatorSign,null)); Debug.Assert(sqlOperatorSign.Length>0); Debug.Assert(sqlOperatorSign==sqlOperatorSign.Trim()); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_gen_err__not_supported_sql_operator__1); (errRec).push(sqlOperatorSign); ThrowSysError.not_supported (errRec); }//SqlGenErr__NotSupportedSqlOperator //----------------------------------------------------------------------- public static void SqlGenErr__NotSupportedSqlOperator__APPLY (ErrSourceID errSrcID) { SqlGenErr__NotSupportedSqlOperator (errSrcID, "APPLY"); }//SqlGenErr__NotSupportedSqlOperator__APPLY //----------------------------------------------------------------------- public static void SqlGenErr__NotSupportedSqlOperator__INTERSECT (ErrSourceID errSrcID) { SqlGenErr__NotSupportedSqlOperator (errSrcID, "INTERSECT"); }//SqlGenErr__NotSupportedSqlOperator__INTERSECT //----------------------------------------------------------------------- public static void SqlGenErr__NotSupportedSqlOperator__EXCEPT (ErrSourceID errSrcID) { SqlGenErr__NotSupportedSqlOperator (errSrcID, "EXCEPT"); }//SqlGenErr__NotSupportedSqlOperator__EXCEPT //----------------------------------------------------------------------- public static void SqlGenErr__TranslationOfMemberNotSupportedInCurrentCnDialect (ErrSourceID errSrcID, int cnDialect, MemberInfo memberInfo) { // [2020-10-18] Tested. Debug.Assert(!Object.ReferenceEquals(memberInfo,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_gen_err__translation_of_member_not_supported_in_current_cn_dialect_2); errRec .push(cnDialect) .push(Structure.Structure_ReflectionUtils.BuildMemberSign(memberInfo)); ThrowSysError.not_supported (errRec); }//SqlGenErr__TranslationOfMemberNotSupportedInCurrentCnDialect //----------------------------------------------------------------------- public static void SqlGenErr__TranslationOfMemberNotSupportedInCurrentCnDialect (ErrSourceID errSrcID, int cnDialect, Structure_MethodId methodId) { Debug.Assert(!Object.ReferenceEquals(methodId,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_gen_err__translation_of_member_not_supported_in_current_cn_dialect_2); errRec .push(cnDialect) .push(methodId.ToString()); ThrowSysError.not_supported (errRec); }//SqlGenErr__TranslationOfMemberNotSupportedInCurrentCnDialect //----------------------------------------------------------------------- public static void SqlGenErr__DecimalPrecisionNotSupportedInCurrentCnDialect (ErrSourceID errSrcID, int cnDialect, string sqlTypeName, int precision) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.sql_gen_err__decimal_precision_not_supported_in_current_cn_dialect_3); errRec .push(cnDialect) .push(sqlTypeName) .push(precision); ThrowSysError.not_supported (errRec); }//SqlGenErr__DecimalPrecisionNotSupportedInCurrentCnDialect //----------------------------------------------------------------------- public static void MSqlGenErr__ComputedColumnNotSupported (ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.msql_gen_err__computed_column_not_supported__0); ThrowSysError.not_supported (errRec); }//MSqlGenErr__ComputedColumnNotSupported //----------------------------------------------------------------------- public static void MSqlGenErr__CantFindTypeMappingForColumn (ErrSourceID errSrcID, string tableName, string columnName) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__cant_find_type_mapping_for_column__2); exc .push(tableName) .push(columnName) .raise(); }//MSqlGenErr__CantFindTypeMappingForColumn //----------------------------------------------------------------------- public static void MSqlGenErr__DifferentSizeOfFkColumnLists (ErrSourceID errSrcID, int cColumns, int cPrincipalColumns) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__bad_fk_definition__different_size_of_column_lists__2); exc .push(cColumns) .push(cPrincipalColumns) .raise(); }//MSqlGenErr__CantFindTypeMappingForColumn //----------------------------------------------------------------------- public static void MSqlGenErr__UnknownFkReferentialAction (ErrSourceID errSrcID, ReferentialAction referentialAction) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__unknown_fk_referential_action__1); exc .push(referentialAction) .raise(); }//MSqlGenErr__UnknownFkReferentialAction //----------------------------------------------------------------------- public static void MSqlGenErr__CantFindTypeMappingForDefaultValue (ErrSourceID errSrcID, System.Type defaultValueClrType) { Debug.Assert(!Object.ReferenceEquals(defaultValueClrType, null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__cant_find_type_mapping_for_default_value__1); exc .push(defaultValueClrType) .raise(); }//MSqlGenErr__CantFindTypeMappingForDefaultValue //----------------------------------------------------------------------- public static void MSqlGenErr__DetectedMultipleDefinitionOfDefaultValue (ErrSourceID errSrcID) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__detected_multiple_definition_of_default_value__0); exc.raise(); }//MSqlGenErr__DetectedMultipleDefinitionOfDefaultValue //----------------------------------------------------------------------- public static void MSqlGenErr__OverflowInCalculationOfAdjustedSequenceStartValue (ErrSourceID errSrcID, CreateSequenceOperation operation) { // [2021-11-10] Tested. Debug.Assert(!Object.ReferenceEquals(operation,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__overflow_in_calculation_of_adjusted_sequence_start_value__3); exc .push(operation.Name) .push(operation.StartValue) .push(operation.IncrementBy) .raise(); }//MSqlGenErr__OverflowInCalculationOfAdjustedSequenceStartValue //----------------------------------------------------------------------- public static void MSqlGenErr__InconsistentTableNamesInAlterColumnOperation (ErrSourceID errSrcID, string oldDataTableName, string newDataTableName) { // [2021-11-10] Tested. //Expected Debug.Assert(!Object.ReferenceEquals(oldDataTableName,null)); Debug.Assert(!Object.ReferenceEquals(newDataTableName,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__inconsistent_table_names_in_alter_column_operation__2); exc .push(oldDataTableName) .push(newDataTableName) .raise(); }//MSqlGenErr__InconsistentTableNamesInAlterColumnOperation //----------------------------------------------------------------------- public static void MSqlGenErr__ColumnDataUsesIncorrectTableName (ErrSourceID errSrcID, int columnIndex, string columnName, string actualTableName, string expectedTableName) { // [2021-11-10] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__column_data_uses_incorrect_table_name__4); exc .push(columnIndex) .push(columnName) .push(actualTableName) .push(expectedTableName) .raise(); }//MSqlGenErr__ColumnDataUsesIncorrectTableName //----------------------------------------------------------------------- public static void MSqlGenErr__BadIndexDefinition_MultipleData (ErrSourceID errSrcID, string indexName, string tableName) { // [2021-11-11] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__bad_index_definition__multiple_data__2); exc .push(indexName) .push(tableName) .raise(); }//MSqlGenErr__BadIndexDefinition_MultipleData //----------------------------------------------------------------------- public static void MSqlGenErr__BadIndexDefinition_NoData (ErrSourceID errSrcID, string indexName, string tableName) { // [2021-11-11] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__bad_index_definition__no_data__2); exc .push(indexName) .push(tableName) .raise(); }//MSqlGenErr__BadIndexDefinition_NoData //----------------------------------------------------------------------- public static void MSqlGenErr__TableNameNotDefined(ErrSourceID errSrcID) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.msql_gen_err__table_name_not_defined__0); exc .raise(); }//MSqlGenErr__TableNameNotDefined //----------------------------------------------------------------------- public static void ColumnModification__ConflictingRowValuesSensitive (ErrSourceID errSrcID, IColumnModification columnModification1, IColumnModification columnModification2) { Debug.Assert(!Object.ReferenceEquals(columnModification1,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Property,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.ColumnName,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Property,null)); //------------------------------------------------------- var primaryKeys =columnModification1.Entry.EntityType.FindPrimaryKey(); Debug.Assert(!Object.ReferenceEquals(primaryKeys,null)); Debug.Assert(!Object.ReferenceEquals(primaryKeys.Properties,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__ConflictingRowValuesSensitive_6); errRec .push(columnModification1.Entry.EntityType.DisplayName()) .push(columnModification2.Entry.EntityType.DisplayName()) .push(columnModification1.Entry.Helper__BuildCurrentValuesString(primaryKeys.Properties)) .push(columnModification1.Entry.Helper__BuildCurrentValuesString(new[] { columnModification1.Property })) .push(columnModification2.Entry.Helper__BuildCurrentValuesString(new[] { columnModification2.Property })) .push(columnModification1.ColumnName); ThrowSysError.invalid_operation (errRec); }//ColumnModification__ConflictingRowValuesSensitive //----------------------------------------------------------------------- public static void ColumnModification__ConflictingRowValues (ErrSourceID errSrcID, IColumnModification columnModification1, IColumnModification columnModification2) { Debug.Assert(!Object.ReferenceEquals(columnModification1,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Property,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.ColumnName,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Property,null)); //------------------------------------------------------- var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__ConflictingRowValues_5); errRec .push(columnModification1.Entry.EntityType.DisplayName()) .push(columnModification2.Entry.EntityType.DisplayName()) .push(new[] { columnModification1.Property }.Helper__Format()) .push(new[] { columnModification2.Property }.Helper__Format()) .push(columnModification1.ColumnName); ThrowSysError.invalid_operation (errRec); }//ColumnModification__ConflictingRowValues //----------------------------------------------------------------------- public static void ColumnModification__ConflictingOriginalRowValuesSensitive (ErrSourceID errSrcID, IColumnModification columnModification1, IColumnModification columnModification2) { Debug.Assert(!Object.ReferenceEquals(columnModification1,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Property,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.ColumnName,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Property,null)); //------------------------------------------------------- var primaryKeys =columnModification1.Entry.EntityType.FindPrimaryKey(); Debug.Assert(!Object.ReferenceEquals(primaryKeys,null)); Debug.Assert(!Object.ReferenceEquals(primaryKeys.Properties,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__ConflictingOriginalRowValuesSensitive_6); errRec .push(columnModification1.Entry.EntityType.DisplayName()) .push(columnModification2.Entry.EntityType.DisplayName()) .push(columnModification1.Entry.Helper__BuildCurrentValuesString (primaryKeys.Properties)) .push(columnModification1.Entry.Helper__BuildOriginalValuesString (new[] { columnModification1.Property })) .push(columnModification2.Entry.Helper__BuildOriginalValuesString (new[] { columnModification2.Property })) .push(columnModification1.ColumnName); ThrowSysError.invalid_operation (errRec); }//ColumnModification__ConflictingOriginalRowValuesSensitive //----------------------------------------------------------------------- public static void ColumnModification__ConflictingOriginalRowValues (ErrSourceID errSrcID, IColumnModification columnModification1, IColumnModification columnModification2) { Debug.Assert(!Object.ReferenceEquals(columnModification1,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.Property,null)); Debug.Assert(!Object.ReferenceEquals(columnModification1.ColumnName,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Entry.EntityType,null)); Debug.Assert(!Object.ReferenceEquals(columnModification2.Property,null)); //------------------------------------------------------- var primaryKeys =columnModification1.Entry.EntityType.FindPrimaryKey(); Debug.Assert(!Object.ReferenceEquals(primaryKeys,null)); Debug.Assert(!Object.ReferenceEquals(primaryKeys.Properties,null)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__ConflictingOriginalRowValues_5); errRec .push(columnModification1.Entry.EntityType.DisplayName()) .push(columnModification2.Entry.EntityType.DisplayName()) .push(new[] { columnModification1.Property }.Helper__Format()) .push(new[] { columnModification2.Property }.Helper__Format()) .push(columnModification1.ColumnName); ThrowSysError.invalid_operation (errRec); }//ColumnModification__ConflictingOriginalRowValues //----------------------------------------------------------------------- public static void Schema__DataProviderNotSupportReqRestriction (ErrSourceID errSrcID, string schemaName, string restrictionName) { // [2021-09-23] Tested. Debug.Assert(!string.IsNullOrEmpty(schemaName)); Debug.Assert(!string.IsNullOrEmpty(restrictionName)); var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.schema_err__data_provider_not_support_req_restriction_2); errRec .push(schemaName) .push(restrictionName); ThrowSysError.invalid_operation (errRec); }//Schema__DataProviderNotSupportReqRestriction //----------------------------------------------------------------------- public static void UnknownAnnotation(ErrSourceID errSrcID, string annotationName) { // [2021-09-23] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__unknown_annotation__1); exc .push(annotationName) .raise(); }//UnknownAnnotation //----------------------------------------------------------------------- public static void AnnotationHasUnknownValue<T>(ErrSourceID errSrcID, string annotationName, T annotationValue) { // [2021-09-23] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__annotation_has_unknown_value__2); exc .push(annotationName) .push_object(annotationValue) .raise(); }//AnnotationHasUnknownValue<T> //----------------------------------------------------------------------- public static void AnnotationHasNullValue(ErrSourceID errSrcID, string annotationName) { // [2021-09-23] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__annotation_has_null_value__1); exc .push(annotationName) .raise(); }//AnnotationHasNullValue //----------------------------------------------------------------------- public static void AnnotationHasValueWithUnexpectedType (ErrSourceID errSrcID, string annotationName, System.Type actualValueType) { var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__annotation_has_value_with_unexpected_type__2); exc .push(annotationName) .push(actualValueType) .raise(); }//AnnotationHasValueWithUnexpectedType //----------------------------------------------------------------------- public static void AnnotationHasValueWithUnexpectedType (ErrSourceID errSrcID, string annotationName, System.Type actualValueType, System.Type expectedValueType) { // [2021-09-23] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__annotation_has_value_with_unexpected_type__3); exc .push(annotationName) .push(actualValueType) .push(expectedValueType) .raise(); }//AnnotationHasValueWithUnexpectedType //----------------------------------------------------------------------- public static void MultipleDefinitionOfAnnotation<T> (ErrSourceID errSrcID, string annotationName, T prevValue, T newValue) { // [2021-09-23] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__multiple_definition_of_annotation__3); exc .push(annotationName) .push_object(prevValue) .push_object(newValue) .raise(); }//AnnotationHasValueWithUnexpectedType<T> //----------------------------------------------------------------------- public static void ModelDefinesIncorrectGlobalValueGenerationStrategy (ErrSourceID errSrcID, string strategySign) { // [2021-11-16] Tested. Debug.Assert(!Object.ReferenceEquals(strategySign,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__model_defines_incorrect_global_value_generation_strategy__1); exc .push(strategySign) .raise(); }//ModelDefinesIncorrectGlobalValueGenerationStrategy //----------------------------------------------------------------------- public static void PropertyWithDataTypeIsNotCompatiblyWithValueGenerationStrategy (ErrSourceID errSrcID, string strategySign, System.Type declaringClrType, string propertyName, System.Type propertyDataClrDataType) { // [2021-11-16] Tested. Debug.Assert(!Object.ReferenceEquals(strategySign,null)); Debug.Assert(!Object.ReferenceEquals(declaringClrType,null)); Debug.Assert(!Object.ReferenceEquals(propertyName,null)); Debug.Assert(!Object.ReferenceEquals(propertyDataClrDataType,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__property_with_datatype_is_not_compatible_with_value_generation_strategy__4); exc .push(strategySign) .push(declaringClrType) .push(propertyName) .push(propertyDataClrDataType) .raise(); }//PropertyWithDataTypeIsNotCompatiblyWithValueGenerationStrategy //----------------------------------------------------------------------- public static void ValueGenerationStrategyCantBeDefinedAtModelLevel (ErrSourceID errSrcID, string strategySign) { // [2021-11-16] Tested. Debug.Assert(!Object.ReferenceEquals(strategySign,null)); var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.common_err__value_generation_strategy_cant_be_defined_at_model_level__1); exc .push(strategySign) .raise(); }//ValueGenerationStrategyCantBeDefinedAtModelLevel //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportDropIdentityAttributeFromColumn (ErrSourceID errSrcID) { // [2021-11-10] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_drop_identity_attribute_from_column__0); exc .raise(); }//DbmsErr__FB__FirebirdDoesNotSupportDropIdentityAttributeFromColumn //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportAddIdentityAttributeToColumn (ErrSourceID errSrcID) { // [2021-11-10] Tested. var exc =new LcpiOleDb__DataToolException (com_lib.HResultCode.E_FAIL, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_add_identity_attribute_to_column__0); exc .raise(); }//DbmsErr__FB__FirebirdDoesNotSupportAddIdentityAttributeToColumn //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportRenamingOfTables (ErrSourceID errSrcID) { // [2021-11-11] Tested. var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_renaming_of_tables__0); ThrowSysError.not_supported (errRec); }//DbmsErr__FB__FirebirdDoesNotSupportRenamingOfTables //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportRenamingOfSequences (ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_renaming_of_sequences__0); ThrowSysError.not_supported (errRec); }//DbmsErr__FB__FirebirdDoesNotSupportRenamingOfSequences //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportRenamingOfIndexes (ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_renaming_of_indexes__0); ThrowSysError.not_supported (errRec); }//DbmsErr__FB__FirebirdDoesNotSupportRenamingOfIndexes //----------------------------------------------------------------------- public static void DbmsErr__FB__FirebirdDoesNotSupportSchemas (ErrSourceID errSrcID) { var errRec =new Core.Core_ExceptionRecord (com_lib.HResultCode.DB_E_NOTSUPPORTED, errSrcID, ErrMessageID.dbms_err__fb__firebird_does_not_support_schemas__0); ThrowSysError.not_supported (errRec); }//DbmsErr__FB__FirebirdDoesNotSupportSchemas //helper methods -------------------------------------------------------- private static string Helper__BuildCommaSepTypeList (Expression[] arguments) { Debug.Assert(!Object.ReferenceEquals(arguments,null)); string comma=""; var sb=new System.Text.StringBuilder(); foreach(var a in arguments) { Debug.Assert(!Object.ReferenceEquals(a,null)); sb.Append(comma); sb.Append(a.Type.Extension__BuildHumanName()); comma=", "; }//foreach a return sb.ToString(); }//Helper__BuildCommaSepTypeList //----------------------------------------------------------------------- private static string Helper__BuildCommaSepList (IReadOnlyCollection<int> values) { Debug.Assert(!Object.ReferenceEquals(values,null)); string comma=null; //why not ... var sb=new System.Text.StringBuilder(); foreach(var v in values) { sb.Append(comma); sb.Append(v); comma=", "; }//foreach v return sb.ToString(); }//Helper__BuildCommaSepList //----------------------------------------------------------------------- private static string Helper__BuildCurrentValuesString (this IUpdateEntry entry, IEnumerable<IPropertyBase> properties) { Debug.Assert(!Object.ReferenceEquals(entry,null)); Debug.Assert(!Object.ReferenceEquals(properties,null)); string comma=""; var sb=new System.Text.StringBuilder(); sb.Append('{'); foreach(var p in properties) { Debug.Assert(!Object.ReferenceEquals(p,null)); Debug.Assert(!Object.ReferenceEquals(p.Name,null)); sb.Append(comma); var currentValue=entry.GetCurrentValue(p); sb.Append(p.Name); sb.Append(": "); sb.Append(Helper__BuildValueString(currentValue)); comma=", "; }//foreach sb.Append('}'); return sb.ToString(); }//Helper__BuildCurrentValuesString //----------------------------------------------------------------------- private static string Helper__BuildOriginalValuesString (this IUpdateEntry entry, IEnumerable<IPropertyBase> properties) { Debug.Assert(!Object.ReferenceEquals(entry,null)); Debug.Assert(!Object.ReferenceEquals(properties,null)); string comma=""; var sb=new System.Text.StringBuilder(); sb.Append('{'); foreach(var p in properties) { Debug.Assert(!Object.ReferenceEquals(p,null)); Debug.Assert(!Object.ReferenceEquals(p.Name,null)); sb.Append(comma); var originalValue=entry.GetOriginalValue(p); sb.Append(p.Name); sb.Append(": "); sb.Append(Helper__BuildValueString(originalValue)); comma=", "; }//foreach sb.Append('}'); return sb.ToString(); }//Helper__BuildOriginalValuesString //----------------------------------------------------------------------- private static string Helper__BuildValueString(object propertyValue) { if(Object.ReferenceEquals(propertyValue, null)) return "<null>"; return Convert.ToString(propertyValue, CultureInfo.InvariantCulture); }//Helper__BuildValueString //----------------------------------------------------------------------- private static string Helper__Format (this IEnumerable<IReadOnlyPropertyBase> properties, bool includeTypes=false) { Debug.Assert(!Object.ReferenceEquals(properties,null)); string comma=""; var sb=new System.Text.StringBuilder(); sb.Append('{'); foreach(var p in properties) { Debug.Assert(!Object.ReferenceEquals(p,null)); Debug.Assert(!Object.ReferenceEquals(p.Name,null)); Debug.Assert(!Object.ReferenceEquals(p.ClrType,null)); sb.Append(comma); sb.Append('\''); sb.Append(p.Name); sb.Append('\''); if(includeTypes) { sb.Append(" : "); sb.Append(p.ClrType.DisplayName(fullName: false)); }//if comma=", "; }//foreach p sb.Append('}'); return sb.ToString(); }//Helper__Format };//class ThrowError //////////////////////////////////////////////////////////////////////////////// }//namespace Lcpi.EntityFrameworkCore.DataProvider.LcpiOleDb
//--------------------------------------------------------------------- // <copyright file="QueryBinaryOperation.cs" company="Microsoft"> // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. // </copyright> //--------------------------------------------------------------------- namespace Microsoft.Test.Taupo.Query.Contracts { /// <summary> /// Query binary operations /// </summary> public enum QueryBinaryOperation { /// <summary> /// String concatenation /// </summary> Concat, /// <summary> /// Arithmetic: Add /// </summary> Add, /// <summary> /// Arithmetic: Subtract /// </summary> Subtract, /// <summary> /// Arithmetic: Multiply /// </summary> Multiply, /// <summary> /// Arithmetic: Divide /// </summary> Divide, /// <summary> /// Arithmetic: Modulo /// </summary> Modulo, /// <summary> /// Bitwise: and /// </summary> BitwiseAnd, /// <summary> /// Bitwise: or /// </summary> BitwiseOr, /// <summary> /// Bitwise: exclusive or /// </summary> BitwiseExclusiveOr, /// <summary> /// Logical: and /// </summary> LogicalAnd, /// <summary> /// Logical: or /// </summary> LogicalOr, /// <summary> /// Comparison: EqualTo /// </summary> EqualTo, /// <summary> /// Comparison: NotEqualTo /// </summary> NotEqualTo, /// <summary> /// Comparison: LessThan /// </summary> LessThan, /// <summary> /// Comparison: GreaterThan /// </summary> GreaterThan, /// <summary> /// Comparison: LessThanOrEqualTo /// </summary> LessThanOrEqualTo, /// <summary> /// Comparison: GreaterThanOrEqualTo /// </summary> GreaterThanOrEqualTo, } }
using System; namespace WarframeStatService.Entity.Interface { public interface IActivatable { DateTime Activation { get; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace paa5 { class ClauseReader { private string path; private readonly IList<string> files; private StreamReader fileContent; private StreamWriter outputFile; private double clauseToFormulaRatio; private int clauseCount; private int clausesNumber; private int clauseLimit; public ClauseReader(double ratio) { Console.WriteLine("Type in a path with problems."); //path = Console.ReadLine(); path = @"C:\dev\paa\5\"; files = new List<string>(); files = Directory.GetFiles(path, "*.cnf").ToList(); Console.WriteLine("Got " + files.Count + " files."); clauseCount = 0; clauseToFormulaRatio = ratio; } public void SetOutputFile(StreamWriter of) { outputFile = of; } public string GetPath() { return path; } public int GetVariablesCount() { if (PrepareReader() == "end") { return -1; } string line; do { line = fileContent.ReadLine(); } while (line[0] != 'p'); string[] split = line.Split(' '); clausesNumber = int.Parse(split[4]); int literals = int.Parse(split[2]); clauseLimit = (int)(clauseToFormulaRatio*literals); return literals; } public int[] GetWeights() { if (PrepareReader() == "end") { return null; } string line; do { line = fileContent.ReadLine(); } while (line[0] != 'w'); string[] split = line.Split(' '); int[] weights = new int[split.Length - 1]; // -1 because we need not to count the 'w' symbol for (int i = 1; i < split.Length; i++) { weights[i - 1] = int.Parse(split[i]); } return weights; } public string ReadNextClause() { if (clauseCount < clauseLimit) { string prepared = PrepareReader(); if (prepared == "ok") { clauseCount++; var line = fileContent.ReadLine(); if (line[0] == ' ') { line = line.Remove(0, 1); } return line; } else if (prepared == "end") { return "end"; } else { return prepared; } } else { fileContent.Close(); fileContent = null; clauseCount = 0; return PrepareReader(); } } private string PrepareReader() { if (fileContent != null && (fileContent.Peek() == -1 || fileContent.Peek() == '%')) { fileContent.Close(); fileContent = null; } if (fileContent == null) { clauseCount = 0; if (files.Count > 0) { //OutputWriter.PrintOutput("----- " + files[0] + " -----", outputFile); fileContent = new StreamReader(files[0]); string ret = files[0]; files.RemoveAt(0); return "----- " + ret + " -----"; } else { return "end"; // end of the file } } return "ok"; // you can read from the file } // For testing purposes public void PrintFilesNames() { Console.WriteLine("Printing files in " + path); Console.WriteLine("-------------------------------------"); foreach (string file in files) { Console.WriteLine(file); } } } }
using System.Diagnostics.Tracing; namespace Thundershock.Core.Rendering { /// <summary> /// Defines the format of the depth buffer when creating a <see cref="RenderTarget"/>. /// </summary> public enum DepthFormat { /// <summary> /// No depth buffer is created. /// </summary> None, /// <summary> /// 24 bits per pixel are allocated for depth information. /// </summary> Depth24, /// <summary> /// 24 bits per pixel are allocated for depth information, and 8 are allocated for /// stencil information. /// </summary> Depth24Stencil8 } }
using System; using System.Diagnostics; using System.Net.Mail; using System.Threading.Tasks; using EmailModule; namespace Resgrid.Providers.EmailProvider { public class SmtpClientWrapper : ISmtpClient { private SmtpClient realClient; private bool disposed; public SmtpClientWrapper(SmtpClient realClient) { Invariant.IsNotNull(realClient, "realClient"); this.realClient = realClient; } [DebuggerStepThrough] ~SmtpClientWrapper() { Dispose(false); } [DebuggerStepThrough] public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } public async Task<bool> Send(MailMessage message) { Invariant.IsNotNull(message, "message"); await realClient.SendMailAsync(message); return true; } [DebuggerStepThrough] protected virtual void DisposeCore() { if (realClient != null) { realClient.Dispose(); realClient = null; } } [DebuggerStepThrough] private void Dispose(bool disposing) { if (!disposed && disposing) { DisposeCore(); } disposed = true; } } }
namespace Com.CompanyName.OnlineShop.ComponentLibrary.Migrations { using System.Data.Entity.Migrations; public partial class initial : DbMigration { public override void Up() { CreateTable( "dbo.CartItems", c => new { CartItemId = c.Int(nullable: false, identity: true), Quantity = c.Int(nullable: false), CartId = c.Int(nullable: false), ProductId = c.Int(nullable: false), }) .PrimaryKey(t => t.CartItemId) .ForeignKey("dbo.Carts", t => t.CartId, cascadeDelete: true) .ForeignKey("dbo.Products", t => t.ProductId, cascadeDelete: true) .Index(t => t.CartId) .Index(t => t.ProductId); CreateTable( "dbo.Carts", c => new { CartId = c.Int(nullable: false, identity: true), Status = c.Int(nullable: false), CustomerId = c.Int(nullable: false), }) .PrimaryKey(t => t.CartId) .ForeignKey("dbo.Customers", t => t.CustomerId, cascadeDelete: true) .Index(t => t.CustomerId); CreateTable( "dbo.Customers", c => new { CustomerId = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 50, unicode: false), Email = c.String(maxLength: 256, unicode: false), Password = c.String(maxLength: 50, unicode: false), Address = c.String(maxLength: 100, unicode: false), }) .PrimaryKey(t => t.CustomerId); CreateTable( "dbo.Products", c => new { ProductId = c.Int(nullable: false, identity: true), Name = c.String(nullable: false, maxLength: 50, unicode: false), Description = c.String(maxLength: 100, unicode: false), CategoryId = c.Int(nullable: false), }) .PrimaryKey(t => t.ProductId) .ForeignKey("dbo.Categories", t => t.CategoryId, cascadeDelete: true) .Index(t => t.CategoryId); CreateTable( "dbo.Categories", c => new { CategoryId = c.Int(nullable: false, identity: true), CategoryName = c.String(nullable: false, maxLength: 50, unicode: false), SubCategoryName = c.String(nullable: false, maxLength: 50, unicode: false), }) .PrimaryKey(t => t.CategoryId); } public override void Down() { DropForeignKey("dbo.Products", "CategoryId", "dbo.Categories"); DropForeignKey("dbo.CartItems", "ProductId", "dbo.Products"); DropForeignKey("dbo.Carts", "CustomerId", "dbo.Customers"); DropForeignKey("dbo.CartItems", "CartId", "dbo.Carts"); DropIndex("dbo.Products", new[] { "CategoryId" }); DropIndex("dbo.Carts", new[] { "CustomerId" }); DropIndex("dbo.CartItems", new[] { "ProductId" }); DropIndex("dbo.CartItems", new[] { "CartId" }); DropTable("dbo.Categories"); DropTable("dbo.Products"); DropTable("dbo.Customers"); DropTable("dbo.Carts"); DropTable("dbo.CartItems"); } } }
using System; namespace ConoHaDNS.Models { internal class RecordInfo { public DateTime created_at { get; set; } public string data { get; set; } public object description { get; set; } public string domain_id { get; set; } public object gslb_check { get; set; } public object gslb_region { get; set; } public object gslb_weight { get; set; } public string id { get; set; } public string name { get; set; } public object priority { get; set; } public object ttl { get; set; } public string type { get; set; } public object updated_at { get; set; } } }
namespace Standard { public enum OLECMDID { OPEN = 1, NEW, SAVE, SAVEAS, SAVECOPYAS, PRINT, PRINTPREVIEW, PAGESETUP, SPELL, PROPERTIES, CUT, COPY, PASTE, PASTESPECIAL, UNDO, REDO, SELECTALL, CLEARSELECTION, ZOOM, GETZOOMRANGE, UPDATECOMMANDS, REFRESH, STOP, HIDETOOLBARS, SETPROGRESSMAX, SETPROGRESSPOS, SETPROGRESSTEXT, SETTITLE, SETDOWNLOADSTATE, STOPDOWNLOAD, ONTOOLBARACTIVATED, FIND, DELETE, HTTPEQUIV, HTTPEQUIV_DONE, ENABLE_INTERACTION, ONUNLOAD, PROPERTYBAG2, PREREFRESH, SHOWSCRIPTERROR, SHOWMESSAGE, SHOWFIND, SHOWPAGESETUP, SHOWPRINT, CLOSE, ALLOWUILESSSAVEAS, DONTDOWNLOADCSS, UPDATEPAGESTATUS, PRINT2, PRINTPREVIEW2, SETPRINTTEMPLATE, GETPRINTTEMPLATE, PAGEACTIONBLOCKED = 55, PAGEACTIONUIQUERY, FOCUSVIEWCONTROLS, FOCUSVIEWCONTROLSQUERY, SHOWPAGEACTIONMENU } }
using System.Collections.Generic; namespace Roler.Toolkit.File.Epub.Entity { public class NavOl { public string Id { get; set; } public bool IsHidden { get; set; } public IList<NavLi> Items { get; } = new List<NavLi>(); } }
 using System; [Serializable] public class GD_Misc { public int m_arthStarId; public int m_arthPlanetId; public int m_enduriumElementId; public int m_artifactAnalysisPrice; public int m_baseShipMass; public int m_baseShipVolume; public int m_cargoPodBuyPrice; public int m_cargoPodSellPrice; public int m_cargoPodMass; public int m_cargoPodVolume; public int m_terrainVehicleVolume; }
namespace Plus.Communication.Packets.Outgoing.Inventory.Trading { internal class TradingStartComposer : ServerPacket { public TradingStartComposer(int user1Id, int user2Id) : base(ServerPacketHeader.TradingStartMessageComposer) { WriteInteger(user1Id); WriteInteger(1); WriteInteger(user2Id); WriteInteger(1); } } }
using ImagePipeline.Memory; using ImagePipeline.Testing; using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using System; using Windows.Graphics.Imaging; namespace ImagePipeline.Tests.Memory { /// <summary> /// Basic tests for BitmapCounter /// </summary> [TestClass] public class BitmapCounterTests { private const int MAX_COUNT = 4; private const int MAX_SIZE = MAX_COUNT + 1; private BitmapCounter _bitmapCounter; /// <summary> /// Initialize /// </summary> [TestInitialize] public void Initialize() { _bitmapCounter = new BitmapCounter(MAX_COUNT, MAX_SIZE); } /// <summary> /// Tests the basic operations /// </summary> [TestMethod] public void TestBasic() { using (SoftwareBitmap bitmap1 = BitmapForSize(1), bitmap2 = BitmapForSize(2), bitmap3 = BitmapForSize(1)) { AssertState(0, 0); Assert.IsTrue(_bitmapCounter.Increase(bitmap1)); AssertState(1, 1); Assert.IsTrue(_bitmapCounter.Increase(bitmap2)); AssertState(2, 3); _bitmapCounter.Decrease(bitmap3); AssertState(1, 2); } } /// <summary> /// Tests if the size decreases too much /// </summary> [TestMethod] public void TestDecreaseTooMuch() { using (SoftwareBitmap bitmap1 = BitmapForSize(1), bitmap2 = BitmapForSize(2)) { try { Assert.IsTrue(_bitmapCounter.Increase(bitmap1)); _bitmapCounter.Decrease(bitmap2); Assert.Fail(); } catch (ArgumentException) { // This is expected } } } /// <summary> /// Tests if the bitmap count decreases too much /// </summary> [TestMethod] public void TestDecreaseTooMany() { using (SoftwareBitmap bitmap1 = BitmapForSize(2), bitmap2 = BitmapForSize(1), bitmap3 = BitmapForSize(1)) { try { Assert.IsTrue(_bitmapCounter.Increase(bitmap1)); _bitmapCounter.Decrease(bitmap2); _bitmapCounter.Decrease(bitmap3); Assert.Fail(); } catch (ArgumentException) { // This is expected } } } /// <summary> /// Tests the max size allocation /// </summary> [TestMethod] public void TestMaxSize() { using (SoftwareBitmap bitmap = BitmapForSize(MAX_SIZE)) { Assert.IsTrue(_bitmapCounter.Increase(bitmap)); AssertState(1, MAX_SIZE); } } /// <summary> /// Tests the max count allocation /// </summary> [TestMethod] public void TestMaxCount() { for (int i = 0; i < MAX_COUNT; ++i) { var bitmap = BitmapForSize(1); _bitmapCounter.Increase(bitmap); bitmap.Dispose(); } AssertState(MAX_COUNT, MAX_COUNT); } /// <summary> /// Tests the allocation which exceeds the max size /// </summary> [TestMethod] public void IncreaseTooBigObject() { using (SoftwareBitmap bitmap = BitmapForSize(MAX_SIZE + 1)) { Assert.IsFalse(_bitmapCounter.Increase(BitmapForSize(MAX_SIZE + 1))); AssertState(0, 0); } } /// <summary> /// Tests the allocation which exceeds the max count /// </summary> [TestMethod] public void IncreaseTooManyObjects() { for (int i = 0; i < MAX_COUNT; ++i) { var bitmap = BitmapForSize(1); _bitmapCounter.Increase(bitmap); bitmap.Dispose(); } using (SoftwareBitmap bitmap = BitmapForSize(1)) { Assert.IsFalse(_bitmapCounter.Increase(bitmap)); AssertState(MAX_COUNT, MAX_COUNT); } } private void AssertState(int count, long size) { Assert.AreEqual(count, _bitmapCounter.GetCount()); Assert.AreEqual(size, _bitmapCounter.GetSize()); } private SoftwareBitmap BitmapForSize(int size) { return MockBitmapFactory.Create(size, 1, BitmapPixelFormat.Gray8); } } }
using System.Threading.Tasks; using NUnit.Framework; using HADotNet.Core; using HADotNet.Core.Clients; using HADotNet.Entities.Models; using HADotNet.Entities.Tests.Infrastructure; namespace HADotNet.Entities.Tests.Models { public class ClimateTest { private const string MY_CLIMATE = "my_climate"; private EntitiesService _entitiesService; [SetUp] public void Setup() { ClientHelper.InitializeClientFactory(); var statesClient = ClientFactory.GetClient<StatesClient>(); var entityClient = ClientFactory.GetClient<EntityClient>(); _entitiesService = new EntitiesService(entityClient, statesClient); } [Test, Explicit] public async Task SetHvacMode_ShouldSetHvacMode() { var climate = await _entitiesService.GetEntity<Climate>(MY_CLIMATE); await climate.SetHvacMode("auto"); Assert.AreEqual("auto", climate.HvacAction); } } }
// Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information. namespace Remote.Linq.Expressions { using Aqua.TypeSystem; using System; using System.Runtime.Serialization; using System.Xml.Serialization; [Serializable] [DataContract] [KnownType(typeof(MemberAssignment)), XmlInclude(typeof(MemberAssignment))] [KnownType(typeof(MemberListBinding)), XmlInclude(typeof(MemberListBinding))] [KnownType(typeof(MemberMemberBinding)), XmlInclude(typeof(MemberMemberBinding))] public abstract class MemberBinding { protected MemberBinding(MemberInfo member) { Member = member; } public abstract MemberBindingType BindingType { get; } [DataMember(Order = 1)] public MemberInfo Member { get; set; } } }
using System.Collections.Generic; namespace StrategyWithAbstractClass.Sort { public abstract class SortStrategy { public override string ToString() { return this.GetType().Name; } public abstract void Sort(List<string> list); } }
using Laser.Orchard.StartupConfig.Models; using Laser.Orchard.StartupConfig.Settings; using Orchard.ContentManagement; using Orchard.ContentManagement.MetaData.Models; using Orchard.CustomForms.Services; using Orchard.Environment.Extensions; using System; namespace Laser.Orchard.StartupConfig.Services { [OrchardFeature("Laser.Orchard.StartupConfig.FrontendEditorConfiguration")] public class ConfigurableEditorBuilderWrapper : IEditorBuilderWrapper { private readonly IContentManager _contentManager; private readonly IFrontEndEditService _frontEndEditService; public ConfigurableEditorBuilderWrapper( IContentManager contentManager, IFrontEndEditService frontEndEditService) { _contentManager = contentManager; _frontEndEditService = frontEndEditService; } public dynamic BuildEditor(IContent content) { if (content.Is<FrontendEditConfigurationPart>()) { return _frontEndEditService.BuildFrontEndShape( _contentManager.BuildEditor(content), PartTest, FieldTest); } return _contentManager.BuildEditor(content); } public dynamic UpdateEditor(IContent content, IUpdateModel updateModel) { if (content.Is<FrontendEditConfigurationPart>()) { return _frontEndEditService.BuildFrontEndShape( _contentManager.UpdateEditor(content, updateModel), PartTest, FieldTest); } return _contentManager.UpdateEditor(content, updateModel); } Func<ContentTypePartDefinition, string, bool> PartTest = (ctpd, typeName) => ctpd.PartDefinition.Name == typeName || // for fields added to the ContentType directly AllowEdit(ctpd); Func<ContentPartFieldDefinition, bool> FieldTest = (cpfd) => AllowEdit(cpfd); private static bool AllowEdit(ContentPartFieldDefinition cpfd) { var settings = cpfd ?.Settings ?.GetModel<FrontendEditorConfigurationSettings>(); if (settings != null) { return settings.AllowFrontEndEdit; } return false; } private static bool AllowEdit(ContentTypePartDefinition ctpd) { var settings = ctpd ?.Settings ?.GetModel<FrontendEditorConfigurationSettings>(); if (settings != null) { return settings.AllowFrontEndEdit; } return false; } } }
using System.Collections.Generic; namespace SilupostWeb.Data.Core { public interface IRepository<T> { List<T> GetAll(); T Find(string id); string Add(T model); bool Remove(string id); bool Update(T model); } }
using System.Collections.Generic; using System.Text.Json.Serialization; namespace Palantir.Homatic { public record ChannelInformation { public string Address { get; init; } public int AesActive { get; init; } public string AvailableFirmware { get; init; } public object Children { get; init; } public int Direction { get; init; } public string Firmware { get; init; } public int Flags { get; init; } public string Group { get; init; } public string Identifier { get; init; } public int Index { get; init; } public string Interface { get; init; } public string LinkSourceRoles { get; init; } public string LinkTargetRoles { get; init; } public IEnumerable<string> Paramsets { get; } = new List<string>(); public string Parent { get; init; } public string ParentType { get; init; } public int RfAddress { get; init; } public int Roaming { get; init; } public int RxMode { get; init; } public string Team { get; init; } public object TeamChannels { get; init; } public string TeamTag { get; init; } public string Title { get; init; } public string Type { get; init; } public int Version { get; init; } [JsonPropertyName("~links")] public IEnumerable<Link> Links { get; init; } = new List<Link>(); } }
using System; using System.Collections.Generic; using System.Text; using kkde.screen.control; using System.Drawing; using System.Xml; namespace kkde.screen { /// <summary> /// スクリーンコントロール用インターフェース /// </summary> public interface IScreenControl { /// <summary> /// パラメーターの取得(プロパティエディタに表示するプロパティ) /// </summary> /// <returns></returns> BaseType GetPropertyParam(); /// <summary> /// 画像ファイルパスが変更されたときに呼ばれるメソッド /// </summary> /// <param name="filePath"></param> void SetImagePath(String filePath); /// <summary> /// 移動用メソッド(プロパティエディタで位置の値を変更したときに実行するメソッド) /// </summary> /// <param name="pos"></param> void MoveControl(Point pos); /// <summary> /// 現在のコントロールの情報をXMLに書き出す /// </summary> /// <param name="xw"></param> void WriteXml(XmlTextWriter xw); /// <summary> /// XMLからコントロールの情報を読み込む /// </summary> /// <param name="xr"></param> void ReadXml(XmlTextReader xr); } }
using System; using System.Collections.Generic; using System.Threading.Tasks; using SWATProject.Models; namespace SWATProject.Interfaces { public interface IRestInterface { Task<bool> RegisterUser(string email, string password, string confirmPassword); Task<TokenResponse> GetToken(string email, string password); Task<List<Event>> GetEvents(); } }