content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (c) 2003-2008 by AG-Software * * All Rights Reserved. * * Contact information for AG-Software is available at http://www.ag-software.de * * * * Licence: * * The agsXMPP SDK is released under a dual licence * * agsXMPP can be used under either of two licences * * * * A commercial licence which is probably the most appropriate for commercial * * corporate use and closed source projects. * * * * The GNU Public License (GPL) is probably most appropriate for inclusion in * * other open source projects. * * * * See README.html for details. * * * * For general enquiries visit our website at: * * http://www.ag-software.de * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ using System; using agsXMPP.protocol.Base; using agsXMPP.Xml.Dom; namespace agsXMPP.protocol.iq.roster { // jabber:iq:roster // <iq from="user@server.com/Office" id="doroster_1" type="result"> // <query xmlns="jabber:iq:roster"> // <item subscription="both" name="juiliet" jid="11111@icq.myjabber.net"><group>ICQ</group></item> // <item subscription="both" name="roman" jid="22222@icq.myjabber.net"><group>ICQ</group></item> // <item subscription="both" name="angie" jid="33333@icq.myjabber.net"><group>ICQ</group></item> // <item subscription="both" name="bob" jid="44444@icq.myjabber.net"><group>ICQ</group></item> // </query> // </iq> // # "none" -- the user does not have a subscription to the contact's presence information, and the contact does not have a subscription to the user's presence information // # "to" -- the user has a subscription to the contact's presence information, but the contact does not have a subscription to the user's presence information // # "from" -- the contact has a subscription to the user's presence information, but the user does not have a subscription to the contact's presence information // # "both" -- both the user and the contact have subscriptions to each other's presence information // TODO rename to Ask and move to a seperate file, so it matches better to all other enums public enum AskType { NONE = -1, subscribe, unsubscribe } // TODO rename to Subscription and move to a seperate file, so it matches better to all other enums public enum SubscriptionType { none, to, from, both, remove } /// <summary> /// Item is used in jabber:iq:roster, jabber:iq:search /// </summary> public class RosterItem : agsXMPP.protocol.Base.RosterItem { public RosterItem() : base() { this.Namespace = Uri.IQ_ROSTER; } public RosterItem(Jid jid) : this() { Jid = jid; } public RosterItem(Jid jid, string name) : this(jid) { Name = name; } public SubscriptionType Subscription { get { return (SubscriptionType) GetAttributeEnum("subscription", typeof(SubscriptionType)); } set { SetAttribute("subscription", value.ToString()); } } public AskType Ask { get { return (AskType) GetAttributeEnum("ask", typeof(AskType)); } set { if (value == AskType.NONE) RemoveAttribute("ask"); else SetAttribute("ask", value.ToString()); } } } }
32.675926
172
0.598186
[ "MIT" ]
MrAnderson1989/agsXMPP-WinFormIM
agsxmpp/protocol/iq/roster/RosterItem.cs
3,529
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.Batch.V20170901.Outputs { [OutputType] public sealed class ScaleSettingsResponse { /// <summary> /// This property and fixedScale are mutually exclusive and one of the properties must be specified. /// </summary> public readonly Outputs.AutoScaleSettingsResponse? AutoScale; /// <summary> /// This property and autoScale are mutually exclusive and one of the properties must be specified. /// </summary> public readonly Outputs.FixedScaleSettingsResponse? FixedScale; [OutputConstructor] private ScaleSettingsResponse( Outputs.AutoScaleSettingsResponse? autoScale, Outputs.FixedScaleSettingsResponse? fixedScale) { AutoScale = autoScale; FixedScale = fixedScale; } } }
32.222222
108
0.67931
[ "Apache-2.0" ]
pulumi-bot/pulumi-azure-native
sdk/dotnet/Batch/V20170901/Outputs/ScaleSettingsResponse.cs
1,160
C#
namespace Pets.Platform.Permissions.Core; public static class GenericTypeExtensions { public static string GetGenericTypeName(this Type type) { var typeName = string.Empty; if (type.IsGenericType) { var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray()); typeName = $"{type.Name.Remove(type.Name.IndexOf('`'))}<{genericTypes}>"; } else { typeName = type.Name; } return typeName; } public static string GetGenericTypeName(this object @object) { return @object.GetType().GetGenericTypeName(); } }
25.769231
106
0.6
[ "MIT" ]
11pets/Pets.Platform.Permissions
Pets.Platform.Permissions.Core/SeedWork/GenericTypeExtensions.cs
672
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using Boku.Base; using Boku.Common; using Boku.Audio; using Boku.Fx; namespace Boku { public class TitleScreen : GameObject, INeedsDeviceReset { protected class Shared { public bool waitMode = false; } protected class UpdateObj : UpdateObject { private Shared shared = null; public UpdateObj(ref Shared shared) { this.shared = shared; } // end of UpdateObj c'tor public override void Update() { } // end of UpdateObj Update() public override void Activate() { } public override void Deactivate() { } } // end of class UpdateObj protected class RenderObj : RenderObject, INeedsDeviceReset { private Shared shared = null; private Texture2D backgroundTexture = null; private Texture2D dotTexture = null; private Texture2D waitTexture = null; private float kMaxRadius = 32.0f; public class Dot { public Vector2 position; // Center of dot, screen coords. public float radius = 32.0f; // In pixels. public float alpha = 1.0f; } private Dot[] dots = null; public RenderObj(ref Shared shared) { this.shared = shared; dots = new Dot[4]; for (int i = 0; i < 4; i++) { dots[i] = new Dot(); dots[i].position = new Vector2(413 + 56 * i, 280); } } // end of RenderObj c'tor public override void Render(Camera camera) { GraphicsDevice device = BokuGame.bokuGame.GraphicsDevice; // Animate the dots... double tic = Time.WallClockTotalSeconds; tic *= 2.0; // Speed up time? for (int i = 0; i < 4; i++) { float t = (float)tic + 5.0f - 0.5f * i; t %= 6.0f; if (t > 4.0f) { dots[i].radius = 0.0f; dots[i].alpha = 0.0f; } else { t *= 0.5f; if (t > 1.0f) t = 2.0f - t; t = TwitchCurve.Apply(t, TwitchCurve.Shape.EaseOut); dots[i].radius = t * kMaxRadius; dots[i].alpha = t; } } Vector2 screenSize = BokuGame.ScreenSize; #if NETFX_CORE // For some reason, right at the start, this shows up as 0, 0. if (screenSize == Vector2.Zero) { screenSize = new Vector2(device.Viewport.Width, device.Viewport.Height); } #endif Vector2 backgroundSize = new Vector2(backgroundTexture.Width, backgroundTexture.Height); Vector2 logoSize = new Vector2(logoTexture.Width, logoTexture.Height); Vector2 position = (screenSize - backgroundSize) / 2.0f; // Clamp to pixels. position.X = (int)position.X; position.Y = (int)position.Y; // Clear the screen & z-buffer. InGame.Clear(Color.Black); SpriteBatch batch = UI2D.Shared.SpriteBatch; batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied); { // Apply the background. batch.Draw(backgroundTexture, position, Color.White); // Render dots. for (int i = 0; i < 4; i++) { Vector2 size = new Vector2(dots[i].radius); Vector2 pos = position + dots[i].position - size; size *= 2; Color color = new Color(1, 1, 1, dots[i].alpha); batch.Draw(dotTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y), color); // Reflection color = new Color(1, 1, 1, dots[i].alpha * 0.15f); batch.Draw(dotTexture, new Rectangle((int)pos.X, (int)pos.Y + 150, (int)size.X, (int)size.Y), color); } // MS logo. position = (screenSize - logoSize) / 2.0f + new Vector2(0, screenSize.Y / 4.0f); // Clamp to pixels. position.X = (int)position.X; position.Y = (int)position.Y; batch.Draw(logoTexture, position, Color.White); // If in wait mode, show texture. if (shared.waitMode) { Vector2 size = new Vector2(waitTexture.Width, waitTexture.Height); Vector2 pos = screenSize * 0.5f - size * 0.5f; pos.Y -= 50; batch.Draw(waitTexture, new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y), Color.White); } } batch.End(); } // end of Render() public override void Activate() { } public override void Deactivate() { } public void LoadContent(bool immediate) { // Load the textures. if (backgroundTexture == null) { backgroundTexture = BokuGame.Load<Texture2D>(BokuGame.Settings.MediaPath + @"Textures\Loading"); } if (dotTexture == null) { dotTexture = BokuGame.Load<Texture2D>(BokuGame.Settings.MediaPath + @"Textures\LoadingDot"); } if (waitTexture == null) { waitTexture = BokuGame.Load<Texture2D>(BokuGame.Settings.MediaPath + @"Textures\Terrain\WaitPicture"); } } // end of TitleScreen RenderObj LoadContent() public void InitDeviceResources(GraphicsDevice device) { } public void UnloadContent() { BokuGame.Release(ref backgroundTexture); BokuGame.Release(ref logoTexture); BokuGame.Release(ref dotTexture); BokuGame.Release(ref waitTexture); } // end of TitleScreen RenderObj UnloadContent() /// <summary> /// Recreate render targets /// </summary> /// <param name="graphics"></param> public void DeviceReset(GraphicsDevice device) { } } // end of class RenderObj // // TitleScreen // private RenderObj renderObj = null; private UpdateObj updateObj = null; private Shared shared = null; private enum States { Inactive, Active, } private States state = States.Inactive; private States pendingState = States.Inactive; public bool WaitMode { set { shared.waitMode = value; } } // c'tor public TitleScreen() { shared = new Shared(); renderObj = new RenderObj(ref shared); updateObj = new UpdateObj(ref shared); } // end of TitleScreen c'tor private void ContentLoadComplete() { WaitMode = true; } #if NETFX_CORE /// <summary> /// Hacked render call to help make the WinRT startup look better. /// </summary> public void Render() { renderObj.UnloadContent(); renderObj.LoadContent(true); renderObj.Render(null); } #endif public override bool Refresh(List<UpdateObject> updateList, List<RenderObject> renderList) { bool result = false; if (state != pendingState) { if (pendingState == States.Active) { updateList.Add(updateObj); updateObj.Activate(); renderList.Add(renderObj); renderObj.Activate(); BokuGame.Audio.PlayStartupSound(); } else { updateObj.Deactivate(); updateList.Remove(updateObj); renderObj.Deactivate(); renderList.Remove(renderObj); // Since we never come back to this object, flush the device dependent textures. UnloadContent(); } state = pendingState; } return result; } // end of TitleScreen Refresh() override public void Activate() { if (state != States.Active) { pendingState = States.Active; BokuGame.objectListDirty = true; #if !NETFX_CORE // Bring window to top. bool prevTopMost = MainForm.Instance.TopMost; MainForm.Instance.TopMost = true; MainForm.Instance.TopMost = prevTopMost; #endif } } override public void Deactivate() { if (state != States.Inactive) { pendingState = States.Inactive; BokuGame.objectListDirty = true; #if !NETFX_CORE // Bring window to top. bool prevTopMost = MainForm.Instance.TopMost; MainForm.Instance.TopMost = true; MainForm.Instance.TopMost = prevTopMost; #endif } } #region INeedsDeviceReset Members public void LoadContent(bool immediate) { BokuGame.Load(renderObj, immediate); } // end of TitleScreen LoadContent() public void InitDeviceResources(GraphicsDevice device) { } public void UnloadContent() { BokuGame.Unload(renderObj); } // end of TitleScreen UnloadContent() /// <summary> /// Recreate render targets /// </summary> /// <param name="graphics"></param> public void DeviceReset(GraphicsDevice device) { BokuGame.DeviceReset(renderObj, device); } #endregion } // end of class TitleScreen } // end of namespace Boku
31.572222
126
0.479676
[ "MIT" ]
Yash-Codemaster/KoduGameLab
main/Boku/TitleScreen/TitleScreen.cs
11,366
C#
using Xamarin.Forms.Internals; namespace MotoServicesExpress.Validators.Rules { /// <summary> /// Validation Rule to check the email is valid or not. /// </summary> /// <typeparam name="T">Valid email rule parameter</typeparam> [Preserve(AllMembers = true)] public class IsValidEmailRule<T> : IValidationRule<T> { #region Properties /// <summary> /// Gets or sets the Validation Message. /// </summary> public string ValidationMessage { get; set; } #endregion #region Method /// <summary> /// Check the email has valid or not /// </summary> /// <param name="value">The value</param> /// <returns>returns bool value</returns> public bool Check(T value) { try { var addr = new System.Net.Mail.MailAddress($"{value}"); return addr.Address == $"{value}"; } catch { return false; throw; } } #endregion } }
25.068182
71
0.511333
[ "MIT" ]
JomaDoT/MotoServicesExpress
MotoServicesExpress/Validators/Rules/IsValidEmailRule.cs
1,105
C#
// Copyright 2005-2010 Gallio Project - http://www.gallio.org/ // Portions Copyright 2000-2004 Jonathan de Halleux // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using MbUnit.Framework; namespace MbUnit.Tests.Framework { [TestsOn(typeof(Mirror))] public class MirrorTest { [Test] public void NullOfUnknownType_HasExpectedProperties() { Assert.Multiple(() => { Assert.IsTrue(Mirror.NullOfUnknownType.IsNull); Assert.IsTrue(Mirror.NullOfUnknownType.IsNullOfUnknownType); Assert.IsNull(Mirror.NullOfUnknownType.Type); Assert.IsNull(Mirror.NullOfUnknownType.Instance); }); } [Test] public void ForType_Generic_ReturnsTypeMirror() { var mirror = Mirror.ForType<int>(); Assert.Multiple(() => { Assert.IsTrue(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(typeof(int), mirror.Type); Assert.IsNull(mirror.Instance); }); } [Test] public void ForType_BYType_WhenTypeIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType((Type)null)); } [Test] public void ForType_ByType_WhenTypeIsNotNull_ReturnsTypeMirror() { var mirror = Mirror.ForType(typeof(int)); Assert.Multiple(() => { Assert.IsTrue(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(typeof(int), mirror.Type); Assert.IsNull(mirror.Instance); }); } [Test] public void ForType_ByTypeName_WhenTypeNameIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType((string)null)); } [Test] public void ForType_ByTypeName_WhenTypeNameIsValid_ReturnsTypeMirror() { var mirror = Mirror.ForType("System.Int32"); Assert.Multiple(() => { Assert.IsTrue(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(typeof(int), mirror.Type); Assert.IsNull(mirror.Instance); }); } [Test] public void ForType_ByTypeName_WhenTypeNameIsNotValid_Throws() { var ex = Assert.Throws<MirrorException>(() => Mirror.ForType("This_Is_Not_A_Known_Type_Name")); Assert.AreEqual("Could not find type 'This_Is_Not_A_Known_Type_Name'.", ex.Message); } [Test] public void ForType_ByTypeNameAndAssembly_WhenTypeNameIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType(null, typeof(int).Assembly)); } [Test] public void ForType_ByTypeNameAndAssembly_WhenAssemblyIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType("System.Int32", (Assembly)null)); } [Test] public void ForType_ByTypeNameAndAssembly_WhenTypeNameAndAssemblyAreValid_ReturnsTypeMirror() { var mirror = Mirror.ForType("System.Int32", typeof(int).Assembly); Assert.Multiple(() => { Assert.IsTrue(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(typeof(int), mirror.Type); Assert.IsNull(mirror.Instance); }); } [Test] public void ForType_ByTypeNameAndAssembly_WhenTypeNameIsNotValid_Throws() { var ex = Assert.Throws<MirrorException>(() => Mirror.ForType("This_Is_Not_A_Known_Type_Name", typeof(int).Assembly)); Assert.Like(ex.Message, @"Could not find type 'This_Is_Not_A_Known_Type_Name' in assembly 'mscorlib.*'\."); } [Test] public void ForType_ByTypeNameAndAssemblyName_WhenTypeNameIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType(null, "mscorlib")); } [Test] public void ForType_ByTypeNameAndAssemblyName_WhenAssemblyNameIsNull_Throws() { Assert.Throws<ArgumentNullException>(() => Mirror.ForType("System.Int32", (string)null)); } [Test] public void ForType_ByTypeNameAndAssemblyName_WhenTypeNameAndAssemblyNameAreValid_ReturnsTypeMirror() { var mirror = Mirror.ForType("System.Int32", "mscorlib"); Assert.Multiple(() => { Assert.IsTrue(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(typeof(int), mirror.Type); Assert.IsNull(mirror.Instance); }); } [Test] public void ForType_ByTypeNameAndAssemblyName_WhenTypeNameIsNotValid_Throws() { var ex = Assert.Throws<MirrorException>(() => Mirror.ForType("This_Is_Not_A_Known_Type_Name", "mscorlib")); Assert.Like(ex.Message, @"Could not find type 'This_Is_Not_A_Known_Type_Name' in assembly 'mscorlib.*'\."); } [Test] public void ForType_ByTypeNameAndAssemblyName_WhenAssemblyNameIsNotValid_Throws() { var ex = Assert.Throws<MirrorException>(() => Mirror.ForType("System.Int32", "This_Is_Not_A_Known_Assembly_Name")); Assert.Like(ex.Message, @"Could not find type 'System\.Int32' in assembly 'This_Is_Not_A_Known_Assembly_Name'."); } [Test] public void ForObject_WhenObjectIsNull_ReturnsNullOfUnknownType() { var mirror = Mirror.ForObject(null); Assert.AreSame(Mirror.NullOfUnknownType, mirror); } [Test] public void ForObject_WhenObjectIsNotNull_ReturnsObjectMirror() { var obj = this; var mirror = Mirror.ForObject(obj); Assert.Multiple(() => { Assert.IsFalse(mirror.IsNull); Assert.IsFalse(mirror.IsNullOfUnknownType); Assert.AreEqual(obj.GetType(), mirror.Type); Assert.AreSame(obj, mirror.Instance); }); } [Test] public void Indexer_WhenMemberNameIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => { object x = mirror[null]; }); } [Test] public void MemberSetIndexer_WhenIndexArgsIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => { object x = mirror["StaticProperty"][(object[])null]; }); } [Test] public void MemberSetInvoke_WhenArgsIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => mirror["StaticMethod"].Invoke((object[])null)); } [Test] public void MemberSetInvokeAsMirror_WhenArgsIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => mirror["StaticMethod"].InvokeAsMirror((object[])null)); } [Test] public void MemberSetWithSignature_WhenArgTypesIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => mirror["StaticMethod"].WithSignature((Type[])null)); } [Test] public void MemberSetWithGenericArgs_WhenArgTypesIsNull_Throws() { var mirror = Mirror.ForType<SampleObject>(); Assert.Throws<ArgumentNullException>(() => mirror["StaticMethod"].WithGenericArgs((Type[])null)); } [Test] public void Syntax_InstanceField() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); Assert.AreEqual("InstanceField", mirror["InstanceField"].MemberInfo.Name); mirror["InstanceField"].Value = 5; Assert.AreEqual(5, obj.InstanceField); Assert.AreEqual(5, mirror["InstanceField"].Value); Assert.AreEqual(5, mirror["InstanceField"].ValueAsMirror.Instance); } [Test] public void Syntax_StaticField([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); Assert.AreEqual("StaticField", mirror["StaticField"].MemberInfo.Name); mirror["StaticField"].Value = 5; Assert.AreEqual(5, SampleObject.StaticField); Assert.AreEqual(5, mirror["StaticField"].Value); Assert.AreEqual(5, mirror["StaticField"].ValueAsMirror.Instance); } [Test] public void Syntax_InstanceProperty() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); Assert.AreEqual("InstanceProperty", mirror["InstanceProperty"].MemberInfo.Name); mirror["InstanceProperty"].Value = 5; Assert.AreEqual(5, obj.InstanceProperty); Assert.AreEqual(5, mirror["InstanceProperty"].Value); Assert.AreEqual(5, mirror["InstanceProperty"].ValueAsMirror.Instance); } [Test] public void Syntax_StaticProperty([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); Assert.AreEqual("StaticProperty", mirror["StaticProperty"].MemberInfo.Name); mirror["StaticProperty"].Value = 5; Assert.AreEqual(5, SampleObject.StaticProperty); Assert.AreEqual(5, mirror["StaticProperty"].Value); Assert.AreEqual(5, mirror["StaticProperty"].ValueAsMirror.Instance); } [Test] public void Syntax_IndexedProperty() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); var ex = Assert.Throws<MirrorException>(() => { var m = mirror["Item"].MemberInfo; }); Assert.AreEqual("Could not find a unique matching member 'Item' of type 'MbUnit.Tests.Framework.MirrorTest+SampleObject'. There were 2 matches out of 2 members with the same name. Try providing additional information to narrow down the choices.", ex.Message); Assert.AreEqual("Item", mirror["Item"].WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((PropertyInfo)mirror["Item"].WithSignature(typeof(int)).MemberInfo).GetIndexParameters().Length); Assert.AreEqual("Item", mirror["Item"].WithSignature(typeof(int), typeof(int)).MemberInfo.Name); Assert.AreEqual(2, ((PropertyInfo)mirror["Item"].WithSignature(typeof(int), typeof(int)).MemberInfo).GetIndexParameters().Length); Assert.AreEqual(8, mirror["Item"][4].Value); Assert.AreEqual(28, mirror["Item"][4, 7].Value); Assert.AreEqual(8, mirror["Item"][4].ValueAsMirror.Instance); Assert.AreEqual(28, mirror["Item"][4, 7].ValueAsMirror.Instance); mirror["Item"][4].Value = 2; Assert.AreEqual(8, obj.indexerLastSetValue); mirror["Item"][4, 7].Value = 2; Assert.AreEqual(56, obj.indexerLastSetValue); } [Test] public void Syntax_InstanceEvent() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); Assert.AreEqual("InstanceCustomEvent", mirror["InstanceCustomEvent"].MemberInfo.Name); // adding/removing null should work event though no handlers will be registered mirror["InstanceCustomEvent"].AddHandler((Delegate)null); mirror["InstanceCustomEvent"].AddHandler((EventHandler)null); mirror["InstanceCustomEvent"].AddHandler((EventHandler<EventArgs>)null); mirror["InstanceCustomEvent"].RemoveHandler((Delegate)null); mirror["InstanceCustomEvent"].RemoveHandler((EventHandler)null); mirror["InstanceCustomEvent"].RemoveHandler((EventHandler<EventArgs>)null); Assert.AreEqual(6, obj.instanceCustomEventAddRemoveCount); Assert.IsNull(obj.instanceCustomEvent); // adding other handlers int handled = 0; SampleObject.CustomEventHandler nonCoercedHandler = (sender, e) => { handled++; }; mirror["InstanceCustomEvent"].AddHandler(nonCoercedHandler); mirror["InstanceCustomEvent"].AddHandler((sender, e) => { handled++; }); // coerced mirror["InstanceCustomEvent"].AddHandler<EventArgs>((sender, e) => { handled++; }); // coerced Assert.AreEqual(9, obj.instanceCustomEventAddRemoveCount); Assert.IsNotNull(obj.instanceCustomEvent); obj.RaiseInstanceCustomEvent(); Assert.AreEqual(3, handled); // remove handler (non-coerced only) mirror["InstanceCustomEvent"].RemoveHandler(nonCoercedHandler); Assert.AreEqual(10, obj.instanceCustomEventAddRemoveCount); Assert.IsNotNull(obj.instanceCustomEvent); obj.RaiseInstanceCustomEvent(); Assert.AreEqual(5, handled); } [Test] public void Syntax_StaticEvent([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); SampleObject.staticCustomEvent = null; SampleObject.staticCustomEventAddRemoveCount = 0; Assert.AreEqual("StaticCustomEvent", mirror["StaticCustomEvent"].MemberInfo.Name); // adding/removing null should work event though no handlers will be registered mirror["StaticCustomEvent"].AddHandler((Delegate)null); mirror["StaticCustomEvent"].AddHandler((EventHandler)null); mirror["StaticCustomEvent"].AddHandler((EventHandler<EventArgs>)null); mirror["StaticCustomEvent"].RemoveHandler((Delegate)null); mirror["StaticCustomEvent"].RemoveHandler((EventHandler)null); mirror["StaticCustomEvent"].RemoveHandler((EventHandler<EventArgs>)null); Assert.AreEqual(6, SampleObject.staticCustomEventAddRemoveCount); Assert.IsNull(SampleObject.staticCustomEvent); // adding other handlers int handled = 0; SampleObject.CustomEventHandler nonCoercedHandler = (sender, e) => { handled++; }; mirror["StaticCustomEvent"].AddHandler(nonCoercedHandler); mirror["StaticCustomEvent"].AddHandler((sender, e) => { handled++; }); // coerced mirror["StaticCustomEvent"].AddHandler<EventArgs>((sender, e) => { handled++; }); // coerced Assert.AreEqual(9, SampleObject.staticCustomEventAddRemoveCount); Assert.IsNotNull(SampleObject.staticCustomEvent); SampleObject.RaiseStaticCustomEvent(); Assert.AreEqual(3, handled); // remove handler (non-coerced only) mirror["StaticCustomEvent"].RemoveHandler(nonCoercedHandler); Assert.AreEqual(10, SampleObject.staticCustomEventAddRemoveCount); Assert.IsNotNull(SampleObject.staticCustomEvent); SampleObject.RaiseStaticCustomEvent(); Assert.AreEqual(5, handled); } [Test] public void Syntax_InstanceMethod() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); var ex = Assert.Throws<MirrorException>(() => { var m = mirror["InstanceMethod"].MemberInfo; }); Assert.AreEqual("Could not find a unique matching member 'InstanceMethod' of type 'MbUnit.Tests.Framework.MirrorTest+SampleObject'. There were 5 matches out of 5 members with the same name. Try providing additional information to narrow down the choices.", ex.Message); Assert.AreEqual("InstanceMethod", mirror["InstanceMethod"].WithGenericArgs().WithSignature().MemberInfo.Name); Assert.AreEqual(0, ((MethodInfo)mirror["InstanceMethod"].WithGenericArgs().WithSignature().MemberInfo).GetParameters().Length); Assert.AreEqual("InstanceMethod", mirror["InstanceMethod"].WithGenericArgs().WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((MethodInfo)mirror["InstanceMethod"].WithGenericArgs().WithSignature(typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual("InstanceMethod", mirror["InstanceMethod"].WithSignature(typeof(int), typeof(int)).MemberInfo.Name); Assert.AreEqual(2, ((MethodInfo)mirror["InstanceMethod"].WithSignature(typeof(int), typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual("InstanceMethod", mirror["InstanceMethod"].WithGenericArgs(typeof(int)).WithSignature().MemberInfo.Name); Assert.AreEqual(0, ((MethodInfo)mirror["InstanceMethod"].WithGenericArgs(typeof(int)).WithSignature().MemberInfo).GetParameters().Length); Assert.AreEqual("InstanceMethod", mirror["InstanceMethod"].WithGenericArgs(typeof(int)).WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((MethodInfo)mirror["InstanceMethod"].WithGenericArgs(typeof(int)).WithSignature(typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual(5, mirror["InstanceMethod"].WithGenericArgs().Invoke()); Assert.AreEqual(8, mirror["InstanceMethod"].WithGenericArgs().Invoke(4)); Assert.AreEqual(28, mirror["InstanceMethod"].Invoke(4, 7)); Assert.AreEqual(0, mirror["InstanceMethod"].WithGenericArgs(typeof(int)).Invoke()); Assert.AreEqual(4, mirror["InstanceMethod"].WithGenericArgs(typeof(int)).Invoke(4)); } [Test] public void Syntax_InstanceMethod_with_null_arguments() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); var ex = Assert.Throws<MirrorException>(() => { var m = mirror["InstanceMethodForNull"].MemberInfo; }); Assert.AreEqual("Could not find a unique matching member 'InstanceMethodForNull' of type 'MbUnit.Tests.Framework.MirrorTest+SampleObject'. There were 2 matches out of 2 members with the same name. Try providing additional information to narrow down the choices.", ex.Message); Assert.AreEqual("InstanceMethodForNull", mirror["InstanceMethodForNull"].WithSignature(typeof(string)).MemberInfo.Name); Assert.AreEqual(1, ((MethodInfo)mirror["InstanceMethodForNull"].WithSignature(typeof(string)).MemberInfo).GetParameters().Length); Assert.AreEqual("InstanceMethodForNull", mirror["InstanceMethodForNull"].WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((MethodInfo)mirror["InstanceMethodForNull"].WithSignature(typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual(25, mirror["InstanceMethodForNull"].Invoke(25)); Assert.AreEqual(6, mirror["InstanceMethodForNull"].Invoke("abcdef")); Assert.AreEqual(0, mirror["InstanceMethodForNull"].Invoke(new object[] { null })); // Resolve null parameter as string. } [Test] public void Syntax_StaticMethod([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); var ex = Assert.Throws<MirrorException>(() => { var m = mirror["StaticMethod"].MemberInfo; }); Assert.AreEqual("Could not find a unique matching member 'StaticMethod' of type 'MbUnit.Tests.Framework.MirrorTest+SampleObject'. There were 5 matches out of 5 members with the same name. Try providing additional information to narrow down the choices.", ex.Message); Assert.AreEqual("StaticMethod", mirror["StaticMethod"].WithGenericArgs().WithSignature().MemberInfo.Name); Assert.AreEqual(0, ((MethodInfo)mirror["StaticMethod"].WithGenericArgs().WithSignature().MemberInfo).GetParameters().Length); Assert.AreEqual("StaticMethod", mirror["StaticMethod"].WithGenericArgs().WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((MethodInfo)mirror["StaticMethod"].WithGenericArgs().WithSignature(typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual("StaticMethod", mirror["StaticMethod"].WithSignature(typeof(int), typeof(int)).MemberInfo.Name); Assert.AreEqual(2, ((MethodInfo)mirror["StaticMethod"].WithSignature(typeof(int), typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual(5, mirror["StaticMethod"].WithGenericArgs().Invoke()); Assert.AreEqual(8, mirror["StaticMethod"].WithGenericArgs().Invoke(4)); Assert.AreEqual(28, mirror["StaticMethod"].Invoke(4, 7)); Assert.AreEqual(0, mirror["StaticMethod"].WithGenericArgs(typeof(int)).Invoke()); Assert.AreEqual(4, mirror["StaticMethod"].WithGenericArgs(typeof(int)).Invoke(4)); } [Test] public void Syntax_Constructor() { var obj = new SampleObject(); var mirror = Mirror.ForObject(obj); var ex = Assert.Throws<MirrorException>(() => { var m = mirror.Constructor.MemberInfo; }); Assert.AreEqual("Could not find a unique matching member '.ctor' of type 'MbUnit.Tests.Framework.MirrorTest+SampleObject'. There were 2 matches out of 2 members with the same name. Try providing additional information to narrow down the choices.", ex.Message); Assert.AreEqual(".ctor", mirror.Constructor.WithSignature().MemberInfo.Name); Assert.AreEqual(0, ((ConstructorInfo)mirror.Constructor.WithSignature().MemberInfo).GetParameters().Length); Assert.AreEqual(".ctor", mirror.Constructor.WithSignature(typeof(int)).MemberInfo.Name); Assert.AreEqual(1, ((ConstructorInfo)mirror.Constructor.WithSignature(typeof(int)).MemberInfo).GetParameters().Length); Assert.AreEqual(0, ((SampleObject)mirror.Constructor.Invoke()).constructorArg); Assert.AreEqual(4, ((SampleObject)mirror.Constructor.Invoke(4)).constructorArg); } [Test] public void Syntax_StaticConstructor([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); Assert.AreEqual(".cctor", mirror.StaticConstructor.WithSignature().MemberInfo.Name); SampleObject.callsToStaticConstructor = 0; mirror.StaticConstructor.Invoke(); Assert.AreEqual(1, SampleObject.callsToStaticConstructor); } [Test] public void Syntax_NestedType([Column(false, true)] bool usingObjectMirror) { var mirror = usingObjectMirror ? Mirror.ForObject(new SampleObject()) : Mirror.ForType<SampleObject>(); Assert.AreEqual("NestedType", mirror["NestedType"].MemberInfo.Name); Assert.AreEqual("NestedType", mirror["NestedType"].NestedType.Name); } private class SampleObject { internal class CustomEventArgs : EventArgs { } internal delegate void CustomEventHandler(object sender, CustomEventArgs e); internal SampleObject() { } internal SampleObject(int constructorArg) { this.constructorArg = constructorArg; } static SampleObject() { callsToStaticConstructor += 1; } internal static int callsToStaticConstructor; internal int constructorArg; internal int InstanceField = 0; internal int InstanceProperty { get; set; } internal static int StaticField = 0; internal static int StaticProperty { get; set; } internal CustomEventHandler instanceCustomEvent; internal int instanceCustomEventAddRemoveCount; internal static CustomEventHandler staticCustomEvent; internal static int staticCustomEventAddRemoveCount; private event CustomEventHandler InstanceCustomEvent { add { instanceCustomEvent += value; instanceCustomEventAddRemoveCount++; } remove { instanceCustomEvent -= value; instanceCustomEventAddRemoveCount++; } } private static event CustomEventHandler StaticCustomEvent { add { staticCustomEvent += value; staticCustomEventAddRemoveCount++; } remove { staticCustomEvent -= value; staticCustomEventAddRemoveCount++; } } public void RaiseInstanceCustomEvent() { if (instanceCustomEvent != null) instanceCustomEvent(this, new CustomEventArgs()); } public static void RaiseStaticCustomEvent() { if (staticCustomEvent != null) staticCustomEvent(null, new CustomEventArgs()); } internal int indexerLastSetValue; private int this[int x] { get { return x * 2; } set { indexerLastSetValue = x * value; } } private int this[int x, int y] { get { return x * y; } set { indexerLastSetValue = x* y * value; } } private int InstanceMethod() { return 5; } private int InstanceMethod(int x) { return x* 2; } private int InstanceMethod(int x, int y) { return x * y; } private T InstanceMethod<T>() { return default(T); } private T InstanceMethod<T>(T x) { return x; } private int InstanceMethodForNull(string x) { return (x ?? String.Empty).Length; } private int InstanceMethodForNull(int x) { return x; } private static int StaticMethod() { return 5; } private static int StaticMethod(int x) { return x * 2; } private static int StaticMethod(int x, int y) { return x * y; } private static T StaticMethod<T>() { return default(T); } private static T StaticMethod<T>(T x) { return x; } private class NestedType { } } } }
44.344237
291
0.610278
[ "ECL-2.0", "Apache-2.0" ]
Gallio/mbunit-v3
src/MbUnit/MbUnit.Tests/Framework/MirrorTest.cs
28,469
C#
#pragma warning disable using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading; using System.Threading.Tasks; namespace Tests.Scenarios { class ExternalMethodWithCancellationToken { public async Task<int> FooAsync(Stream s, CancellationToken cancellationToken) { var data = new byte[10]; return await s.ReadAsync(data, 0, 10, cancellationToken); } } }
24.2
86
0.700413
[ "MIT" ]
roji/AsyncRewriter
test/AsyncRewriter.Tests/Scenarios/ExternalMethodWithCancellationToken.out.cs
486
C#
using Knx.Common; using Knx.Common.Attribute; namespace Knx.DatapointTypes.Dpt8BitEnumeration { [DatapointType(20, 6, Usage.FunctionBlock)] public class DptLightApplicationArea : Dpt8BitEnum<ApplicationArea> { public DptLightApplicationArea(byte[] payload) : base(payload) { } public DptLightApplicationArea(ApplicationArea value) : base(value) { } } }
24.210526
72
0.617391
[ "MIT" ]
ChrisTTian667/KNX
Knx/DatapointTypes/Dpt8BitEnumeration/DptLightApplicationArea.cs
460
C#
using AutoSaveCommandsApi.Models; using Microsoft.EntityFrameworkCore; namespace AutoSaveCommandsApi { // >dotnet ef migration add testMigration public class DomainModelMsSqlServerContext : DbContext { public DomainModelMsSqlServerContext(DbContextOptions<DomainModelMsSqlServerContext> options) : base(options) { } public DbSet<AboutData> AboutData { get; set; } public DbSet<HomeData> HomeData { get; set; } public DbSet<CommandEntity> CommandEntity { get; set; } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<AboutData>().HasKey(m => m.Id); builder.Entity<HomeData>().HasKey(m => m.Id); builder.Entity<CommandEntity>().HasKey(m => m.Id); base.OnModelCreating(builder); } } }
32.296296
118
0.644495
[ "MIT" ]
damienbod/Angular2AutoSaveCommands
AutoSaveCommandsApi/DomainModelMsSqlServerContext.cs
874
C#
using LinqInfer.Learning.Classification; using LinqInfer.Learning.Features; using LinqInfer.Maths; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; namespace LinqInfer.Learning { public static class LearningExtensions { /// <summary> /// Converts the results of a classifier into a distribution of probabilities by class type. /// </summary> /// <typeparam name="TClass">The class type</typeparam> /// <param name="classifyResults">The classification results</param> /// <returns>A dictionary of TClass / Fraction pairs</returns> public static IDictionary<TClass, Fraction> ToDistribution<TClass>( this IEnumerable<ClassifyResult<TClass>> classifyResults) { var cr = classifyResults.ToList(); var total = cr.Sum(m => m.Score); return cr.ToDictionary(m => m.ClassType, m => Fraction.ApproximateRational(m.Score / total)); } } }
37.37037
105
0.670961
[ "MIT" ]
roberino/linqinfer
src/LinqInfer/Learning/LearningExtensions.cs
1,011
C#
using Newtonsoft.Json; namespace Essensoft.AspNetCore.Payment.Alipay.Notify { /// <summary> /// 电脑网站支付页面回跳参数 /// 更新时间:2019-10-10 /// https://docs.open.alipay.com/203/107090/ /// 暂缺根据官方文档(https://opensupport.alipay.com/support/knowledge/20070/201602425007?ant_source=zsearch) /// 参考:手机网站支付同步通知参数说明 /// </summary> public class AlipayTradePagePayReturn : AlipayNotify { // 公共参数 /// <summary> /// 开发者的app_id /// </summary> [JsonProperty("app_id")] public string AppId { get; set; } /// <summary> /// 接口 /// </summary> [JsonProperty("method")] public string Method { get; set; } /// <summary> /// 签名类型 /// </summary> [JsonProperty("sign_type")] public string SignType { get; set; } /// <summary> /// 签名 /// </summary> [JsonProperty("sign")] public string Sign { get; set; } /// <summary> /// 编码格式 /// </summary> [JsonProperty("charset")] public string Charset { get; set; } /// <summary> /// 时间戳 /// </summary> [JsonProperty("timestamp")] public string Timestamp { get; set; } /// <summary> /// 接口版本 /// </summary> [JsonProperty("version")] public string Version { get; set; } // 业务参数 /// <summary> /// 商户订单号 /// </summary> [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// <summary> /// 支付宝交易号 /// </summary> [JsonProperty("trade_no")] public string TradeNo { get; set; } /// <summary> /// 订单金额 /// </summary> [JsonProperty("total_amount")] public string TotalAmount { get; set; } /// <summary> /// 卖家支付宝用户号 /// </summary> [JsonProperty("seller_id")] public string SellerId { get; set; } } }
23.788235
104
0.492582
[ "MIT" ]
lotosbin/payment
src/Essensoft.AspNetCore.Payment.Alipay/Notify/AlipayTradePagePayReturn.cs
2,216
C#
using System.Linq; using System.Threading.Tasks; using IoTHubClientGeneratorSDK; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; namespace IoTHubClientGenerator { partial class IoTHubPartialClassBuilder { private void CreateReportedProperties() { var programReportedProperties = GetAttributedMembers(nameof(ReportedAttribute)).ToArray(); if (programReportedProperties.Length == 0) return; AppendLine("private void ReportProperty<T>(string propertyName, T data)"); using (Block()) { using (Try(_isErrorHandlerExist)) { AppendLine("var reportedProperties = new Microsoft.Azure.Devices.Shared.TwinCollection();"); AppendLine("reportedProperties[propertyName] = data.ToString();"); AppendLine( $"System.Threading.Tasks.Task.Run(async () => await {_deviceClientPropertyName}.UpdateReportedPropertiesAsync(reportedProperties));"); } using (Catch("System.Exception exception", _isErrorHandlerExist)) { AppendLine("string errorMessage =\"Error updating desired properties\";", _isErrorHandlerExist); AppendLine(_callErrorHandlerPattern, _isErrorHandlerExist); } } AppendLine(); foreach (var reportedProperty in programReportedProperties) { var field = ((FieldDeclarationSyntax) reportedProperty.Key).Declaration.Variables.First(); string fieldName = field.Identifier.ToString(); var semanticModel = _generatorExecutionContext.Compilation.GetSemanticModel(field.SyntaxTree); var clrTypeName = ((IFieldSymbol) semanticModel.GetDeclaredSymbol(field))?.Type.Name; var typeName = Util.GetFriendlyNameOfPrimitive(clrTypeName); var twinPropertyAttribute = reportedProperty.Value.First(v => v.Name.ToString() == nameof(ReportedAttribute).AttName()); var localPropertyName = twinPropertyAttribute.ArgumentList?.Arguments[0].Expression.ToString() .TrimStart('\"').TrimEnd('\"'); var twinPropertyName = twinPropertyAttribute.ArgumentList != null && twinPropertyAttribute.ArgumentList.Arguments.Count > 1 ? twinPropertyAttribute.ArgumentList?.Arguments[1].Expression.ToString().TrimStart('\"') .TrimEnd('\"') : localPropertyName; AppendLine($"public {typeName} {localPropertyName}"); using (Block()) { AppendLine($"get {{ return {fieldName}; }}"); AppendLine($"set {{ {fieldName} = value; ReportProperty(\"{twinPropertyName}\",value);}}"); } AppendLine(); } } } }
47.348485
158
0.58688
[ "MIT" ]
AlexPshul/IoTHubClientGenerator
IoTHubClientGenerator/CreateReportedProperties.cs
3,127
C#
/** * The MIT License * Copyright (c) 2016 Population Register Centre (VRK) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using System; using PTV.Database.DataAccess.Interfaces.Translators; using PTV.Database.Model.Models; using PTV.Framework.Interfaces; using PTV.Framework; using PTV.Domain.Model.Models.OpenApi; using PTV.Database.DataAccess.Caches; namespace PTV.Database.DataAccess.Translators.OpenApi.Channels { [RegisterService(typeof(ITranslator<ServiceChannelArea, VmOpenApiArea>), RegisterType.Transient)] internal class OpenApiServiceChannelAreaTranslator : Translator<ServiceChannelArea, VmOpenApiArea> { private readonly ITypesCache typesCache; public OpenApiServiceChannelAreaTranslator(IResolveManager resolveManager, ITranslationPrimitives translationPrimitives, ICacheManager cacheManager) : base(resolveManager, translationPrimitives) { this.typesCache = cacheManager.TypesCache; } public override VmOpenApiArea TranslateEntityToVm(ServiceChannelArea entity) { throw new NotImplementedException("No translation implemented in OpenApiServiceAreaTranslator!"); } public override ServiceChannelArea TranslateVmToEntity(VmOpenApiArea vModel) { var exists = vModel.OwnerReferenceId.IsAssigned(); var areaTypeId = typesCache.Get<AreaType>(vModel.Type); var definition = CreateViewModelEntityDefinition(vModel) .UseDataContextCreate(input => !exists) .UseDataContextUpdate(input => exists, input => output => input.OwnerReferenceId == output.ServiceChannelVersionedId && input.Code == output.Area.Code && areaTypeId == output.Area.AreaTypeId, def => def.UseDataContextCreate(x => true)); definition.AddNavigation(input => input, output => output.Area); return definition.GetFinal(); } } }
45.953846
156
0.734181
[ "MIT" ]
MikkoVirenius/ptv-1.7
src/PTV.Database.DataAccess/Translators/OpenApi/Channels/OpenApiServiceChannelAreaTranslator.cs
2,989
C#
#region Apache License Version 2.0 /*---------------------------------------------------------------- Copyright 2019 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md ----------------------------------------------------------------*/ #endregion Apache License Version 2.0 /*---------------------------------------------------------------- Copyright (C) 2020 Senparc 文件名:WxFileJsonResult.cs 文件功能描述:文件相关接口 返回结果 创建标识:lishewen - 20190530 ----------------------------------------------------------------*/ using Senparc.Weixin.Entities; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Senparc.Weixin.WxOpen.AdvancedAPIs.Tcb { /// <summary> /// 获取文件上传链接 返回结果 /// </summary> public class WxUploadFileJsonResult : WxJsonResult { /// <summary> /// 上传url /// </summary> public string url { get; set; } public string token { get; set; } public string authorization { get; set; } /// <summary> /// 文件ID /// </summary> public string file_id { get; set; } /// <summary> /// cos文件ID /// </summary> public string cos_file_id { get; set; } } /// <summary> /// 获取文件下载链接 返回结果 /// </summary> public class WxDownloadFileJsonResult : WxJsonResult { /// <summary> /// 文件列表 /// </summary> public Result_File_List[] file_list { get; set; } } /// <summary> /// 删除文件 返回结果 /// </summary> public class WxDeleteFileJsonResult : WxJsonResult { /// <summary> /// 文件列表 /// </summary> public Result_File_List[] delete_list { get; set; } } public class Result_File_List { /// <summary> /// 文件ID /// </summary> public string fileid { get; set; } /// <summary> /// 下载链接 /// </summary> public string download_url { get; set; } /// <summary> /// 状态码 /// </summary> public int status { get; set; } /// <summary> /// 该文件错误信息 /// </summary> public string errmsg { get; set; } } public class FileItem { /// <summary> /// 文件ID /// </summary> public string fileid { get; set; } /// <summary> /// 下载链接有效期 /// </summary> public int max_age { get; set; } } }
26.706897
90
0.531633
[ "Apache-2.0" ]
Frunck8206/WeiXinMPSDK
src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/AdvancedAPIs/Tcb/TcbJson/WxFileJsonResult.cs
3,294
C#
using System.Threading.Tasks; namespace NodeLibrary.Native { public interface IBLEUtils { Task<MetaSenseNode> NodeFactory(NodeInfo devicInfo); Task<NodeInfo> DeviceInfoFromMac(string mac); Task<bool> PairDevice(NodeInfo dev); } }
24.272727
60
0.700375
[ "BSD-3-Clause" ]
metasenseorg/MetaSense
MetaSenseApps/Core.NodeLibrary/Native/IBLEUtils.cs
269
C#
// **************************************************************** // This is free software licensed under the NUnit license. You // may obtain a copy of the license as well as information regarding // copyright ownership at http://nunit.org. // **************************************************************** using System; namespace NUnit.Gui { using System; using System.Windows.Forms; using NUnit.Core; using NUnit.Util; /// <summary> /// Summary description for DetailResults /// </summary> public class DetailResults { private readonly ListBox testDetails; private readonly TreeView notRunTree; public DetailResults(ListBox listBox, TreeView notRun) { testDetails = listBox; notRunTree = notRun; } public void DisplayResults( TestResult results ) { notRunTree.BeginUpdate(); ProcessResults( results ); notRunTree.EndUpdate(); if( testDetails.Items.Count > 0 ) testDetails.SelectedIndex = 0; } private void ProcessResults(TestResult result) { switch( result.ResultState ) { case ResultState.Failure: case ResultState.Error: case ResultState.Cancelled: TestResultItem item = new TestResultItem(result); //string resultString = String.Format("{0}:{1}", result.Name, result.Message); testDetails.BeginUpdate(); testDetails.Items.Insert(testDetails.Items.Count, item); testDetails.EndUpdate(); break; case ResultState.Skipped: case ResultState.NotRunnable: case ResultState.Ignored: notRunTree.Nodes.Add(MakeNotRunNode(result)); break; } if ( result.HasResults ) foreach (TestResult childResult in result.Results) ProcessResults( childResult ); } private static TreeNode MakeNotRunNode(TestResult result) { TreeNode node = new TreeNode(result.Name); TreeNode reasonNode = new TreeNode("Reason: " + result.Message); node.Nodes.Add(reasonNode); return node; } } }
26.506494
83
0.626164
[ "MIT" ]
acken/AutoTest.Net
lib/NUnit/src/NUnit-2.5.9.10348/src/GuiRunner/nunit-gui/DetailResults.cs
2,041
C#
using Assets.Scripts.Define; using Eternity.FlatBuffer; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class NpcShopElementGrid : MonoBehaviour { /// <summary> /// 商品品质 /// </summary> protected Image m_Quality; /// <summary> /// 商品图标 /// </summary> protected Image m_Icon; /// <summary> /// 商品重叠图标 /// </summary> private Image m_Icon2; /// <summary> /// 商品名称 /// </summary> private TMP_Text m_Name; /// <summary> /// 商品等级 /// </summary> private TMP_Text m_Level; /// <summary> /// 单位数量 /// </summary> private TMP_Text m_Bounds; /// <summary> /// 库存 /// </summary> private TMP_Text m_Stock; /// <summary> /// 个人限量 /// </summary> private TMP_Text m_Available; /// <summary> /// 货币类型 /// </summary> private Image m_MoneyIcon; /// <summary> /// 打折价格 /// </summary> private TMP_Text m_Discount; /// <summary> /// 商品售价 /// </summary> private TMP_Text m_Price; /// <summary> /// 未开启变灰显示图片 /// </summary> private Image m_Black; /// <summary> /// 价格 /// </summary> private int m_GoodPrice; /// <summary> /// 商品数据 /// </summary> private ShopItemData m_ShopItemData; /// <summary> /// 初始化控件 /// </summary> public void Init() { m_Quality = TransformUtil.FindUIObject<Image>(transform, "Content/Image_Quality"); m_Icon = TransformUtil.FindUIObject<Image>(transform, "Content/Image_Icon"); m_Icon2 = TransformUtil.FindUIObject<Image>(transform, "Content/Image_Icon2"); m_Name = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/Mask/Label_Name"); m_Level = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/Mask/Label_Lv2"); m_Bounds = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/Label_Num"); m_Stock = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/ShopMessage/Label_Stork "); m_Available = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/ShopMessage/Label_Available"); m_MoneyIcon = TransformUtil.FindUIObject<Image>(transform, "Content/ShopMessage/Money/Icon_Money"); m_Discount = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/ShopMessage/Money/Label_Money_Discount"); m_Price = TransformUtil.FindUIObject<TMP_Text>(transform, "Content/ShopMessage/Money/Label_Money_Sell"); m_Black = TransformUtil.FindUIObject<Image>(transform, "Content/Image_Black"); } /// <summary> /// 设置商品数据 /// </summary> /// <param name="shopWindowVO"></param> /// <param name="isSelect"></param> /// <param name="isList"></param> public void SetData(ShopWindowVO shopWindowVO, bool isSelect, bool isList = false) { Init(); Item m_Item = shopWindowVO.ShopItemConfig.Value.ItemGood.Value; m_ShopItemData = shopWindowVO.ShopItemConfig.Value; m_Quality.color = ColorUtil.GetColorByItemQuality(m_Item.Quality); if (isList) { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id)); } else { UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id)); UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id)); } m_Name.text = TableUtil.GetItemName(m_Item.Id); m_Level.text = TableUtil.ShowLevel(1); m_Bounds.text = m_ShopItemData.Bounds.ToString(); if (shopWindowVO.LimitCount == -1) { m_Available.gameObject.SetActive(false); } else { m_Available.gameObject.SetActive(true); m_Available.text = string.Format(TableUtil.GetLanguageString("shop_text_1012"), shopWindowVO.LimitCount); } if (shopWindowVO.LimitCount < m_ShopItemData.Bounds) { m_Available.color = Color.red; } else { m_Available.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white; } UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopItemData.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopItemData.MoneyType)); if (m_ShopItemData.DisCount == 1) { m_Discount.gameObject.SetActive(false); m_GoodPrice = m_ShopItemData.BuyCost; } else { m_Discount.gameObject.SetActive(true); m_Discount.text = m_ShopItemData.BuyCost.ToString(); m_GoodPrice = Mathf.CeilToInt(m_ShopItemData.BuyCost * m_ShopItemData.DisCount); } m_Price.text = m_GoodPrice.ToString(); if (MoneyeEnough()) { m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1); } else { m_Price.color = Color.red; } if (shopWindowVO.ServerLeftNum == -1) { m_Stock.text = TableUtil.GetLanguageString("shop_text_1010"); } else if (shopWindowVO.ServerLeftNum == 0) { m_Stock.text = TableUtil.GetLanguageString("shop_text_1013"); } else { m_Stock.text = string.Format(TableUtil.GetLanguageString("shop_text_1011"), shopWindowVO.ServerLeftNum); } m_Stock.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white; m_Black.gameObject.SetActive(shopWindowVO.IsOpen == 0); } /// <summary> /// 货币是否充足 /// </summary> /// <param name="MoneyType"></param> /// <returns></returns> public bool MoneyeEnough() { long m_OwnMoney = 0; if (m_ShopItemData.MoneyType == 1) { m_OwnMoney = CurrencyUtil.GetGameCurrencyCount(); } else if (m_ShopItemData.MoneyType == 2) { m_OwnMoney = CurrencyUtil.GetRechargeCurrencyCount(); } if (m_GoodPrice <= m_OwnMoney) { return true; } return false; } }
33.984127
180
0.617001
[ "Apache-2.0" ]
fqkw6/RewriteFrame
other/Scripts/View/Shop/NpcShopElementGrid.cs
6,577
C#
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.live.Model.V20161101; namespace Aliyun.Acs.live.Transform.V20161101 { public class DescribeLiveDomainTranscodeDataResponseUnmarshaller { public static DescribeLiveDomainTranscodeDataResponse Unmarshall(UnmarshallerContext _ctx) { DescribeLiveDomainTranscodeDataResponse describeLiveDomainTranscodeDataResponse = new DescribeLiveDomainTranscodeDataResponse(); describeLiveDomainTranscodeDataResponse.HttpResponse = _ctx.HttpResponse; describeLiveDomainTranscodeDataResponse.RequestId = _ctx.StringValue("DescribeLiveDomainTranscodeData.RequestId"); List<DescribeLiveDomainTranscodeDataResponse.DescribeLiveDomainTranscodeData_TranscodeDataInfo> describeLiveDomainTranscodeDataResponse_transcodeDataInfos = new List<DescribeLiveDomainTranscodeDataResponse.DescribeLiveDomainTranscodeData_TranscodeDataInfo>(); for (int i = 0; i < _ctx.Length("DescribeLiveDomainTranscodeData.TranscodeDataInfos.Length"); i++) { DescribeLiveDomainTranscodeDataResponse.DescribeLiveDomainTranscodeData_TranscodeDataInfo transcodeDataInfo = new DescribeLiveDomainTranscodeDataResponse.DescribeLiveDomainTranscodeData_TranscodeDataInfo(); transcodeDataInfo.Date = _ctx.StringValue("DescribeLiveDomainTranscodeData.TranscodeDataInfos["+ i +"].Date"); transcodeDataInfo.Total = _ctx.IntegerValue("DescribeLiveDomainTranscodeData.TranscodeDataInfos["+ i +"].Total"); transcodeDataInfo.Detail = _ctx.StringValue("DescribeLiveDomainTranscodeData.TranscodeDataInfos["+ i +"].Detail"); describeLiveDomainTranscodeDataResponse_transcodeDataInfos.Add(transcodeDataInfo); } describeLiveDomainTranscodeDataResponse.TranscodeDataInfos = describeLiveDomainTranscodeDataResponse_transcodeDataInfos; return describeLiveDomainTranscodeDataResponse; } } }
53.588235
263
0.809733
[ "Apache-2.0" ]
AxiosCros/aliyun-openapi-net-sdk
aliyun-net-sdk-live/Live/Transform/V20161101/DescribeLiveDomainTranscodeDataResponseUnmarshaller.cs
2,733
C#
// Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Threading.Tasks; using Dolittle.Runtime.Execution; using Microsoft.Extensions.Logging; using Dolittle.Runtime.Services; using Grpc.Core; using Microsoft.Extensions.Hosting; using static Dolittle.Runtime.Embeddings.Contracts.Embeddings; using Dolittle.Runtime.Embeddings.Contracts; using Dolittle.Runtime.Protobuf; using System.Threading; using Dolittle.Runtime.Rudimentary; using System.Runtime.ExceptionServices; using Dolittle.Runtime.ApplicationModel; using Dolittle.Runtime.Embeddings.Store; using Dolittle.Runtime.Embeddings.Store.Definition; using System.Linq; namespace Dolittle.Runtime.Embeddings.Processing { /// <summary> /// Represents the implementation of <see cref="EmbeddingsBase"/>. /// </summary> public class EmbeddingsService : EmbeddingsBase { readonly IExecutionContextManager _executionContextManager; readonly IInitiateReverseCallServices _reverseCallServices; readonly IEmbeddingsProtocol _protocol; readonly IEmbeddingProcessorFactory _embeddingProcessorFactory; readonly IEmbeddingProcessors _embeddingProcessors; readonly IEmbeddingRequestFactory _embeddingRequestFactory; readonly ICompareEmbeddingDefinitionsForAllTenants _embeddingDefinitionComparer; readonly IPersistEmbeddingDefinitionForAllTenants _embeddingDefinitionPersister; readonly ILogger _logger; readonly ILoggerFactory _loggerFactory; readonly IHostApplicationLifetime _hostApplicationLifetime; /// <summary> /// Initializes an instance of the <see cref="EmbeddingsService" /> class. /// </summary> /// <param name="hostApplicationLifetime"></param> /// <param name="executionContextManager"></param> /// <param name="reverseCallServices"></param> /// <param name="protocol"></param> /// <param name="embeddingProcessorFactory"></param> /// <param name="embeddingProcessors"></param> /// <param name="embeddingRequestFactory"></param> /// <param name="embeddingDefinitionComparer"></param> /// <param name="embeddingDefinitionPersister"></param> /// <param name="logger"></param> public EmbeddingsService( IHostApplicationLifetime hostApplicationLifetime, IExecutionContextManager executionContextManager, IInitiateReverseCallServices reverseCallServices, IEmbeddingsProtocol protocol, IEmbeddingProcessorFactory embeddingProcessorFactory, IEmbeddingProcessors embeddingProcessors, IEmbeddingRequestFactory embeddingRequestFactory, ICompareEmbeddingDefinitionsForAllTenants embeddingDefinitionComparer, IPersistEmbeddingDefinitionForAllTenants embeddingDefinitionPersister, ILogger<EmbeddingsService> logger, ILoggerFactory loggerFactory) { _hostApplicationLifetime = hostApplicationLifetime; _executionContextManager = executionContextManager; _reverseCallServices = reverseCallServices; _protocol = protocol; _embeddingProcessorFactory = embeddingProcessorFactory; _embeddingProcessors = embeddingProcessors; _embeddingRequestFactory = embeddingRequestFactory; _embeddingDefinitionComparer = embeddingDefinitionComparer; _embeddingDefinitionPersister = embeddingDefinitionPersister; _logger = logger; _loggerFactory = loggerFactory; } /// <inheritdoc/> public override async Task Connect( IAsyncStreamReader<EmbeddingClientToRuntimeMessage> runtimeStream, IServerStreamWriter<EmbeddingRuntimeToClientMessage> clientStream, ServerCallContext context) { _logger.LogDebug("Connecting Embeddings"); using var cts = CancellationTokenSource.CreateLinkedTokenSource(_hostApplicationLifetime.ApplicationStopping, context.CancellationToken); var connection = await _reverseCallServices.Connect(runtimeStream, clientStream, context, _protocol, context.CancellationToken).ConfigureAwait(false); if (!connection.Success) { return; } var (dispatcher, arguments) = connection.Result; _executionContextManager.CurrentFor(arguments.ExecutionContext); if (_embeddingProcessors.HasEmbeddingProcessors(arguments.Definition.Embedding)) { await dispatcher.Reject( _protocol.CreateFailedConnectResponse($"Failed to register Embedding: {arguments.Definition.Embedding.Value}. Embedding already registered with the same id"), cts.Token).ConfigureAwait(false); return; } if (await RejectIfInvalidDefinition(arguments.Definition, dispatcher, cts.Token).ConfigureAwait(false)) { return; } var persistDefinition = await _embeddingDefinitionPersister.TryPersist(arguments.Definition, cts.Token).ConfigureAwait(false); if (!persistDefinition.Success) { await dispatcher.Reject( _protocol.CreateFailedConnectResponse($"Failed to register Embedding: {arguments.Definition.Embedding.Value}. Failed to persist embedding definition. {persistDefinition.Exception.Message}"), cts.Token).ConfigureAwait(false); return; } var dispatcherTask = dispatcher.Accept(new EmbeddingRegistrationResponse(), cts.Token); var processorTask = _embeddingProcessors.TryStartEmbeddingProcessorForAllTenants( arguments.Definition.Embedding, tenant => _embeddingProcessorFactory.Create( tenant, arguments.Definition.Embedding, new Embedding(arguments.Definition.Embedding, dispatcher, _embeddingRequestFactory, _loggerFactory.CreateLogger<Embedding>()), arguments.Definition.InititalState), cts.Token); var tasks = new[] { dispatcherTask, processorTask }; try { await Task.WhenAny(tasks).ConfigureAwait(false); if (tasks.TryGetFirstInnerMostException(out var ex)) { ExceptionDispatchInfo.Capture(ex).Throw(); } } finally { cts.Cancel(); await Task.WhenAll(tasks).ConfigureAwait(false); } } /// <inheritdoc/> public override async Task<UpdateResponse> Update(UpdateRequest request, ServerCallContext context) { using var cts = CancellationTokenSource.CreateLinkedTokenSource(_hostApplicationLifetime.ApplicationStopping, context.CancellationToken); _executionContextManager.CurrentFor(request.CallContext.ExecutionContext); if (!TryGetRegisteredEmbeddingProcessorForTenant(_executionContextManager.Current.Tenant, request.EmbeddingId.ToGuid(), out var processor, out var failure)) { return new UpdateResponse { Failure = failure }; } var newState = await processor.Update(request.Key, request.State, cts.Token).ConfigureAwait(false); if (!newState.Success) { return new UpdateResponse { Failure = new Dolittle.Protobuf.Contracts.Failure { Id = EmbeddingFailures.FailedToUpdateEmbedding.ToProtobuf(), Reason = $"Failed to update embedding {request.EmbeddingId.ToGuid()} for tenant {_executionContextManager.Current.Tenant.Value} with key {request.Key}. {newState.Exception.Message}" } }; } return new UpdateResponse { State = new Projections.Contracts.ProjectionCurrentState { Type = Projections.Contracts.ProjectionCurrentStateType.Persisted, Key = request.Key, State = newState.Result } }; } public override async Task<DeleteResponse> Delete(DeleteRequest request, ServerCallContext context) { using var cts = CancellationTokenSource.CreateLinkedTokenSource(_hostApplicationLifetime.ApplicationStopping, context.CancellationToken); _executionContextManager.CurrentFor(request.CallContext.ExecutionContext); if (!TryGetRegisteredEmbeddingProcessorForTenant(_executionContextManager.Current.Tenant, request.EmbeddingId.ToGuid(), out var processor, out var failure)) { return new DeleteResponse { Failure = failure }; } var deleteEmbedding = await processor.Delete(request.Key, cts.Token).ConfigureAwait(false); if (!deleteEmbedding.Success) { return new DeleteResponse { Failure = new Dolittle.Protobuf.Contracts.Failure { Id = EmbeddingFailures.FailedToDeleteEmbedding.ToProtobuf(), Reason = $"Failed to delete embedding {request.EmbeddingId.ToGuid()} for tenant {_executionContextManager.Current.Tenant.Value}. {deleteEmbedding.Exception.Message}" } }; } return new DeleteResponse(); } bool TryGetRegisteredEmbeddingProcessorForTenant(TenantId tenant, EmbeddingId embedding, out IEmbeddingProcessor processor, out Failure failure) { failure = default; if (!_embeddingProcessors.TryGetEmbeddingProcessorFor(tenant, embedding, out processor)) { failure = new Dolittle.Protobuf.Contracts.Failure { Id = EmbeddingFailures.NoEmbeddingRegisteredForTenant.ToProtobuf(), Reason = $"No embedding with id {embedding.Value} registered for tenant {tenant.Value}" }; return false; } return true; } async Task<bool> RejectIfInvalidDefinition( EmbeddingDefinition definition, IReverseCallDispatcher<EmbeddingClientToRuntimeMessage, EmbeddingRuntimeToClientMessage, EmbeddingRegistrationRequest, EmbeddingRegistrationResponse, EmbeddingRequest, EmbeddingResponse> dispatcher, CancellationToken cancellationToken) { _logger.ComparingEmbeddingDefinition(definition); var tenantsAndComparisonResult = await _embeddingDefinitionComparer.DiffersFromPersisted( new EmbeddingDefinition( definition.Embedding, definition.Events, definition.InititalState), cancellationToken).ConfigureAwait(false); if (!tenantsAndComparisonResult.Values.Any(_ => !_.Succeeded)) { return false; } var unsuccessfulComparisons = tenantsAndComparisonResult .Where(_ => !_.Value.Succeeded) .Select(_ => { return (_.Key, _.Value); }); _logger.InvalidEmbeddingDefinition(definition, unsuccessfulComparisons); await dispatcher.Reject(CreateInvalidValidationResponse( unsuccessfulComparisons, definition.Embedding), cancellationToken).ConfigureAwait(false); return true; } EmbeddingRegistrationResponse CreateInvalidValidationResponse( System.Collections.Generic.IEnumerable<(TenantId Key, EmbeddingDefinitionComparisonResult Value)> unsuccessfulComparisons, EmbeddingId embedding) { var (_, result) = unsuccessfulComparisons.First(); return _protocol.CreateFailedConnectResponse($"Failed to register Embedding: {embedding.Value} for tenant. {result.FailureReason.Value}"); } } }
47.551331
210
0.64545
[ "MIT" ]
dolittle/Runtime
Source/Embeddings.Processing/EmbeddingsService.cs
12,506
C#
using System.Collections.Generic; using System.Threading.Tasks; using Paladyne.TaskManager.Api.Domain.Models; using Paladyne.TaskManager.Api.Domain.Models.Queries; namespace Paladyne.TaskManager.Api.Domain.Repositories { public interface IProductRepository { Task<QueryResult<Product>> ListAsync(ProductsQuery query); Task AddAsync(Product product); Task<Product> FindByIdAsync(int id); void Update(Product product); void Remove(Product product); } }
31.4375
66
0.741551
[ "MIT" ]
aramis2019/supermarket-api
src/Paladyne.TaskManager.Api/Domain/Repositories/IProductRepository.cs
503
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.DataAnnotations; using Microsoft.Extensions.Options; namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation { public class TestClientModelValidatorProvider : CompositeClientModelValidatorProvider { // Creates a provider with all the defaults - includes data annotations public static IClientModelValidatorProvider CreateDefaultProvider() { var providers = new IClientModelValidatorProvider[] { new DefaultClientModelValidatorProvider(), new DataAnnotationsClientModelValidatorProvider( new ValidationAttributeAdapterProvider(), Options.Create(new MvcDataAnnotationsLocalizationOptions()), stringLocalizerFactory: null), }; return new TestClientModelValidatorProvider(providers); } public TestClientModelValidatorProvider(IEnumerable<IClientModelValidatorProvider> providers) : base(providers) { } } }
38.4375
101
0.693496
[ "MIT" ]
48355746/AspNetCore
src/Mvc/shared/Mvc.Core.TestCommon/TestClientModelValidatorProvider.cs
1,230
C#
using System; using System.IO; using System.Reflection; using Chromely.CefSharp.Winapi.BrowserWindow; using Chromely.Core; using Chromely.Core.Helpers; using Chromely.Core.Host; using ChromelySmallSingleExecutable.Features.App.Models; using ChromelySmallSingleExecutable.Features.Bootstrap; using ChromelySmallSingleExecutable.Features.Downloader; namespace ChromelySmallSingleExecutable { internal class Program { private static readonly AppEnvironment _env = AppEnvironmentBuilder.Instance.GetAppEnvironment(); private static readonly Config _cnf = ConfigBuilder.Create(); private static readonly Registry _reg = new Registry(_env, _cnf); private static int Main(string[] args) { Init(); return Start(args); } private static int Start(string[] args) { const string startUrl = "https://google.com"; var config = ChromelyConfiguration .Create() .WithCustomSetting(CefSettingKeys.BrowserSubprocessPath, _reg.BrowserSubprocessPath) .WithCustomSetting(CefSettingKeys.LocalesDirPath, _reg.CefSharpLocalePath) .WithCustomSetting(CefSettingKeys.LogFile, ".logs\\chronium.log") .UseDefaultLogger(".logs\\chromely.log") .WithHostMode(WindowState.Normal) .WithHostTitle("ChromelySmallSingleExecutable") .WithAppArgs(args) .WithHostSize(1100, 700) .WithStartUrl(startUrl); using (var window = new CefSharpBrowserWindow(config)) { return window.Run(args); } } private static void Init() { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; ProgramDownloader.DownloadCefSharpEnvIfNeeded(_reg); } private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { var dll = args.Name.Split(new[] {','}, 2)[0] + ".dll"; switch (dll) { case "CefSharp.Core.dll": case "CefSharp.dll": var path = Path.Combine(_reg.CefSharpEnvPath, dll); var asm = Assembly.LoadFile(path); return asm; default: return null; } } } }
34.957143
105
0.608909
[ "MIT" ]
pkudrel/ChromelySmallSingleExecutable
src/ChromelySmallSingleExecutable/Program.cs
2,449
C#
/* * THIS FILE WAS GENERATED BY PLOTLY.BLAZOR.GENERATOR */ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.Serialization.Formatters.Binary; using System.Text.Json.Serialization; namespace Plotly.Blazor.Traces.PieLib.HoverLabelLib { /// <summary> /// The Font class. /// </summary> [System.CodeDom.Compiler.GeneratedCode("Plotly.Blazor.Generator", "1.0.0.0")] [JsonConverter(typeof(PlotlyConverter))] [Serializable] public class Font : IEquatable<Font> { /// <summary> /// HTML font family - the typeface that will be applied by the web browser. /// The web browser will only be able to apply a font if it is available on /// the system which it operates. Provide multiple font families, separated /// by commas, to indicate the preference in which to apply fonts if they aren&#39;t /// available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com /// or on-premise) generates images on a server, where only a select number /// of fonts are installed and supported. These include <c>Arial</c>, <c>Balto</c>, /// &#39;Courier New&#39;, &#39;Droid Sans&#39;,, &#39;Droid Serif&#39;, &#39;Droid /// Sans Mono&#39;, &#39;Gravitas One&#39;, &#39;Old Standard TT&#39;, &#39;Open /// Sans&#39;, <c>Overpass</c>, &#39;PT Sans Narrow&#39;, <c>Raleway</c>, &#39;Times /// New Roman&#39;. /// </summary> [JsonPropertyName(@"family")] public string Family { get; set;} /// <summary> /// HTML font family - the typeface that will be applied by the web browser. /// The web browser will only be able to apply a font if it is available on /// the system which it operates. Provide multiple font families, separated /// by commas, to indicate the preference in which to apply fonts if they aren&#39;t /// available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com /// or on-premise) generates images on a server, where only a select number /// of fonts are installed and supported. These include <c>Arial</c>, <c>Balto</c>, /// &#39;Courier New&#39;, &#39;Droid Sans&#39;,, &#39;Droid Serif&#39;, &#39;Droid /// Sans Mono&#39;, &#39;Gravitas One&#39;, &#39;Old Standard TT&#39;, &#39;Open /// Sans&#39;, <c>Overpass</c>, &#39;PT Sans Narrow&#39;, <c>Raleway</c>, &#39;Times /// New Roman&#39;. /// </summary> [JsonPropertyName(@"family")] [Array] public IList<string> FamilyArray { get; set;} /// <summary> /// Gets or sets the Size. /// </summary> [JsonPropertyName(@"size")] public decimal? Size { get; set;} /// <summary> /// Gets or sets the Size. /// </summary> [JsonPropertyName(@"size")] [Array] public IList<decimal?> SizeArray { get; set;} /// <summary> /// Gets or sets the Color. /// </summary> [JsonPropertyName(@"color")] public object Color { get; set;} /// <summary> /// Gets or sets the Color. /// </summary> [JsonPropertyName(@"color")] [Array] public IList<object> ColorArray { get; set;} /// <summary> /// Sets the source reference on Chart Studio Cloud for family . /// </summary> [JsonPropertyName(@"familysrc")] public string FamilySrc { get; set;} /// <summary> /// Sets the source reference on Chart Studio Cloud for size . /// </summary> [JsonPropertyName(@"sizesrc")] public string SizeSrc { get; set;} /// <summary> /// Sets the source reference on Chart Studio Cloud for color . /// </summary> [JsonPropertyName(@"colorsrc")] public string ColorSrc { get; set;} /// <inheritdoc /> public override bool Equals(object obj) { if (!(obj is Font other)) return false; return ReferenceEquals(this, obj) || Equals(other); } /// <inheritdoc /> public bool Equals([AllowNull] Font other) { if (other == null) return false; if (ReferenceEquals(this, other)) return true; return ( Family == other.Family || Family != null && Family.Equals(other.Family) ) && ( Equals(FamilyArray, other.FamilyArray) || FamilyArray != null && other.FamilyArray != null && FamilyArray.SequenceEqual(other.FamilyArray) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) ) && ( Equals(SizeArray, other.SizeArray) || SizeArray != null && other.SizeArray != null && SizeArray.SequenceEqual(other.SizeArray) ) && ( Color == other.Color || Color != null && Color.Equals(other.Color) ) && ( Equals(ColorArray, other.ColorArray) || ColorArray != null && other.ColorArray != null && ColorArray.SequenceEqual(other.ColorArray) ) && ( FamilySrc == other.FamilySrc || FamilySrc != null && FamilySrc.Equals(other.FamilySrc) ) && ( SizeSrc == other.SizeSrc || SizeSrc != null && SizeSrc.Equals(other.SizeSrc) ) && ( ColorSrc == other.ColorSrc || ColorSrc != null && ColorSrc.Equals(other.ColorSrc) ); } /// <inheritdoc /> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Family != null) hashCode = hashCode * 59 + Family.GetHashCode(); if (FamilyArray != null) hashCode = hashCode * 59 + FamilyArray.GetHashCode(); if (Size != null) hashCode = hashCode * 59 + Size.GetHashCode(); if (SizeArray != null) hashCode = hashCode * 59 + SizeArray.GetHashCode(); if (Color != null) hashCode = hashCode * 59 + Color.GetHashCode(); if (ColorArray != null) hashCode = hashCode * 59 + ColorArray.GetHashCode(); if (FamilySrc != null) hashCode = hashCode * 59 + FamilySrc.GetHashCode(); if (SizeSrc != null) hashCode = hashCode * 59 + SizeSrc.GetHashCode(); if (ColorSrc != null) hashCode = hashCode * 59 + ColorSrc.GetHashCode(); return hashCode; } } /// <summary> /// Checks for equality of the left Font and the right Font. /// </summary> /// <param name="left">Left Font.</param> /// <param name="right">Right Font.</param> /// <returns>Boolean</returns> public static bool operator == (Font left, Font right) { return Equals(left, right); } /// <summary> /// Checks for inequality of the left Font and the right Font. /// </summary> /// <param name="left">Left Font.</param> /// <param name="right">Right Font.</param> /// <returns>Boolean</returns> public static bool operator != (Font left, Font right) { return !Equals(left, right); } /// <summary> /// Gets a deep copy of this instance. /// </summary> /// <returns>Font</returns> public Font DeepClone() { using var ms = new MemoryStream(); var formatter = new BinaryFormatter(); formatter.Serialize(ms, this); ms.Position = 0; return (Font) formatter.Deserialize(ms); } } }
39.49537
99
0.510139
[ "MIT" ]
HansenBerlin/PlanspielWebapp
Plotly.Blazor/Traces/PieLib/HoverLabelLib/Font.cs
8,531
C#
using System; namespace Travelopedia_API.Areas.HelpPage.ModelDescriptions { /// <summary> /// Describes a type model. /// </summary> public abstract class ModelDescription { public string Documentation { get; set; } public Type ModelType { get; set; } public string Name { get; set; } } }
21.1875
59
0.625369
[ "MIT" ]
spuranik0710/Travelopedia
Travelopedia-API/Travelopedia-API/Areas/HelpPage/ModelDescriptions/ModelDescription.cs
339
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class life_controler : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
14.529412
45
0.704453
[ "MIT" ]
kwantum0/GGJ17
Assets/life_controler.cs
249
C#
// Fen's note: This is straight out of .NET Core 3 with no functional changes. I'm trusting it to be correct and // working, and I'm not gonna touch it even for nullability. #nullable disable // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Diagnostics; using System.IO; using System.Threading; using System.Threading.Tasks; namespace FMScanner.FastZipReader.Deflate64Managed { internal sealed class Deflate64ManagedStream : Stream { private const int DefaultBufferSize = 8192; private Stream _stream; private bool _leaveOpen; private Inflater64Managed _inflater64; private byte[] _buffer; // A specific constructor to allow decompression of Deflate64 internal Deflate64ManagedStream(Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (!stream.CanRead) { throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream)); } InitializeInflater(stream); } /// <summary> /// Sets up this DeflateManagedStream to be used for Inflation/Decompression /// </summary> private void InitializeInflater(Stream stream) { Debug.Assert(stream != null); if (!stream.CanRead) throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream)); _inflater64 = new Inflater64Managed(reader: null); _stream = stream; _leaveOpen = false; _buffer = new byte[DefaultBufferSize]; } public override bool CanRead => _stream != null && _stream.CanRead; public override bool CanWrite => false; public override bool CanSeek => false; public override long Length => throw new NotSupportedException(SR.NotSupported); public override long Position { get => throw new NotSupportedException(SR.NotSupported); set => throw new NotSupportedException(SR.NotSupported); } public override void Flush() { ThrowIfDisposed(); throw new NotSupportedException(SR.WritingNotSupported); } public override Task FlushAsync(CancellationToken cancellationToken) { ThrowIfDisposed(); throw new NotSupportedException(SR.WritingNotSupported); } public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(SR.NotSupported); } public override void SetLength(long value) { throw new NotSupportedException(SR.NotSupported); } public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(SR.WritingNotSupported); } public override int Read(byte[] array, int offset, int count) { if (array == null) throw new ArgumentNullException(nameof(array)); if (offset < 0) throw new ArgumentOutOfRangeException(nameof(offset)); if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); if (array.Length - offset < count) throw new ArgumentException(SR.InvalidArgumentOffsetCount); ThrowIfDisposed(); int currentOffset = offset; int remainingCount = count; while (true) { int bytesRead = _inflater64.Inflate(array, currentOffset, remainingCount); currentOffset += bytesRead; remainingCount -= bytesRead; if (remainingCount == 0) { break; } if (_inflater64.Finished()) { // if we finished decompressing, we can't have anything left in the outputwindow. Debug.Assert(_inflater64.AvailableOutput == 0, "We should have copied all stuff out!"); break; } int bytes = _stream.Read(_buffer, 0, _buffer.Length); if (bytes <= 0) { break; } else if (bytes > _buffer.Length) { // The stream is either malicious or poorly implemented and returned a number of // bytes larger than the buffer supplied to it. throw new InvalidDataException(SR.GenericInvalidData); } _inflater64.SetInput(_buffer, 0, bytes); } return count - remainingCount; } private void ThrowIfDisposed() { if (_stream == null) throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed); } protected override void Dispose(bool disposing) { // Close the underlying stream even if PurgeBuffers threw. // Stream.Close() may throw here (may or may not be due to the same error). // In this case, we still need to clean up internal resources, hence the inner finally blocks. try { if (disposing && !_leaveOpen) _stream?.Dispose(); } finally { _stream = null; try { _inflater64?.Dispose(); } finally { _inflater64 = null; base.Dispose(disposing); } } } } }
32.715084
112
0.568477
[ "MIT" ]
FenPhoenix/AngelLoader
FMScanner/FastZipReader/Deflate64Managed/Deflate64ManagedStream.cs
5,856
C#
// <auto-generated /> using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage.Internal; using Piranha; using Piranha.Models; using System; namespace Piranha.Data.EF.MySql.Migrations { [DbContext(typeof(MySqlDb))] [Migration("20180331212736_AddCLRContentType")] partial class AddCLRContentType { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "2.0.1-rtm-125"); modelBuilder.Entity("Piranha.Data.Alias", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<string>("AliasUrl") .IsRequired() .HasMaxLength(256); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.Property<string>("RedirectUrl") .IsRequired() .HasMaxLength(256); b.Property<Guid>("SiteId"); b.Property<int>("Type"); b.HasKey("Id"); b.HasIndex("SiteId", "AliasUrl") .IsUnique(); b.ToTable("Piranha_Aliases"); }); modelBuilder.Entity("Piranha.Data.Category", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<Guid>("BlogId"); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.Property<string>("Slug") .IsRequired() .HasMaxLength(64); b.Property<string>("Title") .IsRequired() .HasMaxLength(64); b.HasKey("Id"); b.HasIndex("BlogId", "Slug") .IsUnique(); b.ToTable("Piranha_Categories"); }); modelBuilder.Entity("Piranha.Data.Media", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<string>("ContentType") .IsRequired() .HasMaxLength(256); b.Property<DateTime>("Created"); b.Property<string>("Filename") .IsRequired() .HasMaxLength(128); b.Property<Guid?>("FolderId"); b.Property<int?>("Height"); b.Property<DateTime>("LastModified"); b.Property<string>("PublicUrl"); b.Property<long>("Size"); b.Property<int>("Type"); b.Property<int?>("Width"); b.HasKey("Id"); b.HasIndex("FolderId"); b.ToTable("Piranha_Media"); }); modelBuilder.Entity("Piranha.Data.MediaFolder", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<DateTime>("Created"); b.Property<string>("Name") .IsRequired() .HasMaxLength(128); b.Property<Guid?>("ParentId"); b.HasKey("Id"); b.ToTable("Piranha_MediaFolders"); }); modelBuilder.Entity("Piranha.Data.MediaVersion", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<int?>("Height"); b.Property<Guid>("MediaId"); b.Property<long>("Size"); b.Property<int>("Width"); b.HasKey("Id"); b.HasIndex("MediaId", "Width", "Height") .IsUnique(); b.ToTable("Piranha_MediaVersions"); }); modelBuilder.Entity("Piranha.Data.Page", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<string>("ContentType") .IsRequired() .ValueGeneratedOnAdd() .HasDefaultValue("Page") .HasMaxLength(255); b.Property<DateTime>("Created"); b.Property<bool>("IsHidden"); b.Property<DateTime>("LastModified"); b.Property<string>("MetaDescription") .HasMaxLength(256); b.Property<string>("MetaKeywords") .HasMaxLength(128); b.Property<string>("NavigationTitle") .HasMaxLength(128); b.Property<string>("PageTypeId") .IsRequired() .HasMaxLength(64); b.Property<Guid?>("ParentId"); b.Property<DateTime?>("Published"); b.Property<int>("RedirectType"); b.Property<string>("RedirectUrl") .HasMaxLength(256); b.Property<string>("Route") .HasMaxLength(256); b.Property<Guid>("SiteId"); b.Property<string>("Slug") .IsRequired() .HasMaxLength(128); b.Property<int>("SortOrder"); b.Property<string>("Title") .IsRequired() .HasMaxLength(128); b.HasKey("Id"); b.HasIndex("PageTypeId"); b.HasIndex("ParentId"); b.HasIndex("SiteId", "Slug") .IsUnique(); b.ToTable("Piranha_Pages"); }); modelBuilder.Entity("Piranha.Data.PageField", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<string>("CLRType") .IsRequired() .HasMaxLength(256); b.Property<string>("FieldId") .IsRequired() .HasMaxLength(64); b.Property<Guid>("PageId"); b.Property<string>("RegionId") .IsRequired() .HasMaxLength(64); b.Property<int>("SortOrder"); b.Property<string>("Value"); b.HasKey("Id"); b.HasIndex("PageId", "RegionId", "FieldId", "SortOrder"); b.ToTable("Piranha_PageFields"); }); modelBuilder.Entity("Piranha.Data.PageType", b => { b.Property<string>("Id") .ValueGeneratedOnAdd() .HasMaxLength(64); b.Property<string>("Body"); b.Property<string>("CLRType") .HasMaxLength(256); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.HasKey("Id"); b.ToTable("Piranha_PageTypes"); }); modelBuilder.Entity("Piranha.Data.Param", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<DateTime>("Created"); b.Property<string>("Description") .HasMaxLength(256); b.Property<string>("Key") .IsRequired() .HasMaxLength(64); b.Property<DateTime>("LastModified"); b.Property<string>("Value"); b.HasKey("Id"); b.HasIndex("Key") .IsUnique(); b.ToTable("Piranha_Params"); }); modelBuilder.Entity("Piranha.Data.Post", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<Guid>("BlogId"); b.Property<Guid>("CategoryId"); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.Property<string>("MetaDescription") .HasMaxLength(256); b.Property<string>("MetaKeywords") .HasMaxLength(128); b.Property<string>("PostTypeId") .IsRequired() .HasMaxLength(64); b.Property<DateTime?>("Published"); b.Property<int>("RedirectType"); b.Property<string>("RedirectUrl") .HasMaxLength(256); b.Property<string>("Route") .HasMaxLength(256); b.Property<string>("Slug") .IsRequired() .HasMaxLength(128); b.Property<string>("Title") .IsRequired() .HasMaxLength(128); b.HasKey("Id"); b.HasIndex("CategoryId"); b.HasIndex("PostTypeId"); b.HasIndex("BlogId", "Slug") .IsUnique(); b.ToTable("Piranha_Posts"); }); modelBuilder.Entity("Piranha.Data.PostField", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<string>("CLRType") .IsRequired() .HasMaxLength(256); b.Property<string>("FieldId") .IsRequired() .HasMaxLength(64); b.Property<Guid>("PostId"); b.Property<string>("RegionId") .IsRequired() .HasMaxLength(64); b.Property<int>("SortOrder"); b.Property<string>("Value"); b.HasKey("Id"); b.HasIndex("PostId", "RegionId", "FieldId", "SortOrder"); b.ToTable("Piranha_PostFields"); }); modelBuilder.Entity("Piranha.Data.PostTag", b => { b.Property<Guid>("PostId"); b.Property<Guid>("TagId"); b.HasKey("PostId", "TagId"); b.HasIndex("TagId"); b.ToTable("Piranha_PostTags"); }); modelBuilder.Entity("Piranha.Data.PostType", b => { b.Property<string>("Id") .ValueGeneratedOnAdd() .HasMaxLength(64); b.Property<string>("Body"); b.Property<string>("CLRType") .HasMaxLength(256); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.HasKey("Id"); b.ToTable("Piranha_PostTypes"); }); modelBuilder.Entity("Piranha.Data.Site", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<DateTime>("Created"); b.Property<string>("Description") .HasMaxLength(256); b.Property<string>("Hostnames") .HasMaxLength(256); b.Property<string>("InternalId") .IsRequired() .HasMaxLength(64); b.Property<bool>("IsDefault"); b.Property<DateTime>("LastModified"); b.Property<string>("Title") .HasMaxLength(128); b.HasKey("Id"); b.HasIndex("InternalId") .IsUnique(); b.ToTable("Piranha_Sites"); }); modelBuilder.Entity("Piranha.Data.Tag", b => { b.Property<Guid>("Id") .ValueGeneratedOnAdd(); b.Property<Guid>("BlogId"); b.Property<DateTime>("Created"); b.Property<DateTime>("LastModified"); b.Property<string>("Slug") .IsRequired() .HasMaxLength(64); b.Property<string>("Title") .IsRequired() .HasMaxLength(64); b.HasKey("Id"); b.HasIndex("BlogId", "Slug") .IsUnique(); b.ToTable("Piranha_Tags"); }); modelBuilder.Entity("Piranha.Data.Alias", b => { b.HasOne("Piranha.Data.Site", "Site") .WithMany() .HasForeignKey("SiteId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.Category", b => { b.HasOne("Piranha.Data.Page", "Blog") .WithMany() .HasForeignKey("BlogId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.Media", b => { b.HasOne("Piranha.Data.MediaFolder", "Folder") .WithMany("Media") .HasForeignKey("FolderId"); }); modelBuilder.Entity("Piranha.Data.MediaVersion", b => { b.HasOne("Piranha.Data.Media", "Media") .WithMany("Versions") .HasForeignKey("MediaId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.Page", b => { b.HasOne("Piranha.Data.PageType", "PageType") .WithMany() .HasForeignKey("PageTypeId") .OnDelete(DeleteBehavior.Cascade); b.HasOne("Piranha.Data.Page", "Parent") .WithMany() .HasForeignKey("ParentId"); b.HasOne("Piranha.Data.Site", "Site") .WithMany() .HasForeignKey("SiteId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.PageField", b => { b.HasOne("Piranha.Data.Page", "Page") .WithMany("Fields") .HasForeignKey("PageId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.Post", b => { b.HasOne("Piranha.Data.Page", "Blog") .WithMany() .HasForeignKey("BlogId") .OnDelete(DeleteBehavior.Cascade); b.HasOne("Piranha.Data.Category", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); b.HasOne("Piranha.Data.PostType", "PostType") .WithMany() .HasForeignKey("PostTypeId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.PostField", b => { b.HasOne("Piranha.Data.Post", "Post") .WithMany("Fields") .HasForeignKey("PostId") .OnDelete(DeleteBehavior.Cascade); }); modelBuilder.Entity("Piranha.Data.PostTag", b => { b.HasOne("Piranha.Data.Post", "Post") .WithMany("Tags") .HasForeignKey("PostId") .OnDelete(DeleteBehavior.Cascade); b.HasOne("Piranha.Data.Tag", "Tag") .WithMany() .HasForeignKey("TagId") .OnDelete(DeleteBehavior.Restrict); }); modelBuilder.Entity("Piranha.Data.Tag", b => { b.HasOne("Piranha.Data.Page", "Blog") .WithMany() .HasForeignKey("BlogId") .OnDelete(DeleteBehavior.Cascade); }); #pragma warning restore 612, 618 } } }
30.99827
77
0.403472
[ "MIT" ]
AdaptiveApi/piranha.core
data/Piranha.Data.EF.MySql/Migrations/20180331212736_AddCLRContentType.Designer.cs
17,919
C#
namespace TileGame.Items { public struct ItemAssembly { public ItemAssembly(string[] spawnableItems, float spawnFrequency, bool spawnPlayerWithItems, int playerStartItemAmount) { SpawnableItems = spawnableItems; SpawnFrequency = spawnFrequency; SpawnPlayerWithItems = spawnPlayerWithItems; PlayerStartItemAmount = playerStartItemAmount; } public string[] SpawnableItems { get; } public float SpawnFrequency { get; } public bool SpawnPlayerWithItems { get; } public int PlayerStartItemAmount { get; } } }
33.157895
128
0.653968
[ "MIT" ]
PascalPieper/Portfolio_TileGame
TileGame/Items/ItemAssembly.cs
632
C#
using System; using System.Collections.Generic; using System.Linq; using Mono.Cecil; namespace MethodBoundaryAspect.Fody.Ordering { public class AspectInfo { private const string AspectCanTHaveRoleAndBeOrderedBeforeOrAfterThatRole = "Aspect '{0}' can't have role '{1}' and be ordered before or after that role"; private const string AspectHasToProvideANonEmptyMethodBoundaryAspectAttributesProvideAspectRoleAttribute = "Aspect '{0}' has to provide a non-empty MethodBoundaryAspect.Attributes.ProvideAspectRoleAttribute attribute"; private const string AspectHasMultipleOrderIndicesDefinedOnTheSameLevel = "Aspect '{0}' has multiple order indices defined on {1} level"; public AspectInfo(CustomAttribute aspectAttribute) { AspectAttribute = aspectAttribute; Name = aspectAttribute.AttributeType.FullName; AspectTypeDefinition = aspectAttribute.AttributeType.Resolve(); var aspectAttributes = AspectTypeDefinition.CustomAttributes; InitRole(aspectAttributes); InitOrder(aspectAttributes); InitSkipProperties(aspectAttributes); } public TypeDefinition AspectTypeDefinition { get; } public string Name { get; private set; } public string Role { get; private set; } public bool SkipProperties { get; set; } public CustomAttribute AspectAttribute { get; private set; } public List<CustomAttribute> AspectRoleDependencyAttributes { get; private set; } #pragma warning disable 0618 public AspectOrder Order { get; private set; } #pragma warning restore 0618 public int? OrderIndex { get; set; } private void InitRole(IEnumerable<CustomAttribute> aspectAttributes) { Role = "<Default>"; var roleAttribute = aspectAttributes .SingleOrDefault(c => c.AttributeType.FullName == AttributeFullNames.ProvideAspectRoleAttribute); if (roleAttribute == null) return; var role = (string) roleAttribute.ConstructorArguments[0].Value; if (string.IsNullOrEmpty(role)) { var msg = string.Format(AspectHasToProvideANonEmptyMethodBoundaryAspectAttributesProvideAspectRoleAttribute, Name); throw new InvalidAspectConfigurationException(msg); } Role = role; } private void InitOrder(IEnumerable<CustomAttribute> aspectAttributes) { AspectRoleDependencyAttributes = aspectAttributes.Where( c => c.AttributeType.FullName == AttributeFullNames.AspectRoleDependencyAttribute).ToList(); if (AspectRoleDependencyAttributes.Count == 0) return; #pragma warning disable 0618 var aspectOrder = new AspectOrder(this); #pragma warning restore 0618 foreach (var roleDependencyAttribute in AspectRoleDependencyAttributes) { var role = (string) roleDependencyAttribute.ConstructorArguments[2].Value; if (role == Role) { var msg = string.Format(AspectCanTHaveRoleAndBeOrderedBeforeOrAfterThatRole, Name, role); throw new InvalidAspectConfigurationException(msg); } var position = (int) roleDependencyAttribute.ConstructorArguments[1].Value; aspectOrder.AddRole(role, position); } Order = aspectOrder; } private void InitSkipProperties(IEnumerable<CustomAttribute> aspectAttributes) { var skipPropertiesAttribute = aspectAttributes .SingleOrDefault(c => c.AttributeType.FullName == AttributeFullNames.AspectSkipPropertiesAttribute); if (skipPropertiesAttribute == null) return; var skipProperties = (bool)skipPropertiesAttribute.ConstructorArguments[0].Value; SkipProperties = skipProperties; } public void InitOrderIndex( IEnumerable<CustomAttribute> assemblyAspectAttributes, IEnumerable<CustomAttribute> classAspectAttributes, IEnumerable<CustomAttribute> methodAspectAttributes) { InternalInitOrderIndex(assemblyAspectAttributes, "assembly"); InternalInitOrderIndex(classAspectAttributes, "class"); InternalInitOrderIndex(methodAspectAttributes, "method"); } private void InternalInitOrderIndex(IEnumerable<CustomAttribute> aspectAttributes, string level) { var orderIndexAttributes = aspectAttributes .Where(c => c.AttributeType.FullName == AttributeFullNames.AspectOrderIndexAttribute && ((TypeReference)c.ConstructorArguments[0].Value).FullName == AspectTypeDefinition.FullName) .ToList(); if (orderIndexAttributes.Count > 1) throw new InvalidAspectConfigurationException(string.Format(AspectHasMultipleOrderIndicesDefinedOnTheSameLevel, Name, level)); if (orderIndexAttributes.Count == 1) OrderIndex = (int)orderIndexAttributes[0].ConstructorArguments[1].Value; } } }
39.152174
142
0.650379
[ "MIT" ]
chloeffl/MethodBoundaryAspect.Fody
src/MethodBoundaryAspect.Fody/Ordering/AspectInfo.cs
5,403
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.235 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace DocumentFormat.OpenXml.Validation { using System; using System.Reflection; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal partial class ValidationResources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal ValidationResources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DocumentFormat.OpenXml.src.ofapi.Validation.ValidationResources", typeof(ValidationResources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized string similar to Inner exception: {0}.. /// </summary> internal static string ExceptionError { get { return ResourceManager.GetString("ExceptionError", resourceCulture); } } /// <summary> /// Looks up a localized string similar to any element in namespace &apos;{0}&apos;. /// </summary> internal static string Fmt_AnyElementInNamespace { get { return ResourceManager.GetString("Fmt_AnyElementInNamespace", resourceCulture); } } /// <summary> /// Looks up a localized string similar to &lt;{0}:{1}&gt;. /// </summary> internal static string Fmt_ElementName { get { return ResourceManager.GetString("Fmt_ElementName", resourceCulture); } } /// <summary> /// Looks up a localized string similar to ,. /// </summary> internal static string Fmt_ElementNameSeparator { get { return ResourceManager.GetString("Fmt_ElementNameSeparator", resourceCulture); } } /// <summary> /// Looks up a localized string similar to List of possible elements expected: {0}.. /// </summary> internal static string Fmt_ListOfPossibleElements { get { return ResourceManager.GetString("Fmt_ListOfPossibleElements", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The attribute &apos;{0}&apos; needs to specify a proper prefix when defined on an AlternateContent element.. /// </summary> internal static string MC_ErrorOnUnprefixedAttributeName { get { return ResourceManager.GetString("MC_ErrorOnUnprefixedAttributeName", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The Ignorable attribute is invalid - The value &apos;{0}&apos; contains an invalid prefix that is not defined.. /// </summary> internal static string MC_InvalidIgnorableAttribute { get { return ResourceManager.GetString("MC_InvalidIgnorableAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The MustUnderstand attribute is invalid - The value &apos;{0}&apos; contains an invalid prefix that is not defined.. /// </summary> internal static string MC_InvalidMustUnderstandAttribute { get { return ResourceManager.GetString("MC_InvalidMustUnderstandAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The PreserveAttributes attribute is invalid - The value &apos;{0}&apos; contains invalid qualified names. The ProcessAttributes attribute value cannot reference any attribute name that does not belong to a namespace that is identified by the Ignorable attribute of the same element.. /// </summary> internal static string MC_InvalidPreserveAttributesAttribute { get { return ResourceManager.GetString("MC_InvalidPreserveAttributesAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The PreserveElements attribute is invalid - The value &apos;{0}&apos; contains invalid qualified names. The PreserveElements attribute value cannot reference any element name that does not belong to a namespace that is identified by the Ignorable attribute of the same element.. /// </summary> internal static string MC_InvalidPreserveElementsAttribute { get { return ResourceManager.GetString("MC_InvalidPreserveElementsAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The ProcessContent attribute is invalid - The value &apos;{0}&apos; contains invalid qualified names. The ProcessContent attribute value cannot reference any element name that does not belong to a namespace that is identified by the Ignorable attribute of the same element.. /// </summary> internal static string MC_InvalidProcessContentAttribute { get { return ResourceManager.GetString("MC_InvalidProcessContentAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The Requires attribute is invalid - The value &apos;{0}&apos; contains an invalid prefix that is not defined.. /// </summary> internal static string MC_InvalidRequiresAttribute { get { return ResourceManager.GetString("MC_InvalidRequiresAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The {0} element should not have an xml:lang or xml:space attribute.. /// </summary> internal static string MC_InvalidXmlAttribute { get { return ResourceManager.GetString("MC_InvalidXmlAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to An element should not have an xml:lang or xml:space attribute and also be identified by a ProcessContent attribute.. /// </summary> internal static string MC_InvalidXmlAttributeWithProcessContent { get { return ResourceManager.GetString("MC_InvalidXmlAttributeWithProcessContent", resourceCulture); } } /// <summary> /// Looks up a localized string similar to All Choice elements must have a Requires attribute whose value contains a whitespace delimited list of namespace prefixes.. /// </summary> internal static string MC_MissedRequiresAttribute { get { return ResourceManager.GetString("MC_MissedRequiresAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to An AlternateContent element must contain one or more Choice child elements, optionally followed by a Fallback child element.. /// </summary> internal static string MC_ShallContainChoice { get { return ResourceManager.GetString("MC_ShallContainChoice", resourceCulture); } } /// <summary> /// Looks up a localized string similar to An AlternateContent element cannot be the child of an AlternateContent element.. /// </summary> internal static string MC_ShallNotContainAlternateContent { get { return ResourceManager.GetString("MC_ShallNotContainAlternateContent", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The package/part &apos;{0}&apos; cannot have a relationship that targets &apos;{1}&apos;.. /// </summary> internal static string Pkg_DataPartReferenceIsNotAllowed { get { return ResourceManager.GetString("Pkg_DataPartReferenceIsNotAllowed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to An ExtendedPart &apos;{0}&apos; was encountered with a relationship type that starts with &quot;http://schemas.openxmlformats.org&quot;. Expected a defined part instead based on the relationship type.. /// </summary> internal static string Pkg_ExtendedPartIsOpenXmlPart { get { return ResourceManager.GetString("Pkg_ExtendedPartIsOpenXmlPart", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The package/part &apos;{0}&apos; can only have one instance of relationship that targets part &apos;{1}&apos;.. /// </summary> internal static string Pkg_OnlyOnePartAllowed { get { return ResourceManager.GetString("Pkg_OnlyOnePartAllowed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The package/part &apos;{0}&apos; cannot have a relationship that targets part &apos;{1}&apos;.. /// </summary> internal static string Pkg_PartIsNotAllowed { get { return ResourceManager.GetString("Pkg_PartIsNotAllowed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to A required part &apos;{0}&apos; is missing.. /// </summary> internal static string Pkg_RequiredPartDoNotExist { get { return ResourceManager.GetString("Pkg_RequiredPartDoNotExist", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Element &apos;{0}&apos; cannot appear more than once if content model type is &quot;all&quot;.. /// </summary> internal static string Sch_AllElement { get { return ResourceManager.GetString("Sch_AllElement", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The &apos;{0}&apos; attribute is invalid - The value &apos;{1}&apos; is not valid according to any of the memberTypes of the union.. /// </summary> internal static string Sch_AttributeUnionFailedEx { get { return ResourceManager.GetString("Sch_AttributeUnionFailedEx", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The attribute &apos;{0}&apos; has invalid value &apos;{1}&apos;.{2}. /// </summary> internal static string Sch_AttributeValueDataTypeDetailed { get { return ResourceManager.GetString("Sch_AttributeValueDataTypeDetailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The &apos;{0}&apos; element is invalid - The value &apos;{1}&apos; is not valid according to any of the memberTypes of the union.. /// </summary> internal static string Sch_ElementUnionFailedEx { get { return ResourceManager.GetString("Sch_ElementUnionFailedEx", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element &apos;{0}&apos; has invalid value &apos;{1}&apos;.{2}. /// </summary> internal static string Sch_ElementValueDataTypeDetailed { get { return ResourceManager.GetString("Sch_ElementValueDataTypeDetailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The attribute value cannot be empty.. /// </summary> internal static string Sch_EmptyAttributeValue { get { return ResourceManager.GetString("Sch_EmptyAttributeValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The text value cannot be empty.. /// </summary> internal static string Sch_EmptyElementValue { get { return ResourceManager.GetString("Sch_EmptyElementValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The Enumeration constraint failed.. /// </summary> internal static string Sch_EnumerationConstraintFailed { get { return ResourceManager.GetString("Sch_EnumerationConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element has incomplete content.{0}. /// </summary> internal static string Sch_IncompleteContentExpectingComplex { get { return ResourceManager.GetString("Sch_IncompleteContentExpectingComplex", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element &apos;{0}&apos; is a leaf element and cannot contain children.. /// </summary> internal static string Sch_InvalidChildinLeafElement { get { return ResourceManager.GetString("Sch_InvalidChildinLeafElement", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element has invalid child element &apos;{0}&apos;.{1}. /// </summary> internal static string Sch_InvalidElementContentExpectingComplex { get { return ResourceManager.GetString("Sch_InvalidElementContentExpectingComplex", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element has child element &apos;{0}&apos; of invalid type &apos;{1}&apos;.. /// </summary> internal static string Sch_InvalidElementContentWrongType { get { return ResourceManager.GetString("Sch_InvalidElementContentWrongType", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The actual length according to datatype &apos;{0}&apos; is not equal to the specified length. The expected length is {1}.. /// </summary> internal static string Sch_LengthConstraintFailed { get { return ResourceManager.GetString("Sch_LengthConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The MaxExclusive constraint failed. The value must be less than {0}.. /// </summary> internal static string Sch_MaxExclusiveConstraintFailed { get { return ResourceManager.GetString("Sch_MaxExclusiveConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The MaxInclusive constraint failed. The value must be less than or equal to {0}.. /// </summary> internal static string Sch_MaxInclusiveConstraintFailed { get { return ResourceManager.GetString("Sch_MaxInclusiveConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The actual length according to datatype &apos;{0}&apos; is greater than the MaxLength value. The length must be smaller than or equal to {1}.. /// </summary> internal static string Sch_MaxLengthConstraintFailed { get { return ResourceManager.GetString("Sch_MaxLengthConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The MinExclusive constraint failed. The value must be greater than {0}.. /// </summary> internal static string Sch_MinExclusiveConstraintFailed { get { return ResourceManager.GetString("Sch_MinExclusiveConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The MinInclusive constraint failed. The value must be greater than or equal to {0}.. /// </summary> internal static string Sch_MinInclusiveConstraintFailed { get { return ResourceManager.GetString("Sch_MinInclusiveConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The actual length according to datatype &apos;{0}&apos; is less than the MinLength value. The length must be bigger than or equal to {1}.. /// </summary> internal static string Sch_MinLengthConstraintFailed { get { return ResourceManager.GetString("Sch_MinLengthConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The required attribute &apos;{0}&apos; is missing.. /// </summary> internal static string Sch_MissRequiredAttribute { get { return ResourceManager.GetString("Sch_MissRequiredAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The Pattern constraint failed. The expected pattern is {0}.. /// </summary> internal static string Sch_PatternConstraintFailed { get { return ResourceManager.GetString("Sch_PatternConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The string &apos;{0}&apos; is not a valid &apos;{1}&apos; value.. /// </summary> internal static string Sch_StringIsNotValidValue { get { return ResourceManager.GetString("Sch_StringIsNotValidValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The TotalDigits constraint failed. The expected number of digits is {0}.. /// </summary> internal static string Sch_TotalDigitsConstraintFailed { get { return ResourceManager.GetString("Sch_TotalDigitsConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The &apos;{0}&apos; attribute is not declared.. /// </summary> internal static string Sch_UndeclaredAttribute { get { return ResourceManager.GetString("Sch_UndeclaredAttribute", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The element has unexpected child element &apos;{0}&apos;.{1}. /// </summary> internal static string Sch_UnexpectedElementContentExpectingComplex { get { return ResourceManager.GetString("Sch_UnexpectedElementContentExpectingComplex", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should be absent when the value of attribute &apos;{1}&apos; is not {2}.. /// </summary> internal static string Sem_AttributeAbsentConditionToNonValue { get { return ResourceManager.GetString("Sem_AttributeAbsentConditionToNonValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should be absent when the value of attribute &apos;{1}&apos; is {2}.. /// </summary> internal static string Sem_AttributeAbsentConditionToValue { get { return ResourceManager.GetString("Sem_AttributeAbsentConditionToValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; and &apos;{1}&apos; cannot be present at the same time. Only one of these attributes &apos;{2}&apos; can be present at a given time.. /// </summary> internal static string Sem_AttributeMutualExclusive { get { return ResourceManager.GetString("Sem_AttributeMutualExclusive", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should be present when the value of attribute &apos;{1}&apos; is {2}.. /// </summary> internal static string Sem_AttributeRequiredConditionToValue { get { return ResourceManager.GetString("Sem_AttributeRequiredConditionToValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should have value(s) {1} when attribute &apos;{2}&apos; has value(s) {3}. Current value of attribute &apos;{4}&apos; is &apos;{5}&apos;.. /// </summary> internal static string Sem_AttributeValueConditionToAnother { get { return ResourceManager.GetString("Sem_AttributeValueConditionToAnother", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The attribute &apos;{0}&apos; has invalid value &apos;{1}&apos;.{2}. /// </summary> internal static string Sem_AttributeValueDataTypeDetailed { get { return ResourceManager.GetString("Sem_AttributeValueDataTypeDetailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; has value &apos;{1}&apos;. It should be less than or equal to the value of attribute &apos;{2}&apos; which is &apos;{3}&apos;.. /// </summary> internal static string Sem_AttributeValueLessEqualToAnother { get { return ResourceManager.GetString("Sem_AttributeValueLessEqualToAnother", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; has value &apos;{1}&apos;. It should be less than the value of attribute &apos;{2}&apos; which is &apos;{3}&apos;.. /// </summary> internal static string Sem_AttributeValueLessEqualToAnotherEx { get { return ResourceManager.GetString("Sem_AttributeValueLessEqualToAnotherEx", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should have unique value in the whole document. Its current value &apos;{1}&apos; duplicates with others.. /// </summary> internal static string Sem_AttributeValueUniqueInDocument { get { return ResourceManager.GetString("Sem_AttributeValueUniqueInDocument", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Relationship &apos;{0}&apos; referenced by attribute &apos;{1}&apos; has incorrect type. Its type should be &apos;{2}&apos;.. /// </summary> internal static string Sem_IncorrectRelationshipType { get { return ResourceManager.GetString("Sem_IncorrectRelationshipType", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The relationship &apos;{0}&apos; referenced by attribute &apos;{1}&apos; does not exist.. /// </summary> internal static string Sem_InvalidRelationshipId { get { return ResourceManager.GetString("Sem_InvalidRelationshipId", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The actual length is greater than the MaxLength value. The length must be smaller than or equal to {0}.. /// </summary> internal static string Sem_MaxLengthConstraintFailed { get { return ResourceManager.GetString("Sem_MaxLengthConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The actual length is less than the MinLength value. The length must be bigger than or equal to {0}.. /// </summary> internal static string Sem_MinLengthConstraintFailed { get { return ResourceManager.GetString("Sem_MinLengthConstraintFailed", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Element &apos;{0}&apos; referenced by &apos;{1}@{2}&apos; does not exist in part &apos;{3}&apos;. The index is &apos;{4}&apos;.. /// </summary> internal static string Sem_MissingIndexedElement { get { return ResourceManager.GetString("Sem_MissingIndexedElement", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Element &apos;{0}&apos; referenced by &apos;{1}@{2}&apos; does not exist in part &apos;{3}&apos;. The reference value is &apos;{4}&apos;.. /// </summary> internal static string Sem_MissingReferenceElement { get { return ResourceManager.GetString("Sem_MissingReferenceElement", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Attribute &apos;{0}&apos; should have unique value. Its current value &apos;{1}&apos; duplicates with others.. /// </summary> internal static string Sem_UniqueAttributeValue { get { return ResourceManager.GetString("Sem_UniqueAttributeValue", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:base64Binary. /// </summary> internal static string TypeName_base64Binary { get { return ResourceManager.GetString("TypeName_base64Binary", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:hexBinary. /// </summary> internal static string TypeName_hexBinary { get { return ResourceManager.GetString("TypeName_hexBinary", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:ID. /// </summary> internal static string TypeName_ID { get { return ResourceManager.GetString("TypeName_ID", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:integer. /// </summary> internal static string TypeName_Integer { get { return ResourceManager.GetString("TypeName_Integer", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:language. /// </summary> internal static string TypeName_language { get { return ResourceManager.GetString("TypeName_language", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:NCName. /// </summary> internal static string TypeName_NCName { get { return ResourceManager.GetString("TypeName_NCName", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:nonNegativeInteger. /// </summary> internal static string TypeName_nonNegativeInteger { get { return ResourceManager.GetString("TypeName_nonNegativeInteger", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:positiveInteger. /// </summary> internal static string TypeName_positiveInteger { get { return ResourceManager.GetString("TypeName_positiveInteger", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:QName. /// </summary> internal static string TypeName_QName { get { return ResourceManager.GetString("TypeName_QName", resourceCulture); } } /// <summary> /// Looks up a localized string similar to http://www.w3.org/2001/XMLSchema:token. /// </summary> internal static string TypeName_token { get { return ResourceManager.GetString("TypeName_token", resourceCulture); } } } }
44.940443
336
0.597682
[ "Apache-2.0" ]
tarunchopra/Vs2017-Issue
DocumentFormat.OpenXml/src/ofapi/Validation/ValidationResources.Designer.cs
32,449
C#
// Copyright (c) MASA Stack All rights reserved. // Licensed under the Apache License. See LICENSE.txt in the project root for license information. namespace Masa.Auth.Service.Admin.Application.Sso.Commands; public record RemoveCustomLoginCommand(RemoveCustomLoginDto CustomLogin) : Command { }
33.111111
98
0.805369
[ "Apache-2.0" ]
masastack/MASA.Auth
src/Services/Masa.Auth.Service.Admin/Application/Sso/Commands/RemoveCustomLoginCommand.cs
300
C#
/* Copyright (c) 2006 - 2008 The Open Toolkit library. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Runtime.InteropServices; namespace OpenTK { /// <summary> /// Represents a double-precision Quaternion. /// </summary> [StructLayout(LayoutKind.Sequential)] public struct Quaterniond : IEquatable<Quaterniond> { /// <summary> /// The X, Y and Z components of this instance. /// </summary> public Vector3d Xyz; /// <summary> /// The W component of this instance. /// </summary> public double W; /// <summary> /// Construct a new Quaterniond from vector and w components /// </summary> /// <param name="v">The vector part</param> /// <param name="w">The w part</param> public Quaterniond(Vector3d v, double w) { Xyz = v; W = w; } /// <summary> /// Construct a new Quaterniond /// </summary> /// <param name="x">The x component</param> /// <param name="y">The y component</param> /// <param name="z">The z component</param> /// <param name="w">The w component</param> public Quaterniond(double x, double y, double z, double w) : this(new Vector3d(x, y, z), w) { } /// <summary> /// Construct a new Quaterniond from given Euler angles /// </summary> /// <param name="pitch">The pitch (attitude), rotation around X axis</param> /// <param name="yaw">The yaw (heading), rotation around Y axis</param> /// <param name="roll">The roll (bank), rotation around Z axis</param> public Quaterniond(double pitch, double yaw, double roll) { yaw *= 0.5; pitch *= 0.5; roll *= 0.5; double c1 = Math.Cos(yaw); double c2 = Math.Cos(pitch); double c3 = Math.Cos(roll); double s1 = Math.Sin(yaw); double s2 = Math.Sin(pitch); double s3 = Math.Sin(roll); W = c1 * c2 * c3 - s1 * s2 * s3; Xyz.X = s1 * s2 * c3 + c1 * c2 * s3; Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; } /// <summary> /// Construct a new Quaterniond from given Euler angles /// </summary> /// <param name="eulerAngles">The euler angles as a Vector3d</param> public Quaterniond(Vector3d eulerAngles) : this(eulerAngles.X, eulerAngles.Y, eulerAngles.Z) { } /// <summary> /// Gets or sets the X component of this instance. /// </summary> [XmlIgnore] public double X { get { return Xyz.X; } set { Xyz.X = value; } } /// <summary> /// Gets or sets the Y component of this instance. /// </summary> [XmlIgnore] public double Y { get { return Xyz.Y; } set { Xyz.Y = value; } } /// <summary> /// Gets or sets the Z component of this instance. /// </summary> [XmlIgnore] public double Z { get { return Xyz.Z; } set { Xyz.Z = value; } } /// <summary> /// Convert the current quaternion to axis angle representation /// </summary> /// <param name="axis">The resultant axis</param> /// <param name="angle">The resultant angle</param> public void ToAxisAngle(out Vector3d axis, out double angle) { Vector4d result = ToAxisAngle(); axis = result.Xyz; angle = result.W; } /// <summary> /// Convert this instance to an axis-angle representation. /// </summary> /// <returns>A Vector4 that is the axis-angle representation of this quaternion.</returns> public Vector4d ToAxisAngle() { Quaterniond q = this; if (Math.Abs(q.W) > 1.0f) { q.Normalize(); } Vector4d result = new Vector4d(); result.W = 2.0f * (float)System.Math.Acos(q.W); // angle float den = (float)System.Math.Sqrt(1.0 - q.W * q.W); if (den > 0.0001f) { result.Xyz = q.Xyz / den; } else { // This occurs when the angle is zero. // Not a problem: just set an arbitrary normalized axis. result.Xyz = Vector3d.UnitX; } return result; } /// <summary> /// Gets the length (magnitude) of the Quaterniond. /// </summary> /// <seealso cref="LengthSquared"/> public double Length { get { return (double)System.Math.Sqrt(W * W + Xyz.LengthSquared); } } /// <summary> /// Gets the square of the Quaterniond length (magnitude). /// </summary> public double LengthSquared { get { return W * W + Xyz.LengthSquared; } } /// <summary> /// Returns a copy of the Quaterniond scaled to unit length. /// </summary> public Quaterniond Normalized() { Quaterniond q = this; q.Normalize(); return q; } /// <summary> /// Reverses the rotation angle of this Quaterniond. /// </summary> public void Invert() { W = -W; } /// <summary> /// Returns a copy of this Quaterniond with its rotation angle reversed. /// </summary> public Quaterniond Inverted() { var q = this; q.Invert(); return q; } /// <summary> /// Scales the Quaterniond to unit length. /// </summary> public void Normalize() { double scale = 1.0f / this.Length; Xyz *= scale; W *= scale; } /// <summary> /// Inverts the Vector3d component of this Quaterniond. /// </summary> public void Conjugate() { Xyz = -Xyz; } /// <summary> /// Defines the identity quaternion. /// </summary> public readonly static Quaterniond Identity = new Quaterniond(0, 0, 0, 1); /// <summary> /// Add two quaternions /// </summary> /// <param name="left">The first operand</param> /// <param name="right">The second operand</param> /// <returns>The result of the addition</returns> public static Quaterniond Add(Quaterniond left, Quaterniond right) { return new Quaterniond( left.Xyz + right.Xyz, left.W + right.W); } /// <summary> /// Add two quaternions /// </summary> /// <param name="left">The first operand</param> /// <param name="right">The second operand</param> /// <param name="result">The result of the addition</param> public static void Add(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result = new Quaterniond( left.Xyz + right.Xyz, left.W + right.W); } /// <summary> /// Subtracts two instances. /// </summary> /// <param name="left">The left instance.</param> /// <param name="right">The right instance.</param> /// <returns>The result of the operation.</returns> public static Quaterniond Sub(Quaterniond left, Quaterniond right) { return new Quaterniond( left.Xyz - right.Xyz, left.W - right.W); } /// <summary> /// Subtracts two instances. /// </summary> /// <param name="left">The left instance.</param> /// <param name="right">The right instance.</param> /// <param name="result">The result of the operation.</param> public static void Sub(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result = new Quaterniond( left.Xyz - right.Xyz, left.W - right.W); } /// <summary> /// Multiplies two instances. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>A new instance containing the result of the calculation.</returns> public static Quaterniond Multiply(Quaterniond left, Quaterniond right) { Quaterniond result; Multiply(ref left, ref right, out result); return result; } /// <summary> /// Multiplies two instances. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <param name="result">A new instance containing the result of the calculation.</param> public static void Multiply(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result = new Quaterniond( right.W * left.Xyz + left.W * right.Xyz + Vector3d.Cross(left.Xyz, right.Xyz), left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz)); } /// <summary> /// Multiplies an instance by a scalar. /// </summary> /// <param name="quaternion">The instance.</param> /// <param name="scale">The scalar.</param> /// <param name="result">A new instance containing the result of the calculation.</param> public static void Multiply(ref Quaterniond quaternion, double scale, out Quaterniond result) { result = new Quaterniond(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale); } /// <summary> /// Multiplies an instance by a scalar. /// </summary> /// <param name="quaternion">The instance.</param> /// <param name="scale">The scalar.</param> /// <returns>A new instance containing the result of the calculation.</returns> public static Quaterniond Multiply(Quaterniond quaternion, double scale) { return new Quaterniond(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale); } /// <summary> /// Get the conjugate of the given Quaterniond /// </summary> /// <param name="q">The Quaterniond</param> /// <returns>The conjugate of the given Quaterniond</returns> public static Quaterniond Conjugate(Quaterniond q) { return new Quaterniond(-q.Xyz, q.W); } /// <summary> /// Get the conjugate of the given Quaterniond /// </summary> /// <param name="q">The Quaterniond</param> /// <param name="result">The conjugate of the given Quaterniond</param> public static void Conjugate(ref Quaterniond q, out Quaterniond result) { result = new Quaterniond(-q.Xyz, q.W); } /// <summary> /// Get the inverse of the given Quaterniond /// </summary> /// <param name="q">The Quaterniond to invert</param> /// <returns>The inverse of the given Quaterniond</returns> public static Quaterniond Invert(Quaterniond q) { Quaterniond result; Invert(ref q, out result); return result; } /// <summary> /// Get the inverse of the given Quaterniond /// </summary> /// <param name="q">The Quaterniond to invert</param> /// <param name="result">The inverse of the given Quaterniond</param> public static void Invert(ref Quaterniond q, out Quaterniond result) { double lengthSq = q.LengthSquared; if (lengthSq != 0.0) { double i = 1.0f / lengthSq; result = new Quaterniond(q.Xyz * -i, q.W * i); } else { result = q; } } /// <summary> /// Scale the given Quaterniond to unit length /// </summary> /// <param name="q">The Quaterniond to normalize</param> /// <returns>The normalized Quaterniond</returns> public static Quaterniond Normalize(Quaterniond q) { Quaterniond result; Normalize(ref q, out result); return result; } /// <summary> /// Scale the given Quaterniond to unit length /// </summary> /// <param name="q">The Quaterniond to normalize</param> /// <param name="result">The normalized Quaterniond</param> public static void Normalize(ref Quaterniond q, out Quaterniond result) { double scale = 1.0f / q.Length; result = new Quaterniond(q.Xyz * scale, q.W * scale); } /// <summary> /// Build a Quaterniond from the given axis and angle /// </summary> /// <param name="axis">The axis to rotate about</param> /// <param name="angle">The rotation angle in radians</param> /// <returns></returns> public static Quaterniond FromAxisAngle(Vector3d axis, double angle) { if (axis.LengthSquared == 0.0f) { return Identity; } Quaterniond result = Identity; angle *= 0.5f; axis.Normalize(); result.Xyz = axis * (double)System.Math.Sin(angle); result.W = (double)System.Math.Cos(angle); return Normalize(result); } /// <summary> /// Builds a Quaterniond from the given euler angles /// </summary> /// <param name="pitch">The pitch (attitude), rotation around X axis</param> /// <param name="yaw">The yaw (heading), rotation around Y axis</param> /// <param name="roll">The roll (bank), rotation around Z axis</param> /// <returns></returns> public static Quaterniond FromEulerAngles(double pitch, double yaw, double roll) { return new Quaterniond(pitch, yaw, roll); } /// <summary> /// Builds a Quaterniond from the given euler angles /// </summary> /// <param name="eulerAngles">The euler angles as a vector</param> /// <returns>The equivalent Quaterniond</returns> public static Quaterniond FromEulerAngles(Vector3d eulerAngles) { return new Quaterniond(eulerAngles); } /// <summary> /// Builds a Quaterniond from the given euler angles /// </summary> /// <param name="eulerAngles">The euler angles a vector</param> /// <param name="result">The equivalent Quaterniond</param> public static void FromEulerAngles(ref Vector3d eulerAngles, out Quaterniond result) { double c1 = Math.Cos(eulerAngles.Y * 0.5); double c2 = Math.Cos(eulerAngles.X * 0.5); double c3 = Math.Cos(eulerAngles.Z * 0.5); double s1 = Math.Sin(eulerAngles.Y * 0.5); double s2 = Math.Sin(eulerAngles.X * 0.5); double s3 = Math.Sin(eulerAngles.Z * 0.5); result.W = c1 * c2 * c3 - s1 * s2 * s3; result.Xyz.X = s1 * s2 * c3 + c1 * c2 * s3; result.Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; result.Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; } /// <summary> /// Builds a quaternion from the given rotation matrix /// </summary> /// <param name="matrix">A rotation matrix</param> /// <returns>The equivalent quaternion</returns> public static Quaterniond FromMatrix(Matrix3d matrix) { Quaterniond result; FromMatrix(ref matrix, out result); return result; } /// <summary> /// Builds a quaternion from the given rotation matrix /// </summary> /// <param name="matrix">A rotation matrix</param> /// <param name="result">The equivalent quaternion</param> public static void FromMatrix(ref Matrix3d matrix, out Quaterniond result) { double trace = matrix.Trace; if (trace > 0) { double s = Math.Sqrt(trace + 1) * 2; double invS = 1.0 / s; result.W = s * 0.25; result.Xyz.X = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.Xyz.Y = (matrix.Row0.Z - matrix.Row2.X) * invS; result.Xyz.Z = (matrix.Row1.X - matrix.Row0.Y) * invS; } else { double m00 = matrix.Row0.X, m11 = matrix.Row1.Y, m22 = matrix.Row2.Z; if (m00 > m11 && m00 > m22) { double s = Math.Sqrt(1 + m00 - m11 - m22) * 2; double invS = 1.0 / s; result.W = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.Xyz.X = s * 0.25; result.Xyz.Y = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.Z = (matrix.Row0.Z + matrix.Row2.X) * invS; } else if (m11 > m22) { double s = Math.Sqrt(1 + m11 - m00 - m22) * 2; double invS = 1.0 / s; result.W = (matrix.Row0.Z - matrix.Row2.X) * invS; result.Xyz.X = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.Y = s * 0.25; result.Xyz.Z = (matrix.Row1.Z + matrix.Row2.Y) * invS; } else { double s = Math.Sqrt(1 + m22 - m00 - m11) * 2; double invS = 1.0 / s; result.W = (matrix.Row1.X - matrix.Row0.Y) * invS; result.Xyz.X = (matrix.Row0.Z + matrix.Row2.X) * invS; result.Xyz.Y = (matrix.Row1.Z + matrix.Row2.Y) * invS; result.Xyz.Z = s * 0.25; } } } /// <summary> /// Do Spherical linear interpolation between two quaternions /// </summary> /// <param name="q1">The first Quaterniond</param> /// <param name="q2">The second Quaterniond</param> /// <param name="blend">The blend factor</param> /// <returns>A smooth blend between the given quaternions</returns> public static Quaterniond Slerp(Quaterniond q1, Quaterniond q2, double blend) { // if either input is zero, return the other. if (q1.LengthSquared == 0.0f) { if (q2.LengthSquared == 0.0f) { return Identity; } return q2; } else if (q2.LengthSquared == 0.0f) { return q1; } double cosHalfAngle = q1.W * q2.W + Vector3d.Dot(q1.Xyz, q2.Xyz); if (cosHalfAngle >= 1.0f || cosHalfAngle <= -1.0f) { // angle = 0.0f, so just return one input. return q1; } else if (cosHalfAngle < 0.0f) { q2.Xyz = -q2.Xyz; q2.W = -q2.W; cosHalfAngle = -cosHalfAngle; } double blendA; double blendB; if (cosHalfAngle < 0.99f) { // do proper slerp for big angles double halfAngle = (double)System.Math.Acos(cosHalfAngle); double sinHalfAngle = (double)System.Math.Sin(halfAngle); double oneOverSinHalfAngle = 1.0f / sinHalfAngle; blendA = (double)System.Math.Sin(halfAngle * (1.0f - blend)) * oneOverSinHalfAngle; blendB = (double)System.Math.Sin(halfAngle * blend) * oneOverSinHalfAngle; } else { // do lerp if angle is really small. blendA = 1.0f - blend; blendB = blend; } Quaterniond result = new Quaterniond(blendA * q1.Xyz + blendB * q2.Xyz, blendA * q1.W + blendB * q2.W); if (result.LengthSquared > 0.0f) { return Normalize(result); } else { return Identity; } } /// <summary> /// Adds two instances. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>The result of the calculation.</returns> public static Quaterniond operator +(Quaterniond left, Quaterniond right) { left.Xyz += right.Xyz; left.W += right.W; return left; } /// <summary> /// Subtracts two instances. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>The result of the calculation.</returns> public static Quaterniond operator -(Quaterniond left, Quaterniond right) { left.Xyz -= right.Xyz; left.W -= right.W; return left; } /// <summary> /// Multiplies two instances. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>The result of the calculation.</returns> public static Quaterniond operator *(Quaterniond left, Quaterniond right) { Multiply(ref left, ref right, out left); return left; } /// <summary> /// Multiplies an instance by a scalar. /// </summary> /// <param name="quaternion">The instance.</param> /// <param name="scale">The scalar.</param> /// <returns>A new instance containing the result of the calculation.</returns> public static Quaterniond operator *(Quaterniond quaternion, double scale) { Multiply(ref quaternion, scale, out quaternion); return quaternion; } /// <summary> /// Multiplies an instance by a scalar. /// </summary> /// <param name="quaternion">The instance.</param> /// <param name="scale">The scalar.</param> /// <returns>A new instance containing the result of the calculation.</returns> public static Quaterniond operator *(double scale, Quaterniond quaternion) { return new Quaterniond(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale); } /// <summary> /// Compares two instances for equality. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>True, if left equals right; false otherwise.</returns> public static bool operator ==(Quaterniond left, Quaterniond right) { return left.Equals(right); } /// <summary> /// Compares two instances for inequality. /// </summary> /// <param name="left">The first instance.</param> /// <param name="right">The second instance.</param> /// <returns>True, if left does not equal right; false otherwise.</returns> public static bool operator !=(Quaterniond left, Quaterniond right) { return !left.Equals(right); } /// <summary> /// Returns a System.String that represents the current Quaterniond. /// </summary> /// <returns></returns> public override string ToString() { return String.Format("V: {0}, W: {1}", Xyz, W); } /// <summary> /// Compares this object instance to another object for equality. /// </summary> /// <param name="other">The other object to be used in the comparison.</param> /// <returns>True if both objects are Quaternions of equal value. Otherwise it returns false.</returns> public override bool Equals(object other) { if (other is Quaterniond == false) { return false; } return this == (Quaterniond)other; } /// <summary> /// Provides the hash code for this object. /// </summary> /// <returns>A hash code formed from the bitwise XOR of this objects members.</returns> public override int GetHashCode() { unchecked { return (this.Xyz.GetHashCode() * 397) ^ this.W.GetHashCode(); } } #if false /// <summary>The W component of the Quaterniond.</summary> public double W; /// <summary>The X component of the Quaterniond.</summary> public double X; /// <summary>The Y component of the Quaterniond.</summary> public double Y; /// <summary>The Z component of the Quaterniond.</summary> public double Z; /// <summary>Constructs left Quaterniond that is left copy of the given Quaterniond.</summary> /// <param name="quaterniond">The Quaterniond to copy.</param> public Quaterniond(ref Quaterniond Quaterniond) : this(Quaterniond.W, Quaterniond.X, Quaterniond.Y, Quaterniond.Z) { } /// <summary>Constructs left Quaterniond from the given components.</summary> /// <param name="w">The W component for the Quaterniond.</param> /// <param name="vector3d">A Vector representing the X, Y, and Z componets for the quaterion.</param> public Quaterniond(double w, ref Vector3d vector3d) : this(w, vector3d.X, vector3d.Y, vector3d.Z) { } /// <summary>Constructs left Quaterniond from the given axis and angle.</summary> /// <param name="axis">The axis for the Quaterniond.</param> /// <param name="angle">The angle for the quaternione.</param> public Quaterniond(ref Vector3d axis, double angle) { double halfAngle = Functions.DTOR * angle / 2; this.W = System.Math.Cos(halfAngle); double sin = System.Math.Sin(halfAngle); Vector3d axisNormalized; Vector3d.Normalize(ref axis, out axisNormalized); this.X = axisNormalized.X * sin; this.Y = axisNormalized.Y * sin; this.Z = axisNormalized.Z * sin; } /// <summary>Constructs left Quaterniond from the given components.</summary> /// <param name="w">The W component for the Quaterniond.</param> /// <param name="x">The X component for the Quaterniond.</param> /// <param name="y">The Y component for the Quaterniond.</param> /// <param name="z">The Z component for the Quaterniond.</param> public Quaterniond(double w, double x, double y, double z) { this.W = w; this.X = x; this.Y = y; this.Z = z; } /// <summary>Constructs left Quaterniond from the given array of double-precision floating-point numbers.</summary> /// <param name="doubleArray">The array of doubles for the components of the Quaterniond.</param> public Quaterniond(double[] doubleArray) { if (doubleArray == null || doubleArray.GetLength(0) < 4) throw new MissingFieldException(); this.W = doubleArray[0]; this.X = doubleArray[1]; this.Y = doubleArray[2]; this.Z = doubleArray[3]; } /// <summary>Constructs left Quaterniond from the given matrix. Only contains rotation information.</summary> /// <param name="matrix">The matrix for the components of the Quaterniond.</param> public Quaterniond(ref Matrix4d matrix) { double scale = System.Math.Pow(matrix.Determinant, 1.0d/3.0d); W = System.Math.Sqrt(System.Math.Max(0, scale + matrix[0, 0] + matrix[1, 1] + matrix[2, 2])) / 2; X = System.Math.Sqrt(System.Math.Max(0, scale + matrix[0, 0] - matrix[1, 1] - matrix[2, 2])) / 2; Y = System.Math.Sqrt(System.Math.Max(0, scale - matrix[0, 0] + matrix[1, 1] - matrix[2, 2])) / 2; Z = System.Math.Sqrt(System.Math.Max(0, scale - matrix[0, 0] - matrix[1, 1] + matrix[2, 2])) / 2; if( matrix[2,1] - matrix[1,2] < 0 ) X = -X; if( matrix[0,2] - matrix[2,0] < 0 ) Y = -Y; if( matrix[1,0] - matrix[0,1] < 0 ) Z = -Z; } public Quaterniond(ref Matrix3d matrix) { double scale = System.Math.Pow(matrix.Determinant, 1.0d / 3.0d); W = System.Math.Sqrt(System.Math.Max(0, scale + matrix[0, 0] + matrix[1, 1] + matrix[2, 2])) / 2; X = System.Math.Sqrt(System.Math.Max(0, scale + matrix[0, 0] - matrix[1, 1] - matrix[2, 2])) / 2; Y = System.Math.Sqrt(System.Math.Max(0, scale - matrix[0, 0] + matrix[1, 1] - matrix[2, 2])) / 2; Z = System.Math.Sqrt(System.Math.Max(0, scale - matrix[0, 0] - matrix[1, 1] + matrix[2, 2])) / 2; if (matrix[2, 1] - matrix[1, 2] < 0) X = -X; if (matrix[0, 2] - matrix[2, 0] < 0) Y = -Y; if (matrix[1, 0] - matrix[0, 1] < 0) Z = -Z; } public void Add(ref Quaterniond Quaterniond) { W = W + Quaterniond.W; X = X + Quaterniond.X; Y = Y + Quaterniond.Y; Z = Z + Quaterniond.Z; } public void Add(ref Quaterniond Quaterniond, out Quaterniond result) { result.W = W + Quaterniond.W; result.X = X + Quaterniond.X; result.Y = Y + Quaterniond.Y; result.Z = Z + Quaterniond.Z; } public static void Add(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result.W = left.W + right.W; result.X = left.X + right.X; result.Y = left.Y + right.Y; result.Z = left.Z + right.Z; } public void Subtract(ref Quaterniond Quaterniond) { W = W - Quaterniond.W; X = X - Quaterniond.X; Y = Y - Quaterniond.Y; Z = Z - Quaterniond.Z; } public void Subtract(ref Quaterniond Quaterniond, out Quaterniond result) { result.W = W - Quaterniond.W; result.X = X - Quaterniond.X; result.Y = Y - Quaterniond.Y; result.Z = Z - Quaterniond.Z; } public static void Subtract(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result.W = left.W - right.W; result.X = left.X - right.X; result.Y = left.Y - right.Y; result.Z = left.Z - right.Z; } public void Multiply(ref Quaterniond Quaterniond) { double w = W * Quaterniond.W - X * Quaterniond.X - Y * Quaterniond.Y - Z * Quaterniond.Z; double x = W * Quaterniond.X + X * Quaterniond.W + Y * Quaterniond.Z - Z * Quaterniond.Y; double y = W * Quaterniond.Y + Y * Quaterniond.W + Z * Quaterniond.X - X * Quaterniond.Z; Z = W * Quaterniond.Z + Z * Quaterniond.W + X * Quaterniond.Y - Y * Quaterniond.X; W = w; X = x; Y = y; } public void Multiply(ref Quaterniond Quaterniond, out Quaterniond result) { result.W = W * Quaterniond.W - X * Quaterniond.X - Y * Quaterniond.Y - Z * Quaterniond.Z; result.X = W * Quaterniond.X + X * Quaterniond.W + Y * Quaterniond.Z - Z * Quaterniond.Y; result.Y = W * Quaterniond.Y + Y * Quaterniond.W + Z * Quaterniond.X - X * Quaterniond.Z; result.Z = W * Quaterniond.Z + Z * Quaterniond.W + X * Quaterniond.Y - Y * Quaterniond.X; } public static void Multiply(ref Quaterniond left, ref Quaterniond right, out Quaterniond result) { result.W = left.W * right.W - left.X * right.X - left.Y * right.Y - left.Z * right.Z; result.X = left.W * right.X + left.X * right.W + left.Y * right.Z - left.Z * right.Y; result.Y = left.W * right.Y + left.Y * right.W + left.Z * right.X - left.X * right.Z; result.Z = left.W * right.Z + left.Z * right.W + left.X * right.Y - left.Y * right.X; } public void Multiply(double scalar) { W = W * scalar; X = X * scalar; Y = Y * scalar; Z = Z * scalar; } public void Multiply(double scalar, out Quaterniond result) { result.W = W * scalar; result.X = X * scalar; result.Y = Y * scalar; result.Z = Z * scalar; } public static void Multiply(ref Quaterniond Quaterniond, double scalar, out Quaterniond result) { result.W = Quaterniond.W * scalar; result.X = Quaterniond.X * scalar; result.Y = Quaterniond.Y * scalar; result.Z = Quaterniond.Z * scalar; } public void Divide(double scalar) { if (scalar == 0) throw new DivideByZeroException(); W = W / scalar; X = X / scalar; Y = Y / scalar; Z = Z / scalar; } public void Divide(double scalar, out Quaterniond result) { if (scalar == 0) throw new DivideByZeroException(); result.W = W / scalar; result.X = X / scalar; result.Y = Y / scalar; result.Z = Z / scalar; } public static void Divide(ref Quaterniond Quaterniond, double scalar, out Quaterniond result) { if (scalar == 0) throw new DivideByZeroException(); result.W = Quaterniond.W / scalar; result.X = Quaterniond.X / scalar; result.Y = Quaterniond.Y / scalar; result.Z = Quaterniond.Z / scalar; } public double Modulus { get { return System.Math.Sqrt(W * W + X * X + Y * Y + Z * Z); } } public double ModulusSquared { get { return W * W + X * X + Y * Y + Z * Z; } } public static double DotProduct(Quaterniond left, Quaterniond right) { return left.W * right.W + left.X * right.X + left.Y * right.Y + left.Z * right.Z; } public void Normalize() { double modulus = System.Math.Sqrt(W * W + X * X + Y * Y + Z * Z); if (modulus == 0) throw new DivideByZeroException(); W = W / modulus; X = X / modulus; Y = Y / modulus; Z = Z / modulus; } public void Normalize( out Quaterniond result ) { double modulus = System.Math.Sqrt(W * W + X * X + Y * Y + Z * Z); if (modulus == 0) throw new DivideByZeroException(); result.W = W / modulus; result.X = X / modulus; result.Y = Y / modulus; result.Z = Z / modulus; } public static void Normalize(ref Quaterniond Quaterniond, out Quaterniond result) { double modulus = System.Math.Sqrt(Quaterniond.W * Quaterniond.W + Quaterniond.X * Quaterniond.X + Quaterniond.Y * Quaterniond.Y + Quaterniond.Z * Quaterniond.Z); if (modulus == 0) throw new DivideByZeroException(); result.W = Quaterniond.W / modulus; result.X = Quaterniond.X / modulus; result.Y = Quaterniond.Y / modulus; result.Z = Quaterniond.Z / modulus; } public void Conjugate() { X = -X; Y = -Y; Z = -Z; } public void Conjugate( out Quaterniond result ) { result.W = W; result.X = -X; result.Y = -Y; result.Z = -Z; } public static void Conjugate(ref Quaterniond Quaterniond, out Quaterniond result) { result.W = Quaterniond.W; result.X = -Quaterniond.X; result.Y = -Quaterniond.Y; result.Z = -Quaterniond.Z; } public void Inverse() { double modulusSquared = W * W + X * X + Y * Y + Z * Z; if (modulusSquared <= 0) throw new InvalidOperationException(); double inverseModulusSquared = 1.0 / modulusSquared; W = W * inverseModulusSquared; X = X * -inverseModulusSquared; Y = Y * -inverseModulusSquared; Z = Z * -inverseModulusSquared; } public void Inverse( out Quaterniond result ) { double modulusSquared = W * W + X * X + Y * Y + Z * Z; if (modulusSquared <= 0) throw new InvalidOperationException(); double inverseModulusSquared = 1.0 / modulusSquared; result.W = W * inverseModulusSquared; result.X = X * -inverseModulusSquared; result.Y = Y * -inverseModulusSquared; result.Z = Z * -inverseModulusSquared; } public static void Inverse(ref Quaterniond Quaterniond, out Quaterniond result) { double modulusSquared = Quaterniond.W * Quaterniond.W + Quaterniond.X * Quaterniond.X + Quaterniond.Y * Quaterniond.Y + Quaterniond.Z * Quaterniond.Z; if (modulusSquared <= 0) throw new InvalidOperationException(); double inverseModulusSquared = 1.0 / modulusSquared; result.W = Quaterniond.W * inverseModulusSquared; result.X = Quaterniond.X * -inverseModulusSquared; result.Y = Quaterniond.Y * -inverseModulusSquared; result.Z = Quaterniond.Z * -inverseModulusSquared; } public void Log() { if (System.Math.Abs(W) < 1.0) { double angle = System.Math.Acos(W); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) >= 0) { double coefficient = angle / sin; X = X * coefficient; Y = Y * coefficient; Z = Z * coefficient; } } else { X = 0; Y = 0; Z = 0; } W = 0; } public void Log( out Quaterniond result ) { if (System.Math.Abs(W) < 1.0) { double angle = System.Math.Acos(W); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) >= 0) { double coefficient = angle / sin; result.X = X * coefficient; result.Y = Y * coefficient; result.Z = Z * coefficient; } else { result.X = X; result.Y = Y; result.Z = Z; } } else { result.X = 0; result.Y = 0; result.Z = 0; } result.W = 0; } public static void Log(ref Quaterniond Quaterniond, out Quaterniond result) { if (System.Math.Abs(Quaterniond.W) < 1.0) { double angle = System.Math.Acos(Quaterniond.W); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) >= 0) { double coefficient = angle / sin; result.X = Quaterniond.X * coefficient; result.Y = Quaterniond.Y * coefficient; result.Z = Quaterniond.Z * coefficient; } else { result.X = Quaterniond.X; result.Y = Quaterniond.Y; result.Z = Quaterniond.Z; } } else { result.X = 0; result.Y = 0; result.Z = 0; } result.W = 0; } public void Exp() { double angle = System.Math.Sqrt(X * X + Y * Y + Z * Z); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) > 0) { double coefficient = angle / sin; W = 0; X = X * coefficient; Y = Y * coefficient; Z = Z * coefficient; } else { W = 0; } } public void Exp(out Quaterniond result) { double angle = System.Math.Sqrt(X * X + Y * Y + Z * Z); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) > 0) { double coefficient = angle / sin; result.W = 0; result.X = X * coefficient; result.Y = Y * coefficient; result.Z = Z * coefficient; } else { result.W = 0; result.X = X; result.Y = Y; result.Z = Z; } } public static void Exp(ref Quaterniond Quaterniond, out Quaterniond result) { double angle = System.Math.Sqrt(Quaterniond.X * Quaterniond.X + Quaterniond.Y * Quaterniond.Y + Quaterniond.Z * Quaterniond.Z); double sin = System.Math.Sin(angle); if (System.Math.Abs(sin) > 0) { double coefficient = angle / sin; result.W = 0; result.X = Quaterniond.X * coefficient; result.Y = Quaterniond.Y * coefficient; result.Z = Quaterniond.Z * coefficient; } else { result.W = 0; result.X = Quaterniond.X; result.Y = Quaterniond.Y; result.Z = Quaterniond.Z; } } /// <summary>Returns left matrix for this Quaterniond.</summary> public void Matrix4d(out Matrix4d result) { // TODO Expand result = new Matrix4d(ref this); } public void GetAxisAndAngle(out Vector3d axis, out double angle) { Quaterniond Quaterniond; Normalize(out Quaterniond); double cos = Quaterniond.W; angle = System.Math.Acos(cos) * 2 * Functions.RTOD; double sin = System.Math.Sqrt( 1.0d - cos * cos ); if ( System.Math.Abs( sin ) < 0.0001 ) sin = 1; axis = new Vector3d(X / sin, Y / sin, Z / sin); } public static void Slerp(ref Quaterniond start, ref Quaterniond end, double blend, out Quaterniond result) { if (start.W == 0 && start.X == 0 && start.Y == 0 && start.Z == 0) { if (end.W == 0 && end.X == 0 && end.Y == 0 && end.Z == 0) { result.W = 1; result.X = 0; result.Y = 0; result.Z = 0; } else { result = end; } } else if (end.W == 0 && end.X == 0 && end.Y == 0 && end.Z == 0) { result = start; } Vector3d startVector = new Vector3d(start.X, start.Y, start.Z); Vector3d endVector = new Vector3d(end.X, end.Y, end.Z); double cosHalfAngle = start.W * end.W + Vector3d.Dot(startVector, endVector); if (cosHalfAngle >= 1.0f || cosHalfAngle <= -1.0f) { // angle = 0.0f, so just return one input. result = start; } else if (cosHalfAngle < 0.0f) { end.W = -end.W; end.X = -end.X; end.Y = -end.Y; end.Z = -end.Z; cosHalfAngle = -cosHalfAngle; } double blendA; double blendB; if (cosHalfAngle < 0.99f) { // do proper slerp for big angles double halfAngle = (double)System.Math.Acos(cosHalfAngle); double sinHalfAngle = (double)System.Math.Sin(halfAngle); double oneOverSinHalfAngle = 1.0f / sinHalfAngle; blendA = (double)System.Math.Sin(halfAngle * (1.0f - blend)) * oneOverSinHalfAngle; blendB = (double)System.Math.Sin(halfAngle * blend) * oneOverSinHalfAngle; } else { // do lerp if angle is really small. blendA = 1.0f - blend; blendB = blend; } result.W = blendA * start.W + blendB * end.W; result.X = blendA * start.X + blendB * end.X; result.Y = blendA * start.Y + blendB * end.Y; result.Z = blendA * start.Z + blendB * end.Z; if (result.W != 0 || result.X != 0 || result.Y != 0 || result.Z != 0) { result.Normalize(); } else { result.W = 1; result.X = 0; result.Y = 0; result.Z = 0; } } /// <summary>Returns the hash code for this instance.</summary> /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns> public override int GetHashCode() { base.GetHashCode(); return W.GetHashCode() ^ X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); } /// <summary>Returns the fully qualified type name of this instance.</summary> /// <returns>A System.String containing left fully qualified type name.</returns> public override string ToString() { return string.Format("({0}, {1}, {2}, {3})", W, X, Y, Z); } /// <summary>Parses left string, converting it to left Quaterniond.</summary> /// <param name="str">The string to parse.</param> /// <returns>The Quaterniond represented by the string.</returns> public static void Parse(string str, out Quaterniond result) { Match match = new Regex(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None).Match(str); if (!match.Success) throw new Exception("Parse failed!"); result.W = double.Parse(match.Result("${w}")); result.X = double.Parse(match.Result("${x}")); result.Y = double.Parse(match.Result("${y}")); result.Z = double.Parse(match.Result("${z}")); } /// <summary>A quaterion with all zero components.</summary> public static readonly Quaterniond Zero = new Quaterniond(0, 0, 0, 0); /// <summary>A quaterion representing an identity.</summary> public static readonly Quaterniond Identity = new Quaterniond(1, 0, 0, 0); /// <summary>A quaterion representing the W axis.</summary> public static readonly Quaterniond WAxis = new Quaterniond(1, 0, 0, 0); /// <summary>A quaterion representing the X axis.</summary> public static readonly Quaterniond XAxis = new Quaterniond(0, 1, 0, 0); /// <summary>A quaterion representing the Y axis.</summary> public static readonly Quaterniond YAxis = new Quaterniond(0, 0, 1, 0); /// <summary>A quaterion representing the Z axis.</summary> public static readonly Quaterniond ZAxis = new Quaterniond(0, 0, 0, 1); #endif /// <summary> /// Compares this Quaterniond instance to another Quaterniond for equality. /// </summary> /// <param name="other">The other Quaterniond to be used in the comparison.</param> /// <returns>True if both instances are equal; false otherwise.</returns> public bool Equals(Quaterniond other) { return Xyz == other.Xyz && W == other.W; } } }
37.326592
173
0.51478
[ "MIT" ]
LayoutFarm/PixelFarm
src/PixelFarm/BackEnd.MiniOpenTK/src/OpenTK/Math/Quaterniond.cs
49,831
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using CampaignManager.App.Models; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; namespace CampaignManager.App.Areas.Identity.Pages.Account { [AllowAnonymous] public class ConfirmEmailChangeModel : PageModel { private readonly UserManager<ApplicationUser> _userManager; private readonly SignInManager<ApplicationUser> _signInManager; public ConfirmEmailChangeModel(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager) { _userManager = userManager; _signInManager = signInManager; } [TempData] public string StatusMessage { get; set; } public async Task<IActionResult> OnGetAsync(string userId, string email, string code) { if (userId == null || email == null || code == null) { return RedirectToPage("/Index"); } var user = await _userManager.FindByIdAsync(userId); if (user == null) { return NotFound($"Unable to load user with ID '{userId}'."); } code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code)); var result = await _userManager.ChangeEmailAsync(user, email, code); if (!result.Succeeded) { StatusMessage = "Error changing email."; return Page(); } // In our UI email and user name are one and the same, so when we update the email // we need to update the user name. var setUserNameResult = await _userManager.SetUserNameAsync(user, email); if (!setUserNameResult.Succeeded) { StatusMessage = "Error changing user name."; return Page(); } await _signInManager.RefreshSignInAsync(user); StatusMessage = "Thank you for confirming your email change."; return Page(); } } }
34.318182
126
0.625166
[ "MIT" ]
Maissae/CampaignManager
src/CampaignManager.App/Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs
2,265
C#
namespace DSA_attendance_system { partial class dashboard { /// <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.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.employeeManagementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.attendanceManagementToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.logoutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 // this.menuStrip1.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.employeeManagementToolStripMenuItem, this.attendanceManagementToolStripMenuItem, this.settingsToolStripMenuItem, this.logoutToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1371, 40); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuStrip1_ItemClicked); // // employeeManagementToolStripMenuItem // this.employeeManagementToolStripMenuItem.Name = "employeeManagementToolStripMenuItem"; this.employeeManagementToolStripMenuItem.Size = new System.Drawing.Size(274, 36); this.employeeManagementToolStripMenuItem.Text = "Student Management"; this.employeeManagementToolStripMenuItem.Click += new System.EventHandler(this.employeeManagementToolStripMenuItem_Click); // // attendanceManagementToolStripMenuItem // this.attendanceManagementToolStripMenuItem.Name = "attendanceManagementToolStripMenuItem"; this.attendanceManagementToolStripMenuItem.Size = new System.Drawing.Size(317, 36); this.attendanceManagementToolStripMenuItem.Text = "Attendance Management"; this.attendanceManagementToolStripMenuItem.Click += new System.EventHandler(this.attendanceManagementToolStripMenuItem_Click); // // settingsToolStripMenuItem // this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Size = new System.Drawing.Size(120, 36); this.settingsToolStripMenuItem.Text = "Settings"; this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); // // logoutToolStripMenuItem // this.logoutToolStripMenuItem.Name = "logoutToolStripMenuItem"; this.logoutToolStripMenuItem.Size = new System.Drawing.Size(109, 36); this.logoutToolStripMenuItem.Text = "Logout"; this.logoutToolStripMenuItem.Click += new System.EventHandler(this.logoutToolStripMenuItem_Click); // // dashboard // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(39)))), ((int)(((byte)(135))))); this.ClientSize = new System.Drawing.Size(1371, 922); this.Controls.Add(this.menuStrip1); this.IsMdiContainer = true; this.MainMenuStrip = this.menuStrip1; this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "dashboard"; this.Text = "Dashboard"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.dashboard_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem employeeManagementToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem attendanceManagementToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem logoutToolStripMenuItem; } }
51.044643
158
0.648767
[ "Apache-2.0" ]
GunarakulanGunaretnam/qr-based-attendance-system-for-dreamspace
2-attendance-management-system-c#/DSA-attendance-system/dashboard.Designer.cs
5,719
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("02. Randomize Words")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("02. Randomize Words")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e7361264-8b66-4d3c-9779-09ddda0b368e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.135135
84
0.743444
[ "Apache-2.0" ]
kaliopa1983/Programming-Fundamentals
09.Lab Objects and Classes/02. Randomize Words/Properties/AssemblyInfo.cs
1,414
C#
using System; using MAVN.Service.Campaign.MsSqlRepositories; using Microsoft.EntityFrameworkCore; namespace MAVN.Service.Campaign.Tests.MsSqlRepositories.Fixtures { public class CampaignContextFixture : IDisposable { public CampaignContext BonusEngineContext => GetInMemoryContextWithSeededData(); public DbContextOptions DbContextOptions { get; private set; } private CampaignContext GetInMemoryContextWithSeededData() { var context = CreateDataContext(); CampaignDbContextSeed.Seed(context); return context; } private CampaignContext CreateDataContext() { DbContextOptions = new DbContextOptionsBuilder() .UseInMemoryDatabase(nameof(BonusEngineContext)) .Options; var context = new CampaignContext(DbContextOptions); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); return context; } public void Dispose() { BonusEngineContext?.Dispose(); } } }
28.538462
88
0.647799
[ "MIT" ]
IliyanIlievPH/MAVN.Service.Campaign
tests/MAVN.Service.Campaign.Tests/MsSqlRepositories/Fixtures/CampaignContextFixture.cs
1,113
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.ML.Data; using Microsoft.ML.Runtime; using Microsoft.ML.Runtime.Api; using Microsoft.ML.Runtime.Data; using Microsoft.ML.Runtime.ImageAnalytics; using Microsoft.ML.Runtime.Model; using Microsoft.ML.Runtime.RunTests; using System; using System.Drawing; using System.IO; using System.Linq; using Xunit; using Xunit.Abstractions; namespace Microsoft.ML.Tests { public class ImageTests : TestDataPipeBase { public ImageTests(ITestOutputHelper output) : base(output) { } [Fact] public void TestEstimatorChain() { var env = new MLContext(); var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var invalidData = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.R4, 0), } }, new MultiFileSource(dataFile)); var pipe = new ImageLoadingEstimator(env, imageFolder, ("ImagePath", "ImageReal")) .Append(new ImageResizingEstimator(env, "ImageReal", "ImageReal", 100, 100)) .Append(new ImagePixelExtractingEstimator(env, "ImageReal", "ImagePixels")) .Append(new ImageGrayscalingEstimator(env, ("ImageReal", "ImageGray"))); TestEstimatorCore(pipe, data, null, invalidData); Done(); } [Fact] public void TestEstimatorSaveLoad() { IHostEnvironment env = new MLContext(); var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var pipe = new ImageLoadingEstimator(env, imageFolder, ("ImagePath", "ImageReal")) .Append(new ImageResizingEstimator(env, "ImageReal", "ImageReal", 100, 100)) .Append(new ImagePixelExtractingEstimator(env, "ImageReal", "ImagePixels")) .Append(new ImageGrayscalingEstimator(env, ("ImageReal", "ImageGray"))); pipe.GetOutputSchema(Core.Data.SchemaShape.Create(data.Schema)); var model = pipe.Fit(data); var tempPath = Path.GetTempFileName(); using (var file = new SimpleFileHandle(env, tempPath, true, true)) { using (var fs = file.CreateWriteStream()) model.SaveTo(env, fs); var model2 = TransformerChain.LoadFrom(env, file.OpenReadStream()); var newCols = ((ImageLoaderTransform)model2.First()).Columns; var oldCols = ((ImageLoaderTransform)model.First()).Columns; Assert.True(newCols .Zip(oldCols, (x, y) => x == y) .All(x => x)); } Done(); } [Fact] public void TestSaveImages() { var env = new MLContext(); var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); IDataView cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Name= "ImageCropped", Source = "ImageReal", ImageHeight =100, ImageWidth = 100, Resizing = ImageResizerTransform.ResizingKind.IsoPad} } }, images); cropped.Schema.TryGetColumnIndex("ImagePath", out int pathColumn); cropped.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = cropped.GetRowCursor((x) => true)) { var pathGetter = cursor.GetGetter<ReadOnlyMemory<char>>(pathColumn); ReadOnlyMemory<char> path = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap bitmap = default; while (cursor.MoveNext()) { pathGetter(ref path); bitmapCropGetter(ref bitmap); Assert.NotNull(bitmap); var fileToSave = GetOutputPath(Path.GetFileNameWithoutExtension(path.ToString()) + ".cropped.jpg"); bitmap.Save(fileToSave, System.Drawing.Imaging.ImageFormat.Jpeg); } } Done(); } [Fact] public void TestGreyscaleTransformImages() { IHostEnvironment env = new MLContext(); var imageHeight = 150; var imageWidth = 100; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Name= "ImageCropped", Source = "ImageReal", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); IDataView grey = ImageGrayscaleTransform.Create(env, new ImageGrayscaleTransform.Arguments() { Column = new ImageGrayscaleTransform.Column[1]{ new ImageGrayscaleTransform.Column() { Name= "ImageGrey", Source = "ImageCropped"} } }, cropped); var fname = nameof(TestGreyscaleTransformImages) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(grey)); grey = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); grey.Schema.TryGetColumnIndex("ImageGrey", out int greyColumn); using (var cursor = grey.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(greyColumn); Bitmap bitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref bitmap); Assert.NotNull(bitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var pixel = bitmap.GetPixel(x, y); // greyscale image has same values for R,G and B Assert.True(pixel.R == pixel.G && pixel.G == pixel.B); } } } Done(); } [Fact] public void TestBackAndForthConversionWithAlphaInterleave() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = true, Offset = 127.5f, Scale = 2f / 255, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=true} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = true, Offset = -1f, Scale = 255f / 2, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=true} } }, pixels); var fname = nameof(TestBackAndForthConversionWithAlphaInterleave) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c == r); } } } Done(); } [Fact] public void TestBackAndForthConversionWithoutAlphaInterleave() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = true, Offset = 127.5f, Scale = 2f / 255, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=false} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = true, Offset = -1f, Scale = 255f / 2, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=false} } }, pixels); var fname = nameof(TestBackAndForthConversionWithoutAlphaInterleave) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c.R == r.R && c.G == r.G && c.B == r.B); } } } Done(); } [Fact] public void TestBackAndForthConversionWithAlphaNoInterleave() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = false, Offset = 127.5f, Scale = 2f / 255, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=true} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = false, Offset = -1f, Scale = 255f / 2, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=true} } }, pixels); var fname = nameof(TestBackAndForthConversionWithAlphaNoInterleave) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c == r); } } } Done(); } [Fact] public void TestBackAndForthConversionWithoutAlphaNoInterleave() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = false, Offset = 127.5f, Scale = 2f / 255, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=false} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = false, Offset = -1f, Scale = 255f / 2, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=false} } }, pixels); var fname = nameof(TestBackAndForthConversionWithoutAlphaNoInterleave) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c.R == r.R && c.G == r.G && c.B == r.B); } } } Done(); } [Fact] public void TestBackAndForthConversionWithAlphaInterleaveNoOffset() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = true, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=true} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = true, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=true} } }, pixels); var fname = nameof(TestBackAndForthConversionWithAlphaInterleaveNoOffset) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c == r); } } } Done(); } [Fact] public void TestBackAndForthConversionWithoutAlphaInterleaveNoOffset() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = true, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=false} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = true, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=false} } }, pixels); var fname = nameof(TestBackAndForthConversionWithoutAlphaInterleaveNoOffset) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c.R == r.R && c.G == r.G && c.B == r.B); } } } Done(); } [Fact] public void TestBackAndForthConversionWithAlphaNoInterleaveNoOffset() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; var imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = false, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=true} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = false, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=true} } }, pixels); var fname = nameof(TestBackAndForthConversionWithAlphaNoInterleaveNoOffset) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c == r); } } } Done(); } [Fact] public void TestBackAndForthConversionWithoutAlphaNoInterleaveNoOffset() { IHostEnvironment env = new MLContext(); const int imageHeight = 100; const int imageWidth = 130; var dataFile = GetDataPath("images/images.tsv"); var imageFolder = Path.GetDirectoryName(dataFile); var data = TextLoader.Create(env, new TextLoader.Arguments() { Column = new[] { new TextLoader.Column("ImagePath", DataKind.TX, 0), new TextLoader.Column("Name", DataKind.TX, 1), } }, new MultiFileSource(dataFile)); var images = ImageLoaderTransform.Create(env, new ImageLoaderTransform.Arguments() { Column = new ImageLoaderTransform.Column[1] { new ImageLoaderTransform.Column() { Source= "ImagePath", Name="ImageReal" } }, ImageFolder = imageFolder }, data); var cropped = ImageResizerTransform.Create(env, new ImageResizerTransform.Arguments() { Column = new ImageResizerTransform.Column[1]{ new ImageResizerTransform.Column() { Source = "ImageReal", Name= "ImageCropped", ImageHeight =imageHeight, ImageWidth = imageWidth, Resizing = ImageResizerTransform.ResizingKind.IsoCrop} } }, images); var pixels = ImagePixelExtractorTransform.Create(env, new ImagePixelExtractorTransform.Arguments() { InterleaveArgb = false, Column = new ImagePixelExtractorTransform.Column[1]{ new ImagePixelExtractorTransform.Column() { Source= "ImageCropped", Name = "ImagePixels", UseAlpha=false} } }, cropped); IDataView backToBitmaps = new VectorToImageTransform(env, new VectorToImageTransform.Arguments() { InterleaveArgb = false, Column = new VectorToImageTransform.Column[1]{ new VectorToImageTransform.Column() { Source= "ImagePixels", Name = "ImageRestored" , ImageHeight=imageHeight, ImageWidth=imageWidth, ContainsAlpha=false} } }, pixels); var fname = nameof(TestBackAndForthConversionWithoutAlphaNoInterleaveNoOffset) + "_model.zip"; var fh = env.CreateOutputFile(fname); using (var ch = env.Start("save")) TrainUtils.SaveModel(env, ch, fh, null, new RoleMappedData(backToBitmaps)); backToBitmaps = ModelFileUtils.LoadPipeline(env, fh.OpenReadStream(), new MultiFileSource(dataFile)); DeleteOutputPath(fname); backToBitmaps.Schema.TryGetColumnIndex("ImageRestored", out int bitmapColumn); backToBitmaps.Schema.TryGetColumnIndex("ImageCropped", out int cropBitmapColumn); using (var cursor = backToBitmaps.GetRowCursor((x) => true)) { var bitmapGetter = cursor.GetGetter<Bitmap>(bitmapColumn); Bitmap restoredBitmap = default; var bitmapCropGetter = cursor.GetGetter<Bitmap>(cropBitmapColumn); Bitmap croppedBitmap = default; while (cursor.MoveNext()) { bitmapGetter(ref restoredBitmap); Assert.NotNull(restoredBitmap); bitmapCropGetter(ref croppedBitmap); Assert.NotNull(croppedBitmap); for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) { var c = croppedBitmap.GetPixel(x, y); var r = restoredBitmap.GetPixel(x, y); Assert.True(c.R == r.R && c.G == r.G && c.B == r.B); } } Done(); } } } }
46.674779
211
0.543016
[ "MIT" ]
Jungmaus/machinelearning
test/Microsoft.ML.Tests/ImagesTests.cs
42,196
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("02. Choreography")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("02. Choreography")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("33653930-bdef-4935-ac0c-4c9ac47dce59")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
37.837838
84
0.746429
[ "MIT" ]
LuchezarVelkov/C-Sharp-Course
01 Programming Basics/11 Preparation/Progr Basics Exam - 23 July 2017/02. Choreography/Properties/AssemblyInfo.cs
1,403
C#
using System; using Netron; using QuickGraph.Concepts; namespace QuickGraph.Layout.ConnectorChoosers { /// <summary> /// Defines a connector chooser class /// </summary> /// <remarks> /// The connector chooser is, given a <see cref="Connection"/> and /// two <see cref="Shape"/> instances, find the best connectors. /// </remarks> public interface IConnectorChooser { /// <summary> /// Connects <paramref name="conn"/> /// </summary> /// <param name="e">edge reprensted by conn</param> /// <param name="conn">the <see cref="Connection"/> instance</param> /// <param name="source">the <see cref="Shape"/> source</param> /// <param name="target">the <see cref="Shape"/> target</param> void Connect( IEdge e, Connection conn, Shape source, Shape target ); } }
26.806452
71
0.628159
[ "ECL-2.0", "Apache-2.0" ]
Gallio/mbunit-v2
src/quickgraph/QuickGraph.Layout/ConnectorChoosers/IConnectorChooser.cs
831
C#
using Microsoft.EntityFrameworkCore.Migrations; using System; using System.Collections.Generic; namespace esencialAdmin.Data.Migrations { public partial class MaxLength : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<string>( name: "LastName", table: "AspNetUsers", type: "nvarchar(256)", maxLength: 256, nullable: true, oldClrType: typeof(string), oldNullable: true); migrationBuilder.AlterColumn<string>( name: "FirstName", table: "AspNetUsers", type: "nvarchar(256)", maxLength: 256, nullable: true, oldClrType: typeof(string), oldNullable: true); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<string>( name: "LastName", table: "AspNetUsers", nullable: true, oldClrType: typeof(string), oldType: "nvarchar(256)", oldMaxLength: 256, oldNullable: true); migrationBuilder.AlterColumn<string>( name: "FirstName", table: "AspNetUsers", nullable: true, oldClrType: typeof(string), oldType: "nvarchar(256)", oldMaxLength: 256, oldNullable: true); } } }
31.153846
71
0.511728
[ "Apache-2.0" ]
Che4ter/PAWI
src/esencialAdmin/Data/Migrations/20171025132130_MaxLength.cs
1,622
C#
using System.ComponentModel.DataAnnotations; namespace BookFast.Api.Models { public class FacilityData { /// <summary> /// Facility name /// </summary> [Required] [StringLength(100, MinimumLength = 3)] public string Name { get; set; } /// <summary> /// Facility description /// </summary> [StringLength(1000)] public string Description { get; set; } /// <summary> /// Facility street address /// </summary> [Required] [StringLength(100)] public string StreetAddress { get; set; } /// <summary> /// Latitude /// </summary> public double? Longitude { get; set; } /// <summary> /// Longitude /// </summary> public double? Latitude { get; set; } /// <summary> /// Facility images /// </summary> public string[] Images { get; set; } } }
23.380952
49
0.5
[ "MIT" ]
dzimchuk/book-fast-api
src/BookFast.Api/Models/FacilityData.cs
984
C#
/* Copyright 2020-present MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Bson.TestHelpers.JsonDrivenTests; namespace MongoDB.Driver.Tests.UnifiedTestOperations { public class UnifiedBulkWriteOperation : IUnifiedEntityTestOperation { private readonly IMongoCollection<BsonDocument> _collection; private readonly BulkWriteOptions _options; private readonly List<WriteModel<BsonDocument>> _requests; private readonly IClientSessionHandle _session; public UnifiedBulkWriteOperation( IClientSessionHandle session, IMongoCollection<BsonDocument> collection, List<WriteModel<BsonDocument>> requests, BulkWriteOptions options) { _session = session; _collection = collection; _requests = requests; _options = options; } public OperationResult Execute(CancellationToken cancellationToken) { try { BulkWriteResult<BsonDocument> result; if (_session == null) { result = _collection.BulkWrite(_requests, _options); } else { result = _collection.BulkWrite(_session, _requests, _options); } return new UnifiedBulkWriteOperationResultConverter().Convert(result); } catch (Exception exception) { return OperationResult.FromException(exception); } } public async Task<OperationResult> ExecuteAsync(CancellationToken cancellationToken) { try { BulkWriteResult<BsonDocument> result; if (_session == null) { result = await _collection.BulkWriteAsync(_requests, _options); } else { result = await _collection.BulkWriteAsync(_session, _requests, _options); } return new UnifiedBulkWriteOperationResultConverter().Convert(result); } catch (Exception exception) { return OperationResult.FromException(exception); } } } public class UnifiedBulkWriteOperationBuilder { private readonly UnifiedEntityMap _entityMap; public UnifiedBulkWriteOperationBuilder(UnifiedEntityMap entityMap) { _entityMap = entityMap; } public UnifiedBulkWriteOperation Build(string targetCollectionId, BsonDocument arguments) { var collection = _entityMap.GetCollection(targetCollectionId); BulkWriteOptions options = null; List<WriteModel<BsonDocument>> requests = null; IClientSessionHandle session = null; foreach (var argument in arguments) { switch (argument.Name) { case "ordered": options = options ?? new BulkWriteOptions(); options.IsOrdered = argument.Value.AsBoolean; break; case "requests": requests = ParseWriteModels(argument.Value.AsBsonArray.Cast<BsonDocument>()); break; case "session": session = _entityMap.GetSession(argument.Value.AsString); break; default: throw new FormatException($"Invalid BulkWriteOperation argument name: '{argument.Name}'."); } } return new UnifiedBulkWriteOperation(session, collection, requests, options); } private DeleteManyModel<BsonDocument> ParseDeleteManyModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "filter"); var filter = new BsonDocumentFilterDefinition<BsonDocument>(model["filter"].AsBsonDocument); return new DeleteManyModel<BsonDocument>(filter); } private DeleteOneModel<BsonDocument> ParseDeleteOneModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "filter"); var filter = new BsonDocumentFilterDefinition<BsonDocument>(model["filter"].AsBsonDocument); return new DeleteOneModel<BsonDocument>(filter); } private InsertOneModel<BsonDocument> ParseInsertOneModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "document"); var document = model["document"].AsBsonDocument; return new InsertOneModel<BsonDocument>(document); } private ReplaceOneModel<BsonDocument> ParseReplaceOneModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "filter", "replacement", "upsert"); var filter = new BsonDocumentFilterDefinition<BsonDocument>(model["filter"].AsBsonDocument); var replacement = model["replacement"].AsBsonDocument; var isUpsert = model.GetValue("upsert", false).ToBoolean(); return new ReplaceOneModel<BsonDocument>(filter, replacement) { IsUpsert = isUpsert }; } private UpdateManyModel<BsonDocument> ParseUpdateManyModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "filter", "update", "upsert"); var filter = new BsonDocumentFilterDefinition<BsonDocument>(model["filter"].AsBsonDocument); var update = new BsonDocumentUpdateDefinition<BsonDocument>(model["update"].AsBsonDocument); var isUpsert = model.GetValue("upsert", false).ToBoolean(); return new UpdateManyModel<BsonDocument>(filter, update) { IsUpsert = isUpsert }; } private UpdateOneModel<BsonDocument> ParseUpdateOneModel(BsonDocument model) { JsonDrivenHelper.EnsureAllFieldsAreValid(model, "filter", "update", "upsert"); var filter = new BsonDocumentFilterDefinition<BsonDocument>(model["filter"].AsBsonDocument); var update = new BsonDocumentUpdateDefinition<BsonDocument>(model["update"].AsBsonDocument); var isUpsert = model.GetValue("upsert", false).ToBoolean(); return new UpdateOneModel<BsonDocument>(filter, update) { IsUpsert = isUpsert }; } private WriteModel<BsonDocument> ParseWriteModel(BsonDocument modelItem) { if (modelItem.ElementCount != 1) { throw new FormatException("BulkWrite request model must contain a single element."); } var modelName = modelItem.GetElement(0).Name; var model = modelItem[0].AsBsonDocument; switch (modelName) { case "deleteMany": return ParseDeleteManyModel(model); case "deleteOne": return ParseDeleteOneModel(model); case "insertOne": return ParseInsertOneModel(model); case "replaceOne": return ParseReplaceOneModel(model); case "updateMany": return ParseUpdateManyModel(model); case "updateOne": return ParseUpdateOneModel(model); default: throw new FormatException($"Invalid write model name: '{modelName}'."); } } private List<WriteModel<BsonDocument>> ParseWriteModels(IEnumerable<BsonDocument> models) { var result = new List<WriteModel<BsonDocument>>(); foreach (var model in models) { result.Add(ParseWriteModel(model)); } return result; } } public class UnifiedBulkWriteOperationResultConverter { public OperationResult Convert(BulkWriteResult<BsonDocument> result) { var document = new BsonDocument { { "deletedCount", result.DeletedCount }, { "insertedCount", result.InsertedCount }, { "matchedCount", result.MatchedCount }, { "modifiedCount", result.ModifiedCount }, { "upsertedCount", result.Upserts.Count }, { "insertedIds", PrepareInsertedIds(result.ProcessedRequests) }, { "upsertedIds", PrepareUpsertedIds(result.Upserts) } }; return OperationResult.FromResult(document); } private BsonDocument PrepareInsertedIds(IReadOnlyList<WriteModel<BsonDocument>> processedRequests) { var result = new BsonDocument(); for (int i = 0; i < processedRequests.Count; i++) { if (processedRequests[i] is InsertOneModel<BsonDocument> insertOneModel) { result.Add(i.ToString(), insertOneModel.Document["_id"]); } } return result; } private BsonDocument PrepareUpsertedIds(IReadOnlyList<BulkWriteUpsert> upserts) { return new BsonDocument(upserts.Select(x => new BsonElement(x.Index.ToString(), x.Id))); } } }
36.844765
115
0.593964
[ "Apache-2.0" ]
Magicianred/mongo-csharp-driver
tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedBulkWriteOperation.cs
10,208
C#
using Content.Shared.GameObjects.Components.Buckle; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; namespace Content.Client.GameObjects.Components.Buckle { [RegisterComponent] public class BuckleComponent : SharedBuckleComponent { private bool _buckled; private int? _originalDrawDepth; public override bool Buckled => _buckled; public override bool TryBuckle(IEntity user, IEntity to) { // TODO: Prediction return false; } public override void HandleComponentState(ComponentState curState, ComponentState nextState) { if (curState is not BuckleComponentState buckle) { return; } _buckled = buckle.Buckled; if (!Owner.TryGetComponent(out SpriteComponent ownerSprite)) { return; } if (_buckled && buckle.DrawDepth.HasValue) { _originalDrawDepth ??= ownerSprite.DrawDepth; ownerSprite.DrawDepth = buckle.DrawDepth.Value; return; } if (!_buckled && _originalDrawDepth.HasValue) { ownerSprite.DrawDepth = _originalDrawDepth.Value; _originalDrawDepth = null; } } } }
27.705882
100
0.587403
[ "MIT" ]
ColdAutumnRain/space-station-14
Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs
1,413
C#
using System; using System.Data; using System.Globalization; using Maestria.Data.Extensions.Internal; namespace Maestria.Data.Extensions { public static class GetInt64Extensions { public static long GetInt64( this IDataRecord dataRecord, string column, IFormatProvider provider = null) => dataRecord.GetValue(column, v => Convert.ToInt64( Convert.ToSingle(v, provider ?? CultureInfo.InvariantCulture))); public static long? GetInt64Safe( this IDataRecord dataRecord, string column, IFormatProvider provider = null) => dataRecord.GetValueSafe(column, v => Convert.ToInt64( Convert.ToSingle(v, provider ?? CultureInfo.InvariantCulture))); public static long GetInt64Safe( this IDataRecord dataRecord, string column, long @default, IFormatProvider provider = null) => dataRecord.GetInt64Safe(column, provider) ?? @default; } }
40.25
106
0.684265
[ "MIT" ]
MaestriaNet/DataExtensions
src/GetInt64Extensions.cs
966
C#
// Copyright (c) 2012-2015 fo-dicom contributors. // Licensed under the Microsoft Public License (MS-PL). namespace Dicom { public static class DicomFileExtensions { public static DicomFile Clone(this DicomFile original) { var df = new DicomFile(); df.FileMetaInfo.Add(original.FileMetaInfo); df.Dataset.Add(original.Dataset); df.Dataset.InternalTransferSyntax = original.Dataset.InternalTransferSyntax; return df; } } }
28.833333
88
0.641618
[ "BSD-3-Clause" ]
cuilishen/fo-dicom
DICOM/DicomFileExtensions.cs
521
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PracticeCharsAndStrings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PracticeCharsAndStrings")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("350442e0-0579-472d-9e27-d00a3ab6ef9e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
38.216216
84
0.751768
[ "MIT" ]
GeorgiGarnenkov/ProgrammingFundamentals
DataTypesAndVariablesExercise/PracticeCharsAndStrings/Properties/AssemblyInfo.cs
1,417
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TarkovPingTester { class ServerPingData : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private string _ServerRegion; public string ServerRegion { get { return _ServerRegion; } set { _ServerRegion = value; OnPropertyChanged("ServerRegion"); } } private string _ServerName; public string ServerName { get { return _ServerName; } set { _ServerName = value; OnPropertyChanged("ServerName"); } } private string[] _ServerAddress; public string[] ServerAddress { get { return _ServerAddress; } set { _ServerAddress = value; OnPropertyChanged("ServerAddress"); } } private decimal _MinPing; public decimal MinPing { get { return _MinPing; } set { _MinPing = value; OnPropertyChanged("MinPing"); } } private decimal _AvgPing; public decimal AvgPing { get { return _AvgPing; } set { _AvgPing = value; OnPropertyChanged("AvgPing"); } } private decimal _MaxPing; public decimal MaxPing { get { return _MaxPing; } set { _MaxPing = value; OnPropertyChanged("MaxPing"); } } private int _TestCount; public int TestCount { get { return _TestCount; } set { _TestCount = value; OnPropertyChanged("TestCount"); } } private int _ErrorCount; public int ErrorCount { get { return _ErrorCount; } set { _ErrorCount = value; OnPropertyChanged("ErrorCount"); } } // Create the OnPropertyChanged method to raise the event protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } } }
21.883212
66
0.431955
[ "MIT" ]
tarkov-dev/TarkovPingTester
TarkovPingTester/ServerPingData.cs
3,000
C#
namespace RelhaxModpack { partial class LoadingGifPreview { /// <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() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoadingGifPreview)); this.gifPreviewBox = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.gifPreviewBox)).BeginInit(); this.SuspendLayout(); // // gifPreviewBox // this.gifPreviewBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.gifPreviewBox.Image = global::RelhaxModpack.Properties.Resources.loading_3rdguards; this.gifPreviewBox.Location = new System.Drawing.Point(12, 12); this.gifPreviewBox.Name = "gifPreviewBox"; this.gifPreviewBox.Size = new System.Drawing.Size(268, 249); this.gifPreviewBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.gifPreviewBox.TabIndex = 0; this.gifPreviewBox.TabStop = false; // // LoadingGifPreview // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(292, 273); this.Controls.Add(this.gifPreviewBox); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "LoadingGifPreview"; this.Text = "loadingGifPreview"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LoadingGifPreview_FormClosing); this.Load += new System.EventHandler(this.GifPreview_Load); ((System.ComponentModel.ISupportInitialize)(this.gifPreviewBox)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.PictureBox gifPreviewBox; } }
44.253521
162
0.623488
[ "Apache-2.0" ]
Arkhorse/RelhaxModpack
RelhaxLegacy/RelicModManager/Forms/GifPreview.Designer.cs
3,144
C#
//------------------------------------------------------------------------------ // <copyright file="_Win32.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> //------------------------------------------------------------------------------ namespace System.Net { internal static class Win32 { internal const int OverlappedInternalOffset = 0; internal static int OverlappedInternalHighOffset = IntPtr.Size; internal static int OverlappedOffsetOffset = IntPtr.Size*2; internal static int OverlappedOffsetHighOffset = IntPtr.Size*2 + 4; internal static int OverlappedhEventOffset = IntPtr.Size*2 + 8; internal static int OverlappedSize = IntPtr.Size*3 + 8; } }
44.722222
80
0.534161
[ "Apache-2.0" ]
295007712/295007712.github.io
sourceCode/dotNet4.6/ndp/fx/src/net/System/Net/_Win32.cs
805
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using TMPro; using DG.Tweening; using UnityEngine.UI; public class DebugPopup : ButtonBase { public OpenState openState { get; private set; } public Vector2 size { get; } public Func<string> message { get; private set; } private TextMeshProUGUI text; Sequence seq = DOTween.Sequence(); public DebugPopup(Func<string> m) { message = m; } public void SetPopup(Func<string> m) { message = m; openState = OpenState.Opening; gameObject.SetActive(true); seq = DOTween.Sequence() .Append(rectTransform.DOSizeDelta(new Vector2(800, 600), 0.2f)) .OnComplete(() => { text.gameObject.SetActive(true); openState = OpenState.Opened; }); } protected override void Start() { base.Start(); openState = OpenState.Closed; rectTransform.sizeDelta = new Vector2(0, 0); text = GetComponentInChildren<TextMeshProUGUI>(); text.gameObject.SetActive(false); onClick = () => { if(openState == OpenState.Opened) { seq.Kill(); text.gameObject.SetActive(false); openState = OpenState.Closing; seq = DOTween.Sequence() .Append(rectTransform.DOSizeDelta(new Vector2(0, 0), 0.2f)) .OnComplete(() => { openState = OpenState.Closed; gameObject.SetActive(false); }); } }; } protected override void Update() { base.Update(); if (openState == OpenState.Opened) { text.text = message(); } } public enum OpenState { Closed, Opening, Opened, Closing } }
25.265823
79
0.523046
[ "MIT" ]
tada0389/TheLegendOfKawaz
TheLegendOfKawaz/Assets/Scripts/KoitanLib/Scripts/Debug/DebugPopup.cs
1,998
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace MessageSoftUni { class Program { static void Main(string[] args) { string input = Console.ReadLine(); while (input != "Decrypt!") { int number = int.Parse(Console.ReadLine()); string result = ""; if (IsValidInput(input)) { string word = GetWord(input); if (word.Length == number) { var digits = GetDigits(input); foreach (var digit in digits) { if (digit <= word.Length - 1) { var letter = word.Substring(digit, 1); result += letter; } } Console.WriteLine($"{word} = {result}"); } } input = Console.ReadLine(); // number = int.Parse(Console.ReadLine()); } } private static List<int> GetDigits(string input) { List<int> listOfDigits = new List<int>(); Regex regex = new Regex(@"\d"); var digits = regex.Matches(input); foreach (Match d in digits) { int dig = int.Parse(d.Value); listOfDigits.Add(dig); } return listOfDigits; } private static string GetWord(string input) { string result = ""; Regex regex = new Regex(@"(?<=[0-9])([A-Za-z]+)"); var words = regex.Matches(input); foreach (var word in words) { result += word.ToString(); } return result; } private static bool IsValidInput(string input) { Regex regex = new Regex(@"(?<=[0-9])([A-Za-z]+)"); var valid = regex.IsMatch(input); return valid; } } }
27.5
70
0.422173
[ "MIT" ]
Malin-Naydenov/Regex
MessageSoftUni/Program.cs
2,257
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Linq; using System.Threading; using System.Threading.Tasks; namespace Azure.Storage.Blobs.Models { internal class GetBlobContainersAsyncCollection : StorageCollectionEnumerator<BlobContainerItem> { private readonly BlobServiceClient _client; private readonly GetBlobContainersOptions? _options; public GetBlobContainersAsyncCollection( BlobServiceClient client, GetBlobContainersOptions? options) { _client = client; _options = options; } public override async ValueTask<Page<BlobContainerItem>> GetNextPageAsync( string continuationToken, int? pageSizeHint, bool isAsync, CancellationToken cancellationToken) { Task<Response<BlobContainersSegment>> task = _client.GetBlobContainersInternal( continuationToken, _options, pageSizeHint, isAsync, cancellationToken); Response<BlobContainersSegment> response = isAsync ? await task.ConfigureAwait(false) : task.EnsureCompleted(); return new Page<BlobContainerItem>( response.Value.BlobContainerItems.ToArray(), response.Value.NextMarker, response.GetRawResponse()); } } }
33.333333
100
0.628
[ "MIT" ]
SanjayHukumRana/azure-sdk-for-net
sdk/storage/Azure.Storage.Blobs/src/Models/GetBlobContainersAsyncCollection.cs
1,502
C#
// CS0144: Cannot create an instance of the abstract class or interface `ITest' // Line: 9 // Compiler options: -r:CS0144-3-lib.dll public class SampleClass { public void Main () { ITest modelo; modelo= new ITest (); } }
21.181818
79
0.67382
[ "Apache-2.0" ]
121468615/mono
mcs/errors/cs0144-3.cs
233
C#
// <auto-generated /> using System; using BugBlaze.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace BugBlaze.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20210207041700_UpdatingParams")] partial class UpdatingParams { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseIdentityColumns() .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("ProductVersion", "5.0.2"); modelBuilder.Entity("BugBlaze.Data.Models.Bug", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<string>("Component") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property<string>("Description") .HasColumnType("nvarchar(max)"); b.Property<int>("ProjectId") .HasColumnType("int"); b.Property<int>("Severity") .HasColumnType("int"); b.HasKey("Id"); b.ToTable("Bugs"); }); modelBuilder.Entity("BugBlaze.Data.Models.Project", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<string>("Description") .HasColumnType("nvarchar(max)"); b.Property<string>("Language") .HasColumnType("nvarchar(max)"); b.Property<string>("ProjectName") .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Projects"); }); modelBuilder.Entity("BugBlaze.Data.Models.Team", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<int>("NumMembers") .HasColumnType("int"); b.Property<string>("TeamName") .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Teams"); }); modelBuilder.Entity("BugBlaze.Data.Models.UserModel", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<string>("EmailAddress") .HasColumnType("nvarchar(max)"); b.Property<string>("FirstName") .HasColumnType("nvarchar(max)"); b.Property<string>("LastName") .HasColumnType("nvarchar(max)"); b.Property<int?>("OnTeamId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("OnTeamId"); b.ToTable("UserModels"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { b.Property<string>("Id") .HasColumnType("nvarchar(450)"); b.Property<string>("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("nvarchar(max)"); b.Property<string>("Name") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.Property<string>("NormalizedName") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.HasKey("Id"); b.HasIndex("NormalizedName") .IsUnique() .HasDatabaseName("RoleNameIndex") .HasFilter("[NormalizedName] IS NOT NULL"); b.ToTable("AspNetRoles"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<string>("ClaimType") .HasColumnType("nvarchar(max)"); b.Property<string>("ClaimValue") .HasColumnType("nvarchar(max)"); b.Property<string>("RoleId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("Id"); b.HasIndex("RoleId"); b.ToTable("AspNetRoleClaims"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => { b.Property<string>("Id") .HasColumnType("nvarchar(450)"); b.Property<int>("AccessFailedCount") .HasColumnType("int"); b.Property<string>("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnType("nvarchar(max)"); b.Property<string>("Email") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.Property<bool>("EmailConfirmed") .HasColumnType("bit"); b.Property<bool>("LockoutEnabled") .HasColumnType("bit"); b.Property<DateTimeOffset?>("LockoutEnd") .HasColumnType("datetimeoffset"); b.Property<string>("NormalizedEmail") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.Property<string>("NormalizedUserName") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.Property<string>("PasswordHash") .HasColumnType("nvarchar(max)"); b.Property<string>("PhoneNumber") .HasColumnType("nvarchar(max)"); b.Property<bool>("PhoneNumberConfirmed") .HasColumnType("bit"); b.Property<string>("SecurityStamp") .HasColumnType("nvarchar(max)"); b.Property<bool>("TwoFactorEnabled") .HasColumnType("bit"); b.Property<string>("UserName") .HasMaxLength(256) .HasColumnType("nvarchar(256)"); b.HasKey("Id"); b.HasIndex("NormalizedEmail") .HasDatabaseName("EmailIndex"); b.HasIndex("NormalizedUserName") .IsUnique() .HasDatabaseName("UserNameIndex") .HasFilter("[NormalizedUserName] IS NOT NULL"); b.ToTable("AspNetUsers"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => { b.Property<int>("Id") .ValueGeneratedOnAdd() .HasColumnType("int") .UseIdentityColumn(); b.Property<string>("ClaimType") .HasColumnType("nvarchar(max)"); b.Property<string>("ClaimValue") .HasColumnType("nvarchar(max)"); b.Property<string>("UserId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("AspNetUserClaims"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => { b.Property<string>("LoginProvider") .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property<string>("ProviderKey") .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property<string>("ProviderDisplayName") .HasColumnType("nvarchar(max)"); b.Property<string>("UserId") .IsRequired() .HasColumnType("nvarchar(450)"); b.HasKey("LoginProvider", "ProviderKey"); b.HasIndex("UserId"); b.ToTable("AspNetUserLogins"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => { b.Property<string>("UserId") .HasColumnType("nvarchar(450)"); b.Property<string>("RoleId") .HasColumnType("nvarchar(450)"); b.HasKey("UserId", "RoleId"); b.HasIndex("RoleId"); b.ToTable("AspNetUserRoles"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => { b.Property<string>("UserId") .HasColumnType("nvarchar(450)"); b.Property<string>("LoginProvider") .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property<string>("Name") .HasMaxLength(128) .HasColumnType("nvarchar(128)"); b.Property<string>("Value") .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); b.ToTable("AspNetUserTokens"); }); modelBuilder.Entity("BugBlaze.Data.Models.UserModel", b => { b.HasOne("BugBlaze.Data.Models.Team", "OnTeam") .WithMany("Members") .HasForeignKey("OnTeamId"); b.Navigation("OnTeam"); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b => { b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); modelBuilder.Entity("BugBlaze.Data.Models.Team", b => { b.Navigation("Members"); }); #pragma warning restore 612, 618 } } }
35.730366
95
0.443549
[ "MIT" ]
kysu1313/BlazinAsp
Data/Migrations/20210207041700_UpdatingParams.Designer.cs
13,651
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace Nucleus.Coop.PkgManager.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Nucleus.Coop.PkgManager.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
43.90625
189
0.615302
[ "MIT" ]
jackxriot/nucleuscoop
Master/Nucleus.Coop.PkgManager/Properties/Resources.Designer.cs
2,812
C#
// Copyright 2017 the original author or authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using Microsoft.Extensions.Logging; using Steeltoe.Common.Discovery; using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; namespace Steeltoe.Common.Http.Discovery { /// <summary> /// A <see cref="DelegatingHandler"/> implementation that performs Service Discovery /// </summary> public class DiscoveryHttpMessageHandler : DelegatingHandler { private readonly ILogger _logger; private readonly DiscoveryHttpClientHandlerBase _discoveryBase; /// <summary> /// Initializes a new instance of the <see cref="DiscoveryHttpMessageHandler"/> class. /// </summary> /// <param name="discoveryClient">Service discovery client to use - provided by calling services.AddDiscoveryClient(Configuration)</param> /// <param name="logger">ILogger for capturing logs from Discovery operations</param> public DiscoveryHttpMessageHandler(IDiscoveryClient discoveryClient, ILogger<DiscoveryHttpClientHandler> logger = null) { _discoveryBase = new DiscoveryHttpClientHandlerBase(discoveryClient, logger); _logger = logger; } /// <inheritdoc /> protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var current = request.RequestUri; try { request.RequestUri = await _discoveryBase.LookupServiceAsync(current).ConfigureAwait(false); return await base.SendAsync(request, cancellationToken).ConfigureAwait(false); } catch (Exception e) { _logger?.LogDebug(e, "Exception during SendAsync()"); throw; } finally { request.RequestUri = current; } } } }
39.109375
146
0.673991
[ "Apache-2.0" ]
budorcas/steeltoe
src/Common/src/Common.Http/Discovery/DiscoveryHttpMessageHandler.cs
2,505
C#
namespace Titanosoft.AspCacheManager { public interface ICacheExpirationBuilder { ICacheManagerBuilder Builder { get; set; } } }
21.285714
50
0.704698
[ "MIT" ]
cdwaddell/AspCacheManager
src/AspCacheManager/ICacheExpirationBuilder.cs
151
C#
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace RO.Web { public partial class AdmMsgCenter : RO.Web.PageBase { public AdmMsgCenter() { Page.PreInit += new System.EventHandler(Page_PreInit); Page.Init += new System.EventHandler(Page_Init); } protected void Page_Load(object sender, System.EventArgs e) { } protected void Page_PreInit(object sender, EventArgs e) { SetMasterPage(); } protected void Page_Init(object sender, EventArgs e) { InitializeComponent(); } #region Web 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() { } #endregion } }
19.795918
61
0.723711
[ "Apache-2.0" ]
fintrux-team/Low-Code-Development-Platform
Web/AdmMsgCenter.aspx.cs
970
C#
using Microsoft.Extensions.Logging; using Moq; using RectBinPacker.Interfaces; using RectBinPacker.Services.Solver; using RectBinPacker.Validators; using System.Collections.Generic; using Xunit; namespace RectBinPacker.Tests.Integration { public class SolverServiceTests { private IItem CreateNewMockIItem(int width, int height) { var item = new Mock<IItem>(); item.SetupGet(x => x.Height).Returns(height); item.SetupGet(x => x.Width).Returns(width); return item.Object; } private IList<IItem> CreateMockIItems() { // generate our test data var mockItems = new List<IItem> { CreateNewMockIItem(32, 32), CreateNewMockIItem(32, 32), CreateNewMockIItem(32, 32), CreateNewMockIItem(32, 32) }; return mockItems; } [Fact] public void FourItems_NoValidators_SuccessResult() { // configure our validators // there are none var moqValidators = new Mock<IDefaultValidators>(); moqValidators.Setup(m => m.GetValidators()).Returns(new List<IValidator>()); // configure our logging var moqLogging = new Mock<ILogger<ISolverService>>(); // create our system var sut = new SolverService(moqLogging.Object, moqValidators.Object); // solve IAtlas<IItem> sutAtlas; bool sutResult = sut.Solve<IItem>(64, 64, CreateMockIItems(), out sutAtlas); // ensure we have an atlas Assert.True(sutResult); Assert.NotNull(sutAtlas); // get our asset items var sutAtlasItems = sutAtlas.GetConfiguredItems(); // ensure we have a count of 4 Assert.Equal(4, sutAtlasItems.Count); // compare the item placement // items 0 - 3 Assert.Equal(0, sutAtlasItems[0].X); Assert.Equal(0, sutAtlasItems[0].Y); Assert.Equal(1, sutAtlasItems[0].Scale); Assert.Equal(32, sutAtlasItems[0].Width); Assert.Equal(32, sutAtlasItems[0].Height); Assert.Equal(32, sutAtlasItems[1].X); Assert.Equal(0, sutAtlasItems[1].Y); Assert.Equal(1, sutAtlasItems[1].Scale); Assert.Equal(32, sutAtlasItems[1].Width); Assert.Equal(32, sutAtlasItems[1].Height); Assert.Equal(0, sutAtlasItems[2].X); Assert.Equal(32, sutAtlasItems[2].Y); Assert.Equal(1, sutAtlasItems[2].Scale); Assert.Equal(32, sutAtlasItems[2].Width); Assert.Equal(32, sutAtlasItems[2].Height); Assert.Equal(32, sutAtlasItems[3].X); Assert.Equal(32, sutAtlasItems[3].Y); Assert.Equal(1, sutAtlasItems[3].Scale); Assert.Equal(32, sutAtlasItems[3].Width); Assert.Equal(32, sutAtlasItems[3].Height); } [Fact] public void NoItems_ItemCountValidator_GreaterThanZero_FailureResult() { // configure our validators // there are none var moqValidators = new Mock<IDefaultValidators>(); moqValidators.Setup(m => m.GetValidators()).Returns(new List<IValidator> { new ItemCountValidator { Comparison = ECompareType.GREATERTHAN, Value = 0 } }); // configure our logging var moqLogging = new Mock<ILogger<ISolverService>>(); // create our system var sut = new SolverService(moqLogging.Object, moqValidators.Object); // solve IAtlas<IItem> sutAtlas; bool sutResult = sut.Solve<IItem>(64, 64, new List<IItem>(), out sutAtlas); Assert.False(sutResult); Assert.Null(sutAtlas); } } }
34.324561
166
0.578584
[ "CC0-1.0" ]
kernja/rectangle-bin-packer-core
test/RectBinPacker.Tests.Integration/SolverServiceTests.cs
3,913
C#
using DB.Api.Application.Queries; using FluentValidation; namespace DB.Api.Application.Validators.Queries { public class GetAvailabilityUsernameQueryValidator : AbstractValidator<GetAvailabilityUsernameQuery> { public GetAvailabilityUsernameQueryValidator() { RuleFor(query => query.Username) .NotNull() .WithMessage("Must not be null") .NotEmpty() .WithMessage("Should not be empty"); } } }
28.111111
104
0.628458
[ "MIT" ]
OmniChannelChatBot/DBApi
src/DB.Api/Application/Validators/Queries/GetAvailabilityUsernameQueryValidator.cs
508
C#
using UnityEngine; using HutongGames.PlayMaker; using DG.Tweening; namespace HutongGames.PlayMaker.Actions { [ActionCategory("DOTween")] [Tooltip("Moves the target's position to the given value, tweening only the Y axis. ")] [HelpUrl("http://dotween.demigiant.com/documentation.php")] public class DOTweenTransformMoveY : FsmStateAction { [RequiredField] [CheckForComponent(typeof(Transform))] public FsmOwnerDefault gameObject; [ActionSection("")] [Tooltip("Select the target. Either a Vector3 or a GameObject's y position")] public DOTweenActionsEnums.Target target = DOTweenActionsEnums.Target.Value; [UIHint(UIHint.FsmFloat)] [Tooltip("The end value to reach")] public FsmFloat to; [UIHint(UIHint.FsmGameObject)] [Tooltip("The end value to reach")] public FsmGameObject toGameObject; [ActionSection("")] [UIHint(UIHint.FsmBool)] [Tooltip("If setRelative is TRUE sets the tween as relative (the endValue will be calculated as startValue + endValue instead of being used directly). In case of Sequences, sets all the nested tweens as relative. IMPORTANT: Has no effect on Reverse Options, since in that case you directly choose if the tween isRelative or not in the settings below")] public FsmBool setRelative; [UIHint(UIHint.FsmBool)] [Tooltip("If TRUE the tween will smoothly snap all values to integers.")] public FsmBool snapping; [RequiredField] [UIHint(UIHint.FsmFloat)] [Tooltip("The duration of the tween")] public FsmFloat duration; [UIHint(UIHint.FsmBool)] [Tooltip("If isSpeedBased is TRUE sets the tween as speed based (the duration will represent the number of units/degrees the tween moves x second). NOTE: if you want your speed to be constant, also set the ease to Ease.Linear.")] public FsmBool setSpeedBased; [UIHint(UIHint.FsmFloat)] [Tooltip("Set a delayed startup for the tween")] public FsmFloat startDelay; [ActionSection("Reverse Options")] [UIHint(UIHint.FsmBool)] [Tooltip("Play in reverse. Changes a TO tween into a FROM tween: sets the current target's startValue as the tween's endValue then immediately sends the target to the previously set endValue.")] public FsmBool playInReverse; [UIHint(UIHint.FsmBool)] [Tooltip("If TRUE the FROM value will be calculated as relative to the current one")] public FsmBool setReverseRelative; [ActionSection("Events")] [UIHint(UIHint.FsmEvent)] public FsmEvent startEvent; [UIHint(UIHint.FsmEvent)] public FsmEvent finishEvent; [UIHint(UIHint.FsmBool)] [Tooltip("If TRUE this action will finish immediately, if FALSE it will finish when the tween is complete.")] public FsmBool finishImmediately; [ActionSection("Tween ID")] [UIHint(UIHint.Description)] public string tweenIdDescription = "Set an ID for the tween, which can then be used as a filter with DOTween's Control Methods"; [Tooltip("Select the source for the tween ID")] public DOTweenActionsEnums.TweenId tweenIdType; [UIHint(UIHint.FsmString)] [Tooltip("Use a String as the tween ID")] public FsmString stringAsId; [UIHint(UIHint.Tag)] [Tooltip("Use a Tag as the tween ID")] public FsmString tagAsId; [ActionSection("Ease Settings")] public DOTweenActionsEnums.SelectedEase selectedEase; [Tooltip("Sets the ease of the tween. If applied to a Sequence instead of a Tweener, the ease will be applied to the whole Sequence as if it was a single animated timeline.Sequences always have Ease.Linear by default, independently of the global default ease settings.")] public Ease easeType; public FsmAnimationCurve animationCurve; [ActionSection("Loop Settings")] [UIHint(UIHint.Description)] public string loopsDescriptionArea = "Setting loops to -1 will make the tween loop infinitely."; [UIHint(UIHint.FsmInt)] [Tooltip("Setting loops to -1 will make the tween loop infinitely.")] public FsmInt loops; [Tooltip("Sets the looping options (Restart, Yoyo, Incremental) for the tween. LoopType.Restart: When a loop ends it will restart from the beginning. LoopType.Yoyo: When a loop ends it will play backwards until it completes another loop, then forward again, then backwards again, and so on and on and on. LoopType.Incremental: Each time a loop ends the difference between its endValue and its startValue will be added to the endValue, thus creating tweens that increase their values with each loop cycle. Has no effect if the tween has already started.Also, infinite loops will not be applied if the tween is inside a Sequence.")] public LoopType loopType = LoopType.Restart; [ActionSection("Special Settings")] [UIHint(UIHint.FsmBool)] [Tooltip("If autoKillOnCompletion is set to TRUE the tween will be killed as soon as it completes, otherwise it will stay in memory and you'll be able to reuse it.")] public FsmBool autoKillOnCompletion; [UIHint(UIHint.FsmBool)] [Tooltip("Sets the recycling behaviour for the tween. If you don't set it then the default value (set either via DOTween.Init or DOTween.defaultRecyclable) will be used.")] public FsmBool recyclable; [Tooltip("Sets the type of update (Normal, Late or Fixed) for the tween and eventually tells it to ignore Unity's timeScale. UpdateType.Normal: Updates every frame during Update calls. UpdateType.Late: Updates every frame during LateUpdate calls. UpdateType.Fixed: Updates using FixedUpdate calls. ")] public UpdateType updateType = UpdateType.Normal; [UIHint(UIHint.FsmBool)] [Tooltip(" If TRUE the tween will ignore Unity's Time.timeScale. NOTE: independentUpdate works also with UpdateType.Fixed but is not recommended in that case (because at timeScale 0 FixedUpdate won't run).")] public FsmBool isIndependentUpdate; [ActionSection("Debug Options")] [UIHint(UIHint.FsmBool)] public FsmBool debugThis; private Tweener tweener; public override void Reset() { base.Reset(); gameObject = null; to = new FsmFloat { UseVariable = false }; toGameObject = new FsmGameObject { UseVariable = false }; duration = new FsmFloat { UseVariable = false }; setSpeedBased = new FsmBool { UseVariable = false, Value = false }; snapping = new FsmBool { UseVariable = false, Value = false }; setRelative = new FsmBool { UseVariable = false, Value = false }; playInReverse = new FsmBool { UseVariable = false, Value = false }; setReverseRelative = new FsmBool { UseVariable = false, Value = false }; startEvent = null; finishEvent = null; finishImmediately = new FsmBool { UseVariable = false, Value = false }; stringAsId = new FsmString { UseVariable = false }; tagAsId = new FsmString { UseVariable = false }; startDelay = new FsmFloat { Value = 0 }; selectedEase = DOTweenActionsEnums.SelectedEase.EaseType; easeType = Ease.Linear; loops = new FsmInt { Value = 0 }; loopType = LoopType.Restart; autoKillOnCompletion = new FsmBool { Value = true }; recyclable = new FsmBool { Value = false }; updateType = UpdateType.Normal; isIndependentUpdate = new FsmBool { Value = false }; debugThis = new FsmBool { Value = false }; } public override void OnEnter() { switch (target) { case DOTweenActionsEnums.Target.Value: tweener = Fsm.GetOwnerDefaultTarget(gameObject).GetComponent<Transform>().DOMoveY(to.Value, duration.Value, snapping.Value); break; case DOTweenActionsEnums.Target.GameObject: tweener = Fsm.GetOwnerDefaultTarget(gameObject).GetComponent<Transform>().DOMoveY(toGameObject.Value.transform.position.y, duration.Value, snapping.Value); break; } if (setSpeedBased.Value) tweener.SetSpeedBased(); tweener.SetRelative(setRelative.Value); switch (tweenIdType) { case DOTweenActionsEnums.TweenId.UseString: if (string.IsNullOrEmpty(stringAsId.Value) == false) tweener.SetId(stringAsId.Value); break; case DOTweenActionsEnums.TweenId.UseTag: if (string.IsNullOrEmpty(tagAsId.Value) == false) tweener.SetId(tagAsId.Value); break; case DOTweenActionsEnums.TweenId.UseGameObject: tweener.SetId(Fsm.GetOwnerDefaultTarget(gameObject)); break; } tweener.SetDelay(startDelay.Value); switch (selectedEase) { case DOTweenActionsEnums.SelectedEase.EaseType: tweener.SetEase(easeType); break; case DOTweenActionsEnums.SelectedEase.AnimationCurve: tweener.SetEase(animationCurve.curve); break; } tweener.SetLoops(loops.Value, loopType); tweener.SetAutoKill(autoKillOnCompletion.Value); tweener.SetRecyclable(recyclable.Value); tweener.SetUpdate(updateType, isIndependentUpdate.Value); if (playInReverse.Value) tweener.From(setReverseRelative.Value); if (startEvent != null) tweener.OnStart(() => { Fsm.Event(startEvent); }); if (finishImmediately.Value == false) // This allows Action Sequences of this action. { if (finishEvent != null) { tweener.OnComplete(() => { Fsm.Event(finishEvent); }); } else { tweener.OnComplete(Finish); } } tweener.Play(); if (debugThis.Value) Debug.Log("GameObject [" + State.Fsm.GameObjectName + "] FSM [" + State.Fsm.Name + "] State [" + State.Name + "] - DOTween Transform Move Y - SUCCESS!"); if (finishImmediately.Value) Finish(); } } }
46.079295
638
0.653346
[ "MIT" ]
H1NIVyrus/BRKDWNSANDBRKUPS
Assets/Tools/DOTweenPlaymakerActions/Actions/DOTween/DOTweenTransformMoveY.cs
10,460
C#
//------------------------------------------------------------------------------ // <auto-generated> // קוד זה נוצר על-ידי כלי. // גירסת זמן ריצה:4.0.30319.42000 // // ייתכן ששינויים בקובץ זה גרמו לפעולה לא תקינה ויאבדו אם // הקוד נוצר מחדש. // </auto-generated> //------------------------------------------------------------------------------ [assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("assets/refresh-svgrepo-com.svg")]
33.857143
109
0.459916
[ "MIT" ]
yardenavraham/CounterCalories
PL/obj/Debug/PL_Content.g.i.cs
562
C#
 using NoPorn.Mvc.ApplicationService; using NoPorn.Mvc.Models; namespace NoPorn.Mvc.ApplicationHelper; public class ImageAppService : IImageAppService { public async Task<string> UploadImageForGirlAsync(int girlId, string webRootPath, IFormFile file) { var folderRelativePath = $"images/{girlId}"; var fileName = $"{Guid.NewGuid()}_{file.FileName}"; var fileRelativePath = $"{folderRelativePath}/{fileName}"; await UploadImageAsync(folderRelativePath, webRootPath, file, fileName); return fileRelativePath; } public async Task<List<string>> UploadImagesForGirlAsync(int girlId, string webRootPath, IList<IFormFile> fileList) { var folderRelativePath = $"images/{girlId}"; var taskList = new List<Task>(); var fileRelativePathList = new List<string>(); foreach (var file in fileList) { var fileName = $"{Guid.NewGuid()}_{file.FileName}"; fileRelativePathList.Add($"{folderRelativePath}/{fileName}"); taskList.Add(UploadImageAsync(folderRelativePath, webRootPath, file, fileName)); } await Task.WhenAll(taskList.ToArray()); return fileRelativePathList; } private async Task UploadImageAsync(string folderRelativePath, string webRootPath, IFormFile file, string fileName) { var folderAbsolutePath = Path.Combine(webRootPath, folderRelativePath); if (!Directory.Exists(folderAbsolutePath)) { Directory.CreateDirectory(folderAbsolutePath); } // var fileRelativePath = $"{folderRelativePath}/{fileName}"; var fileAbsolutePath = $"{folderAbsolutePath}/{fileName}"; using var stream = System.IO.File.Create(fileAbsolutePath); await file.CopyToAsync(stream); } }
39.369565
119
0.680287
[ "MIT" ]
Kit086/NoPorn
NoPorn.Mvc/ApplicationService/ImageAppService.cs
1,813
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Attack : MonoBehaviour { public float dmgValue = 4; public GameObject throwableObject; public Transform attackCheck; private Rigidbody2D m_Rigidbody2D; public Animator animator; public bool canAttack = true; public bool isTimeToCheck = false; public GameObject cam; private void Awake() { m_Rigidbody2D = GetComponent<Rigidbody2D>(); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.X) && canAttack) { canAttack = false; animator.SetBool("IsAttacking", true); StartCoroutine(AttackCooldown()); } if (Input.GetKeyDown(KeyCode.V)) { GameObject throwableWeapon = Instantiate(throwableObject, transform.position + new Vector3(transform.localScale.x * 0.5f,-0.2f), Quaternion.identity) as GameObject; Vector2 direction = new Vector2(transform.localScale.x, 0); throwableWeapon.GetComponent<ThrowableWeapon>().direction = direction; throwableWeapon.name = "ThrowableWeapon"; } } IEnumerator AttackCooldown() { yield return new WaitForSeconds(0.25f); canAttack = true; } public void DoDashDamage() { dmgValue = Mathf.Abs(dmgValue); Collider2D[] collidersEnemies = Physics2D.OverlapCircleAll(attackCheck.position, 0.9f); for (int i = 0; i < collidersEnemies.Length; i++) { if (collidersEnemies[i].gameObject.tag == "Enemy") { if (collidersEnemies[i].transform.position.x - transform.position.x < 0) { dmgValue = -dmgValue; } collidersEnemies[i].gameObject.SendMessage("ApplyDamage", dmgValue); cam.GetComponent<CameraFollow>().ShakeCamera(); } } } }
25.014085
168
0.711149
[ "MIT" ]
Gabo3001/Nightmare-School
Assets/MetroidvaniaController/Scripts/Player/Attack.cs
1,778
C#
using System; namespace System.Diagnostics.CodeAnalysis { /// <summary> /// Specifies that the attributed code should be excluded from code coverage /// collection. Placing this attribute on a class/struct excludes all /// enclosed methods and properties from code coverage collection. /// </summary> [AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event, Inherited = false, AllowMultiple = false )] public sealed class ExcludeFromCodeCoverageAttribute : Attribute { public ExcludeFromCodeCoverageAttribute() { } } }
33.136364
167
0.703704
[ "Apache-2.0" ]
295007712/295007712.github.io
sourceCode/dotNet4.6/ndp/fx/src/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs
729
C#
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("CS2.02.AnonymousMethods")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("${AuthorCopyright}")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")]
37.296296
82
0.744786
[ "MIT" ]
m-ishizaki/CS22XSamples
CS2/CS2.02.AnonymousMethods/Properties/AssemblyInfo.cs
1,009
C#
using Nmars.Instructions.Abstraction; namespace Nmars.Instructions { public class Andi : MipsInstruction { public override string Name => "Bitwise and immediate"; public override string Description => "Bitwise ands a register and an immediate value and stores the result in a register"; public override string Operation => "$t = $s & imm; advance_pc (4);"; public override string Syntax => "andi $t, $s, imm"; public override string Encoding => "0011 00ss ssst tttt iiii iiii iiii iiii"; } }
39.785714
97
0.666068
[ "Unlicense" ]
trooper982/nmaps
Nmars/Instructions/Andi.cs
559
C#
namespace EZRATServer.Forms { partial class ShellCommand { /// <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() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShellCommand)); this.rtbText = new System.Windows.Forms.RichTextBox(); this.tbxMessage = new System.Windows.Forms.TextBox(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // rtbText // this.rtbText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.rtbText.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rtbText.Location = new System.Drawing.Point(-1, -2); this.rtbText.Name = "rtbText"; this.rtbText.ReadOnly = true; this.rtbText.Size = new System.Drawing.Size(793, 360); this.rtbText.TabIndex = 1; this.rtbText.Text = ""; // // tbxMessage // this.tbxMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxMessage.Location = new System.Drawing.Point(1, 364); this.tbxMessage.Name = "tbxMessage"; this.tbxMessage.Size = new System.Drawing.Size(791, 20); this.tbxMessage.TabIndex = 0; // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lblStatus}); this.statusStrip1.Location = new System.Drawing.Point(0, 387); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(793, 22); this.statusStrip1.TabIndex = 2; this.statusStrip1.Text = "statusStrip1"; // // lblStatus // this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(86, 17); this.lblStatus.Text = "Command line"; // // ShellCommand // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(793, 409); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.tbxMessage); this.Controls.Add(this.rtbText); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ShellCommand"; this.Text = "Command"; this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.RichTextBox rtbText; private System.Windows.Forms.TextBox tbxMessage; private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel lblStatus; } }
43.813725
170
0.593645
[ "MIT" ]
Exo-poulpe/EZRAT
EZRATServer/Forms/ShellCommand.Designer.cs
4,471
C#
using System.Threading; using System.Threading.Tasks; using MediatR; using Microsoft.Extensions.Logging; using SFA.DAS.ApprenticeCommitments.Data.Models; using SFA.DAS.ApprenticeCommitments.Messages.Events; using SFA.DAS.NServiceBus.Services; namespace SFA.DAS.ApprenticeCommitments.Application.DomainEvents.Handlers { internal class PublishApprenticeshipConfirmationCommencedEvent : INotificationHandler<RegistrationAdded> , INotificationHandler<RevisionAdded> { private readonly IEventPublisher _eventPublisher; private readonly ILogger<PublishApprenticeshipConfirmationCommencedEvent> _logger; public PublishApprenticeshipConfirmationCommencedEvent( IEventPublisher eventPublisher, ILogger<PublishApprenticeshipConfirmationCommencedEvent> logger) { _eventPublisher = eventPublisher; _logger = logger; } public async Task Handle(RegistrationAdded notification, CancellationToken cancellationToken) { // The revision isn't technically added until the apprentice // confirms their identity, however it's possible that the apprentice // never does. Approvals can use this event to prompt the apprentice // when the confirmation is overdue. var pretend = new Revision( notification.Registration.CommitmentsApprenticeshipId, notification.Registration.CommitmentsApprovedOn, notification.Registration.Approval); _logger.LogInformation( "RegistrationAdded - Publishing ApprenticeshipConfirmationCommencedEvent for Apprentice {ApprenticeId}, Apprenticeship {ApprenticeshipId}", notification.Registration.RegistrationId, notification.Registration.CommitmentsApprenticeshipId); await _eventPublisher.Publish(new ApprenticeshipConfirmationCommencedEvent { ApprenticeId = notification.Registration.RegistrationId, ConfirmationOverdueOn = pretend.ConfirmBefore, CommitmentsApprenticeshipId = notification.Registration.CommitmentsApprenticeshipId, CommitmentsApprovedOn = notification.Registration.CommitmentsApprovedOn, }); } public async Task Handle(RevisionAdded notification, CancellationToken cancellationToken) { _logger.LogInformation( "RevisionAdded - Publishing ApprenticeshipConfirmationCommencedEvent for Apprentice {ApprenticeId}, Apprenticeship {ApprenticeshipId}", notification.Revision.Apprenticeship.ApprenticeId, notification.Revision.ApprenticeshipId); await _eventPublisher.Publish(new ApprenticeshipConfirmationCommencedEvent { ApprenticeId = notification.Revision.Apprenticeship.ApprenticeId, ApprenticeshipId = notification.Revision.ApprenticeshipId, ConfirmationId = notification.Revision.Id, ConfirmationOverdueOn = notification.Revision.ConfirmBefore, CommitmentsApprenticeshipId = notification.Revision.CommitmentsApprenticeshipId, CommitmentsApprovedOn = notification.Revision.CommitmentsApprovedOn, }); } } }
48.652174
155
0.706583
[ "MIT" ]
SkillsFundingAgency/das-apprentice-commitments-api
src/SFA.DAS.ApprenticeCommitments/Application/DomainEvents/Handlers/PublishApprenticeshipConfirmationCommencedEvent.cs
3,359
C#
using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Data; using System.Text; using System.Threading.Tasks; #nullable disable namespace YandereSaveEditor { public class CustomCharacter { public static void SetYanHair(string file, string HairID) { StreamWriter sw = new StreamWriter(file); sw.WriteLine("YanHair:" + HairID); sw.Close(); } public static void SetYanHoodie(string file, string ocfile) { StreamWriter sw = new StreamWriter(file); sw.WriteLine("ActivateChildAl:Teacher_11:Hoodie:true"); sw.WriteLine("Duplicate:Hoodie:YanHoodie"); //but why these lines? sw.WriteLine("ActivateChildAl:Teacher_11:Hoodie:false"); sw.WriteLine("Attach:YanHoodie:YandereChan/Character/PelvisRoot/Hips"); sw.WriteLine("RefLocalPosition:YanHoode:0:-0.9:0"); //position according to player, 0 is on top of head. sw.WriteLine("RefLocalRotation:YanHoodie:0:0:)"); //vector rotation. string[] patharray = UtilityScript.SeperateIntoArray(file, char.Parse(@"\")); string texture = patharray.Last(); sw.WriteLine("OpenTexture:" + texture); sw.WriteLine("Texture3:0:YanHoodie"); sw.Close(); } public static void SetCustomHair(string file, string ocfile) { StreamWriter sw = new StreamWriter(file); sw.WriteLine("DeliYanHair:PlayerHair:YandereChan"); string[] patharray = UtilityScript.SeperateIntoArray(file, char.Parse(@"\")); string texture = patharray.Last(); sw.WriteLine("OpenTexture:" + texture); sw.WriteLine("Texture:0:PlayerHair"); sw.WriteLine("Texture:1:PlayerHair"); sw.WriteLine("Texture:2:PlayerHair"); sw.Close(); } } }
40.25
116
0.622153
[ "BSD-3-Clause" ]
BTELNYY/yansimsavegameeditor
YandereSaveEditor/CustomCharacter.cs
1,934
C#
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace Lucene.Net.Search { /// <summary>Expert: Describes the score computation for document and query. </summary> [Serializable] public class Explanation { private float value_Renamed; // the value of this node private System.String description; // what it represents private System.Collections.ArrayList details; // sub-explanations public Explanation() { } public Explanation(float value_Renamed, System.String description) { this.value_Renamed = value_Renamed; this.description = description; } /// <summary> Indicates whether or not this Explanation models a good match. /// /// <p> /// By default, an Explanation represents a "match" if the value is positive. /// </p> /// </summary> /// <seealso cref="GetValue"> /// </seealso> public virtual bool IsMatch() { return (0.0f < GetValue()); } /// <summary>The value assigned to this explanation node. </summary> public virtual float GetValue() { return value_Renamed; } /// <summary>Sets the value assigned to this explanation node. </summary> public virtual void SetValue(float value_Renamed) { this.value_Renamed = value_Renamed; } /// <summary>A description of this explanation node. </summary> public virtual System.String GetDescription() { return description; } /// <summary>Sets the description of this explanation node. </summary> public virtual void SetDescription(System.String description) { this.description = description; } /// <summary> A short one line summary which should contain all high level /// information about this Explanation, without the "Details" /// </summary> protected internal virtual System.String GetSummary() { return GetValue() + " = " + GetDescription(); } /// <summary>The sub-nodes of this explanation node. </summary> public virtual Explanation[] GetDetails() { if (details == null) return null; return (Explanation[]) details.ToArray(typeof(Explanation)); } /// <summary>Adds a sub-node to this explanation node. </summary> public virtual void AddDetail(Explanation detail) { if (details == null) details = new System.Collections.ArrayList(); details.Add(detail); } /// <summary>Render an explanation as text. </summary> public override System.String ToString() { return ToString(0); } protected internal virtual System.String ToString(int depth) { System.Text.StringBuilder buffer = new System.Text.StringBuilder(); for (int i = 0; i < depth; i++) { buffer.Append(" "); } buffer.Append(GetSummary()); buffer.Append("\n"); Explanation[] details = GetDetails(); if (details != null) { for (int i = 0; i < details.Length; i++) { buffer.Append(details[i].ToString(depth + 1)); } } return buffer.ToString(); } /// <summary>Render an explanation as HTML. </summary> public virtual System.String ToHtml() { System.Text.StringBuilder buffer = new System.Text.StringBuilder(); buffer.Append("<ul>\n"); buffer.Append("<li>"); buffer.Append(GetSummary()); buffer.Append("<br />\n"); Explanation[] details = GetDetails(); if (details != null) { for (int i = 0; i < details.Length; i++) { buffer.Append(details[i].ToHtml()); } } buffer.Append("</li>\n"); buffer.Append("</ul>\n"); return buffer.ToString(); } } }
27.509677
88
0.672842
[ "MIT" ]
restran/lucene-file-finder
Lucene.Net 2.4.0/Search/Explanation.cs
4,264
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/d3d12.h in the Windows SDK for Windows 10.0.19041.0 // Original source is Copyright © Microsoft. All rights reserved. namespace TerraFX.Interop { public partial struct D3D12_TEX2DMS_ARRAY_RTV { [NativeTypeName("UINT")] public uint FirstArraySlice; [NativeTypeName("UINT")] public uint ArraySize; } }
30.058824
145
0.710372
[ "MIT" ]
Ethereal77/terrafx.interop.windows
sources/Interop/Windows/um/d3d12/D3D12_TEX2DMS_ARRAY_RTV.cs
513
C#
namespace GSWolves_Viewer { partial class login { /// <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.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(login)); this.label1 = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.bunifuDragControl1 = new Bunifu.Framework.UI.BunifuDragControl(this.components); this.bunifuImageButton1 = new Bunifu.Framework.UI.BunifuImageButton(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.bunifuMetroTextbox1 = new Bunifu.Framework.UI.BunifuMetroTextbox(); this.bunifuMetroTextbox2 = new Bunifu.Framework.UI.BunifuMetroTextbox(); this.bunifuThinButton21 = new Bunifu.Framework.UI.BunifuThinButton2(); this.panel3 = new System.Windows.Forms.Panel(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.timer2 = new System.Windows.Forms.Timer(this.components); ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(832, 49); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(43, 17); this.label1.TabIndex = 0; this.label1.Text = "Login"; // // timer1 // this.timer1.Enabled = true; this.timer1.Interval = 1; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // bunifuDragControl1 // this.bunifuDragControl1.Fixed = true; this.bunifuDragControl1.Horizontal = true; this.bunifuDragControl1.TargetControl = this; this.bunifuDragControl1.Vertical = true; // // bunifuImageButton1 // this.bunifuImageButton1.BackColor = System.Drawing.Color.Transparent; this.bunifuImageButton1.Image = ((System.Drawing.Image)(resources.GetObject("bunifuImageButton1.Image"))); this.bunifuImageButton1.ImageActive = null; this.bunifuImageButton1.Location = new System.Drawing.Point(1067, 14); this.bunifuImageButton1.Name = "bunifuImageButton1"; this.bunifuImageButton1.Size = new System.Drawing.Size(34, 35); this.bunifuImageButton1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.bunifuImageButton1.TabIndex = 1; this.bunifuImageButton1.TabStop = false; this.bunifuImageButton1.Zoom = 10; this.bunifuImageButton1.Click += new System.EventHandler(this.bunifuImageButton1_Click); // // panel1 // this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.panel1.Location = new System.Drawing.Point(835, 259); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(215, 1); this.panel1.TabIndex = 3; // // panel2 // this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.panel2.Location = new System.Drawing.Point(835, 337); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(215, 1); this.panel2.TabIndex = 4; // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); this.pictureBox2.Location = new System.Drawing.Point(835, 224); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(29, 29); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox2.TabIndex = 5; this.pictureBox2.TabStop = false; // // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(835, 302); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(29, 29); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 6; this.pictureBox1.TabStop = false; // // bunifuMetroTextbox1 // this.bunifuMetroTextbox1.BorderColorFocused = System.Drawing.Color.Blue; this.bunifuMetroTextbox1.BorderColorIdle = System.Drawing.Color.Transparent; this.bunifuMetroTextbox1.BorderColorMouseHover = System.Drawing.Color.Blue; this.bunifuMetroTextbox1.BorderThickness = 1; this.bunifuMetroTextbox1.Cursor = System.Windows.Forms.Cursors.IBeam; this.bunifuMetroTextbox1.Font = new System.Drawing.Font("Century Gothic", 9.75F); this.bunifuMetroTextbox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.bunifuMetroTextbox1.isPassword = false; this.bunifuMetroTextbox1.Location = new System.Drawing.Point(871, 216); this.bunifuMetroTextbox1.Margin = new System.Windows.Forms.Padding(4); this.bunifuMetroTextbox1.Name = "bunifuMetroTextbox1"; this.bunifuMetroTextbox1.Size = new System.Drawing.Size(179, 40); this.bunifuMetroTextbox1.TabIndex = 7; this.bunifuMetroTextbox1.Text = "admin"; this.bunifuMetroTextbox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; // // bunifuMetroTextbox2 // this.bunifuMetroTextbox2.BorderColorFocused = System.Drawing.Color.Blue; this.bunifuMetroTextbox2.BorderColorIdle = System.Drawing.Color.Transparent; this.bunifuMetroTextbox2.BorderColorMouseHover = System.Drawing.Color.Blue; this.bunifuMetroTextbox2.BorderThickness = 1; this.bunifuMetroTextbox2.Cursor = System.Windows.Forms.Cursors.IBeam; this.bunifuMetroTextbox2.Font = new System.Drawing.Font("Century Gothic", 9.75F); this.bunifuMetroTextbox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.bunifuMetroTextbox2.isPassword = true; this.bunifuMetroTextbox2.Location = new System.Drawing.Point(871, 294); this.bunifuMetroTextbox2.Margin = new System.Windows.Forms.Padding(4); this.bunifuMetroTextbox2.Name = "bunifuMetroTextbox2"; this.bunifuMetroTextbox2.Size = new System.Drawing.Size(179, 40); this.bunifuMetroTextbox2.TabIndex = 8; this.bunifuMetroTextbox2.Text = "198411684"; this.bunifuMetroTextbox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; // // bunifuThinButton21 // this.bunifuThinButton21.ActiveBorderThickness = 1; this.bunifuThinButton21.ActiveCornerRadius = 20; this.bunifuThinButton21.ActiveFillColor = System.Drawing.Color.Transparent; this.bunifuThinButton21.ActiveForecolor = System.Drawing.Color.White; this.bunifuThinButton21.ActiveLineColor = System.Drawing.Color.Transparent; this.bunifuThinButton21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(30)))), ((int)(((byte)(28))))); this.bunifuThinButton21.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("bunifuThinButton21.BackgroundImage"))); this.bunifuThinButton21.ButtonText = "LogIn "; this.bunifuThinButton21.Cursor = System.Windows.Forms.Cursors.Hand; this.bunifuThinButton21.Font = new System.Drawing.Font("Century Gothic", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.bunifuThinButton21.ForeColor = System.Drawing.Color.LightSlateGray; this.bunifuThinButton21.IdleBorderThickness = 1; this.bunifuThinButton21.IdleCornerRadius = 20; this.bunifuThinButton21.IdleFillColor = System.Drawing.Color.Transparent; this.bunifuThinButton21.IdleForecolor = System.Drawing.Color.Transparent; this.bunifuThinButton21.IdleLineColor = System.Drawing.Color.Transparent; this.bunifuThinButton21.Location = new System.Drawing.Point(835, 397); this.bunifuThinButton21.Margin = new System.Windows.Forms.Padding(5); this.bunifuThinButton21.Name = "bunifuThinButton21"; this.bunifuThinButton21.Size = new System.Drawing.Size(215, 41); this.bunifuThinButton21.TabIndex = 11; this.bunifuThinButton21.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.bunifuThinButton21.Click += new System.EventHandler(this.bunifuThinButton21_Click); // // panel3 // this.panel3.Controls.Add(this.pictureBox3); this.panel3.Dock = System.Windows.Forms.DockStyle.Left; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(809, 555); this.panel3.TabIndex = 12; // // pictureBox3 // this.pictureBox3.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); this.pictureBox3.Location = new System.Drawing.Point(0, 0); this.pictureBox3.Name = "pictureBox3"; this.pictureBox3.Size = new System.Drawing.Size(809, 555); this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox3.TabIndex = 0; this.pictureBox3.TabStop = false; // // timer2 // this.timer2.Enabled = true; this.timer2.Tick += new System.EventHandler(this.timer2_Tick); // // login // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(30)))), ((int)(((byte)(28))))); this.ClientSize = new System.Drawing.Size(1115, 555); this.Controls.Add(this.panel3); this.Controls.Add(this.bunifuThinButton21); this.Controls.Add(this.bunifuMetroTextbox2); this.Controls.Add(this.bunifuMetroTextbox1); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Controls.Add(this.bunifuImageButton1); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.Color.White; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "login"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Login"; this.TopMost = true; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.bunifuImageButton1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Timer timer1; private Bunifu.Framework.UI.BunifuDragControl bunifuDragControl1; private Bunifu.Framework.UI.BunifuImageButton bunifuImageButton1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; private Bunifu.Framework.UI.BunifuMetroTextbox bunifuMetroTextbox1; private Bunifu.Framework.UI.BunifuMetroTextbox bunifuMetroTextbox2; private Bunifu.Framework.UI.BunifuThinButton2 bunifuThinButton21; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.Timer timer2; } }
56.323308
173
0.619944
[ "MIT" ]
casp3r0x0/GSWolves
GSWolves Number 9/GSWolves Viewer/login.Designer.cs
14,984
C#
using Newtonsoft.Json; namespace AzDevOpsWiReader.Shared { public enum Mode { WorkItems, Users, History } public class Config { public OrgsWithPAT[] OrgsWithPATs { get; set; } public string Query { get; set; } public Mode Mode { get; set; } public string LinkType { get; set; } public string InternalDomain { get; set; } public FieldWithLabel[] Fields { get; set; } [JsonIgnore] public string Content { get { if (this.OrgsWithPATs == null || this.OrgsWithPATs.Length == 0) return Config.DEFAULT_WI; else return JsonConvert.SerializeObject(this, Formatting.Indented); } set { Config _config = JsonConvert.DeserializeObject<Config>(value); this.OrgsWithPATs = _config.OrgsWithPATs; this.Query = _config.Query; this.LinkType = _config.LinkType; this.Fields = _config.Fields; this.Mode = _config.Mode; this.InternalDomain = _config.InternalDomain; } } public const string DEFAULT_WI = @" { ""OrgsWithPATs"": [ { ""Pat"": ""<put-your-pat-here>"", ""Orgs"": [ ""<org1>"", ""<org2>"" ] } ], ""Query"": ""SELECT [System.Id] FROM workitemLinks WHERE ([Source].[System.WorkItemType] IN ('User Story', 'Bug') AND [Source].[System.State] IN ('Active', 'Resolved') ) AND ([Target].[System.WorkItemType] = 'Task' AND NOT [Target].[System.State] IN ('Closed') ) ORDER BY [System.Id] MODE (MayContain)"", ""Mode"": 0, ""LinkType"": ""System.LinkTypes.Hierarchy-Forward"", ""Fields"": [ { ""Id"": ""System.WorkItemType"", ""Label"": ""Type"" }, { ""Id"": ""System.AssignedTo"", ""Label"": ""AssignedTo"" }, { ""Id"": ""System.State"", ""Label"": ""State"" }, { ""Id"": ""System.Tags"", ""Label"": ""Tags"" }, { ""Id"": ""System.TeamProject"", ""Label"": ""Project"" } ], ""InternalDomain"": null } "; public const string DEFAULT_USER = @" { ""OrgsWithPATs"": [ { ""Pat"": ""<put-your-pat-here>"", ""Orgs"": [ ""<org1>"", ""<org2>"" ] } ], ""Query"": null, ""Mode"": 1, ""InternalDomain"": ""cosmoconsult.com"", ""LinkType"": null, ""Fields"": null } "; public const string DEFAULT_HISTORY = @" { ""OrgsWithPATs"": [ { ""Pat"": ""<put-your-pat-here>"", ""Orgs"": [ ""<org1>"", ""<org2>"" ] } ], ""Query"": ""SELECT [System.Id] FROM workitemLinks WHERE ([Source].[System.WorkItemType] IN ('Feature', 'User Story')) AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') AND ([Target].[System.WorkItemType] = 'Task' AND [Target].[System.ChangedDate] > @startOfDay('-14d')) ORDER BY [System.ChangedDate] DESC MODE (Recursive, ReturnMatchingChildren)"", ""Mode"": 2, ""LinkType"": ""System.LinkTypes.Hierarchy-Forward"", ""Fields"": [], ""InternalDomain"": null } "; } public class OrgsWithPAT { public string Pat { get; set; } public string[] Orgs { get; set; } } public class FieldWithLabel { public string Id { get; set; } public string Label { get; set; } } }
26.891473
370
0.519746
[ "MIT" ]
jenkoc/azdevops-wi-reader
shared/Config.cs
3,469
C#
using System; namespace Rgb { public static class RgbConverter { public static byte[] A8ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; A8ToBGRA32(input, width, height, output); return output; } public unsafe static void A8ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { A8ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void A8ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = 0; // b output[1] = 0; // g output[2] = 0; // r output[3] = *input; // a output += 4; input++; } } } public static byte[] ARGB16ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; ARGB16ToBGRA32(input, width, height, output); return output; } public unsafe static void ARGB16ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { ARGB16ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void ARGB16ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = unchecked((byte)(input[0] << 4)); // b output[1] = (byte)(input[0] & 0xF0); // g output[2] = unchecked((byte)(input[1] << 4)); // r output[3] = (byte)(input[1] & 0xF0); // a input += 2; output += 4; } } } public static byte[] RGB24ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGB24ToBGRA32(input, width, height, output); return output; } public unsafe static void RGB24ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGB24ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGB24ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = input[2]; // b output[1] = input[1]; // g output[2] = input[0]; // r output[3] = 255; // a input += 3; output += 4; } } } public static byte[] RGBA32ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGBA32ToBGRA32(input, width, height, output); return output; } public unsafe static void RGBA32ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGBA32ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGBA32ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = input[2]; // b output[1] = input[1]; // g output[2] = input[0]; // r output[3] = input[3]; // a input += 4; output += 4; } } } public static byte[] ARGB32ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; ARGB32ToBGRA32(input, width, height, output); return output; } public unsafe static void ARGB32ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { ARGB32ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void ARGB32ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = input[3]; // b output[1] = input[2]; // g output[2] = input[1]; // r output[3] = input[0]; // a input += 4; output += 4; } } } public static byte[] RGB16ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGB16ToBGRA32(input, width, height, output); return output; } public unsafe static void RGB16ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGB16ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGB16ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { byte r = (byte)(input[1] & 0xF8); byte g = unchecked((byte)((input[1] << 5) | ((input[0] & 0xE0) >> 3))); byte b = unchecked((byte)(input[0] << 3)); output[0] = b; // b output[1] = g; // g output[2] = r; // r output[3] = 255; // a input += 2; output += 4; } } } public static byte[] R16ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; R16ToBGRA32(input, width, height, output); return output; } public unsafe static void R16ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { R16ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void R16ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = 0; // b output[1] = 0; // g output[2] = input[1]; // r output[3] = 255; // a input += 2; output += 4; } } } public static byte[] RGBA16ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGBA16ToBGRA32(input, width, height, output); return output; } public unsafe static void RGBA16ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGBA16ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGBA16ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = (byte)(input[0] & 0xF0); // b output[1] = unchecked((byte)(input[1] << 4)); // g output[2] = (byte)(input[1] & 0xF0); // r output[3] = unchecked((byte)(input[0] << 4)); // a input += 2; output += 4; } } } public static byte[] RG16ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RG16ToBGRA32(input, width, height, output); return output; } public unsafe static void RG16ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RG16ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RG16ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = 0; // b output[1] = input[1]; // g output[2] = input[0]; // r output[3] = 255; // a input += 2; output += 4; } } } public static byte[] R8ToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; R8ToBGRA32(input, width, height, output); return output; } public unsafe static void R8ToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { R8ToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void R8ToBGRA32(byte* input, int width, int height, byte* output) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { output[0] = 0; // b output[1] = 0; // g output[2] = input[0]; // r output[3] = 255; // a input += 1; output += 4; } } } public static byte[] RHalfToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RHalfToBGRA32(input, width, height, output); return output; } public unsafe static void RHalfToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RHalfToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RHalfToBGRA32(byte* input, int width, int height, byte* output) { ushort* sinput = (ushort*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(Half.ToHalf(sinput[0]) * 255f)); output[0] = 0; // b output[1] = 0; // g output[2] = Convert.ToByte(r); // r output[3] = 255; // a sinput += 1; output += 4; } } } public static byte[] RGHalfToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGHalfToBGRA32(input, width, height, output); return output; } public unsafe static void RGHalfToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGHalfToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGHalfToBGRA32(byte* input, int width, int height, byte* output) { ushort* sinput = (ushort*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(Half.ToHalf(sinput[0]) * 255f)); double g = Clamp255(Math.Round(Half.ToHalf(sinput[1]) * 255f)); output[0] = 0; // b output[1] = Convert.ToByte(g); // g output[2] = Convert.ToByte(r); // r output[3] = 255; // a sinput += 2; output += 4; } } } public static byte[] RGBAHalfToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGBAHalfToBGRA32(input, width, height, output); return output; } public unsafe static void RGBAHalfToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGBAHalfToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGBAHalfToBGRA32(byte* input, int width, int height, byte* output) { ushort* sinput = (ushort*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(Half.ToHalf(sinput[0]) * 255f)); double g = Clamp255(Math.Round(Half.ToHalf(sinput[1]) * 255f)); double b = Clamp255(Math.Round(Half.ToHalf(sinput[2]) * 255f)); double a = Clamp255(Math.Round(Half.ToHalf(sinput[3]) * 255f)); output[0] = Convert.ToByte(b); // b output[1] = Convert.ToByte(g); // g output[2] = Convert.ToByte(r); // r output[3] = Convert.ToByte(a); // a sinput += 4; output += 4; } } } public static byte[] RFloatToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RFloatToBGRA32(input, width, height, output); return output; } public unsafe static void RFloatToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RFloatToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RFloatToBGRA32(byte* input, int width, int height, byte* output) { float* sinput = (float*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(sinput[0] * 255f)); output[0] = 0; // b output[1] = 0; // g output[2] = Convert.ToByte(r); // r output[3] = 255; // a sinput += 1; output += 4; } } } public static byte[] RGFloatToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGFloatToBGRA32(input, width, height, output); return output; } public unsafe static void RGFloatToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGFloatToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGFloatToBGRA32(byte* input, int width, int height, byte* output) { float* sinput = (float*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(sinput[0] * 255f)); double g = Clamp255(Math.Round(sinput[1] * 255f)); output[0] = 0; // b output[1] = Convert.ToByte(g); // g output[2] = Convert.ToByte(r); // r output[3] = 255; // a sinput += 2; output += 4; } } } public static byte[] RGBAFloatToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGBAFloatToBGRA32(input, width, height, output); return output; } public unsafe static void RGBAFloatToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGBAFloatToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGBAFloatToBGRA32(byte* input, int width, int height, byte* output) { float* sinput = (float*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { double r = Clamp255(Math.Round(sinput[0] * 255f)); double g = Clamp255(Math.Round(sinput[1] * 255f)); double b = Clamp255(Math.Round(sinput[2] * 255f)); double a = Clamp255(Math.Round(sinput[3] * 255f)); output[0] = Convert.ToByte(b); // b output[1] = Convert.ToByte(g); // g output[2] = Convert.ToByte(r); // r output[3] = Convert.ToByte(a); // a sinput += 4; output += 4; } } } public static byte[] RGB9e5FloatToBGRA32(byte[] input, int width, int height) { byte[] output = new byte[width * height * 4]; RGB9e5FloatToBGRA32(input, width, height, output); return output; } public unsafe static void RGB9e5FloatToBGRA32(byte[] input, int width, int height, byte[] output) { fixed (byte* inputPtr = input) { fixed (byte* outputPtr = output) { RGB9e5FloatToBGRA32(inputPtr, width, height, outputPtr); } } } public unsafe static void RGB9e5FloatToBGRA32(byte* input, int width, int height, byte* output) { uint* sinput = (uint*)input; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { uint value = *sinput; double scale = Math.Pow(2, unchecked((int)(value >> 27) - 24)); byte r = Convert.ToByte(Math.Round((value >> 0 & 0x1FF) * scale * 255.0)); byte g = Convert.ToByte(Math.Round((value >> 9 & 0x1FF) * scale * 255.0)); byte b = Convert.ToByte(Math.Round((value >> 18 & 0x1FF) * scale * 255.0)); output[0] = b; // b output[1] = g; // g output[2] = r; // r output[3] = 255; // a sinput += 1; output += 4; } } } private static double Clamp255(double value) => value < 0.0 ? 0.0 : value > 255.0 ? 255.0 : value; } }
25.604538
100
0.57349
[ "MIT" ]
Bluscream/UtinyRipper
uTinyRipperGUI/ThirdParty/Texture converters/RgbConverter.cs
15,798
C#
using UnityEngine; using UnityEditor; using System.Collections.Generic; using System.Linq; using com.spacepuppy; using com.spacepuppy.Utils; namespace com.spacepuppyeditor.Core { [CustomPropertyDrawer(typeof(EnumFlagsAttribute))] public class EnumFlagsPropertyDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); var attrib = this.attribute as EnumFlagsAttribute; var tp = (attrib.EnumType != null && attrib.EnumType.IsEnum) ? attrib.EnumType : this.fieldInfo.FieldType; if (tp.IsEnum) { property.intValue = SPEditorGUI.EnumFlagField(position, tp, label, property.intValue); property.serializedObject.ApplyModifiedProperties(); } else { EditorGUI.LabelField(position, label); } EditorGUI.EndProperty(); } } }
28.135135
118
0.638809
[ "MIT" ]
lordofduct/spacepuppy-unity-framework-4.0
Framework/com.spacepuppy.core/Editor/src/Core/EnumFlagsPropertyDrawer.cs
1,043
C#
using System; namespace AtcSimController.SiteReflection.Models { /// <summary> /// Aircraft Model Specifications /// </summary> public sealed class AircraftSpecification { /// <summary> /// Default speed for aircraft when on final (kts) /// </summary> private int _approachSpeed; /// <summary> /// Default cruising speed (kts) /// </summary> private int _cruiseSpeed; /// <summary> /// Speed aircraft must reach for liftoff (kts) /// </summary> private int _liftoffSpeed; /// <summary> /// Constructor for the <see cref="AircraftSpecification"/> class, which defines speeds for different aircraft types /// </summary> /// <param name="cruise">Cruise speed</param> /// <param name="liftoff">Liftoff speed</param> /// <param name="approach">Approach speed</param> public AircraftSpecification(int cruise, int liftoff, int approach) { this._cruiseSpeed = cruise; this._liftoffSpeed = liftoff; this._approachSpeed = approach; } /// <summary> /// Gets the aircraft approach speed, which is typically how fast it's going during landings /// </summary> public int ApproachSpeed { get { return this._approachSpeed; } } /// <summary> /// Gets the aircraft cruise speed, which is typically the speed it enters our airspace at. /// </summary> public int CruiseSpeed { get { return this._cruiseSpeed; } } /// <summary> /// Gets the aircraft Liftoff speed, which is typically the speed it starts to climb at during takeoff /// </summary> public int LiftoffSpeed { get { return this._liftoffSpeed; } } public override string ToString() { return String.Format("ApproachSpeed={0};CruiseSpeed={1};LiftoffSpeed={2}", this._approachSpeed, this._cruiseSpeed, this._liftoffSpeed); } } }
29.397436
124
0.532054
[ "BSD-3-Clause" ]
corygehr/ATC-SIM-AI
ATC-SIM AI/SiteReflection/Models/AircraftSpecification.cs
2,295
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Simplification; namespace ILLink.CodeFix { public abstract class BaseAttributeCodeFixProvider : Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider { private protected abstract LocalizableString CodeFixTitle { get; } private protected abstract string FullyQualifiedAttributeName { get; } private protected abstract AttributeableParentTargets AttributableParentTargets { get; } public sealed override FixAllProvider GetFixAllProvider () { // See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md for more information on Fix All Providers return WellKnownFixAllProviders.BatchFixer; } protected async Task BaseRegisterCodeFixesAsync (CodeFixContext context) { var root = await context.Document.GetSyntaxRootAsync (context.CancellationToken).ConfigureAwait (false); var diagnostic = context.Diagnostics.First (); var diagnosticSpan = diagnostic.Location.SourceSpan; SyntaxNode targetNode = root!.FindNode (diagnosticSpan); CSharpSyntaxNode? declarationSyntax = FindAttributableParent (targetNode, AttributableParentTargets); if (declarationSyntax is not null) { var semanticModel = await context.Document.GetSemanticModelAsync (context.CancellationToken).ConfigureAwait (false); var symbol = semanticModel!.Compilation.GetTypeByMetadataName (FullyQualifiedAttributeName); var document = context.Document; var editor = new SyntaxEditor (root, document.Project.Solution.Workspace); var generator = editor.Generator; var attrArgs = GetAttributeArguments (semanticModel, targetNode, declarationSyntax, generator, diagnostic); var codeFixTitle = CodeFixTitle.ToString (); // Register a code action that will invoke the fix. context.RegisterCodeFix ( CodeAction.Create ( title: codeFixTitle, createChangedDocument: c => AddAttribute ( document, editor, generator, declarationSyntax, attrArgs, symbol!, c), equivalenceKey: codeFixTitle), diagnostic); } } private static async Task<Document> AddAttribute ( Document document, SyntaxEditor editor, SyntaxGenerator generator, CSharpSyntaxNode containingDecl, SyntaxNode[] attrArgs, ITypeSymbol AttributeSymbol, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync (cancellationToken).ConfigureAwait (false); if (semanticModel is null) { return document; } var newAttribute = generator .Attribute (generator.TypeExpression (AttributeSymbol), attrArgs) .WithAdditionalAnnotations ( Simplifier.Annotation, Simplifier.AddImportsAnnotation); editor.AddAttribute (containingDecl, newAttribute); return document.WithSyntaxRoot (editor.GetChangedRoot ()); } [Flags] protected enum AttributeableParentTargets { MethodOrConstructor = 0x0001, Property = 0x0002, Field = 0x0004, Event = 0x0008, All = MethodOrConstructor | Property | Field | Event } private static CSharpSyntaxNode? FindAttributableParent (SyntaxNode node, AttributeableParentTargets targets) { SyntaxNode? parentNode = node.Parent; while (parentNode is not null) { switch (parentNode) { case LambdaExpressionSyntax: return null; case LocalFunctionStatementSyntax or BaseMethodDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.MethodOrConstructor): case PropertyDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.Property): case FieldDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.Field): case EventDeclarationSyntax when targets.HasFlag (AttributeableParentTargets.Event): return (CSharpSyntaxNode) parentNode; default: parentNode = parentNode.Parent; break; } } return null; } protected abstract SyntaxNode[] GetAttributeArguments (SemanticModel semanticModel, SyntaxNode targetNode, CSharpSyntaxNode declarationSyntax, SyntaxGenerator generator, Diagnostic diagnostic); protected static bool HasPublicAccessibility (ISymbol? m) { if (m is not { DeclaredAccessibility: Accessibility.Public or Accessibility.Protected }) { return false; } for (var t = m.ContainingType; t is not null; t = t.ContainingType) { if (t.DeclaredAccessibility != Accessibility.Public) { return false; } } return true; } } }
37.40458
195
0.771633
[ "MIT" ]
MichaelSimons/linker
src/ILLink.CodeFix/BaseAttributeCodeFixProvider.cs
4,902
C#
using UnityEngine; using System.Collections; public class CameraController : MonoBehaviour { /// <summary> /// /// </summary> public float RotateSpeed = 1.0f; /// <summary> /// /// </summary> public float MovementSpeed = 1.0f; public bool IsModeEnabled { get; set; } // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (IsModeEnabled) { HandleRotation(); HandleMovement(); } } /// <summary> /// /// </summary> private void HandleMovement() { float horizontalMovement = Input.GetAxis("MoveHorizontal") * MovementSpeed; float verticalMovement = Input.GetAxis("MoveVertical") * MovementSpeed; Vector3 direction = this.transform.TransformDirection(Vector3.forward); Vector3 leftRight = this.transform.TransformDirection(Vector3.right); this.rigidbody.AddForce(direction * verticalMovement); this.rigidbody.AddForce(leftRight * horizontalMovement); } /// <summary> /// /// </summary> private void HandleRotation() { float verticalRotation = Input.GetAxis("RotationVertical") * this.RotateSpeed; Vector3 cameradestination = Camera.main.transform.localEulerAngles + new Vector3(verticalRotation, 0.0f, 0.0f); if (cameradestination.x <= 180.0f && cameradestination.x > 30.0f) { cameradestination.x = 30.0f; } if (cameradestination.x >= 180.0f && cameradestination.x < 350.0f) { cameradestination.x = 350.0f; } Camera.main.transform.localEulerAngles = cameradestination; float horizontalRotation = Input.GetAxis("RotationHorizontal") * this.RotateSpeed; this.transform.localEulerAngles = this.transform.localEulerAngles + new Vector3(0.0f, horizontalRotation, 0.0f); } }
26.473684
121
0.605368
[ "MIT" ]
samoatesgames/Ludumdare-29
Assets/Scripts/Camera/CameraController.cs
2,012
C#
using System; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Runtime.Caching; using Force.Crc32; using YamlDotNet.Core; using YamlDotNet.Serialization; namespace sharexserv { public static class Program { private class Config { public string listener_prefix = "http://+:80/upload/"; public string key = ""; public string path = "./files/"; public string address = "http://localhost/"; public string fail_address = "http://localhost/failed.jpg"; public int store_duration = 14; // days public string[] removal_ignore_list = { "index.html", "style.css", "failed.jpg" }; // never delete these public bool only_images = true; } private static readonly CacheEntryRemovedCallback cachedFileRemove = RemoveCachedFile; private static readonly MemoryCache cache = MemoryCache.Default; private static Config config = new Config(); private const string config_path = "./config.yml"; public static void Main(string[] args) { LoadConfig(); Cleanup(); // perform cleanup as soon as we start using var listener = new HttpListener(); listener.Prefixes.Add(config.listener_prefix); listener.Start(); Console.WriteLine("Listening..."); while (true) { #if !DEBUG try #endif { // GetContext is blocking HttpListenerContext context = listener.GetContext(); if (context.Request.HasEntityBody) { Response(context.Request, context.Response); } } #if !DEBUG catch (Exception e) { Console.WriteLine(e.Message); } #endif } //listener.Stop(); } private static void LoadConfig() { if (File.Exists(config_path)) { try { config = new Deserializer().Deserialize<Config>(File.ReadAllText(config_path)); } catch (YamlException e) { string message = e.Message; if (e.InnerException != null) message = e.InnerException.Message; Console.WriteLine("!!! Failed to parse config:"); Console.WriteLine(message); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); Environment.Exit(0); } } else { Console.WriteLine(" !!! CONFIG NOT FOUND, MAKING DEFAULT ONE !!!"); File.WriteAllText(config_path, new Serializer().Serialize(config)); } } private static void Response(HttpListenerRequest request, HttpListenerResponse response) { bool success = false; string fileName = string.Empty; if (request.Headers.Get("key") == config.key) // password check { string fileType = string.Empty; var fullReq = new MemoryStream(); request.InputStream.CopyTo(fullReq); fullReq.Position = 0; bool shouldSave = false; using var reader = new StreamReader(fullReq); if (config.only_images) { // iterate through first 4 lines to find the file extension for (int i = 0; i < 3; i++) { // Content-Type if (i == 2) { string contentType = reader.ReadLine()?.Split(':')[1].TrimStart(' '); if (!string.IsNullOrEmpty(contentType) && (contentType == "image/png" || contentType == "image/jpeg")) { // only save if it's a picture shouldSave = true; if (contentType == "image/png") { fileType = ".png"; } else if (contentType == "image/jpeg") { fileType = ".jpg"; } } } else { reader.ReadLine(); } } } // save data if (shouldSave) { fullReq.Position = 0; var data = GetFile(request.ContentEncoding, GetBoundary(request.ContentType), fullReq); data.Position = 0; byte[] buf = new byte[data.Length]; data.Read(buf, 0, (int) data.Length); // use CRC32 as an unique file name fileName = Crc32Algorithm.Compute(buf).ToString("X") + fileType; if (Directory.Exists(config.path)) { if (!File.Exists(config.path + fileName)) { File.WriteAllBytes(config.path + fileName, buf); Console.WriteLine($"Wrote {fileName}"); // cache file name to remove it after store_duration days CacheItemPolicy policy = new CacheItemPolicy() { AbsoluteExpiration = DateTimeOffset.Now.AddDays(config.store_duration), RemovedCallback = cachedFileRemove }; cache.Add(fileName, fileName, policy); } success = true; } } } // write file address in the response string responsestring = config.fail_address; if (success) responsestring = config.address + fileName; byte[] buffer = Encoding.UTF8.GetBytes(responsestring); response.ContentLength64 = buffer.Length; Stream output = response.OutputStream; output.Write(buffer, 0, buffer.Length); output.Close(); } #region File Removal private static void RemoveCachedFile(CacheEntryRemovedArguments arguments) { // iterate through all file in the directory and delete cached file string fileName = arguments.CacheItem.Key; var files = Directory.EnumerateFiles(config.path); foreach (string dirFile in files) { if (Path.GetFileName(dirFile) == fileName) { Console.WriteLine($"Removed {fileName}"); File.Delete(config.path + fileName); return; } } } private static void Cleanup() { if (Directory.Exists(config.path)) { // delete all files in the directory that are older than store_duration foreach (string filePath in Directory.EnumerateFiles(config.path)) { if (!config.removal_ignore_list.Contains(Path.GetFileName(filePath)) && File.GetLastWriteTimeUtc(filePath).AddDays(config.store_duration) < DateTime.UtcNow) { Console.WriteLine($"Removed {filePath}"); File.Delete(filePath); } } } else { Directory.CreateDirectory(config.path); } } #endregion #region Data Detection // Based on https://stackoverflow.com/questions/8466703/httplistener-and-file-upload private static string GetBoundary(string ctype) { return "--" + ctype.Split(';')[1].Split('=')[1]; } private static MemoryStream GetFile(Encoding enc, string boundary, Stream input) { byte[] boundaryBytes = enc.GetBytes(boundary); int boundaryLen = boundaryBytes.Length; MemoryStream output = new MemoryStream(); byte[] buffer = new byte[1024]; int len = input.Read(buffer, 0, 1024); int startPos; // Find start boundary while (true) { if (len != 0) { startPos = IndexOf(buffer, len, boundaryBytes); if (startPos >= 0) { break; } else { Array.Copy(buffer, len - boundaryLen, buffer, 0, boundaryLen); len = input.Read(buffer, boundaryLen, 1024 - boundaryLen); } } } // Skip four lines (Boundary, Content-Disposition, Content-Type, and a blank) for (int i = 0; i < 4; i++) { while (true) { if (len != 0) { startPos = Array.IndexOf(buffer, enc.GetBytes("\n")[0], startPos); if (startPos >= 0) { startPos++; break; } else { len = input.Read(buffer, 0, 1024); } } } } Array.Copy(buffer, startPos, buffer, 0, len - startPos); len -= startPos; while (true) { int endPos = IndexOf(buffer, len, boundaryBytes); if (endPos >= 0) { if (endPos > 0) output.Write(buffer, 0, endPos - 2); break; } else if (len <= boundaryLen) { throw new Exception("End Boundary Not Found"); } else { output.Write(buffer, 0, len - boundaryLen); Array.Copy(buffer, len - boundaryLen, buffer, 0, boundaryLen); len = input.Read(buffer, boundaryLen, 1024 - boundaryLen) + boundaryLen; } } return output; } private static int IndexOf(byte[] buffer, int len, byte[] boundarybytes) { for (int i = 0; i <= len - boundarybytes.Length; i++) { bool match = true; for (int j = 0; j < boundarybytes.Length && match; j++) { match = buffer[i + j] == boundarybytes[j]; } if (match) { return i; } } return -1; } #endregion } }
23.955882
93
0.620258
[ "MIT" ]
stanriders/sharexserv
sharexserv/Program.cs
8,147
C#
// Generated by gencs from sensor_msgs/JoyFeedbackArray.msg // DO NOT EDIT THIS FILE BY HAND! using System; using System.Collections; using System.Collections.Generic; using SIGVerse.ROSBridge; using UnityEngine; using SIGVerse.ROSBridge.sensor_msgs; namespace SIGVerse.ROSBridge { namespace sensor_msgs { [System.Serializable] public class JoyFeedbackArray : ROSMessage { public System.Collections.Generic.List<sensor_msgs.JoyFeedback> array; public JoyFeedbackArray() { this.array = new System.Collections.Generic.List<sensor_msgs.JoyFeedback>(); } public JoyFeedbackArray(System.Collections.Generic.List<sensor_msgs.JoyFeedback> array) { this.array = array; } new public static string GetMessageType() { return "sensor_msgs/JoyFeedbackArray"; } new public static string GetMD5Hash() { return "cde5730a895b1fc4dee6f91b754b213d"; } } // class JoyFeedbackArray } // namespace sensor_msgs } // namespace SIGVerse.ROSBridge
22.244444
91
0.746254
[ "MIT" ]
shiori-yokota/CookingTask
Assets/SIGVerse/Common/ROSBridge/messaging/sensor_msgs/JoyFeedbackArray.cs
1,001
C#
namespace PersonalRecipeDatabase.Models; public class ErrorViewModel { public string? RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); }
20.555556
66
0.756757
[ "MIT" ]
crixlis/PersonalRecipeDatabase
Models/ErrorViewModel.cs
185
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MOBA_CSharp_Server.Library.ECS; namespace MOBA_CSharp_Server.Game { public class Poison : Effect { public int UnitID { get; private set; } float attack; public Poison(int unitID, float duration, float attack, Unit unitRoot, Entity root) : base(CombatType.Poison, unitRoot, root) { AddInheritedType(typeof(Poison)); UnitID = unitID; UpdateTimer(duration, attack); } public override void Step(float deltaTime) { base.Step(deltaTime); Timer -= deltaTime; if(Timer <= 0) { Destroyed = true; } if (unitRoot.HP > 0) { unitRoot.Damage(UnitID, true, attack * deltaTime); } } public void UpdateTimer(float duration, float attack) { Timer = duration; this.attack = attack; Stack = 1; IsActive = true; Destroyed = false; } } }
23.42
133
0.538856
[ "MIT" ]
LaudateCorpus1/MOBA_CSharp_Unity
MOBA_CSharp_Server/MOBA_CSharp_Server/Game/UnitComponent/Combat/Effects/Poison.cs
1,173
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { public Drive DriveScript; // Start is called before the first frame update void Start() { DriveScript = gameObject.GetComponent<Drive>(); } void Update() { float a = Input.GetAxis("Vertical"); float s = Input.GetAxis("Horizontal"); float b = Input.GetAxis("Jump"); DriveScript.Go(a, s, b); DriveScript.CheckForSkid(); DriveScript.CalculateEngineSound(); } }
23.12
56
0.640138
[ "MIT" ]
gwalek/GrashKart
Assets/PlayerController.cs
580
C#
using System.ComponentModel.DataAnnotations.Schema; using TrackableEntities.Client; namespace WebApiSample.Shared.Entities.Models { [Table("OrderDetail")] public partial class OrderDetail : EntityBase { public int OrderDetailId { get { return _OrderDetailId; } set { if (Equals(value, _OrderDetailId)) return; _OrderDetailId = value; NotifyPropertyChanged(); } } private int _OrderDetailId; public int OrderId { get { return _OrderId; } set { if (Equals(value, _OrderId)) return; _OrderId = value; NotifyPropertyChanged(); } } private int _OrderId; public int ProductId { get { return _ProductId; } set { if (Equals(value, _ProductId)) return; _ProductId = value; NotifyPropertyChanged(); } } private int _ProductId; [Column(TypeName = "money")] public decimal UnitPrice { get { return _UnitPrice; } set { if (Equals(value, _UnitPrice)) return; _UnitPrice = value; NotifyPropertyChanged(); } } private decimal _UnitPrice; public short Quantity { get { return _Quantity; } set { if (Equals(value, _Quantity)) return; _Quantity = value; NotifyPropertyChanged(); } } private short _Quantity; public float Discount { get { return _Discount; } set { if (Equals(value, _Discount)) return; _Discount = value; NotifyPropertyChanged(); } } private float _Discount; public Order Order { get { return _Order; } set { if (Equals(value, _Order)) return; _Order = value; OrderChangeTracker = _Order == null ? null : new ChangeTrackingCollection<Order> { _Order }; NotifyPropertyChanged(); } } private Order _Order; private ChangeTrackingCollection<Order> OrderChangeTracker { get; set; } public Product Product { get { return _Product; } set { if (Equals(value, _Product)) return; _Product = value; ProductChangeTracker = _Product == null ? null : new ChangeTrackingCollection<Product> { _Product }; NotifyPropertyChanged(); } } private Product _Product; private ChangeTrackingCollection<Product> ProductChangeTracker { get; set; } } }
19.478261
78
0.651339
[ "MIT" ]
ERobishaw/trackable-entities
Samples/VS2013/WebApiSample/WebApiSample.Shared.Entities.Net45/Models/OrderDetail.cs
2,240
C#
using System; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("AWSSDK.KinesisAnalytics")] #if BCL35 [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - Amazon Kinesis Analytics. Amazon Kinesis Analytics is a fully managed service for continuously querying streaming data using standard SQL.")] #elif BCL45 [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (4.5) - Amazon Kinesis Analytics. Amazon Kinesis Analytics is a fully managed service for continuously querying streaming data using standard SQL.")] #elif PCL [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (PCL) - Amazon Kinesis Analytics. Amazon Kinesis Analytics is a fully managed service for continuously querying streaming data using standard SQL.")] #elif UNITY [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (Unity) - Amazon Kinesis Analytics. Amazon Kinesis Analytics is a fully managed service for continuously querying streaming data using standard SQL.")] #elif CORECLR [assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (CoreCLR)- Amazon Kinesis Analytics. Amazon Kinesis Analytics is a fully managed service for continuously querying streaming data using standard SQL.")] #else #error Unknown platform constant - unable to set correct AssemblyDescription #endif [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Amazon Web Services SDK for .NET")] [assembly: AssemblyCompany("Amazon.com, Inc")] [assembly: AssemblyCopyright("Copyright 2009-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.3")] [assembly: AssemblyFileVersion("3.3.4.1")] #if WINDOWS_PHONE || UNITY [assembly: System.CLSCompliant(false)] # else [assembly: System.CLSCompliant(true)] #endif #if BCL [assembly: System.Security.AllowPartiallyTrustedCallers] #endif
48.649123
221
0.776776
[ "Apache-2.0" ]
slang25/aws-sdk-net
sdk/src/Services/KinesisAnalytics/Properties/AssemblyInfo.cs
2,773
C#
using UnityEngine; using System.Collections; using System; public enum TileType { property, free, goJail, inJail, start, tax, chance, chest }
10.133333
25
0.723684
[ "MIT" ]
VulcanStorm/BOTMonopoly
Assets/TileType.cs
154
C#
using System; using System.Collections.Generic; using System.Text; namespace EPlast.BLL.Models { public class FacebookUserInfo { public string AccessToken { get; set; } public string DataAccessExpirationTime { get; set; } public string Email { get; set; } public string ExpiresIn { get; set; } public string GraphDomain { get; set; } public string Id { get; set; } public string Name { get; set; } public object Picture { get; set; } public string UserId { get; set; } public string SignedRequest { get; set; } public string Birthday { get; set; } public string Gender { get; set; } } }
30.304348
60
0.61406
[ "MIT" ]
Toxa2202/plast
EPlast/EPlast.BLL/Models/FacebookUserInfo.cs
699
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DatasetWriter.Models { public class Contribution { public int ContributionID { get; set; } public string Contributor { get; set; } public string City { get; set; } public string State { get; set; } public int Zipcode { get; set; } public string Gender { get; set; } public DateTime Time { get; set; } public string TimeWindow { get; set; } public decimal Amount { get; set; } } public class ContributionSet { public Contribution[] rows { get; set; } } #region "Classes for generating sample data for contribution demo" public class LocationData { public string City { get; set; } public string State { get; set; } public int Zipcode { get; set; } } #endregion public class ContributionsDataFactory { private static Random RandomNumberFactory = new Random(2016); private static int contributionCount = 0; private static int contributionListsCount = 0; private static int ContributionGrowthPhase = 1; public static void SetContributionGrowthPhase(int value) { ContributionGrowthPhase = value; } public static Contribution GetNextContribution() { contributionCount += 1; LocationData contributionLocation = GetNextContributionLocation(); int contributionId = contributionCount; string City = contributionLocation.City; string State = contributionLocation.State; int Zipcode = contributionLocation.Zipcode; string Gender = "Female"; switch (ContributionGrowthPhase) { case 1: if (RandomNumberFactory.Next(1, 100) > 36) { Gender = "Male"; } break; case 2: if (RandomNumberFactory.Next(1, 100) > 72) { Gender = "Male"; } break; case 3: if (RandomNumberFactory.Next(1, 100) > 80) { Gender = "Male"; } break; case 4: if (RandomNumberFactory.Next(1, 100) > 72) { Gender = "Male"; } break; case 5: if (RandomNumberFactory.Next(1, 100) > 62) { Gender = "Male"; } break; case 6: if (RandomNumberFactory.Next(1, 100) > 45) { Gender = "Male"; } break; case 7: if (RandomNumberFactory.Next(1, 100) > 48) { Gender = "Male"; } break; case 8: if (RandomNumberFactory.Next(1, 100) > 40) { Gender = "Male"; } break; case 9: if (RandomNumberFactory.Next(1, 100) > 50) { Gender = "Male"; } break; case 10: if (RandomNumberFactory.Next(1, 100) > 58) { Gender = "Male"; } break; } string FirstName = ""; if (Gender.Equals("F")) { FirstName = GetNextFemaleFirstName(); } else { FirstName = GetNextMaleFirstName(); } string LastName = GetNextLastName(); string TimeValue = DateTime.Now.ToString("H:mm") + ":" + ((DateTime.Now.Second / 15) * 15).ToString("00"); Contribution newContribution = new Contribution { ContributionID = contributionId, Contributor = FirstName + " " + LastName, City = City + ", " + State, State = State, Zipcode = Zipcode, Gender = Gender, Time = DateTime.Now.AddHours(-4), TimeWindow = TimeValue, Amount = GetNextContributionAmount(Zipcode) }; return newContribution; } public static ContributionSet GetContributionList() { contributionListsCount += 1; if (contributionListsCount == 7) { SetContributionGrowthPhase(2); } if (contributionListsCount == 21) { SetContributionGrowthPhase(3); } if (contributionListsCount == 30) { SetContributionGrowthPhase(4); } if (contributionListsCount == 45) { SetContributionGrowthPhase(5); } if (contributionListsCount == 60) { SetContributionGrowthPhase(6); } if (contributionListsCount == 85) { SetContributionGrowthPhase(7); } if (contributionListsCount == 100) { SetContributionGrowthPhase(8); } if (contributionListsCount == 120) { SetContributionGrowthPhase(9); } if (contributionListsCount == 135) { SetContributionGrowthPhase(10); } int ContributionCount = 1; switch (ContributionGrowthPhase) { case 1: ContributionCount = 1; break; case 2: ContributionCount = 8; break; case 3: ContributionCount = RandomNumberFactory.Next(15, 30); break; case 4: ContributionCount = RandomNumberFactory.Next(22, 30); break; case 5: ContributionCount = RandomNumberFactory.Next(28, 42); break; case 6: ContributionCount = RandomNumberFactory.Next(1, 2); break; case 7: ContributionCount = RandomNumberFactory.Next(34, 48); break; case 8: ContributionCount = RandomNumberFactory.Next(42, 62); break; case 9: ContributionCount = RandomNumberFactory.Next(44, 70); break; case 10: ContributionCount = RandomNumberFactory.Next(56, 66); break; } List<Contribution> list = new List<Contribution>(ContributionCount); for (int i = 1; i <= ContributionCount; i++) { list.Add(GetNextContribution()); } Console.Write("."); return new ContributionSet { rows = list.ToArray() }; } #region "Static fields with arrays of sample data values" private static LocationData[] ContributionLocations1 = new LocationData[]{ new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Davis Island", State="FL", Zipcode=33606 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 } }; private static LocationData[] ContributionLocations2 = new LocationData[]{ new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="Davis Island", State="FL", Zipcode=33606 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621}, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, }; private static LocationData[] ContributionLocations3 = new LocationData[]{ new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Davis Island", State="FL", Zipcode=33606 } }; private static LocationData[] ContributionLocations4 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 } }; private static LocationData[] ContributionLocations5 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 } }; private static LocationData[] ContributionLocations6 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Davis Island", State="FL", Zipcode=33606 } }; private static LocationData[] ContributionLocations7 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Town N Country", State="FL", Zipcode=33615 }, new LocationData{ City="Tampa", State="FL", Zipcode=33634 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33610 }, new LocationData{ City="Clair Mel City", State="FL", Zipcode=33619 }, new LocationData{ City="Tampa", State="FL", Zipcode=33607 }, new LocationData{ City="Palma Ceia", State="FL", Zipcode=33629 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33767 } }; private static LocationData[] ContributionLocations8 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Town N Country", State="FL", Zipcode=33615 }, new LocationData{ City="Tampa", State="FL", Zipcode=33634 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33610 }, new LocationData{ City="Clair Mel City", State="FL", Zipcode=33619 }, new LocationData{ City="Tampa", State="FL", Zipcode=33607 }, new LocationData{ City="Palma Ceia", State="FL", Zipcode=33629 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33767 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33764 }, new LocationData{ City="Indian Rocks Beach", State="FL", Zipcode=33786 }, new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33709 } }; private static LocationData[] ContributionLocations9 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Town N Country", State="FL", Zipcode=33615 }, new LocationData{ City="Tampa", State="FL", Zipcode=33634 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33610 }, new LocationData{ City="Clair Mel City", State="FL", Zipcode=33619 }, new LocationData{ City="Tampa", State="FL", Zipcode=33607 }, new LocationData{ City="Palma Ceia", State="FL", Zipcode=33629 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33767 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33764 }, new LocationData{ City="Indian Rocks Beach", State="FL", Zipcode=33786 }, new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33709 }, new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Belleair Bluffs", State="FL", Zipcode=33770 } }; private static LocationData[] ContributionLocations10 = new LocationData[] { new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Town N Country", State="FL", Zipcode=33615 }, new LocationData{ City="Tampa", State="FL", Zipcode=33634 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33610 }, new LocationData{ City="Clair Mel City", State="FL", Zipcode=33619 }, new LocationData{ City="Tampa", State="FL", Zipcode=33607 }, new LocationData{ City="Palma Ceia", State="FL", Zipcode=33629 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33767 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33764 }, new LocationData{ City="Indian Rocks Beach", State="FL", Zipcode=33786 }, new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33709 }, new LocationData{ City="Odessa", State="FL", Zipcode=33556 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33558 }, new LocationData{ City="Lutz", State="FL", Zipcode=33548 }, new LocationData{ City="Lutz", State="FL", Zipcode=33559 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34683 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34684 }, new LocationData{ City="Palm Harbor", State="FL", Zipcode=34685 }, new LocationData{ City="Westchase", State="FL", Zipcode=33626 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33625 }, new LocationData{ City="Carrollwood", State="FL", Zipcode=33618 }, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34689}, new LocationData{ City="Tarpon Springs", State="FL", Zipcode=34688 }, new LocationData{ City="Lake Magdalene", State="FL", Zipcode=33613 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33617 }, new LocationData{ City="Tampa Palms", State="FL", Zipcode=33647 }, new LocationData{ City="Thonotosassa", State="FL", Zipcode=33592 }, new LocationData{ City="Belleair Bluffs", State="FL", Zipcode=33770 }, new LocationData{ City="Tampa", State="FL", Zipcode=33634 }, new LocationData{ City="Temple Terrace", State="FL", Zipcode=33610 }, new LocationData{ City="Clair Mel City", State="FL", Zipcode=33619 }, new LocationData{ City="Tampa", State="FL", Zipcode=33602 }, new LocationData{ City="Tampa", State="FL", Zipcode=33607 }, new LocationData{ City="Palma Ceia", State="FL", Zipcode=33629 }, new LocationData{ City="Tampa", State="FL", Zipcode=33616 }, new LocationData{ City="Macdill AFB, Port Tampa", State="FL", Zipcode=33621 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33767 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33755 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33765 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33759 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33764 }, new LocationData{ City="Indian Rocks Beach", State="FL", Zipcode=33786 }, new LocationData{ City="Belleair Bluffs", State="FL", Zipcode=33770 }, new LocationData{ City="Largo", State="FL", Zipcode=33771 }, new LocationData{ City="Clearwater", State="FL", Zipcode=33760 }, new LocationData{ City="Largo", State="FL", Zipcode=33773 }, new LocationData{ City="Largo", State="FL", Zipcode=33774 }, new LocationData{ City="Pinellas Park", State="FL", Zipcode=33782 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33709 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33713 }, new LocationData{ City="St Petersburg", State="FL", Zipcode=33713 }, new LocationData{ City="New Port Richey", State="FL", Zipcode=34625 }, new LocationData{ City="Wesley Chappel", State="FL", Zipcode=33544 }, new LocationData{ City="Dunedin", State="FL", Zipcode=34698 }, new LocationData{ City="Apollo Beach", State="FL", Zipcode=33572 }, new LocationData{ City="RiverView", State="FL", Zipcode=33569 } }; private static string[] FemaleFirstNames = new string[] { "Abby", "Abigail", "Ada", "Addie", "Adela", "Adele", "Adeline", "Adrian", "Adriana", "Adrienne", "Agnes", "Aida", "Aileen", "Aimee", "Aisha", "Alana", "Alba", "Alberta", "Alejandra", "Alexandra", "Alexandria", "Alexis", "Alfreda", "Alice", "Alicia", "Aline", "Alisa", "Alisha", "Alison", "Alissa", "Allie", "Allison", "Allyson", "Alma", "Alta", "Althea", "Alyce", "Alyson", "Alyssa", "Amalia", "Amanda", "Amber", "Amelia", "Amie", "Amparo", "Amy", "Ana", "Anastasia", "Andrea", "Angel", "Angela", "Angelia", "Angelica", "Angelina", "Angeline", "Angelique", "Angelita", "Angie", "Anita", "Ann", "Anna", "Annabelle", "Anne", "Annette", "Annie", "Annmarie", "Antoinette", "Antonia", "April", "Araceli", "Arlene", "Arline", "Ashlee", "Ashley", "Audra", "Audrey", "Augusta", "Aurelia", "Aurora", "Autumn", "Ava", "Avis", "Barbara", "Barbra", "Beatrice", "Beatriz", "Becky", "Belinda", "Benita", "Bernadette", "Bernadine", "Bernice", "Berta", "Bertha", "Bertie", "Beryl", "Bessie", "Beth", "Bethany", "Betsy", "Bette", "Bettie", "Betty", "Bettye", "Beulah", "Beverley", "Beverly", "Bianca", "Billie", "Blanca", "Blanche", "Bobbi", "Bobbie", "Bonita", "Bonnie", "Brandi", "Brandie", "Brandy", "Brenda", "Briana", "Brianna", "Bridget", "Bridgett", "Bridgette", "Brigitte", "Britney", "Brittany", "Brittney", "Brooke", "Caitlin", "Callie", "Camille", "Candace", "Candice", "Candy", "Cara", "Carey", "Carissa", "Carla", "Carlene", "Carly", "Carmela", "Carmella", "Carmen", "Carol", "Carole", "Carolina", "Caroline", "Carolyn", "Carrie", "Casandra", "Casey", "Cassandra", "Cassie", "Catalina", "Catherine", "Cathleen", "Cathryn", "Cathy", "Cecelia", "Cecile", "Cecilia", "Celeste", "Celia", "Celina", "Chandra", "Charity", "Charlene", "Charlotte", "Charmaine", "Chasity", "Chelsea", "Cheri", "Cherie", "Cherry", "Cheryl", "Chris", "Christa", "Christi", "Christian", "Christie", "Christina", "Christine", "Christy", "Chrystal", "Cindy", "Claire", "Clara", "Clare", "Clarice", "Clarissa", "Claudette", "Claudia", "Claudine", "Cleo", "Coleen", "Colette", "Colleen", "Concepcion", "Concetta", "Connie", "Constance", "Consuelo", "Cora", "Corina", "Corine", "Corinne", "Cornelia", "Corrine", "Courtney", "Cristina", "Crystal", "Cynthia", "Daisy", "Dale", "Dana", "Danielle", "Daphne", "Darcy", "Darla", "Darlene", "Dawn", "Deana", "Deann", "Deanna", "Deanne", "Debbie", "Debora", "Deborah", "Debra", "Dee", "Deena", "Deidre", "Deirdre", "Delia", "Della", "Delores", "Deloris", "Dena", "Denise", "Desiree", "Diana", "Diane", "Diann", "Dianna", "Dianne", "Dina", "Dionne", "Dixie", "Dollie", "Dolly", "Dolores", "Dominique", "Dona", "Donna", "Dora", "Doreen", "Doris", "Dorothea", "Dorothy", "Dorthy", "Earlene", "Earline", "Earnestine", "Ebony", "Eddie", "Edith", "Edna", "Edwina", "Effie", "Eileen", "Elaine", "Elba", "Eleanor", "Elena", "Elinor", "Elisa", "Elisabeth", "Elise", "Eliza", "Elizabeth", "Ella", "Ellen", "Elma", "Elnora", "Eloise", "Elsa", "Elsie", "Elva", "Elvia", "Elvira", "Emilia", "Emily", "Emma", "Enid", "Erica", "Ericka", "Erika", "Erin", "Erma", "Erna", "Ernestine", "Esmeralda", "Esperanza", "Essie", "Estela", "Estella", "Estelle", "Ester", "Esther", "Ethel", "Etta", "Eugenia", "Eula", "Eunice", "Eva", "Evangelina", "Evangeline", "Eve", "Evelyn", "Faith", "Fannie", "Fanny", "Fay", "Faye", "Felecia", "Felicia", "Fern", "Flora", "Florence", "Florine", "Flossie", "Fran", "Frances", "Francesca", "Francine", "Francis", "Francisca", "Frankie", "Freda", "Freida", "Frieda", "Gabriela", "Gabrielle", "Gail", "Gale", "Gay", "Gayle", "Gena", "Geneva", "Genevieve", "Georgette", "Georgia", "Georgina", "Geraldine", "Gertrude", "Gilda", "Gina", "Ginger", "Gladys", "Glenda", "Glenna", "Gloria", "Goldie", "Grace", "Gracie", "Graciela", "Greta", "Gretchen", "Guadalupe", "Gwen", "Gwendolyn", "Haley", "Hallie", "Hannah", "Harriet", "Harriett", "Hattie", "Hazel", "Heather", "Heidi", "Helen", "Helena", "Helene", "Helga", "Henrietta", "Herminia", "Hester", "Hilary", "Hilda", "Hillary", "Hollie", "Holly", "Hope", "Ida", "Ila", "Ilene", "Imelda", "Imogene", "Ina", "Ines", "Inez", "Ingrid", "Irene", "Iris", "Irma", "Isabel", "Isabella", "Isabelle", "Iva", "Ivy", "Jackie", "Jacklyn", "Jaclyn", "Jacqueline", "Jacquelyn", "Jaime", "James", "Jami", "Jamie", "Jan", "Jana", "Jane", "Janell", "Janelle", "Janet", "Janette", "Janice", "Janie", "Janine", "Janis", "Janna", "Jannie", "Jasmine", "Jayne", "Jean", "Jeanette", "Jeanie", "Jeanine", "Jeanne", "Jeannette", "Jeannie", "Jeannine", "Jenifer", "Jenna", "Jennie", "Jennifer", "Jenny", "Jeri", "Jerri", "Jerry", "Jessica", "Jessie", "Jewel", "Jewell", "Jill", "Jillian", "Jimmie", "Jo", "Joan", "Joann", "Joanna", "Joanne", "Jocelyn", "Jodi", "Jodie", "Jody", "Johanna", "John", "Johnnie", "Jolene", "Joni", "Jordan", "Josefa", "Josefina", "Josephine", "Josie", "Joy", "Joyce", "Juana", "Juanita", "Judith", "Judy", "Julia", "Juliana", "Julianne", "Julie", "Juliet", "Juliette", "June", "Justine", "Kaitlin", "Kara", "Karen", "Kari", "Karin", "Karina", "Karla", "Karyn", "Kasey", "Kate", "Katelyn", "Katharine", "Katherine", "Katheryn", "Kathie", "Kathleen", "Kathrine", "Kathryn", "Kathy", "Katie", "Katina", "Katrina", "Katy", "Kay", "Kaye", "Kayla", "Keisha", "Kelley", "Kelli", "Kellie", "Kelly", "Kelsey", "Kendra", "Kenya", "Keri", "Kerri", "Kerry", "Kim", "Kimberley", "Kimberly", "Kirsten", "Kitty", "Kris", "Krista", "Kristen", "Kristi", "Kristie", "Kristin", "Kristina", "Kristine", "Kristy", "Krystal", "Lacey", "Lacy", "Ladonna", "Lakeisha", "Lakisha", "Lana", "Lara", "Latasha", "Latisha", "Latonya", "Latoya", "Laura", "Laurel", "Lauren", "Lauri", "Laurie", "Laverne", "Lavonne", "Lawanda", "Lea", "Leah", "Leann", "Leanna", "Leanne", "Lee", "Leigh", "Leila", "Lela", "Lelia", "Lena", "Lenora", "Lenore", "Leola", "Leona", "Leonor", "Lesa", "Lesley", "Leslie", "Lessie", "Leta", "Letha", "Leticia", "Letitia", "Lidia", "Lila", "Lilia", "Lilian", "Liliana", "Lillian", "Lillie", "Lilly", "Lily", "Lina", "Linda", "Lindsay", "Lindsey", "Lisa", "Liz", "Liza", "Lizzie", "Lois", "Lola", "Lolita", "Lora", "Loraine", "Lorena", "Lorene", "Loretta", "Lori", "Lorie", "Lorna", "Lorraine", "Lorrie", "Lottie", "Lou", "Louella", "Louisa", "Louise", "Lourdes", "Luann", "Lucia", "Lucile", "Lucille", "Lucinda", "Lucy", "Luella", "Luisa", "Lula", "Lupe", "Luz", "Lydia", "Lynda", "Lynette", "Lynn", "Lynne", "Lynnette", "Mabel", "Mable", "Madeleine", "Madeline", "Madelyn", "Madge", "Mae", "Magdalena", "Maggie", "Mai", "Malinda", "Mallory", "Mamie", "Mandy", "Manuela", "Mara", "Marcella", "Marci", "Marcia", "Marcie", "Marcy", "Margaret", "Margarita", "Margery", "Margie", "Margo", "Margret", "Marguerite", "Mari", "Maria", "Marian", "Mariana", "Marianne", "Maribel", "Maricela", "Marie", "Marietta", "Marilyn", "Marina", "Marion", "Marisa", "Marisol", "Marissa", "Maritza", "Marjorie", "Marla", "Marlene", "Marquita", "Marsha", "Marta", "Martha", "Martina", "Marva", "Mary", "Maryann", "Maryanne", "Maryellen", "Marylou", "Matilda", "Mattie", "Maude", "Maura", "Maureen", "Mavis", "Maxine", "May", "Mayra", "Meagan", "Megan", "Meghan", "Melanie", "Melba", "Melinda", "Melisa", "Melissa", "Melody", "Melva", "Mercedes", "Meredith", "Merle", "Mia", "Michael", "Michele", "Michelle", "Milagros", "Mildred", "Millicent", "Millie", "Mindy", "Minerva", "Minnie", "Miranda", "Miriam", "Misty", "Mitzi", "Mollie", "Molly", "Mona", "Monica", "Monique", "Morgan", "Muriel", "Myra", "Myrna", "Myrtle", "Nadia", "Nadine", "Nancy", "Nanette", "Nannie", "Naomi", "Natalia", "Natalie", "Natasha", "Nelda", "Nell", "Nellie", "Nettie", "Neva", "Nichole", "Nicole", "Nikki", "Nina", "Nita", "Noelle", "Noemi", "Nola", "Nona", "Nora", "Noreen", "Norma", "Odessa", "Ofelia", "Ola", "Olga", "Olive", "Olivia", "Ollie", "Opal", "Ophelia", "Ora", "Paige", "Pam", "Pamela", "Pansy", "Pat", "Patrica", "Patrice", "Patricia", "Patsy", "Patti", "Patty", "Paula", "Paulette", "Pauline", "Pearl", "Pearlie", "Peggy", "Penelope", "Penny", "Petra", "Phoebe", "Phyllis", "Polly", "Priscilla", "Queen", "Rachael", "Rachel", "Rachelle", "Rae", "Ramona", "Randi", "Raquel", "Reba", "Rebecca", "Rebekah", "Regina", "Rena", "Rene", "Renee", "Reva", "Reyna", "Rhea", "Rhoda", "Rhonda", "Rita", "Robbie", "Robert", "Roberta", "Robin", "Robyn", "Rochelle", "Ronda", "Rosa", "Rosalie", "Rosalind", "Rosalinda", "Rosalyn", "Rosanna", "Rosanne", "Rosario", "Rose", "Roseann", "Rosella", "Rosemarie", "Rosemary", "Rosetta", "Rosie", "Roslyn", "Rowena", "Roxanne", "Roxie", "Ruby", "Ruth", "Ruthie", "Sabrina", "Sadie", "Sallie", "Sally", "Samantha", "Sandra", "Sandy", "Sara", "Sarah", "Sasha", "Saundra", "Savannah", "Selena", "Selma", "Serena", "Shana", "Shanna", "Shannon", "Shari", "Sharlene", "Sharon", "Sharron", "Shauna", "Shawn", "Shawna", "Sheena", "Sheila", "Shelby", "Shelia", "Shelley", "Shelly", "Sheree", "Sheri", "Sherri", "Sherrie", "Sherry", "Sheryl", "Shirley", "Silvia", "Simone", "Socorro", "Sofia", "Sondra", "Sonia", "Sonja", "Sonya", "Sophia", "Sophie", "Stacey", "Staci", "Stacie", "Stacy", "Stefanie", "Stella", "Stephanie", "Sue", "Summer", "Susan", "Susana", "Susanna", "Susanne", "Susie", "Suzanne", "Suzette", "Sybil", "Sylvia", "Tabatha", "Tabitha", "Tamara", "Tameka", "Tamera", "Tami", "Tamika", "Tammi", "Tammie", "Tammy", "Tamra", "Tania", "Tanisha", "Tanya", "Tara", "Tasha", "Taylor", "Teresa", "Teri", "Terra", "Terri", "Terrie", "Terry", "Tessa", "Thelma", "Theresa", "Therese", "Tia", "Tiffany", "Tina", "Tisha", "Tommie", "Toni", "Tonia", "Tonya", "Tracey", "Traci", "Tracie", "Tracy", "Tricia", "Trina", "Trisha", "Trudy", "Twila", "Ursula", "Valarie", "Valeria", "Valerie", "Vanessa", "Velma", "Vera", "Verna", "Veronica", "Vicki", "Vickie", "Vicky", "Victoria", "Vilma", "Viola", "Violet", "Virgie", "Virginia", "Vivian", "Vonda", "Wanda", "Wendi", "Wendy", "Whitney", "Wilda", "Willa", "Willie", "Wilma", "Winifred", "Winnie", "Yesenia", "Yolanda", "Young", "Yvette", "Yvonne", "Zelma" }; private static string[] MaleFirstNames = new string[] { "Aaron", "Abdul", "Abe", "Abel", "Abraham", "Abram", "Adam", "Adolfo", "Adrian", "Ahmed", "Al", "Alan", "Albert", "Alberto", "Alden", "Alec", "Alejandro", "Alex", "Alexander", "Alexis", "Alfonzo", "Alfred", "Allan", "Alonso", "Alonzo", "Alphonse", "Alphonso", "Alton", "Alva", "Alvaro", "Alvin", "Amado", "Ambrose", "Amos", "Anderson", "Andre", "Andrea", "Andres", "Andrew", "Andy", "Angel", "Angelo", "Anibal", "Anthony", "Antione", "Antoine", "Anton", "Antone", "Antonia", "Antonio", "Antony", "Antwan", "Archie", "Arden", "Ariel", "Arlen", "Arlie", "Armand", "Armando", "Arnold", "Arnoldo", "Arnulfo", "Aron", "Arron", "Art", "Arthur", "Arturo", "Asa", "Ashley", "Aubrey", "August", "Augustine", "Augustus", "Aurelio", "Austin", "Avery", "Barney", "Barrett", "Barry", "Bart", "Barton", "Basil", "Beau", "Ben", "Benedict", "Benito", "Benjamin", "Bennett", "Bennie", "Benny", "Benton", "Bernard", "Bernardo", "Bernie", "Berry", "Bert", "Bertram", "Bill", "Billie", "Billy", "Blaine", "Blair", "Blake", "Bo", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Bob", "Bobbie", "Bobby", "Booker", "Boris", "Boyce", "Boyd", "Brad", "Bradford", "Bradley", "Bradly", "Brady", "Brain", "Branden", "Brandon", "Brant", "Brendan", "Brendon", "Brent", "Brenton", "Bret", "Brett", "Brian", "Brice", "Britt", "Brock", "Broderick", "Brooks", "Bruce", "Bruno", "Bryan", "Bryant", "Bryce", "Bryon", "Buck", "Bud", "Buddy", "Buford", "Burl", "Burt", "Burton", "Buster", "Byron", "Caleb", "Calvin", "Cameron", "Carey", "Carl", "Carlo", "Carlos", "Carlton", "Carmelo", "Carmen", "Carmine", "Carol", "Carrol", "Carroll", "Carson", "Carter", "Cary", "Casey", "Cecil", "Cedric", "Cedrick", "Cesar", "Chad", "Chadwick", "Chance", "Chang", "Charles", "Charley", "Charlie", "Chas", "Chase", "Chauncey", "Chester", "Chet", "Chi", "Chong", "Chris", "Christian", "Christoper", "Christopher", "Chuck", "Chung", "Clair", "Clarence", "Clark", "Claud", "Claude", "Claudio", "Clay", "Clayton", "Clement", "Clemente", "Cleo", "Cletus", "Cleveland", "Cliff", "Clifford", "Clifton", "Clint", "Clinton", "Clyde", "Cody", "Colby", "Cole", "Coleman", "Colin", "Collin", "Colton", "Columbus", "Connie", "Conrad", "Cordell", "Corey", "Cornelius", "Cornell", "Cortez", "Cory", "Courtney", "Coy", "Craig", "Cristobal", "Cristopher", "Cruz", "Curt", "Curtis", "Cyril", "Cyrus", "Dale", "Dallas", "Dalton", "Damian", "Damien", "Damion", "Damon", "Dan", "Dana", "Dane", "Danial", "Daniel", "Danilo", "Dannie", "Danny", "Dante", "Darell", "Daren", "Darin", "Dario", "Darius", "Darnell", "Daron", "Darrel", "Darrell", "Darren", "Darrick", "Darrin", "Darron", "Darryl", "Darwin", "Daryl", "Dave", "David", "Davis", "Dean", "Deandre", "Deangelo", "Dee", "Del", "Delbert", "Delmar", "Delmer", "Demarcus", "Demetrius", "Denis", "Dennis", "Denny", "Denver", "Deon", "Derek", "Derick", "Derrick", "Deshawn", "Desmond", "Devin", "Devon", "Dewayne", "Dewey", "Dewitt", "Dexter", "Dick", "Diego", "Dillon", "Dino", "Dion", "Dirk", "Domenic", "Domingo", "Dominic", "Dominick", "Dominique", "Don", "Donald", "Dong", "Donn", "Donnell", "Donnie", "Donny", "Donovan", "Donte", "Dorian", "Dorsey", "Doug", "Douglas", "Douglass", "Doyle", "Drew", "Duane", "Dudley", "Duncan", "Dustin", "Dusty", "Dwain", "Dwayne", "Dwight", "Dylan", "Earl", "Earle", "Earnest", "Ed", "Eddie", "Eddy", "Edgar", "Edgardo", "Edison", "Edmond", "Edmund", "Edmundo", "Eduardo", "Edward", "Edwardo", "Edwin", "Efrain", "Efren", "Elbert", "Elden", "Eldon", "Eldridge", "Eli", "Elias", "Elijah", "Eliseo", "Elisha", "Elliot", "Elliott", "Ellis", "Ellsworth", "Elmer", "Elmo", "Eloy", "Elroy", "Elton", "Elvin", "Elvis", "Elwood", "Emanuel", "Emerson", "Emery", "Emil", "Emile", "Emilio", "Emmanuel", "Emmett", "Emmitt", "Emory", "Enoch", "Enrique", "Erasmo", "Eric", "Erich", "Erick", "Erik", "Erin", "Ernest", "Ernesto", "Ernie", "Errol", "Ervin", "Erwin", "Esteban", "Ethan", "Eugene", "Eugenio", "Eusebio", "Evan", "Everett", "Everette", "Ezekiel", "Ezequiel", "Ezra", "Fabian", "Faustino", "Fausto", "Federico", "Felipe", "Felix", "Felton", "Ferdinand", "Fermin", "Fernando", "Fidel", "Filiberto", "Fletcher", "Florencio", "Florentino", "Floyd", "Forest", "Forrest", "Foster", "Frances", "Francesco", "Francis", "Francisco", "Frank", "Frankie", "Franklin", "Franklyn", "Fred", "Freddie", "Freddy", "Frederic", "Frederick", "Fredric", "Fredrick", "Freeman", "Fritz", "Gabriel", "Gail", "Gale", "Galen", "Garfield", "Garland", "Garret", "Garrett", "Garry", "Garth", "Gary", "Gaston", "Gavin", "Gayle", "Gaylord", "Genaro", "Gene", "Geoffrey", "George", "Gerald", "Geraldo", "Gerard", "Gerardo", "German", "Gerry", "Gil", "Gilbert", "Gilberto", "Gino", "Giovanni", "Giuseppe", "Glen", "Glenn", "Gonzalo", "Gordon", "Grady", "Graham", "Graig", "Grant", "Granville", "Greg", "Gregg", "Gregorio", "Gregory", "Grover", "Guadalupe", "Guillermo", "Gus", "Gustavo", "Guy", "Hai", "Hal", "Hank", "Hans", "Harlan", "Harland", "Harley", "Harold", "Harris", "Harrison", "Harry", "Harvey", "Hassan", "Hayden", "Haywood", "Heath", "Hector", "Henry", "Herb", "Herbert", "Heriberto", "Herman", "Herschel", "Hershel", "Hilario", "Hilton", "Hipolito", "Hiram", "Hobert", "Hollis", "Homer", "Hong", "Horace", "Horacio", "Hosea", "Houston", "Howard", "Hoyt", "Hubert", "Huey", "Hugh", "Hugo", "Humberto", "Hung", "Hunter", "Hyman", "Ian", "Ignacio", "Ike", "Ira", "Irvin", "Irving", "Irwin", "Isaac", "Isaiah", "Isaias", "Isiah", "Isidro", "Ismael", "Israel", "Isreal", "Issac", "Ivan", "Ivory", "Jacinto", "Jack", "Jackie", "Jackson", "Jacob", "Jacques", "Jae", "Jaime", "Jake", "Jamaal", "Jamal", "Jamar", "Jame", "Jamel", "James", "Jamey", "Jamie", "Jamison", "Jan", "Jared", "Jarod", "Jarred", "Jarrett", "Jarrod", "Jarvis", "Jason", "Jasper", "Javier", "Jay", "Jayson", "Jc", "Jean", "Jed", "Jeff", "Jefferey", "Jefferson", "Jeffery", "Jeffrey", "Jeffry", "Jerald", "Jeramy", "Jere", "Jeremiah", "Jeremy", "Jermaine", "Jerold", "Jerome", "Jeromy", "Jerrell", "Jerrod", "Jerrold", "Jerry", "Jess", "Jesse", "Jessie", "Jesus", "Jewel", "Jewell", "Jim", "Jimmie", "Jimmy", "Joan", "Joaquin", "Jody", "Joe", "Joel", "Joesph", "Joey", "John", "Johnathan", "Johnathon", "Johnie", "Johnnie", "Johnny", "Johnson", "Jon", "Jonah", "Jonas", "Jonathan", "Jonathon", "Jordan", "Jordon", "Jorge", "Jose", "Josef", "Joseph", "Josh", "Joshua", "Josiah", "Jospeh", "Josue", "Juan", "Jude", "Judson", "Jules", "Julian", "Julio", "Julius", "Junior", "Justin", "Kareem", "Karl", "Kasey", "Keenan", "Keith", "Kelley", "Kelly", "Kelvin", "Ken", "Kendall", "Kendrick", "Keneth", "Kenneth", "Kennith", "Kenny", "Kent", "Kenton", "Kermit", "Kerry", "Keven", "Kevin", "Kieth", "Kim", "King", "Kip", "Kirby", "Kirk", "Korey", "Kory", "Kraig", "Kris", "Kristofer", "Kristopher", "Kurt", "Kurtis", "Kyle", "Lacy", "Lamar", "Lamont", "Lance", "Landon", "Lane", "Lanny", "Larry", "Lauren", "Laurence", "Lavern", "Laverne", "Lawerence", "Lawrence", "Lazaro", "Leandro", "Lee", "Leif", "Leigh", "Leland", "Lemuel", "Len", "Lenard", "Lenny", "Leo", "Leon", "Leonard", "Leonardo", "Leonel", "Leopoldo", "Leroy", "Les", "Lesley", "Leslie", "Lester", "Levi", "Lewis", "Lincoln", "Lindsay", "Lindsey", "Lino", "Linwood", "Lionel", "Lloyd", "Logan", "Lon", "Long", "Lonnie", "Lonny", "Loren", "Lorenzo", "Lou", "Louie", "Louis", "Lowell", "Loyd", "Lucas", "Luciano", "Lucien", "Lucio", "Lucius", "Luigi", "Luis", "Luke", "Lupe", "Luther", "Lyle", "Lyman", "Lyndon", "Lynn", "Lynwood", "Mac", "Mack", "Major", "Malcolm", "Malcom", "Malik", "Man", "Manual", "Manuel", "Marc", "Marcel", "Marcelino", "Marcellus", "Marcelo", "Marco", "Marcos", "Marcus", "Margarito", "Maria", "Mariano", "Mario", "Marion", "Mark", "Markus", "Marlin", "Marlon", "Marquis", "Marshall", "Martin", "Marty", "Marvin", "Mary", "Mason", "Mathew", "Matt", "Matthew", "Maurice", "Mauricio", "Mauro", "Max", "Maximo", "Maxwell", "Maynard", "Mckinley", "Mel", "Melvin", "Merle", "Merlin", "Merrill", "Mervin", "Micah", "Michael", "Michal", "Michale", "Micheal", "Michel", "Mickey", "Miguel", "Mike", "Mikel", "Milan", "Miles", "Milford", "Millard", "Milo", "Milton", "Minh", "Miquel", "Mitch", "Mitchel", "Mitchell", "Modesto", "Mohamed", "Mohammad", "Mohammed", "Moises", "Monroe", "Monte", "Monty", "Morgan", "Morris", "Morton", "Mose", "Moses", "Moshe", "Murray", "Myles", "Myron", "Napoleon", "Nathan", "Nathanael", "Nathanial", "Nathaniel", "Neal", "Ned", "Neil", "Nelson", "Nestor", "Neville", "Newton", "Nicholas", "Nick", "Nickolas", "Nicky", "Nicolas", "Nigel", "Noah", "Noble", "Noe", "Noel", "Nolan", "Norbert", "Norberto", "Norman", "Normand", "Norris", "Numbers", "Octavio", "Odell", "Odis", "Olen", "Olin", "Oliver", "Ollie", "Omar", "Omer", "Oren", "Orlando", "Orval", "Orville", "Oscar", "Osvaldo", "Oswaldo", "Otha", "Otis", "Otto", "Owen", "Pablo", "Palmer", "Paris", "Parker", "Pasquale", "Pat", "Patricia", "Patrick", "Paul", "Pedro", "Percy", "Perry", "Pete", "Peter", "Phil", "Philip", "Phillip", "Pierre", "Porfirio", "Porter", "Preston", "Prince", "Quentin", "Quincy", "Quinn", "Quintin", "Quinton", "Rafael", "Raleigh", "Ralph", "Ramiro", "Ramon", "Randal", "Randall", "Randell", "Randolph", "Randy", "Raphael", "Rashad", "Raul", "Ray", "Rayford", "Raymon", "Raymond", "Raymundo", "Reed", "Refugio", "Reggie", "Reginald", "Reid", "Reinaldo", "Renaldo", "Renato", "Rene", "Reuben", "Rex", "Rey", "Reyes", "Reynaldo", "Rhett", "Ricardo", "Rich", "Richard", "Richie", "Rick", "Rickey", "Rickie", "Ricky", "Rico", "Rigoberto", "Riley", "Rob", "Robbie", "Robby", "Robert", "Roberto", "Robin", "Robt", "Rocco", "Rocky", "Rod", "Roderick", "Rodger", "Rodney", "Rodolfo", "Rodrick", "Rodrigo", "Rogelio", "Roger", "Roland", "Rolando", "Rolf", "Rolland", "Roman", "Romeo", "Ron", "Ronald", "Ronnie", "Ronny", "Roosevelt", "Rory", "Rosario", "Roscoe", "Rosendo", "Ross", "Roy", "Royal", "Royce", "Ruben", "Rubin", "Rudolf", "Rudolph", "Rudy", "Rueben", "Rufus", "Rupert", "Russ", "Russel", "Russell", "Rusty", "Ryan", "Sal", "Salvador", "Salvatore", "Sam", "Sammie", "Sammy", "Samual", "Samuel", "Sandy", "Sanford", "Sang", "Santiago", "Santo", "Santos", "Saul", "Scot", "Scott", "Scottie", "Scotty", "Sean", "Sebastian", "Sergio", "Seth", "Seymour", "Shad", "Shane", "Shannon", "Shaun", "Shawn", "Shayne", "Shelby", "Sheldon", "Shelton", "Sherman", "Sherwood", "Shirley", "Shon", "Sid", "Sidney", "Silas", "Simon", "Sol", "Solomon", "Son", "Sonny", "Spencer", "Stacey", "Stacy", "Stan", "Stanford", "Stanley", "Stanton", "Stefan", "Stephan", "Stephen", "Sterling", "Steve", "Steven", "Stevie", "Stewart", "Stuart", "Sung", "Sydney", "Sylvester", "Tad", "Tanner", "Taylor", "Ted", "Teddy", "Teodoro", "Terence", "Terrance", "Terrell", "Terrence", "Terry", "Thad", "Thaddeus", "Thanh", "Theo", "Theodore", "Theron", "Thomas", "Thurman", "Tim", "Timmy", "Timothy", "Titus", "Tobias", "Toby", "Tod", "Todd", "Tom", "Tomas", "Tommie", "Tommy", "Toney", "Tony", "Tory", "Tracey", "Tracy", "Travis", "Trent", "Trenton", "Trevor", "Trey", "Trinidad", "Tristan", "Troy", "Truman", "Tuan", "Ty", "Tyler", "Tyree", "Tyrell", "Tyron", "Tyrone", "Tyson", "Ulysses", "Val", "Valentin", "Valentine", "Van", "Vance", "Vaughn", "Vern", "Vernon", "Vicente", "Victor", "Vince", "Vincent", "Vincenzo", "Virgil", "Virgilio", "Vito", "Von", "Wade", "Waldo", "Walker", "Wallace", "Wally", "Walter", "Walton", "Ward", "Warner", "Warren", "Waylon", "Wayne", "Weldon", "Wendell", "Werner", "Wes", "Wesley", "Weston", "Whitney", "Wilber", "Wilbert", "Wilbur", "Wilburn", "Wiley", "Wilford", "Wilfred", "Wilfredo", "Will", "Willard", "William", "Williams", "Willian", "Willie", "Willis", "Willy", "Wilmer", "Wilson", "Wilton", "Winford", "Winfred", "Winston", "Wm", "Woodrow", "Wyatt", "Xavier", "Yong", "Young", "Zachariah", "Zachary", "Zachery", "Zack", "Zackary", "Zane" }; private static string[] LastNames = new string[] { "Abbott", "Acosta", "Adams", "Adkins", "Aguilar", "Albert", "Alexander", "Alford", "Allen", "Alston", "Alvarado", "Alvarez", "Anderson", "Andrews", "Anthony", "Armstrong", "Arnold", "Ashley", "Atkins", "Atkinson", "Austin", "Avery", "Ayala", "Ayers", "Bailey", "Baird", "Baker", "Baldwin", "Ball", "Ballard", "Banks", "Barber", "Barker", "Barlow", "Barnes", "Barnett", "Barr", "Barrera", "Barrett", "Barron", "Barry", "Bartlett", "Barton", "Bass", "Bates", "Battle", "Bauer", "Baxter", "Beach", "Bean", "Beard", "Beasley", "Beck", "Becker", "Bell", "Bender", "Benjamin", "Bennett", "Benson", "Bentley", "Benton", "Berg", "Berger", "Bernard", "Berry", "Best", "Bird", "Bishop", "Black", "Blackburn", "Blackwell", "Blair", "Blake", "Blanchard", "Blankenship", "Blevins", "Bolton", "Bond", "Bonner", "Booker", "Boone", "Booth", "Bowen", "Bowers", "Bowman", "Boyd", "Boyer", "Boyle", "Bradford", "Bradley", "Bradshaw", "Brady", "Branch", "Bray", "Brennan", "Brewer", "Bridges", "Briggs", "Bright", "Britt", "Brock", "Brooks", "Brown", "Browning", "Bruce", "Bryan", "Bryant", "Buchanan", "Buck", "Buckley", "Buckner", "Bullock", "Burch", "Burgess", "Burke", "Burks", "Burnett", "Burns", "Burris", "Burt", "Burton", "Bush", "Butler", "Byers", "Byrd", "Cabrera", "Cain", "Calderon", "Caldwell", "Calhoun", "Callahan", "Camacho", "Cameron", "Campbell", "Campos", "Cannon", "Cantrell", "Cantu", "Cardenas", "Carey", "Carlson", "Carney", "Carpenter", "Carr", "Carrillo", "Carroll", "Carson", "Carter", "Carver", "Case", "Casey", "Cash", "Castaneda", "Castillo", "Castro", "Cervantes", "Chambers", "Chan", "Chandler", "Chaney", "Chang", "Chapman", "Charles", "Chase", "Chavez", "Chen", "Cherry", "Christensen", "Christian", "Church", "Clark", "Clarke", "Clay", "Clayton", "Clements", "Clemons", "Cleveland", "Cline", "Cobb", "Cochran", "Coffey", "Cohen", "Cole", "Coleman", "Collier", "Collins", "Colon", "Combs", "Compton", "Conley", "Conner", "Conrad", "Contreras", "Conway", "Cook", "Cooke", "Cooley", "Cooper", "Copeland", "Cortez", "Cote", "Cotton", "Cox", "Craft", "Craig", "Crane", "Crawford", "Crosby", "Cross", "Cruz", "Cummings", "Cunningham", "Curry", "Curtis", "Dale", "Dalton", "Daniel", "Daniels", "Daugherty", "Davenport", "David", "Davidson", "Davis", "Dawson", "Day", "Dean", "Decker", "Dejesus", "Delacruz", "Delaney", "Deleon", "Delgado", "Dennis", "Diaz", "Dickerson", "Dickson", "Dillard", "Dillon", "Dixon", "Dodson", "Dominguez", "Donaldson", "Donovan", "Dorsey", "Dotson", "Douglas", "Downs", "Doyle", "Drake", "Dudley", "Duffy", "Duke", "Duncan", "Dunlap", "Dunn", "Duran", "Durham", "Dyer", "Eaton", "Edwards", "Elliott", "Ellis", "Ellison", "Emerson", "England", "English", "Erickson", "Espinoza", "Estes", "Estrada", "Evans", "Everett", "Ewing", "Farley", "Farmer", "Farrell", "Faulkner", "Ferguson", "Fernandez", "Ferrell", "Fields", "Figueroa", "Finch", "Finley", "Fischer", "Fisher", "Fitzgerald", "Fitzpatrick", "Fleming", "Fletcher", "Flores", "Flowers", "Floyd", "Flynn", "Foley", "Forbes", "Ford", "Foreman", "Foster", "Fowler", "Fox", "Francis", "Franco", "Frank", "Franklin", "Franks", "Frazier", "Frederick", "Freeman", "French", "Frost", "Fry", "Frye", "Fuentes", "Fuller", "Fulton", "Gaines", "Gallagher", "Gallegos", "Galloway", "Gamble", "Garcia", "Gardner", "Garner", "Garrett", "Garrison", "Garza", "Gates", "Gay", "Gentry", "George", "Gibbs", "Gibson", "Gilbert", "Giles", "Gill", "Gillespie", "Gilliam", "Gilmore", "Glass", "Glenn", "Glover", "Goff", "Golden", "Gomez", "Gonzales", "Gonzalez", "Good", "Goodman", "Goodwin", "Gordon", "Gould", "Graham", "Grant", "Graves", "Gray", "Green", "Greene", "Greer", "Gregory", "Griffin", "Griffith", "Grimes", "Gross", "Guerra", "Guerrero", "Guthrie", "Gutierrez", "Guy", "Guzman", "Hahn", "Hale", "Haley", "Hall", "Hamilton", "Hammond", "Hampton", "Hancock", "Haney", "Hansen", "Hanson", "Hardin", "Harding", "Hardy", "Harmon", "Harper", "Harrell", "Harrington", "Harris", "Harrison", "Hart", "Hartman", "Harvey", "Hatfield", "Hawkins", "Hayden", "Hayes", "Haynes", "Hays", "Head", "Heath", "Hebert", "Henderson", "Hendricks", "Hendrix", "Henry", "Hensley", "Henson", "Herman", "Hernandez", "Herrera", "Herring", "Hess", "Hester", "Hewitt", "Hickman", "Hicks", "Higgins", "Hill", "Hines", "Hinton", "Hobbs", "Hodge", "Hodges", "Hoffman", "Hogan", "Holcomb", "Holden", "Holder", "Holland", "Holloway", "Holman", "Holmes", "Holt", "Hood", "Hooper", "Hoover", "Hopkins", "Hopper", "Horn", "Horne", "Horton", "House", "Houston", "Howard", "Howe", "Howell", "Hubbard", "Huber", "Hudson", "Huff", "Huffman", "Hughes", "Hull", "Humphrey", "Hunt", "Hunter", "Hurley", "Hurst", "Hutchinson", "Hyde", "Ingram", "Irwin", "Jackson", "Jacobs", "Jacobson", "James", "Jarvis", "Jefferson", "Jenkins", "Jennings", "Jensen", "Jimenez", "Johns", "Johnson", "Johnston", "Jones", "Jordan", "Joseph", "Joyce", "Joyner", "Juarez", "Justice", "Kane", "Kaufman", "Keith", "Keller", "Kelley", "Kelly", "Kemp", "Kennedy", "Kent", "Kerr", "Key", "Kidd", "Kim", "King", "Kinney", "Kirby", "Kirk", "Kirkland", "Klein", "Kline", "Knapp", "Knight", "Knowles", "Knox", "Koch", "Kramer", "Lamb", "Lambert", "Lancaster", "Landry", "Lane", "Lang", "Langley", "Lara", "Larsen", "Larson", "Lawrence", "Lawson", "Le", "Leach", "Leblanc", "Lee", "Leon", "Leonard", "Lester", "Levine", "Levy", "Lewis", "Lindsay", "Lindsey", "Little", "Livingston", "Lloyd", "Logan", "Long", "Lopez", "Lott", "Love", "Lowe", "Lowery", "Lucas", "Luna", "Lynch", "Lynn", "Lyons", "Macdonald", "Macias", "Mack", "Madden", "Maddox", "Maldonado", "Malone", "Mann", "Manning", "Marks", "Marquez", "Marsh", "Marshall", "Martin", "Martinez", "Mason", "Massey", "Mathews", "Mathis", "Matthews", "Maxwell", "May", "Mayer", "Maynard", "Mayo", "Mays", "McBride", "McCall", "McCarthy", "McCarty", "McClain", "McClure", "McConnell", "McCormick", "McCoy", "McCray", "McCullough", "McDaniel", "McDonald", "McDowell", "McFadden", "McFarland", "McGee", "McGowan", "McGuire", "McIntosh", "McIntyre", "McKay", "McKee", "McKenzie", "McKinney", "McKnight", "McLaughlin", "Mclean", "McLeod", "McMahon", "McMillan", "McNeil", "McPherson", "Meadows", "Medina", "Mejia", "Melendez", "Melton", "Mendez", "Mendoza", "Mercado", "Mercer", "Merrill", "Merritt", "Meyer", "Meyers", "Michael", "Middleton", "Miles", "Miller", "Mills", "Miranda", "Mitchell", "Molina", "Monroe", "Montgomery", "Montoya", "Moody", "Moon", "Mooney", "Moore", "Morales", "Moran", "Moreno", "Morgan", "Morin", "Morris", "Morrison", "Morrow", "Morse", "Morton", "Moses", "Mosley", "Moss", "Mueller", "Mullen", "Mullins", "Munoz", "Murphy", "Murray", "Myers", "Nash", "Navarro", "Neal", "Nelson", "Newman", "Newton", "Nguyen", "Nichols", "Nicholson", "Nielsen", "Nieves", "Nixon", "Noble", "Noel", "Nolan", "Norman", "Norris", "Norton", "Nunez", "OBrien", "Ochoa", "OConnor", "Odom", "Odonnell", "Oliver", "Olsen", "Olson", "Oneal", "Oneil", "Oneill", "Orr", "Ortega", "Ortiz", "Osborn", "Osborne", "Owen", "Owens", "Pace", "Pacheco", "Padilla", "Page", "Palmer", "Park", "Parker", "Parks", "Parrish", "Parsons", "Pate", "Patel", "Patrick", "Patterson", "Patton", "Paul", "Payne", "Pearson", "Peck", "Pena", "Pennington", "Perez", "Perkins", "Perry", "Peters", "Petersen", "Peterson", "Petty", "Phelps", "Phillips", "Pickett", "Pierce", "Pittman", "Pitts", "Pollard", "Poole", "Pope", "Porter", "Potter", "Potts", "Powell", "Powers", "Pratt", "Preston", "Price", "Prince", "Pruitt", "Puckett", "Pugh", "Quinn", "Ramirez", "Ramos", "Ramsey", "Randall", "Randolph", "Rasmussen", "Ratliff", "Ray", "Raymond", "Reed", "Reese", "Reeves", "Reid", "Reilly", "Reyes", "Reynolds", "Rhodes", "Rice", "Rich", "Richard", "Richards", "Richardson", "Richmond", "Riddle", "Riggs", "Riley", "Rios", "Rivas", "Rivera", "Rivers", "Roach", "Robbins", "Roberson", "Roberts", "Robertson", "Robinson", "Robles", "Rocha", "Rodgers", "Rodriguez", "Rodriquez", "Rogers", "Rojas", "Rollins", "Roman", "Romero", "Rosa", "Rosales", "Rosario", "Rose", "Ross", "Roth", "Rowe", "Rowland", "Roy", "Ruiz", "Rush", "Russell", "Russo", "Rutledge", "Ryan", "Salas", "Salazar", "Salinas", "Sampson", "Sanchez", "Sanders", "Sandoval", "Sanford", "Santana", "Santiago", "Santos", "Sargent", "Saunders", "Savage", "Sawyer", "Schmidt", "Schneider", "Schroeder", "Schultz", "Schwartz", "Scott", "Sears", "Sellers", "Serrano", "Sexton", "Shaffer", "Shannon", "Sharp", "Sharpe", "Shaw", "Shelton", "Shepard", "Shepherd", "Sheppard", "Sherman", "Shields", "Short", "Silva", "Simmons", "Simon", "Simpson", "Sims", "Singleton", "Skinner", "Slater", "Sloan", "Small", "Smith", "Snider", "Snow", "Snyder", "Solis", "Solomon", "Sosa", "Soto", "Sparks", "Spears", "Spence", "Spencer", "Stafford", "Stanley", "Stanton", "Stark", "Steele", "Stein", "Stephens", "Stephenson", "Stevens", "Stevenson", "Stewart", "Stokes", "Stone", "Stout", "Strickland", "Strong", "Stuart", "Suarez", "Sullivan", "Summers", "Sutton", "Swanson", "Sweeney", "Sweet", "Sykes", "Talley", "Tanner", "Tate", "Taylor", "Terrell", "Terry", "Thomas", "Thompson", "Thornton", "Tillman", "Todd", "Torres", "Townsend", "Tran", "Travis", "Trevino", "Trujillo", "Tucker", "Turner", "Tyler", "Tyson", "Underwood", "Valdez", "Valencia", "Valentine", "Valenzuela", "Vance", "Vang", "Vargas", "Vasquez", "Vaughan", "Vaughn", "Vazquez", "Vega", "Velasquez", "Velazquez", "Velez", "Villarreal", "Vincent", "Vinson", "Wade", "Wagner", "Walker", "Wall", "Wallace", "Waller", "Walls", "Walsh", "Walter", "Walters", "Walton", "Ward", "Ware", "Warner", "Warren", "Washington", "Waters", "Watkins", "Watson", "Watts", "Weaver", "Webb", "Weber", "Webster", "Weeks", "Weiss", "Welch", "Wells", "West", "Wheeler", "Whitaker", "White", "Whitehead", "Whitfield", "Whitley", "Whitney", "Wiggins", "Wilcox", "Wilder", "Wiley", "Wilkerson", "Wilkins", "Wilkinson", "William", "Williams", "Williamson", "Willis", "Wilson", "Winters", "Wise", "Witt", "Wolf", "Wolfe", "Wong", "Wood", "Woodard", "Woods", "Woodward", "Wooten", "Workman", "Wright", "Wyatt", "Wynn", "Yang", "Yates", "York", "Young", "Zamora", "Zimmerman" }; #endregion #region "Methods to help generate simulated contribution data" private static LocationData GetNextContributionLocation() { LocationData[] contributionLocations; switch (ContributionGrowthPhase) { case 1: contributionLocations = ContributionLocations1; break; case 2: contributionLocations = ContributionLocations2; break; case 3: contributionLocations = ContributionLocations3; break; case 4: contributionLocations = ContributionLocations4; break; case 5: contributionLocations = ContributionLocations5; break; case 6: contributionLocations = ContributionLocations6; break; case 7: contributionLocations = ContributionLocations7; break; case 8: contributionLocations = ContributionLocations8; break; case 9: contributionLocations = ContributionLocations9; break; case 10: contributionLocations = ContributionLocations10; break; default: contributionLocations = ContributionLocations10; break; } int index = RandomNumberFactory.Next(0, contributionLocations.Length); return contributionLocations[index]; } private static string GetNextFemaleFirstName() { int index = RandomNumberFactory.Next(0, FemaleFirstNames.Length); return FemaleFirstNames[index]; } private static string GetNextMaleFirstName() { int index = RandomNumberFactory.Next(0, MaleFirstNames.Length); return MaleFirstNames[index]; } private static string GetNextLastName() { int index = RandomNumberFactory.Next(0, LastNames.Length); return LastNames[index]; } private static decimal GetNextContributionAmount(int Zipcode) { if (ContributionGrowthPhase == 6) { return 25; } if (Zipcode.Equals(33621)) { return 50; } decimal[] contributionAmounts = ContributionAmounts; int[] BiggerContributors = { 33609, 33626, 33612, 33760, 33613, 33759, 33765, 33619, 33647 }; if (BiggerContributors.Contains(Zipcode)) { contributionAmounts = BiggerContributionAmounts; } int[] BigShotContributors = { 33629, 33621, 33713, 33709, 33760, 36299, 33606, 33709, 33713, 33710, 33770 }; if (BigShotContributors.Contains(Zipcode)) { contributionAmounts = BigShotContributionAmounts; } int index = RandomNumberFactory.Next(0, contributionAmounts.Length); return contributionAmounts[index]; } private static decimal[] ContributionAmounts = new decimal[] { 25, 25, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75, 75, 100, 100, 125, 150, 150, 150, 150, 150, 200, 200, 200, 500, 1000 }; private static decimal[] BiggerContributionAmounts = new decimal[] { 25, 50, 50, 100, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 250, 250, 250, 250, 250, 250, 250, 250, 250, 500, 500, 1000, 1000, 2500 }; private static decimal[] BigShotContributionAmounts = new decimal[] { 100, 250, 250, 250, 250, 250, 250, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 2500, 2500, 5000, 10000 }; #endregion } }
80.065789
193
0.599746
[ "MIT" ]
CriticalPathTraining/DevInADay
Modules/04_RealtimeDashboards/Demo/DatasetWriter/DatasetWriter/Models/CampaignContributions.cs
66,102
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Tilemaps; public class IceCrystalScript : MonoBehaviour { Tilemap tm; GridLayout gridLayout; public Tilemap frozenTm; public TileBase frozenBL; public TileBase frozenBR; public TileBase frozenTL; public TileBase frozenTR; // Start is called before the first frame update void Start() { tm = GetComponent<Tilemap>(); gridLayout = GetComponentInParent<GridLayout>(); } public void OnIceCrystalEnterAura(bool auraType, Transform groundChecker, Transform headChecker, Transform leftChecker, Transform rightChecker) { if (auraType) //hot { if (tm.GetTile(gridLayout.WorldToCell(groundChecker.position)) == frozenBL) { tm.SetTile(gridLayout.WorldToCell(groundChecker.position), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(headChecker.position)) == frozenBL) { tm.SetTile(gridLayout.WorldToCell(headChecker.position), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(leftChecker.position)) == frozenBL) { tm.SetTile(gridLayout.WorldToCell(leftChecker.position), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(rightChecker.position)) == frozenBL) { tm.SetTile(gridLayout.WorldToCell(rightChecker.position), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(groundChecker.position)) == frozenBR) { tm.SetTile(gridLayout.WorldToCell(groundChecker.position), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(-0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(headChecker.position)) == frozenBR) { tm.SetTile(gridLayout.WorldToCell(headChecker.position), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(-0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(leftChecker.position)) == frozenBR) { tm.SetTile(gridLayout.WorldToCell(leftChecker.position), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(-0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(rightChecker.position)) == frozenBR) { tm.SetTile(gridLayout.WorldToCell(rightChecker.position), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0f, 0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(-0.32f, 0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(groundChecker.position)) == frozenTL) { tm.SetTile(gridLayout.WorldToCell(groundChecker.position), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(headChecker.position)) == frozenTL) { tm.SetTile(gridLayout.WorldToCell(headChecker.position), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(leftChecker.position)) == frozenTL) { tm.SetTile(gridLayout.WorldToCell(leftChecker.position), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(rightChecker.position)) == frozenTL) { tm.SetTile(gridLayout.WorldToCell(rightChecker.position), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(groundChecker.position)) == frozenTR) { tm.SetTile(gridLayout.WorldToCell(groundChecker.position), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(groundChecker.position + new Vector3(-0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(headChecker.position)) == frozenTR) { tm.SetTile(gridLayout.WorldToCell(headChecker.position), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(headChecker.position + new Vector3(-0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(leftChecker.position)) == frozenTR) { tm.SetTile(gridLayout.WorldToCell(leftChecker.position), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(leftChecker.position + new Vector3(-0.32f, -0.32f, 0)), null); } if (tm.GetTile(gridLayout.WorldToCell(rightChecker.position)) == frozenTR) { tm.SetTile(gridLayout.WorldToCell(rightChecker.position), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(0f, -0.32f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(-0.32f, 0f, 0)), null); tm.SetTile(gridLayout.WorldToCell(rightChecker.position + new Vector3(-0.32f, -0.32f, 0)), null); } } //Debug.Log((gridLayout.WorldToCell(groundChecker.position))); } }
61.741722
147
0.628875
[ "MIT" ]
Ferretex/Ice-Peak-Game
Assets/Scripts/IceCrystalScript.cs
9,323
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace VoteTracking { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseMvc(); } } }
33.909091
109
0.670241
[ "MIT" ]
peteraritchie/introduction-to-service-fabric
src/VoteTracking/Startup.cs
1,494
C#
namespace Swan.Extensions; /// <summary> /// Provides various extension methods for value types and structs. /// </summary> public static class ValueTypeExtensions { /// <summary> /// Clamps the specified value between the minimum and the maximum. /// </summary> /// <typeparam name="T">The type of the value being clamped.</typeparam> /// <typeparam name="TMin">The type of the minimum value comparison.</typeparam> /// <typeparam name="TMax">The type of the maximum value comparison.</typeparam> /// <param name="this">The value being clamped.</param> /// <param name="min">The minimum clamp value.</param> /// <param name="max">The maximum clamp value.</param> /// <returns>The value clamped between the minimum and the maximum specified values.</returns> public static T Clamp<T, TMin, TMax>(this T @this, TMin min, TMax max) where T : struct, IComparable, IConvertible where TMin : struct, IConvertible where TMax : struct, IConvertible { if (min is not T minValue) minValue = (T)Convert.ChangeType(min, typeof(T), CultureInfo.InvariantCulture); if (max is not T maxValue) maxValue = (T)Convert.ChangeType(max, typeof(T), CultureInfo.InvariantCulture); if (minValue.CompareTo(maxValue) > 0) throw new ArgumentOutOfRangeException(nameof(min), minValue, "Minimum value has to be less than or equal to maximum value."); if (@this.CompareTo(minValue) < 0) return minValue; return @this.CompareTo(maxValue) > 0 ? maxValue : @this; } /// <summary> /// Determines whether the specified value is between a minimum and a maximum value. /// </summary> /// <typeparam name="T">The type of the value being compared.</typeparam> /// <typeparam name="TMin">The type of the minimum value comparison.</typeparam> /// <typeparam name="TMax">The type of the maximum value comparison.</typeparam> /// <param name="this">The value.</param> /// <param name="min">The minimum.</param> /// <param name="max">The maximum.</param> /// <returns> /// <c>true</c> if the specified minimum is between; otherwise, <c>false</c>. /// </returns> public static bool IsBetween<T, TMin, TMax>(this T @this, TMin min, TMax max) where T : struct, IComparable, IConvertible where TMin : struct, IConvertible where TMax : struct, IConvertible { if (min is not T minValue) minValue = (T)Convert.ChangeType(min, typeof(T), CultureInfo.InvariantCulture); if (max is not T maxValue) maxValue = (T)Convert.ChangeType(max, typeof(T), CultureInfo.InvariantCulture); if (minValue.CompareTo(maxValue) > 0) throw new ArgumentOutOfRangeException(nameof(min), minValue, "Minimum value has to be less than or equal to maximum value."); return @this.CompareTo(minValue) >= 0 && @this.CompareTo(maxValue) <= 0; } /// <summary> /// Returns a value that is not less than the provided limit. /// </summary> /// <typeparam name="T">The type of the value being clamped.</typeparam> /// <typeparam name="TLimit">The type of the limit value.</typeparam> /// <param name="this">The value being tested.</param> /// <param name="limit">The limit value.</param> /// <returns>A value not less than the provided limit.</returns> public static T ClampMin<T, TLimit>(this T @this, TLimit limit) where T : struct, IComparable, IConvertible where TLimit : struct, IConvertible { if (limit is not T limitValue) limitValue = (T)Convert.ChangeType(limit, typeof(T), CultureInfo.InvariantCulture); return @this.CompareTo(limitValue) < 0 ? limitValue : @this; } /// <summary> /// Returns a value that is not greater than the provided limit. /// </summary> /// <typeparam name="T">The type of the value being clamped.</typeparam> /// <typeparam name="TLimit">The type of the limit value.</typeparam> /// <param name="this">The value being tested.</param> /// <param name="limit">The limit value.</param> /// <returns>A value not greater than the provided limit.</returns> public static T ClampMax<T, TLimit>(this T @this, TLimit limit) where T : struct, IComparable, IConvertible where TLimit : struct, IConvertible { if (limit is not T limitValue) limitValue = (T)Convert.ChangeType(limit, typeof(T), CultureInfo.InvariantCulture); return @this.CompareTo(limitValue) > 0 ? limitValue : @this; } }
43.82243
98
0.640435
[ "MIT" ]
unosquare/swan
src/Swan.Core/Extensions/ValueTypeExtensions.cs
4,691
C#
using System; using System.Collections.Generic; using Ecobit_Blockchain_Frontend.Factories; using Ecobit_Blockchain_Frontend.Models; using NUnit.Framework; namespace Ecobit_Blockchain_Frontend_Test.Factories { [TestFixture] public class SupplyChainFactoryTest { [Test] public void ShouldOrderTheTransactionsByDate() { var transactions = new List<Transaction> { new Transaction {OrderTime = new DateTime(2002, 1, 1), FromOwner = "test2", ToOwner = "test3"}, new Transaction {OrderTime = new DateTime(2001, 1, 1), FromOwner = "test2", ToOwner = "test3"}, new Transaction {OrderTime = new DateTime(2000, 1, 1), FromOwner = "test1", ToOwner = "test2"} }; var chain = SupplyChainFactory.Make(transactions); Assert.AreEqual(2001, chain.Children[0].Transaction.OrderTime.Year); } [Test] public void ShouldHaveTheCorrectChildren() { var transactions = new List<Transaction> { new Transaction {OrderTime = new DateTime(2000, 1, 1), FromOwner = "test1", ToOwner = "test2"}, new Transaction {OrderTime = new DateTime(2001, 1, 1), FromOwner = "test2", ToOwner = "test3"}, new Transaction {OrderTime = new DateTime(2002, 1, 1), FromOwner = "test3", ToOwner = "test4"} }; var chain = SupplyChainFactory.Make(transactions); Assert.AreEqual("test1", chain.Transaction.FromOwner); Assert.AreEqual("test2", chain.Children[0].Transaction.FromOwner); Assert.AreEqual("test3", chain.Children[0].Children[0].Transaction.FromOwner); } } }
38.06383
111
0.602571
[ "Apache-2.0" ]
bramerto/ecobit-blockchain
ecobit-blockchain-front-end/Ecobit-Blockchain-Frontend-Test/Factories/SupplyChainFactoryTest.cs
1,791
C#
namespace AllOverIt.Aws.Cdk.AppSync { /// <summary>Provides available authorization directive modes.</summary> public enum AuthDirectiveMode { /// <summary>OIDC authorization mode.</summary> Oidc, /// <summary>API KEY authorization mode.</summary> ApiKey, /// <summary>Cognito authorization mode.</summary> Cognito, /// <summary>IAM authorization mode.</summary> Iam } }
25.222222
76
0.61674
[ "MIT" ]
mjfreelancing/AllOverIt
Source/AllOverIt.Aws.Cdk.AppSync/AuthDirectiveMode.cs
456
C#
using BeetleX.Clients; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BeetleX { public class SocketFactory { public static IServer CreateTcpServer(IServerHandler handler, IPacket packet, ServerOptions options = null) { TcpServer server = new TcpServer(options); server.Handler = handler; server.Packet = packet; return server; } public static IServer CreateTcpServer<HANDLER, IPACKET>(ServerOptions options = null) where HANDLER : IServerHandler, new() where IPACKET : IPacket, new() { return CreateTcpServer(new HANDLER(), new IPACKET(), options); } public static IServer CreateTcpServer<HANDLER>(ServerOptions options = null) where HANDLER : IServerHandler, new() { return CreateTcpServer(new HANDLER(), null, options); } public static CLIENT CreateClient<CLIENT>(string host, int port) where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, null); return client; } public static CLIENT CreateClient<CLIENT, PACKET>(string host, int port) where PACKET : Clients.IClientPacket, new() where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, new PACKET()); return client; } public static CLIENT CreateClient<CLIENT>(IClientPacket packet, string host, int port) where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, packet); return client; } public static CLIENT CreateSslClient<CLIENT>(string host, int port, string serviceName) where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, null); client.SSL = true; client.SslServiceName = serviceName; return client; } public static CLIENT CreateSslClient<CLIENT, PACKET>(string host, int port, string serviceName) where PACKET : Clients.IClientPacket, new() where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, new PACKET()); client.SSL = true; client.SslServiceName = serviceName; return client; } public static CLIENT CreateSslClient<CLIENT>(IClientPacket packet, string host, int port, string serviceName) where CLIENT : IClient, new() { CLIENT client = new CLIENT(); client.Init(host, port, packet); client.SSL = true; client.SslServiceName = serviceName; return client; } [ThreadStatic] private static bool mChangeExecuteContext = false; internal static void ChangeExecuteContext(bool executionContextEnabled) { if (!mChangeExecuteContext && !executionContextEnabled) { if (!System.Threading.ExecutionContext.IsFlowSuppressed()) System.Threading.ExecutionContext.SuppressFlow(); mChangeExecuteContext = true; } } } }
31.218182
147
0.587653
[ "Apache-2.0" ]
5118234/BeetleX
src/BeetleX/ServerFactory.cs
3,436
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SharperArchitecture.CodeList; using SharperArchitecture.CodeList.Attributes; using SharperArchitecture.Tests.CodeList.Attributes; namespace SharperArchitecture.Tests.CodeList.Entities { [CodeListConfiguration] public partial class CustomLanguageFilter : LocalizableCodeListWithUser<string, CustomLanguageFilter, CustomLanguageFilterLanguage> { [CurrentLanguage] public virtual string Name { get; set; } [CurrentLanguage] public virtual string Custom { get; set; } [CurrentLanguage("Custom2")] public virtual string CurrentCustom2 { get; set; } } public partial class CustomLanguageFilterLanguage : LocalizableCodeListLanguage<CustomLanguageFilter, CustomLanguageFilterLanguage> { public virtual string Custom { get; set; } public virtual string Custom2 { get; set; } } }
30.060606
135
0.745968
[ "MIT" ]
maca88/PowerArhitecture
Source/SharperArchitecture.Tests/SharperArchitecture.Tests.CodeList/Entities/CustomLanguageFilter.cs
994
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; namespace Samples.Net { /// <summary> /// VERY basic implementation of a PriorityList, shouldn't really be used by anyone else right now. /// </summary> /// <typeparam name="Priority">Type used as the priority, need to have an implemention of IComparable.</typeparam> /// <typeparam name="Value">The type to be stored in the list.</typeparam> public class PriorityList<Priority, Value> : IEnumerable<Value> where Priority : IComparable<Priority> { /// <summary> /// Used to store entries in the PriorityList. /// </summary> private class PriorityListEntry : IComparable<PriorityListEntry>, IComparable { public Value Data; public Priority Priority; public PriorityListEntry(Priority priority, Value data) { this.Priority = priority; this.Data = data; } public int CompareTo(PriorityListEntry other) { return this.Priority.CompareTo(other.Priority); } public int CompareTo(object obj) { if (obj is Priority other) { return Priority.CompareTo(other); } throw new ArgumentException($"Object is not of type {typeof(Priority)}"); } } private readonly List<PriorityListEntry> data; public PriorityList() { data = new List<PriorityListEntry>(); } /// <summary> /// Add item to list at a given priority. /// </summary> /// <param name="priority"></param> /// <param name="value"></param> public void Add(Priority priority, Value value) { data.Add(new PriorityListEntry(priority, value)); this.Sort(); } /// <summary> /// Get an item from the PriorityList at the given index. /// </summary> /// <param name="index">Index of item to be returned.</param> /// <returns>Item at the given index.</returns> public Value Get(int index) { return data[index].Data; } /// <summary> /// Sort underlying data. /// </summary> private void Sort() { data.Sort(); } public IEnumerator<Value> GetEnumerator() { return data.Select(x => x.Data).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } } }
29.44086
118
0.542732
[ "MIT" ]
TristanPearce/Samples.Net
Samples.Net/Utils/PriorityList.cs
2,740
C#
using Abp.Domain.Entities; using Abp.Domain.Repositories; using Abp.EntityFrameworkCore; using Abp.EntityFrameworkCore.Repositories; namespace SalesManagement.EntityFrameworkCore.Repositories { /// <summary> /// Base class for custom repositories of the application. /// </summary> /// <typeparam name="TEntity">Entity type</typeparam> /// <typeparam name="TPrimaryKey">Primary key type of the entity</typeparam> public abstract class SalesManagementRepositoryBase<TEntity, TPrimaryKey> : EfCoreRepositoryBase<SalesManagementDbContext, TEntity, TPrimaryKey> where TEntity : class, IEntity<TPrimaryKey> { protected SalesManagementRepositoryBase(IDbContextProvider<SalesManagementDbContext> dbContextProvider) : base(dbContextProvider) { } // Add your common methods for all repositories } /// <summary> /// Base class for custom repositories of the application. /// This is a shortcut of <see cref="SalesManagementRepositoryBase{TEntity,TPrimaryKey}"/> for <see cref="int"/> primary key. /// </summary> /// <typeparam name="TEntity">Entity type</typeparam> public abstract class SalesManagementRepositoryBase<TEntity> : SalesManagementRepositoryBase<TEntity, int>, IRepository<TEntity> where TEntity : class, IEntity<int> { protected SalesManagementRepositoryBase(IDbContextProvider<SalesManagementDbContext> dbContextProvider) : base(dbContextProvider) { } // Do not add any method here, add to the class above (since this inherits it)!!! } }
40.4
148
0.71349
[ "MIT" ]
NguyenVanTung11041998/SalesManaementApi
aspnet-core/src/SalesManagement.EntityFrameworkCore/EntityFrameworkCore/Repositories/SalesManagementRepositoryBase.cs
1,618
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Localization; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Localization; using OrchardCore.DisplayManagement; using OrchardCore.DisplayManagement.ModelBinding; using OrchardCore.DisplayManagement.Notify; using OrchardCore.Navigation; using OrchardCore.Queries.ViewModels; using OrchardCore.Routing; using OrchardCore.Settings; namespace OrchardCore.Queries.Controllers { public class AdminController : Controller { private readonly IAuthorizationService _authorizationService; private readonly ISiteService _siteService; private readonly INotifier _notifier; private readonly IQueryManager _queryManager; private readonly IEnumerable<IQuerySource> _querySources; private readonly IDisplayManager<Query> _displayManager; private readonly IUpdateModelAccessor _updateModelAccessor; private readonly IStringLocalizer S; private readonly IHtmlLocalizer H; private readonly dynamic New; public AdminController( IDisplayManager<Query> displayManager, IAuthorizationService authorizationService, ISiteService siteService, IShapeFactory shapeFactory, IStringLocalizer<AdminController> stringLocalizer, IHtmlLocalizer<AdminController> htmlLocalizer, INotifier notifier, IQueryManager queryManager, IEnumerable<IQuerySource> querySources, IUpdateModelAccessor updateModelAccessor) { _displayManager = displayManager; _authorizationService = authorizationService; _siteService = siteService; _queryManager = queryManager; _querySources = querySources; _updateModelAccessor = updateModelAccessor; New = shapeFactory; _notifier = notifier; S = stringLocalizer; H = htmlLocalizer; } public async Task<IActionResult> Index(ContentOptions options, PagerParameters pagerParameters) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var siteSettings = await _siteService.GetSiteSettingsAsync(); var pager = new Pager(pagerParameters, siteSettings.PageSize); var queries = await _queryManager.ListQueriesAsync(); queries = queries.OrderBy(x => x.Name); if (!string.IsNullOrWhiteSpace(options.Search)) { queries = queries.Where(q => q.Name.IndexOf(options.Search, StringComparison.OrdinalIgnoreCase) >= 0); } var results = queries .Skip(pager.GetStartIndex()) .Take(pager.PageSize) .ToList(); // Maintain previous route data when generating page links var routeData = new RouteData(); routeData.Values.Add("Options.Search", options.Search); var pagerShape = (await New.Pager(pager)).TotalItemCount(queries.Count()).RouteData(routeData); var model = new QueriesIndexViewModel { Queries = new List<QueryEntry>(), Options = options, Pager = pagerShape, QuerySourceNames = _querySources.Select(x => x.Name).ToList() }; foreach (var query in results) { model.Queries.Add(new QueryEntry { Query = query, Shape = await _displayManager.BuildDisplayAsync(query, _updateModelAccessor.ModelUpdater, "SummaryAdmin") }); } model.Options.ContentsBulkAction = new List<SelectListItem>() { new SelectListItem() { Text = S["Delete"], Value = nameof(ContentsBulkAction.Remove) } }; return View(model); } [HttpPost, ActionName("Index")] [FormValueRequired("submit.Filter")] public ActionResult IndexFilterPOST(QueriesIndexViewModel model) { return RedirectToAction("Index", new RouteValueDictionary { { "Options.Search", model.Options.Search } }); } public async Task<IActionResult> Create(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var query = _querySources.FirstOrDefault(x => x.Name == id)?.Create(); if (query == null) { return NotFound(); } var model = new QueriesCreateViewModel { Editor = await _displayManager.BuildEditorAsync(query, updater: _updateModelAccessor.ModelUpdater, isNew: true), SourceName = id }; return View(model); } [HttpPost, ActionName(nameof(Create))] public async Task<IActionResult> CreatePost(QueriesCreateViewModel model) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var query = _querySources.FirstOrDefault(x => x.Name == model.SourceName)?.Create(); if (query == null) { return NotFound(); } var editor = await _displayManager.UpdateEditorAsync(query, updater: _updateModelAccessor.ModelUpdater, isNew: true); if (ModelState.IsValid) { await _queryManager.SaveQueryAsync(query.Name, query); _notifier.Success(H["Query created successfully"]); return RedirectToAction("Index"); } // If we got this far, something failed, redisplay form model.Editor = editor; return View(model); } public async Task<IActionResult> Edit(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var query = await _queryManager.GetQueryAsync(id); if (query == null) { return NotFound(); } var model = new QueriesEditViewModel { SourceName = query.Source, Name = query.Name, Schema = query.Schema, Editor = await _displayManager.BuildEditorAsync(query, updater: _updateModelAccessor.ModelUpdater, isNew: false) }; return View(model); } [HttpPost, ActionName("Edit")] public async Task<IActionResult> EditPost(QueriesEditViewModel model) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var query = (await _queryManager.LoadQueryAsync(model.Name)); if (query == null) { return NotFound(); } var editor = await _displayManager.UpdateEditorAsync(query, updater: _updateModelAccessor.ModelUpdater, isNew: false); if (ModelState.IsValid) { await _queryManager.SaveQueryAsync(model.Name, query); _notifier.Success(H["Query updated successfully"]); return RedirectToAction("Index"); } model.Editor = editor; // If we got this far, something failed, redisplay form return View(model); } [HttpPost] public async Task<IActionResult> Delete(string id) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } var query = await _queryManager.LoadQueryAsync(id); if (query == null) { return NotFound(); } await _queryManager.DeleteQueryAsync(id); _notifier.Success(H["Query deleted successfully"]); return RedirectToAction("Index"); } [HttpPost, ActionName("Index")] [FormValueRequired("submit.BulkAction")] public async Task<ActionResult> IndexPost(ViewModels.ContentOptions options, IEnumerable<string> itemIds) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) { return Forbid(); } if (itemIds?.Count() > 0) { var queriesList = await _queryManager.ListQueriesAsync(); var checkedContentItems = queriesList.Where(x => itemIds.Contains(x.Name)); switch (options.BulkAction) { case ContentsBulkAction.None: break; case ContentsBulkAction.Remove: foreach (var item in checkedContentItems) { await _queryManager.DeleteQueryAsync(item.Name); } _notifier.Success(H["Queries successfully removed."]); break; default: throw new ArgumentOutOfRangeException(); } } return RedirectToAction("Index"); } } }
34.529825
130
0.577685
[ "BSD-3-Clause" ]
wael101/OrchardCore
src/OrchardCore.Modules/OrchardCore.Queries/Controllers/AdminController.cs
9,841
C#
//------------------------------------------------------------------------------ // <auto-generated> // このコードはツールによって生成されました。 // ランタイム バージョン:4.0.30319.42000 // // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 // コードが再生成されるときに損失したりします。 // </auto-generated> //------------------------------------------------------------------------------ namespace CustomizeLegend.Properties { using System; /// <summary> /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 /// </summary> // このクラスは StronglyTypedResourceBuilder クラスが ResGen // または Visual Studio のようなツールを使用して自動生成されました。 // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CustomizeLegend.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
40.671875
181
0.61237
[ "MIT" ]
MasuqaT-NET/BlogExamples
Windows/SparrowChart/CustomizeLegend/Properties/Resources.Designer.cs
3,247
C#