content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
using System.Collections.Generic;
using System.Diagnostics;
namespace CocosSharp
{
public class CCAnimation
{
#region Properties
public bool RestoreOriginalFrame { get; set; }
public float DelayPerUnit { get; set; }
public float TotalDelayUnits { get; private set; }
public List<CCAnimationFrame> Frames { get; private set; }
public uint Loops { get; set; }
public float Duration
{
get { return TotalDelayUnits * DelayPerUnit; }
}
#endregion Properties
#region Constructors
public CCAnimation() : this(new List<CCSpriteFrame>(), 0)
{
}
public CCAnimation(CCSpriteSheet cs, string[] frames, float delay)
{
List<CCSpriteFrame> l = new List<CCSpriteFrame>();
foreach(string f in frames)
{
CCSpriteFrame cf = cs[f];
if (cf != null)
l.Add(cs[f]);
}
InitWithSpriteFrames(l, delay);
}
public CCAnimation(CCSpriteSheet cs, float delay) : this(cs.Frames, delay)
{
}
// Perform deep copy of CCAnimation
protected CCAnimation(CCAnimation animation) : this(animation.Frames, animation.DelayPerUnit, animation.Loops)
{
RestoreOriginalFrame = animation.RestoreOriginalFrame;
}
public CCAnimation (List<CCSpriteFrame> frames, float delay)
{
InitWithSpriteFrames(frames, delay);
}
public CCAnimation (List<CCAnimationFrame> arrayOfAnimationFrameNames, float delayPerUnit, uint loops)
{
DelayPerUnit = delayPerUnit;
Loops = loops;
Frames = new List<CCAnimationFrame>(arrayOfAnimationFrameNames);
float totalDelatUnits = 0.0f;
foreach (CCAnimationFrame frame in Frames) { totalDelatUnits += frame.DelayUnits; }
TotalDelayUnits = totalDelatUnits;
}
void InitWithSpriteFrames(List<CCSpriteFrame> frames, float delay)
{
Loops = 1;
DelayPerUnit = delay;
if (frames == null)
return;
Frames = new List<CCAnimationFrame> (frames.Count);
foreach (var frame in frames)
Frames.Add (new CCAnimationFrame (frame, 1, null));
TotalDelayUnits = Frames.Count;
}
public CCAnimation Copy()
{
return new CCAnimation(this);
}
#endregion Constructors
public void AddSpriteFrame(CCSprite sprite)
{
CCRect textureRect = sprite.TextureRectInPixels;
CCSpriteFrame f = new CCSpriteFrame(sprite.ContentSize, sprite.Texture, textureRect);
AddSpriteFrame(f);
}
public void AddSpriteFrame(CCSpriteFrame frame)
{
var animFrame = new CCAnimationFrame(frame, 1.0f, null);
Frames.Add(animFrame);
// update duration
TotalDelayUnits++;
}
public void AddSpriteFrame(string filename, CCSize? contentSize=null)
{
var texture = CCTextureCache.SharedTextureCache.AddImage(filename);
CCRect rect = CCRect.Zero;
rect.Size = texture.ContentSizeInPixels;
if(contentSize == null)
contentSize = rect.Size;
AddSpriteFrame(new CCSpriteFrame ((CCSize)contentSize, texture, rect));
}
public void AddSpriteFrame(CCTexture2D texture, CCRect textureRect, CCSize? contentSize=null)
{
if(contentSize == null)
contentSize = textureRect.Size;
AddSpriteFrame(new CCSpriteFrame((CCSize)contentSize, texture, textureRect));
}
}
} | 29.627907 | 118 | 0.584772 | [
"MIT"
] | YersonSolano/CocosSharp | src/Nodes/Sprites/CCAnimation.cs | 3,822 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Azure.Core.TestFramework;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.AppConfiguration;
using Azure.ResourceManager.AppConfiguration.Models;
using NUnit.Framework;
namespace Azure.ResourceManager.AppConfiguration.Tests
{
public class PrivateEndpointConnectionCollectionTests : AppConfigurationClientBase
{
private ResourceGroupResource ResGroup { get; set; }
private ConfigurationStoreResource ConfigStore { get; set; }
private Network.PrivateEndpointResource PrivateEndpointResource { get; set; }
public PrivateEndpointConnectionCollectionTests(bool isAsync)
: base(isAsync)
{
}
[SetUp]
public async Task TestSetUp()
{
if (Mode == RecordedTestMode.Record || Mode == RecordedTestMode.Playback)
{
Initialize();
string groupName = Recording.GenerateAssetName(ResourceGroupPrefix);
string VnetName = Recording.GenerateAssetName("vnetname");
string SubnetName = Recording.GenerateAssetName("subnetname");
string EndpointName = Recording.GenerateAssetName("endpointxyz");
ResGroup = (await ArmClient.GetDefaultSubscriptionAsync().Result.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, groupName, new ResourceGroupData(Location))).Value;
string configurationStoreName = Recording.GenerateAssetName("testapp-");
ConfigurationStoreData configurationStoreData = new ConfigurationStoreData(Location, new AppConfigurationSku("Standard"))
{
PublicNetworkAccess = PublicNetworkAccess.Disabled
};
ConfigStore = (await ResGroup.GetConfigurationStores().CreateOrUpdateAsync(WaitUntil.Completed, configurationStoreName, configurationStoreData)).Value;
// Prepare VNet and Private Endpoint
VirtualNetworkData vnetData = new VirtualNetworkData()
{
Location = "eastus",
Subnets = { new SubnetData() { Name = SubnetName, AddressPrefix = "10.0.0.0/24", PrivateEndpointNetworkPolicies = "Disabled" } }
};
vnetData.AddressPrefixes.Add("10.0.0.0/16");
vnetData.DhcpOptionsDnsServers.Add("10.1.1.1");
vnetData.DhcpOptionsDnsServers.Add("10.1.2.4");
VirtualNetworkResource vnet = (await ResGroup.GetVirtualNetworks().CreateOrUpdateAsync(WaitUntil.Completed, VnetName, vnetData)).Value;
PrivateEndpointData privateEndpointData = new PrivateEndpointData()
{
Location = "eastus",
PrivateLinkServiceConnections = { new PrivateLinkServiceConnection()
{
Name ="myconnection",
PrivateLinkServiceId = ConfigStore.Data.Id,
GroupIds = {"configurationStores"},
RequestMessage = "Please approve my connection",
}
},
Subnet = new SubnetData() { Id = "/subscriptions/" + TestEnvironment.SubscriptionId + "/resourceGroups/" + groupName + "/providers/Microsoft.Network/virtualNetworks/" + VnetName + "/subnets/" + SubnetName }
};
PrivateEndpointResource = (await ResGroup.GetPrivateEndpoints().CreateOrUpdateAsync(WaitUntil.Completed, EndpointName, privateEndpointData)).Value;
}
}
[Test]
public async Task CreateOrUpdateTest()
{
// Only support update
List<AppConfigurationPrivateEndpointConnectionResource> connections = await ConfigStore.GetAppConfigurationPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync();
string privateEndpointConnectionName = connections.FirstOrDefault().Data.Name;
AppConfigurationPrivateEndpointConnectionData privateEndpointConnectionData = connections.FirstOrDefault().Data;
privateEndpointConnectionData.ConnectionState.Description = "Update descriptions";
AppConfigurationPrivateEndpointConnectionResource privateEndpointConnection = (await ConfigStore.GetAppConfigurationPrivateEndpointConnections().CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, privateEndpointConnectionData)).Value;
Assert.IsTrue(privateEndpointConnectionName.Equals(privateEndpointConnection.Data.Name));
Assert.IsTrue(PrivateEndpointResource.Data.Id.Equals(privateEndpointConnection.Data.PrivateEndpoint.Id));
Assert.IsTrue(privateEndpointConnection.Data.ConnectionState.Description.Equals("Update descriptions"));
}
[Test]
public async Task GetTest()
{
List<AppConfigurationPrivateEndpointConnectionResource> connections = await ConfigStore.GetAppConfigurationPrivateEndpointConnections().GetAllAsync().ToEnumerableAsync();
string privateEndpointConnectionName = connections.First().Data.Name;
AppConfigurationPrivateEndpointConnectionResource privateEndpointConnection = await ConfigStore.GetAppConfigurationPrivateEndpointConnections().GetAsync(privateEndpointConnectionName);
Assert.IsTrue(privateEndpointConnectionName.Equals(privateEndpointConnection.Data.Name));
Assert.IsTrue(privateEndpointConnection.Data.ConnectionState.Status == Models.ConnectionStatus.Approved);
}
[Test]
public async Task GetAllTest()
{
string configurationStoreName1 = Recording.GenerateAssetName("testapp-");
string configurationStoreName2 = Recording.GenerateAssetName("testapp-");
ConfigurationStoreData configurationStoreData = new ConfigurationStoreData(Location, new AppConfigurationSku("Standard"))
{
PublicNetworkAccess = PublicNetworkAccess.Disabled
};
await ResGroup.GetConfigurationStores().CreateOrUpdateAsync(WaitUntil.Completed, configurationStoreName1, configurationStoreData);
await ResGroup.GetConfigurationStores().CreateOrUpdateAsync(WaitUntil.Completed, configurationStoreName2, configurationStoreData);
List<ConfigurationStoreResource> configurationStores = await ResGroup.GetConfigurationStores().GetAllAsync().ToEnumerableAsync();
Assert.IsTrue(configurationStores.Count >= 2);
Assert.IsTrue(configurationStores.Where(x => x.Data.Name == configurationStoreName1).FirstOrDefault().Data.PublicNetworkAccess == PublicNetworkAccess.Disabled);
}
}
}
| 59.110169 | 267 | 0.692473 | [
"MIT"
] | jasonsandlin/azure-sdk-for-net | sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/tests/Tests/PrivateEndpointConnectionCollectionTests.cs | 6,977 | C# |
namespace _01.StreamProgress
{
public class Program
{
public static void Main()
{
}
}
}
| 11.454545 | 33 | 0.507937 | [
"MIT"
] | mdamyanova/C-Sharp-Web-Development | 08.C# Fundamentals/08.03.C# OOP Advanced/13.SOLID/01.StreamProgress/Program.cs | 128 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FloatingTextHandler : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Destroy(gameObject, 1f);
transform.localPosition += new Vector3(0, 0.5f, 0);
}
// Update is called once per frame
void Update()
{
}
}
| 19.35 | 59 | 0.643411 | [
"MIT"
] | moccbc/Deserted | Assets/Scripts/FloatingTextHandler.cs | 387 | C# |
namespace BWAF.Data.Models
{
public class Entity : IEntity
{
public long Id { get; set; }
public string Name { get; set; }
}
}
| 15.6 | 40 | 0.557692 | [
"MIT"
] | alexOprean/BWAF | BWAF.Data/Models/Entity.cs | 156 | C# |
namespace Santase.Logic.Tests.Players
{
using System.Collections.Generic;
using NUnit.Framework;
using Santase.Logic.Cards;
using Santase.Logic.Players;
using Santase.Logic.RoundStates;
[TestFixture]
public class BasePlayerTests
{
[Test]
public void CardsShouldNotBeNull()
{
var basePlayerImplementation = new BasePlayerImpl();
Assert.IsTrue(basePlayerImplementation.ListIsNotNull);
}
[Test]
public void AnnounceValidatorShouldNotBeNull()
{
var basePlayerImplementation = new BasePlayerImpl();
Assert.IsTrue(basePlayerImplementation.AnnounceValidatorIsNotNull);
}
[Test]
public void AddCardShouldWorkCorrectly()
{
var basePlayerImplementation = new BasePlayerImpl();
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.Ace));
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.Ten));
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.King));
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.Queen));
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.Jack));
basePlayerImplementation.AddCard(new Card(CardSuit.Club, CardType.Nine));
Assert.AreEqual(6, basePlayerImplementation.CardsCollection.Count);
}
[Test]
public void EndRoundShouldClearCards()
{
var basePlayerImplementation = new BasePlayerImpl();
basePlayerImplementation.EndRound();
Assert.AreEqual(0, basePlayerImplementation.CardsCollection.Count);
}
[Test]
public void PlayerActionValidatorShouldNotBeNull()
{
var basePlayerImplementation = new BasePlayerImpl();
Assert.IsTrue(basePlayerImplementation.PlayerActionValidatorIsNotNull);
}
[Test]
public void PlayCardShouldReturnPlayerActionWithTypePlayCard()
{
var basePlayerImplementation = new BasePlayerImpl();
var action = basePlayerImplementation.PlayCardProxy(new Card(CardSuit.Heart, CardType.Ace));
Assert.AreEqual(PlayerActionType.PlayCard, action.Type);
}
[Test]
public void PlayCardShouldReturnPlayerActionWithPlayedCard()
{
var card = new Card(CardSuit.Heart, CardType.Ace);
var basePlayerImplementation = new BasePlayerImpl();
var action = basePlayerImplementation.PlayCardProxy(card);
Assert.AreEqual(card, action.Card);
}
[Test]
public void ChangeTrumpShouldReturnPlayerActionWithTypeChangeTrump()
{
var basePlayerImplementation = new BasePlayerImpl();
var action = basePlayerImplementation.ChangeTrumpProxy(new Card(CardSuit.Diamond, CardType.King));
Assert.AreEqual(PlayerActionType.ChangeTrump, action.Type);
}
[Test]
public void ChangeTrumpShouldRemoveNineOfTrumpFromThePlayersCards()
{
var basePlayerImplementation = new BasePlayerImpl();
basePlayerImplementation.AddCard(new Card(CardSuit.Diamond, CardType.Nine));
basePlayerImplementation.ChangeTrumpProxy(new Card(CardSuit.Diamond, CardType.King));
Assert.IsFalse(
basePlayerImplementation.CardsCollection.Contains(new Card(CardSuit.Diamond, CardType.Nine)),
"Trump card for changing found in player cards after changing the trump");
}
[Test]
public void ChangeTrumpShouldAddTrumpCardToPlayerCards()
{
var basePlayerImplementation = new BasePlayerImpl();
basePlayerImplementation.AddCard(new Card(CardSuit.Diamond, CardType.Nine));
basePlayerImplementation.ChangeTrumpProxy(new Card(CardSuit.Diamond, CardType.King));
Assert.IsTrue(
basePlayerImplementation.CardsCollection.Contains(new Card(CardSuit.Diamond, CardType.King)),
"Trump card not found in player cards after changing the trump");
Assert.AreEqual(1, basePlayerImplementation.CardsCollection.Count);
}
[Test]
public void EndTurnShouldNotThrowExceptions()
{
var basePlayerImplementation = new BasePlayerImpl();
var playerTurnContext = new PlayerTurnContext(
new FinalRoundState(null),
new Card(CardSuit.Club, CardType.Ace),
0,
0,
0);
basePlayerImplementation.EndTurn(playerTurnContext);
}
[Test]
public void EndGameShouldNotThrowExceptions()
{
var basePlayerImplementation = new BasePlayerImpl();
basePlayerImplementation.EndGame(true);
}
private class BasePlayerImpl : BasePlayer
{
public bool ListIsNotNull => this.Cards != null;
public bool AnnounceValidatorIsNotNull => this.AnnounceValidator != null;
public bool PlayerActionValidatorIsNotNull => this.PlayerActionValidator != null;
public ICollection<Card> CardsCollection => this.Cards;
public override string Name => string.Empty;
public override PlayerAction GetTurn(PlayerTurnContext context)
{
throw new System.NotImplementedException();
}
public PlayerAction ChangeTrumpProxy(Card trumpCard)
{
return this.ChangeTrump(trumpCard);
}
public PlayerAction PlayCardProxy(Card card)
{
return this.PlayCard(card);
}
}
}
}
| 36.610063 | 110 | 0.640783 | [
"MIT"
] | KonstantinSimeonov/Zatvoreno | SantaseGameEngine/Tests/Santase.Logic.Tests/Players/BasePlayerTests.cs | 5,823 | C# |
// ========================================
// Project Name : WodiLib
// File Name : MapTreeData.cs
//
// MIT License Copyright(c) 2019 kameske
// see LICENSE file
// ========================================
using System;
using System.Collections.Generic;
using WodiLib.Sys;
namespace WodiLib.Map
{
/// <summary>
/// マップツリーデータ
/// </summary>
[Serializable]
public class MapTreeData : IEquatable<MapTreeData>
{
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Public Constant
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/// <summary>
/// ヘッダ
/// </summary>
public static readonly byte[] Header =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90
};
/// <summary>
/// フッタ
/// </summary>
public static readonly byte[] Footer =
{
0xBC
};
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Public Property
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
private MapTreeNodeList treeNodeList = new MapTreeNodeList();
/// <summary>
/// [NotNull] マップツリーノードリスト
/// </summary>
/// <exception cref="PropertyNullException">nullをセットした場合</exception>
public MapTreeNodeList TreeNodeList
{
get => treeNodeList;
set
{
if (value == null)
throw new PropertyNullException(
ErrorMessage.NotNull(nameof(TreeNodeList)));
treeNodeList = value;
}
}
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Public Method
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/// <summary>
/// 値を比較する。
/// </summary>
/// <param name="other">比較対象</param>
/// <returns>一致する場合、true</returns>
public bool Equals(MapTreeData other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return treeNodeList.Equals(other.treeNodeList);
}
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// Common
// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/// <summary>
/// バイナリ変換する。
/// </summary>
/// <returns>バイナリデータ</returns>
public byte[] ToBinary()
{
var result = new List<byte>();
// ヘッダ
result.AddRange(Header);
// ツリーノード
result.AddRange(TreeNodeList.ToBinary());
// フッタ
result.AddRange(Footer);
return result.ToArray();
}
}
} | 29.029126 | 77 | 0.450836 | [
"MIT"
] | sono8stream/WodiLib | WodiLib/WodiLib/Map/Model/MapTreeData.cs | 3,152 | C# |
using UnityEngine;
public class TimeManager : MonoBehaviour
{
public float slowdownFactor = 0.05f;
public void SlowDown()
{
Time.timeScale = slowdownFactor;
Time.fixedDeltaTime = Time.timeScale * 0.02f;
}
public void NormalTime()
{
Time.timeScale = 1f;
Time.fixedDeltaTime = Time.fixedUnscaledDeltaTime;
}
}
| 19.578947 | 58 | 0.642473 | [
"Apache-2.0"
] | FieryBlade-313/Quick-Shooter | Assets/Scripts/TimeManager.cs | 374 | C# |
using System;
namespace Numani.CommandStack.Maybe
{
public static class MaybeMonad
{
public static IMaybe<TResult> Bind<T, TResult>(this IMaybe<T> m, Func<T, IMaybe<TResult>> binder)
=> m.FMap(binder).Join();
public static IMaybe<T> Join<T>(this IMaybe<IMaybe<T>> m)
=> m.Match(x => x, Maybe.Nothing<T>);
public static IMaybe<TResult> FMap<T, TResult>(this IMaybe<T> m, Func<T, TResult> mapper)
=> m.Match(just => mapper(just).Just(), Maybe.Nothing<TResult>);
}
} | 30.3125 | 99 | 0.682474 | [
"MIT"
] | NumAniCloud/CommandBackStack | Dev/Numani.CommandStack/Maybe/MaybeMonad.cs | 487 | C# |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace EntityGraphQL
{
public class QueryResult
{
[JsonProperty("errors")]
public List<GraphQLError> Errors => (List<GraphQLError>)dataResults["errors"];
[JsonProperty("data")]
public ConcurrentDictionary<string, object> Data => (ConcurrentDictionary<string, object>)dataResults["data"];
private readonly ConcurrentDictionary<string, object> dataResults = new ConcurrentDictionary<string, object>();
public QueryResult()
{
dataResults["errors"] = new List<GraphQLError>();
dataResults["data"] = new ConcurrentDictionary<string, object>();
}
internal void SetDebug(object debugData)
{
dataResults["_debug"] = debugData;
}
}
} | 32.37037 | 119 | 0.659039 | [
"MIT"
] | nhathoang989/EntityGraphQL | src/EntityGraphQL/QueryResult.cs | 874 | C# |
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace Common.DataModel.DTO.Dashboard.UserDTO
{
public class RegisteredUserDto
{
[HiddenInput(DisplayValue = false)]
[ScaffoldColumn(false)]
public int UserId { get; set; }
[Required(ErrorMessage = "Required.")]
[DisplayName("نام کاربری ")]
[DataType(DataType.Text)]
public string Username { get; set; }
[Required(ErrorMessage = "Required.")]
[EmailAddress(ErrorMessage = "Invalid email address.")]
[DisplayName("ایمیل")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[DisplayName("زمان ایجاد")]
[DataType(DataType.DateTime)]
public System.DateTime CreatedDate { get; set; }
[DisplayName("آخرین ورود")]
[DataType(DataType.DateTime)]
public Nullable<System.DateTime> LastLoginDate { get; set; }
[HiddenInput(DisplayValue = false)]
[ScaffoldColumn(false)]
public long RoleId { get; set; }
}
} | 30.054054 | 68 | 0.633993 | [
"MIT"
] | n-khosh/SamplePersianAdminPanel | PersianAdminPanel/Common/DataModel/DTO/Dashboard/UserDTO/User.cs | 1,146 | C# |
namespace Serilog.Sinks.MySql.Tvans.Test.Unit.Sinks
{
public class MySqlSinkTests
{
}
}
| 11.875 | 52 | 0.726316 | [
"Apache-2.0"
] | TvanSchagen/Serilog.Sinks.MySql.Tvans | test/Unit/Sinks/MySqlSinkTests.cs | 97 | C# |
using System;
using System.Collections.Generic;
namespace PubNubAPI
{
public enum PNMessageActionsEvent
{
// PNMessageActionsEventAdded is the enum when the event `added` occurs
PNMessageActionsEventAdded,
// PNMessageActionsEventRemoved is the enum when the event `removed` occurs
PNMessageActionsEventRemoved,
PNMessageActionsNoneEvent,
}
public static class PNMessageActionsEventExtensions
{
public static string GetDescription(this PNMessageActionsEvent @this)
{
if (@this.Equals(PNMessageActionsEvent.PNMessageActionsEventAdded)){
return "added";
} else if (@this.Equals(PNMessageActionsEvent.PNMessageActionsEventRemoved)){
return "removed";
} else {
return "";
}
}
}
} | 30.821429 | 89 | 0.643105 | [
"MIT"
] | JordanSchuetz/Unity-Realtime-Chat-Room-Tutorial | Assets/PubNub/Enum/PNMessageActionEnums.cs | 863 | C# |
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using QuantConnect.Data;
using QuantConnect.Data.Market;
namespace QuantConnect.Indicators
{
/// <summary>
/// This indicator computes the Slow Stochastics %K and %D. The Fast Stochastics %K is is computed by
/// (Current Close Price - Lowest Price of given Period) / (Highest Price of given Period - Lowest Price of given Period)
/// multiplied by 100. Once the Fast Stochastics %K is calculated the Slow Stochastic %K is calculated by the average/smoothed price of
/// of the Fast %K with the given period. The Slow Stochastics %D is then derived from the Slow Stochastics %K with the given period.
/// </summary>
public class Stochastic : BarIndicator, IIndicatorWarmUpPeriodProvider
{
private readonly IndicatorBase<IndicatorDataPoint> _maximum;
private readonly IndicatorBase<IndicatorDataPoint> _minimum;
private readonly IndicatorBase<IndicatorDataPoint> _sumFastK;
private readonly IndicatorBase<IndicatorDataPoint> _sumSlowK;
/// <summary>
/// Gets the value of the Fast Stochastics %K given Period.
/// </summary>
public IndicatorBase<IBaseDataBar> FastStoch { get; }
/// <summary>
/// Gets the value of the Slow Stochastics given Period K.
/// </summary>
public IndicatorBase<IBaseDataBar> StochK { get; }
/// <summary>
/// Gets the value of the Slow Stochastics given Period D.
/// </summary>
public IndicatorBase<IBaseDataBar> StochD { get; }
/// <summary>
/// Creates a new Stochastics Indicator from the specified periods.
/// </summary>
/// <param name="name">The name of this indicator.</param>
/// <param name="period">The period given to calculate the Fast %K</param>
/// <param name="kPeriod">The K period given to calculated the Slow %K</param>
/// <param name="dPeriod">The D period given to calculated the Slow %D</param>
public Stochastic(string name, int period, int kPeriod, int dPeriod)
: base(name)
{
_maximum = new Maximum(name + "_Max", period);
_minimum = new Minimum(name + "_Min", period);
_sumFastK = new Sum(name + "_SumFastK", kPeriod);
_sumSlowK = new Sum(name + "_SumD", dPeriod);
FastStoch = new FunctionalIndicator<IBaseDataBar>(name + "_FastStoch",
input => ComputeFastStoch(period, input),
fastStoch => _maximum.IsReady,
() => { }
);
StochK = new FunctionalIndicator<IBaseDataBar>(name + "_StochK",
input => ComputeStochK(period, kPeriod, input),
stochK => _maximum.IsReady,
() => { }
);
StochD = new FunctionalIndicator<IBaseDataBar>(
name + "_StochD",
input => ComputeStochD(period, kPeriod, dPeriod),
stochD => _maximum.IsReady,
() => { }
);
WarmUpPeriod = period;
}
/// <summary>
/// Creates a new <see cref="Stochastic"/> indicator from the specified inputs.
/// </summary>
/// <param name="period">The period given to calculate the Fast %K</param>
/// <param name="kPeriod">The K period given to calculated the Slow %K</param>
/// <param name="dPeriod">The D period given to calculated the Slow %D</param>
public Stochastic(int period, int kPeriod, int dPeriod)
: this($"STO({period},{kPeriod},{dPeriod})", period, kPeriod, dPeriod)
{
}
/// <summary>
/// Gets a flag indicating when this indicator is ready and fully initialized
/// </summary>
public override bool IsReady => FastStoch.IsReady && StochK.IsReady && StochD.IsReady;
/// <summary>
/// Required period, in data points, for the indicator to be ready and fully initialized.
/// </summary>
public int WarmUpPeriod { get; }
/// <summary>
/// Computes the next value of this indicator from the given state
/// </summary>
/// <param name="input">The input given to the indicator</param>
protected override decimal ComputeNextValue(IBaseDataBar input)
{
_maximum.Update(input.Time, input.High);
_minimum.Update(input.Time, input.Low);
FastStoch.Update(input);
StochK.Update(input);
StochD.Update(input);
return FastStoch;
}
/// <summary>
/// Computes the Fast Stochastic %K.
/// </summary>
/// <param name="period">The period.</param>
/// <param name="input">The input.</param>
/// <returns>The Fast Stochastics %K value.</returns>
private decimal ComputeFastStoch(int period, IBaseDataBar input)
{
var denominator = _maximum - _minimum;
// if there's no range, just return constant zero
if (denominator == 0m)
{
return 0m;
}
var numerator = input.Close - _minimum;
var fastStoch = _maximum.Samples >= period ? numerator / denominator : decimal.Zero;
_sumFastK.Update(input.Time, fastStoch);
return fastStoch * 100;
}
/// <summary>
/// Computes the Slow Stochastic %K.
/// </summary>
/// <param name="period">The period.</param>
/// <param name="constantK">The constant k.</param>
/// <param name="input">The input.</param>
/// <returns>The Slow Stochastics %K value.</returns>
private decimal ComputeStochK(int period, int constantK, IBaseData input)
{
var stochK = _maximum.Samples >= (period + constantK - 1) ? _sumFastK / constantK : decimal.Zero;
_sumSlowK.Update(input.Time, stochK);
return stochK * 100;
}
/// <summary>
/// Computes the Slow Stochastic %D.
/// </summary>
/// <param name="period">The period.</param>
/// <param name="constantK">The constant k.</param>
/// <param name="constantD">The constant d.</param>
/// <returns>The Slow Stochastics %D value.</returns>
private decimal ComputeStochD(int period, int constantK, int constantD)
{
var stochD = _maximum.Samples >= (period + constantK + constantD - 2) ? _sumSlowK / constantD : decimal.Zero;
return stochD * 100;
}
/// <summary>
/// Resets this indicator to its initial state
/// </summary>
public override void Reset()
{
FastStoch.Reset();
StochK.Reset();
StochD.Reset();
_maximum.Reset();
_minimum.Reset();
_sumFastK.Reset();
_sumSlowK.Reset();
base.Reset();
}
}
} | 41.247312 | 139 | 0.593457 | [
"Apache-2.0"
] | 9812334/Lean | Indicators/Stochastics.cs | 7,674 | C# |
using System;
using Cradiator.Config;
namespace Cradiator.Model
{
// ReSharper disable MemberCanBeMadeStatic.Global
/// <summary>
/// GuiltFactory determines the BuildBusterStrategy given the GuiltStrategyType
/// Seems overkill, but still reads better than the code it replaced
/// There is no interface IGuiltFactory - really, just to avoid even worse overkill
/// </summary>
public class GuiltFactory
{
public BuildBusterStrategy Get(GuiltStrategyType guiltType)
{
switch(guiltType)
{
case GuiltStrategyType.First:
return new FirstGuiltStrategy();
case GuiltStrategyType.Last:
return new LastGuiltStrategy();
default:
throw new ArgumentOutOfRangeException(nameof(guiltType), guiltType, null);
}
throw new UnknownStrategyTypeException();
}
}
// ReSharper restore MemberCanBeMadeStatic.Global
public class UnknownStrategyTypeException : Exception {}
} | 27.666667 | 84 | 0.756846 | [
"MIT"
] | PandaWood/Cradiator | src/Cradiator/Model/GuiltFactory.cs | 913 | C# |
//using System.Collections.Generic;
//using Microsoft.AspNet.Identity;
//
//namespace LearningSignalR.BackEnd.ViewModels.Manage
//{
// public class IndexViewModel
// {
// public bool HasPassword { get; set; }
// public IList<UserLoginInfo> Logins { get; set; }
// public string PhoneNumber { get; set; }
// public bool TwoFactor { get; set; }
// public bool BrowserRemembered { get; set; }
// }
//} | 31.642857 | 58 | 0.629797 | [
"Apache-2.0"
] | MihaiBogdanEugen/LearningSignalR-InternalNotification | LearningSignalR/LearningSignalR.BackEnd/ViewModels/Manage/IndexViewModel.cs | 445 | 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.DBforMySQL.V20200701Preview
{
public static class GetDatabase
{
/// <summary>
/// Represents a Database.
/// </summary>
public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.InvokeAsync<GetDatabaseResult>("azure-native:dbformysql/v20200701preview:getDatabase", args ?? new GetDatabaseArgs(), options.WithVersion());
}
public sealed class GetDatabaseArgs : Pulumi.InvokeArgs
{
/// <summary>
/// The name of the database.
/// </summary>
[Input("databaseName", required: true)]
public string DatabaseName { get; set; } = null!;
/// <summary>
/// The name of the resource group. The name is case insensitive.
/// </summary>
[Input("resourceGroupName", required: true)]
public string ResourceGroupName { get; set; } = null!;
/// <summary>
/// The name of the server.
/// </summary>
[Input("serverName", required: true)]
public string ServerName { get; set; } = null!;
public GetDatabaseArgs()
{
}
}
[OutputType]
public sealed class GetDatabaseResult
{
/// <summary>
/// The charset of the database.
/// </summary>
public readonly string? Charset;
/// <summary>
/// The collation of the database.
/// </summary>
public readonly string? Collation;
/// <summary>
/// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
/// </summary>
public readonly string Id;
/// <summary>
/// The name of the resource
/// </summary>
public readonly string Name;
/// <summary>
/// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
/// </summary>
public readonly string Type;
[OutputConstructor]
private GetDatabaseResult(
string? charset,
string? collation,
string id,
string name,
string type)
{
Charset = charset;
Collation = collation;
Id = id;
Name = name;
Type = type;
}
}
}
| 30.5 | 197 | 0.59052 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/DBforMySQL/V20200701Preview/GetDatabase.cs | 2,806 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using NUnit.Framework;
using Saltarelle.Compiler.JSModel;
using Saltarelle.Compiler.JSModel.Expressions;
using Saltarelle.Compiler.JSModel.StateMachineRewrite;
using Saltarelle.Compiler.JSModel.Statements;
namespace Saltarelle.Compiler.Tests.StateMachineTests {
public enum MethodType {
Normal,
Iterator,
AsyncVoid,
AsyncTask
}
public class StateMachineRewriterTestBase {
protected void AssertCorrect(string orig, string expected, MethodType methodType = MethodType.Normal) {
int tempIndex = 0, stateIndex = 0, loopLabelIndex = 0;
var stmt = JsStatement.EnsureBlock(JavaScriptParser.Parser.ParseStatement(orig, allowCustomKeywords: true));
JsBlockStatement result;
if (methodType == MethodType.Iterator) {
int finallyHandlerIndex = 0;
result = StateMachineRewriter.RewriteIteratorBlock(stmt, e => e.NodeType != ExpressionNodeType.Identifier, () => "$tmp" + (++tempIndex).ToString(CultureInfo.InvariantCulture), () => "$state" + (++stateIndex).ToString(CultureInfo.InvariantCulture), () => string.Format("$loop" + (++loopLabelIndex).ToString(CultureInfo.InvariantCulture)), () => string.Format("$finally" + (++finallyHandlerIndex).ToString(CultureInfo.InvariantCulture)), v => JsExpression.Invocation(JsExpression.Identifier("setCurrent"), v), sm => {
var body = new List<JsStatement>();
if (sm.Variables.Count > 0)
body.Add(JsStatement.Var(sm.Variables));
body.AddRange(sm.FinallyHandlers.Select(h => (JsStatement)JsExpression.Assign(JsExpression.Identifier(h.Item1), h.Item2)));
if (sm.Disposer != null)
body.Add(JsExpression.Assign(JsExpression.Identifier("dispose"), JsExpression.FunctionDefinition(new string[0], sm.Disposer)));
body.Add(sm.MainBlock);
return JsStatement.Block(body);
});
}
else if (methodType == MethodType.AsyncTask || methodType == MethodType.AsyncVoid) {
result = StateMachineRewriter.RewriteAsyncMethod(stmt,
e => e.NodeType != ExpressionNodeType.Identifier,
() => "$tmp" + (++tempIndex).ToString(CultureInfo.InvariantCulture),
() => "$state" + (++stateIndex).ToString(CultureInfo.InvariantCulture),
() => string.Format("$loop" + (++loopLabelIndex).ToString(CultureInfo.InvariantCulture)),
"$sm",
"$doFinally",
methodType == MethodType.AsyncTask ? JsStatement.Declaration("$tcs", JsExpression.New(JsExpression.Identifier("TaskCompletionSource"))) : null,
expr => { if (methodType != MethodType.AsyncTask) throw new InvalidOperationException("Should not set result in async void method"); return JsExpression.Invocation(JsExpression.Member(JsExpression.Identifier("$tcs"), "setResult"), expr ?? JsExpression.String("<<null>>")); },
expr => { if (methodType != MethodType.AsyncTask) throw new InvalidOperationException("Should not set exception in async void method"); return JsExpression.Invocation(JsExpression.Member(JsExpression.Identifier("$tcs"), "setException"), expr); },
() => { if (methodType != MethodType.AsyncTask) throw new InvalidOperationException("Should not get task async void method"); return JsExpression.Invocation(JsExpression.Member(JsExpression.Identifier("$tcs"), "getTask")); },
(sm, ctx) => JsExpression.Invocation(JsExpression.Identifier("$Bind"), sm, ctx));
}
else {
result = StateMachineRewriter.RewriteNormalMethod(stmt, e => e.NodeType != ExpressionNodeType.Identifier, () => "$tmp" + (++tempIndex).ToString(CultureInfo.InvariantCulture), () => "$state" + (++stateIndex).ToString(CultureInfo.InvariantCulture), () => string.Format("$loop" + (++loopLabelIndex).ToString(CultureInfo.InvariantCulture)));
}
var actual = OutputFormatter.Format(result);
Assert.That(actual.Replace("\r\n", "\n"), Is.EqualTo(expected.Replace("\r\n", "\n")), "Expected:\n" + expected + "\n\nActual:\n" + actual);
}
}
}
| 75.355932 | 519 | 0.64215 | [
"Apache-2.0"
] | AstrorEnales/SaltarelleCompiler | Compiler/Saltarelle.Compiler.Tests/StateMachineTests/StateMachineRewriterTestBase.cs | 4,448 | C# |
using GroupTrip.Shared.Models;
using Microsoft.EntityFrameworkCore;
namespace GroupTrip.Server.DataAccess
{
public class GroupTripContext : DbContext
{
public virtual DbSet<Person> PersonDbSet { get; set; }
public virtual DbSet<Group> GroupDbSet { get; set; }
public virtual DbSet<Trip> TripDbSet { get; set; }
public virtual DbSet<Payment> PaymentDbSet { get; set; }
public virtual DbSet<PersonGroup> PersonGroupDbSet { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Person>().HasKey(p => p.Id);
modelBuilder.Entity<Group>().HasKey(p => p.Id);
modelBuilder.Entity<Payment>().HasKey(p => p.Id);
modelBuilder.Entity<Trip>().HasKey(p => p.Id);
modelBuilder.Entity<PersonGroup>().HasKey(p => p.Id);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
var connection =
@"Server=(localdb)\mssqllocaldb;Database=GroupTrip.Db;Trusted_Connection=True;ConnectRetryCount=0";
optionsBuilder.UseSqlServer(connection);
}
}
}
} | 35.242424 | 111 | 0.692175 | [
"MIT"
] | mislav-markovic/graduate-project | GroupTrip/GroupTrip.Server/DataAccess/GroupTripContext.cs | 1,165 | C# |
using Application.DTOs.Account;
using Application.Exceptions;
using Application.Interfaces;
using Application.Wrappers;
using Domain.Settings;
using Infrastructure.Identity.Helpers;
using Infrastructure.Identity.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Security.Cryptography;
using System.Text;
using Application.Enums;
using System.Threading.Tasks;
using Application.DTOs.Email;
namespace Infrastructure.Identity.Services
{
public class AccountService : IAccountService
{
private readonly UserManager<ApplicationUser> _userManager;
private readonly RoleManager<IdentityRole> _roleManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly IEmailService _emailService;
private readonly JWTSettings _jwtSettings;
private readonly IDateTimeService _dateTimeService;
public AccountService(UserManager<ApplicationUser> userManager,
RoleManager<IdentityRole> roleManager,
IOptions<JWTSettings> jwtSettings,
IDateTimeService dateTimeService,
SignInManager<ApplicationUser> signInManager,
IEmailService emailService)
{
_userManager = userManager;
_roleManager = roleManager;
_jwtSettings = jwtSettings.Value;
_dateTimeService = dateTimeService;
_signInManager = signInManager;
this._emailService = emailService;
}
public async Task<Response<AuthenticationResponse>> AuthenticateAsync(AuthenticationRequest request, string ipAddress)
{
var user = await _userManager.FindByEmailAsync(request.Email);
if (user == null)
{
throw new ApiException($"No Accounts Registered with {request.Email}.");
}
var result = await _signInManager.PasswordSignInAsync(user.UserName, request.Password, false, lockoutOnFailure: false);
if (!result.Succeeded)
{
throw new ApiException($"Invalid Credentials for '{request.Email}'.");
}
if (!user.EmailConfirmed)
{
throw new ApiException($"Account Not Confirmed for '{request.Email}'.");
}
JwtSecurityToken jwtSecurityToken = await GenerateJWToken(user);
AuthenticationResponse response = new AuthenticationResponse();
response.Id = user.Id;
response.JWToken = new JwtSecurityTokenHandler().WriteToken(jwtSecurityToken);
response.Email = user.Email;
response.UserName = user.UserName;
var rolesList = await _userManager.GetRolesAsync(user).ConfigureAwait(false);
response.Roles = rolesList.ToList();
response.IsVerified = user.EmailConfirmed;
var refreshToken = GenerateRefreshToken(ipAddress);
response.RefreshToken = refreshToken.Token;
return new Response<AuthenticationResponse>(response, $"Authenticated {user.UserName}");
}
public async Task<Response<string>> RegisterAsync(RegisterRequest request, string origin)
{
var userWithSameUserName = await _userManager.FindByNameAsync(request.UserName);
if (userWithSameUserName != null)
{
throw new ApiException($"Username '{request.UserName}' is already taken.");
}
var user = new ApplicationUser
{
Email = request.Email,
FirstName = request.FirstName,
LastName = request.LastName,
UserName = request.UserName
};
var userWithSameEmail = await _userManager.FindByEmailAsync(request.Email);
if (userWithSameEmail == null)
{
var result = await _userManager.CreateAsync(user, request.Password);
if (result.Succeeded)
{
await _userManager.AddToRoleAsync(user, Roles.Basic.ToString());
var verificationUri = await SendVerificationEmail(user, origin);
//TODO: Attach Email Service here and configure it via appsettings
await _emailService.SendAsync(new Application.DTOs.Email.EmailRequest() { From = "mail@codewithmukesh.com", To = user.Email, Body = $"Please confirm your account by visiting this URL {verificationUri}", Subject = "Confirm Registration" });
return new Response<string>(user.Id, message: $"User Registered. Please confirm your account by visiting this URL {verificationUri}");
}
else
{
throw new ApiException($"{result.Errors}");
}
}
else
{
throw new ApiException($"Email {request.Email } is already registered.");
}
}
private async Task<JwtSecurityToken> GenerateJWToken(ApplicationUser user)
{
var userClaims = await _userManager.GetClaimsAsync(user);
var roles = await _userManager.GetRolesAsync(user);
var roleClaims = new List<Claim>();
for (int i = 0; i < roles.Count; i++)
{
roleClaims.Add(new Claim("roles", roles[i]));
}
string ipAddress = IpHelper.GetIpAddress();
var claims = new[]
{
new Claim(JwtRegisteredClaimNames.Sub, user.UserName),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Email, user.Email),
new Claim("uid", user.Id),
new Claim("ip", ipAddress)
}
.Union(userClaims)
.Union(roleClaims);
var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.Key));
var signingCredentials = new SigningCredentials(symmetricSecurityKey, SecurityAlgorithms.HmacSha256);
var jwtSecurityToken = new JwtSecurityToken(
issuer: _jwtSettings.Issuer,
audience: _jwtSettings.Audience,
claims: claims,
expires: DateTime.UtcNow.AddMinutes(_jwtSettings.DurationInMinutes),
signingCredentials: signingCredentials);
return jwtSecurityToken;
}
private string RandomTokenString()
{
using var rngCryptoServiceProvider = new RNGCryptoServiceProvider();
var randomBytes = new byte[40];
rngCryptoServiceProvider.GetBytes(randomBytes);
// convert random bytes to hex string
return BitConverter.ToString(randomBytes).Replace("-", "");
}
private async Task<string> SendVerificationEmail(ApplicationUser user, string origin)
{
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var route = "api/account/confirm-email/";
var _enpointUri = new Uri(string.Concat($"{origin}/", route));
var verificationUri = QueryHelpers.AddQueryString(_enpointUri.ToString(), "userId", user.Id);
verificationUri = QueryHelpers.AddQueryString(verificationUri, "code", code);
//Email Service Call Here
return verificationUri;
}
public async Task<Response<string>> ConfirmEmailAsync(string userId, string code)
{
var user = await _userManager.FindByIdAsync(userId);
code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code));
var result = await _userManager.ConfirmEmailAsync(user, code);
if(result.Succeeded)
{
return new Response<string>(user.Id, message: $"Account Confirmed for {user.Email}. You can now use the /api/Account/authenticate endpoint.");
}
else
{
throw new ApiException($"An error occured while confirming {user.Email}.");
}
}
private RefreshToken GenerateRefreshToken(string ipAddress)
{
return new RefreshToken
{
Token = RandomTokenString(),
Expires = DateTime.UtcNow.AddDays(7),
Created = DateTime.UtcNow,
CreatedByIp = ipAddress
};
}
public async Task ForgotPassword(ForgotPasswordRequest model, string origin)
{
var account = await _userManager.FindByEmailAsync(model.Email);
// always return ok response to prevent email enumeration
if (account == null) return;
var code = await _userManager.GeneratePasswordResetTokenAsync(account);
var route = "api/account/reset-password/";
var _enpointUri = new Uri(string.Concat($"{origin}/", route));
var emailRequest = new EmailRequest()
{
Body = $"You reset token is - {code}",
To = model.Email,
Subject = "Reset Password",
};
await _emailService.SendAsync(emailRequest);
}
public async Task<Response<string>> ResetPassword(ResetPasswordRequest model)
{
var account = await _userManager.FindByEmailAsync(model.Email);
if (account == null) throw new ApiException($"No Accounts Registered with {model.Email}.");
var result = await _userManager.ResetPasswordAsync(account, model.Token, model.Password);
if(result.Succeeded)
{
return new Response<string>(model.Email, message: $"Password Resetted.");
}
else
{
throw new ApiException($"Error occured while reseting the password.");
}
}
}
}
| 43.510638 | 259 | 0.61643 | [
"MIT"
] | chenzuo/CleanArchitecture.WebApi | Infrastructure.Identity/Services/AccountService.cs | 10,227 | C# |
namespace NVelocity.Runtime.Parser.Node
{
using System;
public class ASTVariable : SimpleNode
{
public ASTVariable(int id) : base(id)
{
}
public ASTVariable(Parser p, int id) : base(p, id)
{
}
/// <summary>
/// Accept the visitor.
/// </summary>
public override Object Accept(IParserVisitor visitor, Object data)
{
return visitor.Visit(this, data);
}
}
} | 16.869565 | 68 | 0.657216 | [
"Apache-2.0"
] | Telligent/NVelocity | src/NVelocity/Runtime/Parser/Node/ASTVariable.cs | 388 | C# |
using System;
using System.Collections.Generic;
using NHapi.Base.Log;
using NHapi.Model.V251.Group;
using NHapi.Model.V251.Segment;
using NHapi.Model.V251.Datatype;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V251.Message
{
///<summary>
/// Represents a QCN_J01 message structure (see chapter 5.4.6). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: SFT (Software Segment) optional repeating</li>
///<li>2: QID (Query Identification) </li>
///</ol>
///</summary>
[Serializable]
public class QCN_J01 : AbstractMessage {
///<summary>
/// Creates a new QCN_J01 Group with custom IModelClassFactory.
///</summary>
public QCN_J01(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new QCN_J01 Group with DefaultModelClassFactory.
///</summary>
public QCN_J01() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for QCN_J01. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(SFT), false, true);
this.add(typeof(QID), true, false);
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating QCN_J01 - this is probably a bug in the source code generator.", e);
}
}
public override string Version
{
get{
return Constants.VERSION;
}
}
///<summary>
/// Returns MSH (Message Header) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of SFT (Software Segment) - creates it if necessary
///</summary>
public SFT GetSFT() {
SFT ret = null;
try {
ret = (SFT)this.GetStructure("SFT");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of SFT
/// * (Software Segment) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public SFT GetSFT(int rep) {
return (SFT)this.GetStructure("SFT", rep);
}
/**
* Returns the number of existing repetitions of SFT
*/
public int SFTRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("SFT").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the SFT results
*/
public IEnumerable<SFT> SFTs
{
get
{
for (int rep = 0; rep < SFTRepetitionsUsed; rep++)
{
yield return (SFT)this.GetStructure("SFT", rep);
}
}
}
///<summary>
///Adds a new SFT
///</summary>
public SFT AddSFT()
{
return this.AddStructure("SFT") as SFT;
}
///<summary>
///Removes the given SFT
///</summary>
public void RemoveSFT(SFT toRemove)
{
this.RemoveStructure("SFT", toRemove);
}
///<summary>
///Removes the SFT at the given index
///</summary>
public void RemoveSFTAt(int index)
{
this.RemoveRepetition("SFT", index);
}
///<summary>
/// Returns QID (Query Identification) - creates it if necessary
///</summary>
public QID QID {
get{
QID ret = null;
try {
ret = (QID)this.GetStructure("QID");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
}
}
| 26.531792 | 146 | 0.631155 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | afaonline/nHapi | src/NHapi.Model.V251/Message/QCN_J01.cs | 4,590 | C# |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#if !USE_WINUI3
using Windows.UI.Xaml;
#else
using Microsoft.UI.Xaml;
#endif
namespace Microsoft.ReactNative.Managed
{
public delegate void ViewManagerEvent<TFrameworkElement, TEventData>(TFrameworkElement view, TEventData eventData) where TFrameworkElement : FrameworkElement;
}
| 26.571429 | 161 | 0.77957 | [
"MIT"
] | mganandraj/react-native-windows-dbg | Microsoft.ReactNative.Managed/ViewManagerEvent.cs | 372 | C# |
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256
// hash algorithms as defined in FIPS 180-4.
//
// All the hash.Hash implementations returned by this package also
// implement encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to
// marshal and unmarshal the internal state of the hash.
// package sha512 -- go2cs converted at 2020 October 09 04:52:55 UTC
// import "crypto/sha512" ==> using sha512 = go.crypto.sha512_package
// Original source: C:\Go\src\crypto\sha512\sha512.go
using crypto = go.crypto_package;
using binary = go.encoding.binary_package;
using errors = go.errors_package;
using hash = go.hash_package;
using static go.builtin;
namespace go {
namespace crypto
{
public static partial class sha512_package
{
private static void init()
{
crypto.RegisterHash(crypto.SHA384, New384);
crypto.RegisterHash(crypto.SHA512, New);
crypto.RegisterHash(crypto.SHA512_224, New512_224);
crypto.RegisterHash(crypto.SHA512_256, New512_256);
}
// Size is the size, in bytes, of a SHA-512 checksum.
public static readonly long Size = (long)64L;
// Size224 is the size, in bytes, of a SHA-512/224 checksum.
public static readonly long Size224 = (long)28L;
// Size256 is the size, in bytes, of a SHA-512/256 checksum.
public static readonly long Size256 = (long)32L;
// Size384 is the size, in bytes, of a SHA-384 checksum.
public static readonly long Size384 = (long)48L;
// BlockSize is the block size, in bytes, of the SHA-512/224,
// SHA-512/256, SHA-384 and SHA-512 hash functions.
public static readonly long BlockSize = (long)128L;
private static readonly long chunk = (long)128L;
private static readonly ulong init0 = (ulong)0x6a09e667f3bcc908UL;
private static readonly ulong init1 = (ulong)0xbb67ae8584caa73bUL;
private static readonly ulong init2 = (ulong)0x3c6ef372fe94f82bUL;
private static readonly ulong init3 = (ulong)0xa54ff53a5f1d36f1UL;
private static readonly ulong init4 = (ulong)0x510e527fade682d1UL;
private static readonly ulong init5 = (ulong)0x9b05688c2b3e6c1fUL;
private static readonly ulong init6 = (ulong)0x1f83d9abfb41bd6bUL;
private static readonly ulong init7 = (ulong)0x5be0cd19137e2179UL;
private static readonly ulong init0_224 = (ulong)0x8c3d37c819544da2UL;
private static readonly ulong init1_224 = (ulong)0x73e1996689dcd4d6UL;
private static readonly ulong init2_224 = (ulong)0x1dfab7ae32ff9c82UL;
private static readonly ulong init3_224 = (ulong)0x679dd514582f9fcfUL;
private static readonly ulong init4_224 = (ulong)0x0f6d2b697bd44da8UL;
private static readonly ulong init5_224 = (ulong)0x77e36f7304c48942UL;
private static readonly ulong init6_224 = (ulong)0x3f9d85a86a1d36c8UL;
private static readonly ulong init7_224 = (ulong)0x1112e6ad91d692a1UL;
private static readonly ulong init0_256 = (ulong)0x22312194fc2bf72cUL;
private static readonly ulong init1_256 = (ulong)0x9f555fa3c84c64c2UL;
private static readonly ulong init2_256 = (ulong)0x2393b86b6f53b151UL;
private static readonly ulong init3_256 = (ulong)0x963877195940eabdUL;
private static readonly ulong init4_256 = (ulong)0x96283ee2a88effe3UL;
private static readonly ulong init5_256 = (ulong)0xbe5e1e2553863992UL;
private static readonly ulong init6_256 = (ulong)0x2b0199fc2c85b8aaUL;
private static readonly ulong init7_256 = (ulong)0x0eb72ddc81c52ca2UL;
private static readonly ulong init0_384 = (ulong)0xcbbb9d5dc1059ed8UL;
private static readonly ulong init1_384 = (ulong)0x629a292a367cd507UL;
private static readonly ulong init2_384 = (ulong)0x9159015a3070dd17UL;
private static readonly ulong init3_384 = (ulong)0x152fecd8f70e5939UL;
private static readonly ulong init4_384 = (ulong)0x67332667ffc00b31UL;
private static readonly ulong init5_384 = (ulong)0x8eb44a8768581511UL;
private static readonly ulong init6_384 = (ulong)0xdb0c2e0d64f98fa7UL;
private static readonly ulong init7_384 = (ulong)0x47b5481dbefa4fa4UL;
// digest represents the partial evaluation of a checksum.
private partial struct digest
{
public array<ulong> h;
public array<byte> x;
public long nx;
public ulong len;
public crypto.Hash function;
}
private static void Reset(this ptr<digest> _addr_d)
{
ref digest d = ref _addr_d.val;
if (d.function == crypto.SHA384)
d.h[0L] = init0_384;
d.h[1L] = init1_384;
d.h[2L] = init2_384;
d.h[3L] = init3_384;
d.h[4L] = init4_384;
d.h[5L] = init5_384;
d.h[6L] = init6_384;
d.h[7L] = init7_384;
else if (d.function == crypto.SHA512_224)
d.h[0L] = init0_224;
d.h[1L] = init1_224;
d.h[2L] = init2_224;
d.h[3L] = init3_224;
d.h[4L] = init4_224;
d.h[5L] = init5_224;
d.h[6L] = init6_224;
d.h[7L] = init7_224;
else if (d.function == crypto.SHA512_256)
d.h[0L] = init0_256;
d.h[1L] = init1_256;
d.h[2L] = init2_256;
d.h[3L] = init3_256;
d.h[4L] = init4_256;
d.h[5L] = init5_256;
d.h[6L] = init6_256;
d.h[7L] = init7_256;
else
d.h[0L] = init0;
d.h[1L] = init1;
d.h[2L] = init2;
d.h[3L] = init3;
d.h[4L] = init4;
d.h[5L] = init5;
d.h[6L] = init6;
d.h[7L] = init7;
d.nx = 0L;
d.len = 0L;
}
private static readonly @string magic384 = (@string)"sha\x04";
private static readonly @string magic512_224 = (@string)"sha\x05";
private static readonly @string magic512_256 = (@string)"sha\x06";
private static readonly @string magic512 = (@string)"sha\x07";
private static readonly var marshaledSize = len(magic512) + 8L * 8L + chunk + 8L;
private static (slice<byte>, error) MarshalBinary(this ptr<digest> _addr_d)
{
slice<byte> _p0 = default;
error _p0 = default!;
ref digest d = ref _addr_d.val;
var b = make_slice<byte>(0L, marshaledSize);
if (d.function == crypto.SHA384)
b = append(b, magic384);
else if (d.function == crypto.SHA512_224)
b = append(b, magic512_224);
else if (d.function == crypto.SHA512_256)
b = append(b, magic512_256);
else if (d.function == crypto.SHA512)
b = append(b, magic512);
else
return (null, error.As(errors.New("crypto/sha512: invalid hash function"))!);
b = appendUint64(b, d.h[0L]);
b = appendUint64(b, d.h[1L]);
b = appendUint64(b, d.h[2L]);
b = appendUint64(b, d.h[3L]);
b = appendUint64(b, d.h[4L]);
b = appendUint64(b, d.h[5L]);
b = appendUint64(b, d.h[6L]);
b = appendUint64(b, d.h[7L]);
b = append(b, d.x[..d.nx]);
b = b[..len(b) + len(d.x) - int(d.nx)]; // already zero
b = appendUint64(b, d.len);
return (b, error.As(null!)!);
}
private static error UnmarshalBinary(this ptr<digest> _addr_d, slice<byte> b)
{
ref digest d = ref _addr_d.val;
if (len(b) < len(magic512))
{
return error.As(errors.New("crypto/sha512: invalid hash state identifier"))!;
}
if (d.function == crypto.SHA384 && string(b[..len(magic384)]) == magic384) else if (d.function == crypto.SHA512_224 && string(b[..len(magic512_224)]) == magic512_224) else if (d.function == crypto.SHA512_256 && string(b[..len(magic512_256)]) == magic512_256) else if (d.function == crypto.SHA512 && string(b[..len(magic512)]) == magic512) else
return error.As(errors.New("crypto/sha512: invalid hash state identifier"))!;
if (len(b) != marshaledSize)
{
return error.As(errors.New("crypto/sha512: invalid hash state size"))!;
}
b = b[len(magic512)..];
b, d.h[0L] = consumeUint64(b);
b, d.h[1L] = consumeUint64(b);
b, d.h[2L] = consumeUint64(b);
b, d.h[3L] = consumeUint64(b);
b, d.h[4L] = consumeUint64(b);
b, d.h[5L] = consumeUint64(b);
b, d.h[6L] = consumeUint64(b);
b, d.h[7L] = consumeUint64(b);
b = b[copy(d.x[..], b)..];
b, d.len = consumeUint64(b);
d.nx = int(d.len % chunk);
return error.As(null!)!;
}
private static slice<byte> appendUint64(slice<byte> b, ulong x)
{
array<byte> a = new array<byte>(8L);
binary.BigEndian.PutUint64(a[..], x);
return append(b, a[..]);
}
private static (slice<byte>, ulong) consumeUint64(slice<byte> b)
{
slice<byte> _p0 = default;
ulong _p0 = default;
_ = b[7L];
var x = uint64(b[7L]) | uint64(b[6L]) << (int)(8L) | uint64(b[5L]) << (int)(16L) | uint64(b[4L]) << (int)(24L) | uint64(b[3L]) << (int)(32L) | uint64(b[2L]) << (int)(40L) | uint64(b[1L]) << (int)(48L) | uint64(b[0L]) << (int)(56L);
return (b[8L..], x);
}
// New returns a new hash.Hash computing the SHA-512 checksum.
public static hash.Hash New()
{
ptr<digest> d = addr(new digest(function:crypto.SHA512));
d.Reset();
return d;
}
// New512_224 returns a new hash.Hash computing the SHA-512/224 checksum.
public static hash.Hash New512_224()
{
ptr<digest> d = addr(new digest(function:crypto.SHA512_224));
d.Reset();
return d;
}
// New512_256 returns a new hash.Hash computing the SHA-512/256 checksum.
public static hash.Hash New512_256()
{
ptr<digest> d = addr(new digest(function:crypto.SHA512_256));
d.Reset();
return d;
}
// New384 returns a new hash.Hash computing the SHA-384 checksum.
public static hash.Hash New384()
{
ptr<digest> d = addr(new digest(function:crypto.SHA384));
d.Reset();
return d;
}
private static long Size(this ptr<digest> _addr_d)
{
ref digest d = ref _addr_d.val;
if (d.function == crypto.SHA512_224)
return Size224;
else if (d.function == crypto.SHA512_256)
return Size256;
else if (d.function == crypto.SHA384)
return Size384;
else
return Size;
}
private static long BlockSize(this ptr<digest> _addr_d)
{
ref digest d = ref _addr_d.val;
return BlockSize;
}
private static (long, error) Write(this ptr<digest> _addr_d, slice<byte> p)
{
long nn = default;
error err = default!;
ref digest d = ref _addr_d.val;
nn = len(p);
d.len += uint64(nn);
if (d.nx > 0L)
{
var n = copy(d.x[d.nx..], p);
d.nx += n;
if (d.nx == chunk)
{
block(d, d.x[..]);
d.nx = 0L;
}
p = p[n..];
}
if (len(p) >= chunk)
{
n = len(p) & ~(chunk - 1L);
block(d, p[..n]);
p = p[n..];
}
if (len(p) > 0L)
{
d.nx = copy(d.x[..], p);
}
return ;
}
private static slice<byte> Sum(this ptr<digest> _addr_d, slice<byte> @in)
{
ref digest d = ref _addr_d.val;
// Make a copy of d so that caller can keep writing and summing.
ptr<digest> d0 = @new<digest>();
d0.val = d.val;
var hash = d0.checkSum();
if (d0.function == crypto.SHA384)
return append(in, hash[..Size384]);
else if (d0.function == crypto.SHA512_224)
return append(in, hash[..Size224]);
else if (d0.function == crypto.SHA512_256)
return append(in, hash[..Size256]);
else
return append(in, hash[..]);
}
private static array<byte> checkSum(this ptr<digest> _addr_d) => func((_, panic, __) =>
{
ref digest d = ref _addr_d.val;
// Padding. Add a 1 bit and 0 bits until 112 bytes mod 128.
var len = d.len;
array<byte> tmp = new array<byte>(128L);
tmp[0L] = 0x80UL;
if (len % 128L < 112L)
{
d.Write(tmp[0L..112L - len % 128L]);
}
else
{
d.Write(tmp[0L..128L + 112L - len % 128L]);
}
// Length in bits.
len <<= 3L;
binary.BigEndian.PutUint64(tmp[0L..], 0L); // upper 64 bits are always zero, because len variable has type uint64
binary.BigEndian.PutUint64(tmp[8L..], len);
d.Write(tmp[0L..16L]);
if (d.nx != 0L)
{
panic("d.nx != 0");
}
array<byte> digest = new array<byte>(Size);
binary.BigEndian.PutUint64(digest[0L..], d.h[0L]);
binary.BigEndian.PutUint64(digest[8L..], d.h[1L]);
binary.BigEndian.PutUint64(digest[16L..], d.h[2L]);
binary.BigEndian.PutUint64(digest[24L..], d.h[3L]);
binary.BigEndian.PutUint64(digest[32L..], d.h[4L]);
binary.BigEndian.PutUint64(digest[40L..], d.h[5L]);
if (d.function != crypto.SHA384)
{
binary.BigEndian.PutUint64(digest[48L..], d.h[6L]);
binary.BigEndian.PutUint64(digest[56L..], d.h[7L]);
}
return digest;
});
// Sum512 returns the SHA512 checksum of the data.
public static array<byte> Sum512(slice<byte> data)
{
digest d = new digest(function:crypto.SHA512);
d.Reset();
d.Write(data);
return d.checkSum();
}
// Sum384 returns the SHA384 checksum of the data.
public static array<byte> Sum384(slice<byte> data)
{
array<byte> sum384 = default;
digest d = new digest(function:crypto.SHA384);
d.Reset();
d.Write(data);
var sum = d.checkSum();
copy(sum384[..], sum[..Size384]);
return ;
}
// Sum512_224 returns the Sum512/224 checksum of the data.
public static array<byte> Sum512_224(slice<byte> data)
{
array<byte> sum224 = default;
digest d = new digest(function:crypto.SHA512_224);
d.Reset();
d.Write(data);
var sum = d.checkSum();
copy(sum224[..], sum[..Size224]);
return ;
}
// Sum512_256 returns the Sum512/256 checksum of the data.
public static array<byte> Sum512_256(slice<byte> data)
{
array<byte> sum256 = default;
digest d = new digest(function:crypto.SHA512_256);
d.Reset();
d.Write(data);
var sum = d.checkSum();
copy(sum256[..], sum[..Size256]);
return ;
}
}
}}
| 37.646925 | 404 | 0.536577 | [
"MIT"
] | GridProtectionAlliance/go2cs | src/go-src-converted/crypto/sha512/sha512.cs | 16,527 | C# |
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated code. DO NOT EDIT!
namespace Google.Cloud.Spanner.Admin.Database.V1.Snippets
{
using Google.Cloud.Spanner.Admin.Database.V1;
using Google.LongRunning;
using System.Threading.Tasks;
public sealed partial class GeneratedDatabaseAdminClientStandaloneSnippets
{
/// <summary>Snippet for RestoreDatabaseAsync</summary>
/// <remarks>
/// This snippet has been automatically generated for illustrative purposes only.
/// It may require modifications to work in your environment.
/// </remarks>
public async Task RestoreDatabaseRequestObjectAsync()
{
// Create client
DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();
// Initialize request argument(s)
RestoreDatabaseRequest request = new RestoreDatabaseRequest
{
ParentAsInstanceName = InstanceName.FromProjectInstance("[PROJECT]", "[INSTANCE]"),
DatabaseId = "",
BackupAsBackupName = BackupName.FromProjectInstanceBackup("[PROJECT]", "[INSTANCE]", "[BACKUP]"),
EncryptionConfig = new RestoreDatabaseEncryptionConfig(),
};
// Make the request
Operation<Database, RestoreDatabaseMetadata> response = await databaseAdminClient.RestoreDatabaseAsync(request);
// Poll until the returned long-running operation is complete
Operation<Database, RestoreDatabaseMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Database result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Database, RestoreDatabaseMetadata> retrievedResponse = await databaseAdminClient.PollOnceRestoreDatabaseAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Database retrievedResult = retrievedResponse.Result;
}
}
}
}
| 46.190476 | 147 | 0.679725 | [
"Apache-2.0"
] | googleapis/googleapis-gen | google/spanner/admin/database/v1/google-cloud-admin-database-v1-csharp/Google.Cloud.Spanner.Admin.Database.V1.StandaloneSnippets/DatabaseAdminClient.RestoreDatabaseRequestObjectAsyncSnippet.g.cs | 2,910 | C# |
using System;
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Xunit;
namespace RecipeApp.CoreApi.UnitTests.Features.Instruction.V1_0
{
public partial class InstructionServiceTests
{
[Theory(DisplayName = "InstructionServiceTests.Delete")]
[InlineData("00000000-0000-0000-0000-000000000000", HttpStatusCode.BadRequest, new string[] { "Id is required." })]
[InlineData("eb95c593-69b2-4483-8fc3-4f74726a317e", HttpStatusCode.OK, new string[] { })]
public async Task Delete_Should_Return_Correct_StatusCode(Guid id
, HttpStatusCode expectedHttpStatusCode
, string[] expectedMessages)
{
// Arrange
_instructionRepositoryMock
.Setup(x => x.DeleteAsync(It.IsAny<Guid>()))
.ReturnsAsync(1);
// Act
var actualApiResult = await _instructionService.DeleteAsync(id).ConfigureAwait(false);
// Assert
actualApiResult.HttpStatusCode.Should().Be(expectedHttpStatusCode);
actualApiResult.Messages.Count.Should().Be(expectedMessages.Length);
foreach (var expectedMessage in expectedMessages)
actualApiResult.Messages.Should().Contain(m => Equals(m.Message, expectedMessage));
}
}
}
| 35.263158 | 123 | 0.663433 | [
"MIT"
] | roysurles/TbdApps | src/RecipeApp.CoreApi.UnitTests/Features/Instruction/V1_0/05_InstructionServiceTests.DeleteAsync.cs | 1,342 | C# |
/* Problem 12. Index of letters
Write a program that creates an array containing all letters from the alphabet (a-z).
Read a word from the console and print the index of each of its letters in the array.
Input: On the first line you will receive the word
Output: Print the index of each of the word's letters in the array. Each index should be on a new line.
Constraints: 1 <= word length <= 128. Word is consisted of lowercase english letters. */
using System;
class IndexOfLetters
{
static void Main()
{
// input
string word = Console.ReadLine();
int[] lettersArray = new int[26];
// creating an array containing all letters from the alphabet (a-z)
for (int i = 0; i < 26; i++)
{
lettersArray[i] = 'a' + i;
}
// printing the index of each of word's letters in the array
for (int i = 0; i < word.Length; i++)
{
for (int j = 0; j < lettersArray.Length; j++)
{
if (word[i] == lettersArray[j])
{
Console.WriteLine(j);
break;
}
}
}
}
} | 32.5 | 108 | 0.529555 | [
"MIT"
] | veritasbg/CSharp2 | Arrays/IndexOfLetters/IndexOfLetters.cs | 1,237 | C# |
namespace BlazorApps.BlazorCharts.Model
{
public class FillTarget: IFillTarget
{
public object Value { get; set; }
}
} | 19.714286 | 41 | 0.65942 | [
"MIT"
] | TimPurdum/blazor-apps | BlazorApps.BlazorCharts/Model/FillTarget.cs | 138 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace Toqe.Downloader.Business.Contract.Enums
{
public enum DownloadState
{
Undefined = 0,
Initialized = 1,
Running = 2,
Finished = 3,
Stopped = 4,
Cancelled = 5
}
} | 18.625 | 49 | 0.600671 | [
"MIT"
] | Genusatplay/Downloader | Downloader.Business.Contract/Enums/DownloadState.cs | 300 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Playnite.Native
{
public static class Windef
{
internal static int LOWORD(int i)
{
return (short)(i & 0xFFFF);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct POINTL
{
private int x;
private int y;
}
[StructLayout(LayoutKind.Sequential)]
public struct SIZE
{
public int cx;
public int cy;
}
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
private int _x;
private int _y;
public POINT(int x, int y)
{
_x = x;
_y = y;
}
public int X
{
get { return _x; }
set { _x = value; }
}
public int Y
{
get { return _y; }
set { _y = value; }
}
public override bool Equals(object obj)
{
if (obj is POINT)
{
var point = (POINT)obj;
return point._x == _x && point._y == _y;
}
return base.Equals(obj);
}
public override int GetHashCode()
{
return _x.GetHashCode() ^ _y.GetHashCode();
}
public static bool operator ==(POINT a, POINT b)
{
return a._x == b._x && a._y == b._y;
}
public static bool operator !=(POINT a, POINT b)
{
return !(a == b);
}
}
[StructLayout(LayoutKind.Sequential, Pack = 0)]
public struct RECT
{
private int _left;
private int _top;
private int _right;
private int _bottom;
public static readonly RECT Empty = new RECT();
public RECT(int left, int top, int right, int bottom)
{
this._left = left;
this._top = top;
this._right = right;
this._bottom = bottom;
}
public RECT(RECT rcSrc)
{
_left = rcSrc.Left;
_top = rcSrc.Top;
_right = rcSrc.Right;
_bottom = rcSrc.Bottom;
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public void Offset(int dx, int dy)
{
_left += dx;
_top += dy;
_right += dx;
_bottom += dy;
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Left
{
get { return _left; }
set { _left = value; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Right
{
get { return _right; }
set { _right = value; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Top
{
get { return _top; }
set { _top = value; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Bottom
{
get { return _bottom; }
set { _bottom = value; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Width
{
get { return _right - _left; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public int Height
{
get { return _bottom - _top; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public POINT Position
{
get { return new POINT { X = _left, Y = _top }; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public SIZE Size
{
get { return new SIZE { cx = Width, cy = Height }; }
}
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static RECT Union(RECT rect1, RECT rect2)
{
return new RECT
{
Left = Math.Min(rect1.Left, rect2.Left),
Top = Math.Min(rect1.Top, rect2.Top),
Right = Math.Max(rect1.Right, rect2.Right),
Bottom = Math.Max(rect1.Bottom, rect2.Bottom),
};
}
public override bool Equals(object obj)
{
try
{
var rc = (RECT)obj;
return rc._bottom == _bottom
&& rc._left == _left
&& rc._right == _right
&& rc._top == _top;
}
catch (InvalidCastException)
{
return false;
}
}
public bool IsEmpty
{
get
{
// BUGBUG : On Bidi OS (hebrew arabic) left > right
return Left >= Right || Top >= Bottom;
}
}
public override string ToString()
{
if (this == Empty)
return "RECT {Empty}";
return "RECT { left : " + Left + " / top : " + Top + " / right : " + Right + " / bottom : " + Bottom + " }";
}
public override int GetHashCode()
{
return (_left << 16 | Windef.LOWORD(_right)) ^ (_top << 16 | Windef.LOWORD(_bottom));
}
public static bool operator ==(RECT rect1, RECT rect2)
{
return (rect1.Left == rect2.Left && rect1.Top == rect2.Top && rect1.Right == rect2.Right && rect1.Bottom == rect2.Bottom);
}
public static bool operator !=(RECT rect1, RECT rect2)
{
return !(rect1 == rect2);
}
}
}
| 26.91342 | 135 | 0.474345 | [
"MIT"
] | FenDIY/Worknite | source/Playnite/Native/Windef.cs | 6,219 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Neblina.Api.Models.TransferViewModels
{
public class SendTransferReceiptViewModel
{
public int TransactionId { get; set; }
public int DestinationBankId { get; set; }
public int DestinationAccountId { get; set; }
public decimal Amount { get; set; }
}
}
| 26.25 | 54 | 0.671429 | [
"MIT"
] | leonaascimento/Neblina | src/Neblina.Api/Models/TransferViewModels/SendTransferReceiptViewModel.cs | 422 | C# |
using DesignPatterns.AbstractFactory.Interfaces;
namespace DesignPatterns.AbstractFactory.Devices
{
public class SamsungTablet : Device
{
public SamsungTablet(string brand) : base(brand)
{
}
public override int BatteryLife()
{
return 7000;
}
public override string Model()
{
return "Galaxy Tab";
}
public override int ScreenSize()
{
return 13;
}
public override int YearOfRelease()
{
return 2018;
}
}
}
| 18.40625 | 56 | 0.528014 | [
"MIT"
] | bmaximus/DesignPatterns | DesignPatterns/AbstractFactory/Devices/SamsungTablet.cs | 591 | C# |
// <auto-generated />
using System;
using JjOnlineStore.Data.EF;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace JjOnlineStore.Data.EF.Migrations
{
[DbContext(typeof(JjOnlineStoreDbContext))]
[Migration("20181104070340_CartOrderArchitectureRefactoring")]
partial class CartOrderArchitectureRefactoring
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.3-rtm-32065")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("JjOnlineStore.Data.Entities.ApplicationRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("DeletedOn");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.ApplicationUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<long>("CartId");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("DeletedOn");
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<bool>("IsDeleted");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Cart", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("UserId");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique()
.HasFilter("[UserId] IS NOT NULL");
b.ToTable("Carts");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.CartItem", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<long>("CartId");
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("DeletedOn");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("ModifiedOn");
b.Property<long>("ProductId");
b.Property<short>("Quantity");
b.HasKey("Id");
b.HasIndex("CartId");
b.HasIndex("ProductId");
b.ToTable("CartItems");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Category", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("DeletedOn");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100);
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Order", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Address");
b.Property<string>("CardNumber")
.IsRequired();
b.Property<string>("CardholderName")
.IsRequired();
b.Property<string>("City")
.IsRequired();
b.Property<string>("Country")
.IsRequired();
b.Property<DateTime>("CreatedOn");
b.Property<string>("Cvv")
.IsRequired();
b.Property<DateTime?>("DeletedOn");
b.Property<string>("Email");
b.Property<DateTime>("ExpireDate");
b.Property<string>("FirstName")
.IsRequired();
b.Property<bool>("IsDeleted");
b.Property<string>("LastName")
.IsRequired();
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("Phone");
b.Property<bool>("Shipped");
b.Property<string>("State")
.IsRequired();
b.Property<int>("TransportationType");
b.Property<string>("UserId");
b.Property<string>("Zip");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Orders");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.OrderItem", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<long>("OrderId");
b.Property<long>("ProductId");
b.Property<short>("Quantity");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Product", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Base64Image")
.IsRequired();
b.Property<long>("CategoryId");
b.Property<string>("Color");
b.Property<DateTime>("CreatedOn");
b.Property<DateTime?>("DeletedOn");
b.Property<string>("Description")
.IsRequired();
b.Property<string>("Details");
b.Property<bool>("IsAvailable");
b.Property<bool>("IsDeleted");
b.Property<DateTime?>("ModifiedOn");
b.Property<string>("Name")
.IsRequired();
b.Property<decimal>("Price");
b.Property<int>("Size");
b.Property<int>("Type");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("Products");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Cart", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser", "User")
.WithOne("Cart")
.HasForeignKey("JjOnlineStore.Data.Entities.Cart", "UserId");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.CartItem", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.Cart", "Cart")
.WithMany("OrderedItems")
.HasForeignKey("CartId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("JjOnlineStore.Data.Entities.Product", "Product")
.WithMany("CartItems")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Order", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser", "User")
.WithMany("Orders")
.HasForeignKey("UserId");
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.OrderItem", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.Order", "Order")
.WithMany("OrderedItems")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("JjOnlineStore.Data.Entities.Product", "Product")
.WithMany("OrderItems")
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("JjOnlineStore.Data.Entities.Product", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.Category", "Category")
.WithMany("Products")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser")
.WithMany("Claims")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser")
.WithMany("Logins")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser")
.WithMany("Roles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("JjOnlineStore.Data.Entities.ApplicationUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
| 34.114458 | 125 | 0.469598 | [
"MIT"
] | profjordanov/JJ-Online-Store | Data/JjOnlineStore.Data.EF/Migrations/20181104070340_CartOrderArchitectureRefactoring.Designer.cs | 16,991 | C# |
namespace SplitScreenMe.Core.IO {
public struct BackupFile {
public string Source { get; set; }
public string BackupPath { get; set; }
public BackupFile(string source, string backup)
: this() {
Source = source;
BackupPath = backup;
}
}
}
| 24.307692 | 55 | 0.550633 | [
"MIT"
] | jackxriot/nucleuscoop | Master/SplitScreenMe.Core/Coop/Data/IO/BackupFile.cs | 318 | C# |
namespace Adnc.Shared.Consts.RegistrationCenter;
public static class RegisteredTypeConsts
{
public const string Direct = "direct";
public const string Consul = "consul";
public const string Nacos = "nacos";
public const string ClusterIP = "clusterip";
}
| 27.2 | 49 | 0.735294 | [
"MIT"
] | Jiayg/Adnc | src/ServerApi/Services/Shared/Adnc.Shared/Consts/RegistrationCenter/RegisteredTypeConsts.cs | 274 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.Web.V20200901.Outputs
{
[OutputType]
public sealed class SlotSwapStatusResponse
{
/// <summary>
/// The destination slot of the last swap operation.
/// </summary>
public readonly string DestinationSlotName;
/// <summary>
/// The source slot of the last swap operation.
/// </summary>
public readonly string SourceSlotName;
/// <summary>
/// The time the last successful slot swap completed.
/// </summary>
public readonly string TimestampUtc;
[OutputConstructor]
private SlotSwapStatusResponse(
string destinationSlotName,
string sourceSlotName,
string timestampUtc)
{
DestinationSlotName = destinationSlotName;
SourceSlotName = sourceSlotName;
TimestampUtc = timestampUtc;
}
}
}
| 28.604651 | 81 | 0.635772 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/Web/V20200901/Outputs/SlotSwapStatusResponse.cs | 1,230 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Dynamic;
using System.Linq;
using System.Text;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
using Microsoft.EntityFrameworkCore.ValueGeneration;
using Xunit;
// ReSharper disable InconsistentNaming
namespace Microsoft.EntityFrameworkCore.ModelBuilding
{
public abstract partial class ModelBuilderTest
{
public abstract class NonRelationshipTestBase : ModelBuilderTestBase
{
[ConditionalFact]
public void Can_set_model_annotation()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder = modelBuilder.HasAnnotation("Fus", "Ro");
Assert.NotNull(modelBuilder);
Assert.Equal("Ro", model.FindAnnotation("Fus").Value);
}
[ConditionalFact]
public void Model_is_readonly_after_Finalize()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.FinalizeModel();
Assert.ThrowsAny<Exception>(() => modelBuilder.HasAnnotation("Fus", "Ro"));
}
[ConditionalFact]
public virtual void Can_get_entity_builder_for_clr_type()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
var entityBuilder = modelBuilder.Entity<Customer>();
Assert.NotNull(entityBuilder);
Assert.Equal(typeof(Customer).FullName, model.FindEntityType(typeof(Customer)).Name);
}
[ConditionalFact]
public virtual void Can_set_entity_key_from_clr_property()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Customer>().HasKey(b => b.Id);
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(1, entity.FindPrimaryKey().Properties.Count);
Assert.Equal(Customer.IdProperty.Name, entity.FindPrimaryKey().Properties.First().Name);
}
[ConditionalFact]
public virtual void Entity_key_on_shadow_property_is_discovered_by_convention()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Order>().Property<int>("Id");
modelBuilder.Entity<Customer>();
modelBuilder.Ignore<Product>();
var entity = modelBuilder.Model.FindEntityType(typeof(Order));
modelBuilder.FinalizeModel();
Assert.Equal("Id", entity.FindPrimaryKey().Properties.Single().Name);
}
[ConditionalFact]
public virtual void Entity_key_on_secondary_property_is_discovered_by_convention_when_first_ignored()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<SelfRef>()
.Ignore(s => s.SelfRef1)
.Ignore(s => s.SelfRef2)
.Ignore(s => s.Id);
modelBuilder.FinalizeModel();
var entity = modelBuilder.Model.FindEntityType(typeof(SelfRef));
Assert.Equal(nameof(SelfRef.SelfRefId), entity.FindPrimaryKey().Properties.Single().Name);
}
[ConditionalFact]
public virtual void Can_set_entity_key_from_property_name_when_no_clr_property()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Customer>(
b =>
{
b.Property<int>(Customer.IdProperty.Name + 1);
b.Ignore(p => p.Details);
b.Ignore(p => p.Orders);
b.HasKey(Customer.IdProperty.Name + 1);
});
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(1, entity.FindPrimaryKey().Properties.Count);
Assert.Equal(Customer.IdProperty.Name + 1, entity.FindPrimaryKey().Properties.First().Name);
}
[ConditionalFact]
public virtual void Can_set_entity_key_from_clr_property_when_property_ignored()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>(
b =>
{
b.Ignore(Customer.IdProperty.Name);
b.HasKey(e => e.Id);
});
var entity = modelBuilder.Model.FindEntityType(typeof(Customer));
Assert.Equal(1, entity.FindPrimaryKey().Properties.Count);
Assert.Equal(Customer.IdProperty.Name, entity.FindPrimaryKey().Properties.First().Name);
}
[ConditionalFact]
public virtual void Can_set_composite_entity_key_from_clr_properties()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder
.Entity<Customer>()
.HasKey(
e => new { e.Id, e.Name });
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(2, entity.FindPrimaryKey().Properties.Count);
Assert.Equal(Customer.IdProperty.Name, entity.FindPrimaryKey().Properties.First().Name);
Assert.Equal(Customer.NameProperty.Name, entity.FindPrimaryKey().Properties.Last().Name);
}
[ConditionalFact]
public virtual void Can_set_composite_entity_key_from_property_names_when_mixed_properties()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Ignore<CustomerDetails>();
modelBuilder.Ignore<Order>();
modelBuilder.Entity<Customer>(
b =>
{
b.Property<string>(Customer.NameProperty.Name + "Shadow");
b.HasKey(Customer.IdProperty.Name, Customer.NameProperty.Name + "Shadow");
});
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(2, entity.FindPrimaryKey().Properties.Count);
Assert.Equal(Customer.IdProperty.Name, entity.FindPrimaryKey().Properties.First().Name);
Assert.Equal(Customer.NameProperty.Name + "Shadow", entity.FindPrimaryKey().Properties.Last().Name);
}
[ConditionalFact]
public virtual void Can_set_entity_key_with_annotations()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
var keyBuilder = modelBuilder
.Entity<Customer>()
.HasKey(
e => new { e.Id, e.Name });
keyBuilder.HasAnnotation("A1", "V1")
.HasAnnotation("A2", "V2");
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(
new[] { Customer.IdProperty.Name, Customer.NameProperty.Name }, entity.FindPrimaryKey().Properties.Select(p => p.Name));
Assert.Equal("V1", keyBuilder.Metadata["A1"]);
Assert.Equal("V2", keyBuilder.Metadata["A2"]);
}
[ConditionalFact]
public virtual void Can_upgrade_candidate_key_to_primary_key()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>().Property<int>(Customer.IdProperty.Name);
modelBuilder.Entity<Customer>().HasAlternateKey(b => b.Name);
modelBuilder.Ignore<OrderDetails>();
modelBuilder.Ignore<CustomerDetails>();
modelBuilder.Ignore<Order>();
var entity = modelBuilder.Model.FindEntityType(typeof(Customer));
var key = entity.FindKey(entity.FindProperty(Customer.NameProperty));
modelBuilder.Entity<Customer>().HasKey(b => b.Name);
modelBuilder.FinalizeModel();
var nameProperty = entity.FindPrimaryKey().Properties.Single();
Assert.Equal(Customer.NameProperty.Name, nameProperty.Name);
Assert.False(nameProperty.RequiresValueGenerator());
Assert.Equal(ValueGenerated.Never, nameProperty.ValueGenerated);
var idProperty = (IReadOnlyProperty)entity.FindProperty(Customer.IdProperty);
Assert.Equal(ValueGenerated.Never, idProperty.ValueGenerated);
}
[ConditionalFact]
public virtual void Can_set_alternate_key_from_clr_property()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Customer>().HasAlternateKey(b => b.AlternateKey);
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(
Customer.AlternateKeyProperty.Name,
entity.GetKeys().First(key => key != entity.FindPrimaryKey()).Properties.First().Name);
}
[ConditionalFact]
public virtual void Can_set_alternate_key_from_property_name_when_no_clr_property()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Customer>(
b =>
{
b.Property<int>(Customer.AlternateKeyProperty.Name + 1);
b.HasAlternateKey(Customer.AlternateKeyProperty.Name + 1);
});
var entity = model.FindEntityType(typeof(Customer));
Assert.Equal(
Customer.AlternateKeyProperty.Name + 1,
entity.GetKeys().First(key => key != entity.FindPrimaryKey()).Properties.First().Name);
}
[ConditionalFact]
public virtual void Can_set_alternate_key_from_clr_property_when_property_ignored()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>(
b =>
{
b.Ignore(Customer.AlternateKeyProperty.Name);
b.HasAlternateKey(e => e.AlternateKey);
});
var entity = modelBuilder.Model.FindEntityType(typeof(Customer));
Assert.Equal(
Customer.AlternateKeyProperty.Name,
entity.GetKeys().First(key => key != entity.FindPrimaryKey()).Properties.First().Name);
}
[ConditionalFact]
public virtual void Setting_alternate_key_makes_properties_required()
{
var modelBuilder = CreateModelBuilder();
var entityBuilder = modelBuilder.Entity<Customer>();
var entity = modelBuilder.Model.FindEntityType(typeof(Customer));
var alternateKeyProperty = entity.FindProperty(nameof(Customer.Name));
Assert.True(alternateKeyProperty.IsNullable);
entityBuilder.HasAlternateKey(e => e.Name);
Assert.False(alternateKeyProperty.IsNullable);
}
[ConditionalFact]
public virtual void Can_set_entity_annotation()
{
var modelBuilder = CreateModelBuilder();
var entityBuilder = modelBuilder
.Entity<Customer>()
.HasAnnotation("foo", "bar");
Assert.Equal("bar", entityBuilder.Metadata["foo"]);
}
[ConditionalFact]
public virtual void Can_set_property_annotation()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
modelBuilder
.Entity<Customer>()
.Property(c => c.Name).HasAnnotation("foo", "bar");
var property = modelBuilder.FinalizeModel().FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Name));
Assert.Equal("bar", property["foo"]);
}
[ConditionalFact]
public virtual void Can_set_property_annotation_when_no_clr_property()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
modelBuilder
.Entity<Customer>()
.Property<string>(Customer.NameProperty.Name).HasAnnotation("foo", "bar");
var property = modelBuilder.FinalizeModel().FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Name));
Assert.Equal("bar", property["foo"]);
}
[ConditionalFact]
public virtual void Can_set_property_annotation_by_type()
{
var modelBuilder = CreateModelBuilder(c => c.Properties<string>().HaveAnnotation("foo", "bar"));
modelBuilder.Ignore<Product>();
var propertyBuilder = modelBuilder
.Entity<Customer>()
.Property(c => c.Name).HasAnnotation("foo", "bar");
var property = modelBuilder.FinalizeModel().FindEntityType(typeof(Customer)).FindProperty(nameof(Customer.Name));
Assert.Equal("bar", property["foo"]);
}
[ConditionalFact]
public virtual void Properties_are_required_by_default_only_if_CLR_type_is_nullable()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down);
b.Property<int>("Charm");
b.Property<string>("Strange");
b.Property<int>("Top");
b.Property<string>("Bottom");
});
var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks));
Assert.False(entityType.FindProperty("Up").IsNullable);
Assert.True(entityType.FindProperty("Down").IsNullable);
Assert.False(entityType.FindProperty("Charm").IsNullable);
Assert.True(entityType.FindProperty("Strange").IsNullable);
Assert.False(entityType.FindProperty("Top").IsNullable);
Assert.True(entityType.FindProperty("Bottom").IsNullable);
}
[ConditionalFact]
public virtual void Properties_can_be_ignored()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Ignore(e => e.Up);
b.Ignore(e => e.Down);
b.Ignore("Charm");
b.Ignore("Strange");
b.Ignore("Top");
b.Ignore("Bottom");
b.Ignore("Shadow");
});
var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks));
Assert.Contains(nameof(Quarks.Id), entityType.GetProperties().Select(p => p.Name));
Assert.DoesNotContain(nameof(Quarks.Up), entityType.GetProperties().Select(p => p.Name));
Assert.DoesNotContain(nameof(Quarks.Down), entityType.GetProperties().Select(p => p.Name));
}
[ConditionalFact]
public virtual void Properties_can_be_ignored_by_type()
{
var modelBuilder = CreateModelBuilder(c => c.IgnoreAny<Guid>());
modelBuilder.Ignore<Product>();
modelBuilder.Entity<Customer>();
var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Customer));
Assert.Null(entityType.FindProperty(nameof(Customer.AlternateKey)));
}
[ConditionalFact]
public virtual void Int32_cannot_be_ignored()
{
Assert.Equal(CoreStrings.UnconfigurableType("int?", "Ignored", "Property", "int"),
Assert.Throws<InvalidOperationException>(() => CreateModelBuilder(c => c.IgnoreAny<int>())).Message);
}
[ConditionalFact]
public virtual void Object_cannot_be_ignored()
{
Assert.Equal(CoreStrings.UnconfigurableType("string", "Ignored", "Property", "object"),
Assert.Throws<InvalidOperationException>(() => CreateModelBuilder(c => c.IgnoreAny<object>())).Message);
}
[ConditionalFact]
public virtual void Can_ignore_a_property_that_is_part_of_explicit_entity_key()
{
var modelBuilder = CreateModelBuilder();
var entityBuilder = modelBuilder.Entity<Customer>();
entityBuilder.HasKey(e => e.Id);
entityBuilder.Ignore(e => e.Id);
Assert.Null(entityBuilder.Metadata.FindProperty(Customer.IdProperty.Name));
}
[ConditionalFact]
public virtual void Can_ignore_shadow_properties_when_they_have_been_added_explicitly()
{
var modelBuilder = CreateModelBuilder();
var entityBuilder = modelBuilder.Entity<Customer>();
entityBuilder.Property<string>("Shadow");
entityBuilder.Ignore("Shadow");
Assert.Null(entityBuilder.Metadata.FindProperty("Shadow"));
}
[ConditionalFact]
public virtual void Can_add_shadow_properties_when_they_have_been_ignored()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
modelBuilder.Entity<Customer>(
b =>
{
b.Ignore("Shadow");
b.Property<string>("Shadow");
});
var model = modelBuilder.FinalizeModel();
Assert.NotNull(model.FindEntityType(typeof(Customer)).FindProperty("Shadow"));
}
[ConditionalFact]
public virtual void Can_override_navigations_as_properties()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Customer>();
var customer = model.FindEntityType(typeof(Customer));
Assert.NotNull(customer.FindNavigation(nameof(Customer.Orders)));
modelBuilder.Entity<Customer>().Property(c => c.Orders);
Assert.Null(customer.FindNavigation(nameof(Customer.Orders)));
Assert.NotNull(customer.FindProperty(nameof(Customer.Orders)));
}
[ConditionalFact]
public virtual void Ignoring_a_navigation_property_removes_discovered_entity_types()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>(
b =>
{
b.Ignore(c => c.Details);
b.Ignore(c => c.Orders);
});
var model = modelBuilder.FinalizeModel();
Assert.Single(model.GetEntityTypes());
}
[ConditionalFact]
public virtual void Ignoring_a_navigation_property_removes_discovered_relationship()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>(
b =>
{
b.Ignore(c => c.Details);
b.Ignore(c => c.Orders);
});
modelBuilder.Entity<CustomerDetails>(b => b.Ignore(c => c.Customer));
var model = modelBuilder.FinalizeModel();
Assert.Empty(model.GetEntityTypes().First().GetForeignKeys());
Assert.Empty(model.GetEntityTypes().Last().GetForeignKeys());
Assert.Equal(2, model.GetEntityTypes().Count());
}
[ConditionalFact]
public virtual void Ignoring_a_base_type_removes_relationships()
{
var modelBuilder = CreateModelBuilder(c => c.IgnoreAny<INotifyPropertyChanged>());
modelBuilder.Entity<Customer>();
var model = modelBuilder.FinalizeModel();
Assert.Empty(model.GetEntityTypes().Single().GetForeignKeys());
}
[ConditionalFact]
public virtual void Properties_can_be_made_required()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).IsRequired();
b.Property(e => e.Down).IsRequired();
b.Property<int>("Charm").IsRequired();
b.Property<string>("Strange").IsRequired();
b.Property<int>("Top").IsRequired();
b.Property<string>("Bottom").IsRequired();
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.False(entityType.FindProperty("Up").IsNullable);
Assert.False(entityType.FindProperty("Down").IsNullable);
Assert.False(entityType.FindProperty("Charm").IsNullable);
Assert.False(entityType.FindProperty("Strange").IsNullable);
Assert.False(entityType.FindProperty("Top").IsNullable);
Assert.False(entityType.FindProperty("Bottom").IsNullable);
}
[ConditionalFact]
public virtual void Properties_can_be_made_optional()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Down).IsRequired(false);
b.Property<string>("Strange").IsRequired(false);
b.Property<string>("Bottom").IsRequired(false);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.True(entityType.FindProperty("Down").IsNullable);
Assert.True(entityType.FindProperty("Strange").IsNullable);
Assert.True(entityType.FindProperty("Bottom").IsNullable);
}
[ConditionalFact]
public virtual void Key_properties_cannot_be_made_optional()
{
Assert.Equal(
CoreStrings.KeyPropertyCannotBeNullable(nameof(Quarks.Down), nameof(Quarks), "{'" + nameof(Quarks.Down) + "'}"),
Assert.Throws<InvalidOperationException>(
() =>
CreateModelBuilder().Entity<Quarks>(
b =>
{
b.HasAlternateKey(
e => new { e.Down });
b.Property(e => e.Down).IsRequired(false);
})).Message);
}
[ConditionalFact]
public virtual void Non_nullable_properties_cannot_be_made_optional()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
Assert.Equal(
CoreStrings.CannotBeNullable("Up", "Quarks", "int"),
Assert.Throws<InvalidOperationException>(() => b.Property(e => e.Up).IsRequired(false)).Message);
Assert.Equal(
CoreStrings.CannotBeNullable("Charm", "Quarks", "int"),
Assert.Throws<InvalidOperationException>(() => b.Property<int>("Charm").IsRequired(false)).Message);
Assert.Equal(
CoreStrings.CannotBeNullable("Top", "Quarks", "int"),
Assert.Throws<InvalidOperationException>(() => b.Property<int>("Top").IsRequired(false)).Message);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.False(entityType.FindProperty("Up").IsNullable);
Assert.False(entityType.FindProperty("Charm").IsNullable);
Assert.False(entityType.FindProperty("Top").IsNullable);
}
[ConditionalFact]
public virtual void Properties_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property<int>("Up");
b.Property<int>("Gluon");
b.Property<string>("Down");
b.Property<string>("Photon");
});
var model = modelBuilder.FinalizeModel();
var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks));
Assert.False(entityType.FindProperty("Up").IsShadowProperty());
Assert.False(entityType.FindProperty("Down").IsShadowProperty());
Assert.True(entityType.FindProperty("Gluon").IsShadowProperty());
Assert.True(entityType.FindProperty("Photon").IsShadowProperty());
Assert.Equal(-1, entityType.FindProperty("Up").GetShadowIndex());
Assert.Equal(-1, entityType.FindProperty("Down").GetShadowIndex());
Assert.Equal(0, entityType.FindProperty("Gluon").GetShadowIndex());
Assert.Equal(1, entityType.FindProperty("Photon").GetShadowIndex());
}
[ConditionalFact]
public virtual void Properties_can_be_made_concurrency_tokens()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).IsConcurrencyToken();
b.Property(e => e.Down).IsConcurrencyToken(false);
b.Property<int>("Charm").IsConcurrencyToken();
b.Property<string>("Strange").IsConcurrencyToken(false);
b.Property<int>("Top").IsConcurrencyToken();
b.Property<string>("Bottom").IsConcurrencyToken(false);
b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangingAndChangedNotifications);
});
var model = modelBuilder.FinalizeModel();
var entityType = modelBuilder.FinalizeModel().FindEntityType(typeof(Quarks));
Assert.False(entityType.FindProperty(Customer.IdProperty.Name).IsConcurrencyToken);
Assert.True(entityType.FindProperty("Up").IsConcurrencyToken);
Assert.False(entityType.FindProperty("Down").IsConcurrencyToken);
Assert.True(entityType.FindProperty("Charm").IsConcurrencyToken);
Assert.False(entityType.FindProperty("Strange").IsConcurrencyToken);
Assert.True(entityType.FindProperty("Top").IsConcurrencyToken);
Assert.False(entityType.FindProperty("Bottom").IsConcurrencyToken);
Assert.Equal(0, entityType.FindProperty(Customer.IdProperty.Name).GetOriginalValueIndex());
Assert.Equal(3, entityType.FindProperty("Up").GetOriginalValueIndex());
Assert.Equal(-1, entityType.FindProperty("Down").GetOriginalValueIndex());
Assert.Equal(1, entityType.FindProperty("Charm").GetOriginalValueIndex());
Assert.Equal(-1, entityType.FindProperty("Strange").GetOriginalValueIndex());
Assert.Equal(2, entityType.FindProperty("Top").GetOriginalValueIndex());
Assert.Equal(-1, entityType.FindProperty("Bottom").GetOriginalValueIndex());
Assert.Equal(ChangeTrackingStrategy.ChangingAndChangedNotifications, entityType.GetChangeTrackingStrategy());
}
[ConditionalFact]
public virtual void Properties_can_have_access_mode_set()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down).HasField("_forDown").UsePropertyAccessMode(PropertyAccessMode.Field);
b.Property<int>("Charm").UsePropertyAccessMode(PropertyAccessMode.Property);
b.Property<string>("Strange").UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.Equal(PropertyAccessMode.PreferField, entityType.FindProperty("Up").GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.Field, entityType.FindProperty("Down").GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.Property, entityType.FindProperty("Charm").GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.FieldDuringConstruction, entityType.FindProperty("Strange").GetPropertyAccessMode());
}
[ConditionalFact]
public virtual void Access_mode_can_be_overridden_at_entity_and_property_levels()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.UsePropertyAccessMode(PropertyAccessMode.Field);
modelBuilder.Entity<Hob>(b =>
{
b.HasKey(e => e.Id1);
});
modelBuilder.Ignore<Nob>();
modelBuilder.Entity<Quarks>(
b =>
{
b.UsePropertyAccessMode(PropertyAccessMode.FieldDuringConstruction);
b.Property(e => e.Up).UsePropertyAccessMode(PropertyAccessMode.Property);
b.Property(e => e.Down).HasField("_forDown");
});
var model = modelBuilder.FinalizeModel();
Assert.Equal(PropertyAccessMode.Field, model.GetPropertyAccessMode());
var hobsType = (IReadOnlyEntityType)model.FindEntityType(typeof(Hob));
Assert.Equal(PropertyAccessMode.Field, hobsType.GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.Field, hobsType.FindProperty("Id1").GetPropertyAccessMode());
var quarksType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.Equal(PropertyAccessMode.FieldDuringConstruction, quarksType.GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.FieldDuringConstruction, quarksType.FindProperty("Down").GetPropertyAccessMode());
Assert.Equal(PropertyAccessMode.Property, quarksType.FindProperty("Up").GetPropertyAccessMode());
}
[ConditionalFact]
public virtual void Properties_can_have_provider_type_set()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down).HasConversion<byte[]>();
b.Property<int>("Charm").HasConversion(typeof(long), typeof(CustomValueComparer<int>));
b.Property<string>("Strange").HasConversion<byte[]>();
b.Property<string>("Strange").HasConversion((Type)null);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
var up = entityType.FindProperty("Up");
Assert.Null(up.GetProviderClrType());
Assert.IsType<ValueComparer.DefaultValueComparer<int>>(up.GetValueComparer());
var down = entityType.FindProperty("Down");
Assert.Same(typeof(byte[]), down.GetProviderClrType());
Assert.IsType<ValueComparer.DefaultValueComparer<string>>(down.GetValueComparer());
var charm = entityType.FindProperty("Charm");
Assert.Same(typeof(long), charm.GetProviderClrType());
Assert.IsType<CustomValueComparer<int>>(charm.GetValueComparer());
var strange = entityType.FindProperty("Strange");
Assert.Null(strange.GetProviderClrType());
Assert.IsType<ValueComparer.DefaultValueComparer<string>>(strange.GetValueComparer());
}
[ConditionalFact]
public virtual void Properties_can_have_provider_type_set_for_type()
{
var modelBuilder = CreateModelBuilder(c => c.Properties<string>().HaveConversion<byte[]>());
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down);
b.Property<int>("Charm");
b.Property<string>("Strange");
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty("Up").GetProviderClrType());
Assert.Same(typeof(byte[]), entityType.FindProperty("Down").GetProviderClrType());
Assert.Null(entityType.FindProperty("Charm").GetProviderClrType());
Assert.Same(typeof(byte[]), entityType.FindProperty("Strange").GetProviderClrType());
}
[ConditionalFact]
public virtual void Properties_can_have_value_converter_set_non_generic()
{
var modelBuilder = CreateModelBuilder();
ValueConverter stringConverter = new StringToBytesConverter(Encoding.UTF8);
ValueConverter intConverter = new CastingConverter<int, long>();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down).HasConversion(stringConverter);
b.Property<int>("Charm").HasConversion(intConverter);
b.Property<string>("Strange").HasConversion(stringConverter);
b.Property<string>("Strange").HasConversion((ValueConverter)null);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty("Up").GetValueConverter());
Assert.Same(stringConverter, entityType.FindProperty("Down").GetValueConverter());
Assert.Same(intConverter, entityType.FindProperty("Charm").GetValueConverter());
Assert.Null(entityType.FindProperty("Strange").GetValueConverter());
}
[ConditionalFact]
public virtual void Properties_can_have_value_converter_type_set()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down).HasConversion(typeof(UTF8StringToBytesConverter));
b.Property<int>("Charm").HasConversion<CastingConverter<int, long>, CustomValueComparer<int>>();
b.Property<string>("Strange").HasConversion(typeof(UTF8StringToBytesConverter), typeof(CustomValueComparer<string>));
b.Property<string>("Strange").HasConversion((ValueConverter)null, null);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty("Up").GetValueConverter());
var down = entityType.FindProperty("Down");
Assert.IsType<UTF8StringToBytesConverter>(down.GetValueConverter());
Assert.IsType<ValueComparer.DefaultValueComparer<string>>(down.GetValueComparer());
var charm = entityType.FindProperty("Charm");
Assert.IsType<CastingConverter<int, long>>(charm.GetValueConverter());
Assert.IsType<CustomValueComparer<int>>(charm.GetValueComparer());
Assert.Null(entityType.FindProperty("Strange").GetValueConverter());
Assert.IsAssignableFrom<ValueComparer.DefaultValueComparer<string>>(entityType.FindProperty("Strange").GetValueComparer());
}
private class UTF8StringToBytesConverter : StringToBytesConverter
{
public UTF8StringToBytesConverter()
: base(Encoding.UTF8)
{
}
}
private class CustomValueComparer<T> : ValueComparer<T>
{
public CustomValueComparer()
: base(false)
{
}
}
[ConditionalFact]
public virtual void Properties_can_have_value_converter_set_inline()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up);
b.Property(e => e.Down).HasConversion(v => v.ToCharArray(), v => new string(v));
b.Property<int>("Charm").HasConversion(v => (long)v, v => (int)v);
});
var model = (IReadOnlyModel)modelBuilder.Model;
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty("Up").GetValueConverter());
Assert.NotNull(entityType.FindProperty("Down").GetValueConverter());
Assert.NotNull(entityType.FindProperty("Charm").GetValueConverter());
}
[ConditionalFact]
public virtual void IEnumerable_properties_with_value_converter_set_are_not_discovered_as_navigations()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<DynamicProperty>(
b =>
{
b.Property(e => e.ExpandoObject).HasConversion(
v => (string)((IDictionary<string, object>)v)["Value"], v => DeserializeExpandoObject(v));
var comparer = new ValueComparer<ExpandoObject>(
(v1, v2) => v1.SequenceEqual(v2),
v => v.GetHashCode());
b.Property(e => e.ExpandoObject).Metadata.SetValueComparer(comparer);
});
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.GetEntityTypes().Single();
Assert.NotNull(entityType.FindProperty(nameof(DynamicProperty.ExpandoObject)).GetValueConverter());
Assert.NotNull(entityType.FindProperty(nameof(DynamicProperty.ExpandoObject)).GetValueComparer());
}
private static ExpandoObject DeserializeExpandoObject(string value)
{
dynamic obj = new ExpandoObject();
obj.Value = value;
return obj;
}
private class ExpandoObjectConverter : ValueConverter<ExpandoObject, string>
{
public ExpandoObjectConverter()
: base(v => (string)((IDictionary<string, object>)v)["Value"], v => DeserializeExpandoObject(v))
{
}
}
private class ExpandoObjectComparer : ValueComparer<ExpandoObject>
{
public ExpandoObjectComparer()
: base((v1, v2) => v1.SequenceEqual(v2), v => v.GetHashCode())
{
}
}
[ConditionalFact]
public virtual void Properties_can_have_value_converter_configured_by_type()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties(typeof(IWrapped<>)).AreUnicode(false);
c.Properties<WrappedStringBase>().HaveMaxLength(20);
c.Properties<WrappedString>().HaveConversion(typeof(WrappedStringToStringConverter));
});
modelBuilder.Entity<WrappedStringEntity>();
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.GetEntityTypes().Single();
var wrappedProperty = entityType.FindProperty(nameof(WrappedStringEntity.WrappedString));
Assert.False(wrappedProperty.IsUnicode());
Assert.Equal(20, wrappedProperty.GetMaxLength());
Assert.IsType<WrappedStringToStringConverter>(wrappedProperty.GetValueConverter());
Assert.IsType<ValueComparer<WrappedString>>(wrappedProperty.GetValueComparer());
}
[ConditionalFact]
public virtual void Value_converter_configured_on_base_type_is_not_applied()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties<WrappedStringBase>().HaveConversion(typeof(WrappedStringToStringConverter));
});
modelBuilder.Entity<WrappedStringEntity>();
Assert.Equal(CoreStrings.PropertyNotMapped(
nameof(WrappedStringEntity), nameof(WrappedStringEntity.WrappedString), nameof(WrappedString)),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
private interface IWrapped<T>
{
T Value { get; init; }
}
private abstract class WrappedStringBase : IWrapped<string>
{
public abstract string Value { get; init; }
}
private class WrappedString : WrappedStringBase
{
public override string Value { get; init; }
}
private class WrappedStringEntity
{
public int Id { get; set; }
public WrappedString WrappedString { get; set; }
}
private class WrappedStringToStringConverter : ValueConverter<WrappedString, string>
{
public WrappedStringToStringConverter()
: base(v => v.Value, v => new WrappedString { Value = v })
{
}
}
[ConditionalFact]
public virtual void Throws_for_conflicting_base_configurations_by_type()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties<WrappedString>();
c.IgnoreAny<IWrapped<string>>();
});
Assert.Equal(CoreStrings.TypeConfigurationConflict(
nameof(WrappedString), "Property",
"IWrapped<string>", "Ignored"),
Assert.Throws<InvalidOperationException>(() => modelBuilder.Entity<WrappedStringEntity>()).Message);
}
[ConditionalFact]
public virtual void Value_converter_type_is_checked()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
Assert.Equal(
CoreStrings.ConverterPropertyMismatch("string", "Quarks", "Up", "int"),
Assert.Throws<InvalidOperationException>(
() => b.Property(e => e.Up).HasConversion(
new StringToBytesConverter(Encoding.UTF8))).Message);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty("Up").GetValueConverter());
}
[ConditionalFact]
public virtual void Properties_can_have_field_set()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property<int>("Up").HasField("_forUp");
b.Property(e => e.Down).HasField("_forDown");
b.Property<int?>("_forWierd").HasField("_forWierd");
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal("_forUp", entityType.FindProperty("Up").GetFieldName());
Assert.Equal("_forDown", entityType.FindProperty("Down").GetFieldName());
Assert.Equal("_forWierd", entityType.FindProperty("_forWierd").GetFieldName());
}
[ConditionalFact]
public virtual void HasField_throws_if_field_is_not_found()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
Assert.Equal(
CoreStrings.MissingBackingField("_notFound", nameof(Quarks.Down), nameof(Quarks)),
Assert.Throws<InvalidOperationException>(() => b.Property(e => e.Down).HasField("_notFound")).Message);
});
}
[ConditionalFact]
public virtual void HasField_throws_if_field_is_wrong_type()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
Assert.Equal(
CoreStrings.BadBackingFieldType("_forUp", "int", nameof(Quarks), nameof(Quarks.Down), "string"),
Assert.Throws<InvalidOperationException>(() => b.Property(e => e.Down).HasField("_forUp")).Message);
});
}
[ConditionalFact]
public virtual void Properties_can_be_set_to_generate_values_on_Add()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.HasKey(e => e.Id);
b.Property(e => e.Up).ValueGeneratedOnAddOrUpdate();
b.Property(e => e.Down).ValueGeneratedNever();
b.Property<int>("Charm").Metadata.ValueGenerated = ValueGenerated.OnUpdateSometimes;
b.Property<string>("Strange").ValueGeneratedNever();
b.Property<int>("Top").ValueGeneratedOnAddOrUpdate();
b.Property<string>("Bottom").ValueGeneratedOnUpdate();
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal(ValueGenerated.OnAdd, entityType.FindProperty(Customer.IdProperty.Name).ValueGenerated);
Assert.Equal(ValueGenerated.OnAddOrUpdate, entityType.FindProperty("Up").ValueGenerated);
Assert.Equal(ValueGenerated.Never, entityType.FindProperty("Down").ValueGenerated);
Assert.Equal(ValueGenerated.OnUpdateSometimes, entityType.FindProperty("Charm").ValueGenerated);
Assert.Equal(ValueGenerated.Never, entityType.FindProperty("Strange").ValueGenerated);
Assert.Equal(ValueGenerated.OnAddOrUpdate, entityType.FindProperty("Top").ValueGenerated);
Assert.Equal(ValueGenerated.OnUpdate, entityType.FindProperty("Bottom").ValueGenerated);
}
[ConditionalFact]
public virtual void Properties_can_set_row_version()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.HasKey(e => e.Id);
b.Property(e => e.Up).IsRowVersion();
b.Property(e => e.Down).ValueGeneratedNever();
b.Property<int>("Charm").IsRowVersion();
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal(ValueGenerated.OnAddOrUpdate, entityType.FindProperty("Up").ValueGenerated);
Assert.Equal(ValueGenerated.Never, entityType.FindProperty("Down").ValueGenerated);
Assert.Equal(ValueGenerated.OnAddOrUpdate, entityType.FindProperty("Charm").ValueGenerated);
Assert.True(entityType.FindProperty("Up").IsConcurrencyToken);
Assert.False(entityType.FindProperty("Down").IsConcurrencyToken);
Assert.True(entityType.FindProperty("Charm").IsConcurrencyToken);
}
[ConditionalFact]
public virtual void Can_set_max_length_for_properties()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).HasMaxLength(0);
b.Property(e => e.Down).HasMaxLength(100);
b.Property<int>("Charm").HasMaxLength(0);
b.Property<string>("Strange").HasMaxLength(100);
b.Property<int>("Top").HasMaxLength(0);
b.Property<string>("Bottom").HasMaxLength(100);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty(Customer.IdProperty.Name).GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Up").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Down").GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Charm").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Strange").GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Top").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Bottom").GetMaxLength());
}
[ConditionalFact]
public virtual void Can_set_max_length_for_property_type()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties<int>().HaveMaxLength(0);
c.Properties<string>().HaveMaxLength(100);
});
modelBuilder.Entity<Quarks>(
b =>
{
b.Property<int>("Charm");
b.Property<string>("Strange");
b.Property<int>("Top");
b.Property<string>("Bottom");
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal(0, entityType.FindProperty(Customer.IdProperty.Name).GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Up").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Down").GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Charm").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Strange").GetMaxLength());
Assert.Equal(0, entityType.FindProperty("Top").GetMaxLength());
Assert.Equal(100, entityType.FindProperty("Bottom").GetMaxLength());
}
[ConditionalFact]
public virtual void Can_set_precision_and_scale_for_properties()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).HasPrecision(1, 0);
b.Property(e => e.Down).HasPrecision(100, 10);
b.Property<int>("Charm").HasPrecision(1, 0);
b.Property<string>("Strange").HasPrecision(100, 10);
b.Property<int>("Top").HasPrecision(1, 0);
b.Property<string>("Bottom").HasPrecision(100, 10);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty(Customer.IdProperty.Name).GetPrecision());
Assert.Null(entityType.FindProperty(Customer.IdProperty.Name).GetScale());
Assert.Equal(1, entityType.FindProperty("Up").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Up").GetScale());
Assert.Equal(100, entityType.FindProperty("Down").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Down").GetScale());
Assert.Equal(1, entityType.FindProperty("Charm").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Charm").GetScale());
Assert.Equal(100, entityType.FindProperty("Strange").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Strange").GetScale());
Assert.Equal(1, entityType.FindProperty("Top").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Top").GetScale());
Assert.Equal(100, entityType.FindProperty("Bottom").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Bottom").GetScale());
}
[ConditionalFact]
public virtual void Can_set_precision_and_scale_for_property_type()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties<int>().HavePrecision(1, 0);
c.Properties<string>().HavePrecision(100, 10);
});
modelBuilder.Entity<Quarks>(
b =>
{
b.Property<int>("Charm");
b.Property<string>("Strange");
b.Property<int>("Top");
b.Property<string>("Bottom");
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal(1, entityType.FindProperty(Customer.IdProperty.Name).GetPrecision());
Assert.Equal(0, entityType.FindProperty(Customer.IdProperty.Name).GetScale());
Assert.Equal(1, entityType.FindProperty("Up").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Up").GetScale());
Assert.Equal(100, entityType.FindProperty("Down").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Down").GetScale());
Assert.Equal(1, entityType.FindProperty("Charm").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Charm").GetScale());
Assert.Equal(100, entityType.FindProperty("Strange").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Strange").GetScale());
Assert.Equal(1, entityType.FindProperty("Top").GetPrecision());
Assert.Equal(0, entityType.FindProperty("Top").GetScale());
Assert.Equal(100, entityType.FindProperty("Bottom").GetPrecision());
Assert.Equal(10, entityType.FindProperty("Bottom").GetScale());
}
[ConditionalFact]
public virtual void Can_set_custom_value_generator_for_properties()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).HasValueGenerator<CustomValueGenerator>();
b.Property(e => e.Down).HasValueGenerator(typeof(CustomValueGenerator));
b.Property<int>("Charm").HasValueGenerator((_, __) => new CustomValueGenerator());
b.Property<string>("Strange").HasValueGenerator<CustomValueGenerator>();
b.Property<int>("Top").HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory));
b.Property<string>("Bottom").HasValueGeneratorFactory<CustomValueGeneratorFactory>();
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty(Customer.IdProperty.Name).GetValueGeneratorFactory());
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Up").GetValueGeneratorFactory()(null, null));
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Down").GetValueGeneratorFactory()(null, null));
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Charm").GetValueGeneratorFactory()(null, null));
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Strange").GetValueGeneratorFactory()(null, null));
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Top").GetValueGeneratorFactory()(null, null));
Assert.IsType<CustomValueGenerator>(entityType.FindProperty("Bottom").GetValueGeneratorFactory()(null, null));
}
private class CustomValueGenerator : ValueGenerator<int>
{
public override int Next(EntityEntry entry)
{
throw new NotImplementedException();
}
public override bool GeneratesTemporaryValues
=> false;
}
private class CustomValueGeneratorFactory : ValueGeneratorFactory
{
public override ValueGenerator Create(IProperty property, IEntityType entityType)
=> new CustomValueGenerator();
}
[ConditionalFact]
public virtual void Throws_for_bad_value_generator_type()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
Assert.Equal(
CoreStrings.BadValueGeneratorType(nameof(Random), nameof(ValueGenerator)),
Assert.Throws<ArgumentException>(() => b.Property(e => e.Down).HasValueGenerator(typeof(Random))).Message);
});
}
[ConditionalFact]
public virtual void Throws_for_value_generator_that_cannot_be_constructed()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).HasValueGenerator<BadCustomValueGenerator1>();
b.Property(e => e.Down).HasValueGenerator<BadCustomValueGenerator2>();
});
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Equal(
CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator1), "HasValueGenerator"),
Assert.Throws<InvalidOperationException>(
() => entityType.FindProperty("Up").GetValueGeneratorFactory()(null, null)).Message);
Assert.Equal(
CoreStrings.CannotCreateValueGenerator(nameof(BadCustomValueGenerator2), "HasValueGenerator"),
Assert.Throws<InvalidOperationException>(
() => entityType.FindProperty("Down").GetValueGeneratorFactory()(null, null)).Message);
}
private class BadCustomValueGenerator1 : CustomValueGenerator
{
public BadCustomValueGenerator1(string foo)
{
}
}
private abstract class BadCustomValueGenerator2 : CustomValueGenerator
{
}
[ConditionalFact]
public virtual void Throws_for_collection_of_string()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<StringCollectionEntity>();
Assert.Equal(
CoreStrings.PropertyNotAdded(
nameof(StringCollectionEntity), nameof(StringCollectionEntity.Property), "ICollection<string>"),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
protected class StringCollectionEntity
{
public ICollection<string> Property { get; set; }
}
[ConditionalFact]
public virtual void Object_cannot_be_configured_as_property()
{
Assert.Equal(CoreStrings.UnconfigurableType("Dictionary<string, object>", "Property", "SharedTypeEntityType", "object"),
Assert.Throws<InvalidOperationException>(() => CreateModelBuilder(c => c.Properties<object>())).Message);
}
[ConditionalFact]
public virtual void Property_bag_cannot_be_configured_as_property()
{
Assert.Equal(CoreStrings.UnconfigurableType("Dictionary<string, object>", "Property", "SharedTypeEntityType", "Dictionary<string, object>"),
Assert.Throws<InvalidOperationException>(() => CreateModelBuilder(c => c.Properties<Dictionary<string, object>>())).Message);
Assert.Equal(CoreStrings.UnconfigurableType("Dictionary<string, object>", "Property", "SharedTypeEntityType", "IDictionary<string, object>"),
Assert.Throws<InvalidOperationException>(() => CreateModelBuilder(c => c.Properties<IDictionary<string, object>>())).Message);
}
[ConditionalFact]
protected virtual void Mapping_throws_for_non_ignored_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<OneDee>();
Assert.Equal(
CoreStrings.PropertyNotAdded(
typeof(OneDee).ShortDisplayName(), "One", typeof(int[]).ShortDisplayName()),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
[ConditionalFact]
protected virtual void Mapping_ignores_ignored_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<OneDee>().Ignore(e => e.One);
var model = modelBuilder.FinalizeModel();
Assert.Null(model.FindEntityType(typeof(OneDee)).FindProperty("One"));
}
[ConditionalFact]
protected virtual void Mapping_throws_for_non_ignored_two_dimensional_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<TwoDee>();
Assert.Equal(
CoreStrings.PropertyNotAdded(
typeof(TwoDee).ShortDisplayName(), "Two", typeof(int[,]).ShortDisplayName()),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
[ConditionalFact]
protected virtual void Mapping_ignores_ignored_two_dimensional_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<TwoDee>().Ignore(e => e.Two);
var model = modelBuilder.FinalizeModel();
Assert.Null(model.FindEntityType(typeof(TwoDee)).FindProperty("Two"));
}
[ConditionalFact]
protected virtual void Mapping_throws_for_non_ignored_three_dimensional_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<ThreeDee>();
Assert.Equal(
CoreStrings.PropertyNotAdded(
typeof(ThreeDee).ShortDisplayName(), "Three", typeof(int[,,]).ShortDisplayName()),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
[ConditionalFact]
protected virtual void Mapping_ignores_ignored_three_dimensional_array()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<ThreeDee>().Ignore(e => e.Three);
var model = modelBuilder.FinalizeModel();
Assert.Null(model.FindEntityType(typeof(ThreeDee)).FindProperty("Three"));
}
protected class OneDee
{
public int Id { get; set; }
public int[] One { get; set; }
}
protected class TwoDee
{
public int Id { get; set; }
public int[,] Two { get; set; }
}
protected class ThreeDee
{
public int Id { get; set; }
public int[,,] Three { get; set; }
}
[ConditionalFact]
protected virtual void Throws_for_int_keyed_dictionary()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<IntDict>();
Assert.Equal(
CoreStrings.EntityRequiresKey(typeof(Dictionary<int, string>).ShortDisplayName()),
Assert.Throws<InvalidOperationException>(() => modelBuilder.FinalizeModel()).Message);
}
protected class IntDict
{
public int Id { get; set; }
public Dictionary<int, string> Notes { get; set; }
}
[ConditionalFact]
public virtual void Can_set_unicode_for_properties()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Quarks>(
b =>
{
b.Property(e => e.Up).IsUnicode();
b.Property(e => e.Down).IsUnicode(false);
b.Property<int>("Charm").IsUnicode();
b.Property<string>("Strange").IsUnicode(false);
b.Property<int>("Top").IsUnicode();
b.Property<string>("Bottom").IsUnicode(false);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.Null(entityType.FindProperty(Customer.IdProperty.Name).IsUnicode());
Assert.True(entityType.FindProperty("Up").IsUnicode());
Assert.False(entityType.FindProperty("Down").IsUnicode());
Assert.True(entityType.FindProperty("Charm").IsUnicode());
Assert.False(entityType.FindProperty("Strange").IsUnicode());
Assert.True(entityType.FindProperty("Top").IsUnicode());
Assert.False(entityType.FindProperty("Bottom").IsUnicode());
}
[ConditionalFact]
public virtual void Can_set_unicode_for_property_type()
{
var modelBuilder = CreateModelBuilder(c =>
{
c.Properties<int>().AreUnicode();
c.Properties<string>().AreUnicode(false);
});
modelBuilder.Entity<Quarks>(
b =>
{
b.Property<int>("Charm");
b.Property<string>("Strange");
b.Property<int>("Top");
b.Property<string>("Bottom");
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Quarks));
Assert.True(entityType.FindProperty(Customer.IdProperty.Name).IsUnicode());
Assert.True(entityType.FindProperty("Up").IsUnicode());
Assert.False(entityType.FindProperty("Down").IsUnicode());
Assert.True(entityType.FindProperty("Charm").IsUnicode());
Assert.False(entityType.FindProperty("Strange").IsUnicode());
Assert.True(entityType.FindProperty("Top").IsUnicode());
Assert.False(entityType.FindProperty("Bottom").IsUnicode());
}
[ConditionalFact]
public virtual void PropertyBuilder_methods_can_be_chained()
{
CreateModelBuilder()
.Entity<Quarks>()
.Property(e => e.Up)
.IsRequired()
.HasAnnotation("A", "V")
.IsConcurrencyToken()
.ValueGeneratedNever()
.ValueGeneratedOnAdd()
.ValueGeneratedOnAddOrUpdate()
.ValueGeneratedOnUpdate()
.IsUnicode()
.HasMaxLength(100)
.HasPrecision(10, 1)
.HasValueGenerator<CustomValueGenerator>()
.HasValueGenerator(typeof(CustomValueGenerator))
.HasValueGeneratorFactory<CustomValueGeneratorFactory>()
.HasValueGeneratorFactory(typeof(CustomValueGeneratorFactory))
.HasValueGenerator((_, __) => null)
.IsRequired();
}
[ConditionalFact]
public virtual void Can_add_index()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
modelBuilder
.Entity<Customer>()
.HasIndex(ix => ix.Name);
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Customer));
var index = entityType.GetIndexes().Single();
Assert.Equal(Customer.NameProperty.Name, index.Properties.Single().Name);
}
[ConditionalFact]
public virtual void Can_add_index_when_no_clr_property()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
modelBuilder
.Entity<Customer>(
b =>
{
b.Property<int>("Index");
b.HasIndex("Index");
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Customer));
var index = entityType.GetIndexes().Single();
Assert.Equal("Index", index.Properties.Single().Name);
}
[ConditionalFact]
public virtual void Can_add_multiple_indexes()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
var entityBuilder = modelBuilder.Entity<Customer>();
entityBuilder.HasIndex(ix => ix.Id).IsUnique();
entityBuilder.HasIndex(ix => ix.Name).HasAnnotation("A1", "V1");
entityBuilder.HasIndex(ix => ix.Id, "Named");
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(Customer));
var idProperty = entityType.FindProperty(nameof(Customer.Id));
var nameProperty = entityType.FindProperty(nameof(Customer.Name));
Assert.Equal(3, entityType.GetIndexes().Count());
var firstIndex = entityType.FindIndex(idProperty);
Assert.True(firstIndex.IsUnique);
var secondIndex = entityType.FindIndex(nameProperty);
Assert.False(secondIndex.IsUnique);
Assert.Equal("V1", secondIndex["A1"]);
var namedIndex = entityType.FindIndex("Named");
Assert.False(namedIndex.IsUnique);
}
[ConditionalFact]
public virtual void Can_add_contained_indexes()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Product>();
var entityBuilder = modelBuilder.Entity<Customer>();
var firstIndexBuilder = entityBuilder.HasIndex(
ix => new { ix.Id, ix.AlternateKey }).IsUnique();
var secondIndexBuilder = entityBuilder.HasIndex(
ix => new { ix.Id });
var model = modelBuilder.FinalizeModel();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(Customer));
Assert.Equal(2, entityType.GetIndexes().Count());
Assert.True(firstIndexBuilder.Metadata.IsUnique);
Assert.False(secondIndexBuilder.Metadata.IsUnique);
}
[ConditionalFact]
public virtual void Can_set_primary_key_by_convention_for_user_specified_shadow_property()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
var entityBuilder = modelBuilder.Entity<EntityWithoutId>();
var entityType = (IReadOnlyEntityType)model.FindEntityType(typeof(EntityWithoutId));
Assert.Null(entityType.FindPrimaryKey());
entityBuilder.Property<int>("Id");
Assert.NotNull(entityType.FindPrimaryKey());
AssertEqual(new[] { "Id" }, entityType.FindPrimaryKey().Properties.Select(p => p.Name));
}
[ConditionalFact]
public virtual void Can_ignore_explicit_interface_implementation_property()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<EntityBase>().HasNoKey().Ignore(e => ((IEntityBase)e).Target);
Assert.DoesNotContain(
nameof(IEntityBase.Target),
modelBuilder.Model.FindEntityType(typeof(EntityBase)).GetProperties().Select(p => p.Name));
modelBuilder.Entity<EntityBase>().Property(e => ((IEntityBase)e).Target);
Assert.Contains(
nameof(IEntityBase.Target),
modelBuilder.Model.FindEntityType(typeof(EntityBase)).GetProperties().Select(p => p.Name));
}
[ConditionalFact]
public virtual void Can_set_key_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasKey(e => e.Id);
var model = modelBuilder.FinalizeModel();
var entity = model.FindEntityType(typeof(EntityWithFields));
var primaryKey = entity.FindPrimaryKey();
Assert.NotNull(primaryKey);
var property = Assert.Single(primaryKey.Properties);
Assert.Equal(nameof(EntityWithFields.Id), property.Name);
Assert.Null(property.PropertyInfo);
Assert.NotNull(property.FieldInfo);
}
[ConditionalFact]
public virtual void Can_set_composite_key_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasKey(e => new { e.TenantId, e.CompanyId });
var model = modelBuilder.FinalizeModel();
var entity = model.FindEntityType(typeof(EntityWithFields));
var primaryKeyProperties = entity.FindPrimaryKey().Properties;
Assert.Equal(2, primaryKeyProperties.Count);
var first = primaryKeyProperties[0];
var second = primaryKeyProperties[1];
Assert.Equal(nameof(EntityWithFields.TenantId), first.Name);
Assert.Null(first.PropertyInfo);
Assert.NotNull(first.FieldInfo);
Assert.Equal(nameof(EntityWithFields.CompanyId), second.Name);
Assert.Null(second.PropertyInfo);
Assert.NotNull(second.FieldInfo);
}
[ConditionalFact]
public virtual void Can_set_alternate_key_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasAlternateKey(e => e.CompanyId);
var entity = modelBuilder.Model.FindEntityType(typeof(EntityWithFields));
var properties = entity.GetProperties();
Assert.Single(properties);
var property = properties.Single();
Assert.Equal(nameof(EntityWithFields.CompanyId), property.Name);
Assert.Null(property.PropertyInfo);
Assert.NotNull(property.FieldInfo);
var keys = entity.GetKeys();
var key = Assert.Single(keys);
Assert.Equal(properties, key.Properties);
}
[ConditionalFact]
public virtual void Can_set_composite_alternate_key_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasAlternateKey(e => new { e.TenantId, e.CompanyId });
var keys = modelBuilder.Model.FindEntityType(typeof(EntityWithFields)).GetKeys();
Assert.Single(keys);
var properties = keys.Single().Properties;
Assert.Equal(2, properties.Count);
var first = properties[0];
var second = properties[1];
Assert.Equal(nameof(EntityWithFields.TenantId), first.Name);
Assert.Null(first.PropertyInfo);
Assert.NotNull(first.FieldInfo);
Assert.Equal(nameof(EntityWithFields.CompanyId), second.Name);
Assert.Null(second.PropertyInfo);
Assert.NotNull(second.FieldInfo);
}
[ConditionalFact]
public virtual void Can_call_Property_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().Property(e => e.Id);
var model = modelBuilder.FinalizeModel();
var properties = model.FindEntityType(typeof(EntityWithFields)).GetProperties();
var property = Assert.Single(properties);
Assert.Equal(nameof(EntityWithFields.Id), property.Name);
Assert.Null(property.PropertyInfo);
Assert.NotNull(property.FieldInfo);
}
[ConditionalFact]
public virtual void Can_set_index_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasNoKey().HasIndex(e => e.CompanyId);
var model = modelBuilder.FinalizeModel();
var indexes = model.FindEntityType(typeof(EntityWithFields)).GetIndexes();
var index = Assert.Single(indexes);
var property = Assert.Single(index.Properties);
Assert.Null(property.PropertyInfo);
Assert.NotNull(property.FieldInfo);
}
[ConditionalFact]
public virtual void Can_set_composite_index_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>().HasNoKey().HasIndex(e => new { e.TenantId, e.CompanyId });
var model = modelBuilder.FinalizeModel();
var indexes = model.FindEntityType(typeof(EntityWithFields)).GetIndexes();
var index = Assert.Single(indexes);
Assert.Equal(2, index.Properties.Count);
var properties = index.Properties;
var first = properties[0];
var second = properties[1];
Assert.Equal(nameof(EntityWithFields.TenantId), first.Name);
Assert.Null(first.PropertyInfo);
Assert.NotNull(first.FieldInfo);
Assert.Equal(nameof(EntityWithFields.CompanyId), second.Name);
Assert.Null(second.PropertyInfo);
Assert.NotNull(second.FieldInfo);
}
[ConditionalFact]
public virtual void Can_ignore_a_field_on_an_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<EntityWithFields>()
.Ignore(e => e.CompanyId)
.HasKey(e => e.Id);
var model = modelBuilder.FinalizeModel();
var entity = model.FindEntityType(typeof(EntityWithFields));
var property = Assert.Single(entity.GetProperties());
Assert.Equal(nameof(EntityWithFields.Id), property.Name);
}
[ConditionalFact]
public virtual void Can_ignore_a_field_on_a_keyless_entity_with_fields()
{
var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder();
modelBuilder.Entity<KeylessEntityWithFields>()
.HasNoKey()
.Ignore(e => e.FirstName)
.Property(e => e.LastName);
var model = modelBuilder.FinalizeModel();
var entity = model.FindEntityType(typeof(KeylessEntityWithFields));
var property = Assert.Single(entity.GetProperties());
Assert.Equal(nameof(KeylessEntityWithFields.LastName), property.Name);
}
[ConditionalFact]
public virtual void Can_add_seed_data_objects()
{
var modelBuilder = CreateModelBuilder();
var model = modelBuilder.Model;
modelBuilder.Ignore<Theta>();
modelBuilder.Entity<Beta>(
c =>
{
c.HasData(
new Beta { Id = -1 });
var customers = new List<Beta> { new() { Id = -2 } };
c.HasData(customers);
});
var finalModel = modelBuilder.FinalizeModel();
var customer = finalModel.FindEntityType(typeof(Beta));
var data = customer.GetSeedData();
Assert.Equal(2, data.Count());
Assert.Equal(-1, data.First()[nameof(Beta.Id)]);
Assert.Equal(-2, data.Last()[nameof(Beta.Id)]);
var _ = finalModel.ToDebugString();
}
[ConditionalFact]
public virtual void Can_add_seed_data_anonymous_objects()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Theta>();
modelBuilder.Entity<Beta>(
c =>
{
c.HasData(
new { Id = -1 });
var customers = new List<object> { new { Id = -2 } };
c.HasData(customers);
});
var model = modelBuilder.FinalizeModel();
var customer = model.FindEntityType(typeof(Beta));
var data = customer.GetSeedData();
Assert.Equal(2, data.Count());
Assert.Equal(-1, data.First().Values.Single());
Assert.Equal(-2, data.Last().Values.Single());
}
[ConditionalFact]
public virtual void Private_property_is_not_discovered_by_convention()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Ignore<Alpha>();
modelBuilder.Entity<Gamma>();
var model = modelBuilder.FinalizeModel();
Assert.Empty(
model.FindEntityType(typeof(Gamma)).GetProperties()
.Where(p => p.Name == "PrivateProperty"));
}
[ConditionalFact]
public virtual void Can_add_seed_data_objects_indexed_property()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<IndexedClass>(
b =>
{
b.IndexerProperty<int>("Required");
b.IndexerProperty<string>("Optional");
var d = new IndexedClass { Id = -1 };
d["Required"] = 2;
b.HasData(d);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(IndexedClass));
var data = Assert.Single(entityType.GetSeedData());
Assert.Equal(-1, data["Id"]);
Assert.Equal(2, data["Required"]);
Assert.Null(data["Optional"]);
}
[ConditionalFact]
public virtual void Can_add_seed_data_anonymous_objects_indexed_property()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<IndexedClass>(
b =>
{
b.IndexerProperty<int>("Required");
b.IndexerProperty<string>("Optional");
b.HasData(new { Id = -1, Required = 2 });
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(IndexedClass));
var data = Assert.Single(entityType.GetSeedData());
Assert.Equal(-1, data["Id"]);
Assert.Equal(2, data["Required"]);
Assert.False(data.ContainsKey("Optional"));
}
[ConditionalFact]
public virtual void Can_add_seed_data_objects_indexed_property_dictionary()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<IndexedClassByDictionary>(
b =>
{
b.IndexerProperty<int>("Required");
b.IndexerProperty<string>("Optional");
var d = new IndexedClassByDictionary { Id = -1 };
d["Required"] = 2;
b.HasData(d);
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(IndexedClassByDictionary));
var data = Assert.Single(entityType.GetSeedData());
Assert.Equal(-1, data["Id"]);
Assert.Equal(2, data["Required"]);
Assert.Null(data["Optional"]);
}
[ConditionalFact]
public virtual void Can_add_seed_data_anonymous_objects_indexed_property_dictionary()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<IndexedClassByDictionary>(
b =>
{
b.IndexerProperty<int>("Required");
b.IndexerProperty<string>("Optional");
b.HasData(new { Id = -1, Required = 2 });
});
var model = modelBuilder.FinalizeModel();
var entityType = model.FindEntityType(typeof(IndexedClassByDictionary));
var data = Assert.Single(entityType.GetSeedData());
Assert.Equal(-1, data["Id"]);
Assert.Equal(2, data["Required"]);
Assert.False(data.ContainsKey("Optional"));
}
[ConditionalFact] //Issue#12617
[UseCulture("de-DE")]
public virtual void EntityType_name_is_stored_culture_invariantly()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Entityß>();
modelBuilder.Entity<Entityss>();
var model = modelBuilder.FinalizeModel();
Assert.Equal(2, model.GetEntityTypes().Count());
Assert.Equal(2, model.FindEntityType(typeof(Entityss)).GetNavigations().Count());
}
protected class Entityß
{
public int Id { get; set; }
}
protected class Entityss
{
public int Id { get; set; }
public Entityß Navigationß { get; set; }
public Entityß Navigationss { get; set; }
}
[ConditionalFact]
public virtual void Can_add_shared_type_entity_type()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.SharedTypeEntity<Dictionary<string, object>>("Shared1", b =>
{
b.IndexerProperty<int>("Key");
b.Property<int>("Keys");
b.Property<byte[]>("Values");
b.Property<string>("Count");
b.HasKey("Key");
});
modelBuilder.SharedTypeEntity<Dictionary<string, object>>("Shared2", b => b.IndexerProperty<int>("Id"));
Assert.Equal(
CoreStrings.ClashingSharedType(typeof(Dictionary<string, object>).ShortDisplayName()),
Assert.Throws<InvalidOperationException>(() => modelBuilder.Entity<Dictionary<string, object>>()).Message);
var model = modelBuilder.FinalizeModel();
Assert.Equal(2, model.GetEntityTypes().Count());
var shared1 = model.FindEntityType("Shared1");
Assert.NotNull(shared1);
Assert.True(shared1.HasSharedClrType);
Assert.Null(shared1.FindProperty("Id"));
Assert.Equal(typeof(int), shared1.FindProperty("Keys").ClrType);
Assert.Equal(typeof(byte[]), shared1.FindProperty("Values").ClrType);
Assert.Equal(typeof(string), shared1.FindProperty("Count").ClrType);
var shared2 = model.FindEntityType("Shared2");
Assert.NotNull(shared2);
Assert.True(shared2.HasSharedClrType);
Assert.NotNull(shared2.FindProperty("Id"));
var indexer = shared1.FindIndexerPropertyInfo();
Assert.True(model.IsIndexerMethod(indexer.GetMethod));
Assert.True(model.IsIndexerMethod(indexer.SetMethod));
Assert.Same(indexer, shared2.FindIndexerPropertyInfo());
}
[ConditionalFact]
public virtual void Cannot_add_shared_type_when_non_shared_exists()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<Customer>();
Assert.Equal(
CoreStrings.ClashingNonSharedType("Shared1", nameof(Customer)),
Assert.Throws<InvalidOperationException>(() => modelBuilder.SharedTypeEntity<Customer>("Shared1")).Message);
}
}
}
}
| 44.40514 | 157 | 0.549749 | [
"MIT"
] | dtkujawski/efcore | test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs | 95,032 | C# |
using HotChocolate.Types;
using Snapshooter.Xunit;
using Xunit;
namespace HotChocolate.Data.Filters
{
public class StringOperationInputTests
{
[Fact]
public void Create_OperationType()
{
// arrange
// act
ISchema schema = SchemaBuilder.New()
.AddQueryType(
t => t
.Name("Query")
.Field("foo")
.Type<StringType>()
.Resolver("foo")
.Argument("test", a => a.Type<StringOperationFilterInput>()))
.AddFiltering()
.Create();
// assert
schema.ToString().MatchSnapshot();
}
[Fact]
public void Create_Implicit_Operation()
{
// arrange
// act
ISchema schema = SchemaBuilder.New()
.AddQueryType(
t => t
.Name("Query")
.Field("foo")
.Type<StringType>()
.Resolver("foo")
.Argument("test", a => a.Type<FilterInputType<Foo>>()))
.AddFiltering()
.Create();
// assert
schema.ToString().MatchSnapshot();
}
[Fact]
public void Create_Explicit_Operation()
{
// arrange
// act
ISchema schema = SchemaBuilder.New()
.AddQueryType(
t => t
.Name("Query")
.Field("foo")
.Type<StringType>()
.Resolver("foo")
.Argument("test", a => a.Type<FooFilterType>()))
.TryAddConvention<IFilterConvention>(
(sp) => new FilterConvention(x => x.UseMock()))
.AddFiltering()
.Create();
// assert
schema.ToString().MatchSnapshot();
}
public class FooFilterType : FilterInputType
{
protected override void Configure(IFilterInputTypeDescriptor descriptor)
{
descriptor.Field("string").Type<StringOperationFilterInput>();
}
}
public class Foo
{
public string String { get; set; } = "";
public string? StringNullable { get; set; }
}
}
}
| 28.83908 | 85 | 0.426863 | [
"MIT"
] | GraemeF/hotchocolate | src/HotChocolate/Data/test/Data.Filters.Tests/Types/StringOperationInputTests.cs | 2,509 | C# |
// <auto-generated />
using System;
using Library.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace Library.Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20220225162223_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("Library.Domain.Author", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(55)
.HasColumnType("nvarchar(55)");
b.HasKey("Id");
b.ToTable("Authors");
b.HasData(
new
{
Id = 1,
Name = "Laurelli Rolf"
},
new
{
Id = 2,
Name = "Jordan B Peterson"
},
new
{
Id = 3,
Name = "Annmarie Palm"
},
new
{
Id = 4,
Name = "Dale Carnegie"
},
new
{
Id = 5,
Name = "Bo Gustafsson"
},
new
{
Id = 6,
Name = "Brian Tracy "
},
new
{
Id = 7,
Name = "Stephen Denning"
},
new
{
Id = 8,
Name = "Geoff Watts"
},
new
{
Id = 9,
Name = "David J Anderson"
},
new
{
Id = 10,
Name = "Rashina Hoda"
},
new
{
Id = 11,
Name = "William Shakespeare"
},
new
{
Id = 12,
Name = "Villiam Skakspjut"
},
new
{
Id = 13,
Name = "Robert C. Martin"
});
});
modelBuilder.Entity("Library.Domain.BookCopy", b =>
{
b.Property<int>("BookCopyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("BookCopyId"), 1L, 1);
b.Property<int>("DetailsId")
.HasColumnType("int");
b.Property<bool>("IsAvailable")
.HasColumnType("bit");
b.HasKey("BookCopyId");
b.HasIndex("DetailsId");
b.ToTable("BookCopies");
b.HasData(
new
{
BookCopyId = 1,
DetailsId = 1,
IsAvailable = true
},
new
{
BookCopyId = 2,
DetailsId = 1,
IsAvailable = true
},
new
{
BookCopyId = 3,
DetailsId = 1,
IsAvailable = true
},
new
{
BookCopyId = 4,
DetailsId = 3,
IsAvailable = true
},
new
{
BookCopyId = 5,
DetailsId = 2,
IsAvailable = true
},
new
{
BookCopyId = 6,
DetailsId = 3,
IsAvailable = true
},
new
{
BookCopyId = 7,
DetailsId = 3,
IsAvailable = true
},
new
{
BookCopyId = 8,
DetailsId = 3,
IsAvailable = true
});
});
modelBuilder.Entity("Library.Domain.BookCopyLoan", b =>
{
b.Property<int>("BookCopyId")
.HasColumnType("int");
b.Property<int>("LoanId")
.HasColumnType("int");
b.HasKey("BookCopyId", "LoanId");
b.HasIndex("LoanId");
b.ToTable("BookCopyLoans");
b.HasData(
new
{
BookCopyId = 1,
LoanId = 2
},
new
{
BookCopyId = 2,
LoanId = 3
},
new
{
BookCopyId = 3,
LoanId = 4
},
new
{
BookCopyId = 4,
LoanId = 1
});
});
modelBuilder.Entity("Library.Domain.BookDetails", b =>
{
b.Property<int>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"), 1L, 1);
b.Property<int>("AuthorID")
.HasColumnType("int");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ISBN")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("ID");
b.HasIndex("AuthorID");
b.ToTable("BookDetails");
b.HasData(
new
{
ID = 1,
AuthorID = 1,
Description = "Arguably Shakespeare's greatest tragedy",
ISBN = "1472518381",
Title = "Hamlet"
},
new
{
ID = 2,
AuthorID = 1,
Description = "King Lear is a tragedy written by William Shakespeare. It depicts the gradual descent into madness of the title character, after he disposes of his kingdom by giving bequests to two of his three daughters egged on by their continual flattery, bringing tragic consequences for all.",
ISBN = "9780141012292",
Title = "King Lear"
},
new
{
ID = 3,
AuthorID = 2,
Description = "An intense drama of love, deception, jealousy and destruction.",
ISBN = "1853260185",
Title = "Othello"
},
new
{
ID = 4,
AuthorID = 4,
Description = "I Affärsmannaskap har Rolf Laurelli summerat sin långa erfarenhet av konsten att göra affärer. Med boken hoppas han kunna locka fram dina affärsinstinkter.",
ISBN = "9789147107483",
Title = "Affärsmannaskap för ingenjörer, jurister och alla andra specialister"
},
new
{
ID = 5,
AuthorID = 5,
Description = "12 Rules for Life offers a deeply rewarding antidote to the chaos in our lives: eternal truths applied to our modern problems. ",
ISBN = "9780345816023",
Title = "12 Rules For Life "
},
new
{
ID = 6,
AuthorID = 6,
Description = "Denna eminenta bok handlar om hur man ska behandla sina affärskontakter för att de ska känna sig trygga med dig som affärspartner. ",
ISBN = "9789147122103",
Title = "Business behavior"
},
new
{
ID = 7,
AuthorID = 7,
Description = "Dale Carnegie had an understanding of human nature that will never be outdated. Financial success, Carnegie believed, is due 15 percent to professional knowledge and 85 percent to the ability to express ideas, to assume leadership, and to arouse enthusiasm among people.",
ISBN = "9781439199190",
Title = "How to Win Friends and Influence People"
},
new
{
ID = 8,
AuthorID = 8,
Description = "I Affärsmannaskap har Rolf Laurelli summerat sin långa erfarenhet av konsten att göra affärer. Med boken hoppas han kunna locka fram dina affärsinstinkter.",
ISBN = "9789186293321",
Title = "Förhandla : från strikta regler till dirty tricks"
},
new
{
ID = 9,
AuthorID = 9,
Description = "Tracy teaches readers how to utilize the six key negotiating styles ",
ISBN = "9780814433195",
Title = "Negotiation "
},
new
{
ID = 13,
AuthorID = 13,
Description = "The Age of Agile helps readers master the three laws of Agile Management (team, customer, network)",
ISBN = "9780814439098",
Title = "THE AGE OF AGILE "
},
new
{
ID = 10,
AuthorID = 10,
Description = "The basics of being a ScrumMaster are fairly straightforward: Facilitate the Scrum process and remove impediments. ",
ISBN = "9780957587403",
Title = "Scrum Mastery "
},
new
{
ID = 11,
AuthorID = 11,
Description = "Optimize the effectiveness of your business, to produce fit-for-purpose products and services that delight your customers, making them loyal to your brand and increasing your share, revenues and margins.",
ISBN = "9780984521401",
Title = "Kanban "
},
new
{
ID = 12,
AuthorID = 12,
Description = "This book constitutes the research workshops, doctoral symposium and panel summaries presented at the 20th International Conference on Agile Software Development",
ISBN = "9783030301255",
Title = " Agile Processes in Software Engineering and Extreme Programming"
});
});
modelBuilder.Entity("Library.Domain.Loan", b =>
{
b.Property<int>("LoanId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("LoanId"), 1L, 1);
b.Property<DateTime>("DueDate")
.HasColumnType("datetime2");
b.Property<int>("Fee")
.HasColumnType("int");
b.Property<int>("MemberID")
.HasColumnType("int");
b.Property<DateTime>("ReturnDate")
.HasColumnType("datetime2");
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.HasKey("LoanId");
b.HasIndex("MemberID");
b.ToTable("Loans");
b.HasData(
new
{
LoanId = 1,
DueDate = new DateTime(2022, 3, 11, 17, 22, 22, 998, DateTimeKind.Local).AddTicks(3054),
Fee = 0,
MemberID = 3,
ReturnDate = new DateTime(2020, 5, 4, 0, 0, 0, 0, DateTimeKind.Unspecified),
StartDate = new DateTime(2022, 2, 25, 17, 22, 22, 998, DateTimeKind.Local).AddTicks(3003)
},
new
{
LoanId = 2,
DueDate = new DateTime(2020, 1, 19, 0, 0, 0, 0, DateTimeKind.Unspecified),
Fee = 0,
MemberID = 1,
ReturnDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
StartDate = new DateTime(2020, 1, 5, 0, 0, 0, 0, DateTimeKind.Unspecified)
},
new
{
LoanId = 3,
DueDate = new DateTime(2020, 1, 17, 0, 0, 0, 0, DateTimeKind.Unspecified),
Fee = 0,
MemberID = 2,
ReturnDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
StartDate = new DateTime(2020, 1, 3, 0, 0, 0, 0, DateTimeKind.Unspecified)
},
new
{
LoanId = 4,
DueDate = new DateTime(2022, 3, 11, 17, 22, 22, 998, DateTimeKind.Local).AddTicks(3070),
Fee = 0,
MemberID = 2,
ReturnDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
StartDate = new DateTime(2022, 2, 25, 17, 22, 22, 998, DateTimeKind.Local).AddTicks(3068)
});
});
modelBuilder.Entity("Library.Domain.Member", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("SSN")
.IsRequired()
.HasMaxLength(13)
.HasColumnType("nvarchar(13)");
b.HasKey("Id");
b.ToTable("Members");
b.HasData(
new
{
Id = 1,
Name = "Daniel Graham",
SSN = "19855666-0001"
},
new
{
Id = 2,
Name = "Eric Howell",
SSN = "19555666-0002"
},
new
{
Id = 3,
Name = "Patricia Lebsack",
SSN = "19555666-0003"
},
new
{
Id = 4,
Name = "Kalle Runolfsdottir",
SSN = "19555666-0004"
},
new
{
Id = 5,
Name = "Linus Reichert",
SSN = "19555666-0005"
});
});
modelBuilder.Entity("Library.Domain.BookCopy", b =>
{
b.HasOne("Library.Domain.BookDetails", "Details")
.WithMany("Copies")
.HasForeignKey("DetailsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Details");
});
modelBuilder.Entity("Library.Domain.BookCopyLoan", b =>
{
b.HasOne("Library.Domain.BookCopy", "BookCopy")
.WithMany("BookCopyLoans")
.HasForeignKey("BookCopyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Library.Domain.Loan", "Loan")
.WithMany("BookCopyLoans")
.HasForeignKey("LoanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BookCopy");
b.Navigation("Loan");
});
modelBuilder.Entity("Library.Domain.BookDetails", b =>
{
b.HasOne("Library.Domain.Author", "Author")
.WithMany("Books")
.HasForeignKey("AuthorID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("Library.Domain.Loan", b =>
{
b.HasOne("Library.Domain.Member", "Member")
.WithMany("Loans")
.HasForeignKey("MemberID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Member");
});
modelBuilder.Entity("Library.Domain.Author", b =>
{
b.Navigation("Books");
});
modelBuilder.Entity("Library.Domain.BookCopy", b =>
{
b.Navigation("BookCopyLoans");
});
modelBuilder.Entity("Library.Domain.BookDetails", b =>
{
b.Navigation("Copies");
});
modelBuilder.Entity("Library.Domain.Loan", b =>
{
b.Navigation("BookCopyLoans");
});
modelBuilder.Entity("Library.Domain.Member", b =>
{
b.Navigation("Loans");
});
#pragma warning restore 612, 618
}
}
}
| 39.620751 | 325 | 0.352086 | [
"MIT"
] | itsyst/Library-Management-System | Library.Infrastructure/Migrations/20220225162223_Initial.Designer.cs | 22,169 | C# |
using System;
using Extenso.Data.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Aurelia.Skeleton.NetCore.Razor.Data.Domain
{
public class Person : IEntity
{
public int Id { get; set; }
public string FamilyName { get; set; }
public string GivenNames { get; set; }
public DateTime DateOfBirth { get; set; }
#region IEntity Members
public object[] KeyValues
{
get { return new object[] { Id }; }
}
#endregion IEntity Members
}
public class PersonMap : IEntityTypeConfiguration<Person>
{
public void Configure(EntityTypeBuilder<Person> builder)
{
builder.ToTable("People");
builder.HasKey(m => m.Id);
builder.Property(m => m.FamilyName).IsRequired().HasMaxLength(128).IsUnicode(true);
builder.Property(m => m.GivenNames).IsRequired().HasMaxLength(128).IsUnicode(true);
builder.Property(m => m.DateOfBirth).IsRequired();
}
}
} | 27.820513 | 95 | 0.623963 | [
"MIT"
] | gordon-matt/aurelia-razor-netcore2-skeleton | Aurelia.Skeleton.NetCore.Razor/Data/Domain/Person.cs | 1,087 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/**
Handle the cirular world using camera borders
*/
public class CircleWorldCamera : MonoBehaviour
{
private Camera camera;
private float cameraLeftBorder;
private float cameraRightBorder;
private float cameraTopBorder;
private float cameraBottomBorder;
// Start is called before the first frame update
void Start()
{
camera = Camera.main;
cameraRightBorder = camera.aspect * camera.orthographicSize;
cameraLeftBorder = -cameraRightBorder;
cameraTopBorder = camera.orthographicSize;
cameraBottomBorder = -cameraTopBorder;
}
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
float posX = transform.position.x;
float posY = transform.position.y;
float posZ = transform.position.z;
if (posX >= cameraRightBorder && horizontal > 0)
{
Debug.Log("right border");
transform.position = new Vector3(cameraLeftBorder, posY, posZ);
}
if (posX <= cameraLeftBorder && horizontal < 0)
{
Debug.Log("left border");
transform.position = new Vector3(cameraRightBorder, posY, posZ);
}
if (posY >= cameraTopBorder && vertical > 0)
{
Debug.Log("top border");
transform.position = new Vector3(posX, cameraBottomBorder, posZ);
}
if (posY <= cameraBottomBorder && vertical < 0)
{
Debug.Log("bottom border");
transform.position = new Vector3(posX, cameraTopBorder, posZ);
}
}
}
| 26.029412 | 77 | 0.618079 | [
"MIT"
] | Game-Dev-Project-D-A-Y/Ex3-SpaceShip | Assets/Scripts/5-scripts/CircleWorldCamera.cs | 1,772 | C# |
/*
Copyright (c) 2017 Thomas Schöngrundner
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.
*/
using ConUI.Helper;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using static ConrealEngine.Assets.UnicodeImage;
namespace ConrealEngine.Assets
{
public class UnicodeFont
{
//private const int CHAR_SIZE_PIXEL = 16;
private string _fontName = "";
//private int charCountX = 0;
//private int charCountY = 0;
private GlyphTypeface fontFile = null;
public string Font
{
get
{
return _fontName;
}
set
{
_fontName = value;
Typeface face = new Typeface(_fontName);
face.TryGetGlyphTypeface(out fontFile);
//if (ResourceHandler.Instance.FontFiles.ContainsKey(value))
//{
// fontFile = ResourceHandler.Instance.FontFiles[value];
// //charCountX = fontFile.Width / CHAR_SIZE_PIXEL;
// //charCountY = fontFile.Height / CHAR_SIZE_PIXEL;
//}
}
}
public IntVector2 CellSize { get { return fontFile != null ? new IntVector2(Size, (int)(Size * fontFile.Height)) : new IntVector2(); } }
public int Size { get; set; } = 5;
public UnicodeFont()
{
Font = "Consolas";
}
public char[,] Sample(char c)
{
return Sample((int)c);
}
//public char[,] Sample(int index)
//{
// int charSize = CharSize;
// char[,] res = new char[charSize, charSize];
// Bitmap bitmap = GetBitmap(index);
// for (int x = 0; x < res.GetLength(0); x++)
// {
// for (int y = 0; y < res.GetLength(1); y++)
// {
// Color pixel = bitmap.GetPixel(x, y);
// if (pixel.A != 0)
// {
// res[x, y] = '█';
// }
// else
// {
// res[x, y] = '\0';
// }
// }
// }
// return res;
//}
public char[,] Sample(int index)
{
//RenderTargetBitmap renderTarget = new RenderTargetBitmap((int)geom.Bounds.Size.Width, (int)geom.Bounds.Size.Height, 72, 72, PixelFormats.Pbgra32);
if (fontFile == null)
return new char[,] { { '\0' } };
ushort glyphIndex = 0;
if (!fontFile.CharacterToGlyphMap.TryGetValue(index, out glyphIndex))
return new char[,] { { '\0' } };
Geometry geom = fontFile.GetGlyphOutline(glyphIndex, Size, 1);
if(geom.IsEmpty())
return new char[,] { { '\0' } };
DrawingVisual viz = new DrawingVisual();
using (DrawingContext dc = viz.RenderOpen())
{
double yOffset = Size * fontFile.Baseline;
double xOffset = Size / 2d - geom.Bounds.Width / 2d;
dc.PushTransform(new TranslateTransform(xOffset, yOffset));
dc.DrawGeometry(System.Windows.Media.Brushes.Red, null, geom);
}
RenderTargetBitmap renderTarget = new RenderTargetBitmap(CellSize.X, CellSize.Y, 100, 100, PixelFormats.Pbgra32);
renderTarget.Render(viz);
MemoryStream stream = new MemoryStream();
PngBitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(renderTarget));
encoder.Save(stream);
Bitmap bitmap = new Bitmap(stream);
char[,] res = new char[bitmap.Width, bitmap.Height];
for (int x = 0; x < res.GetLength(0); x++)
{
for (int y = 0; y < res.GetLength(1); y++)
{
System.Drawing.Color pixel = bitmap.GetPixel(x, y);
if (pixel.A != 0)
{
res[x, y] = '█';
}
else
{
res[x, y] = '\0';
}
}
}
return res;
}
//private Bitmap GetBitmap(int index)
//{
// IntVector2 fontIndex = MathHelper.Get2DIndexFrom1D(index, charCountX, charCountY);
// int charSize = CharSize;
// Bitmap res = new Bitmap(charSize, charSize);
// if (fontIndex.X == -1 || fontFile == null)
// return res;
// Rectangle destRect = new Rectangle(0, 0, charSize, charSize);
// //res.SetResolution(fontFile.HorizontalResolution, fontFile.VerticalResolution);
// //res.SetResolution(200, 200);
// Graphics graphics = Graphics.FromImage(res);
// graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
// graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
// graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
// graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
// graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
// ImageAttributes wrapMode = new ImageAttributes();
// wrapMode.SetWrapMode(System.Drawing.Drawing2D.WrapMode.Clamp);
// graphics.DrawImage(fontFile, destRect, fontIndex.X * CHAR_SIZE_PIXEL, fontIndex.Y * CHAR_SIZE_PIXEL, CHAR_SIZE_PIXEL, CHAR_SIZE_PIXEL, GraphicsUnit.Pixel, wrapMode);
// return res;
//}
}
}
| 32.979798 | 179 | 0.548239 | [
"MIT"
] | Elyptos/ConrealEngine | ConrealEngine/Assets/Font.cs | 6,537 | C# |
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
namespace AdefHelpDeskBase.Models
{
public class DTONode
{
[Key]
public string data { get; set; }
public string label { get; set; }
public string expandedIcon { get; set; }
public string collapsedIcon { get; set; }
public List<DTONode> children { get; set; }
public int parentId { get; set; }
public string type { get; set; }
}
} | 28.588235 | 51 | 0.623457 | [
"MIT"
] | ADefWebserver/ADefHelpDesk | ADefHelpDeskApp/Models/DTONode.cs | 488 | C# |
using RSecurityBackend.Models.Generic;
using RSecurityBackend.Models.Generic.Db;
using System;
using System.Threading.Tasks;
namespace RSecurityBackend.Services
{
/// <summary>
/// generic options service
/// </summary>
public interface IRGenericOptionsService
{
/// <summary>
/// modify an option or add a new one if an option with the requested name does not exist
/// </summary>
/// <param name="optionName"></param>
/// <param name="optionValue"></param>
/// <param name="userId"></param>
/// <returns></returns>
Task<RServiceResult<RGenericOption>> SetAsync(string optionName, string optionValue, Guid? userId);
/// <summary>
/// get option value
/// </summary>
/// <param name="optionName"></param>
/// <param name="userId"></param>
/// <returns></returns>
Task<RServiceResult<string>> GetValueAsync(string optionName, Guid? userId);
}
}
| 31.967742 | 107 | 0.614531 | [
"MIT"
] | hrmoh/RSecurityBackend | RSecurityBackend/Services/IRGenericOptionsService.cs | 993 | C# |
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Intuit.Ipp.Core;
using Intuit.Ipp.Data;
using Intuit.Ipp.Security;
using Intuit.Ipp.Exception;
using System.Threading;
using Intuit.Ipp.QueryFilter;
using Intuit.Ipp.LinqExtender;
using System.Collections.ObjectModel;
using Intuit.Ipp.DataService;
namespace Intuit.Ipp.Test.Services.QBO
{
[TestClass]
public class DepositTest
{
ServiceContext qboContextoAuth = null;
[TestInitialize]
public void MyTestInitializer()
{
qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth();
//qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true;
//qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs";
}
#region TestCases for QBOContextOAuth
#region Sync Methods
#region Test cases for Add Operations
[TestMethod]
public void DepositAddTestUsingoAuth()
{
//Creating the Deposit for Add
Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, deposit);
//Verify the added Deposit
QBOHelper.VerifyDeposit(deposit, added);
}
#endregion
#region Test cases for FindAll Operations
[TestMethod]
public void DepositFindAllTestUsingoAuth()
{
//Making sure that at least one entity is already present
//DepositAddTestUsingoAuth();
//Retrieving the Deposit using FindAll
List<Deposit> deposits = Helper.FindAll<Deposit>(qboContextoAuth, new Deposit(), 1, 500);
Assert.IsNotNull(deposits);
Assert.IsTrue(deposits.Count<Deposit>() > 0);
}
#endregion
#region Test cases for FindbyId Operations
[TestMethod]
public void DepositFindbyIdTestUsingoAuth()
{
//Creating the Deposit for Adding
Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, deposit);
Deposit found = Helper.FindById<Deposit>(qboContextoAuth, added);
QBOHelper.VerifyDeposit(found, added);
}
#endregion
#region Test cases for Update Operations
[TestMethod]
public void DepositUpdateTestUsingoAuth()
{
//Creating the Deposit for Adding
Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, deposit);
//Change the data of added entity
Deposit changed = QBOHelper.UpdateDeposit(qboContextoAuth, added);
//Update the returned entity data
Deposit updated = Helper.Update<Deposit>(qboContextoAuth, changed);//Verify the updated Deposit
QBOHelper.VerifyDeposit(changed, updated);
}
[TestMethod]
public void DepositSparseUpdateTestUsingoAuth()
{
//Creating the Deposit for Adding
Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, deposit);
//Change the data of added entity
Deposit changed = QBOHelper.UpdateDepositSparse(qboContextoAuth, added.Id, added.SyncToken);
//Update the returned entity data
Deposit updated = Helper.Update<Deposit>(qboContextoAuth, changed);//Verify the updated Deposit
QBOHelper.VerifyDepositSparse(changed, updated);
}
#endregion
#region Test cases for Delete Operations
[TestMethod]
public void DepositDeleteTestUsingoAuth()
{
//Creating the Deposit for Adding
Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, deposit);
//Delete the returned entity
try
{
Deposit deleted = Helper.Delete<Deposit>(qboContextoAuth, added);
Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status);
}
catch (IdsException ex)
{
Assert.Fail();
}
}
[TestMethod]
[Ignore]
public void DepositVoidTestUsingoAuth()
{
//Creating the entity for Adding
Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the entity
Deposit added = Helper.Add<Deposit>(qboContextoAuth, entity);
//Void the returned entity
try
{
Deposit voided = Helper.Void<Deposit>(qboContextoAuth, added);
Assert.AreEqual(EntityStatusEnum.Voided, voided.status);
}
catch (IdsException ex)
{
Assert.Fail();
}
}
#endregion
#region Test cases for CDC Operations
[TestMethod]
public void DepositCDCTestUsingoAuth()
{
//Making sure that at least one entity is already present
DepositAddTestUsingoAuth();
//Retrieving the Deposit using CDC
List<Deposit> entities = Helper.CDC(qboContextoAuth, new Deposit(), DateTime.Today.AddDays(-1));
Assert.IsNotNull(entities);
Assert.IsTrue(entities.Count<Deposit>() > 0);
}
#endregion
#region Test cases for Batch
[TestMethod]
public void DepositBatchUsingoAuth()
{
Dictionary<OperationEnum, object> batchEntries = new Dictionary<OperationEnum, object>();
Deposit existing = Helper.FindOrAdd(qboContextoAuth, new Deposit());
batchEntries.Add(OperationEnum.create, QBOHelper.CreateDeposit(qboContextoAuth));
batchEntries.Add(OperationEnum.update, QBOHelper.UpdateDeposit(qboContextoAuth, existing));
batchEntries.Add(OperationEnum.query, "select * from Deposit");
batchEntries.Add(OperationEnum.delete, existing);
ReadOnlyCollection<IntuitBatchResponse> batchResponses = Helper.BatchTest<Deposit>(qboContextoAuth, batchEntries);
int position = 0;
foreach (IntuitBatchResponse resp in batchResponses)
{
if (resp.ResponseType == ResponseType.Exception)
{
Assert.Fail(resp.Exception.ToString());
}
if (resp.ResponseType == ResponseType.Entity)
{
Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Deposit).Id));
}
else if (resp.ResponseType == ResponseType.Query)
{
Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0);
}
else if (resp.ResponseType == ResponseType.CdcQuery)
{
Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0);
}
position++;
}
}
#endregion
#region Test cases for Query
[TestMethod]
public void DepositQueryUsingoAuth()
{
QueryService<Deposit> entityQuery = new QueryService<Deposit>(qboContextoAuth);
Deposit existing = Helper.FindOrAdd<Deposit>(qboContextoAuth, new Deposit());
//List<Deposit> entities = entityQuery.Where(c => c.Id == existing.Id).ToList();
List<Deposit> entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Deposit where Id='" + existing.Id + "'").ToList<Deposit>();
Assert.IsTrue(entities.Count() > 0);
}
#endregion
#endregion
#region ASync Methods
#region Test Cases for Add Operation
[TestMethod]
public void DepositAddAsyncTestsUsingoAuth()
{
//Creating the Deposit for Add
Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth);
Deposit added = Helper.AddAsync<Deposit>(qboContextoAuth, entity);
QBOHelper.VerifyDeposit(entity, added);
}
#endregion
#region Test Cases for FindAll Operation
[TestMethod]
public void DepositRetrieveAsyncTestsUsingoAuth()
{
//Making sure that at least one entity is already present
DepositAddTestUsingoAuth();
//Retrieving the Deposit using FindAll
Helper.FindAllAsync<Deposit>(qboContextoAuth, new Deposit());
}
#endregion
#region Test Cases for FindById Operation
[TestMethod]
public void DepositFindByIdAsyncTestsUsingoAuth()
{
//Creating the Deposit for Adding
Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, entity);
//FindById and verify
Helper.FindByIdAsync<Deposit>(qboContextoAuth, added);
}
#endregion
#region Test Cases for Update Operation
[TestMethod]
public void DepositUpdatedAsyncTestsUsingoAuth()
{
//Creating the Deposit for Adding
Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, entity);
//Update the Deposit
Deposit updated = QBOHelper.UpdateDeposit(qboContextoAuth, added);
//Call the service
Deposit updatedReturned = Helper.UpdateAsync<Deposit>(qboContextoAuth, updated);
//Verify updated Deposit
QBOHelper.VerifyDeposit(updated, updatedReturned);
}
#endregion
#region Test Cases for Delete Operation
[TestMethod]
public void DepositDeleteAsyncTestsUsingoAuth()
{
//Creating the Deposit for Adding
Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth);
//Adding the Deposit
Deposit added = Helper.Add<Deposit>(qboContextoAuth, entity);
Helper.DeleteAsync<Deposit>(qboContextoAuth, added);
}
#endregion
#endregion
#endregion
}
}
| 32.548193 | 139 | 0.606793 | [
"Apache-2.0"
] | dahlbyk/QuickBooks-V3-DotNET-SDK | IPPDotNetDevKitCSV3/Test/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Deposit.cs | 10,806 | C# |
using System;
using NUnit.Framework;
using _1_Int_EventMenu;
namespace UnitTests
{
[TestFixture]
class EventMenuTests
{
[Test]
public void CanCreateEvent()
{
Event e = new Event
{
ID = 1,
Date = new DateTime(2014, 10, 1),
Name = "Fred"
};
Assert.IsNotNull(e);
}
}
}
| 17.208333 | 49 | 0.460048 | [
"MIT"
] | TimCollins/Reddit.DailyProgrammer | src/UnitTests/EventMenuTests.cs | 415 | C# |
using dueltank.Domain.Helpers;
using dueltank.tests.core;
using FluentAssertions;
using NUnit.Framework;
namespace dueltank.domain.unit.tests.Helpers
{
[TestFixture]
[Category(TestType.Unit)]
public class YoutubeHelpersTests
{
[TestCase("http://www.youtube.com/sandalsResorts#p/c/54B8C800269D7C1B/0/FJUvudQsKCM", "FJUvudQsKCM")]
[TestCase("http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo", "1p3vcRhsYGo")]
[TestCase("http://youtu.be/NLqAF9hrVbY", "NLqAF9hrVbY")]
[TestCase("http://www.youtube.com/embed/NLqAF9hrVbY", "NLqAF9hrVbY")]
[TestCase("https://www.youtube.com/embed/NLqAF9hrVbY", "NLqAF9hrVbY")]
[TestCase("http://www.youtube.com/v/NLqAF9hrVbY?fs=1&hl=en_US", "NLqAF9hrVbY")]
[TestCase("http://www.youtube.com/watch?v=NLqAF9hrVbY", "NLqAF9hrVbY")]
[TestCase("http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo", "1p3vcRhsYGo")]
[TestCase("http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I", "NRHVzbJVx8I")]
[TestCase("http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo", "1p3vcRhsYGo")]
[TestCase("http://www.youtube.com/watch?v=JYArUl0TzhA&feature=featured", "JYArUl0TzhA")]
public void Given_A_YoutubeUrl_Extract_VideoId_(string youtubeVideoUrl, string expectVideoId)
{
// Arrange
// Act
var result = YoutubeHelpers.ExtractVideoId(youtubeVideoUrl);
// Assert
result.Should().BeEquivalentTo(expectVideoId);
}
}
} | 45.323529 | 109 | 0.674886 | [
"MIT"
] | fablecode/dueltank | src/Api/src/Tests/Unit/dueltank.domain.unit.tests/Helpers/YoutubeHelpersTests.cs | 1,543 | 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 java.lang;
using java.util;
using stab.query;
using stab.reflection;
using cnatural.helpers;
using cnatural.syntaxtree;
namespace cnatural.compiler {
class StatementValidator : StatementHandler<Void, Void> {
private CompilerContext context;
StatementValidator(CompilerContext context)
: super(true) {
this.context = context;
}
ExpressionValidator ExpressionValidator {
get;
set;
}
protected override Void handleBlock(BlockStatementNode block, Void source) {
try {
context.MemberResolver.enterScope();
foreach (var s in block.Statements) {
handleStatement(s, null);
}
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleBreak(BreakStatementNode breakStatement, Void source) {
return null;
}
protected override Void handleContinue(ContinueStatementNode continueStatement, Void source) {
return null;
}
protected override Void handleDo(DoStatementNode doStatement, Void source) {
try {
context.MemberResolver.enterScope();
handleStatement(doStatement.Statement, source);
} finally {
context.MemberResolver.leaveScope();
}
var condition = doStatement.Condition;
this.ExpressionValidator.handleExpression(condition, null, true);
ValidationHelper.setBoxing(context, context.TypeSystem.BooleanType, condition);
var info = condition.getUserData(typeof(ExpressionInfo));
if (info == null || ValidationHelper.getType(context, condition) != context.TypeSystem.BooleanType) {
throw context.error(CompileErrorId.NoImplicitConversion, condition,
BytecodeHelper.getDisplayName(info == null ? null : info.Type),
BytecodeHelper.getDisplayName(context.TypeSystem.BooleanType));
}
return null;
}
protected override Void handleEmpty(EmptyStatementNode empty, Void source) {
return null;
}
protected override Void handleExpression(ExpressionStatementNode expression, Void source) {
this.ExpressionValidator.handleExpression(expression.Expression, null, false);
return null;
}
protected override Void handleFor(ForStatementNode forStatement, Void source) {
try {
context.MemberResolver.enterScope();
foreach (var s in forStatement.Initializer) {
handleStatement(s, null);
}
var condition = forStatement.Condition;
if (condition != null) {
this.ExpressionValidator.handleExpression(condition, null, true);
ValidationHelper.setBoxing(context, context.TypeSystem.BooleanType, condition);
var info = condition.getUserData(typeof(ExpressionInfo));
if (info == null || ValidationHelper.getType(context, condition) != context.TypeSystem.BooleanType) {
throw context.error(CompileErrorId.NoImplicitConversion, condition,
BytecodeHelper.getDisplayName(info == null ? null : info.Type),
BytecodeHelper.getDisplayName(context.TypeSystem.BooleanType));
}
}
try {
context.MemberResolver.enterScope();
handleStatement(forStatement.Statement, source);
} finally {
context.MemberResolver.leaveScope();
}
foreach (var s in forStatement.Iterator) {
handleStatement(s, source);
}
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleForeach(ForeachStatementNode foreachStatement, Void src) {
try {
context.MemberResolver.enterScope();
var source = foreachStatement.Source;
this.ExpressionValidator.handleExpression(source, null, true);
var sinfo = source.getUserData(typeof(ExpressionInfo));
if (sinfo == null) {
throw context.error(CompileErrorId.NoImplicitConversion, source,
"<null>", BytecodeHelper.getDisplayName(context.TypeSystem.getType("java/lang/Iterable")));
}
var sourceType = ValidationHelper.getType(context, source);
TypeInfo elementType;
if (sourceType.IsArray) {
elementType = sourceType.ElementType;
} else {
var iterableType = BytecodeHelper.getImplementedIterable(sourceType);
if (iterableType == null) {
throw context.error(CompileErrorId.NoImplicitConversion, source,
BytecodeHelper.getDisplayName(sourceType),
BytecodeHelper.getDisplayName(context.TypeSystem.getType("java/lang/Iterable")));
}
foreachStatement.addOrReplaceUserData(iterableType);
elementType = BytecodeHelper.getIterableOrIteratorElementType(iterableType);
}
var localName = context.getIdentifier(foreachStatement.NameOffset, foreachStatement.NameLength);
if (context.MemberResolver.hasLocal(localName)) {
context.addError(CompileErrorId.VariableRedefinition, foreachStatement, localName);
}
var local = context.MemberResolver.defineLocal(localName,
ValidationHelper.getVariableType(context, elementType), context.CodeValidationContext.CurrentMethod);
foreachStatement.addOrReplaceUserData(local);
handleStatement(foreachStatement.Statement, null);
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleGoto(GotoStatementNode gotoStatement, Void source) {
return null;
}
protected override Void handleGotoCase(GotoCaseStatementNode gotoCase, Void source) {
var expression = gotoCase.Expression;
if (expression != null) {
context.DisableIgnoredErrorTracking = true;
if (this.ExpressionValidator.handleExpressionNoError(expression, null, true)) {
context.DisableIgnoredErrorTracking = false;
var einfo = expression.getUserData(typeof(ExpressionInfo));
if (einfo != null) {
if (!einfo.IsConstant) {
throw context.error(CompileErrorId.ConstantValueExpected, expression);
}
TypeInfo type = ValidationHelper.getType(context, expression);
switch (type.NumericTypeKind) {
case Long:
case Float:
case Double:
throw context.error(CompileErrorId.IntegerStringOrEnumExpected, expression);
default:
ValidationHelper.setBoxing(context, context.TypeSystem.IntType, expression);
break;
case None:
if (type != context.TypeSystem.StringType) {
throw context.error(CompileErrorId.IntegerStringOrEnumExpected, expression);
}
break;
}
}
} else {
context.DisableIgnoredErrorTracking = false;
}
}
return null;
}
protected override Void handleIf(IfStatementNode ifStatement, Void source) {
var condition = ifStatement.Condition;
this.ExpressionValidator.handleExpression(condition, context.TypeSystem.BooleanType, true);
ValidationHelper.setBoxing(context, context.TypeSystem.BooleanType, condition);
var cinfo = condition.getUserData(typeof(ExpressionInfo));
if (cinfo == null || ValidationHelper.getType(context, condition) != context.TypeSystem.BooleanType) {
throw context.error(CompileErrorId.NoImplicitConversion, condition,
BytecodeHelper.getDisplayName(cinfo == null ? null : cinfo.Type),
BytecodeHelper.getDisplayName(context.TypeSystem.BooleanType));
}
try {
context.MemberResolver.enterScope();
handleStatement(ifStatement.IfTrue, null);
} finally {
context.MemberResolver.leaveScope();
}
if (ifStatement.IfFalse != null) {
try {
context.MemberResolver.enterScope();
handleStatement(ifStatement.IfFalse, null);
} finally {
context.MemberResolver.leaveScope();
}
}
return null;
}
protected override Void handleLabeled(LabeledStatementNode labeled, Void source) {
handleStatement(labeled.Statement, null);
return null;
}
protected override Void handleLocalDeclaration(LocalDeclarationStatementNode localDeclaration, Void source) {
if (localDeclaration.Type == null) {
if (localDeclaration.Declarators.size() > 1) {
context.addError(CompileErrorId.MultipleImplicitVariableDeclarators, localDeclaration);
}
var decl = localDeclaration.Declarators[0];
if (decl.Value == null) {
throw context.error(CompileErrorId.MissingImplicitVariableInitializer, localDeclaration);
}
if (decl.Value.ExpressionKind == ExpressionKind.ArrayInitializer) {
throw context.error(CompileErrorId.ImplicitVariableWithArrayInitializer, localDeclaration);
}
this.ExpressionValidator.handleExpression(decl.Value, null, true);
var info = decl.Value.getUserData(typeof(ExpressionInfo));
if (info == null) {
throw context.error(CompileErrorId.NullImplicitVariableInitializer, localDeclaration);
}
localDeclaration.addOrReplaceUserData(new ExpressionInfo(ValidationHelper.getType(context, decl.Value)));
var name = context.getIdentifier(decl.NameOffset, decl.NameLength);
if (context.MemberResolver.hasLocal(name)) {
context.addError(CompileErrorId.VariableRedefinition, decl, name);
}
var local = context.MemberResolver.defineLocal(name, ValidationHelper.getVariableType(context, info.Type),
context.CodeValidationContext.CurrentMethod);
decl.addOrReplaceUserData(local);
} else {
var type = CompilerHelper.resolveTypeReference(context, context.CurrentType.PackageName, localDeclaration.Type);
localDeclaration.addOrReplaceUserData(new ExpressionInfo(type));
foreach (var decl in localDeclaration.Declarators) {
var name = context.getIdentifier(decl.NameOffset, decl.NameLength);
if (decl.Value != null) {
var isArrayInit = decl.Value.ExpressionKind == ExpressionKind.ArrayInitializer;
if (isArrayInit && !type.IsArray) {
throw context.error(CompileErrorId.ArrayTypeExpected, decl);
}
this.ExpressionValidator.handleExpression(decl.Value, type, true);
ValidationHelper.setBoxing(context, type, decl.Value);
if (!ValidationHelper.isAssignable(context, type, decl.Value)) {
var vinfo = decl.Value.getUserData(typeof(ExpressionInfo));
var vtype = (vinfo == null) ? null : vinfo.Type;
context.addError(CompileErrorId.NoImplicitConversion, decl.Value,
BytecodeHelper.getDisplayName(vtype),
BytecodeHelper.getDisplayName(type));
}
if (isArrayInit) {
ValidationHelper.setArrayInitializerTypes((ArrayInitializerExpressionNode)decl.Value, type);
}
}
if (context.MemberResolver.hasLocal(name)) {
context.addError(CompileErrorId.VariableRedefinition, decl, name);
}
var local = context.MemberResolver.defineLocal(name, ValidationHelper.getVariableType(context, type),
context.CodeValidationContext.CurrentMethod);
decl.addOrReplaceUserData(local);
}
}
return null;
}
protected override Void handleReturn(ReturnStatementNode returnStatement, Void source) {
var returnType = context.CodeValidationContext.CurrentMethod.ReturnType;
if (returnType == null) {
if (returnStatement.Value != null) {
this.ExpressionValidator.handleExpression(returnStatement.Value, null, true);
var rinfo = returnStatement.Value.getUserData(typeof(ExpressionInfo));
if (rinfo == null) {
context.CodeValidationContext.LambdaReturnTypes.add(null);
} else {
context.CodeValidationContext.LambdaReturnTypes.add(ValidationHelper.getType(context, returnStatement.Value));
}
}
} else if (returnType == context.TypeSystem.VoidType) {
if (returnStatement.Value != null) {
context.addError(CompileErrorId.ReturnVoid, returnStatement);
}
} else if (returnStatement.Value == null) {
context.addError(CompileErrorId.ReturnNotVoid, returnStatement);
} else {
this.ExpressionValidator.handleExpression(returnStatement.Value, returnType, true);
ValidationHelper.setBoxing(context, returnType, returnStatement.Value);
if (!ValidationHelper.isAssignable(context, returnType, returnStatement.Value)) {
var vinfo = returnStatement.Value.getUserData(typeof(ExpressionInfo));
context.addError(CompileErrorId.NoImplicitConversion, returnStatement.Value,
BytecodeHelper.getDisplayName((vinfo == null) ? null : vinfo.Type),
BytecodeHelper.getDisplayName(returnType));
}
}
return null;
}
protected override Void handleSwitch(SwitchStatementNode switchStatement, Void source) {
this.ExpressionValidator.handleExpression(switchStatement.Selector, null, true);
var sinfo = switchStatement.Selector.getUserData(typeof(ExpressionInfo));
if (sinfo == null) {
throw context.error(CompileErrorId.IntegerStringOrEnumExpected, switchStatement.Selector);
}
var type = ValidationHelper.getType(context, switchStatement.getSelector());
if (!type.IsNumeric && !type.IsEnum && type != context.TypeSystem.StringType) {
throw context.error(CompileErrorId.IntegerStringOrEnumExpected, switchStatement.Selector);
}
var isString = false;
switch (type.NumericTypeKind) {
case Long:
case Float:
case Double:
throw context.error(CompileErrorId.IntegerStringOrEnumExpected, switchStatement.Selector);
default:
ValidationHelper.setBoxing(context, context.TypeSystem.IntType, switchStatement.getSelector());
break;
case None:
isString = !type.IsEnum;
break;
}
var hasDefault = false;
HashMap<String, Integer> enumOrdinals = null;
HashSet<String> cases = null;
if (type.IsEnum) {
enumOrdinals = new HashMap<String, Integer>();
cases = new HashSet<String>();
int i = 0;
foreach (var f in type.Fields) {
if (f.IsEnum) {
enumOrdinals[f.Name] = Integer.valueOf(i++);
}
}
}
try {
context.MemberResolver.enterScope();
foreach (var section in switchStatement.Sections) {
if (section.CaseExpression == null) {
if (hasDefault) {
throw context.error(CompileErrorId.DuplicateCase, section);
}
hasDefault = true;
} else {
if (type.IsEnum) {
if (section.CaseExpression.ExpressionKind != ExpressionKind.SimpleName) {
throw context.error(CompileErrorId.EnumCaseNotIdentifier, section);
}
var name = (SimpleNameExpressionNode)section.CaseExpression;
var text = context.getIdentifier(name.NameOffset, name.NameLength);
if (!cases.add(text)) {
throw context.error(CompileErrorId.DuplicateCase, section);
}
if (!enumOrdinals.containsKey(text)) {
throw context.error(CompileErrorId.UnknownEnumMember, section, text, BytecodeHelper.getDisplayName(type));
}
name.addOrReplaceUserData(enumOrdinals.get(text));
} else {
this.ExpressionValidator.handleExpression(section.CaseExpression, type, true);
ValidationHelper.getType(context, section.CaseExpression);
var cinfo = section.CaseExpression.getUserData(typeof(ExpressionInfo));
if (cinfo == null) {
if (!isString) {
throw context.error(CompileErrorId.UnexpectedNull, switchStatement);
}
} else {
if (!cinfo.IsConstant) {
throw context.error(CompileErrorId.ConstantValueExpected, section);
}
if (!type.isAssignableFrom(ValidationHelper.getType(context, section.CaseExpression))) {
context.addError(CompileErrorId.NoImplicitConversion, section.CaseExpression,
BytecodeHelper.getDisplayName(cinfo.Type),
BytecodeHelper.getDisplayName(type));
}
}
}
}
foreach (var s in section.Statements) {
handleStatement(s, null);
}
}
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleSynchronized(SynchronizedStatementNode synchronizedStatement, Void source) {
var lock = synchronizedStatement.Lock;
this.ExpressionValidator.handleExpression(lock, null, true);
var linfo = lock.getUserData(typeof(ExpressionInfo));
if (linfo == null) {
throw context.error(CompileErrorId.UnexpectedNull, lock);
}
if (ValidationHelper.getType(context, lock).IsPrimitive) {
throw context.error(CompileErrorId.ReferenceTypeValueExpected, lock);
}
handleStatement(synchronizedStatement.Statement, null);
return null;
}
protected override Void handleThrow(ThrowStatementNode throwStatement, Void source) {
var exception = throwStatement.Exception;
if (exception != null) {
this.ExpressionValidator.handleExpression(exception, null, true);
var einfo = exception.getUserData(typeof(ExpressionInfo));
if (einfo != null) {
if (!context.TypeSystem.getType("java/lang/Throwable").isAssignableFrom(ValidationHelper.getType(context, exception))) {
throw context.error(CompileErrorId.NoImplicitConversion, exception,
BytecodeHelper.getDisplayName(einfo.Type), "java.lang.Throwable");
}
}
}
return null;
}
protected override Void handleTry(TryStatementNode tryStatement, Void source) {
handleStatement(tryStatement.Block, source);
foreach (var node in tryStatement.CatchClauses) {
try {
context.MemberResolver.enterScope();
if (node.ExceptionType != null) {
var etype = CompilerHelper.resolveTypeReference(context, context.CurrentType.PackageName, node.ExceptionType);
node.addOrReplaceUserData(etype);
if (etype.IsGenericParameter) {
throw context.error(CompileErrorId.GenericParameterInCatch, node.ExceptionType,
BytecodeHelper.getDisplayName(etype));
}
if (!context.TypeSystem.getType("java/lang/Throwable").isAssignableFrom(etype)) {
throw context.error(CompileErrorId.NoImplicitConversion, node.ExceptionType,
BytecodeHelper.getDisplayName(etype), "java.lang.Throwable");
}
if (node.NameLength > 0) {
var local = context.MemberResolver.defineLocal(context.getIdentifier(node.NameOffset, node.NameLength),
etype, context.CodeValidationContext.CurrentMethod);
node.addOrReplaceUserData(local);
}
}
foreach (var s in node.Block.Statements) {
handleStatement(s, source);
}
} finally {
context.MemberResolver.leaveScope();
}
}
if (tryStatement.Finally != null) {
handleStatement(tryStatement.Finally, source);
}
return null;
}
protected override Void handleUsing(UsingStatementNode usingStatement, Void source) {
try {
context.MemberResolver.enterScope();
var resource = usingStatement.ResourceAcquisition;
handleStatement(resource, null);
if (resource.StatementKind == StatementKind.Expression) {
var expr = ((ExpressionStatementNode)resource).Expression;
var einfo = expr.getUserData(typeof(ExpressionInfo));
if (einfo == null
|| BytecodeHelper.getDisposeMethod(context.AnnotatedTypeSystem, ValidationHelper.getType(context, expr)) == null) {
context.addError(CompileErrorId.NoDisposeMethod, expr,
BytecodeHelper.getDisplayName(einfo == null ? null : einfo.Type));
}
} else {
foreach (var decl in ((LocalDeclarationStatementNode)resource).Declarators) {
if (decl.Value == null) {
context.addError(CompileErrorId.UsingVariableUninitialized, decl);
} else {
var vinfo = decl.Value.getUserData(typeof(ExpressionInfo));
if (vinfo == null || BytecodeHelper.getDisposeMethod(context.AnnotatedTypeSystem,
ValidationHelper.getType(context, decl.Value)) == null) {
context.addError(CompileErrorId.NoDisposeMethod, decl.Value,
BytecodeHelper.getDisplayName(vinfo == null ? null : vinfo.Type));
}
}
}
}
handleStatement(usingStatement.Statement, null);
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleWhile(WhileStatementNode whileStatement, Void source) {
var condition = whileStatement.Condition;
this.ExpressionValidator.handleExpression(condition, context.TypeSystem.BooleanType, true);
ValidationHelper.setBoxing(context, context.TypeSystem.BooleanType, condition);
var info = condition.getUserData(typeof(ExpressionInfo));
if (info == null || ValidationHelper.getType(context, condition) != context.TypeSystem.BooleanType) {
throw context.error(CompileErrorId.NoImplicitConversion, condition,
BytecodeHelper.getDisplayName(info == null ? null : ValidationHelper.getType(context, condition)),
BytecodeHelper.getDisplayName(context.TypeSystem.BooleanType));
}
try {
context.MemberResolver.enterScope();
handleStatement(whileStatement.Statement, source);
} finally {
context.MemberResolver.leaveScope();
}
return null;
}
protected override Void handleYield(YieldStatementNode yieldStatement, Void source) {
var returnType = context.CodeValidationContext.CurrentMethod.ReturnType;
var value = yieldStatement.Value;
if (returnType == null) {
if (value != null) {
this.ExpressionValidator.handleExpression(value, returnType, true);
}
} else {
var elementType = BytecodeHelper.getIterableOrIteratorElementType(returnType);
if (elementType == null) {
throw context.error(CompileErrorId.YieldOutsideIterator, yieldStatement);
}
if (value != null) {
this.ExpressionValidator.handleExpression(value, elementType, true);
ValidationHelper.setBoxing(context, elementType, value);
if (!ValidationHelper.isAssignable(context, elementType, value)) {
throw context.error(CompileErrorId.NoImplicitConversion, value,
BytecodeHelper.getDisplayName(ValidationHelper.getType(context, value)),
BytecodeHelper.getDisplayName(elementType));
}
}
}
if (context.Iterables[context.CodeValidationContext.CurrentMethod] == null) {
var prefix = "_" + context.CodeValidationContext.CurrentMethod.Name + "_Iterable";
int n = context.CurrentType.NestedTypes.count(p => p.Name.startsWith(prefix));
var typeBuilder = ((TypeBuilder)context.CurrentType).defineNestedType(prefix + n);
typeBuilder.setSourceFile(PathHelper.getFileName(yieldStatement.Filename));
typeBuilder.setSynthetic(true);
typeBuilder.setSuper(true);
context.Iterables[context.CodeValidationContext.CurrentMethod] = typeBuilder;
context.TypeBuilders.add(typeBuilder);
typeBuilder.setBaseType(context.TypeSystem.ObjectType);
}
return null;
}
}
}
| 53.071556 | 140 | 0.560724 | [
"Apache-2.0"
] | monoman/cnatural-language | compiler/sources/compiler/StatementValidator.stab.cs | 29,667 | C# |
namespace BattleCards.Data
{
using BattleCards.Models;
using Microsoft.EntityFrameworkCore;
public class ApplicationDbContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
optionsBuilder.UseSqlServer(DatabaseConfiguration.ConnectionString);
}
public DbSet<User> Users { get; set; }
public DbSet<Card> Cards { get; set; }
public DbSet<UserCard> UserCards { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserCard>().HasKey(x => new { x.CardId,x.UserId});
}
}
}
| 29.28 | 85 | 0.655738 | [
"MIT"
] | meco00/CSharp-Web | ExamPreparation/28April2020/BattleCards/Data/ApplicationDbContext.cs | 734 | C# |
using GVFS.FunctionalTests.Tools;
using GVFS.Tests.Should;
using NUnit.Framework;
namespace GVFS.FunctionalTests.Tests.GitCommands
{
[TestFixtureSource(typeof(GitRepoTests), nameof(GitRepoTests.ValidateWorkingTree))]
[Category(Categories.GitCommands)]
public class MergeConflictTests : GitRepoTests
{
public MergeConflictTests(bool validateWorkingTree)
: base(enlistmentPerTest: true, validateWorkingTree: validateWorkingTree)
{
}
[TestCase]
public void MergeConflict()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand("merge " + GitRepoTests.ConflictSourceBranch);
this.FilesShouldMatchAfterConflict();
}
[TestCase]
public void MergeConflictWithFileReads()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.ReadConflictTargetFiles();
this.RunGitCommand("merge " + GitRepoTests.ConflictSourceBranch);
this.FilesShouldMatchAfterConflict();
}
[TestCase]
public void MergeConflict_ThenAbort()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand("merge " + GitRepoTests.ConflictSourceBranch);
this.ValidateGitCommand("merge --abort");
this.FilesShouldMatchCheckoutOfTargetBranch();
}
[TestCase]
public void MergeConflict_UsingOurs()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand($"merge -s ours {GitRepoTests.ConflictSourceBranch}");
this.FilesShouldMatchCheckoutOfTargetBranch();
}
[TestCase]
public void MergeConflict_UsingStrategyTheirs()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand($"merge -s recursive -Xtheirs {GitRepoTests.ConflictSourceBranch}");
this.FilesShouldMatchAfterConflict();
}
[TestCase]
public void MergeConflict_UsingStrategyOurs()
{
// No need to tear down this config since these tests are for enlistment per test.
this.SetupRenameDetectionAvoidanceInConfig();
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand($"merge -s recursive -Xours {GitRepoTests.ConflictSourceBranch}");
this.FilesShouldMatchAfterConflict();
}
[TestCase]
public void MergeConflictEnsureStatusFailsDueToConfig()
{
// This is compared against the message emitted by GVFS.Hooks\Program.cs
string expectedErrorMessagePart = "--no-renames";
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
this.RunGitCommand("merge " + GitRepoTests.ConflictSourceBranch, checkStatus: false);
ProcessResult result1 = GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "status");
result1.Errors.Contains(expectedErrorMessagePart);
ProcessResult result2 = GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "status --no-renames");
result2.Errors.Contains(expectedErrorMessagePart);
// Complete setup to ensure teardown succeeds
GitHelpers.InvokeGitAgainstGVFSRepo(this.Enlistment.RepoRoot, "config --local test.renames false");
}
protected override void CreateEnlistment()
{
base.CreateEnlistment();
this.ControlGitRepo.Fetch(GitRepoTests.ConflictSourceBranch);
this.ControlGitRepo.Fetch(GitRepoTests.ConflictTargetBranch);
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictSourceBranch);
this.ValidateGitCommand("checkout " + GitRepoTests.ConflictTargetBranch);
}
private void SetupRenameDetectionAvoidanceInConfig()
{
// Tell the pre-command hook that it shouldn't check for "--no-renames" when runing "git status"
// as the control repo won't do that. When the pre-command hook has been updated to properly
// check for "status.renames" we can set that value here instead.
this.ValidateGitCommand("config --local test.renames false");
}
}
}
| 44.280992 | 122 | 0.654909 | [
"MIT"
] | PastelMobileSuit/VFSForGit | GVFS/GVFS.FunctionalTests/Tests/GitCommands/MergeConflictTests.cs | 5,360 | C# |
// *****************************************************************************
//
// © Component Factory Pty Ltd 2017. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, 13 Swallows Close,
// Mornington, Vic 3931, Australia and are supplied subject to licence terms.
//
// Version 4.5.0.0 www.ComponentFactory.com
// *****************************************************************************
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Diagnostics;
namespace ComponentFactory.Krypton.Toolkit
{
/// <summary>
/// Encapsulates common context for view layout and render operations.
/// </summary>
public class ViewContext : GlobalId,
IDisposable
{
#region Instance Fields
private ViewManager _manager;
private Control _control;
private Control _alignControl;
private Graphics _graphics;
private Control _topControl;
private IRenderer _renderer;
private bool _disposeGraphics;
private bool _disposeManager;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the ViewContext class.
/// </summary>
/// <param name="manager">Reference to the view manager.</param>
/// <param name="control">Control associated with rendering.</param>
/// <param name="alignControl">Control used for aligning elements.</param>
/// <param name="renderer">Rendering provider.</param>
public ViewContext(ViewManager manager,
Control control,
Control alignControl,
IRenderer renderer)
: this(manager, control, alignControl, null, renderer)
{
}
/// <summary>
/// Initialize a new instance of the ViewContext class.
/// </summary>
/// <param name="control">Control associated with rendering.</param>
/// <param name="alignControl">Control used for aligning elements.</param>
/// <param name="graphics">Graphics instance for drawing.</param>
/// <param name="renderer">Rendering provider.</param>
public ViewContext(Control control,
Control alignControl,
Graphics graphics,
IRenderer renderer)
: this(null, control, alignControl, graphics, renderer)
{
}
/// <summary>
/// Initialize a new instance of the ViewContext class.
/// </summary>
/// <param name="manager">Reference to the view manager.</param>
/// <param name="control">Control associated with rendering.</param>
/// <param name="alignControl">Control used for aligning elements.</param>
/// <param name="graphics">Graphics instance for drawing.</param>
/// <param name="renderer">Rendering provider.</param>
public ViewContext(ViewManager manager,
Control control,
Control alignControl,
Graphics graphics,
IRenderer renderer)
{
// Use the manager is provided, otherwise create a temporary one with a null view
if (manager != null)
_manager = manager;
else
{
_manager = new ViewManager(control, new ViewLayoutNull());
_disposeManager = true;
}
// Cache initial values
_control = control;
_alignControl = alignControl;
_graphics = graphics;
_renderer = renderer;
}
/// <summary>
/// Dispose of resources.
/// </summary>
public void Dispose()
{
// Is there a graphics instance that might need disposed?
if (_graphics != null)
{
// Only dispose if we created it
if (_disposeGraphics)
_graphics.Dispose();
_graphics = null;
}
// Is there a manager instance that might need disposed?
if (_manager != null)
{
// Only dispose if we created it
if (_disposeManager)
_manager.Dispose();
_manager = null;
}
}
#endregion
#region Public
/// <summary>
/// Gets the owning view manager.
/// </summary>
public ViewManager ViewManager
{
[System.Diagnostics.DebuggerStepThrough]
get { return _manager; }
}
/// <summary>
/// Gets and sets the owning control associated with rendering.
/// </summary>
public Control Control
{
[System.Diagnostics.DebuggerStepThrough]
get { return _control; }
set { _control = value; }
}
/// <summary>
/// Gets and sets the control to use when aligning elements.
/// </summary>
public Control AlignControl
{
[System.Diagnostics.DebuggerStepThrough]
get { return _alignControl; }
set { _alignControl = value; }
}
/// <summary>
/// Gets the graphics instance used for rendering operations.
/// </summary>
public Graphics Graphics
{
get
{
// Do we need to create the graphics instance?
if (_graphics == null)
{
// If the control has been created...
if (Control.IsHandleCreated)
{
// Get the graphics instance from the control
_graphics = Control.CreateGraphics();
}
else
{
// ...otherwise create a graphics that is not
// tied to the control itself as we do not want
// to force the control to be created.
_graphics = Graphics.FromHwnd(IntPtr.Zero);
}
// We need to dispose of it later
_disposeGraphics = true;
}
return _graphics;
}
}
/// <summary>
/// Gets the owning top level control associated with rendering.
/// </summary>
public Control TopControl
{
get
{
// If this is the first need for the top control...
if (_topControl == null)
{
// Cache the top most owning control
_topControl = _control.TopLevelControl;
// If no top level control was found...
// (this happens at design time)
if (_topControl == null)
{
// Start searching from the control
Control parentControl = _control;
// Climb the parent chain to the top
while (parentControl.Parent != null)
{
// Stop at the first Form instance found
if (parentControl is Form)
break;
parentControl = parentControl.Parent;
}
// Use the top most control found
_topControl = parentControl;
}
}
return _topControl;
}
}
/// <summary>
/// Gets access to the renderer provider.
/// </summary>
public IRenderer Renderer
{
[System.Diagnostics.DebuggerStepThrough]
get { return _renderer; }
}
#endregion
}
}
| 33.361702 | 93 | 0.511862 | [
"BSD-3-Clause"
] | ALMMa/Krypton | Source/Krypton Components/ComponentFactory.Krypton.Toolkit/View Base/ViewContext.cs | 7,843 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using Octopus.Client;
using Octopus.Client.Model;
using Polly;
using SeaMonkey.ProbabilitySets;
using Serilog;
namespace SeaMonkey.Monkeys
{
public class TenantMonkey : Monkey
{
private static byte[] lastImage;
public TenantMonkey(OctopusRepository repository) : base(repository)
{
}
public int MaxTenantedProjects = 10;
public IntProbability ProjectsPerTenant { get; set; } = new LinearProbability(1, 10);
public IntProbability EnvironmentsPerProjectLink { get; set; } = new LinearProbability(0, 4);
public void Create(int numberOfRecords)
{
var projects = GetProjects();
var lifecycleIndex = Repository.Lifecycles.FindAll().ToDictionary(t => t.Id);
Log.Information("Creating {n} tenants", numberOfRecords);
Enumerable.Range(1, numberOfRecords)
.AsParallel()
.ForAll(i =>
{
CreateTenant(projects, lifecycleIndex, i);
//try
//{
// using (var ms = new MemoryStream(CreateLogo(project.Name, "monsterid")))
// Repository.Projects.SetLogo(project, project.Name + ".png", ms);
//}
//catch (Exception ex)
//{
// Console.WriteLine($"Failed to create logo for {project.Name}", ex);
//}
}
);
}
private static byte[] CreateLogo(string name, string type = "retro")
{
var hash = BitConverter.ToString(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(name))).Replace("-", "").ToLower();
using (var client = new HttpClient())
{
byte[] image = lastImage;
Policy
.Handle<Exception>()
.WaitAndRetry(new[]
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(2),
TimeSpan.FromSeconds(3)
}, (exception, timeSpan) => image = lastImage)
.Execute(() =>
{
image = client
.GetByteArrayAsync($"https://www.gravatar.com/avatar/{hash}?s=256&d={type}&r=PG")
.Result;
lastImage = image;
});
return image;
}
}
List<ProjectResource> GetProjects()
{
var currentProjects = Repository.Projects.GetAll();
var tenantableProjects = currentProjects.Where(t => t.TenantedDeploymentMode != TenantedDeploymentMode.Untenanted).ToList();
if (tenantableProjects.Count >= MaxTenantedProjects)
return tenantableProjects;
var projectsAllowedToBecomeTenanted = currentProjects
.Where(t => t.TenantedDeploymentMode == TenantedDeploymentMode.Untenanted)
.TakeRandomSubset(MaxTenantedProjects - tenantableProjects.Count);
return tenantableProjects.Concat(projectsAllowedToBecomeTenanted).ToList();
}
private void CreateTenant(List<ProjectResource> currentProjects, Dictionary<string, LifecycleResource> lifecycleIndex, int t)
{
var projects = currentProjects
.TakeRandomSubset(ProjectsPerTenant.Get())
.ToList();
EnsureProjectsTenanted(projects);
var tenantName = "Tenant " + t.ToString("000");
var tenantBuilder = Repository.Tenants.CreateOrModify(tenantName);
tenantBuilder.ClearProjects();
tenantBuilder.Instance.ProjectEnvironments = projects.ToDictionary(p => p.Id, p => GetEnvironmentsForProject(p, lifecycleIndex));
tenantBuilder.Save();
Log.Information("Created tenant {name}", tenantName);
}
private void EnsureProjectsTenanted(List<ProjectResource> projects)
{
foreach (var untenantedProject in projects.Where(p => p.TenantedDeploymentMode == TenantedDeploymentMode.Untenanted))
{
untenantedProject.TenantedDeploymentMode = TenantedDeploymentMode.TenantedOrUntenanted;
Repository.Projects.Modify(untenantedProject);
}
}
ReferenceCollection GetEnvironmentsForProject(ProjectResource project, IDictionary<string, LifecycleResource> lifecycleIndex)
{
return new ReferenceCollection(lifecycleIndex[project.LifecycleId]
.Phases.SelectMany(phase => phase.AutomaticDeploymentTargets.Concat(phase.OptionalDeploymentTargets))
.TakeRandomSubset(EnvironmentsPerProjectLink.Get()));
}
}
public static class Extensions
{
public static IEnumerable<T> TakeRandomSubset<T>(this IEnumerable<T> elements, int countToTake)
{
var internalList = elements.ToList();
countToTake = Math.Min(countToTake, internalList.Count);
var selected = new List<T>();
for (var i = 0; i < countToTake; ++i)
{
var next = Program.Rnd.Next(0, internalList.Count - selected.Count);
selected.Add(internalList[next]);
internalList[next] = internalList[internalList.Count - selected.Count];
}
return selected;
}
}
}
| 37.437908 | 141 | 0.571404 | [
"Apache-2.0"
] | OctopusDeploy/SeaMonkey | Console/Monkeys/TenantMonkey.cs | 5,730 | C# |
using System.Collections.Generic;
namespace UnityWebBrowser
{
/// <summary>
/// Creates a <see cref="string" />
/// </summary>
internal class WebBrowserArgsBuilder
{
private readonly List<string> arguments;
internal WebBrowserArgsBuilder()
{
arguments = new List<string>();
}
/// <summary>
/// Adds an argument
/// </summary>
/// <param name="arg"></param>
/// <param name="parameters"></param>
/// <param name="quotes"></param>
public void AppendArgument(string arg, object parameters = null, bool quotes = false)
{
string builtArg = $"-{arg}";
if (parameters == null || string.IsNullOrEmpty(parameters.ToString()))
return;
//We got spaces
if (quotes)
builtArg += $" \"{parameters}\"";
else
builtArg += $" {parameters}";
arguments.Add(builtArg);
}
/// <summary>
/// Gets the joined arguments <see cref="string" />
/// </summary>
/// <returns></returns>
public override string ToString()
{
return string.Join(" ", arguments);
}
}
} | 27.170213 | 93 | 0.497259 | [
"MIT"
] | Voltstro-Studios/UnityWebBrowser | src/Packages/UnityWebBrowser/Runtime/WebBrowserArgsBuilder.cs | 1,277 | C# |
using System.Collections.Generic;
using RimWorld;
using UnityEngine;
using Verse;
using Verse.Sound;
namespace JecsTools
{
public class Projectile_LaserConfig
{
public Vector3 offset;
}
public class Projectile_Laser : Projectile
{
// Variables.
public int tickCounter = 0;
public Thing hitThing = null;
// Custom XML variables.
public float preFiringInitialIntensity = 0f;
public float preFiringFinalIntensity = 0f;
public float postFiringInitialIntensity = 0f;
public float postFiringFinalIntensity = 0f;
public int preFiringDuration = 0;
public int postFiringDuration = 0;
public float startFireChance = 0;
public bool canStartFire = false;
// Draw variables.
public Material preFiringTexture;
public Material postFiringTexture;
public List<Matrix4x4> drawingMatrix = null;
//public Vector3 drawingScale;
//public Vector3 drawingPosition;
public float drawingIntensity = 0f;
public Material drawingTexture;
protected virtual void Explode(Thing hitThing, bool destroy = false)
{
var map = Map;
var targetPosition = hitThing?.PositionHeld ?? destination.ToIntVec3();
if (destroy)
Destroy();
if (def.projectile.explosionEffect != null)
{
var effecter = def.projectile.explosionEffect.Spawn();
effecter.Trigger(new TargetInfo(targetPosition, map),
new TargetInfo(targetPosition, map));
effecter.Cleanup();
}
GenExplosion.DoExplosion(targetPosition, map, def.projectile.explosionRadius, def.projectile.damageDef,
launcher, def.projectile.GetDamageAmount(1f), 0f, def.projectile.soundExplode, equipmentDef, def, null,
def.projectile.postExplosionSpawnThingDef, def.projectile.postExplosionSpawnChance,
def.projectile.postExplosionSpawnThingCount, def.projectile.applyDamageToExplosionCellsNeighbors,
def.projectile.preExplosionSpawnThingDef, def.projectile.preExplosionSpawnChance,
def.projectile.preExplosionSpawnThingCount, def.projectile.explosionChanceToStartFire,
def.projectile.explosionDamageFalloff);
}
public override void SpawnSetup(Map map, bool blabla)
{
base.SpawnSetup(map, blabla);
drawingTexture = def.DrawMatSingle;
}
/// <summary>
/// Get parameters from XML.
/// </summary>
public void GetParametersFromXml()
{
var additionalParameters = def as ThingDef_LaserProjectile;
preFiringDuration = additionalParameters.preFiringDuration;
postFiringDuration = additionalParameters.postFiringDuration;
// Draw.
preFiringInitialIntensity = additionalParameters.preFiringInitialIntensity;
preFiringFinalIntensity = additionalParameters.preFiringFinalIntensity;
postFiringInitialIntensity = additionalParameters.postFiringInitialIntensity;
postFiringFinalIntensity = additionalParameters.postFiringFinalIntensity;
startFireChance = additionalParameters.StartFireChance;
canStartFire = additionalParameters.CanStartFire;
}
/// <summary>
/// Save/load data from a savegame file (apparently not used for projectile for now).
/// </summary>
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref tickCounter, nameof(tickCounter));
if (Scribe.mode == LoadSaveMode.PostLoadInit)
{
GetParametersFromXml();
}
}
/// <summary>
/// Main projectile sequence.
/// </summary>
public override void Tick()
{
// Log.Message("Tickng Ma Lazor");
// Directly call the Projectile base Tick function (we want to completely override the Projectile Tick() function).
//((ThingWithComponents)this).Tick(); // Does not work...
try
{
if (tickCounter == 0)
{
GetParametersFromXml();
PerformPreFiringTreatment();
}
// Pre firing.
if (tickCounter < preFiringDuration)
{
GetPreFiringDrawingParameters();
}
// Firing.
else if (tickCounter == preFiringDuration)
{
Fire();
GetPostFiringDrawingParameters();
}
// Post firing.
else
{
GetPostFiringDrawingParameters();
}
if (tickCounter == (preFiringDuration + postFiringDuration) && !Destroyed)
{
Destroy();
}
if (launcher != null)
{
if (launcher is Pawn)
{
var launcherPawn = launcher as Pawn;
if (launcherPawn.Dead && !Destroyed)
{
Destroy();
}
}
}
tickCounter++;
}
catch
{
Destroy();
}
}
/// <summary>
/// Performs prefiring treatment: data initalization.
/// </summary>
public virtual void PerformPreFiringTreatment()
{
DetermineImpactExactPosition();
var cannonMouthOffset = (destination - origin).normalized * 0.9f;
if (Def.graphicSettings.NullOrEmpty())
{
var drawingScale = new Vector3(1f, 1f,
(destination - origin).magnitude - cannonMouthOffset.magnitude);
var drawingPosition = origin + (cannonMouthOffset / 2) + ((destination - origin) / 2) +
Vector3.up * def.Altitude;
drawingMatrix = new List<Matrix4x4>();
var drawing = Matrix4x4.TRS(drawingPosition, ExactRotation, drawingScale);
drawingMatrix.Add(drawing);
}
else
{
drawingMatrix = new List<Matrix4x4>();
if (!Def.cycleThroughFiringPositions)
{
foreach (var setting in Def.graphicSettings)
{
AddLaserGraphicUsing(setting);
}
}
else
{
if (HarmonyPatches.AlternatingFireTracker.TryGetValue(launcher, out var curIndex))
{
curIndex = (curIndex + 1) % Def.graphicSettings.Count;
HarmonyPatches.AlternatingFireTracker[launcher] = curIndex;
}
else
{
curIndex = 0; // technically unnecessary but good to be explicit
HarmonyPatches.AlternatingFireTracker.Add(launcher, curIndex);
}
AddLaserGraphicUsing(Def.graphicSettings[curIndex]);
}
}
}
private void AddLaserGraphicUsing(Projectile_LaserConfig setting)
{
var curCannonMouthOffset = (destination - origin).normalized * 0.9f;
var drawingScale = new Vector3(1f, 1f,
(destination - origin).magnitude - curCannonMouthOffset.magnitude);
var drawingPosition = origin + (curCannonMouthOffset / 2) + ((destination - origin) / 2) +
Vector3.up * def.Altitude;
var num = 0f;
if ((destination - origin).MagnitudeHorizontalSquared() > 0.001f)
{
num = (destination - origin).AngleFlat();
}
drawingPosition += setting.offset.RotatedBy(num);
var drawing = Matrix4x4.TRS(drawingPosition, ExactRotation, drawingScale);
drawingMatrix.Add(drawing);
}
public ThingDef_LaserProjectile Def
{
get => def as ThingDef_LaserProjectile;
}
/// <summary>
/// Gets the prefiring drawing parameters.
/// </summary>
public virtual void GetPreFiringDrawingParameters()
{
if (preFiringDuration != 0)
{
drawingIntensity = preFiringInitialIntensity + (preFiringFinalIntensity - preFiringInitialIntensity) *
tickCounter / preFiringDuration;
}
}
/// <summary>
/// Gets the postfiring drawing parameters.
/// </summary>
public virtual void GetPostFiringDrawingParameters()
{
if (postFiringDuration != 0)
{
drawingIntensity = postFiringInitialIntensity +
(postFiringFinalIntensity - postFiringInitialIntensity) *
((tickCounter - (float)preFiringDuration) / postFiringDuration);
}
}
/// <summary>
/// Checks for colateral targets (cover, neutral animal, pawn) along the trajectory.
/// </summary>
protected void DetermineImpactExactPosition()
{
// We split the trajectory into small segments of approximatively 1 cell size.
var trajectory = destination - origin;
var numberOfSegments = (int)trajectory.magnitude;
var trajectorySegment = trajectory / trajectory.magnitude;
var temporaryDestination = origin; // Last valid tested position in case of an out of boundaries shot.
var exactTestedPosition = origin;
for (var segmentIndex = 1; segmentIndex <= numberOfSegments; segmentIndex++)
{
exactTestedPosition += trajectorySegment;
var testedPosition = exactTestedPosition.ToIntVec3();
if (!exactTestedPosition.InBounds(Map))
{
destination = temporaryDestination;
break;
}
if (!def.projectile.flyOverhead && segmentIndex >= 5)
{
var list = Map.thingGrid.ThingsListAt(Position);
for (var i = 0; i < list.Count; i++)
{
var current = list[i];
// Check impact on a wall.
if (current.def.Fillage == FillCategory.Full)
{
destination = testedPosition.ToVector3Shifted() +
new Vector3(Rand.Range(-0.3f, 0.3f), 0f, Rand.Range(-0.3f, 0.3f));
hitThing = current;
break;
}
// Check impact on a pawn.
if (current.def.category == ThingCategory.Pawn)
{
var pawn = current as Pawn;
var chanceToHitCollateralTarget = 0.45f;
if (pawn.Downed)
{
chanceToHitCollateralTarget *= 0.1f;
}
var targetDistanceFromShooter = (ExactPosition - origin).MagnitudeHorizontal();
if (targetDistanceFromShooter < 4f)
{
chanceToHitCollateralTarget *= 0f;
}
else
{
if (targetDistanceFromShooter < 7f)
{
chanceToHitCollateralTarget *= 0.5f;
}
else
{
if (targetDistanceFromShooter < 10f)
{
chanceToHitCollateralTarget *= 0.75f;
}
}
}
chanceToHitCollateralTarget *= pawn.RaceProps.baseBodySize;
if (Rand.Value < chanceToHitCollateralTarget)
{
destination = testedPosition.ToVector3Shifted() +
new Vector3(Rand.Range(-0.3f, 0.3f), 0f, Rand.Range(-0.3f, 0.3f));
hitThing = pawn;
break;
}
}
}
}
temporaryDestination = exactTestedPosition;
}
}
/// <summary>
/// Manages the projectile damage application.
/// </summary>
public virtual void Fire()
{
ApplyDamage(hitThing);
}
/// <summary>
/// Applies damage on a collateral pawn or an object.
/// </summary>
protected void ApplyDamage(Thing hitThing)
{
if (hitThing != null)
{
// Impact collateral target.
Impact(hitThing);
}
else
{
ImpactSomething();
}
}
/// <summary>
/// Computes what should be impacted in the DestinationCell.
/// </summary>
protected void ImpactSomething()
{
// Check impact on a thick mountain.
if (def.projectile.flyOverhead)
{
var roofDef = Map.roofGrid.RoofAt(DestinationCell);
if (roofDef != null && roofDef.isThickRoof)
{
def.projectile.soundHitThickRoof.PlayOneShot(SoundInfo.InMap(new TargetInfo(DestinationCell, Map)));
return;
}
}
// Impact the initial targeted pawn.
if (usedTarget != null)
{
if (usedTarget.Thing is Pawn pawn && pawn.Downed && (origin - destination).magnitude > 5f && Rand.Value < 0.2f)
Impact(null);
else
Impact(usedTarget.Thing);
}
else
{
// Impact a pawn in the destination cell if present.
var thing = Map.thingGrid.ThingAt(DestinationCell, ThingCategory.Pawn);
if (thing != null)
{
Impact(thing);
}
else
{
// Impact any cover object.
foreach (var current in Map.thingGrid.ThingsAt(DestinationCell))
{
if (current.def.fillPercent > 0f || current.def.passability != Traversability.Standable)
{
Impact(current);
return;
}
}
Impact(null);
}
}
}
/// <summary>
/// Impacts a pawn/object or the ground.
/// </summary>
protected override void Impact(Thing hitThing)
{
if (Def.createsExplosion)
{
Explode(hitThing, false);
GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, def.projectile.damageDef,
launcher.Faction);
}
if (hitThing != null)
{
var battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(launcher,
hitThing, intendedTarget.Thing, equipmentDef, def, targetCoverDef);
Find.BattleLog.Add(battleLogEntry_RangedImpact);
var dinfo = new DamageInfo(def.projectile.damageDef, def.projectile.GetDamageAmount(1f), def.projectile.GetArmorPenetration(1f), ExactRotation.eulerAngles.y, launcher, weapon: equipmentDef);
hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
if (canStartFire && Rand.Range(0f, 1f) > startFireChance)
{
hitThing.TryAttachFire(0.05f);
}
if (hitThing is Pawn pawn)
{
PostImpactEffects(launcher as Pawn, pawn);
FleckMaker.ThrowMicroSparks(destination, Map);
FleckMaker.Static(destination, Map, FleckDefOf.ShotHit_Dirt);
}
}
else
{
SoundDefOf.BulletImpact_Ground.PlayOneShot(SoundInfo.InMap(new TargetInfo(Position, Map)));
FleckMaker.Static(ExactPosition, Map, FleckDefOf.ShotHit_Dirt);
FleckMaker.ThrowMicroSparks(ExactPosition, Map);
}
}
/// <summary>
/// JECRELL:: Added this to make derived classes work easily.
/// </summary>
/// <param name="launcher"></param>
/// <param name="hitTarget"></param>
public virtual void PostImpactEffects(Pawn launcher, Pawn hitTarget)
{
}
/// <summary>
/// Draws the laser ray.
/// </summary>
public override void Draw()
{
Comps_PostDraw();
if (drawingMatrix != null)
{
foreach (var drawing in drawingMatrix)
{
Graphics.DrawMesh(MeshPool.plane10, drawing,
FadedMaterialPool.FadedVersionOf(drawingTexture, drawingIntensity), 0);
}
}
}
}
}
| 38.169811 | 206 | 0.496677 | [
"MIT"
] | Proxyer/JecsTools | Source/AllModdingComponents/JecsTools/Projectile_Laser.cs | 18,209 | C# |
//------------------------------------------------------------------------------
// <copyright file="WebPartAddingEventHandler.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.UI.WebControls.WebParts {
using System;
public delegate void WebPartAddingEventHandler(object sender, WebPartAddingEventArgs e);
}
| 34.214286 | 92 | 0.501044 | [
"Apache-2.0"
] | 295007712/295007712.github.io | sourceCode/dotNet4.6/ndp/fx/src/xsp/system/Web/UI/WebParts/WebPartAddingEventHandler.cs | 479 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace BT_and_BST.Classes
{
public class BinarySearchTree
{
public Node Root { get; set; }
public BinarySearchTree(Node node)
{
Root = node;
}
/// <summary>
/// traverses a binary tree, printing out the values in "root, left, right" order
/// </summary>
/// <param name="node">the root node to start at</param>
public void PreOrder(Node node)
{
Console.WriteLine(node.Value);
if (node.LeftChild != null)
{
PreOrder(node.LeftChild);
}
if (node.RightChild != null)
{
PreOrder(node.RightChild);
}
}
/// <summary>
/// traverses a binary tree, printing out the values in "left, root, right" order
/// </summary>
/// <param name="node">the root node to start at</param>
public void InOrder(Node node)
{
if (node.LeftChild != null)
{
InOrder(node.LeftChild);
}
Console.WriteLine(node.Value);
if (node.RightChild != null)
{
InOrder(node.RightChild);
}
}
/// <summary>
/// traverses a binary tree, printing out the values in "left, right root" order
/// </summary>
/// <param name="node">the root node to start at</param>
public void PostOrder(Node node)
{
if (node.LeftChild != null)
{
PostOrder(node.LeftChild);
}
if (node.RightChild != null)
{
PostOrder(node.RightChild);
}
Console.WriteLine(node.Value);
}
/// <summary>
/// traverses through each "level" of a tree, going left to right
/// </summary>
/// <param name="node">the root node to start at</param>
public void BreadthFirst(Node root)
{
Queue<Node> breadth = new Queue<Node>();
breadth.Enqueue(root);
while (breadth.TryPeek(out root))
{
Node front = breadth.Dequeue();
Console.WriteLine(front.Value);
if (front.LeftChild != null)
{
breadth.Enqueue(front.LeftChild);
}
if (front.RightChild != null)
{
breadth.Enqueue(front.RightChild);
}
}
}
/// <summary>
/// adds a node to the first vacant spot using breadth first traversal
/// </summary>
/// <param name="root">the root node to start at</param>
/// <param name="value">the value of the node to add</param>
/// <returns>boolean determining whether the add was successful</returns>
public bool Add(Node root, int value)
{
if (value == root.Value)
return false;
Node datNode = new Node(value);
Queue<Node> breadth = new Queue<Node>();
breadth.Enqueue(root);
while (breadth.TryPeek(out root))
{
Node front = breadth.Dequeue();
Console.WriteLine(front.Value);
if (value == front.Value)
return false;
if (value < front.Value)
{
if (front.LeftChild == null)
{
front.LeftChild = datNode;
Console.WriteLine($"Added {value} to the left of {front.Value}.");
return true;
}
else
{
breadth.Enqueue(front.LeftChild);
}
}
if (value > front.Value)
{
if (front.RightChild == null)
{
front.RightChild = datNode;
Console.WriteLine($"Added {value} to the right of {front.Value}");
return true;
}
else
{
breadth.Enqueue(front.RightChild);
}
}
}
return false;
}
/// <summary>
/// searches for the value of a node in a tree
/// </summary>
/// <param name="root">the root node to start at</param>
/// <param name="value"></param>
/// <returns>the node if it was found</returns>
public Node Search(Node root, int value)
{
if (root != null)
{
Node datNode = new Node(value);
if (value == root.Value)
{
Console.WriteLine($"Found a match with the value {root.Value}!");
return root;
}
if (value < root.Value)
return Search(root.LeftChild, value);
if (value > root.Value)
return Search(root.RightChild, value);
}
Console.WriteLine("Sorry, but we could not find a match!");
return null;
}
}
}
| 29.813187 | 90 | 0.445264 | [
"MIT"
] | ecaoile/Data-Structures-and-Algorithms | data_structures/Trees/BinaryTree_and_BinarySearchTree/BT_and_BST/Classes/BinarySearchTree.cs | 5,428 | C# |
// Code generated by a Template
using System;
using DNX.Helpers.Maths;
using DNX.Helpers.Validation;
using NUnit.Framework;
using Shouldly;
using Test.DNX.Helpers.Validation.TestsDataSource;
namespace Test.DNX.Helpers.Validation
{
[TestFixture]
public class GuardUInt16Tests
{
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsBetween_Default")]
public bool Guard_IsBetween_Default(ushort value, ushort min, ushort max, string messageText)
{
try
{
// Act
Guard.IsBetween(() => value, min, max);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsBetween_BoundsType")]
public bool Guard_IsBetween_BoundsType(ushort value, ushort min, ushort max, IsBetweenBoundsType boundsType, string messageText)
{
try
{
// Act
Guard.IsBetween(() => value, min, max, boundsType);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsBetween")]
public bool Guard_IsBetween(ushort value, ushort min, ushort max, bool allowEitherOrder, IsBetweenBoundsType boundsType, string messageText)
{
try
{
// Act
Guard.IsBetween(() => value, min, max, allowEitherOrder, boundsType);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsGreaterThan")]
public bool Guard_IsGreaterThan_Expr(ushort value, ushort min, string messageText)
{
try
{
// Act
Guard.IsGreaterThan(() => value, min);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsGreaterThan")]
public bool Guard_IsGreaterThan_Value(ushort actualValue, ushort min, string messageText)
{
try
{
// Act
ushort value = min;
Guard.IsGreaterThan(() => value, actualValue, min);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsGreaterThanOrEqualTo")]
public bool Guard_IsGreaterThanOrEqualTo_Expr(ushort value, ushort min, string messageText)
{
try
{
// Act
Guard.IsGreaterThanOrEqualTo(() => value, min);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsGreaterThanOrEqualTo")]
public bool Guard_IsGreaterThanOrEqualTo_Value(ushort actualValue, ushort min, string messageText)
{
try
{
// Act
ushort value = min;
Guard.IsGreaterThanOrEqualTo(() => value, actualValue, min);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsLessThan")]
public bool Guard_IsLessThan_Expr(ushort value, ushort max, string messageText)
{
try
{
// Act
Guard.IsLessThan(() => value, max);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsLessThan")]
public bool Guard_IsLessThan_Value(ushort actualValue, ushort max, string messageText)
{
try
{
// Act
ushort value = max;
Guard.IsLessThan(() => value, actualValue, max);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsLessThanOrEqualTo")]
public bool Guard_IsLessThanOrEqualTo_Expr(ushort value, ushort max, string messageText)
{
try
{
// Act
Guard.IsLessThanOrEqualTo(() => value, max);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
[TestCaseSource(typeof(GuardUInt16TestsSource), "IsLessThanOrEqualTo")]
public bool Guard_IsLessThanOrEqualTo_Value(ushort actualValue, ushort max, string messageText)
{
try
{
// Act
ushort value = max;
Guard.IsLessThanOrEqualTo(() => value, actualValue, max);
return true;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNotNull(messageText);
Assert.IsNotEmpty(messageText);
ex.Message.ShouldStartWith(messageText);
return false;
}
catch (Exception ex)
{
// Assert
Assert.Fail(ex.Message);
return false;
}
}
}
}
| 30.908163 | 148 | 0.48938 | [
"MIT"
] | martinsmith1968/DNX.Helpers | Test.DNX.Helpers/Validation/GuardUInt16Tests.generated.cs | 9,087 | C# |
using System;
using NetOffice;
namespace NetOffice.VisioApi.Enums
{
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
[EntityTypeAttribute(EntityType.IsEnum)]
public enum VisWindowScrollY
{
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>9</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollNoneY = 9,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>0</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollUp = 0,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>2</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollUpPage = 2,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>1</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollDown = 1,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>3</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollDownPage = 3,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>6</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollToTop = 6,
/// <summary>
/// SupportByVersion Visio 11, 12, 14, 15
/// </summary>
/// <remarks>7</remarks>
[SupportByVersionAttribute("Visio", 11,12,14,15)]
visScrollToBottom = 7
}
} | 26.737705 | 53 | 0.599632 | [
"MIT"
] | NetOffice/NetOffice | Source/Visio/Enums/VisWindowScrollY.cs | 1,631 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Binance.Net.Converters;
using Binance.Net.Enums;
using Binance.Net.Interfaces.SubClients.Spot;
using Binance.Net.Objects.Spot.SpotData;
using CryptoExchange.Net;
using CryptoExchange.Net.Converters;
using CryptoExchange.Net.Logging;
using CryptoExchange.Net.Objects;
using Newtonsoft.Json;
namespace Binance.Net.SubClients.Spot
{
/// <summary>
/// Spot order endpoints
/// </summary>
public class BinanceClientSpotOrder : IBinanceClientSpotOrder
{
private const string api = "api";
private const string signedVersion = "3";
// Orders
private const string openOrdersEndpoint = "openOrders";
private const string allOrdersEndpoint = "allOrders";
private const string newOrderEndpoint = "order";
private const string newTestOrderEndpoint = "order/test";
private const string queryOrderEndpoint = "order";
private const string cancelOrderEndpoint = "order";
private const string cancelAllOpenOrderEndpoint = "openOrders";
private const string myTradesEndpoint = "myTrades";
// OCO orders
private const string newOcoOrderEndpoint = "order/oco";
private const string cancelOcoOrderEndpoint = "orderList";
private const string getOcoOrderEndpoint = "orderList";
private const string getAllOcoOrderEndpoint = "allOrderList";
private const string getOpenOcoOrderEndpoint = "openOrderList";
private readonly BinanceClient _baseClient;
private readonly Log _log;
internal BinanceClientSpotOrder(Log log, BinanceClient baseClient)
{
_baseClient = baseClient;
_log = log;
}
#region Test New Order
/// <summary>
/// Places a new test order. Test orders are not actually being executed and just test the functionality.
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="type">The order type (limit/market)</param>
/// <param name="timeInForce">Lifetime of the order (GoodTillCancel/ImmediateOrCancel)</param>
/// <param name="quantity">The amount of the symbol</param>
/// <param name="quoteOrderQuantity">The amount of the quote symbol. Only valid for market orders</param>
/// <param name="price">The price to use</param>
/// <param name="newClientOrderId">Unique id for order</param>
/// <param name="stopPrice">Used for stop orders</param>
/// <param name="icebergQty">User for iceberg orders</param>
/// <param name="orderResponseType">Used for the response JSON</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for the placed test order</returns>
public WebCallResult<BinancePlacedOrder> PlaceTestOrder(string symbol,
OrderSide side,
OrderType type,
decimal? quantity = null,
decimal? quoteOrderQuantity = null,
string? newClientOrderId = null,
decimal? price = null,
TimeInForce? timeInForce = null,
decimal? stopPrice = null,
decimal? icebergQty = null,
OrderResponseType? orderResponseType = null,
int? receiveWindow = null,
CancellationToken ct = default) => PlaceTestOrderAsync(symbol, side, type, quantity, quoteOrderQuantity, newClientOrderId, price, timeInForce, stopPrice, icebergQty, orderResponseType, receiveWindow, ct).Result;
/// <summary>
/// Places a new test order. Test orders are not actually being executed and just test the functionality.
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="type">The order type (limit/market)</param>
/// <param name="timeInForce">Lifetime of the order (GoodTillCancel/ImmediateOrCancel)</param>
/// <param name="quantity">The amount of the symbol</param>
/// <param name="quoteOrderQuantity">The amount of the quote symbol. Only valid for market orders</param>
/// <param name="price">The price to use</param>
/// <param name="newClientOrderId">Unique id for order</param>
/// <param name="stopPrice">Used for stop orders</param>
/// <param name="icebergQty">User for iceberg orders</param>
/// <param name="orderResponseType">Used for the response JSON</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for the placed test order</returns>
public async Task<WebCallResult<BinancePlacedOrder>> PlaceTestOrderAsync(string symbol,
OrderSide side,
OrderType type,
decimal? quantity = null,
decimal? quoteOrderQuantity = null,
string? newClientOrderId = null,
decimal? price = null,
TimeInForce? timeInForce = null,
decimal? stopPrice = null,
decimal? icebergQty = null,
OrderResponseType? orderResponseType = null,
int? receiveWindow = null,
CancellationToken ct = default)
{
return await _baseClient.PlaceOrderInternal(_baseClient.GetUrlSpot(newTestOrderEndpoint, api, signedVersion),
symbol,
side,
type,
quantity,
quoteOrderQuantity,
newClientOrderId,
price,
timeInForce,
stopPrice,
icebergQty,
null,
null,
orderResponseType,
receiveWindow,
ct).ConfigureAwait(false);
}
#endregion
#region New Order
/// <summary>
/// Places a new order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="type">The order type</param>
/// <param name="timeInForce">Lifetime of the order (GoodTillCancel/ImmediateOrCancel/FillOrKill)</param>
/// <param name="quantity">The amount of the base symbol</param>
/// <param name="quoteOrderQuantity">The amount of the quote symbol. Only valid for market orders</param>
/// <param name="price">The price to use</param>
/// <param name="newClientOrderId">Unique id for order</param>
/// <param name="stopPrice">Used for stop orders</param>
/// <param name="icebergQty">Used for iceberg orders</param>
/// <param name="orderResponseType">Used for the response JSON</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for the placed order</returns>
public WebCallResult<BinancePlacedOrder> PlaceOrder(
string symbol,
OrderSide side,
OrderType type,
decimal? quantity = null,
decimal? quoteOrderQuantity = null,
string? newClientOrderId = null,
decimal? price = null,
TimeInForce? timeInForce = null,
decimal? stopPrice = null,
decimal? icebergQty = null,
OrderResponseType? orderResponseType = null,
int? receiveWindow = null,
CancellationToken ct = default) => PlaceOrderAsync(symbol, side, type, quantity, quoteOrderQuantity, newClientOrderId, price, timeInForce, stopPrice, icebergQty, orderResponseType, receiveWindow, ct).Result;
/// <summary>
/// Places a new order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="type">The order type</param>
/// <param name="timeInForce">Lifetime of the order (GoodTillCancel/ImmediateOrCancel/FillOrKill)</param>
/// <param name="quantity">The amount of the symbol</param>
/// <param name="quoteOrderQuantity">The amount of the quote symbol. Only valid for market orders</param>
/// <param name="price">The price to use</param>
/// <param name="newClientOrderId">Unique id for order</param>
/// <param name="stopPrice">Used for stop orders</param>
/// <param name="icebergQty">Used for iceberg orders</param>
/// <param name="orderResponseType">Used for the response JSON</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for the placed order</returns>
public async Task<WebCallResult<BinancePlacedOrder>> PlaceOrderAsync(string symbol,
OrderSide side,
OrderType type,
decimal? quantity = null,
decimal? quoteOrderQuantity = null,
string? newClientOrderId = null,
decimal? price = null,
TimeInForce? timeInForce = null,
decimal? stopPrice = null,
decimal? icebergQty = null,
OrderResponseType? orderResponseType = null,
int? receiveWindow = null,
CancellationToken ct = default)
{
return await _baseClient.PlaceOrderInternal(_baseClient.GetUrlSpot(newOrderEndpoint, api, signedVersion),
symbol,
side,
type,
quantity,
quoteOrderQuantity,
newClientOrderId,
price,
timeInForce,
stopPrice,
icebergQty,
null,
null,
orderResponseType,
receiveWindow,
ct).ConfigureAwait(false);
}
#endregion
#region Cancel Order
/// <summary>
/// Cancels a pending order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderId">The order id of the order</param>
/// <param name="origClientOrderId">The client order id of the order</param>
/// <param name="newClientOrderId">The new client order id of the order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public WebCallResult<BinanceCanceledOrder> CancelOrder(string symbol, long? orderId = null, string? origClientOrderId = null, string? newClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) => CancelOrderAsync(symbol, orderId, origClientOrderId, newClientOrderId, receiveWindow, ct).Result;
/// <summary>
/// Cancels a pending order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderId">The order id of the order</param>
/// <param name="origClientOrderId">The client order id of the order</param>
/// <param name="newClientOrderId">Unique identifier for this cancel</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public async Task<WebCallResult<BinanceCanceledOrder>> CancelOrderAsync(string symbol, long? orderId = null, string? origClientOrderId = null, string? newClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<BinanceCanceledOrder>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
if (!orderId.HasValue && string.IsNullOrEmpty(origClientOrderId))
throw new ArgumentException("Either orderId or origClientOrderId must be sent");
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("orderId", orderId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("origClientOrderId", origClientOrderId);
parameters.AddOptionalParameter("newClientOrderId", newClientOrderId);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<BinanceCanceledOrder>(_baseClient.GetUrlSpot(cancelOrderEndpoint, api, signedVersion), HttpMethod.Delete, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Cancel all Open Orders on a Symbol
/// <summary>
/// Cancels all open orders on a symbol
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public WebCallResult<IEnumerable<BinanceCancelledId>> CancelAllOpenOrders(string symbol,
long? receiveWindow = null, CancellationToken ct = default)
=> CancelAllOpenOrdersAsync(symbol, receiveWindow, ct).Result;
/// <summary>
/// Cancels all open orders on a symbol
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public async Task<WebCallResult<IEnumerable<BinanceCancelledId>>> CancelAllOpenOrdersAsync(string symbol, long? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceCancelledId>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceCancelledId>>(_baseClient.GetUrlSpot(cancelAllOpenOrderEndpoint, api, signedVersion), HttpMethod.Delete, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Query Order
/// <summary>
/// Retrieves data for a specific order. Either orderId or origClientOrderId should be provided.
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderId">The order id of the order</param>
/// <param name="origClientOrderId">The client order id of the order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>The specific order</returns>
public WebCallResult<BinanceOrder> GetOrder(string symbol, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) => GetOrderAsync(symbol, orderId, origClientOrderId, receiveWindow, ct).Result;
/// <summary>
/// Retrieves data for a specific order. Either orderId or origClientOrderId should be provided.
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderId">The order id of the order</param>
/// <param name="origClientOrderId">The client order id of the order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>The specific order</returns>
public async Task<WebCallResult<BinanceOrder>> GetOrderAsync(string symbol, long? orderId = null, string? origClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
if (orderId == null && origClientOrderId == null)
throw new ArgumentException("Either orderId or origClientOrderId must be sent");
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<BinanceOrder>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("orderId", orderId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("origClientOrderId", origClientOrderId);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<BinanceOrder>(_baseClient.GetUrlSpot(queryOrderEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Current Open Orders
/// <summary>
/// Gets a list of open orders
/// </summary>
/// <param name="symbol">The symbol to get open orders for</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of open orders</returns>
public WebCallResult<IEnumerable<BinanceOrder>> GetOpenOrders(string? symbol = null, int? receiveWindow = null, CancellationToken ct = default) => GetOpenOrdersAsync(symbol, receiveWindow, ct).Result;
/// <summary>
/// Gets a list of open orders
/// </summary>
/// <param name="symbol">The symbol to get open orders for</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of open orders</returns>
public async Task<WebCallResult<IEnumerable<BinanceOrder>>> GetOpenOrdersAsync(string? symbol = null, int? receiveWindow = null, CancellationToken ct = default)
{
symbol?.ValidateBinanceSymbol();
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceOrder>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("symbol", symbol);
return await _baseClient.SendRequestInternal<IEnumerable<BinanceOrder>>(_baseClient.GetUrlSpot(openOrdersEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region All Orders
/// <summary>
/// Gets all orders for the provided symbol
/// </summary>
/// <param name="symbol">The symbol to get orders for</param>
/// <param name="orderId">If set, only orders with an order id higher than the provided will be returned</param>
/// <param name="startTime">If set, only orders placed after this time will be returned</param>
/// <param name="endTime">If set, only orders placed before this time will be returned</param>
/// <param name="limit">Max number of results</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of orders</returns>
public WebCallResult<IEnumerable<BinanceOrder>> GetAllOrders(string symbol, long? orderId = null, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, int? receiveWindow = null, CancellationToken ct = default) => GetAllOrdersAsync(symbol, orderId, startTime, endTime, limit, receiveWindow, ct).Result;
/// <summary>
/// Gets all orders for the provided symbol
/// </summary>
/// <param name="symbol">The symbol to get orders for</param>
/// <param name="orderId">If set, only orders with an order id higher than the provided will be returned</param>
/// <param name="startTime">If set, only orders placed after this time will be returned</param>
/// <param name="endTime">If set, only orders placed before this time will be returned</param>
/// <param name="limit">Max number of results</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of orders</returns>
public async Task<WebCallResult<IEnumerable<BinanceOrder>>> GetAllOrdersAsync(string symbol, long? orderId = null, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, int? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
limit?.ValidateIntBetween(nameof(limit), 1, 1000);
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceOrder>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("orderId", orderId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("startTime", startTime.HasValue ? JsonConvert.SerializeObject(startTime.Value, new TimestampConverter()) : null);
parameters.AddOptionalParameter("endTime", endTime.HasValue ? JsonConvert.SerializeObject(endTime.Value, new TimestampConverter()) : null);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceOrder>>(_baseClient.GetUrlSpot(allOrdersEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region New OCO
/// <summary>
/// Places a new OCO(One cancels other) order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="stopLimitTimeInForce">Lifetime of the stop order (GoodTillCancel/ImmediateOrCancel/FillOrKill)</param>
/// <param name="quantity">The amount of the symbol</param>
/// <param name="price">The price to use</param>
/// <param name="stopPrice">The stop price</param>
/// <param name="stopLimitPrice">The price for the stop limit order</param>
/// <param name="stopClientOrderId">Client id for the stop order</param>
/// <param name="limitClientOrderId">Client id for the limit order</param>
/// <param name="listClientOrderId">Client id for the order list</param>
/// <param name="limitIcebergQuantity">Iceberg quantity for the limit order</param>
/// <param name="stopIcebergQuantity">Iceberg quantity for the stop order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Order list info</returns>
public WebCallResult<BinanceOrderOcoList> PlaceOcoOrder(
string symbol,
OrderSide side,
decimal quantity,
decimal price,
decimal stopPrice,
decimal? stopLimitPrice = null,
string? listClientOrderId = null,
string? limitClientOrderId = null,
string? stopClientOrderId = null,
decimal? limitIcebergQuantity = null,
decimal? stopIcebergQuantity = null,
TimeInForce? stopLimitTimeInForce = null,
int? receiveWindow = null,
CancellationToken ct = default) => PlaceOcoOrderAsync(symbol, side, quantity, price, stopPrice, stopLimitPrice, listClientOrderId, limitClientOrderId, stopClientOrderId, limitIcebergQuantity, stopIcebergQuantity, stopLimitTimeInForce, receiveWindow, ct).Result;
/// <summary>
/// Places a new OCO(One cancels other) order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="side">The order side (buy/sell)</param>
/// <param name="stopLimitTimeInForce">Lifetime of the stop order (GoodTillCancel/ImmediateOrCancel/FillOrKill)</param>
/// <param name="quantity">The amount of the symbol</param>
/// <param name="price">The price to use</param>
/// <param name="stopPrice">The stop price</param>
/// <param name="stopLimitPrice">The price for the stop limit order</param>
/// <param name="stopClientOrderId">Client id for the stop order</param>
/// <param name="limitClientOrderId">Client id for the limit order</param>
/// <param name="listClientOrderId">Client id for the order list</param>
/// <param name="limitIcebergQuantity">Iceberg quantity for the limit order</param>
/// <param name="stopIcebergQuantity">Iceberg quantity for the stop order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Order list info</returns>
public async Task<WebCallResult<BinanceOrderOcoList>> PlaceOcoOrderAsync(string symbol,
OrderSide side,
decimal quantity,
decimal price,
decimal stopPrice,
decimal? stopLimitPrice = null,
string? listClientOrderId = null,
string? limitClientOrderId = null,
string? stopClientOrderId = null,
decimal? limitIcebergQuantity = null,
decimal? stopIcebergQuantity = null,
TimeInForce? stopLimitTimeInForce = null,
int? receiveWindow = null,
CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<BinanceOrderOcoList>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var rulesCheck = await _baseClient.CheckTradeRules(symbol, quantity, price, stopPrice, null, ct).ConfigureAwait(false);
if (!rulesCheck.Passed)
{
_log.Write(LogVerbosity.Warning, rulesCheck.ErrorMessage!);
return new WebCallResult<BinanceOrderOcoList>(null, null, null, new ArgumentError(rulesCheck.ErrorMessage!));
}
quantity = rulesCheck.Quantity!.Value;
price = rulesCheck.Price!.Value;
stopPrice = rulesCheck.StopPrice!.Value;
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "side", JsonConvert.SerializeObject(side, new OrderSideConverter(false)) },
{ "quantity", quantity.ToString(CultureInfo.InvariantCulture) },
{ "price", price.ToString(CultureInfo.InvariantCulture) },
{ "stopPrice", stopPrice.ToString(CultureInfo.InvariantCulture) },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("stopLimitPrice", stopLimitPrice?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("listClientOrderId", listClientOrderId);
parameters.AddOptionalParameter("limitClientOrderId", limitClientOrderId);
parameters.AddOptionalParameter("stopClientOrderId", stopClientOrderId);
parameters.AddOptionalParameter("limitIcebergQty", limitIcebergQuantity?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("stopIcebergQty", stopIcebergQuantity?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("stopLimitTimeInForce", stopLimitTimeInForce == null ? null : JsonConvert.SerializeObject(stopLimitTimeInForce, new TimeInForceConverter(false)));
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<BinanceOrderOcoList>(_baseClient.GetUrlSpot(newOcoOrderEndpoint, api, signedVersion), HttpMethod.Post, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Cancel OCO
/// <summary>
/// Cancels a pending oco order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderListId">The id of the order list to cancel</param>
/// <param name="listClientOrderId">The client order id of the order list to cancel</param>
/// <param name="newClientOrderId">The new client order list id for the order list</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public WebCallResult<BinanceOrderOcoList> CancelOcoOrder(string symbol, long? orderListId = null, string? listClientOrderId = null, string? newClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) => CancelOcoOrderAsync(symbol, orderListId, listClientOrderId, newClientOrderId, receiveWindow, ct).Result;
/// <summary>
/// Cancels a pending oco order
/// </summary>
/// <param name="symbol">The symbol the order is for</param>
/// <param name="orderListId">The id of the order list to cancel</param>
/// <param name="listClientOrderId">The client order id of the order list to cancel</param>
/// <param name="newClientOrderId">The new client order list id for the order list</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Id's for canceled order</returns>
public async Task<WebCallResult<BinanceOrderOcoList>> CancelOcoOrderAsync(string symbol, long? orderListId = null, string? listClientOrderId = null, string? newClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<BinanceOrderOcoList>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
if (!orderListId.HasValue && string.IsNullOrEmpty(listClientOrderId))
throw new ArgumentException("Either orderListId or listClientOrderId must be sent");
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("orderListId", orderListId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("listClientOrderId", listClientOrderId);
parameters.AddOptionalParameter("newClientOrderId", newClientOrderId);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<BinanceOrderOcoList>(_baseClient.GetUrlSpot(cancelOcoOrderEndpoint, api, signedVersion), HttpMethod.Delete, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Query OCO
/// <summary>
/// Retrieves data for a specific oco order. Either listClientOrderId or listClientOrderId should be provided.
/// </summary>
/// <param name="orderListId">The list order id of the order</param>
/// <param name="listClientOrderId">The client order id of the list order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>The specific order list</returns>
public WebCallResult<BinanceOrderOcoList> GetOcoOrder(long? orderListId = null, string? listClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default) => GetOcoOrderAsync(orderListId, listClientOrderId, receiveWindow, ct).Result;
/// <summary>
/// Retrieves data for a specific oco order. Either orderListId or listClientOrderId should be provided.
/// </summary>
/// <param name="orderListId">The list order id of the order</param>
/// <param name="listClientOrderId">The client order id of the list order</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>The specific order list</returns>
public async Task<WebCallResult<BinanceOrderOcoList>> GetOcoOrderAsync(long? orderListId = null, string? listClientOrderId = null, long? receiveWindow = null, CancellationToken ct = default)
{
if (orderListId == null && listClientOrderId == null)
throw new ArgumentException("Either orderListId or listClientOrderId must be sent");
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<BinanceOrderOcoList>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("orderListId", orderListId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("listClientOrderId", listClientOrderId);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<BinanceOrderOcoList>(_baseClient.GetUrlSpot(getOcoOrderEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Query all OCO
/// <summary>
/// Retrieves a list of oco orders matching the parameters
/// </summary>
/// <param name="fromId">Only return oco orders with id higher than this</param>
/// <param name="startTime">Only return oco orders placed later than this. Only valid if fromId isn't provided</param>
/// <param name="endTime">Only return oco orders placed before this. Only valid if fromId isn't provided</param>
/// <param name="limit">Max number of results</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Order lists matching the parameters</returns>
public WebCallResult<IEnumerable<BinanceOrderOcoList>> GetOcoOrders(long? fromId = null, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, long? receiveWindow = null, CancellationToken ct = default) => GetOcoOrdersAsync(fromId, startTime, endTime, limit, receiveWindow, ct).Result;
/// <summary>
/// Retrieves a list of oco orders matching the parameters
/// </summary>
/// <param name="fromId">Only return oco orders with id higher than this</param>
/// <param name="startTime">Only return oco orders placed later than this. Only valid if fromId isn't provided</param>
/// <param name="endTime">Only return oco orders placed before this. Only valid if fromId isn't provided</param>
/// <param name="limit">Max number of results</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Order lists matching the parameters</returns>
public async Task<WebCallResult<IEnumerable<BinanceOrderOcoList>>> GetOcoOrdersAsync(long? fromId = null, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, long? receiveWindow = null, CancellationToken ct = default)
{
if (fromId != null && (startTime != null || endTime != null))
throw new ArgumentException("Start/end time can only be provided without fromId parameter");
limit?.ValidateIntBetween(nameof(limit), 1, 1000);
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceOrderOcoList>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("fromId", fromId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("startTime", startTime != null ? JsonConvert.SerializeObject(startTime, new TimestampConverter()) : null);
parameters.AddOptionalParameter("endTime", endTime != null ? JsonConvert.SerializeObject(endTime, new TimestampConverter()) : null);
parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceOrderOcoList>>(_baseClient.GetUrlSpot(getAllOcoOrderEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Query Open OCO
/// <summary>
/// Retrieves a list of open oco orders
/// </summary>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Open order lists</returns>
public WebCallResult<IEnumerable<BinanceOrderOcoList>> GetOpenOcoOrders(long? receiveWindow = null, CancellationToken ct = default) => GetOpenOcoOrdersAsync(receiveWindow, ct).Result;
/// <summary>
/// Retrieves a list of open oco orders
/// </summary>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>Open order lists</returns>
public async Task<WebCallResult<IEnumerable<BinanceOrderOcoList>>> GetOpenOcoOrdersAsync(long? receiveWindow = null, CancellationToken ct = default)
{
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceOrderOcoList>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceOrderOcoList>>(_baseClient.GetUrlSpot(getOpenOcoOrderEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
#region Get user trades
/// <summary>
/// Gets all user trades for provided symbol
/// </summary>
/// <param name="symbol">Symbol to get trades for</param>
/// <param name="limit">The max number of results</param>
/// <param name="startTime">Orders newer than this date will be retrieved</param>
/// <param name="endTime">Orders older than this date will be retrieved</param>
/// <param name="fromId">TradeId to fetch from. Default gets most recent trades</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of trades</returns>
public WebCallResult<IEnumerable<BinanceTrade>> GetMyTrades(string symbol, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, long? fromId = null, long? receiveWindow = null, CancellationToken ct = default) => GetMyTradesAsync(symbol, startTime, endTime, limit, fromId, receiveWindow, ct).Result;
/// <summary>
/// Gets all user trades for provided symbol
/// </summary>
/// <param name="symbol">Symbol to get trades for</param>
/// <param name="limit">The max number of results</param>
/// <param name="fromId">TradeId to fetch from. Default gets most recent trades</param>
/// <param name="startTime">Orders newer than this date will be retrieved</param>
/// <param name="endTime">Orders older than this date will be retrieved</param>
/// <param name="receiveWindow">The receive window for which this request is active. When the request takes longer than this to complete the server will reject the request</param>
/// <param name="ct">Cancellation token</param>
/// <returns>List of trades</returns>
public async Task<WebCallResult<IEnumerable<BinanceTrade>>> GetMyTradesAsync(string symbol, DateTime? startTime = null, DateTime? endTime = null, int? limit = null, long? fromId = null, long? receiveWindow = null, CancellationToken ct = default)
{
symbol.ValidateBinanceSymbol();
limit?.ValidateIntBetween(nameof(limit), 1, 1000);
var timestampResult = await _baseClient.CheckAutoTimestamp(ct).ConfigureAwait(false);
if (!timestampResult)
return new WebCallResult<IEnumerable<BinanceTrade>>(timestampResult.ResponseStatusCode, timestampResult.ResponseHeaders, null, timestampResult.Error);
var parameters = new Dictionary<string, object>
{
{ "symbol", symbol },
{ "timestamp", _baseClient.GetTimestamp() }
};
parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("fromId", fromId?.ToString(CultureInfo.InvariantCulture));
parameters.AddOptionalParameter("startTime", startTime.HasValue ? JsonConvert.SerializeObject(startTime.Value, new TimestampConverter()) : null);
parameters.AddOptionalParameter("endTime", endTime.HasValue ? JsonConvert.SerializeObject(endTime.Value, new TimestampConverter()) : null);
parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.DefaultReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));
return await _baseClient.SendRequestInternal<IEnumerable<BinanceTrade>>(_baseClient.GetUrlSpot(myTradesEndpoint, api, signedVersion), HttpMethod.Get, ct, parameters, true).ConfigureAwait(false);
}
#endregion
}
}
| 63.418605 | 340 | 0.672982 | [
"MIT"
] | lamtrinh238/Binance.Net | Binance.Net/SubClients/Spot/BinanceClientSpotOrders.cs | 49,088 | 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 DocScript.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Anthony Duguid")]
public string App_Author {
get {
return ((string)(this["App_Author"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("anthonyduguid@gmail.com")]
public string App_HelpEmail {
get {
return ((string)(this["App_HelpEmail"]));
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("TEST")]
public string Script_Docbase {
get {
return ((string)(this["Script_Docbase"]));
}
set {
this["Script_Docbase"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("C:\\Temp\\Update_keywords.dql")]
public string Script_PathCodeFile {
get {
return ((string)(this["Script_PathCodeFile"]));
}
set {
this["Script_PathCodeFile"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("D:\\Documentum\\product\\6.7\\bin")]
public string Script_WorkingDirectory {
get {
return ((string)(this["Script_WorkingDirectory"]));
}
set {
this["Script_WorkingDirectory"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAA3oPQUDIab0amb+Uv1r57ewAAAAACAAAAAAADZgAAwAAAABAAA" +
"ABvWo3ObjcrD008fWfykmScAAAAAASAAACgAAAAEAAAALBCsGCuHAoDMBMrscr5i+0YAAAACmwjW3x47" +
"Ac20ruoT7FYEQTyXSogqdtOFAAAABQPug5+tsKgmXBJbbOLNA7XeZYs")]
public string Script_Functional_Password {
get {
return ((string)(this["Script_Functional_Password"]));
}
set {
this["Script_Functional_Password"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("C:\\Temp\\Update_keywords_Results_TEST.txt")]
public string Script_PathResultsFile {
get {
return ((string)(this["Script_PathResultsFile"]));
}
set {
this["Script_PathResultsFile"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("idql64")]
public string Script_CodeType {
get {
return ((string)(this["Script_CodeType"]));
}
set {
this["Script_CodeType"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("USERNAME")]
public string Script_Functional_UserName {
get {
return ((string)(this["Script_Functional_UserName"]));
}
set {
this["Script_Functional_UserName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("2")]
public int Script_ResultsFileLineOffset {
get {
return ((int)(this["Script_ResultsFileLineOffset"]));
}
set {
this["Script_ResultsFileLineOffset"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("C:\\Temp")]
public string App_PathDeploy {
get {
return ((string)(this["App_PathDeploy"]));
}
set {
this["App_PathDeploy"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string App_PathUserData {
get {
return ((string)(this["App_PathUserData"]));
}
set {
this["App_PathUserData"] = value;
}
}
}
}
| 40.437126 | 152 | 0.58996 | [
"MIT"
] | Documentum-projects/DocumentumScriptAdministrator | CS/Properties/Settings.Designer.cs | 6,755 | C# |
using System;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace dueltank.Converters
{
public sealed class ObjectToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is ImageSource imageSource)
{
return imageSource;
}
if (value is String url)
{
return url;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
| 25.071429 | 99 | 0.574074 | [
"MIT"
] | fablecode/dueltank | src/uwp/src/dueltank/Presentation/dueltank/Converters/ObjectToImageConverter.cs | 704 | C# |
using System;
using System.Collections.Generic;
using Cosmos.Logging.Core;
using Cosmos.Logging.Events;
using Cosmos.Logging.Extensions.Exceptions.Configurations;
using Cosmos.Logging.Extensions.Exceptions.Destructurers;
using Cosmos.Logging.ExtraSupports;
namespace Cosmos.Logging.Extensions.Exceptions.Core {
/// <summary>
/// Exception destructuring processor
/// </summary>
public sealed class ExceptionDestructuringProcessor {
private readonly IExceptionDestructurer _reflectionBasedDestructurer;
private readonly Dictionary<Type, IExceptionDestructurer> _destructurers;
private readonly IDestructuringOptions _destructuringOptions;
/// <inheritdoc />
public ExceptionDestructuringProcessor() {
_destructuringOptions = FinalDestructuringOptions.Current;
if (_destructuringOptions == null)
throw new ArgumentException("Final destructuring options cannot be null.",
nameof(FinalDestructuringOptions.Current));
_reflectionBasedDestructurer = new ReflectionBasedDestructurer(_destructuringOptions.DestructureDepth);
_destructurers = new Dictionary<Type, IExceptionDestructurer>();
foreach (var destructurer in _destructuringOptions.Destructurers)
foreach (var targetType in destructurer.TargetTypes)
_destructurers.Add(targetType, destructurer);
}
/// <summary>
/// Destructure the destructured object into LogEvent by built-in property factory
/// </summary>
/// <param name="logEvent"></param>
/// <exception cref="ArgumentNullException"></exception>
public void Process(LogEvent logEvent) {
if (logEvent is null)
throw new ArgumentNullException(nameof(logEvent));
if (logEvent.Exception != null) {
var destructuredObject = Destructure(logEvent.Exception);
logEvent.AddExtraProperty(_destructuringOptions.Name, destructuredObject, true);
logEvent.ContextData.SetExceptionDetail(_destructuringOptions.Name, destructuredObject, logEvent.Exception, false);
}
}
/// <summary>
/// Destructure the destructured object into LogEvent by given property factory.
/// </summary>
/// <param name="logEvent"></param>
/// <param name="factory"></param>
/// <exception cref="ArgumentNullException"></exception>
public void Process(LogEvent logEvent, IShortcutPropertyFactory factory) {
if (logEvent is null)
throw new ArgumentNullException(nameof(logEvent));
if (factory is null)
throw new ArgumentNullException(nameof(factory));
if (logEvent.Exception != null) {
var destructuredObject = Destructure(logEvent.Exception);
logEvent.AddExtraProperty(factory.CreateProperty(_destructuringOptions.Name, destructuredObject, true).AsExtra());
logEvent.ContextData.SetExceptionDetail(_destructuringOptions.Name, destructuredObject, logEvent.Exception, false);
}
}
private IReadOnlyDictionary<string, object> Destructure(Exception exception) {
var data = new ExceptionPropertyBag(exception, _destructuringOptions.Filter);
var type = exception.GetType();
if (_destructurers.TryGetValue(type, out var destructurer)) {
destructurer.Destructure(exception, data, Destructure);
}
else {
_reflectionBasedDestructurer.Destructure(exception, data, Destructure);
}
return data.GetProperties();
}
}
} | 44.176471 | 131 | 0.667909 | [
"Apache-2.0"
] | alexinea/Cosmos.Logging | src/Cosmos.Logging.Extensions.Exceptions/Cosmos/Logging/Extensions/Exceptions/Core/ExceptionDestructuringProcessor.cs | 3,755 | C# |
// MIT License
// Copyright (C) 2019 VIMaec LLC.
// Copyright (C) 2019 Ara 3D. Inc
// https://ara3d.com
// Copyright (C) The Mono.Xna Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
namespace Vim.Math3d
{
/// <summary>
/// Defines the intersection between a Plane and a bounding volume.
/// </summary>
public enum PlaneIntersectionType
{
/// <summary>
/// There is no intersection, the bounding volume is in the negative half space of the plane.
/// </summary>
Front,
/// <summary>
/// There is no intersection, the bounding volume is in the positive half space of the plane.
/// </summary>
Back,
/// <summary>
/// The plane is intersected.
/// </summary>
Intersecting
}
} | 30.344828 | 101 | 0.605682 | [
"MIT"
] | ara3d/Math3D | src/PlaneIntersectionType.cs | 882 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace SparkAuto.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
| 25.3125 | 88 | 0.681481 | [
"MIT"
] | jaranda/bhrugen-3 | SparkAuto/Pages/Error.cshtml.cs | 810 | C# |
#pragma warning disable 1591
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.17020
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
[assembly: Android.Runtime.ResourceDesignerAttribute("FrillyToothpicksMap.Droid.Resource", IsApplication=true)]
namespace FrillyToothpicksMap.Droid
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
public partial class Resource
{
static Resource()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
public static void UpdateIdValues()
{
}
public partial class Animation
{
// aapt resource value: 0x7f040000
public const int abc_fade_in = 2130968576;
// aapt resource value: 0x7f040001
public const int abc_fade_out = 2130968577;
// aapt resource value: 0x7f040002
public const int abc_slide_in_bottom = 2130968578;
// aapt resource value: 0x7f040003
public const int abc_slide_in_top = 2130968579;
// aapt resource value: 0x7f040004
public const int abc_slide_out_bottom = 2130968580;
// aapt resource value: 0x7f040005
public const int abc_slide_out_top = 2130968581;
static Animation()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Animation()
{
}
}
public partial class Attribute
{
// aapt resource value: 0x7f010084
public const int actionBarDivider = 2130772100;
// aapt resource value: 0x7f010085
public const int actionBarItemBackground = 2130772101;
// aapt resource value: 0x7f01007e
public const int actionBarPopupTheme = 2130772094;
// aapt resource value: 0x7f010083
public const int actionBarSize = 2130772099;
// aapt resource value: 0x7f010080
public const int actionBarSplitStyle = 2130772096;
// aapt resource value: 0x7f01007f
public const int actionBarStyle = 2130772095;
// aapt resource value: 0x7f01007a
public const int actionBarTabBarStyle = 2130772090;
// aapt resource value: 0x7f010079
public const int actionBarTabStyle = 2130772089;
// aapt resource value: 0x7f01007b
public const int actionBarTabTextStyle = 2130772091;
// aapt resource value: 0x7f010081
public const int actionBarTheme = 2130772097;
// aapt resource value: 0x7f010082
public const int actionBarWidgetTheme = 2130772098;
// aapt resource value: 0x7f01009c
public const int actionButtonStyle = 2130772124;
// aapt resource value: 0x7f010097
public const int actionDropDownStyle = 2130772119;
// aapt resource value: 0x7f010056
public const int actionLayout = 2130772054;
// aapt resource value: 0x7f010086
public const int actionMenuTextAppearance = 2130772102;
// aapt resource value: 0x7f010087
public const int actionMenuTextColor = 2130772103;
// aapt resource value: 0x7f01008a
public const int actionModeBackground = 2130772106;
// aapt resource value: 0x7f010089
public const int actionModeCloseButtonStyle = 2130772105;
// aapt resource value: 0x7f01008c
public const int actionModeCloseDrawable = 2130772108;
// aapt resource value: 0x7f01008e
public const int actionModeCopyDrawable = 2130772110;
// aapt resource value: 0x7f01008d
public const int actionModeCutDrawable = 2130772109;
// aapt resource value: 0x7f010092
public const int actionModeFindDrawable = 2130772114;
// aapt resource value: 0x7f01008f
public const int actionModePasteDrawable = 2130772111;
// aapt resource value: 0x7f010094
public const int actionModePopupWindowStyle = 2130772116;
// aapt resource value: 0x7f010090
public const int actionModeSelectAllDrawable = 2130772112;
// aapt resource value: 0x7f010091
public const int actionModeShareDrawable = 2130772113;
// aapt resource value: 0x7f01008b
public const int actionModeSplitBackground = 2130772107;
// aapt resource value: 0x7f010088
public const int actionModeStyle = 2130772104;
// aapt resource value: 0x7f010093
public const int actionModeWebSearchDrawable = 2130772115;
// aapt resource value: 0x7f01007c
public const int actionOverflowButtonStyle = 2130772092;
// aapt resource value: 0x7f01007d
public const int actionOverflowMenuStyle = 2130772093;
// aapt resource value: 0x7f010058
public const int actionProviderClass = 2130772056;
// aapt resource value: 0x7f010057
public const int actionViewClass = 2130772055;
// aapt resource value: 0x7f0100a3
public const int activityChooserViewStyle = 2130772131;
// aapt resource value: 0x7f010000
public const int adSize = 2130771968;
// aapt resource value: 0x7f010001
public const int adSizes = 2130771969;
// aapt resource value: 0x7f010002
public const int adUnitId = 2130771970;
// aapt resource value: 0x7f010016
public const int appTheme = 2130771990;
// aapt resource value: 0x7f010036
public const int background = 2130772022;
// aapt resource value: 0x7f010038
public const int backgroundSplit = 2130772024;
// aapt resource value: 0x7f010037
public const int backgroundStacked = 2130772023;
// aapt resource value: 0x7f010050
public const int barSize = 2130772048;
// aapt resource value: 0x7f01009e
public const int buttonBarButtonStyle = 2130772126;
// aapt resource value: 0x7f01009d
public const int buttonBarStyle = 2130772125;
// aapt resource value: 0x7f01001d
public const int buyButtonAppearance = 2130771997;
// aapt resource value: 0x7f01001a
public const int buyButtonHeight = 2130771994;
// aapt resource value: 0x7f01001c
public const int buyButtonText = 2130771996;
// aapt resource value: 0x7f01001b
public const int buyButtonWidth = 2130771995;
// aapt resource value: 0x7f010007
public const int cameraBearing = 2130771975;
// aapt resource value: 0x7f010008
public const int cameraTargetLat = 2130771976;
// aapt resource value: 0x7f010009
public const int cameraTargetLng = 2130771977;
// aapt resource value: 0x7f01000a
public const int cameraTilt = 2130771978;
// aapt resource value: 0x7f01000b
public const int cameraZoom = 2130771979;
// aapt resource value: 0x7f010005
public const int circleCrop = 2130771973;
// aapt resource value: 0x7f01005f
public const int closeIcon = 2130772063;
// aapt resource value: 0x7f010046
public const int closeItemLayout = 2130772038;
// aapt resource value: 0x7f0100ce
public const int collapseContentDescription = 2130772174;
// aapt resource value: 0x7f0100cd
public const int collapseIcon = 2130772173;
// aapt resource value: 0x7f01004a
public const int color = 2130772042;
// aapt resource value: 0x7f0100be
public const int colorAccent = 2130772158;
// aapt resource value: 0x7f0100c2
public const int colorButtonNormal = 2130772162;
// aapt resource value: 0x7f0100c0
public const int colorControlActivated = 2130772160;
// aapt resource value: 0x7f0100c1
public const int colorControlHighlight = 2130772161;
// aapt resource value: 0x7f0100bf
public const int colorControlNormal = 2130772159;
// aapt resource value: 0x7f0100bc
public const int colorPrimary = 2130772156;
// aapt resource value: 0x7f0100bd
public const int colorPrimaryDark = 2130772157;
// aapt resource value: 0x7f0100c3
public const int colorSwitchThumbNormal = 2130772163;
// aapt resource value: 0x7f010063
public const int commitIcon = 2130772067;
// aapt resource value: 0x7f010041
public const int contentInsetEnd = 2130772033;
// aapt resource value: 0x7f010042
public const int contentInsetLeft = 2130772034;
// aapt resource value: 0x7f010043
public const int contentInsetRight = 2130772035;
// aapt resource value: 0x7f010040
public const int contentInsetStart = 2130772032;
// aapt resource value: 0x7f010039
public const int customNavigationLayout = 2130772025;
// aapt resource value: 0x7f01006a
public const int disableChildrenWhenDisabled = 2130772074;
// aapt resource value: 0x7f01002f
public const int displayOptions = 2130772015;
// aapt resource value: 0x7f010035
public const int divider = 2130772021;
// aapt resource value: 0x7f0100a2
public const int dividerHorizontal = 2130772130;
// aapt resource value: 0x7f010054
public const int dividerPadding = 2130772052;
// aapt resource value: 0x7f0100a1
public const int dividerVertical = 2130772129;
// aapt resource value: 0x7f01004c
public const int drawableSize = 2130772044;
// aapt resource value: 0x7f01002a
public const int drawerArrowStyle = 2130772010;
// aapt resource value: 0x7f0100b4
public const int dropDownListViewStyle = 2130772148;
// aapt resource value: 0x7f010098
public const int dropdownListPreferredItemHeight = 2130772120;
// aapt resource value: 0x7f0100a9
public const int editTextBackground = 2130772137;
// aapt resource value: 0x7f0100a8
public const int editTextColor = 2130772136;
// aapt resource value: 0x7f010044
public const int elevation = 2130772036;
// aapt resource value: 0x7f010017
public const int environment = 2130771991;
// aapt resource value: 0x7f010048
public const int expandActivityOverflowButtonDrawable = 2130772040;
// aapt resource value: 0x7f010029
public const int externalRouteEnabledDrawable = 2130772009;
// aapt resource value: 0x7f010019
public const int fragmentMode = 2130771993;
// aapt resource value: 0x7f010018
public const int fragmentStyle = 2130771992;
// aapt resource value: 0x7f01004d
public const int gapBetweenBars = 2130772045;
// aapt resource value: 0x7f010060
public const int goIcon = 2130772064;
// aapt resource value: 0x7f01002b
public const int height = 2130772011;
// aapt resource value: 0x7f01003f
public const int hideOnContentScroll = 2130772031;
// aapt resource value: 0x7f01009b
public const int homeAsUpIndicator = 2130772123;
// aapt resource value: 0x7f01003a
public const int homeLayout = 2130772026;
// aapt resource value: 0x7f010033
public const int icon = 2130772019;
// aapt resource value: 0x7f01005d
public const int iconifiedByDefault = 2130772061;
// aapt resource value: 0x7f010004
public const int imageAspectRatio = 2130771972;
// aapt resource value: 0x7f010003
public const int imageAspectRatioAdjust = 2130771971;
// aapt resource value: 0x7f01003c
public const int indeterminateProgressStyle = 2130772028;
// aapt resource value: 0x7f010047
public const int initialActivityCount = 2130772039;
// aapt resource value: 0x7f01002c
public const int isLightTheme = 2130772012;
// aapt resource value: 0x7f01003e
public const int itemPadding = 2130772030;
// aapt resource value: 0x7f01005c
public const int layout = 2130772060;
// aapt resource value: 0x7f0100bb
public const int listChoiceBackgroundIndicator = 2130772155;
// aapt resource value: 0x7f0100b5
public const int listPopupWindowStyle = 2130772149;
// aapt resource value: 0x7f0100af
public const int listPreferredItemHeight = 2130772143;
// aapt resource value: 0x7f0100b1
public const int listPreferredItemHeightLarge = 2130772145;
// aapt resource value: 0x7f0100b0
public const int listPreferredItemHeightSmall = 2130772144;
// aapt resource value: 0x7f0100b2
public const int listPreferredItemPaddingLeft = 2130772146;
// aapt resource value: 0x7f0100b3
public const int listPreferredItemPaddingRight = 2130772147;
// aapt resource value: 0x7f01000c
public const int liteMode = 2130771980;
// aapt resource value: 0x7f010034
public const int logo = 2130772020;
// aapt resource value: 0x7f010006
public const int mapType = 2130771974;
// aapt resource value: 0x7f010020
public const int maskedWalletDetailsBackground = 2130772000;
// aapt resource value: 0x7f010022
public const int maskedWalletDetailsButtonBackground = 2130772002;
// aapt resource value: 0x7f010021
public const int maskedWalletDetailsButtonTextAppearance = 2130772001;
// aapt resource value: 0x7f01001f
public const int maskedWalletDetailsHeaderTextAppearance = 2130771999;
// aapt resource value: 0x7f010024
public const int maskedWalletDetailsLogoImageType = 2130772004;
// aapt resource value: 0x7f010023
public const int maskedWalletDetailsLogoTextColor = 2130772003;
// aapt resource value: 0x7f01001e
public const int maskedWalletDetailsTextAppearance = 2130771998;
// aapt resource value: 0x7f0100cb
public const int maxButtonHeight = 2130772171;
// aapt resource value: 0x7f010052
public const int measureWithLargestChild = 2130772050;
// aapt resource value: 0x7f010025
public const int mediaRouteButtonStyle = 2130772005;
// aapt resource value: 0x7f010026
public const int mediaRouteConnectingDrawable = 2130772006;
// aapt resource value: 0x7f010027
public const int mediaRouteOffDrawable = 2130772007;
// aapt resource value: 0x7f010028
public const int mediaRouteOnDrawable = 2130772008;
// aapt resource value: 0x7f01004f
public const int middleBarArrowSize = 2130772047;
// aapt resource value: 0x7f0100d0
public const int navigationContentDescription = 2130772176;
// aapt resource value: 0x7f0100cf
public const int navigationIcon = 2130772175;
// aapt resource value: 0x7f01002e
public const int navigationMode = 2130772014;
// aapt resource value: 0x7f01005a
public const int overlapAnchor = 2130772058;
// aapt resource value: 0x7f0100d2
public const int paddingEnd = 2130772178;
// aapt resource value: 0x7f0100d1
public const int paddingStart = 2130772177;
// aapt resource value: 0x7f0100b8
public const int panelBackground = 2130772152;
// aapt resource value: 0x7f0100ba
public const int panelMenuListTheme = 2130772154;
// aapt resource value: 0x7f0100b9
public const int panelMenuListWidth = 2130772153;
// aapt resource value: 0x7f0100a6
public const int popupMenuStyle = 2130772134;
// aapt resource value: 0x7f010069
public const int popupPromptView = 2130772073;
// aapt resource value: 0x7f010045
public const int popupTheme = 2130772037;
// aapt resource value: 0x7f0100a7
public const int popupWindowStyle = 2130772135;
// aapt resource value: 0x7f010059
public const int preserveIconSpacing = 2130772057;
// aapt resource value: 0x7f01003d
public const int progressBarPadding = 2130772029;
// aapt resource value: 0x7f01003b
public const int progressBarStyle = 2130772027;
// aapt resource value: 0x7f010067
public const int prompt = 2130772071;
// aapt resource value: 0x7f010065
public const int queryBackground = 2130772069;
// aapt resource value: 0x7f01005e
public const int queryHint = 2130772062;
// aapt resource value: 0x7f010061
public const int searchIcon = 2130772065;
// aapt resource value: 0x7f0100ae
public const int searchViewStyle = 2130772142;
// aapt resource value: 0x7f01009f
public const int selectableItemBackground = 2130772127;
// aapt resource value: 0x7f0100a0
public const int selectableItemBackgroundBorderless = 2130772128;
// aapt resource value: 0x7f010055
public const int showAsAction = 2130772053;
// aapt resource value: 0x7f010053
public const int showDividers = 2130772051;
// aapt resource value: 0x7f010071
public const int showText = 2130772081;
// aapt resource value: 0x7f01004b
public const int spinBars = 2130772043;
// aapt resource value: 0x7f01009a
public const int spinnerDropDownItemStyle = 2130772122;
// aapt resource value: 0x7f010068
public const int spinnerMode = 2130772072;
// aapt resource value: 0x7f010099
public const int spinnerStyle = 2130772121;
// aapt resource value: 0x7f010070
public const int splitTrack = 2130772080;
// aapt resource value: 0x7f01005b
public const int state_above_anchor = 2130772059;
// aapt resource value: 0x7f010066
public const int submitBackground = 2130772070;
// aapt resource value: 0x7f010030
public const int subtitle = 2130772016;
// aapt resource value: 0x7f0100c5
public const int subtitleTextAppearance = 2130772165;
// aapt resource value: 0x7f010032
public const int subtitleTextStyle = 2130772018;
// aapt resource value: 0x7f010064
public const int suggestionRowLayout = 2130772068;
// aapt resource value: 0x7f01006e
public const int switchMinWidth = 2130772078;
// aapt resource value: 0x7f01006f
public const int switchPadding = 2130772079;
// aapt resource value: 0x7f0100aa
public const int switchStyle = 2130772138;
// aapt resource value: 0x7f01006d
public const int switchTextAppearance = 2130772077;
// aapt resource value: 0x7f010049
public const int textAllCaps = 2130772041;
// aapt resource value: 0x7f010095
public const int textAppearanceLargePopupMenu = 2130772117;
// aapt resource value: 0x7f0100b6
public const int textAppearanceListItem = 2130772150;
// aapt resource value: 0x7f0100b7
public const int textAppearanceListItemSmall = 2130772151;
// aapt resource value: 0x7f0100ac
public const int textAppearanceSearchResultSubtitle = 2130772140;
// aapt resource value: 0x7f0100ab
public const int textAppearanceSearchResultTitle = 2130772139;
// aapt resource value: 0x7f010096
public const int textAppearanceSmallPopupMenu = 2130772118;
// aapt resource value: 0x7f0100ad
public const int textColorSearchUrl = 2130772141;
// aapt resource value: 0x7f0100cc
public const int theme = 2130772172;
// aapt resource value: 0x7f010051
public const int thickness = 2130772049;
// aapt resource value: 0x7f01006c
public const int thumbTextPadding = 2130772076;
// aapt resource value: 0x7f01002d
public const int title = 2130772013;
// aapt resource value: 0x7f0100ca
public const int titleMarginBottom = 2130772170;
// aapt resource value: 0x7f0100c8
public const int titleMarginEnd = 2130772168;
// aapt resource value: 0x7f0100c7
public const int titleMarginStart = 2130772167;
// aapt resource value: 0x7f0100c9
public const int titleMarginTop = 2130772169;
// aapt resource value: 0x7f0100c6
public const int titleMargins = 2130772166;
// aapt resource value: 0x7f0100c4
public const int titleTextAppearance = 2130772164;
// aapt resource value: 0x7f010031
public const int titleTextStyle = 2130772017;
// aapt resource value: 0x7f0100a5
public const int toolbarNavigationButtonStyle = 2130772133;
// aapt resource value: 0x7f0100a4
public const int toolbarStyle = 2130772132;
// aapt resource value: 0x7f01004e
public const int topBottomBarArrowSize = 2130772046;
// aapt resource value: 0x7f01006b
public const int track = 2130772075;
// aapt resource value: 0x7f01000d
public const int uiCompass = 2130771981;
// aapt resource value: 0x7f010015
public const int uiMapToolbar = 2130771989;
// aapt resource value: 0x7f01000e
public const int uiRotateGestures = 2130771982;
// aapt resource value: 0x7f01000f
public const int uiScrollGestures = 2130771983;
// aapt resource value: 0x7f010010
public const int uiTiltGestures = 2130771984;
// aapt resource value: 0x7f010011
public const int uiZoomControls = 2130771985;
// aapt resource value: 0x7f010012
public const int uiZoomGestures = 2130771986;
// aapt resource value: 0x7f010013
public const int useViewLifecycle = 2130771987;
// aapt resource value: 0x7f010062
public const int voiceIcon = 2130772066;
// aapt resource value: 0x7f010072
public const int windowActionBar = 2130772082;
// aapt resource value: 0x7f010073
public const int windowActionBarOverlay = 2130772083;
// aapt resource value: 0x7f010074
public const int windowActionModeOverlay = 2130772084;
// aapt resource value: 0x7f010078
public const int windowFixedHeightMajor = 2130772088;
// aapt resource value: 0x7f010076
public const int windowFixedHeightMinor = 2130772086;
// aapt resource value: 0x7f010075
public const int windowFixedWidthMajor = 2130772085;
// aapt resource value: 0x7f010077
public const int windowFixedWidthMinor = 2130772087;
// aapt resource value: 0x7f010014
public const int zOrderOnTop = 2130771988;
static Attribute()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Attribute()
{
}
}
public partial class Boolean
{
// aapt resource value: 0x7f0a0000
public const int abc_action_bar_embed_tabs = 2131361792;
// aapt resource value: 0x7f0a0001
public const int abc_action_bar_embed_tabs_pre_jb = 2131361793;
// aapt resource value: 0x7f0a0002
public const int abc_action_bar_expanded_action_views_exclusive = 2131361794;
// aapt resource value: 0x7f0a0003
public const int abc_config_actionMenuItemAllCaps = 2131361795;
// aapt resource value: 0x7f0a0004
public const int abc_config_allowActionMenuItemTextWithIcon = 2131361796;
// aapt resource value: 0x7f0a0005
public const int abc_config_showMenuShortcutsWhenKeyboardPresent = 2131361797;
static Boolean()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Boolean()
{
}
}
public partial class Color
{
// aapt resource value: 0x7f080048
public const int abc_background_cache_hint_selector_material_dark = 2131230792;
// aapt resource value: 0x7f080049
public const int abc_background_cache_hint_selector_material_light = 2131230793;
// aapt resource value: 0x7f080017
public const int abc_input_method_navigation_guard = 2131230743;
// aapt resource value: 0x7f08004a
public const int abc_primary_text_disable_only_material_dark = 2131230794;
// aapt resource value: 0x7f08004b
public const int abc_primary_text_disable_only_material_light = 2131230795;
// aapt resource value: 0x7f08004c
public const int abc_primary_text_material_dark = 2131230796;
// aapt resource value: 0x7f08004d
public const int abc_primary_text_material_light = 2131230797;
// aapt resource value: 0x7f08004e
public const int abc_search_url_text = 2131230798;
// aapt resource value: 0x7f080018
public const int abc_search_url_text_normal = 2131230744;
// aapt resource value: 0x7f080019
public const int abc_search_url_text_pressed = 2131230745;
// aapt resource value: 0x7f08001a
public const int abc_search_url_text_selected = 2131230746;
// aapt resource value: 0x7f08004f
public const int abc_secondary_text_material_dark = 2131230799;
// aapt resource value: 0x7f080050
public const int abc_secondary_text_material_light = 2131230800;
// aapt resource value: 0x7f08001b
public const int accent_material_dark = 2131230747;
// aapt resource value: 0x7f08001c
public const int accent_material_light = 2131230748;
// aapt resource value: 0x7f08001d
public const int background_floating_material_dark = 2131230749;
// aapt resource value: 0x7f08001e
public const int background_floating_material_light = 2131230750;
// aapt resource value: 0x7f08001f
public const int background_material_dark = 2131230751;
// aapt resource value: 0x7f080020
public const int background_material_light = 2131230752;
// aapt resource value: 0x7f080021
public const int bright_foreground_disabled_material_dark = 2131230753;
// aapt resource value: 0x7f080022
public const int bright_foreground_disabled_material_light = 2131230754;
// aapt resource value: 0x7f080023
public const int bright_foreground_inverse_material_dark = 2131230755;
// aapt resource value: 0x7f080024
public const int bright_foreground_inverse_material_light = 2131230756;
// aapt resource value: 0x7f080025
public const int bright_foreground_material_dark = 2131230757;
// aapt resource value: 0x7f080026
public const int bright_foreground_material_light = 2131230758;
// aapt resource value: 0x7f080027
public const int button_material_dark = 2131230759;
// aapt resource value: 0x7f080028
public const int button_material_light = 2131230760;
// aapt resource value: 0x7f080009
public const int common_action_bar_splitter = 2131230729;
// aapt resource value: 0x7f080000
public const int common_signin_btn_dark_text_default = 2131230720;
// aapt resource value: 0x7f080002
public const int common_signin_btn_dark_text_disabled = 2131230722;
// aapt resource value: 0x7f080003
public const int common_signin_btn_dark_text_focused = 2131230723;
// aapt resource value: 0x7f080001
public const int common_signin_btn_dark_text_pressed = 2131230721;
// aapt resource value: 0x7f080008
public const int common_signin_btn_default_background = 2131230728;
// aapt resource value: 0x7f080004
public const int common_signin_btn_light_text_default = 2131230724;
// aapt resource value: 0x7f080006
public const int common_signin_btn_light_text_disabled = 2131230726;
// aapt resource value: 0x7f080007
public const int common_signin_btn_light_text_focused = 2131230727;
// aapt resource value: 0x7f080005
public const int common_signin_btn_light_text_pressed = 2131230725;
// aapt resource value: 0x7f080051
public const int common_signin_btn_text_dark = 2131230801;
// aapt resource value: 0x7f080052
public const int common_signin_btn_text_light = 2131230802;
// aapt resource value: 0x7f080029
public const int dim_foreground_disabled_material_dark = 2131230761;
// aapt resource value: 0x7f08002a
public const int dim_foreground_disabled_material_light = 2131230762;
// aapt resource value: 0x7f08002b
public const int dim_foreground_material_dark = 2131230763;
// aapt resource value: 0x7f08002c
public const int dim_foreground_material_light = 2131230764;
// aapt resource value: 0x7f08002d
public const int highlighted_text_material_dark = 2131230765;
// aapt resource value: 0x7f08002e
public const int highlighted_text_material_light = 2131230766;
// aapt resource value: 0x7f08002f
public const int hint_foreground_material_dark = 2131230767;
// aapt resource value: 0x7f080030
public const int hint_foreground_material_light = 2131230768;
// aapt resource value: 0x7f080031
public const int link_text_material_dark = 2131230769;
// aapt resource value: 0x7f080032
public const int link_text_material_light = 2131230770;
// aapt resource value: 0x7f080033
public const int material_blue_grey_800 = 2131230771;
// aapt resource value: 0x7f080034
public const int material_blue_grey_900 = 2131230772;
// aapt resource value: 0x7f080035
public const int material_blue_grey_950 = 2131230773;
// aapt resource value: 0x7f080036
public const int material_deep_teal_200 = 2131230774;
// aapt resource value: 0x7f080037
public const int material_deep_teal_500 = 2131230775;
// aapt resource value: 0x7f080038
public const int primary_dark_material_dark = 2131230776;
// aapt resource value: 0x7f080039
public const int primary_dark_material_light = 2131230777;
// aapt resource value: 0x7f08003a
public const int primary_material_dark = 2131230778;
// aapt resource value: 0x7f08003b
public const int primary_material_light = 2131230779;
// aapt resource value: 0x7f08003c
public const int primary_text_default_material_dark = 2131230780;
// aapt resource value: 0x7f08003d
public const int primary_text_default_material_light = 2131230781;
// aapt resource value: 0x7f08003e
public const int primary_text_disabled_material_dark = 2131230782;
// aapt resource value: 0x7f08003f
public const int primary_text_disabled_material_light = 2131230783;
// aapt resource value: 0x7f080040
public const int ripple_material_dark = 2131230784;
// aapt resource value: 0x7f080041
public const int ripple_material_light = 2131230785;
// aapt resource value: 0x7f080042
public const int secondary_text_default_material_dark = 2131230786;
// aapt resource value: 0x7f080043
public const int secondary_text_default_material_light = 2131230787;
// aapt resource value: 0x7f080044
public const int secondary_text_disabled_material_dark = 2131230788;
// aapt resource value: 0x7f080045
public const int secondary_text_disabled_material_light = 2131230789;
// aapt resource value: 0x7f080046
public const int switch_thumb_normal_material_dark = 2131230790;
// aapt resource value: 0x7f080047
public const int switch_thumb_normal_material_light = 2131230791;
// aapt resource value: 0x7f08000f
public const int wallet_bright_foreground_disabled_holo_light = 2131230735;
// aapt resource value: 0x7f08000a
public const int wallet_bright_foreground_holo_dark = 2131230730;
// aapt resource value: 0x7f080010
public const int wallet_bright_foreground_holo_light = 2131230736;
// aapt resource value: 0x7f08000c
public const int wallet_dim_foreground_disabled_holo_dark = 2131230732;
// aapt resource value: 0x7f08000b
public const int wallet_dim_foreground_holo_dark = 2131230731;
// aapt resource value: 0x7f08000e
public const int wallet_dim_foreground_inverse_disabled_holo_dark = 2131230734;
// aapt resource value: 0x7f08000d
public const int wallet_dim_foreground_inverse_holo_dark = 2131230733;
// aapt resource value: 0x7f080014
public const int wallet_highlighted_text_holo_dark = 2131230740;
// aapt resource value: 0x7f080013
public const int wallet_highlighted_text_holo_light = 2131230739;
// aapt resource value: 0x7f080012
public const int wallet_hint_foreground_holo_dark = 2131230738;
// aapt resource value: 0x7f080011
public const int wallet_hint_foreground_holo_light = 2131230737;
// aapt resource value: 0x7f080015
public const int wallet_holo_blue_light = 2131230741;
// aapt resource value: 0x7f080016
public const int wallet_link_text_light = 2131230742;
// aapt resource value: 0x7f080053
public const int wallet_primary_text_holo_light = 2131230803;
// aapt resource value: 0x7f080054
public const int wallet_secondary_text_holo_dark = 2131230804;
static Color()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Color()
{
}
}
public partial class Dimension
{
// aapt resource value: 0x7f0b0000
public const int abc_action_bar_default_height_material = 2131427328;
// aapt resource value: 0x7f0b0001
public const int abc_action_bar_default_padding_material = 2131427329;
// aapt resource value: 0x7f0b0002
public const int abc_action_bar_icon_vertical_padding_material = 2131427330;
// aapt resource value: 0x7f0b0003
public const int abc_action_bar_progress_bar_size = 2131427331;
// aapt resource value: 0x7f0b0004
public const int abc_action_bar_stacked_max_height = 2131427332;
// aapt resource value: 0x7f0b0005
public const int abc_action_bar_stacked_tab_max_width = 2131427333;
// aapt resource value: 0x7f0b0006
public const int abc_action_bar_subtitle_bottom_margin_material = 2131427334;
// aapt resource value: 0x7f0b0007
public const int abc_action_bar_subtitle_top_margin_material = 2131427335;
// aapt resource value: 0x7f0b0008
public const int abc_action_button_min_height_material = 2131427336;
// aapt resource value: 0x7f0b0009
public const int abc_action_button_min_width_material = 2131427337;
// aapt resource value: 0x7f0b000a
public const int abc_action_button_min_width_overflow_material = 2131427338;
// aapt resource value: 0x7f0b000b
public const int abc_config_prefDialogWidth = 2131427339;
// aapt resource value: 0x7f0b000c
public const int abc_control_inset_material = 2131427340;
// aapt resource value: 0x7f0b000d
public const int abc_control_padding_material = 2131427341;
// aapt resource value: 0x7f0b000e
public const int abc_dropdownitem_icon_width = 2131427342;
// aapt resource value: 0x7f0b000f
public const int abc_dropdownitem_text_padding_left = 2131427343;
// aapt resource value: 0x7f0b0010
public const int abc_dropdownitem_text_padding_right = 2131427344;
// aapt resource value: 0x7f0b0011
public const int abc_panel_menu_list_width = 2131427345;
// aapt resource value: 0x7f0b0012
public const int abc_search_view_preferred_width = 2131427346;
// aapt resource value: 0x7f0b0013
public const int abc_search_view_text_min_width = 2131427347;
// aapt resource value: 0x7f0b0014
public const int abc_text_size_body_1_material = 2131427348;
// aapt resource value: 0x7f0b0015
public const int abc_text_size_body_2_material = 2131427349;
// aapt resource value: 0x7f0b0016
public const int abc_text_size_button_material = 2131427350;
// aapt resource value: 0x7f0b0017
public const int abc_text_size_caption_material = 2131427351;
// aapt resource value: 0x7f0b0018
public const int abc_text_size_display_1_material = 2131427352;
// aapt resource value: 0x7f0b0019
public const int abc_text_size_display_2_material = 2131427353;
// aapt resource value: 0x7f0b001a
public const int abc_text_size_display_3_material = 2131427354;
// aapt resource value: 0x7f0b001b
public const int abc_text_size_display_4_material = 2131427355;
// aapt resource value: 0x7f0b001c
public const int abc_text_size_headline_material = 2131427356;
// aapt resource value: 0x7f0b001d
public const int abc_text_size_large_material = 2131427357;
// aapt resource value: 0x7f0b001e
public const int abc_text_size_medium_material = 2131427358;
// aapt resource value: 0x7f0b001f
public const int abc_text_size_menu_material = 2131427359;
// aapt resource value: 0x7f0b0020
public const int abc_text_size_small_material = 2131427360;
// aapt resource value: 0x7f0b0021
public const int abc_text_size_subhead_material = 2131427361;
// aapt resource value: 0x7f0b0022
public const int abc_text_size_subtitle_material_toolbar = 2131427362;
// aapt resource value: 0x7f0b0023
public const int abc_text_size_title_material = 2131427363;
// aapt resource value: 0x7f0b0024
public const int abc_text_size_title_material_toolbar = 2131427364;
// aapt resource value: 0x7f0b0025
public const int dialog_fixed_height_major = 2131427365;
// aapt resource value: 0x7f0b0026
public const int dialog_fixed_height_minor = 2131427366;
// aapt resource value: 0x7f0b0027
public const int dialog_fixed_width_major = 2131427367;
// aapt resource value: 0x7f0b0028
public const int dialog_fixed_width_minor = 2131427368;
// aapt resource value: 0x7f0b0029
public const int disabled_alpha_material_dark = 2131427369;
// aapt resource value: 0x7f0b002a
public const int disabled_alpha_material_light = 2131427370;
static Dimension()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Dimension()
{
}
}
public partial class Drawable
{
// aapt resource value: 0x7f020000
public const int abc_ab_share_pack_holo_dark = 2130837504;
// aapt resource value: 0x7f020001
public const int abc_ab_share_pack_holo_light = 2130837505;
// aapt resource value: 0x7f020002
public const int abc_btn_check_material = 2130837506;
// aapt resource value: 0x7f020003
public const int abc_btn_check_to_on_mtrl_000 = 2130837507;
// aapt resource value: 0x7f020004
public const int abc_btn_check_to_on_mtrl_015 = 2130837508;
// aapt resource value: 0x7f020005
public const int abc_btn_radio_material = 2130837509;
// aapt resource value: 0x7f020006
public const int abc_btn_radio_to_on_mtrl_000 = 2130837510;
// aapt resource value: 0x7f020007
public const int abc_btn_radio_to_on_mtrl_015 = 2130837511;
// aapt resource value: 0x7f020008
public const int abc_btn_switch_to_on_mtrl_00001 = 2130837512;
// aapt resource value: 0x7f020009
public const int abc_btn_switch_to_on_mtrl_00012 = 2130837513;
// aapt resource value: 0x7f02000a
public const int abc_cab_background_internal_bg = 2130837514;
// aapt resource value: 0x7f02000b
public const int abc_cab_background_top_material = 2130837515;
// aapt resource value: 0x7f02000c
public const int abc_cab_background_top_mtrl_alpha = 2130837516;
// aapt resource value: 0x7f02000d
public const int abc_edit_text_material = 2130837517;
// aapt resource value: 0x7f02000e
public const int abc_ic_ab_back_mtrl_am_alpha = 2130837518;
// aapt resource value: 0x7f02000f
public const int abc_ic_clear_mtrl_alpha = 2130837519;
// aapt resource value: 0x7f020010
public const int abc_ic_commit_search_api_mtrl_alpha = 2130837520;
// aapt resource value: 0x7f020011
public const int abc_ic_go_search_api_mtrl_alpha = 2130837521;
// aapt resource value: 0x7f020012
public const int abc_ic_menu_copy_mtrl_am_alpha = 2130837522;
// aapt resource value: 0x7f020013
public const int abc_ic_menu_cut_mtrl_alpha = 2130837523;
// aapt resource value: 0x7f020014
public const int abc_ic_menu_moreoverflow_mtrl_alpha = 2130837524;
// aapt resource value: 0x7f020015
public const int abc_ic_menu_paste_mtrl_am_alpha = 2130837525;
// aapt resource value: 0x7f020016
public const int abc_ic_menu_selectall_mtrl_alpha = 2130837526;
// aapt resource value: 0x7f020017
public const int abc_ic_menu_share_mtrl_alpha = 2130837527;
// aapt resource value: 0x7f020018
public const int abc_ic_search_api_mtrl_alpha = 2130837528;
// aapt resource value: 0x7f020019
public const int abc_ic_voice_search_api_mtrl_alpha = 2130837529;
// aapt resource value: 0x7f02001a
public const int abc_item_background_holo_dark = 2130837530;
// aapt resource value: 0x7f02001b
public const int abc_item_background_holo_light = 2130837531;
// aapt resource value: 0x7f02001c
public const int abc_list_divider_mtrl_alpha = 2130837532;
// aapt resource value: 0x7f02001d
public const int abc_list_focused_holo = 2130837533;
// aapt resource value: 0x7f02001e
public const int abc_list_longpressed_holo = 2130837534;
// aapt resource value: 0x7f02001f
public const int abc_list_pressed_holo_dark = 2130837535;
// aapt resource value: 0x7f020020
public const int abc_list_pressed_holo_light = 2130837536;
// aapt resource value: 0x7f020021
public const int abc_list_selector_background_transition_holo_dark = 2130837537;
// aapt resource value: 0x7f020022
public const int abc_list_selector_background_transition_holo_light = 2130837538;
// aapt resource value: 0x7f020023
public const int abc_list_selector_disabled_holo_dark = 2130837539;
// aapt resource value: 0x7f020024
public const int abc_list_selector_disabled_holo_light = 2130837540;
// aapt resource value: 0x7f020025
public const int abc_list_selector_holo_dark = 2130837541;
// aapt resource value: 0x7f020026
public const int abc_list_selector_holo_light = 2130837542;
// aapt resource value: 0x7f020027
public const int abc_menu_hardkey_panel_mtrl_mult = 2130837543;
// aapt resource value: 0x7f020028
public const int abc_popup_background_mtrl_mult = 2130837544;
// aapt resource value: 0x7f020029
public const int abc_spinner_mtrl_am_alpha = 2130837545;
// aapt resource value: 0x7f02002a
public const int abc_switch_thumb_material = 2130837546;
// aapt resource value: 0x7f02002b
public const int abc_switch_track_mtrl_alpha = 2130837547;
// aapt resource value: 0x7f02002c
public const int abc_tab_indicator_material = 2130837548;
// aapt resource value: 0x7f02002d
public const int abc_tab_indicator_mtrl_alpha = 2130837549;
// aapt resource value: 0x7f02002e
public const int abc_textfield_activated_mtrl_alpha = 2130837550;
// aapt resource value: 0x7f02002f
public const int abc_textfield_default_mtrl_alpha = 2130837551;
// aapt resource value: 0x7f020030
public const int abc_textfield_search_activated_mtrl_alpha = 2130837552;
// aapt resource value: 0x7f020031
public const int abc_textfield_search_default_mtrl_alpha = 2130837553;
// aapt resource value: 0x7f020032
public const int abc_textfield_search_material = 2130837554;
// aapt resource value: 0x7f020033
public const int common_full_open_on_phone = 2130837555;
// aapt resource value: 0x7f020034
public const int common_ic_googleplayservices = 2130837556;
// aapt resource value: 0x7f020035
public const int common_signin_btn_icon_dark = 2130837557;
// aapt resource value: 0x7f020036
public const int common_signin_btn_icon_disabled_dark = 2130837558;
// aapt resource value: 0x7f020037
public const int common_signin_btn_icon_disabled_focus_dark = 2130837559;
// aapt resource value: 0x7f020038
public const int common_signin_btn_icon_disabled_focus_light = 2130837560;
// aapt resource value: 0x7f020039
public const int common_signin_btn_icon_disabled_light = 2130837561;
// aapt resource value: 0x7f02003a
public const int common_signin_btn_icon_focus_dark = 2130837562;
// aapt resource value: 0x7f02003b
public const int common_signin_btn_icon_focus_light = 2130837563;
// aapt resource value: 0x7f02003c
public const int common_signin_btn_icon_light = 2130837564;
// aapt resource value: 0x7f02003d
public const int common_signin_btn_icon_normal_dark = 2130837565;
// aapt resource value: 0x7f02003e
public const int common_signin_btn_icon_normal_light = 2130837566;
// aapt resource value: 0x7f02003f
public const int common_signin_btn_icon_pressed_dark = 2130837567;
// aapt resource value: 0x7f020040
public const int common_signin_btn_icon_pressed_light = 2130837568;
// aapt resource value: 0x7f020041
public const int common_signin_btn_text_dark = 2130837569;
// aapt resource value: 0x7f020042
public const int common_signin_btn_text_disabled_dark = 2130837570;
// aapt resource value: 0x7f020043
public const int common_signin_btn_text_disabled_focus_dark = 2130837571;
// aapt resource value: 0x7f020044
public const int common_signin_btn_text_disabled_focus_light = 2130837572;
// aapt resource value: 0x7f020045
public const int common_signin_btn_text_disabled_light = 2130837573;
// aapt resource value: 0x7f020046
public const int common_signin_btn_text_focus_dark = 2130837574;
// aapt resource value: 0x7f020047
public const int common_signin_btn_text_focus_light = 2130837575;
// aapt resource value: 0x7f020048
public const int common_signin_btn_text_light = 2130837576;
// aapt resource value: 0x7f020049
public const int common_signin_btn_text_normal_dark = 2130837577;
// aapt resource value: 0x7f02004a
public const int common_signin_btn_text_normal_light = 2130837578;
// aapt resource value: 0x7f02004b
public const int common_signin_btn_text_pressed_dark = 2130837579;
// aapt resource value: 0x7f02004c
public const int common_signin_btn_text_pressed_light = 2130837580;
// aapt resource value: 0x7f02004d
public const int ic_plusone_medium_off_client = 2130837581;
// aapt resource value: 0x7f02004e
public const int ic_plusone_small_off_client = 2130837582;
// aapt resource value: 0x7f02004f
public const int ic_plusone_standard_off_client = 2130837583;
// aapt resource value: 0x7f020050
public const int ic_plusone_tall_off_client = 2130837584;
// aapt resource value: 0x7f020051
public const int icon = 2130837585;
// aapt resource value: 0x7f020052
public const int mr_ic_audio_vol = 2130837586;
// aapt resource value: 0x7f020053
public const int mr_ic_media_route_connecting_holo_dark = 2130837587;
// aapt resource value: 0x7f020054
public const int mr_ic_media_route_connecting_holo_light = 2130837588;
// aapt resource value: 0x7f020055
public const int mr_ic_media_route_disabled_holo_dark = 2130837589;
// aapt resource value: 0x7f020056
public const int mr_ic_media_route_disabled_holo_light = 2130837590;
// aapt resource value: 0x7f020057
public const int mr_ic_media_route_holo_dark = 2130837591;
// aapt resource value: 0x7f020058
public const int mr_ic_media_route_holo_light = 2130837592;
// aapt resource value: 0x7f020059
public const int mr_ic_media_route_off_holo_dark = 2130837593;
// aapt resource value: 0x7f02005a
public const int mr_ic_media_route_off_holo_light = 2130837594;
// aapt resource value: 0x7f02005b
public const int mr_ic_media_route_on_0_holo_dark = 2130837595;
// aapt resource value: 0x7f02005c
public const int mr_ic_media_route_on_0_holo_light = 2130837596;
// aapt resource value: 0x7f02005d
public const int mr_ic_media_route_on_1_holo_dark = 2130837597;
// aapt resource value: 0x7f02005e
public const int mr_ic_media_route_on_1_holo_light = 2130837598;
// aapt resource value: 0x7f02005f
public const int mr_ic_media_route_on_2_holo_dark = 2130837599;
// aapt resource value: 0x7f020060
public const int mr_ic_media_route_on_2_holo_light = 2130837600;
// aapt resource value: 0x7f020061
public const int mr_ic_media_route_on_holo_dark = 2130837601;
// aapt resource value: 0x7f020062
public const int mr_ic_media_route_on_holo_light = 2130837602;
// aapt resource value: 0x7f020063
public const int powered_by_google_dark = 2130837603;
// aapt resource value: 0x7f020064
public const int powered_by_google_light = 2130837604;
static Drawable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Drawable()
{
}
}
public partial class Id
{
// aapt resource value: 0x7f0c0045
public const int action_bar = 2131492933;
// aapt resource value: 0x7f0c0000
public const int action_bar_activity_content = 2131492864;
// aapt resource value: 0x7f0c0044
public const int action_bar_container = 2131492932;
// aapt resource value: 0x7f0c0040
public const int action_bar_root = 2131492928;
// aapt resource value: 0x7f0c0001
public const int action_bar_spinner = 2131492865;
// aapt resource value: 0x7f0c0033
public const int action_bar_subtitle = 2131492915;
// aapt resource value: 0x7f0c0032
public const int action_bar_title = 2131492914;
// aapt resource value: 0x7f0c0046
public const int action_context_bar = 2131492934;
// aapt resource value: 0x7f0c0002
public const int action_menu_divider = 2131492866;
// aapt resource value: 0x7f0c0003
public const int action_menu_presenter = 2131492867;
// aapt resource value: 0x7f0c0042
public const int action_mode_bar = 2131492930;
// aapt resource value: 0x7f0c0041
public const int action_mode_bar_stub = 2131492929;
// aapt resource value: 0x7f0c0034
public const int action_mode_close_button = 2131492916;
// aapt resource value: 0x7f0c0035
public const int activity_chooser_view_content = 2131492917;
// aapt resource value: 0x7f0c0009
public const int adjust_height = 2131492873;
// aapt resource value: 0x7f0c000a
public const int adjust_width = 2131492874;
// aapt resource value: 0x7f0c002b
public const int always = 2131492907;
// aapt resource value: 0x7f0c0028
public const int beginning = 2131492904;
// aapt resource value: 0x7f0c0019
public const int book_now = 2131492889;
// aapt resource value: 0x7f0c0015
public const int buyButton = 2131492885;
// aapt resource value: 0x7f0c001a
public const int buy_now = 2131492890;
// aapt resource value: 0x7f0c001b
public const int buy_with_google = 2131492891;
// aapt resource value: 0x7f0c003d
public const int checkbox = 2131492925;
// aapt resource value: 0x7f0c001d
public const int classic = 2131492893;
// aapt resource value: 0x7f0c002c
public const int collapseActionView = 2131492908;
// aapt resource value: 0x7f0c0043
public const int decor_content_parent = 2131492931;
// aapt resource value: 0x7f0c0038
public const int default_activity_button = 2131492920;
// aapt resource value: 0x7f0c0030
public const int dialog = 2131492912;
// aapt resource value: 0x7f0c0022
public const int disableHome = 2131492898;
// aapt resource value: 0x7f0c001c
public const int donate_with_google = 2131492892;
// aapt resource value: 0x7f0c0031
public const int dropdown = 2131492913;
// aapt resource value: 0x7f0c0047
public const int edit_query = 2131492935;
// aapt resource value: 0x7f0c0029
public const int end = 2131492905;
// aapt resource value: 0x7f0c0036
public const int expand_activities_button = 2131492918;
// aapt resource value: 0x7f0c003c
public const int expanded_menu = 2131492924;
// aapt resource value: 0x7f0c001e
public const int grayscale = 2131492894;
// aapt resource value: 0x7f0c0010
public const int holo_dark = 2131492880;
// aapt resource value: 0x7f0c0011
public const int holo_light = 2131492881;
// aapt resource value: 0x7f0c0004
public const int home = 2131492868;
// aapt resource value: 0x7f0c0023
public const int homeAsUp = 2131492899;
// aapt resource value: 0x7f0c000c
public const int hybrid = 2131492876;
// aapt resource value: 0x7f0c003a
public const int icon = 2131492922;
// aapt resource value: 0x7f0c002d
public const int ifRoom = 2131492909;
// aapt resource value: 0x7f0c0037
public const int image = 2131492919;
// aapt resource value: 0x7f0c0020
public const int listMode = 2131492896;
// aapt resource value: 0x7f0c0039
public const int list_item = 2131492921;
// aapt resource value: 0x7f0c0017
public const int match_parent = 2131492887;
// aapt resource value: 0x7f0c0056
public const int media_route_control_frame = 2131492950;
// aapt resource value: 0x7f0c0057
public const int media_route_disconnect_button = 2131492951;
// aapt resource value: 0x7f0c0053
public const int media_route_list = 2131492947;
// aapt resource value: 0x7f0c0054
public const int media_route_volume_layout = 2131492948;
// aapt resource value: 0x7f0c0055
public const int media_route_volume_slider = 2131492949;
// aapt resource value: 0x7f0c002a
public const int middle = 2131492906;
// aapt resource value: 0x7f0c001f
public const int monochrome = 2131492895;
// aapt resource value: 0x7f0c002e
public const int never = 2131492910;
// aapt resource value: 0x7f0c000b
public const int none = 2131492875;
// aapt resource value: 0x7f0c000d
public const int normal = 2131492877;
// aapt resource value: 0x7f0c0012
public const int production = 2131492882;
// aapt resource value: 0x7f0c0005
public const int progress_circular = 2131492869;
// aapt resource value: 0x7f0c0006
public const int progress_horizontal = 2131492870;
// aapt resource value: 0x7f0c003f
public const int radio = 2131492927;
// aapt resource value: 0x7f0c0013
public const int sandbox = 2131492883;
// aapt resource value: 0x7f0c000e
public const int satellite = 2131492878;
// aapt resource value: 0x7f0c0049
public const int search_badge = 2131492937;
// aapt resource value: 0x7f0c0048
public const int search_bar = 2131492936;
// aapt resource value: 0x7f0c004a
public const int search_button = 2131492938;
// aapt resource value: 0x7f0c004f
public const int search_close_btn = 2131492943;
// aapt resource value: 0x7f0c004b
public const int search_edit_frame = 2131492939;
// aapt resource value: 0x7f0c0051
public const int search_go_btn = 2131492945;
// aapt resource value: 0x7f0c004c
public const int search_mag_icon = 2131492940;
// aapt resource value: 0x7f0c004d
public const int search_plate = 2131492941;
// aapt resource value: 0x7f0c004e
public const int search_src_text = 2131492942;
// aapt resource value: 0x7f0c0052
public const int search_voice_btn = 2131492946;
// aapt resource value: 0x7f0c0016
public const int selectionDetails = 2131492886;
// aapt resource value: 0x7f0c003e
public const int shortcut = 2131492926;
// aapt resource value: 0x7f0c0024
public const int showCustom = 2131492900;
// aapt resource value: 0x7f0c0025
public const int showHome = 2131492901;
// aapt resource value: 0x7f0c0026
public const int showTitle = 2131492902;
// aapt resource value: 0x7f0c0007
public const int split_action_bar = 2131492871;
// aapt resource value: 0x7f0c0014
public const int strict_sandbox = 2131492884;
// aapt resource value: 0x7f0c0050
public const int submit_area = 2131492944;
// aapt resource value: 0x7f0c0021
public const int tabMode = 2131492897;
// aapt resource value: 0x7f0c000f
public const int terrain = 2131492879;
// aapt resource value: 0x7f0c003b
public const int title = 2131492923;
// aapt resource value: 0x7f0c0008
public const int up = 2131492872;
// aapt resource value: 0x7f0c0027
public const int useLogo = 2131492903;
// aapt resource value: 0x7f0c002f
public const int withText = 2131492911;
// aapt resource value: 0x7f0c0018
public const int wrap_content = 2131492888;
static Id()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Id()
{
}
}
public partial class Integer
{
// aapt resource value: 0x7f090001
public const int abc_max_action_buttons = 2131296257;
// aapt resource value: 0x7f090000
public const int google_play_services_version = 2131296256;
static Integer()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Integer()
{
}
}
public partial class Layout
{
// aapt resource value: 0x7f030000
public const int abc_action_bar_title_item = 2130903040;
// aapt resource value: 0x7f030001
public const int abc_action_bar_up_container = 2130903041;
// aapt resource value: 0x7f030002
public const int abc_action_bar_view_list_nav_layout = 2130903042;
// aapt resource value: 0x7f030003
public const int abc_action_menu_item_layout = 2130903043;
// aapt resource value: 0x7f030004
public const int abc_action_menu_layout = 2130903044;
// aapt resource value: 0x7f030005
public const int abc_action_mode_bar = 2130903045;
// aapt resource value: 0x7f030006
public const int abc_action_mode_close_item_material = 2130903046;
// aapt resource value: 0x7f030007
public const int abc_activity_chooser_view = 2130903047;
// aapt resource value: 0x7f030008
public const int abc_activity_chooser_view_include = 2130903048;
// aapt resource value: 0x7f030009
public const int abc_activity_chooser_view_list_item = 2130903049;
// aapt resource value: 0x7f03000a
public const int abc_expanded_menu_layout = 2130903050;
// aapt resource value: 0x7f03000b
public const int abc_list_menu_item_checkbox = 2130903051;
// aapt resource value: 0x7f03000c
public const int abc_list_menu_item_icon = 2130903052;
// aapt resource value: 0x7f03000d
public const int abc_list_menu_item_layout = 2130903053;
// aapt resource value: 0x7f03000e
public const int abc_list_menu_item_radio = 2130903054;
// aapt resource value: 0x7f03000f
public const int abc_popup_menu_item_layout = 2130903055;
// aapt resource value: 0x7f030010
public const int abc_screen_content_include = 2130903056;
// aapt resource value: 0x7f030011
public const int abc_screen_simple = 2130903057;
// aapt resource value: 0x7f030012
public const int abc_screen_simple_overlay_action_mode = 2130903058;
// aapt resource value: 0x7f030013
public const int abc_screen_toolbar = 2130903059;
// aapt resource value: 0x7f030014
public const int abc_search_dropdown_item_icons_2line = 2130903060;
// aapt resource value: 0x7f030015
public const int abc_search_view = 2130903061;
// aapt resource value: 0x7f030016
public const int abc_simple_dropdown_hint = 2130903062;
// aapt resource value: 0x7f030017
public const int mr_media_route_chooser_dialog = 2130903063;
// aapt resource value: 0x7f030018
public const int mr_media_route_controller_dialog = 2130903064;
// aapt resource value: 0x7f030019
public const int mr_media_route_list_item = 2130903065;
// aapt resource value: 0x7f03001a
public const int support_simple_spinner_dropdown_item = 2130903066;
static Layout()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Layout()
{
}
}
public partial class Raw
{
// aapt resource value: 0x7f050000
public const int gtm_analytics = 2131034112;
static Raw()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Raw()
{
}
}
public partial class String
{
// aapt resource value: 0x7f070029
public const int abc_action_bar_home_description = 2131165225;
// aapt resource value: 0x7f07002a
public const int abc_action_bar_home_description_format = 2131165226;
// aapt resource value: 0x7f07002b
public const int abc_action_bar_home_subtitle_description_format = 2131165227;
// aapt resource value: 0x7f07002c
public const int abc_action_bar_up_description = 2131165228;
// aapt resource value: 0x7f07002d
public const int abc_action_menu_overflow_description = 2131165229;
// aapt resource value: 0x7f07002e
public const int abc_action_mode_done = 2131165230;
// aapt resource value: 0x7f07002f
public const int abc_activity_chooser_view_see_all = 2131165231;
// aapt resource value: 0x7f070030
public const int abc_activitychooserview_choose_application = 2131165232;
// aapt resource value: 0x7f070031
public const int abc_searchview_description_clear = 2131165233;
// aapt resource value: 0x7f070032
public const int abc_searchview_description_query = 2131165234;
// aapt resource value: 0x7f070033
public const int abc_searchview_description_search = 2131165235;
// aapt resource value: 0x7f070034
public const int abc_searchview_description_submit = 2131165236;
// aapt resource value: 0x7f070035
public const int abc_searchview_description_voice = 2131165237;
// aapt resource value: 0x7f070036
public const int abc_shareactionprovider_share_with = 2131165238;
// aapt resource value: 0x7f070037
public const int abc_shareactionprovider_share_with_application = 2131165239;
// aapt resource value: 0x7f070038
public const int abc_toolbar_collapse_description = 2131165240;
// aapt resource value: 0x7f070002
public const int accept = 2131165186;
// aapt resource value: 0x7f070009
public const int common_android_wear_notification_needs_update_text = 2131165193;
// aapt resource value: 0x7f070016
public const int common_android_wear_update_text = 2131165206;
// aapt resource value: 0x7f070014
public const int common_android_wear_update_title = 2131165204;
// aapt resource value: 0x7f070012
public const int common_google_play_services_enable_button = 2131165202;
// aapt resource value: 0x7f070011
public const int common_google_play_services_enable_text = 2131165201;
// aapt resource value: 0x7f070010
public const int common_google_play_services_enable_title = 2131165200;
// aapt resource value: 0x7f07000b
public const int common_google_play_services_error_notification_requested_by_msg = 2131165195;
// aapt resource value: 0x7f07000f
public const int common_google_play_services_install_button = 2131165199;
// aapt resource value: 0x7f07000d
public const int common_google_play_services_install_text_phone = 2131165197;
// aapt resource value: 0x7f07000e
public const int common_google_play_services_install_text_tablet = 2131165198;
// aapt resource value: 0x7f07000c
public const int common_google_play_services_install_title = 2131165196;
// aapt resource value: 0x7f07001a
public const int common_google_play_services_invalid_account_text = 2131165210;
// aapt resource value: 0x7f070019
public const int common_google_play_services_invalid_account_title = 2131165209;
// aapt resource value: 0x7f07000a
public const int common_google_play_services_needs_enabling_title = 2131165194;
// aapt resource value: 0x7f070018
public const int common_google_play_services_network_error_text = 2131165208;
// aapt resource value: 0x7f070017
public const int common_google_play_services_network_error_title = 2131165207;
// aapt resource value: 0x7f070007
public const int common_google_play_services_notification_needs_installation_title = 2131165191;
// aapt resource value: 0x7f070008
public const int common_google_play_services_notification_needs_update_title = 2131165192;
// aapt resource value: 0x7f070006
public const int common_google_play_services_notification_ticker = 2131165190;
// aapt resource value: 0x7f07001b
public const int common_google_play_services_unknown_issue = 2131165211;
// aapt resource value: 0x7f07001d
public const int common_google_play_services_unsupported_text = 2131165213;
// aapt resource value: 0x7f07001c
public const int common_google_play_services_unsupported_title = 2131165212;
// aapt resource value: 0x7f07001e
public const int common_google_play_services_update_button = 2131165214;
// aapt resource value: 0x7f070015
public const int common_google_play_services_update_text = 2131165205;
// aapt resource value: 0x7f070013
public const int common_google_play_services_update_title = 2131165203;
// aapt resource value: 0x7f070021
public const int common_open_on_phone = 2131165217;
// aapt resource value: 0x7f07001f
public const int common_signin_button_text = 2131165215;
// aapt resource value: 0x7f070020
public const int common_signin_button_text_long = 2131165216;
// aapt resource value: 0x7f070005
public const int create_calendar_message = 2131165189;
// aapt resource value: 0x7f070004
public const int create_calendar_title = 2131165188;
// aapt resource value: 0x7f070003
public const int decline = 2131165187;
// aapt resource value: 0x7f070023
public const int mr_media_route_button_content_description = 2131165219;
// aapt resource value: 0x7f070024
public const int mr_media_route_chooser_searching = 2131165220;
// aapt resource value: 0x7f070025
public const int mr_media_route_chooser_title = 2131165221;
// aapt resource value: 0x7f070026
public const int mr_media_route_controller_disconnect = 2131165222;
// aapt resource value: 0x7f070027
public const int mr_system_route_name = 2131165223;
// aapt resource value: 0x7f070028
public const int mr_user_route_category_name = 2131165224;
// aapt resource value: 0x7f070001
public const int store_picture_message = 2131165185;
// aapt resource value: 0x7f070000
public const int store_picture_title = 2131165184;
// aapt resource value: 0x7f070022
public const int wallet_buy_button_place_holder = 2131165218;
static String()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private String()
{
}
}
public partial class Style
{
// aapt resource value: 0x7f060009
public const int Base_TextAppearance_AppCompat = 2131099657;
// aapt resource value: 0x7f06000a
public const int Base_TextAppearance_AppCompat_Body1 = 2131099658;
// aapt resource value: 0x7f06000b
public const int Base_TextAppearance_AppCompat_Body2 = 2131099659;
// aapt resource value: 0x7f06000c
public const int Base_TextAppearance_AppCompat_Button = 2131099660;
// aapt resource value: 0x7f06000d
public const int Base_TextAppearance_AppCompat_Caption = 2131099661;
// aapt resource value: 0x7f06000e
public const int Base_TextAppearance_AppCompat_Display1 = 2131099662;
// aapt resource value: 0x7f06000f
public const int Base_TextAppearance_AppCompat_Display2 = 2131099663;
// aapt resource value: 0x7f060010
public const int Base_TextAppearance_AppCompat_Display3 = 2131099664;
// aapt resource value: 0x7f060011
public const int Base_TextAppearance_AppCompat_Display4 = 2131099665;
// aapt resource value: 0x7f060012
public const int Base_TextAppearance_AppCompat_Headline = 2131099666;
// aapt resource value: 0x7f060013
public const int Base_TextAppearance_AppCompat_Inverse = 2131099667;
// aapt resource value: 0x7f060014
public const int Base_TextAppearance_AppCompat_Large = 2131099668;
// aapt resource value: 0x7f060015
public const int Base_TextAppearance_AppCompat_Large_Inverse = 2131099669;
// aapt resource value: 0x7f060016
public const int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 2131099670;
// aapt resource value: 0x7f060017
public const int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 2131099671;
// aapt resource value: 0x7f060018
public const int Base_TextAppearance_AppCompat_Medium = 2131099672;
// aapt resource value: 0x7f060019
public const int Base_TextAppearance_AppCompat_Medium_Inverse = 2131099673;
// aapt resource value: 0x7f06001a
public const int Base_TextAppearance_AppCompat_Menu = 2131099674;
// aapt resource value: 0x7f06001b
public const int Base_TextAppearance_AppCompat_SearchResult = 2131099675;
// aapt resource value: 0x7f06001c
public const int Base_TextAppearance_AppCompat_SearchResult_Subtitle = 2131099676;
// aapt resource value: 0x7f06001d
public const int Base_TextAppearance_AppCompat_SearchResult_Title = 2131099677;
// aapt resource value: 0x7f06001e
public const int Base_TextAppearance_AppCompat_Small = 2131099678;
// aapt resource value: 0x7f06001f
public const int Base_TextAppearance_AppCompat_Small_Inverse = 2131099679;
// aapt resource value: 0x7f060020
public const int Base_TextAppearance_AppCompat_Subhead = 2131099680;
// aapt resource value: 0x7f060021
public const int Base_TextAppearance_AppCompat_Subhead_Inverse = 2131099681;
// aapt resource value: 0x7f060022
public const int Base_TextAppearance_AppCompat_Title = 2131099682;
// aapt resource value: 0x7f060023
public const int Base_TextAppearance_AppCompat_Title_Inverse = 2131099683;
// aapt resource value: 0x7f060024
public const int Base_TextAppearance_AppCompat_Widget_ActionBar_Menu = 2131099684;
// aapt resource value: 0x7f060025
public const int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 2131099685;
// aapt resource value: 0x7f060026
public const int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 2131099686;
// aapt resource value: 0x7f060027
public const int Base_TextAppearance_AppCompat_Widget_ActionBar_Title = 2131099687;
// aapt resource value: 0x7f060028
public const int Base_TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 2131099688;
// aapt resource value: 0x7f060029
public const int Base_TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 2131099689;
// aapt resource value: 0x7f06002a
public const int Base_TextAppearance_AppCompat_Widget_ActionMode_Title = 2131099690;
// aapt resource value: 0x7f06002b
public const int Base_TextAppearance_AppCompat_Widget_DropDownItem = 2131099691;
// aapt resource value: 0x7f06002c
public const int Base_TextAppearance_AppCompat_Widget_PopupMenu_Large = 2131099692;
// aapt resource value: 0x7f06002d
public const int Base_TextAppearance_AppCompat_Widget_PopupMenu_Small = 2131099693;
// aapt resource value: 0x7f06002e
public const int Base_TextAppearance_AppCompat_Widget_Switch = 2131099694;
// aapt resource value: 0x7f06002f
public const int Base_TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 2131099695;
// aapt resource value: 0x7f060030
public const int Base_TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 2131099696;
// aapt resource value: 0x7f060031
public const int Base_TextAppearance_Widget_AppCompat_Toolbar_Title = 2131099697;
// aapt resource value: 0x7f060032
public const int Base_Theme_AppCompat = 2131099698;
// aapt resource value: 0x7f060033
public const int Base_Theme_AppCompat_CompactMenu = 2131099699;
// aapt resource value: 0x7f060034
public const int Base_Theme_AppCompat_Dialog = 2131099700;
// aapt resource value: 0x7f060035
public const int Base_Theme_AppCompat_Dialog_FixedSize = 2131099701;
// aapt resource value: 0x7f060036
public const int Base_Theme_AppCompat_DialogWhenLarge = 2131099702;
// aapt resource value: 0x7f060037
public const int Base_Theme_AppCompat_Light = 2131099703;
// aapt resource value: 0x7f060038
public const int Base_Theme_AppCompat_Light_DarkActionBar = 2131099704;
// aapt resource value: 0x7f060039
public const int Base_Theme_AppCompat_Light_Dialog = 2131099705;
// aapt resource value: 0x7f06003a
public const int Base_Theme_AppCompat_Light_Dialog_FixedSize = 2131099706;
// aapt resource value: 0x7f06003b
public const int Base_Theme_AppCompat_Light_DialogWhenLarge = 2131099707;
// aapt resource value: 0x7f06003c
public const int Base_ThemeOverlay_AppCompat = 2131099708;
// aapt resource value: 0x7f06003d
public const int Base_ThemeOverlay_AppCompat_ActionBar = 2131099709;
// aapt resource value: 0x7f06003e
public const int Base_ThemeOverlay_AppCompat_Dark = 2131099710;
// aapt resource value: 0x7f06003f
public const int Base_ThemeOverlay_AppCompat_Dark_ActionBar = 2131099711;
// aapt resource value: 0x7f060040
public const int Base_ThemeOverlay_AppCompat_Light = 2131099712;
// aapt resource value: 0x7f0600e8
public const int Base_V11_Theme_AppCompat = 2131099880;
// aapt resource value: 0x7f0600e9
public const int Base_V11_Theme_AppCompat_Dialog = 2131099881;
// aapt resource value: 0x7f0600ea
public const int Base_V11_Theme_AppCompat_Light = 2131099882;
// aapt resource value: 0x7f0600eb
public const int Base_V11_Theme_AppCompat_Light_Dialog = 2131099883;
// aapt resource value: 0x7f0600ec
public const int Base_V14_Theme_AppCompat = 2131099884;
// aapt resource value: 0x7f0600ed
public const int Base_V14_Theme_AppCompat_Dialog = 2131099885;
// aapt resource value: 0x7f0600ee
public const int Base_V14_Theme_AppCompat_Light = 2131099886;
// aapt resource value: 0x7f0600ef
public const int Base_V14_Theme_AppCompat_Light_Dialog = 2131099887;
// aapt resource value: 0x7f0600f0
public const int Base_V21_Theme_AppCompat = 2131099888;
// aapt resource value: 0x7f0600f1
public const int Base_V21_Theme_AppCompat_Dialog = 2131099889;
// aapt resource value: 0x7f0600f2
public const int Base_V21_Theme_AppCompat_Light = 2131099890;
// aapt resource value: 0x7f0600f3
public const int Base_V21_Theme_AppCompat_Light_Dialog = 2131099891;
// aapt resource value: 0x7f060041
public const int Base_V7_Theme_AppCompat = 2131099713;
// aapt resource value: 0x7f060042
public const int Base_V7_Theme_AppCompat_Dialog = 2131099714;
// aapt resource value: 0x7f060043
public const int Base_V7_Theme_AppCompat_Light = 2131099715;
// aapt resource value: 0x7f060044
public const int Base_Widget_AppCompat_ActionBar = 2131099716;
// aapt resource value: 0x7f060045
public const int Base_Widget_AppCompat_ActionBar_Solid = 2131099717;
// aapt resource value: 0x7f060046
public const int Base_Widget_AppCompat_ActionBar_TabBar = 2131099718;
// aapt resource value: 0x7f060047
public const int Base_Widget_AppCompat_ActionBar_TabText = 2131099719;
// aapt resource value: 0x7f060048
public const int Base_Widget_AppCompat_ActionBar_TabView = 2131099720;
// aapt resource value: 0x7f060049
public const int Base_Widget_AppCompat_ActionButton = 2131099721;
// aapt resource value: 0x7f06004a
public const int Base_Widget_AppCompat_ActionButton_CloseMode = 2131099722;
// aapt resource value: 0x7f06004b
public const int Base_Widget_AppCompat_ActionButton_Overflow = 2131099723;
// aapt resource value: 0x7f06004c
public const int Base_Widget_AppCompat_ActionMode = 2131099724;
// aapt resource value: 0x7f06004d
public const int Base_Widget_AppCompat_ActivityChooserView = 2131099725;
// aapt resource value: 0x7f06004e
public const int Base_Widget_AppCompat_AutoCompleteTextView = 2131099726;
// aapt resource value: 0x7f06004f
public const int Base_Widget_AppCompat_CompoundButton_Switch = 2131099727;
// aapt resource value: 0x7f060050
public const int Base_Widget_AppCompat_DrawerArrowToggle = 2131099728;
// aapt resource value: 0x7f060051
public const int Base_Widget_AppCompat_DropDownItem_Spinner = 2131099729;
// aapt resource value: 0x7f060052
public const int Base_Widget_AppCompat_EditText = 2131099730;
// aapt resource value: 0x7f060053
public const int Base_Widget_AppCompat_Light_ActionBar = 2131099731;
// aapt resource value: 0x7f060054
public const int Base_Widget_AppCompat_Light_ActionBar_Solid = 2131099732;
// aapt resource value: 0x7f060055
public const int Base_Widget_AppCompat_Light_ActionBar_TabBar = 2131099733;
// aapt resource value: 0x7f060056
public const int Base_Widget_AppCompat_Light_ActionBar_TabText = 2131099734;
// aapt resource value: 0x7f060057
public const int Base_Widget_AppCompat_Light_ActionBar_TabText_Inverse = 2131099735;
// aapt resource value: 0x7f060058
public const int Base_Widget_AppCompat_Light_ActionBar_TabView = 2131099736;
// aapt resource value: 0x7f060059
public const int Base_Widget_AppCompat_Light_ActivityChooserView = 2131099737;
// aapt resource value: 0x7f06005a
public const int Base_Widget_AppCompat_Light_AutoCompleteTextView = 2131099738;
// aapt resource value: 0x7f06005b
public const int Base_Widget_AppCompat_Light_PopupMenu = 2131099739;
// aapt resource value: 0x7f06005c
public const int Base_Widget_AppCompat_Light_PopupMenu_Overflow = 2131099740;
// aapt resource value: 0x7f06005d
public const int Base_Widget_AppCompat_ListPopupWindow = 2131099741;
// aapt resource value: 0x7f06005e
public const int Base_Widget_AppCompat_ListView_DropDown = 2131099742;
// aapt resource value: 0x7f06005f
public const int Base_Widget_AppCompat_ListView_Menu = 2131099743;
// aapt resource value: 0x7f060060
public const int Base_Widget_AppCompat_PopupMenu = 2131099744;
// aapt resource value: 0x7f060061
public const int Base_Widget_AppCompat_PopupMenu_Overflow = 2131099745;
// aapt resource value: 0x7f060062
public const int Base_Widget_AppCompat_PopupWindow = 2131099746;
// aapt resource value: 0x7f060063
public const int Base_Widget_AppCompat_ProgressBar = 2131099747;
// aapt resource value: 0x7f060064
public const int Base_Widget_AppCompat_ProgressBar_Horizontal = 2131099748;
// aapt resource value: 0x7f060065
public const int Base_Widget_AppCompat_SearchView = 2131099749;
// aapt resource value: 0x7f060066
public const int Base_Widget_AppCompat_Spinner = 2131099750;
// aapt resource value: 0x7f060067
public const int Base_Widget_AppCompat_Spinner_DropDown_ActionBar = 2131099751;
// aapt resource value: 0x7f060068
public const int Base_Widget_AppCompat_Toolbar = 2131099752;
// aapt resource value: 0x7f060069
public const int Base_Widget_AppCompat_Toolbar_Button_Navigation = 2131099753;
// aapt resource value: 0x7f06006a
public const int Platform_AppCompat = 2131099754;
// aapt resource value: 0x7f06006b
public const int Platform_AppCompat_Dialog = 2131099755;
// aapt resource value: 0x7f06006c
public const int Platform_AppCompat_Light = 2131099756;
// aapt resource value: 0x7f06006d
public const int Platform_AppCompat_Light_Dialog = 2131099757;
// aapt resource value: 0x7f06006e
public const int RtlOverlay_Widget_AppCompat_ActionBar_TitleItem = 2131099758;
// aapt resource value: 0x7f06006f
public const int RtlOverlay_Widget_AppCompat_ActionButton_CloseMode = 2131099759;
// aapt resource value: 0x7f060070
public const int RtlOverlay_Widget_AppCompat_ActionButton_Overflow = 2131099760;
// aapt resource value: 0x7f060071
public const int RtlOverlay_Widget_AppCompat_PopupMenuItem = 2131099761;
// aapt resource value: 0x7f060072
public const int RtlOverlay_Widget_AppCompat_PopupMenuItem_InternalGroup = 2131099762;
// aapt resource value: 0x7f060073
public const int RtlOverlay_Widget_AppCompat_PopupMenuItem_Text = 2131099763;
// aapt resource value: 0x7f060074
public const int RtlOverlay_Widget_AppCompat_Search_DropDown = 2131099764;
// aapt resource value: 0x7f060075
public const int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon1 = 2131099765;
// aapt resource value: 0x7f060076
public const int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon2 = 2131099766;
// aapt resource value: 0x7f060077
public const int RtlOverlay_Widget_AppCompat_Search_DropDown_Query = 2131099767;
// aapt resource value: 0x7f060078
public const int RtlOverlay_Widget_AppCompat_Search_DropDown_Text = 2131099768;
// aapt resource value: 0x7f060079
public const int RtlOverlay_Widget_AppCompat_SearchView_MagIcon = 2131099769;
// aapt resource value: 0x7f06007a
public const int TextAppearance_AppCompat = 2131099770;
// aapt resource value: 0x7f06007b
public const int TextAppearance_AppCompat_Body1 = 2131099771;
// aapt resource value: 0x7f06007c
public const int TextAppearance_AppCompat_Body2 = 2131099772;
// aapt resource value: 0x7f06007d
public const int TextAppearance_AppCompat_Button = 2131099773;
// aapt resource value: 0x7f06007e
public const int TextAppearance_AppCompat_Caption = 2131099774;
// aapt resource value: 0x7f06007f
public const int TextAppearance_AppCompat_Display1 = 2131099775;
// aapt resource value: 0x7f060080
public const int TextAppearance_AppCompat_Display2 = 2131099776;
// aapt resource value: 0x7f060081
public const int TextAppearance_AppCompat_Display3 = 2131099777;
// aapt resource value: 0x7f060082
public const int TextAppearance_AppCompat_Display4 = 2131099778;
// aapt resource value: 0x7f060083
public const int TextAppearance_AppCompat_Headline = 2131099779;
// aapt resource value: 0x7f060084
public const int TextAppearance_AppCompat_Inverse = 2131099780;
// aapt resource value: 0x7f060085
public const int TextAppearance_AppCompat_Large = 2131099781;
// aapt resource value: 0x7f060086
public const int TextAppearance_AppCompat_Large_Inverse = 2131099782;
// aapt resource value: 0x7f060087
public const int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 2131099783;
// aapt resource value: 0x7f060088
public const int TextAppearance_AppCompat_Light_SearchResult_Title = 2131099784;
// aapt resource value: 0x7f060089
public const int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 2131099785;
// aapt resource value: 0x7f06008a
public const int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 2131099786;
// aapt resource value: 0x7f06008b
public const int TextAppearance_AppCompat_Medium = 2131099787;
// aapt resource value: 0x7f06008c
public const int TextAppearance_AppCompat_Medium_Inverse = 2131099788;
// aapt resource value: 0x7f06008d
public const int TextAppearance_AppCompat_Menu = 2131099789;
// aapt resource value: 0x7f06008e
public const int TextAppearance_AppCompat_SearchResult_Subtitle = 2131099790;
// aapt resource value: 0x7f06008f
public const int TextAppearance_AppCompat_SearchResult_Title = 2131099791;
// aapt resource value: 0x7f060090
public const int TextAppearance_AppCompat_Small = 2131099792;
// aapt resource value: 0x7f060091
public const int TextAppearance_AppCompat_Small_Inverse = 2131099793;
// aapt resource value: 0x7f060092
public const int TextAppearance_AppCompat_Subhead = 2131099794;
// aapt resource value: 0x7f060093
public const int TextAppearance_AppCompat_Subhead_Inverse = 2131099795;
// aapt resource value: 0x7f060094
public const int TextAppearance_AppCompat_Title = 2131099796;
// aapt resource value: 0x7f060095
public const int TextAppearance_AppCompat_Title_Inverse = 2131099797;
// aapt resource value: 0x7f060096
public const int TextAppearance_AppCompat_Widget_ActionBar_Menu = 2131099798;
// aapt resource value: 0x7f060097
public const int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 2131099799;
// aapt resource value: 0x7f060098
public const int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 2131099800;
// aapt resource value: 0x7f060099
public const int TextAppearance_AppCompat_Widget_ActionBar_Title = 2131099801;
// aapt resource value: 0x7f06009a
public const int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 2131099802;
// aapt resource value: 0x7f06009b
public const int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 2131099803;
// aapt resource value: 0x7f06009c
public const int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 2131099804;
// aapt resource value: 0x7f06009d
public const int TextAppearance_AppCompat_Widget_ActionMode_Title = 2131099805;
// aapt resource value: 0x7f06009e
public const int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 2131099806;
// aapt resource value: 0x7f06009f
public const int TextAppearance_AppCompat_Widget_DropDownItem = 2131099807;
// aapt resource value: 0x7f0600a0
public const int TextAppearance_AppCompat_Widget_PopupMenu_Large = 2131099808;
// aapt resource value: 0x7f0600a1
public const int TextAppearance_AppCompat_Widget_PopupMenu_Small = 2131099809;
// aapt resource value: 0x7f0600a2
public const int TextAppearance_AppCompat_Widget_Switch = 2131099810;
// aapt resource value: 0x7f0600a3
public const int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 2131099811;
// aapt resource value: 0x7f0600a4
public const int TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 2131099812;
// aapt resource value: 0x7f0600a5
public const int TextAppearance_Widget_AppCompat_Toolbar_Title = 2131099813;
// aapt resource value: 0x7f0600a6
public const int Theme_AppCompat = 2131099814;
// aapt resource value: 0x7f0600a7
public const int Theme_AppCompat_CompactMenu = 2131099815;
// aapt resource value: 0x7f0600a8
public const int Theme_AppCompat_Dialog = 2131099816;
// aapt resource value: 0x7f0600a9
public const int Theme_AppCompat_DialogWhenLarge = 2131099817;
// aapt resource value: 0x7f0600aa
public const int Theme_AppCompat_Light = 2131099818;
// aapt resource value: 0x7f0600ab
public const int Theme_AppCompat_Light_DarkActionBar = 2131099819;
// aapt resource value: 0x7f0600ac
public const int Theme_AppCompat_Light_Dialog = 2131099820;
// aapt resource value: 0x7f0600ad
public const int Theme_AppCompat_Light_DialogWhenLarge = 2131099821;
// aapt resource value: 0x7f0600ae
public const int Theme_AppCompat_Light_NoActionBar = 2131099822;
// aapt resource value: 0x7f0600af
public const int Theme_AppCompat_NoActionBar = 2131099823;
// aapt resource value: 0x7f060000
public const int Theme_IAPTheme = 2131099648;
// aapt resource value: 0x7f060005
public const int Theme_MediaRouter = 2131099653;
// aapt resource value: 0x7f060006
public const int Theme_MediaRouter_Light = 2131099654;
// aapt resource value: 0x7f0600b0
public const int ThemeOverlay_AppCompat = 2131099824;
// aapt resource value: 0x7f0600b1
public const int ThemeOverlay_AppCompat_ActionBar = 2131099825;
// aapt resource value: 0x7f0600b2
public const int ThemeOverlay_AppCompat_Dark = 2131099826;
// aapt resource value: 0x7f0600b3
public const int ThemeOverlay_AppCompat_Dark_ActionBar = 2131099827;
// aapt resource value: 0x7f0600b4
public const int ThemeOverlay_AppCompat_Light = 2131099828;
// aapt resource value: 0x7f060003
public const int WalletFragmentDefaultButtonTextAppearance = 2131099651;
// aapt resource value: 0x7f060002
public const int WalletFragmentDefaultDetailsHeaderTextAppearance = 2131099650;
// aapt resource value: 0x7f060001
public const int WalletFragmentDefaultDetailsTextAppearance = 2131099649;
// aapt resource value: 0x7f060004
public const int WalletFragmentDefaultStyle = 2131099652;
// aapt resource value: 0x7f0600b5
public const int Widget_AppCompat_ActionBar = 2131099829;
// aapt resource value: 0x7f0600b6
public const int Widget_AppCompat_ActionBar_Solid = 2131099830;
// aapt resource value: 0x7f0600b7
public const int Widget_AppCompat_ActionBar_TabBar = 2131099831;
// aapt resource value: 0x7f0600b8
public const int Widget_AppCompat_ActionBar_TabText = 2131099832;
// aapt resource value: 0x7f0600b9
public const int Widget_AppCompat_ActionBar_TabView = 2131099833;
// aapt resource value: 0x7f0600ba
public const int Widget_AppCompat_ActionButton = 2131099834;
// aapt resource value: 0x7f0600bb
public const int Widget_AppCompat_ActionButton_CloseMode = 2131099835;
// aapt resource value: 0x7f0600bc
public const int Widget_AppCompat_ActionButton_Overflow = 2131099836;
// aapt resource value: 0x7f0600bd
public const int Widget_AppCompat_ActionMode = 2131099837;
// aapt resource value: 0x7f0600be
public const int Widget_AppCompat_ActivityChooserView = 2131099838;
// aapt resource value: 0x7f0600bf
public const int Widget_AppCompat_AutoCompleteTextView = 2131099839;
// aapt resource value: 0x7f0600c0
public const int Widget_AppCompat_CompoundButton_Switch = 2131099840;
// aapt resource value: 0x7f0600c1
public const int Widget_AppCompat_DrawerArrowToggle = 2131099841;
// aapt resource value: 0x7f0600c2
public const int Widget_AppCompat_DropDownItem_Spinner = 2131099842;
// aapt resource value: 0x7f0600c3
public const int Widget_AppCompat_EditText = 2131099843;
// aapt resource value: 0x7f0600c4
public const int Widget_AppCompat_Light_ActionBar = 2131099844;
// aapt resource value: 0x7f0600c5
public const int Widget_AppCompat_Light_ActionBar_Solid = 2131099845;
// aapt resource value: 0x7f0600c6
public const int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 2131099846;
// aapt resource value: 0x7f0600c7
public const int Widget_AppCompat_Light_ActionBar_TabBar = 2131099847;
// aapt resource value: 0x7f0600c8
public const int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 2131099848;
// aapt resource value: 0x7f0600c9
public const int Widget_AppCompat_Light_ActionBar_TabText = 2131099849;
// aapt resource value: 0x7f0600ca
public const int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 2131099850;
// aapt resource value: 0x7f0600cb
public const int Widget_AppCompat_Light_ActionBar_TabView = 2131099851;
// aapt resource value: 0x7f0600cc
public const int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 2131099852;
// aapt resource value: 0x7f0600cd
public const int Widget_AppCompat_Light_ActionButton = 2131099853;
// aapt resource value: 0x7f0600ce
public const int Widget_AppCompat_Light_ActionButton_CloseMode = 2131099854;
// aapt resource value: 0x7f0600cf
public const int Widget_AppCompat_Light_ActionButton_Overflow = 2131099855;
// aapt resource value: 0x7f0600d0
public const int Widget_AppCompat_Light_ActionMode_Inverse = 2131099856;
// aapt resource value: 0x7f0600d1
public const int Widget_AppCompat_Light_ActivityChooserView = 2131099857;
// aapt resource value: 0x7f0600d2
public const int Widget_AppCompat_Light_AutoCompleteTextView = 2131099858;
// aapt resource value: 0x7f0600d3
public const int Widget_AppCompat_Light_DropDownItem_Spinner = 2131099859;
// aapt resource value: 0x7f0600d4
public const int Widget_AppCompat_Light_ListPopupWindow = 2131099860;
// aapt resource value: 0x7f0600d5
public const int Widget_AppCompat_Light_ListView_DropDown = 2131099861;
// aapt resource value: 0x7f0600d6
public const int Widget_AppCompat_Light_PopupMenu = 2131099862;
// aapt resource value: 0x7f0600d7
public const int Widget_AppCompat_Light_PopupMenu_Overflow = 2131099863;
// aapt resource value: 0x7f0600d8
public const int Widget_AppCompat_Light_SearchView = 2131099864;
// aapt resource value: 0x7f0600d9
public const int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 2131099865;
// aapt resource value: 0x7f0600da
public const int Widget_AppCompat_ListPopupWindow = 2131099866;
// aapt resource value: 0x7f0600db
public const int Widget_AppCompat_ListView_DropDown = 2131099867;
// aapt resource value: 0x7f0600dc
public const int Widget_AppCompat_ListView_Menu = 2131099868;
// aapt resource value: 0x7f0600dd
public const int Widget_AppCompat_PopupMenu = 2131099869;
// aapt resource value: 0x7f0600de
public const int Widget_AppCompat_PopupMenu_Overflow = 2131099870;
// aapt resource value: 0x7f0600df
public const int Widget_AppCompat_PopupWindow = 2131099871;
// aapt resource value: 0x7f0600e0
public const int Widget_AppCompat_ProgressBar = 2131099872;
// aapt resource value: 0x7f0600e1
public const int Widget_AppCompat_ProgressBar_Horizontal = 2131099873;
// aapt resource value: 0x7f0600e2
public const int Widget_AppCompat_SearchView = 2131099874;
// aapt resource value: 0x7f0600e3
public const int Widget_AppCompat_Spinner = 2131099875;
// aapt resource value: 0x7f0600e4
public const int Widget_AppCompat_Spinner_DropDown = 2131099876;
// aapt resource value: 0x7f0600e5
public const int Widget_AppCompat_Spinner_DropDown_ActionBar = 2131099877;
// aapt resource value: 0x7f0600e6
public const int Widget_AppCompat_Toolbar = 2131099878;
// aapt resource value: 0x7f0600e7
public const int Widget_AppCompat_Toolbar_Button_Navigation = 2131099879;
// aapt resource value: 0x7f060007
public const int Widget_MediaRouter_Light_MediaRouteButton = 2131099655;
// aapt resource value: 0x7f060008
public const int Widget_MediaRouter_MediaRouteButton = 2131099656;
static Style()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Style()
{
}
}
public partial class Styleable
{
public static int[] ActionBar = new int[]
{
2130772011,
2130772013,
2130772014,
2130772015,
2130772016,
2130772017,
2130772018,
2130772019,
2130772020,
2130772021,
2130772022,
2130772023,
2130772024,
2130772025,
2130772026,
2130772027,
2130772028,
2130772029,
2130772030,
2130772031,
2130772032,
2130772033,
2130772034,
2130772035,
2130772036,
2130772037,
2130772123};
// aapt resource value: 10
public const int ActionBar_background = 10;
// aapt resource value: 12
public const int ActionBar_backgroundSplit = 12;
// aapt resource value: 11
public const int ActionBar_backgroundStacked = 11;
// aapt resource value: 21
public const int ActionBar_contentInsetEnd = 21;
// aapt resource value: 22
public const int ActionBar_contentInsetLeft = 22;
// aapt resource value: 23
public const int ActionBar_contentInsetRight = 23;
// aapt resource value: 20
public const int ActionBar_contentInsetStart = 20;
// aapt resource value: 13
public const int ActionBar_customNavigationLayout = 13;
// aapt resource value: 3
public const int ActionBar_displayOptions = 3;
// aapt resource value: 9
public const int ActionBar_divider = 9;
// aapt resource value: 24
public const int ActionBar_elevation = 24;
// aapt resource value: 0
public const int ActionBar_height = 0;
// aapt resource value: 19
public const int ActionBar_hideOnContentScroll = 19;
// aapt resource value: 26
public const int ActionBar_homeAsUpIndicator = 26;
// aapt resource value: 14
public const int ActionBar_homeLayout = 14;
// aapt resource value: 7
public const int ActionBar_icon = 7;
// aapt resource value: 16
public const int ActionBar_indeterminateProgressStyle = 16;
// aapt resource value: 18
public const int ActionBar_itemPadding = 18;
// aapt resource value: 8
public const int ActionBar_logo = 8;
// aapt resource value: 2
public const int ActionBar_navigationMode = 2;
// aapt resource value: 25
public const int ActionBar_popupTheme = 25;
// aapt resource value: 17
public const int ActionBar_progressBarPadding = 17;
// aapt resource value: 15
public const int ActionBar_progressBarStyle = 15;
// aapt resource value: 4
public const int ActionBar_subtitle = 4;
// aapt resource value: 6
public const int ActionBar_subtitleTextStyle = 6;
// aapt resource value: 1
public const int ActionBar_title = 1;
// aapt resource value: 5
public const int ActionBar_titleTextStyle = 5;
public static int[] ActionBarLayout = new int[]
{
16842931};
// aapt resource value: 0
public const int ActionBarLayout_android_layout_gravity = 0;
public static int[] ActionMenuItemView = new int[]
{
16843071};
// aapt resource value: 0
public const int ActionMenuItemView_android_minWidth = 0;
public static int[] ActionMenuView;
public static int[] ActionMode = new int[]
{
2130772011,
2130772017,
2130772018,
2130772022,
2130772024,
2130772038};
// aapt resource value: 3
public const int ActionMode_background = 3;
// aapt resource value: 4
public const int ActionMode_backgroundSplit = 4;
// aapt resource value: 5
public const int ActionMode_closeItemLayout = 5;
// aapt resource value: 0
public const int ActionMode_height = 0;
// aapt resource value: 2
public const int ActionMode_subtitleTextStyle = 2;
// aapt resource value: 1
public const int ActionMode_titleTextStyle = 1;
public static int[] ActivityChooserView = new int[]
{
2130772039,
2130772040};
// aapt resource value: 1
public const int ActivityChooserView_expandActivityOverflowButtonDrawable = 1;
// aapt resource value: 0
public const int ActivityChooserView_initialActivityCount = 0;
public static int[] AdsAttrs = new int[]
{
2130771968,
2130771969,
2130771970};
// aapt resource value: 0
public const int AdsAttrs_adSize = 0;
// aapt resource value: 1
public const int AdsAttrs_adSizes = 1;
// aapt resource value: 2
public const int AdsAttrs_adUnitId = 2;
public static int[] CompatTextView = new int[]
{
2130772041};
// aapt resource value: 0
public const int CompatTextView_textAllCaps = 0;
public static int[] DrawerArrowToggle = new int[]
{
2130772042,
2130772043,
2130772044,
2130772045,
2130772046,
2130772047,
2130772048,
2130772049};
// aapt resource value: 6
public const int DrawerArrowToggle_barSize = 6;
// aapt resource value: 0
public const int DrawerArrowToggle_color = 0;
// aapt resource value: 2
public const int DrawerArrowToggle_drawableSize = 2;
// aapt resource value: 3
public const int DrawerArrowToggle_gapBetweenBars = 3;
// aapt resource value: 5
public const int DrawerArrowToggle_middleBarArrowSize = 5;
// aapt resource value: 1
public const int DrawerArrowToggle_spinBars = 1;
// aapt resource value: 7
public const int DrawerArrowToggle_thickness = 7;
// aapt resource value: 4
public const int DrawerArrowToggle_topBottomBarArrowSize = 4;
public static int[] LinearLayoutCompat = new int[]
{
16842927,
16842948,
16843046,
16843047,
16843048,
2130772021,
2130772050,
2130772051,
2130772052};
// aapt resource value: 2
public const int LinearLayoutCompat_android_baselineAligned = 2;
// aapt resource value: 3
public const int LinearLayoutCompat_android_baselineAlignedChildIndex = 3;
// aapt resource value: 0
public const int LinearLayoutCompat_android_gravity = 0;
// aapt resource value: 1
public const int LinearLayoutCompat_android_orientation = 1;
// aapt resource value: 4
public const int LinearLayoutCompat_android_weightSum = 4;
// aapt resource value: 5
public const int LinearLayoutCompat_divider = 5;
// aapt resource value: 8
public const int LinearLayoutCompat_dividerPadding = 8;
// aapt resource value: 6
public const int LinearLayoutCompat_measureWithLargestChild = 6;
// aapt resource value: 7
public const int LinearLayoutCompat_showDividers = 7;
public static int[] LinearLayoutCompat_Layout = new int[]
{
16842931,
16842996,
16842997,
16843137};
// aapt resource value: 0
public const int LinearLayoutCompat_Layout_android_layout_gravity = 0;
// aapt resource value: 2
public const int LinearLayoutCompat_Layout_android_layout_height = 2;
// aapt resource value: 3
public const int LinearLayoutCompat_Layout_android_layout_weight = 3;
// aapt resource value: 1
public const int LinearLayoutCompat_Layout_android_layout_width = 1;
public static int[] ListPopupWindow = new int[]
{
16843436,
16843437};
// aapt resource value: 0
public const int ListPopupWindow_android_dropDownHorizontalOffset = 0;
// aapt resource value: 1
public const int ListPopupWindow_android_dropDownVerticalOffset = 1;
public static int[] LoadingImageView = new int[]
{
2130771971,
2130771972,
2130771973};
// aapt resource value: 2
public const int LoadingImageView_circleCrop = 2;
// aapt resource value: 1
public const int LoadingImageView_imageAspectRatio = 1;
// aapt resource value: 0
public const int LoadingImageView_imageAspectRatioAdjust = 0;
public static int[] MapAttrs = new int[]
{
2130771974,
2130771975,
2130771976,
2130771977,
2130771978,
2130771979,
2130771980,
2130771981,
2130771982,
2130771983,
2130771984,
2130771985,
2130771986,
2130771987,
2130771988,
2130771989};
// aapt resource value: 1
public const int MapAttrs_cameraBearing = 1;
// aapt resource value: 2
public const int MapAttrs_cameraTargetLat = 2;
// aapt resource value: 3
public const int MapAttrs_cameraTargetLng = 3;
// aapt resource value: 4
public const int MapAttrs_cameraTilt = 4;
// aapt resource value: 5
public const int MapAttrs_cameraZoom = 5;
// aapt resource value: 6
public const int MapAttrs_liteMode = 6;
// aapt resource value: 0
public const int MapAttrs_mapType = 0;
// aapt resource value: 7
public const int MapAttrs_uiCompass = 7;
// aapt resource value: 15
public const int MapAttrs_uiMapToolbar = 15;
// aapt resource value: 8
public const int MapAttrs_uiRotateGestures = 8;
// aapt resource value: 9
public const int MapAttrs_uiScrollGestures = 9;
// aapt resource value: 10
public const int MapAttrs_uiTiltGestures = 10;
// aapt resource value: 11
public const int MapAttrs_uiZoomControls = 11;
// aapt resource value: 12
public const int MapAttrs_uiZoomGestures = 12;
// aapt resource value: 13
public const int MapAttrs_useViewLifecycle = 13;
// aapt resource value: 14
public const int MapAttrs_zOrderOnTop = 14;
public static int[] MediaRouteButton = new int[]
{
16843071,
16843072,
2130772009};
// aapt resource value: 1
public const int MediaRouteButton_android_minHeight = 1;
// aapt resource value: 0
public const int MediaRouteButton_android_minWidth = 0;
// aapt resource value: 2
public const int MediaRouteButton_externalRouteEnabledDrawable = 2;
public static int[] MenuGroup = new int[]
{
16842766,
16842960,
16843156,
16843230,
16843231,
16843232};
// aapt resource value: 5
public const int MenuGroup_android_checkableBehavior = 5;
// aapt resource value: 0
public const int MenuGroup_android_enabled = 0;
// aapt resource value: 1
public const int MenuGroup_android_id = 1;
// aapt resource value: 3
public const int MenuGroup_android_menuCategory = 3;
// aapt resource value: 4
public const int MenuGroup_android_orderInCategory = 4;
// aapt resource value: 2
public const int MenuGroup_android_visible = 2;
public static int[] MenuItem = new int[]
{
16842754,
16842766,
16842960,
16843014,
16843156,
16843230,
16843231,
16843233,
16843234,
16843235,
16843236,
16843237,
16843375,
2130772053,
2130772054,
2130772055,
2130772056};
// aapt resource value: 14
public const int MenuItem_actionLayout = 14;
// aapt resource value: 16
public const int MenuItem_actionProviderClass = 16;
// aapt resource value: 15
public const int MenuItem_actionViewClass = 15;
// aapt resource value: 9
public const int MenuItem_android_alphabeticShortcut = 9;
// aapt resource value: 11
public const int MenuItem_android_checkable = 11;
// aapt resource value: 3
public const int MenuItem_android_checked = 3;
// aapt resource value: 1
public const int MenuItem_android_enabled = 1;
// aapt resource value: 0
public const int MenuItem_android_icon = 0;
// aapt resource value: 2
public const int MenuItem_android_id = 2;
// aapt resource value: 5
public const int MenuItem_android_menuCategory = 5;
// aapt resource value: 10
public const int MenuItem_android_numericShortcut = 10;
// aapt resource value: 12
public const int MenuItem_android_onClick = 12;
// aapt resource value: 6
public const int MenuItem_android_orderInCategory = 6;
// aapt resource value: 7
public const int MenuItem_android_title = 7;
// aapt resource value: 8
public const int MenuItem_android_titleCondensed = 8;
// aapt resource value: 4
public const int MenuItem_android_visible = 4;
// aapt resource value: 13
public const int MenuItem_showAsAction = 13;
public static int[] MenuView = new int[]
{
16842926,
16843052,
16843053,
16843054,
16843055,
16843056,
16843057,
2130772057};
// aapt resource value: 4
public const int MenuView_android_headerBackground = 4;
// aapt resource value: 2
public const int MenuView_android_horizontalDivider = 2;
// aapt resource value: 5
public const int MenuView_android_itemBackground = 5;
// aapt resource value: 6
public const int MenuView_android_itemIconDisabledAlpha = 6;
// aapt resource value: 1
public const int MenuView_android_itemTextAppearance = 1;
// aapt resource value: 3
public const int MenuView_android_verticalDivider = 3;
// aapt resource value: 0
public const int MenuView_android_windowAnimationStyle = 0;
// aapt resource value: 7
public const int MenuView_preserveIconSpacing = 7;
public static int[] PopupWindow = new int[]
{
16843126,
2130772058};
// aapt resource value: 0
public const int PopupWindow_android_popupBackground = 0;
// aapt resource value: 1
public const int PopupWindow_overlapAnchor = 1;
public static int[] PopupWindowBackgroundState = new int[]
{
2130772059};
// aapt resource value: 0
public const int PopupWindowBackgroundState_state_above_anchor = 0;
public static int[] SearchView = new int[]
{
16842970,
16843039,
16843296,
16843364,
2130772060,
2130772061,
2130772062,
2130772063,
2130772064,
2130772065,
2130772066,
2130772067,
2130772068,
2130772069,
2130772070};
// aapt resource value: 0
public const int SearchView_android_focusable = 0;
// aapt resource value: 3
public const int SearchView_android_imeOptions = 3;
// aapt resource value: 2
public const int SearchView_android_inputType = 2;
// aapt resource value: 1
public const int SearchView_android_maxWidth = 1;
// aapt resource value: 7
public const int SearchView_closeIcon = 7;
// aapt resource value: 11
public const int SearchView_commitIcon = 11;
// aapt resource value: 8
public const int SearchView_goIcon = 8;
// aapt resource value: 5
public const int SearchView_iconifiedByDefault = 5;
// aapt resource value: 4
public const int SearchView_layout = 4;
// aapt resource value: 13
public const int SearchView_queryBackground = 13;
// aapt resource value: 6
public const int SearchView_queryHint = 6;
// aapt resource value: 9
public const int SearchView_searchIcon = 9;
// aapt resource value: 14
public const int SearchView_submitBackground = 14;
// aapt resource value: 12
public const int SearchView_suggestionRowLayout = 12;
// aapt resource value: 10
public const int SearchView_voiceIcon = 10;
public static int[] Spinner = new int[]
{
16842927,
16842964,
16843125,
16843126,
16843362,
16843436,
16843437,
2130772071,
2130772072,
2130772073,
2130772074};
// aapt resource value: 1
public const int Spinner_android_background = 1;
// aapt resource value: 5
public const int Spinner_android_dropDownHorizontalOffset = 5;
// aapt resource value: 2
public const int Spinner_android_dropDownSelector = 2;
// aapt resource value: 6
public const int Spinner_android_dropDownVerticalOffset = 6;
// aapt resource value: 4
public const int Spinner_android_dropDownWidth = 4;
// aapt resource value: 0
public const int Spinner_android_gravity = 0;
// aapt resource value: 3
public const int Spinner_android_popupBackground = 3;
// aapt resource value: 10
public const int Spinner_disableChildrenWhenDisabled = 10;
// aapt resource value: 9
public const int Spinner_popupPromptView = 9;
// aapt resource value: 7
public const int Spinner_prompt = 7;
// aapt resource value: 8
public const int Spinner_spinnerMode = 8;
public static int[] SwitchCompat = new int[]
{
16843044,
16843045,
16843074,
2130772075,
2130772076,
2130772077,
2130772078,
2130772079,
2130772080,
2130772081};
// aapt resource value: 1
public const int SwitchCompat_android_textOff = 1;
// aapt resource value: 0
public const int SwitchCompat_android_textOn = 0;
// aapt resource value: 2
public const int SwitchCompat_android_thumb = 2;
// aapt resource value: 9
public const int SwitchCompat_showText = 9;
// aapt resource value: 8
public const int SwitchCompat_splitTrack = 8;
// aapt resource value: 6
public const int SwitchCompat_switchMinWidth = 6;
// aapt resource value: 7
public const int SwitchCompat_switchPadding = 7;
// aapt resource value: 5
public const int SwitchCompat_switchTextAppearance = 5;
// aapt resource value: 4
public const int SwitchCompat_thumbTextPadding = 4;
// aapt resource value: 3
public const int SwitchCompat_track = 3;
public static int[] Theme = new int[]
{
16842839,
2130772082,
2130772083,
2130772084,
2130772085,
2130772086,
2130772087,
2130772088,
2130772089,
2130772090,
2130772091,
2130772092,
2130772093,
2130772094,
2130772095,
2130772096,
2130772097,
2130772098,
2130772099,
2130772100,
2130772101,
2130772102,
2130772103,
2130772104,
2130772105,
2130772106,
2130772107,
2130772108,
2130772109,
2130772110,
2130772111,
2130772112,
2130772113,
2130772114,
2130772115,
2130772116,
2130772117,
2130772118,
2130772119,
2130772120,
2130772121,
2130772122,
2130772123,
2130772124,
2130772125,
2130772126,
2130772127,
2130772128,
2130772129,
2130772130,
2130772131,
2130772132,
2130772133,
2130772134,
2130772135,
2130772136,
2130772137,
2130772138,
2130772139,
2130772140,
2130772141,
2130772142,
2130772143,
2130772144,
2130772145,
2130772146,
2130772147,
2130772148,
2130772149,
2130772150,
2130772151,
2130772152,
2130772153,
2130772154,
2130772155,
2130772156,
2130772157,
2130772158,
2130772159,
2130772160,
2130772161,
2130772162,
2130772163};
// aapt resource value: 19
public const int Theme_actionBarDivider = 19;
// aapt resource value: 20
public const int Theme_actionBarItemBackground = 20;
// aapt resource value: 13
public const int Theme_actionBarPopupTheme = 13;
// aapt resource value: 18
public const int Theme_actionBarSize = 18;
// aapt resource value: 15
public const int Theme_actionBarSplitStyle = 15;
// aapt resource value: 14
public const int Theme_actionBarStyle = 14;
// aapt resource value: 9
public const int Theme_actionBarTabBarStyle = 9;
// aapt resource value: 8
public const int Theme_actionBarTabStyle = 8;
// aapt resource value: 10
public const int Theme_actionBarTabTextStyle = 10;
// aapt resource value: 16
public const int Theme_actionBarTheme = 16;
// aapt resource value: 17
public const int Theme_actionBarWidgetTheme = 17;
// aapt resource value: 43
public const int Theme_actionButtonStyle = 43;
// aapt resource value: 38
public const int Theme_actionDropDownStyle = 38;
// aapt resource value: 21
public const int Theme_actionMenuTextAppearance = 21;
// aapt resource value: 22
public const int Theme_actionMenuTextColor = 22;
// aapt resource value: 25
public const int Theme_actionModeBackground = 25;
// aapt resource value: 24
public const int Theme_actionModeCloseButtonStyle = 24;
// aapt resource value: 27
public const int Theme_actionModeCloseDrawable = 27;
// aapt resource value: 29
public const int Theme_actionModeCopyDrawable = 29;
// aapt resource value: 28
public const int Theme_actionModeCutDrawable = 28;
// aapt resource value: 33
public const int Theme_actionModeFindDrawable = 33;
// aapt resource value: 30
public const int Theme_actionModePasteDrawable = 30;
// aapt resource value: 35
public const int Theme_actionModePopupWindowStyle = 35;
// aapt resource value: 31
public const int Theme_actionModeSelectAllDrawable = 31;
// aapt resource value: 32
public const int Theme_actionModeShareDrawable = 32;
// aapt resource value: 26
public const int Theme_actionModeSplitBackground = 26;
// aapt resource value: 23
public const int Theme_actionModeStyle = 23;
// aapt resource value: 34
public const int Theme_actionModeWebSearchDrawable = 34;
// aapt resource value: 11
public const int Theme_actionOverflowButtonStyle = 11;
// aapt resource value: 12
public const int Theme_actionOverflowMenuStyle = 12;
// aapt resource value: 50
public const int Theme_activityChooserViewStyle = 50;
// aapt resource value: 0
public const int Theme_android_windowIsFloating = 0;
// aapt resource value: 45
public const int Theme_buttonBarButtonStyle = 45;
// aapt resource value: 44
public const int Theme_buttonBarStyle = 44;
// aapt resource value: 77
public const int Theme_colorAccent = 77;
// aapt resource value: 81
public const int Theme_colorButtonNormal = 81;
// aapt resource value: 79
public const int Theme_colorControlActivated = 79;
// aapt resource value: 80
public const int Theme_colorControlHighlight = 80;
// aapt resource value: 78
public const int Theme_colorControlNormal = 78;
// aapt resource value: 75
public const int Theme_colorPrimary = 75;
// aapt resource value: 76
public const int Theme_colorPrimaryDark = 76;
// aapt resource value: 82
public const int Theme_colorSwitchThumbNormal = 82;
// aapt resource value: 49
public const int Theme_dividerHorizontal = 49;
// aapt resource value: 48
public const int Theme_dividerVertical = 48;
// aapt resource value: 67
public const int Theme_dropDownListViewStyle = 67;
// aapt resource value: 39
public const int Theme_dropdownListPreferredItemHeight = 39;
// aapt resource value: 56
public const int Theme_editTextBackground = 56;
// aapt resource value: 55
public const int Theme_editTextColor = 55;
// aapt resource value: 42
public const int Theme_homeAsUpIndicator = 42;
// aapt resource value: 74
public const int Theme_listChoiceBackgroundIndicator = 74;
// aapt resource value: 68
public const int Theme_listPopupWindowStyle = 68;
// aapt resource value: 62
public const int Theme_listPreferredItemHeight = 62;
// aapt resource value: 64
public const int Theme_listPreferredItemHeightLarge = 64;
// aapt resource value: 63
public const int Theme_listPreferredItemHeightSmall = 63;
// aapt resource value: 65
public const int Theme_listPreferredItemPaddingLeft = 65;
// aapt resource value: 66
public const int Theme_listPreferredItemPaddingRight = 66;
// aapt resource value: 71
public const int Theme_panelBackground = 71;
// aapt resource value: 73
public const int Theme_panelMenuListTheme = 73;
// aapt resource value: 72
public const int Theme_panelMenuListWidth = 72;
// aapt resource value: 53
public const int Theme_popupMenuStyle = 53;
// aapt resource value: 54
public const int Theme_popupWindowStyle = 54;
// aapt resource value: 61
public const int Theme_searchViewStyle = 61;
// aapt resource value: 46
public const int Theme_selectableItemBackground = 46;
// aapt resource value: 47
public const int Theme_selectableItemBackgroundBorderless = 47;
// aapt resource value: 41
public const int Theme_spinnerDropDownItemStyle = 41;
// aapt resource value: 40
public const int Theme_spinnerStyle = 40;
// aapt resource value: 57
public const int Theme_switchStyle = 57;
// aapt resource value: 36
public const int Theme_textAppearanceLargePopupMenu = 36;
// aapt resource value: 69
public const int Theme_textAppearanceListItem = 69;
// aapt resource value: 70
public const int Theme_textAppearanceListItemSmall = 70;
// aapt resource value: 59
public const int Theme_textAppearanceSearchResultSubtitle = 59;
// aapt resource value: 58
public const int Theme_textAppearanceSearchResultTitle = 58;
// aapt resource value: 37
public const int Theme_textAppearanceSmallPopupMenu = 37;
// aapt resource value: 60
public const int Theme_textColorSearchUrl = 60;
// aapt resource value: 52
public const int Theme_toolbarNavigationButtonStyle = 52;
// aapt resource value: 51
public const int Theme_toolbarStyle = 51;
// aapt resource value: 1
public const int Theme_windowActionBar = 1;
// aapt resource value: 2
public const int Theme_windowActionBarOverlay = 2;
// aapt resource value: 3
public const int Theme_windowActionModeOverlay = 3;
// aapt resource value: 7
public const int Theme_windowFixedHeightMajor = 7;
// aapt resource value: 5
public const int Theme_windowFixedHeightMinor = 5;
// aapt resource value: 4
public const int Theme_windowFixedWidthMajor = 4;
// aapt resource value: 6
public const int Theme_windowFixedWidthMinor = 6;
public static int[] Toolbar = new int[]
{
16842927,
16843072,
2130772013,
2130772016,
2130772032,
2130772033,
2130772034,
2130772035,
2130772037,
2130772164,
2130772165,
2130772166,
2130772167,
2130772168,
2130772169,
2130772170,
2130772171,
2130772172,
2130772173,
2130772174,
2130772175,
2130772176};
// aapt resource value: 0
public const int Toolbar_android_gravity = 0;
// aapt resource value: 1
public const int Toolbar_android_minHeight = 1;
// aapt resource value: 19
public const int Toolbar_collapseContentDescription = 19;
// aapt resource value: 18
public const int Toolbar_collapseIcon = 18;
// aapt resource value: 5
public const int Toolbar_contentInsetEnd = 5;
// aapt resource value: 6
public const int Toolbar_contentInsetLeft = 6;
// aapt resource value: 7
public const int Toolbar_contentInsetRight = 7;
// aapt resource value: 4
public const int Toolbar_contentInsetStart = 4;
// aapt resource value: 16
public const int Toolbar_maxButtonHeight = 16;
// aapt resource value: 21
public const int Toolbar_navigationContentDescription = 21;
// aapt resource value: 20
public const int Toolbar_navigationIcon = 20;
// aapt resource value: 8
public const int Toolbar_popupTheme = 8;
// aapt resource value: 3
public const int Toolbar_subtitle = 3;
// aapt resource value: 10
public const int Toolbar_subtitleTextAppearance = 10;
// aapt resource value: 17
public const int Toolbar_theme = 17;
// aapt resource value: 2
public const int Toolbar_title = 2;
// aapt resource value: 15
public const int Toolbar_titleMarginBottom = 15;
// aapt resource value: 13
public const int Toolbar_titleMarginEnd = 13;
// aapt resource value: 12
public const int Toolbar_titleMarginStart = 12;
// aapt resource value: 14
public const int Toolbar_titleMarginTop = 14;
// aapt resource value: 11
public const int Toolbar_titleMargins = 11;
// aapt resource value: 9
public const int Toolbar_titleTextAppearance = 9;
public static int[] View = new int[]
{
16842970,
2130772177,
2130772178};
// aapt resource value: 0
public const int View_android_focusable = 0;
// aapt resource value: 2
public const int View_paddingEnd = 2;
// aapt resource value: 1
public const int View_paddingStart = 1;
public static int[] ViewStubCompat = new int[]
{
16842960,
16842994,
16842995};
// aapt resource value: 0
public const int ViewStubCompat_android_id = 0;
// aapt resource value: 2
public const int ViewStubCompat_android_inflatedId = 2;
// aapt resource value: 1
public const int ViewStubCompat_android_layout = 1;
public static int[] WalletFragmentOptions = new int[]
{
2130771990,
2130771991,
2130771992,
2130771993};
// aapt resource value: 0
public const int WalletFragmentOptions_appTheme = 0;
// aapt resource value: 1
public const int WalletFragmentOptions_environment = 1;
// aapt resource value: 3
public const int WalletFragmentOptions_fragmentMode = 3;
// aapt resource value: 2
public const int WalletFragmentOptions_fragmentStyle = 2;
public static int[] WalletFragmentStyle = new int[]
{
2130771994,
2130771995,
2130771996,
2130771997,
2130771998,
2130771999,
2130772000,
2130772001,
2130772002,
2130772003,
2130772004};
// aapt resource value: 3
public const int WalletFragmentStyle_buyButtonAppearance = 3;
// aapt resource value: 0
public const int WalletFragmentStyle_buyButtonHeight = 0;
// aapt resource value: 2
public const int WalletFragmentStyle_buyButtonText = 2;
// aapt resource value: 1
public const int WalletFragmentStyle_buyButtonWidth = 1;
// aapt resource value: 6
public const int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
// aapt resource value: 8
public const int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
// aapt resource value: 7
public const int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
// aapt resource value: 5
public const int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
// aapt resource value: 10
public const int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
// aapt resource value: 9
public const int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
// aapt resource value: 4
public const int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
static Styleable()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Styleable()
{
}
}
}
}
#pragma warning restore 1591
| 31.210226 | 111 | 0.729844 | [
"MIT"
] | chadmichel/XamarinMaps_FrillyToothpicks | Droid/Resources/Resource.designer.cs | 125,746 | C# |
//
// Copyright 2015 Blu Age Corporation - Plano, Texas
//
// 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 Summer.Batch.Extra.Copybook;
using Summer.Batch.Common.Factory;
using Summer.Batch.Common.Property;
namespace Summer.Batch.Extra.Ebcdic
{
/// <summary>
/// An EbcdicWriterMapper maps an item to a list of objects that can be written
/// as an EBCDIC record.
/// It requires a boolean encoder and a date parser to correctly manage booleans
/// and dates. For each, a default implementation is used if none is provided.
/// </summary>
public class EbcdicWriterMapper : AbstractEbcdicMapper, IInitializationPostOperations
{
private static readonly List<string> DecimalTypes = new List<string>() { "B", "9", "3" };
/// <summary>
/// Date parser property.
/// </summary>
public IDateParser DateParser { private get; set; }
/// <summary>
/// Boolean encoder property.
/// </summary>
public IBooleanEncoder BooleanEncoder { private get; set; }
/// <summary>
/// RecordFormatMap property.
/// </summary>
public RecordFormatMap RecordFormatMap { private get; set; }
/// <summary>
/// @see IInitializationPostOperations#AfterPropertiesSet
/// </summary>
public void AfterPropertiesSet()
{
if (DateParser == null)
{
DateParser = new DateParser();
}
if (BooleanEncoder == null)
{
BooleanEncoder = new ZeroOneBooleanEncoder();
}
}
/// <summary>
/// Converts the content of a business object into a list of values.
/// </summary>
/// <param name="item">the object to convert</param>
/// <returns> a list of values that can be written in an EBCDIC record</returns>
public List<object> Map(object item)
{
RecordFormat recordFormat;
List<object> values = new List<object>();
if (RecordFormatMap.MultipleRecordFormats)
{
recordFormat = RecordFormatMap.GetFromId(((IEbcdicBusinessObject)item).DistinguishedValue);
values.Add(((IEbcdicBusinessObject) item).DistinguishedValue);
}
else
{
recordFormat = RecordFormatMap.Default;
}
values.AddRange(MapFieldsList(item, recordFormat, new Dictionary<string, decimal>()));
return values;
}
#region private utility methods
/// <summary>
/// Map fields list object
/// </summary>
/// <param name="item"></param>
/// <param name="fieldsList"></param>
/// <param name="writtenNumbers"></param>
/// <returns></returns>
private List<object> MapFieldsList(object item, IFieldsList fieldsList, IDictionary<string, decimal> writtenNumbers)
{
List<object> values = new List<object>();
PropertyAccessor wrapper = new PropertyAccessor(item);
foreach (CopybookElement element in fieldsList.Elements)
{
var format = element as FieldFormat;
if (format != null)
{
values.Add(Convert(wrapper.GetProperty(GetName(format)), format, writtenNumbers));
}
else
{
values.Add(MapFieldsGroup(wrapper.GetProperty(GetName(element)), (FieldsGroup)element, writtenNumbers));
}
}
return values;
}
/// <summary>
/// Map fields group object
/// </summary>
/// <param name="value"></param>
/// <param name="fieldsGroup"></param>
/// <param name="writtenNumbers"></param>
/// <returns></returns>
private List<object> MapFieldsGroup(object value, FieldsGroup fieldsGroup, IDictionary<string, decimal> writtenNumbers)
{
List<object> result = new List<object>();
if (fieldsGroup.HasDependencies() || fieldsGroup.Occurs > 1)
{
MapCollection(result,fieldsGroup,writtenNumbers,(dynamic) value );
}
else
{
result = MapFieldsList(value, fieldsGroup, writtenNumbers);
}
return result;
}
/// <summary>
/// dynamic types handling
/// </summary>
/// <typeparam name="T"> </typeparam>
/// <param name="result"></param>
/// <param name="fieldsGroup"></param>
/// <param name="writtenNumbers"></param>
/// <param name="value"></param>
private void MapCollection<T>(List<object> result, FieldsGroup fieldsGroup, IDictionary<string, decimal> writtenNumbers, List<T> value)
{
result.AddRange(value.Select(item => MapFieldsList(item, fieldsGroup, writtenNumbers)));
}
/// <summary>
/// Get name from object
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
private string GetName(object item)
{
var format = item as FieldFormat;
var name = format != null ? format.Name : ((FieldsGroup)item).Name;
return ToCamelCase(name);
}
/// <summary>
/// Convert object
/// </summary>
/// <param name="value"></param>
/// <param name="format"></param>
/// <param name="writtenNumbers"></param>
/// <returns></returns>
private object Convert(object value, FieldFormat format, IDictionary<string, decimal> writtenNumbers)
{
object result;
if (value is int)
{
result = new decimal((int)value);
writtenNumbers[format.Name] = (decimal)result;
}
else if (value is long)
{
result = new decimal((long)value);
writtenNumbers[format.Name] = (decimal)result;
}
else if (value is float)
{
result = new decimal((float)value);
writtenNumbers[format.Name] = (decimal)result;
}
else if (value is double)
{
result = new decimal((double)value);
writtenNumbers[format.Name] = (decimal)result;
}
else if (value is DateTime)
{
result = EncodeDate((DateTime)value, format);
}
else if (value is bool)
{
result = BooleanEncoder.Encode((bool)value);
}
else
{
var list = value as List<object>;
result = list != null ? ConvertList(list, format, writtenNumbers) : value;
}
return result;
}
/// <summary>
/// Convert list of objects
/// </summary>
/// <param name="values"></param>
/// <param name="format"></param>
/// <param name="writtenNumbers"></param>
/// <returns></returns>
private List<object> ConvertList(List<object> values, FieldFormat format, IDictionary<string, decimal> writtenNumbers)
{
List<object> result = values.Select(element => Convert(element, format, writtenNumbers)).ToList();
int occurs;
if (format.HasDependencies())
{
occurs = (int)writtenNumbers[format.DependingOn];
}
else
{
occurs = format.Occurs;
}
int toFill = occurs - values.Count;
for (int i = 0; i < toFill; i++)
{
result.Add(GetFillValue(format));
}
return result;
}
/// <summary>
/// Encode date
/// </summary>
/// <param name="date"></param>
/// <param name="format"></param>
/// <returns></returns>
private object EncodeDate(DateTime date, FieldFormat format)
{
if (DecimalTypes.Contains(format.Type))
{
return DateParser.EncodeDecimal(date);
}
return DateParser.EncodeString(date);
}
/// <summary>
/// return filler
/// </summary>
/// <param name="format"></param>
/// <returns></returns>
private object GetFillValue(FieldFormat format)
{
if (DecimalTypes.Contains(format.Type))
{
return 0m;
}
return "";
}
#endregion
}
} | 36.108614 | 144 | 0.521938 | [
"Apache-2.0"
] | Andrey-Ostapenko/SummerBatch | Summer.Batch.Extra/Ebcdic/EbcdicWriterMapper.cs | 9,643 | C# |
using NBitcoin;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using WalletWasabi.CoinJoin.Common.Crypto;
using WalletWasabi.JsonConverters;
namespace WalletWasabi.CoinJoin.Common.Models
{
public class RoundStateResponse
{
[JsonConverter(typeof(StringEnumConverter))]
public RoundPhase Phase { get; set; }
[JsonConverter(typeof(MoneyBtcJsonConverter))]
public Money Denomination { get; set; }
[JsonConverter(typeof(BlockCypherDateTimeOffsetJsonConverter))]
public DateTimeOffset InputRegistrationTimesout { get; set; }
public IEnumerable<SchnorrPubKey> SchnorrPubKeys { get; set; }
public int RegisteredPeerCount { get; set; }
public int RequiredPeerCount { get; set; }
public int MaximumInputCountPerPeer { get; set; }
public int RegistrationTimeout { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerInputs { get; set; }
[JsonConverter(typeof(MoneySatoshiJsonConverter))]
public Money FeePerOutputs { get; set; }
public decimal CoordinatorFeePercent { get; set; }
public long RoundId { get; set; }
/// <summary>
/// This is round independent, it is only here because of backward compatibility.
/// </summary>
public int SuccessfulRoundCount { get; set; }
public Money CalculateRequiredAmount(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2); // + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum() || tried.Count == MaximumInputCountPerPeer)
{
return required;
}
}
}
return baseMinimum + FeePerInputs;
//return baseMinimum + (FeePerInputs * MaximumInputCountPerPeer);
}
public bool HaveEnoughQueued(IEnumerable<Money> queuedCoinAmounts)
{
var tried = new List<Money>();
Money baseMinimum = Denomination + (FeePerOutputs * 2); // + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
if (queuedCoinAmounts != default)
{
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
Money required = baseMinimum + (FeePerInputs * tried.Count);
if (required <= tried.Sum())
{
return true;
}
if (tried.Count == MaximumInputCountPerPeer)
{
return false;
}
}
}
return false;
}
}
}
| 28.052632 | 134 | 0.710319 | [
"MIT"
] | Maxie42/WalletWasabi | WalletWasabi/CoinJoin/Common/Models/RoundStateResponse.cs | 2,665 | C# |
using BettingGame.Framework;
using BettingGame.UserManagement.Core.Features.Shared.Abstraction;
using Microsoft.Extensions.DependencyInjection;
using Silverback.Messaging.Subscribers;
namespace BettingGame.UserManagement.Core.Features.UserAdministration
{
public static class Registrar
{
public static IServiceCollection AddFeatureUserAdministration<TUserReader>(this IServiceCollection services)
where TUserReader : class, IUserReader
{
// Shared
services.AddSingleton<IUserReader, TUserReader>();
// QueryHandler
services.AddScoped<ISubscriber, AllUserQueryHandler>();
services.AddScoped<ISubscriber, UserByIdQueryHandler>();
services.AddSingleton<IStartupTask, CreateInitialAdminStartupTask>();
return services;
}
}
}
| 32.777778 | 117 | 0.692655 | [
"Apache-2.0"
] | msallin/BettingGame | BettingGame.UserManagement.Core/Features/UserAdministration/Registrar.cs | 887 | C# |
using System;
using System.Collections.Generic;
using System.Runtime.Remoting;
using NUnit.Framework;
namespace COL.UnityGameWheels.Core.Ioc.Test
{
[TestFixture]
public class ContainerTests
{
[Test]
public void TestBasic()
{
var container = new Container();
container.BindSingleton<IServiceA, ServiceA>();
container.BindSingleton<ServiceB>();
Assert.Throws<InvalidOperationException>(() => { container.BindSingleton(typeof(ServiceB), typeof(ServiceB)); });
var serviceB = container.Make<ServiceB>();
var serviceA = container.Make<IServiceA>();
Assert.AreSame(serviceA, container.Make(typeof(IServiceA)));
serviceB.Execute();
Assert.True(serviceB.IsExecuted);
Assert.True(!serviceB.IsShut);
container.Dispose();
Assert.True(serviceB.IsShut);
}
[Test]
public void TestLifeStyle()
{
var container = new Container();
container.BindSingleton<IServiceA, ServiceA>();
container.Bind<ServiceB>();
container.BindSingleton<ServiceC>();
container.Bind<ServiceD>();
var d1 = container.Make<ServiceD>();
var d2 = container.Make<ServiceD>();
Assert.AreNotSame(d1, d2);
Assert.AreSame(d1.ServiceC, d2.ServiceC);
Assert.AreNotSame(d1.ServiceB, d2.ServiceB);
Assert.AreSame(d1.ServiceA, d2.ServiceA);
container.Dispose();
foreach (var d in new[] { d1, d2 })
{
Assert.True(d.ServiceA.IsShut);
Assert.True(d.ServiceC.IsShut);
Assert.True(!d.ServiceB.IsShut);
Assert.True(!d.IsShut);
}
}
[Test]
public void TestDiamondDependency()
{
var container = new Container();
container.BindSingleton<IServiceA, ServiceA>();
container.BindSingleton<ServiceB>();
container.BindSingleton<ServiceC, ServiceC>();
container.BindSingleton<ServiceD>();
var serviceD = container.Make<ServiceD>();
serviceD.Execute();
var serviceA = (IServiceA)container.Make(typeof(IServiceA));
container.Dispose();
Assert.True(serviceA.IsShut);
}
[Test]
public void TestBindingData()
{
using (var container = new Container())
{
var bindingData = container.BindSingleton<IServiceA, ServiceA>();
Assert.True(container.IsBound<IServiceA>());
Assert.True(container.TypeIsBound(typeof(IServiceA)));
var bindingData2 = container.GetBindingData(typeof(IServiceA));
Assert.AreSame(bindingData, bindingData2);
}
}
[Test]
public void TestBindInstance()
{
using (var container = new Container())
{
container.BindSingleton<IServiceA, ServiceA>();
container.BindInstance(new ServiceB());
var serviceB = container.Make<ServiceB>();
// Life cycle is not managed, so no auto wiring or auto initialization.
Assert.IsNull(serviceB.ServiceA);
}
}
[Test]
public void TestPropertyInjection()
{
using (var container = new Container())
{
container.BindSingleton<IServiceA, ServiceA>().AddPropertyInjections(new PropertyInjection
{
PropertyName = "IntProperty",
Value = 125,
});
Assert.AreEqual(125, container.Make<IServiceA>().IntProperty);
}
}
[Test]
public void TestGenericUnsupported()
{
using (var container = new Container())
{
Assert.Throws<ArgumentException>(() => { container.BindSingleton(typeof(IGenericServiceA<>), typeof(GenericServiceA<>)); });
Assert.Throws<ArgumentException>(() => { container.BindSingleton(typeof(GenericServiceA<>), typeof(GenericServiceA<>)); });
container.BindSingleton<IGenericServiceA<int>, GenericServiceA<int>>();
Assert.AreEqual(typeof(GenericServiceA<int>), container.Make<IGenericServiceA<int>>().GetType());
}
}
[Test]
public void TestBindBeforeMake()
{
using (var container = new Container())
{
container.BindSingleton<ServiceA>();
container.Make<ServiceA>();
Assert.Throws<InvalidOperationException>(() => { container.BindSingleton<ServiceB>(); });
}
}
private interface IServiceA
{
int IntProperty { get; set; }
bool IsExecuted { get; }
bool IsShut { get; }
void Execute();
}
private class ServiceA : IServiceA, IDisposable
{
public int IntProperty { get; set; }
public void Dispose()
{
Assert.True(!IsShut);
IsShut = true;
}
public bool IsExecuted { get; private set; }
public bool IsShut { get; private set; }
public void Execute()
{
IsExecuted = true;
}
}
private class ServiceB : IDisposable
{
[Inject]
public IServiceA ServiceA { get; set; }
public bool IsExecuted { get; private set; }
public bool IsShut { get; private set; }
public void Dispose()
{
Assert.True(!IsShut);
Assert.True(!ServiceA.IsShut);
IsShut = true;
}
public void Execute()
{
ServiceA.Execute();
IsExecuted = true;
}
}
private class ServiceC : ServiceB
{
}
private class ServiceD : IDisposable
{
[Inject]
public IServiceA ServiceA { get; set; }
[Inject]
public ServiceB ServiceB { get; set; }
[Inject]
public ServiceC ServiceC { get; set; }
public void Dispose()
{
Assert.True(!IsShut);
Assert.True(!ServiceA.IsShut);
Assert.True(!ServiceB.IsShut);
Assert.True(!ServiceC.IsShut);
IsShut = true;
}
public bool Executed { get; private set; }
public bool IsShut { get; private set; }
public void Execute()
{
Assert.True(!ServiceA.IsExecuted);
Assert.True(!ServiceB.IsExecuted);
Assert.True(!ServiceC.IsExecuted);
ServiceB.Execute();
ServiceC.Execute();
Executed = true;
}
}
private interface IGenericServiceA<T>
{
}
private class GenericServiceA<T> : IGenericServiceA<T>
{
}
}
} | 31.614719 | 140 | 0.517869 | [
"MIT"
] | GarfieldJiang/UnityGameWheels.Core | Core.Tests/Ioc/ContainerTests.cs | 7,303 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AWSSDK.EBS")]
[assembly: AssemblyDescription("The Amazon Web Services SDK for .NET (3.5) - Amazon Elastic Block Store. This release introduces the EBS direct APIs for Snapshots: 1. ListSnapshotBlocks, which lists the block indexes and block tokens for blocks in an Amazon EBS snapshot. 2. ListChangedBlocks, which lists the block indexes and block tokens for blocks that are different between two snapshots of the same volume/snapshot lineage. 3. GetSnapshotBlock, which returns the data in a block of an Amazon EBS snapshot.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET")]
[assembly: AssemblyCompany("Amazon.com, Inc")]
[assembly: AssemblyCopyright("Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3")]
[assembly: AssemblyFileVersion("3.7.0.109")] | 55.375 | 514 | 0.760722 | [
"Apache-2.0"
] | jamieromanowski/aws-sdk-net | sdk/code-analysis/ServiceAnalysis/EBS/Properties/AssemblyInfo.cs | 1,772 | C# |
//-----------------------------------------------------------------------------
// <copyright file="ContentTransferEncoding.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------------
using System;
namespace System.Net.Mime
{
/// <summary>
/// Summary description for ContentTransferEncoding.
/// </summary>
#if MAKE_MAILCLIENT_PUBLIC
internal
#else
internal
#endif
enum ContentTransferEncoding
{
SevenBit,
EightBit,
Binary,
Base64,
QuotedPrintable,
QEncoded,
Other,
Unspecified
}
}
| 23 | 79 | 0.482468 | [
"Apache-2.0"
] | 295007712/295007712.github.io | sourceCode/dotNet4.6/ndp/fx/src/net/System/Net/mail/ContentTransferEncoding.cs | 713 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace FengCode.Libs.Ado
{
/// <summary>
/// 值转换器抽象基类
/// </summary>
public abstract class BaseValueConvert
{
public BaseValueConvert() { }
/// <summary>
/// 将数据库中读取的值转换成对象的属性值
/// </summary>
public abstract object Read(object dbValue);
/// <summary>
/// 将对象的属性值转换成待更新的数据值
/// </summary>
public abstract object Write(object propertyValue);
}
}
| 20.56 | 59 | 0.587549 | [
"MIT"
] | fengcode-git/FengCode.Libs.Ado | FengCode.Libs.Ado/FengCode.Libs.Ado/BaseValueConvert.cs | 602 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
namespace WebCheck
{
class SendMail
{
public static void sendEmail(string sentFrom, string fromName, string emailTo, string subject, string htmlBody,
string smtp, string smtpUserName, string smtpPassword)
{
// Configure the client:
var client = new System.Net.Mail.SmtpClient(smtp);
var credentials = new System.Net.NetworkCredential(smtpUserName, smtpPassword);
client.Port = 587;
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.EnableSsl = true;
client.Credentials = credentials;
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress(sentFrom, fromName);
mailMessage.To.Add(emailTo);
mailMessage.Body = htmlBody;
mailMessage.IsBodyHtml = true;
mailMessage.Subject = subject;
client.Send(mailMessage);
}
}
}
| 34.2 | 119 | 0.629908 | [
"MIT"
] | urza/WebCheck | WebCheck/SendMail.cs | 1,199 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("TCPServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TCPServer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("97e7547e-f5b5-495e-b429-baefd5e1059d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 25.378378 | 56 | 0.713525 | [
"MIT"
] | SkillyZ/Jungle-war | TCPServer/Properties/AssemblyInfo.cs | 1,280 | C# |
using System;
using Android.App;
using Android.OS;
using Android.Util;
using Android.Views;
using Android.Widget;
using AT.Nineyards.Anyline.Camera;
using AT.Nineyards.Anyline.Models;
using AT.Nineyards.Anyline.Modules.Barcode;
namespace AnylineXamarinApp.Barcode
{
[Activity(Label = "Scan Barcodes", MainLauncher = false, Icon = "@drawable/ic_launcher")]
public class BarcodeActivity : Activity, IBarcodeResultListener
{
public static string TAG = typeof(BarcodeActivity).Name;
private TextView _resultText;
private BarcodeScanView _scanView;
protected override void OnCreate(Bundle bundle)
{
Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
base.OnCreate(bundle);
SetContentView(Resource.Layout.BarcodeActivity);
_scanView = FindViewById<BarcodeScanView>(Resource.Id.barcode_scan_view);
_resultText = FindViewById<TextView>(Resource.Id.text_result);
_scanView.SetConfigFromAsset("BarcodeConfig.json");
_scanView.InitAnyline(MainActivity.LicenseKey, this);
// limit the barcode scanner to QR codes or CODE_128 codes
//scanView.SetBarcodeFormats(BarcodeScanView.BarcodeFormat.QR_CODE, BarcodeScanView.BarcodeFormat.CODE_128);
_scanView.SetBeepOnResult(true);
_scanView.SetCancelOnResult(false);
_scanView.CameraOpened += Camera_Opened;
_scanView.CameraError += Camera_Error;
}
private void Camera_Opened(object sender, CameraOpenedEventArgs a)
{
Log.Debug(TAG, "Camera opened successfully. Frame resolution " + a.Width + " x " + a.Height);
}
private void Camera_Error(object sender, CameraErrorEventArgs a)
{
Log.Error(TAG, "OnCameraError: " + a.Event.Message);
}
void IBarcodeResultListener.OnResult(string result, BarcodeScanView.BarcodeFormat barcodeFormat, AnylineImage anylineImage)
{
_resultText.SetText(result, TextView.BufferType.Normal);
}
protected override void OnResume()
{
base.OnResume();
_scanView.StartScanning();
}
protected override void OnPause()
{
base.OnPause();
_scanView.CancelScanning();
_scanView.ReleaseCameraInBackground();
}
public override void OnBackPressed()
{
base.OnBackPressed();
Finish();
}
protected override void OnDestroy()
{
base.OnDestroy();
// explicitly free memory to avoid leaks
GC.Collect(GC.MaxGeneration);
}
}
} | 32.764045 | 132 | 0.609396 | [
"Apache-2.0"
] | Anyline/anyline-ocr-xamarin-android-example | AnylineXamarinApp.Droid/Barcode/BarcodeActivity.cs | 2,916 | C# |
/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the ram-2018-01-04.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;
using Amazon.RAM.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.RAM.Model.Internal.MarshallTransformations
{
/// <summary>
/// Response Unmarshaller for Principal Object
/// </summary>
public class PrincipalUnmarshaller : IUnmarshaller<Principal, XmlUnmarshallerContext>, IUnmarshaller<Principal, JsonUnmarshallerContext>
{
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
Principal IUnmarshaller<Principal, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
{
throw new NotImplementedException();
}
/// <summary>
/// Unmarshaller the response from the service to the response class.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public Principal Unmarshall(JsonUnmarshallerContext context)
{
context.Read();
if (context.CurrentTokenType == JsonToken.Null)
return null;
Principal unmarshalledObject = new Principal();
int targetDepth = context.CurrentDepth;
while (context.ReadAtDepth(targetDepth))
{
if (context.TestExpression("creationTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.CreationTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("external", targetDepth))
{
var unmarshaller = BoolUnmarshaller.Instance;
unmarshalledObject.External = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("id", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.Id = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("lastUpdatedTime", targetDepth))
{
var unmarshaller = DateTimeUnmarshaller.Instance;
unmarshalledObject.LastUpdatedTime = unmarshaller.Unmarshall(context);
continue;
}
if (context.TestExpression("resourceShareArn", targetDepth))
{
var unmarshaller = StringUnmarshaller.Instance;
unmarshalledObject.ResourceShareArn = unmarshaller.Unmarshall(context);
continue;
}
}
return unmarshalledObject;
}
private static PrincipalUnmarshaller _instance = new PrincipalUnmarshaller();
/// <summary>
/// Gets the singleton.
/// </summary>
public static PrincipalUnmarshaller Instance
{
get
{
return _instance;
}
}
}
} | 36.060345 | 140 | 0.600048 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/RAM/Generated/Model/Internal/MarshallTransformations/PrincipalUnmarshaller.cs | 4,183 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeckCard : Deck {
public override int MaxNumCard { get { return 13; } }
public override bool canGetOffCard(Card card) {
if (!isCardExist(card)) {
return false;
}
Card down = card;
Card up = card.UpCard;
int numLinkedCard = 1;
while (up != null) {
if (Card.IsLinkedCard(down, up)) {
numLinkedCard++;
down = up;
up = up.UpCard;
} else {
return false;
}
}
return numLinkedCard <= NumGetOffLinkedCard;
}
int NumGetOffLinkedCard {
get {
return (Game.Instance.NumEmptyCardDeck + 1)
* (Game.Instance.NumEmptySwitchDeck + 1);
}
}
int NumPutOnLinkedCard {
get {
int num = NumGetOffLinkedCard;
if (TopCard == null) {
num -= (Game.Instance.NumEmptySwitchDeck + 1);
}
return num;
}
}
protected override bool canPutOn(Card card) {
bool isPutOnRuleOK = TopCard == null || Card.IsLinkedCard(TopCard, card);
bool isNumPutOnLinkedCardOK = card.NumCardUp <= NumPutOnLinkedCard;
return isPutOnRuleOK && isNumPutOnLinkedCardOK;
}
public override Vector3 CardStackOffset {
get {
var offset = Config.Instance.CardStackOffset;
float offsetY = Config.Instance.CardStackMaxHeight / NumCard;
if (Mathf.Abs(offset.y) > offsetY) {
offset.y = -offsetY;
}
return offset;
}
}
}
| 24.5 | 81 | 0.537026 | [
"MIT"
] | wood9366/freecell | Assets/scripts/game/DeckCard.cs | 1,717 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Net;
using Microsoft.AspNetCore.Mvc;
using WebFileManagerApi.Exceptions;
using WebFileManagerApi.Models;
namespace WebFileManagerApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class DirectoryController : ControllerBase
{
/// <summary>
/// Gets directory information.
/// </summary>
/// <param name="directoryPath">The directory path.</param>
/// <returns>Returns the directory model.</returns>
[HttpGet]
public DirectoryModel Get([FromQuery, Required]string directoryPath)
{
try
{
var directoryInfo = new DirectoryInfo(directoryPath);
var directoryModel = new DirectoryModel(directoryInfo);
directoryModel.LoadContent();
return directoryModel;
}
catch (DirectoryNotFoundException)
{
throw new ApiException("Directory not found", HttpStatusCode.NotFound);
}
}
/// <summary>
/// Deletes directory.
/// </summary>
/// <param name="directoryPath">The directory path.</param>
[HttpDelete]
public void Delete([FromQuery, Required]string directoryPath)
{
bool isRootPath = Path.GetPathRoot(directoryPath) == directoryPath;
if (isRootPath)
{
throw new ApiException("You can not delete the root directory", HttpStatusCode.Forbidden);
}
if (!Directory.Exists(directoryPath))
{
throw new ApiException("Directory not found", HttpStatusCode.NotFound);
}
Directory.Delete(directoryPath, true);
}
/// <summary>
/// Searches directory.
/// </summary>
/// <param name="query">The query with directory path.</param>
/// <returns>Returns an enumeration with directory models.</returns>
[HttpGet("search")]
public IEnumerable<DirectoryModel> Search([FromQuery]string query = "/")
{
try
{
var parentDirectory = query == "/" ? new DirectoryInfo("/") : Directory.GetParent(query);
return parentDirectory.GetDirectories()
.Select(d => new DirectoryModel(d))
.Where(d => d.Path.StartsWith(query));
}
catch { }
return new List<DirectoryModel>();
}
/// <summary>
/// Renames directory.
/// </summary>
/// <param name="directoryPath">The directory path.</param>
/// <param name="body">These are the parameters for renaming.</param>
/// <returns>Returns the new directory model.</returns>
[HttpPut("rename")]
public DirectoryModel Rename([FromQuery, Required]string directoryPath, RenameParams body)
{
bool isRootPath = Path.GetPathRoot(directoryPath) == directoryPath;
if (isRootPath)
{
throw new ApiException("You can not rename the root directory", HttpStatusCode.Forbidden);
}
if (body.Name.IndexOfAny(Path.GetInvalidPathChars()) != -1 || body.Name.Contains('/'))
{
throw new ApiException("Invalid directory name", HttpStatusCode.BadRequest);
}
string destination = Path.Combine(directoryPath, "..", body.Name);
Directory.Move(directoryPath, destination);
var directoryInfo = new DirectoryInfo(destination);
return new DirectoryModel(directoryInfo);
}
}
} | 35.747664 | 106 | 0.574902 | [
"MIT"
] | Kewka/web-file-manager | WebFileManagerApi/Controllers/DirectoryController.cs | 3,825 | C# |
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using CairoDesktop.AppGrabber;
using CairoDesktop.Configuration;
using ManagedShell.Common.Helpers;
namespace CairoDesktop
{
public partial class QuickLaunchButton
{
public static DependencyProperty ParentTaskbarProperty = DependencyProperty.Register("ParentTaskbar", typeof(Taskbar), typeof(QuickLaunchButton));
public Taskbar ParentTaskbar
{
get { return (Taskbar)GetValue(ParentTaskbarProperty); }
set { SetValue(ParentTaskbarProperty, value); }
}
public QuickLaunchButton()
{
InitializeComponent();
setIconSize();
// register for settings changes
Settings.Instance.PropertyChanged += Instance_PropertyChanged;
}
private void Instance_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e != null && !string.IsNullOrWhiteSpace(e.PropertyName))
{
switch (e.PropertyName)
{
case "TaskbarIconSize":
setIconSize();
break;
}
}
}
private void setIconSize()
{
imgIcon.Width = IconHelper.GetSize(Settings.Instance.TaskbarIconSize);
imgIcon.Height = IconHelper.GetSize(Settings.Instance.TaskbarIconSize);
}
private void LaunchProgram(object sender, RoutedEventArgs e)
{
Button item = (Button)sender;
ApplicationInfo app = item.DataContext as ApplicationInfo;
ParentTaskbar._appGrabber.LaunchProgram(app);
}
private void LaunchProgramMenu(object sender, RoutedEventArgs e)
{
MenuItem item = (MenuItem)sender;
ApplicationInfo app = item.DataContext as ApplicationInfo;
ParentTaskbar._appGrabber.LaunchProgram(app);
}
private void LaunchProgramAdmin(object sender, RoutedEventArgs e)
{
MenuItem item = (MenuItem)sender;
ApplicationInfo app = item.DataContext as ApplicationInfo;
ParentTaskbar._appGrabber.LaunchProgramAdmin(app);
}
private void programsMenu_Remove(object sender, RoutedEventArgs e)
{
MenuItem item = (MenuItem)sender;
ApplicationInfo app = item.DataContext as ApplicationInfo;
ParentTaskbar._appGrabber.RemoveAppConfirm(app);
}
private void programsMenu_Properties(object sender, RoutedEventArgs e)
{
MenuItem item = (MenuItem)sender;
ApplicationInfo app = item.DataContext as ApplicationInfo;
ParentTaskbar._appGrabber.ShowAppProperties(app);
}
#region Drag and drop reordering
private Point? startPoint = null;
private bool inDrag = false;
// receive drop functions
private void btn_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effects = DragDropEffects.Link;
}
else if (!e.Data.GetDataPresent(typeof(ApplicationInfo)))
{
e.Effects = DragDropEffects.None;
}
e.Handled = true;
}
private void btn_Drop(object sender, DragEventArgs e)
{
Button dropContainer = sender as Button;
ApplicationInfo replacedApp = dropContainer.DataContext as ApplicationInfo;
string[] fileNames = e.Data.GetData(DataFormats.FileDrop) as string[];
if (fileNames != null)
{
int dropIndex = ParentTaskbar._appGrabber.QuickLaunch.IndexOf(replacedApp);
ParentTaskbar._appGrabber.InsertByPath(fileNames, dropIndex, AppCategoryType.QuickLaunch);
}
else if (e.Data.GetDataPresent(typeof(ApplicationInfo)))
{
ApplicationInfo dropData = e.Data.GetData(typeof(ApplicationInfo)) as ApplicationInfo;
int initialIndex = ParentTaskbar._appGrabber.QuickLaunch.IndexOf(dropData);
int dropIndex = ParentTaskbar._appGrabber.QuickLaunch.IndexOf(replacedApp);
ParentTaskbar._appGrabber.QuickLaunch.Move(initialIndex, dropIndex);
ParentTaskbar._appGrabber.Save();
}
setParentAutoHide(true);
e.Handled = true;
}
// send drag functions
private void btn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Store the mouse position
startPoint = e.GetPosition(this);
}
private void btn_PreviewMouseMove(object sender, MouseEventArgs e)
{
if (!inDrag && startPoint != null)
{
inDrag = true;
Point mousePos = e.GetPosition(this);
Vector diff = (Point)startPoint - mousePos;
if (mousePos.Y <= this.ActualHeight && ((Point)startPoint).Y <= this.ActualHeight && e.LeftButton == MouseButtonState.Pressed && (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
{
Button button = sender as Button;
ApplicationInfo selectedApp = button.DataContext as ApplicationInfo;
try
{
DragDrop.DoDragDrop(button, selectedApp, DragDropEffects.Move);
setParentAutoHide(true);
}
catch { }
// reset the stored mouse position
startPoint = null;
}
else if (e.LeftButton != MouseButtonState.Pressed)
{
// reset the stored mouse position
startPoint = null;
}
inDrag = false;
}
e.Handled = true;
}
#endregion
private void ContextMenu_Closed(object sender, RoutedEventArgs e)
{
setParentAutoHide(true);
}
private void setParentAutoHide(bool enabled)
{
if (ParentTaskbar != null) ParentTaskbar.CanAutoHide = enabled;
}
}
} | 33.729167 | 280 | 0.588326 | [
"Apache-2.0"
] | curoviyxru/cairoshell | Cairo Desktop/Cairo Desktop/QuickLaunchButton.xaml.cs | 6,478 | C# |
namespace DecTest
{
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
[TestFixture]
public class Attribute : Base
{
public class BaseString : Dec.IRecordable
{
public string value = "default";
public void Record(Dec.Recorder recorder)
{
recorder.Record(ref value, "value");
}
}
public class DerivedString : BaseString
{
}
public class StringMemberRecordable : Dec.IRecordable
{
public BaseString member;
public void Record(Dec.Recorder recorder)
{
recorder.Record(ref member, "member");
}
}
public class StringMemberDec : Dec.Dec
{
public BaseString member;
}
[Test]
public void Record([Values] bool classTag, [Values] bool nullTag, [Values] bool refTag, [Values] bool modeTag)
{
Dec.Config.TestParameters = new Dec.Config.UnitTestParameters { explicitTypes = new Type[] { typeof(BaseString), typeof(DerivedString) } };
string serialized = $@"
<Record>
<recordFormatVersion>1</recordFormatVersion>
<refs>
<Ref id=""ref00000"" class=""BaseString""><value>reffed</value></Ref>
</refs>
<data>
<member {(classTag ? "class='DerivedString'" : "")} {(nullTag ? "null='true'" : "")} {(refTag ? "ref='ref00000'" : "")} {(modeTag ? "mode='patch'" : "")}><value>data</value></member>
</data>
</Record>";
StringMemberRecordable deserialized = null;
int tags = ((classTag || modeTag) ? 1 : 0) + (nullTag ? 1 : 0) + (refTag ? 1 : 0);
if (tags <= 1)
{
deserialized = Dec.Recorder.Read<StringMemberRecordable>(serialized);
}
else
{
ExpectErrors(() => deserialized = Dec.Recorder.Read<StringMemberRecordable>(serialized));
}
if (refTag)
{
Assert.IsInstanceOf<BaseString>(deserialized.member);
Assert.AreEqual("reffed", deserialized.member.value);
}
else if (nullTag)
{
Assert.IsNull(deserialized.member);
}
else if (classTag)
{
Assert.IsInstanceOf<DerivedString>(deserialized.member);
Assert.AreEqual("data", deserialized.member.value);
}
else
{
Assert.IsInstanceOf<BaseString>(deserialized.member);
Assert.AreEqual("data", deserialized.member.value);
}
}
[Test]
public void Parser([Values] BehaviorMode mode, [Values] bool classTag, [Values] bool nullTag, [Values] bool refTag, [Values] bool modeTag)
{
Dec.Config.TestParameters = new Dec.Config.UnitTestParameters { explicitTypes = new Type[] { typeof(StringMemberDec), typeof(DerivedString) } };
var parser = new Dec.Parser();
parser.AddString($@"
<Decs>
<StringMemberDec decName=""TestDec"">
<member {(classTag ? "class='DerivedString'" : "")} {(nullTag ? "null='true'" : "")} {(refTag ? "ref='ref00000'" : "")} {(modeTag ? "mode='patch'" : "")}><value>data</value></member>
</StringMemberDec>
</Decs>");
int tags = ((classTag || modeTag) ? 1 : 0) + (nullTag ? 1 : 0) + (refTag ? 1 : 0);
if (tags <= 1 && !refTag)
{
parser.Finish();
}
else
{
ExpectErrors(() => parser.Finish());
}
DoBehavior(mode);
if (nullTag)
{
Assert.IsNull(Dec.Database<StringMemberDec>.Get("TestDec").member);
}
else if (classTag)
{
Assert.IsInstanceOf<DerivedString>(Dec.Database<StringMemberDec>.Get("TestDec").member);
Assert.AreEqual("data", Dec.Database<StringMemberDec>.Get("TestDec").member.value);
}
else
{
Assert.IsInstanceOf<BaseString>(Dec.Database<StringMemberDec>.Get("TestDec").member);
Assert.AreEqual("data", Dec.Database<StringMemberDec>.Get("TestDec").member.value);
}
}
}
}
| 34.916667 | 206 | 0.50358 | [
"MIT",
"Unlicense"
] | zorbathut/dec | test/unit/Attributes.cs | 4,609 | C# |
using UnityEngine;
using Sirenix.OdinInspector;
using UnityEngine.Networking;
public class FallDown : MonoBehaviour
{
#region variable
/// <summary>
/// variable
/// </summary>
[FoldoutGroup("GamePlay"), Tooltip("gravité de l'objet différent ? 1 = gravité identique, > 1 = gravité de l'objet plus forte"), SerializeField]
private float overallGravityAmplify = 1.05f;
[FoldoutGroup("GamePlay"), Tooltip("Ici la gravité à ajouter sur l'objet uniquement quand il est en train de descendre (> 1 pour augmenter)"), SerializeField]
private float fallDownGravity = 1.05f;
[FoldoutGroup("GamePlay"), Tooltip("marge d'erreur quand on commence à descendre"), SerializeField]
private float marginDescend = 0.05f;
[FoldoutGroup("Object"), Tooltip("gravité de l'objet différent ?"), SerializeField]
private GameObject objectCollider;
private Rigidbody rb;
#endregion
#region initialisation
/// <summary>
/// appelé lors de l'initialisation de ce weapon
/// </summary>
private void Awake()
{
rb = objectCollider.GetComponent<Rigidbody>();
}
#endregion
#region core script
#endregion
#region unity fonction and ending
private void FixedUpdate()
{
//gravité accru sur l'objet
if (overallGravityAmplify != 1)
rb.velocity += Vector3.up * Physics.gravity.y * (overallGravityAmplify - 1);
//gravité accru quand on descend !
if (rb.velocity.y < (0 - marginDescend) && fallDownGravity != 1)
{
rb.velocity += Vector3.up * Physics.gravity.y * (fallDownGravity - 1);
}
}
#endregion
}
| 29.785714 | 162 | 0.657674 | [
"MIT"
] | usernameHed/Pixel | Assets/_Scripts/Core/_Main/FallDown.cs | 1,682 | C# |
using System;
namespace Shimakaze.Struct.Ini.Exceptions
{
[Serializable]
public class DataNotExistsException : Exception
{
public DataNotExistsException() { }
public DataNotExistsException(string message) : base(message) { }
public DataNotExistsException(string message, Exception inner) : base(message, inner) { }
protected DataNotExistsException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
}
| 34.8125 | 97 | 0.709156 | [
"MIT"
] | ShimakazeProj/Shimakaze.Struct.Ini | src/Exceptions/DataNotExistsException.cs | 559 | C# |
using System;
namespace BizHawk.Emulation.DiscSystem
{
public static class DiscExtensions
{
public static Disc CreateAnyType(string path, Action<string> errorCallback)
{
return CreateImpl(null, path, errorCallback);
}
public static Disc Create(this DiscType type, string path, Action<string> errorCallback)
{
return CreateImpl(type, path, errorCallback);
}
private static Disc CreateImpl(DiscType? type, string path, Action<string> errorCallback)
{
//--- load the disc in a context which will let us abort if it's going to take too long
var discMountJob = new DiscMountJob { IN_FromPath = path, IN_SlowLoadAbortThreshold = 8 };
discMountJob.Run();
var disc = discMountJob.OUT_Disc ?? throw new InvalidOperationException($"Can't find the file specified: {path}");
if (discMountJob.OUT_SlowLoadAborted)
{
errorCallback("This disc would take too long to load. Run it through DiscoHawk first, or find a new rip because this one is probably junk");
return null;
}
if (discMountJob.OUT_ErrorLevel)
{
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
}
var discType = new DiscIdentifier(disc).DetectDiscType();
if (type.HasValue && discType != type)
{
errorCallback($"Not a {type} disc");
return null;
}
return disc;
}
}
}
| 29 | 144 | 0.712894 | [
"MIT"
] | NarryG/bizhawk-vanguard | src/BizHawk.Emulation.DiscSystem/DiscExtensions.cs | 1,336 | C# |
//----------------------------------------------------
// <copyright file="MessageQueuePermissionEntry.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Messaging
{
using System.ComponentModel;
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry"]/*' />
[Serializable()]
public class MessageQueuePermissionEntry
{
private string label;
private string machineName;
private string path;
private string category;
private MessageQueuePermissionAccess permissionAccess;
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.MessageQueuePermissionEntry"]/*' />
public MessageQueuePermissionEntry(MessageQueuePermissionAccess permissionAccess, string path)
{
if (path == null)
throw new ArgumentNullException("path");
if (path != MessageQueuePermission.Any && !MessageQueue.ValidatePath(path, false))
throw new ArgumentException(Res.GetString(Res.PathSyntax));
this.path = path;
this.permissionAccess = permissionAccess;
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.MessageQueuePermissionEntry1"]/*' />
public MessageQueuePermissionEntry(MessageQueuePermissionAccess permissionAccess, string machineName, string label, string category)
{
if (machineName == null && label == null && category == null)
throw new ArgumentNullException("machineName");
if (machineName != null && !SyntaxCheck.CheckMachineName(machineName))
throw new ArgumentException(Res.GetString(Res.InvalidParameter, "MachineName", machineName));
this.permissionAccess = permissionAccess;
this.machineName = machineName;
this.label = label;
this.category = category;
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.Category"]/*' />
public string Category
{
get
{
return this.category;
}
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.Label"]/*' />
public string Label
{
get
{
return this.label;
}
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.MachineName"]/*' />
public string MachineName
{
get
{
return this.machineName;
}
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.Path"]/*' />
public string Path
{
get
{
return this.path;
}
}
/// <include file='doc\MessageQueuePermissionEntry.uex' path='docs/doc[@for="MessageQueuePermissionEntry.PermissionAccess"]/*' />
public MessageQueuePermissionAccess PermissionAccess
{
get
{
return this.permissionAccess;
}
}
}
}
| 37.041237 | 149 | 0.57779 | [
"Apache-2.0"
] | 295007712/295007712.github.io | sourceCode/dotNet4.6/ndp/cdf/src/NetFx20/System.Messaging/System/Messaging/MessageQueuePermissionEntry.cs | 3,593 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the mq-2017-11-27.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using Amazon.MQ.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;
namespace Amazon.MQ.Model.Internal.MarshallTransformations
{
/// <summary>
/// DescribeBroker Request Marshaller
/// </summary>
public class DescribeBrokerRequestMarshaller : IMarshaller<IRequest, DescribeBrokerRequest> , IMarshaller<IRequest,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public IRequest Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((DescribeBrokerRequest)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name="publicRequest"></param>
/// <returns></returns>
public IRequest Marshall(DescribeBrokerRequest publicRequest)
{
IRequest request = new DefaultRequest(publicRequest, "Amazon.MQ");
request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2017-11-27";
request.HttpMethod = "GET";
if (!publicRequest.IsSetBrokerId())
throw new AmazonMQException("Request object does not have required field BrokerId set");
request.AddPathResource("{broker-id}", StringUtils.FromString(publicRequest.BrokerId));
request.ResourcePath = "/v1/brokers/{broker-id}";
return request;
}
private static DescribeBrokerRequestMarshaller _instance = new DescribeBrokerRequestMarshaller();
internal static DescribeBrokerRequestMarshaller GetInstance()
{
return _instance;
}
/// <summary>
/// Gets the singleton.
/// </summary>
public static DescribeBrokerRequestMarshaller Instance
{
get
{
return _instance;
}
}
}
} | 34.137931 | 143 | 0.651852 | [
"Apache-2.0"
] | ChristopherButtars/aws-sdk-net | sdk/src/Services/MQ/Generated/Model/Internal/MarshallTransformations/DescribeBrokerRequestMarshaller.cs | 2,970 | C# |
using NUnit.Framework;
using StructureMap.Testing.DocumentationExamples;
using StructureMap.Testing.Widget3;
using StructureMap.Web;
namespace StructureMap.Testing.Web
{
[TestFixture]
public class HybridBuildLifecycleTester
{
[Test]
public void run_without_an_httpcontext()
{
var container = new Container(x => x.For<IService>(WebLifecycles.Hybrid).Use<RemoteService>());
var object1 = container.GetInstance<IService>();
var object2 = container.GetInstance<IService>();
var object3 = container.GetInstance<IService>();
object1.ShouldNotBeNull();
object2.ShouldNotBeNull();
object3.ShouldNotBeNull();
object1.ShouldBeTheSameAs(object2).ShouldBeTheSameAs(object3);
}
}
} | 30.222222 | 107 | 0.66299 | [
"Apache-2.0"
] | NightOwl888/structuremap | src/StructureMap.Testing/Web/HybridBuildLifecycleTester.cs | 816 | C# |
using System;
using System.ComponentModel.DataAnnotations;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using FinanceAPICore;
using FinanceAPIData;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
namespace FinanceAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AuthController : Controller
{
private readonly AppSettings _appSettings;
private AuthenticationProcessor _authenticationProcessor;
public AuthController(IOptions<AppSettings> appSettings, AuthenticationProcessor authenticationProcessor)
{
_appSettings = appSettings.Value;
_authenticationProcessor = authenticationProcessor;
}
[HttpPost("authenticate")]
public IActionResult Authenticate([FromBody][Required] AuthenticateRequest model)
{
Client client = _authenticationProcessor.AuthenticateClient(model.Username, model.Password);
if (client == null)
return Error.Generate("Username or password is incorrect", Error.ErrorType.InvalidCredentials);
var token = generateJwtToken(client);
return Json(token);
}
private string generateJwtToken(Client client)
{
var tokenHandler = new JwtSecurityTokenHandler();
var key = Encoding.ASCII.GetBytes(_appSettings.JwtSecret);
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new[] { new Claim("id", client.ID.ToString()) }),
Expires = DateTime.UtcNow.AddHours(2),
SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(tokenDescriptor);
return tokenHandler.WriteToken(token);
}
public class AuthenticateRequest
{
[Required]
public string Username { get; set; }
[Required]
public string Password { get; set; }
}
}
}
| 30.741935 | 118 | 0.763903 | [
"Apache-2.0"
] | benfl3713/finance-api | src/FinanceAPI/FinanceAPI/Controllers/AuthController.cs | 1,908 | C# |
using Microsoft.EntityFrameworkCore.Migrations;
namespace MyCompany.MyProject.Migrations
{
public partial class Upgrade_ABP_380 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "UserName",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 32);
migrationBuilder.AlterColumn<string>(
name: "NormalizedUserName",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 32);
migrationBuilder.AlterColumn<string>(
name: "UserName",
table: "AbpUserAccounts",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 32,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "UserName",
table: "AbpUsers",
maxLength: 32,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<string>(
name: "NormalizedUserName",
table: "AbpUsers",
maxLength: 32,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 256);
migrationBuilder.AlterColumn<string>(
name: "UserName",
table: "AbpUserAccounts",
maxLength: 32,
nullable: true,
oldClrType: typeof(string),
oldMaxLength: 256,
oldNullable: true);
}
}
}
| 31.671875 | 71 | 0.498273 | [
"Apache-2.0"
] | tairan/aspnetboilerplate | templates/Abp.Template.React.PostgreSQL/Content/aspnet-core/src/MyCompany.MyProject.EntityFrameworkCore/Migrations/20180726102703_Upgrade_ABP_3.8.0.cs | 2,029 | C# |
namespace AnimalFarm
{
using System;
using AnimalFarm.Models;
class StartUp
{
static void Main(string[] args)
{
string name = Console.ReadLine();
int age = int.Parse(Console.ReadLine());
try
{
Chicken chicken = new Chicken(name, age);
Console.WriteLine(
"Chicken {0} (age {1}) can produce {2} eggs per day.",
chicken.Name,
chicken.Age,
chicken.ProductPerDay);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
| 23.466667 | 74 | 0.446023 | [
"MIT"
] | Mithras11/C_Sharp-OOP-SoftUni | EncapsulationEx/AnimalFarm/StartUp.cs | 706 | C# |
using System.Xml.Serialization;
namespace IFConverter.Base.Model.IFolor
{
[XmlRoot(ElementName = "VisibleRectOperation")]
public class VisibleRectOperation
{
[XmlAttribute(AttributeName = "x")]
public double X { get; set; }
[XmlAttribute(AttributeName = "y")]
public double Y { get; set; }
[XmlAttribute(AttributeName = "scaleFactor")]
public double ScaleFactor { get; set; }
[XmlAttribute(AttributeName = "levelingAngle")]
public double LevelingAngle { get; set; }
}
} | 29.052632 | 55 | 0.643116 | [
"MIT"
] | ChiefWiggum/IFConverter | IFConverter.Base/Model/IFolor/VisibleRectOperation.cs | 552 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectPooler : MonoBehaviour {
[System.Serializable]
public class Pool
{
public string tag;
public GameObject prefab;
public int size;
}
public static ObjectPooler instance;
public List<Pool> pools;
public Dictionary<string, Queue<GameObject>> poolDictionary;
void Awake()
{
if(instance != null)
{
Destroy(this.gameObject);
return;
}
instance = this;
poolDictionary = new Dictionary<string, Queue<GameObject>>();
foreach(Pool pool in pools)
{
Queue<GameObject> objectPool = new Queue<GameObject>();
for(int i = 0; i < pool.size; i++)
{
GameObject obj = Instantiate(pool.prefab);
obj.SetActive(false);
objectPool.Enqueue(obj);
}
poolDictionary.Add(pool.tag, objectPool);
}
}
public GameObject Spawn(string tag, Vector3 position, Quaternion rotation)
{
if(!poolDictionary.ContainsKey(tag))
{
Debug.LogWarning("Pool with tag " + tag + " doesn't exist.");
return null;
}
GameObject obj = poolDictionary[tag].Dequeue();
obj.transform.position = position;
obj.transform.rotation = rotation;
obj.SetActive(true);
IPooledObject[] pooledObject = obj.GetComponentsInChildren<IPooledObject>();
foreach(IPooledObject p in pooledObject)
p.OnObjectSpawned();
poolDictionary[tag].Enqueue(obj);
return obj;
}
public void Deactivate(GameObject go, float delay)
{
StartCoroutine(DelayedDeactivation(go, delay));
}
IEnumerator DelayedDeactivation(GameObject go, float delay)
{
yield return new WaitForSeconds(delay);
go.SetActive(false);
}
}
| 20.333333 | 78 | 0.711597 | [
"Apache-2.0"
] | Ahanabunozor/ld46 | Assets/Scripts/ObjectPooler.cs | 1,649 | C# |
using Volo.Abp.DependencyInjection;
namespace EShopOnAbp.Shared.Hosting.Microservices.DbMigrations
{
public abstract class PendingMigrationsCheckerBase : ITransientDependency
{
}
} | 24.25 | 77 | 0.798969 | [
"MIT"
] | Veribelll/eShopOnAbp | shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/PendingMigrationsCheckerBase.cs | 196 | C# |
using UnityEditor;
using UnityEngine;
namespace KeaneGames.AdvancedSceneSearch
{
public class SettingData
{
public string PrefsKey;
public string SettingName;
private const string SETTINGS_KEY = "KeaneSharedAdvancedSceneSearch";
private bool _state;
public SettingData(string settingName, string prefsKey, bool defaultValue)
{
SettingName = settingName;
PrefsKey = prefsKey;
_state = EditorPrefs.GetBool(SETTINGS_KEY + PrefsKey, defaultValue);
}
public bool State
{
get { return _state; }
set
{
EditorPrefs.SetBool(SETTINGS_KEY + PrefsKey, value);
_state = value;
}
}
public void DrawButton()
{
State = GUILayout.Toggle(State, SettingName, EditorStyles.miniButton);
}
}
} | 25.583333 | 82 | 0.58089 | [
"MIT"
] | KeaneGames/AdvancedSceneSearch | Editor/SettingData.cs | 923 | C# |
using UnityEngine;
namespace Foundation.Databinding
{
/// <summary>
/// Coroutine runner for Databinding to Coroutines
/// </summary>
public class ObservableHandler : MonoBehaviour
{
public static ObservableHandler Instance = new ObservableHandler();
static ObservableHandler()
{
var o = new GameObject("_ObservableHandler");
DontDestroyOnLoad(o);
Instance = o.AddComponent<ObservableHandler>();
}
}
}
| 24.8 | 75 | 0.631048 | [
"MIT"
] | MrNerverDie/Unity3d-Databinding-Mvvm-Mvc | Foundation.Databinding.Model/ObservableHandler.cs | 496 | C# |
using Microsoft.AspNetCore.Mvc;
namespace ExpenseReport.Web.Views.Shared.Components.FormModal
{
public class FormModalViewComponent : ViewComponent
{
public IViewComponentResult Invoke()
{
return View();
}
}
} | 21.583333 | 61 | 0.656371 | [
"MIT"
] | FlatFishPrincess/ExpenseReport | ExpenseReport.Web/Views/Shared/Components/FormModal/FormModalViewComponent.cs | 261 | C# |
namespace WhatIsHeDoing.Core.Tests.Extensions
{
using System;
using WhatIsHeDoing.Core.Extensions;
using Xunit;
public static class ObjectExtensionsTest
{
public class AsFluent
{
[Fact]
public void NullObject() => Assert.Throws<ArgumentNullException>(
() => ObjectExtensions.AsFluent<string>(null, DoSomething));
[Fact]
public void NullAction() => Assert.Throws<ArgumentNullException>(
() => 5.AsFluent(null));
[Fact]
public void Simple()
{
var obj = 5;
var value = 5;
const int newValue = 10;
var returned = 5.AsFluent(() => value = newValue);
Assert.Equal(obj, returned);
Assert.Equal(newValue, value);
}
[Fact]
public void ChainOldSkoolVoidSetter()
{
const int expected = 5;
var chainMe = new ChainMe();
var actual = chainMe
.AsFluent(() => chainMe.SetValue(expected))
.GetValue();
Assert.Equal(expected, actual);
}
internal void DoSomething()
{
}
internal class ChainMe
{
private int _value;
public int GetValue() => _value;
// return this; // Would have been useful!
public void SetValue(int value) => _value = value;
}
}
}
}
| 27.586207 | 77 | 0.473125 | [
"Unlicense"
] | WhatIsHeDoing/WhatIsHeDoing.Core | WhatIsHeDoing.Core.Tests/Extensions/ObjectExtensionsTest.cs | 1,600 | C# |
using UnityEngine;
using System;
using System.Collections;
using UnityEngine.Events;
namespace UltimateSpawner
{
/// <summary>
/// Represents a specific element in the enemies array of the enemy manager script.
/// Specifies which enemy prefab to use as well as how likley the enemy is to spawn based on a weighting value.
/// </summary>
[Serializable]
public class SpawnableInfo
{
// Public
/// <summary>
/// The prefab associated with this enenemy.
/// </summary>
[Tooltip("A reference to the prefab to spawn")]
public GameObject prefab;
/// <summary>
/// The chance value used to determine how likley the enemy is to spawn.
/// </summary>
[Range(0, 1)]
[Tooltip("How likley is the enemy to be spawned (The higher the value the more likley of spawning the enemy)")]
public float spawnChance = 0.5f;
}
}
| 31.2 | 119 | 0.634615 | [
"MIT"
] | H1NIVyrus/LOGARHYTHM | Assets/Tools/Ultimate Spawner/Scripts/Common/SpawnableInfo.cs | 938 | C# |
using System;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace EffectsDemo.Droid
{
[Activity (Label = "EffectsDemo.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
LoadApplication (new App ());
}
}
}
| 23.666667 | 164 | 0.757433 | [
"Apache-2.0"
] | Alshaikh-Abdalrahman/jedoo | Behaviors/EffectBehavior/Droid/MainActivity.cs | 641 | C# |
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace MAVN.Service.Credentials.MsSqlRepositories.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "credentials");
migrationBuilder.CreateTable(
name: "customer_credentials",
schema: "credentials",
columns: table => new
{
login = table.Column<string>(nullable: false),
customer_id = table.Column<string>(nullable: false),
salt = table.Column<string>(nullable: true),
hash = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_customer_credentials", x => x.login);
});
migrationBuilder.CreateTable(
name: "PasswordReset",
schema: "credentials",
columns: table => new
{
customer_id = table.Column<string>(nullable: false),
identifier = table.Column<string>(nullable: false),
created_at = table.Column<DateTime>(nullable: false),
expires_at = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PasswordReset", x => x.customer_id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "customer_credentials",
schema: "credentials");
migrationBuilder.DropTable(
name: "PasswordReset",
schema: "credentials");
}
}
}
| 35.125 | 78 | 0.514997 | [
"MIT"
] | IliyanIlievPH/MAVN.Service.Credentials | src/MAVN.Service.Credentials.MsSqlRepositories/Migrations/20190610122850_Initial.cs | 1,967 | C# |
#pragma warning disable 1587
#pragma warning disable 1591
#region Header
/**
* JsonWriter.cs
* Stream-like facility to output JSON text.
*
* The authors disclaim copyright to this source code. For more details, see
* the 3rd-Party-License.md file included with this distribution.
**/
// This file isn't generated, but this comment is necessary to exclude it from code analysis.
// <auto-generated/>
#endregion
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
namespace LitJson
{
internal enum Condition
{
InArray,
InObject,
NotAProperty,
Property,
Value
}
internal class WriterContext
{
public int Count;
public bool InArray;
public bool InObject;
public bool ExpectingValue;
public int Padding;
}
internal class JsonWriter
{
#region Fields
private static readonly NumberFormatInfo number_format;
private WriterContext context;
private Stack<WriterContext> ctx_stack;
private bool has_reached_end;
private char[] hex_seq;
private int indentation;
private int indent_value;
private StringBuilder inst_string_builder;
private bool pretty_print;
private bool validate;
private bool lower_case_properties;
private TextWriter writer;
#endregion
#region Properties
public int IndentValue {
get { return indent_value; }
set {
indentation = (indentation / indent_value) * value;
indent_value = value;
}
}
public bool PrettyPrint {
get { return pretty_print; }
set { pretty_print = value; }
}
public TextWriter TextWriter {
get { return writer; }
}
public bool Validate {
get { return validate; }
set { validate = value; }
}
public bool LowerCaseProperties {
get { return lower_case_properties; }
set { lower_case_properties = value; }
}
#endregion
#region Constructors
static JsonWriter ()
{
number_format = NumberFormatInfo.InvariantInfo;
}
public JsonWriter ()
{
inst_string_builder = new StringBuilder ();
writer = new StringWriter (inst_string_builder);
Init ();
}
public JsonWriter (StringBuilder sb) :
this (new StringWriter (sb))
{
}
public JsonWriter (TextWriter writer)
{
if (writer == null)
throw new ArgumentNullException ("writer");
this.writer = writer;
Init ();
}
#endregion
#region Private Methods
private void DoValidation (Condition cond)
{
if (! context.ExpectingValue)
context.Count++;
if (! validate)
return;
if (has_reached_end)
throw new JsonException (
"A complete JSON symbol has already been written");
switch (cond) {
case Condition.InArray:
if (! context.InArray)
throw new JsonException (
"Can't close an array here");
break;
case Condition.InObject:
if (! context.InObject || context.ExpectingValue)
throw new JsonException (
"Can't close an object here");
break;
case Condition.NotAProperty:
if (context.InObject && ! context.ExpectingValue)
throw new JsonException (
"Expected a property");
break;
case Condition.Property:
if (! context.InObject || context.ExpectingValue)
throw new JsonException (
"Can't add a property here");
break;
case Condition.Value:
if (! context.InArray &&
(! context.InObject || ! context.ExpectingValue))
throw new JsonException (
"Can't add a value here");
break;
}
}
private void Init ()
{
has_reached_end = false;
hex_seq = new char[4];
indentation = 0;
indent_value = 4;
pretty_print = false;
validate = true;
lower_case_properties = false;
ctx_stack = new Stack<WriterContext> ();
context = new WriterContext ();
ctx_stack.Push (context);
}
private static void IntToHex (int n, char[] hex)
{
int num;
for (int i = 0; i < 4; i++) {
num = n % 16;
if (num < 10)
hex[3 - i] = (char) ('0' + num);
else
hex[3 - i] = (char) ('A' + (num - 10));
n >>= 4;
}
}
private void Indent ()
{
if (pretty_print)
indentation += indent_value;
}
private void Put (string str)
{
if (pretty_print && ! context.ExpectingValue)
for (int i = 0; i < indentation; i++)
writer.Write (' ');
writer.Write (str);
}
private void PutNewline ()
{
PutNewline (true);
}
private void PutNewline (bool add_comma)
{
if (add_comma && ! context.ExpectingValue &&
context.Count > 1)
writer.Write (',');
if (pretty_print && ! context.ExpectingValue)
writer.Write (Environment.NewLine);
}
private void PutString (string str)
{
Put (String.Empty);
writer.Write ('"');
int n = str.Length;
for (int i = 0; i < n; i++) {
switch (str[i]) {
case '\n':
writer.Write ("\\n");
continue;
case '\r':
writer.Write ("\\r");
continue;
case '\t':
writer.Write ("\\t");
continue;
case '"':
case '\\':
writer.Write ('\\');
writer.Write (str[i]);
continue;
case '\f':
writer.Write ("\\f");
continue;
case '\b':
writer.Write ("\\b");
continue;
}
if ((int) str[i] >= 32 && (int) str[i] <= 126) {
writer.Write (str[i]);
continue;
}
// Default, turn into a \uXXXX sequence
IntToHex ((int) str[i], hex_seq);
writer.Write ("\\u");
writer.Write (hex_seq);
}
writer.Write ('"');
}
private void Unindent ()
{
if (pretty_print)
indentation -= indent_value;
}
#endregion
public override string ToString ()
{
if (inst_string_builder == null)
return String.Empty;
return inst_string_builder.ToString ();
}
public void Reset ()
{
has_reached_end = false;
ctx_stack.Clear ();
context = new WriterContext ();
ctx_stack.Push (context);
if (inst_string_builder != null)
inst_string_builder.Remove (0, inst_string_builder.Length);
}
public void Write (bool boolean)
{
DoValidation (Condition.Value);
PutNewline ();
Put (boolean ? "true" : "false");
context.ExpectingValue = false;
}
public void Write (decimal number)
{
DoValidation (Condition.Value);
PutNewline ();
Put (Convert.ToString (number, number_format));
context.ExpectingValue = false;
}
public void Write (double number)
{
DoValidation (Condition.Value);
PutNewline ();
string str = Convert.ToString (number, number_format);
Put (str);
if (str.IndexOf ('.') == -1 &&
str.IndexOf ('E') == -1)
writer.Write (".0");
context.ExpectingValue = false;
}
public void Write(float number)
{
DoValidation(Condition.Value);
PutNewline();
string str = Convert.ToString(number, number_format);
Put(str);
context.ExpectingValue = false;
}
public void Write (int number)
{
DoValidation (Condition.Value);
PutNewline ();
Put (Convert.ToString (number, number_format));
context.ExpectingValue = false;
}
public void Write (long number)
{
DoValidation (Condition.Value);
PutNewline ();
Put (Convert.ToString (number, number_format));
context.ExpectingValue = false;
}
public void Write (string str)
{
DoValidation (Condition.Value);
PutNewline ();
if (str == null)
Put ("null");
else
PutString (str);
context.ExpectingValue = false;
}
public void Write (ulong number)
{
DoValidation (Condition.Value);
PutNewline ();
Put (Convert.ToString (number, number_format));
context.ExpectingValue = false;
}
public void WriteArrayEnd ()
{
DoValidation (Condition.InArray);
PutNewline (false);
ctx_stack.Pop ();
if (ctx_stack.Count == 1)
has_reached_end = true;
else {
context = ctx_stack.Peek ();
context.ExpectingValue = false;
}
Unindent ();
Put ("]");
}
public void WriteArrayStart ()
{
DoValidation (Condition.NotAProperty);
PutNewline ();
Put ("[");
context = new WriterContext ();
context.InArray = true;
ctx_stack.Push (context);
Indent ();
}
public void WriteObjectEnd ()
{
DoValidation (Condition.InObject);
PutNewline (false);
ctx_stack.Pop ();
if (ctx_stack.Count == 1)
has_reached_end = true;
else {
context = ctx_stack.Peek ();
context.ExpectingValue = false;
}
Unindent ();
Put ("}");
}
public void WriteObjectStart ()
{
DoValidation (Condition.NotAProperty);
PutNewline ();
Put ("{");
context = new WriterContext ();
context.InObject = true;
ctx_stack.Push (context);
Indent ();
}
public void WritePropertyName (string property_name)
{
DoValidation (Condition.Property);
PutNewline ();
string propertyName = (property_name == null || !lower_case_properties)
? property_name
: property_name.ToLowerInvariant();
PutString (propertyName);
if (pretty_print) {
if (propertyName.Length > context.Padding)
context.Padding = propertyName.Length;
for (int i = context.Padding - propertyName.Length;
i >= 0; i--)
writer.Write (' ');
writer.Write (": ");
} else
writer.Write (':');
context.ExpectingValue = true;
}
}
}
| 25.528571 | 93 | 0.464546 | [
"Apache-2.0",
"Unlicense"
] | cake-contrib/Cake.Issues.Reporting.Generic | src/Cake.Issues.Reporting.Generic/LitJson/JsonWriter.cs | 12,509 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.