content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
// Copyright (c) 2015 SharpYaml - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// -------------------------------------------------------------------------------
// SharpYaml is a fork of YamlDotNet https://github.com/aaubry/YamlDotNet
// published with the following license:
// -------------------------------------------------------------------------------
//
// Copyright (c) 2008, 2009, 2010, 2011, 2012 Antoine Aubry
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
namespace Xenko.Core.Yaml
{
internal interface ILookAheadBuffer
{
/// <summary>
/// Gets a value indicating whether the end of the input reader has been reached.
/// </summary>
bool EndOfInput { get; }
/// <summary>
/// Gets the character at thhe specified offset.
/// </summary>
char Peek(int offset);
/// <summary>
/// Skips the next <paramref name="length"/> characters. Those characters must have been
/// obtained first by calling the <see cref="Peek"/> method.
/// </summary>
void Skip(int length);
}
} | 48.212121 | 96 | 0.684475 | [
"MIT"
] | Aminator/xenko | sources/core/Xenko.Core.Yaml/ILookAheadBuffer.cs | 3,182 | C# |
namespace Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110
{
using Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.PowerShell;
/// <summary>VMware Cbt specific policy details.</summary>
[System.ComponentModel.TypeConverter(typeof(VmwareCbtPolicyDetailsTypeConverter))]
public partial class VmwareCbtPolicyDetails
{
/// <summary>
/// <c>AfterDeserializeDictionary</c> will be called after the deserialization has finished, allowing customization of the
/// object before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
/// <summary>
/// <c>AfterDeserializePSObject</c> will be called after the deserialization has finished, allowing customization of the object
/// before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
/// <summary>
/// <c>BeforeDeserializeDictionary</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
/// <summary>
/// <c>BeforeDeserializePSObject</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VmwareCbtPolicyDetails"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetails" />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetails DeserializeFromDictionary(global::System.Collections.IDictionary content)
{
return new VmwareCbtPolicyDetails(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VmwareCbtPolicyDetails"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetails" />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
{
return new VmwareCbtPolicyDetails(content);
}
/// <summary>
/// Creates a new instance of <see cref="VmwareCbtPolicyDetails" />, deserializing the content from a json string.
/// </summary>
/// <param name="jsonText">a string containing a JSON serialized instance of this model.</param>
/// <returns>an instance of the <see cref="className" /> model class.</returns>
public static Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.Json.JsonNode.Parse(jsonText));
/// <summary>Serializes this instance to a json string.</summary>
/// <returns>a <see cref="System.String" /> containing this model serialized to JSON text.</returns>
public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Migrate.Runtime.SerializationMode.IncludeAll)?.ToString();
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VmwareCbtPolicyDetails"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
internal VmwareCbtPolicyDetails(global::System.Collections.IDictionary content)
{
bool returnNow = false;
BeforeDeserializeDictionary(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString);
AfterDeserializeDictionary(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.VmwareCbtPolicyDetails"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
internal VmwareCbtPolicyDetails(global::System.Management.Automation.PSObject content)
{
bool returnNow = false;
BeforeDeserializePSObject(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute = (int?) content.GetValueForProperty("AppConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).AppConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute = (int?) content.GetValueForProperty("CrashConsistentFrequencyInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).CrashConsistentFrequencyInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute = (int?) content.GetValueForProperty("RecoveryPointHistoryInMinute",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IVmwareCbtPolicyDetailsInternal)this).RecoveryPointHistoryInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int)));
((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IPolicyProviderSpecificDetailsInternal)this).InstanceType = (string) content.GetValueForProperty("InstanceType",((Microsoft.Azure.PowerShell.Cmdlets.Migrate.Models.Api20180110.IPolicyProviderSpecificDetailsInternal)this).InstanceType, global::System.Convert.ToString);
AfterDeserializePSObject(content);
}
}
/// VMware Cbt specific policy details.
[System.ComponentModel.TypeConverter(typeof(VmwareCbtPolicyDetailsTypeConverter))]
public partial interface IVmwareCbtPolicyDetails
{
}
} | 77.854015 | 423 | 0.721076 | [
"MIT"
] | Click4PV/azure-powershell | src/Migrate/generated/api/Models/Api20180110/VmwareCbtPolicyDetails.PowerShell.cs | 10,530 | C# |
/****************************************************************************
*项目名称:SAEA.WebSocket.Core
*CLR 版本:4.0.30319.42000
*机器名称:WENLI-PC
*命名空间:SAEA.WebSocket.Core
*类 名 称:WSServerImpl
*版 本 号:V1.0.0.0
*创建人: yswenli
*电子邮箱:wenguoli_520@qq.com
*创建时间:2019/6/13 15:37:28
*描述:
*=====================================================================
*修改时间:2019/6/13 15:37:28
*修 改 人: yswenli
*版 本 号: V1.0.0.0
*描 述:
*****************************************************************************/
using SAEA.Sockets;
using SAEA.WebSocket.Model;
using SAEA.WebSocket.Type;
using System;
using System.Collections.Generic;
namespace SAEA.WebSocket.Core
{
/// <summary>
/// websocket server,
/// iocp实现
/// </summary>
internal class WSServerImpl : IWSServer
{
IServerSokcet _server;
public event Action<string> OnConnected;
public event Action<string, WSProtocal> OnMessage;
public event Action<string> OnDisconnected;
public List<string> Clients { set; get; } = new List<string>();
/// <summary>
/// websocket server
/// </summary>
/// <param name="port"></param>
/// <param name="bufferSize"></param>
/// <param name="count"></param>
public WSServerImpl(int port = 16666, int bufferSize = 1024, int count = 60000)
{
var option = SocketOptionBuilder.Instance
.SetSocket()
.UseIocp(new WSContext())
.SetPort(port)
.SetReadBufferSize(bufferSize)
.SetWriteBufferSize(bufferSize)
.SetCount(count)
.Build();
_server = SocketFactory.CreateServerSocket(option);
_server.OnReceive += _server_OnReceive;
_server.OnDisconnected += _server_OnDisconnected;
}
private void _server_OnDisconnected(string id, Exception ex)
{
Clients.Remove(id);
OnDisconnected?.Invoke(id);
}
private void _server_OnReceive(object currentObj, byte[] data)
{
var ut = (WSUserToken)(currentObj);
if (!ut.IsHandSharked)
{
byte[] resData = null;
var result = ut.GetReplayHandShake(data, out resData);
if (result)
{
_server.SendAsync(ut.ID, resData);
ut.IsHandSharked = true;
Clients.Add(ut.ID);
OnConnected?.Invoke(ut.ID);
}
}
else
{
var coder = (WSCoder)ut.Unpacker;
coder.Unpack(data, (d) =>
{
var wsProtocal = (WSProtocal)d;
switch (wsProtocal.Type)
{
case (byte)WSProtocalType.Close:
ReplyClose(ut.ID, wsProtocal);
break;
case (byte)WSProtocalType.Ping:
ReplyPong(ut.ID, wsProtocal);
break;
case (byte)WSProtocalType.Binary:
case (byte)WSProtocalType.Text:
case (byte)WSProtocalType.Cont:
OnMessage?.Invoke(ut.ID, (WSProtocal)d);
break;
case (byte)WSProtocalType.Pong:
break;
default:
var error = string.Format("收到未定义的Opcode={0}", d.Type);
break;
}
}, (h) => { }, null);
}
}
private void ReplyBase(string id, WSProtocalType type, byte[] content)
{
var bs = new WSProtocal(type, content);
ReplyBase(id, bs);
}
private void ReplyBase(string id, WSProtocal data)
{
var bs = data.ToBytes(false);
_server.SendAsync(id, bs);
}
private void ReplyPong(string id, WSProtocal data)
{
ReplyBase(id, WSProtocalType.Pong, data.Content);
}
private void ReplyClose(string id, WSProtocal data)
{
ReplyBase(id, WSProtocalType.Close, data.Content);
}
/// <summary>
/// 回复客户端消息
/// </summary>
/// <param name="id"></param>
/// <param name="data"></param>
public void Reply(string id, WSProtocal data)
{
ReplyBase(id, data);
}
/// <summary>
/// 发送关闭
/// </summary>
/// <param name="id"></param>
/// <param name="data"></param>
public void Disconnect(string id, WSProtocal data)
{
ReplyBase(id, data);
_server.Disconnecte(id);
}
/// <summary>
/// 关闭
/// </summary>
/// <param name="id"></param>
public void Disconnect(string id)
{
_server.Disconnecte(id);
}
public void Start(int backlog = 10000)
{
_server.Start(backlog);
}
public void Stop()
{
_server.Stop();
}
}
}
| 28.12766 | 87 | 0.461044 | [
"Apache-2.0"
] | cty901/SAEA | Src/SAEA.WebSocket/Core/WSServerImpl.cs | 5,450 | C# |
using System;
namespace Task_3
{
class Program
{
static void Main()
{
Console.WriteLine("Введите размерность словаря:");
int n = Convert.ToInt32(Console.ReadLine()); //Запись значения полученного от пользователя конвертированного в Int
var dictionary = new MyDictionary<string, string>(n); //Создание переменной типа MyDictionary и закрытие типами string
for (int i = 0; i < n; i++)
{
dictionary.Add(i, "стол", "table"); //Вызов метода добавления новой записи в словарь
}
Console.WriteLine(new string('-', 20));
for (int i = 0; i < n; i++)
{
Console.WriteLine(dictionary[i]); //Отображение значений словаря
}
Console.WriteLine(dictionary[1]); //Отображение определенной записи словаря по указанному ключу
Console.WriteLine(dictionary.Lenght);
// Delay.
Console.ReadKey();
}
}
}
| 30.058824 | 130 | 0.565558 | [
"MIT"
] | 6e3veR6k/codewars-csharp | resources/csharp-essential-materials/HomeWork Answers/Lesson 10/Task 3/Program.cs | 1,266 | C# |
using UnityEngine;
public class Radar : SceneObject {
public Unit Unit { get; set; }
[SerializeField]
private int maximumDistance;
private bool searching = true;
public bool Searching {
get { return this.searching; }
set {
if (value && !this.GetComponent<Collider2D>().enabled) {
this.GetComponent<Collider2D>().enabled = true;
}
this.searching = value;
}
}
private void OnDetect(Collider2D collider) {
//if (this.unit.HasTrait (UnitTraitType.Attacker)) {
Transform parent = collider.transform.parent;
Unit targetUnit = parent.GetComponent<Unit>();
Vector2Int position = this.Unit.Tile.MapPosition;
Vector2Int targetPosition;
if (targetUnit == null) {
Building targetBuilding = parent.GetComponent<Building>();
targetPosition = targetBuilding.Tile.MapPosition;
if (position.EstimateDistance(targetPosition) < this.maximumDistance) {
this.Unit.Detect(targetBuilding);
}
} else {
if (targetUnit.IsDead() || this.Unit.IsDead()) {
return;
}
if (targetUnit.Tile == null) {
return;
}
targetPosition = targetUnit.Tile.MapPosition;
if (position.EstimateDistance(targetPosition) < this.maximumDistance) {
this.Unit.Detect(targetUnit);
}
}
//}
}
private void OnTriggerEnter2D(Collider2D other) {
Unit unit = other.GetComponent<Unit>();
if (unit != null && unit != this.Unit && !unit.Dead && !this.Unit.Dead) {
this.Unit.Attack(unit);
}
}
private void OnTriggerStay2D(Collider2D collider) {
if (this.Searching) {
this.OnDetect(collider);
}
}
public void SetEnabled(bool enabled) {
this.Collider.enabled = enabled;
}
}
| 27.328767 | 83 | 0.566917 | [
"MIT"
] | kyuuzou/warcraft | Assets/Root/Scripts/Units/Radar.cs | 1,995 | C# |
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ordering.Application.Features.Orders.Commands.CheckoutOrder
{
public class CheckoutOrderCommandValidator:AbstractValidator<CheckoutOrderCommand>
{
public CheckoutOrderCommandValidator()
{
RuleFor(p => p.UserName)
.NotEmpty().WithMessage("{UserName} should not be empty ")
.NotNull().WithMessage("{UserName} should not be null ")
.MaximumLength(50).WithMessage("{UserName} should not exceed a length of 15");
RuleFor(p => p.EmailAddress).NotEmpty().WithMessage("{EmailAddress} can be empty");
RuleFor(p => p.TotalPrice)
.NotEmpty().WithMessage("{TotalPrice} can be empty")
.GreaterThan(0).WithMessage("{TotalPrice} should be greated than zero");
}
}
}
| 34.214286 | 95 | 0.655532 | [
"MIT"
] | Ghost17954/MicroserviceNet5 | src/Services/Ordering/Ordering.Application/Features/Orders/Commands/CheckoutOrder/CheckoutOrderCommandValidator.cs | 960 | C# |
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using UnityEngine;
using System;
namespace HoloToolkit.Unity.Buttons
{
/// <summary>
/// Anim controller button offers as simple way to link button states to animation controller parameters
/// </summary>
[RequireComponent(typeof(CompoundButton))]
public class CompoundButtonAnim : MonoBehaviour
{
/// <summary>
/// List of animation actions
/// </summary>
[HideInInspector]
public AnimatorControllerAction[] AnimActions;
/// <summary>
/// Animator
/// </summary>
public Animator TargetAnimator;
private void Awake ()
{
GetComponent<Button>().StateChange += StateChange;
if (TargetAnimator == null)
{
TargetAnimator = GetComponent<Animator>();
}
}
/// <summary>
/// State change
/// </summary>
void StateChange(ButtonStateEnum newState)
{
if (TargetAnimator == null)
{
return;
}
if (AnimActions == null)
{
return;
}
for (int i = 0; i < AnimActions.Length; i++)
{
if (AnimActions[i].ButtonState == newState)
{
switch (AnimActions[i].ParamType)
{
case AnimatorControllerParameterType.Bool:
TargetAnimator.SetBool(AnimActions[i].ParamName, AnimActions[i].BoolValue);
break;
case AnimatorControllerParameterType.Float:
TargetAnimator.SetFloat(AnimActions[i].ParamName, AnimActions[i].FloatValue);
break;
case AnimatorControllerParameterType.Int:
TargetAnimator.SetInteger(AnimActions[i].ParamName, AnimActions[i].IntValue);
break;
case AnimatorControllerParameterType.Trigger:
TargetAnimator.SetTrigger(AnimActions[i].ParamName);
break;
default:
throw new ArgumentOutOfRangeException();
}
break;
}
}
}
}
} | 31.580247 | 108 | 0.497263 | [
"MIT"
] | mtaulty/FutureDecoded2017 | Session2_Developing/OrigamiAnimalsDemo/Assets/HoloToolkit/UX/Scripts/Buttons/CompoundButtonAnim.cs | 2,558 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Northwind.Data
{
using System;
using System.Collections.Generic;
public partial class Supplier
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Supplier()
{
this.Products = new HashSet<Product>();
}
public int SupplierID { get; set; }
public string CompanyName { get; set; }
public string ContactName { get; set; }
public string ContactTitle { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Region { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string HomePage { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Product> Products { get; set; }
}
}
| 38.075 | 128 | 0.574524 | [
"MIT"
] | KaloyanchoSt/Telerik-Academy-HW | 2. Web Design and UI technologies/7. Databases/11. Entity-Framework/Northwind.Data/Supplier.cs | 1,523 | C# |
using MyNUnitLib;
using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
using TestAttribute = NUnit.Framework.TestAttribute;
namespace Tests
{
[TestFixture]
public class MyNUnitTests
{
private List<TestInfo> TestsResults;
private List<string> expectedResultsMethods;
private const string path = "..\\..\\..\\..\\Test1";
[SetUp]
public void Setup()
{
TestsResults = new List<TestInfo>();
expectedResultsMethods = new List<string>();
expectedResultsMethods.Add("SuccessfulMethod");
expectedResultsMethods.Add("IgnoreMethod");
expectedResultsMethods.Add("IgnoreMethodThrowingException");
expectedResultsMethods.Add("ExpectedExceptionThrown");
expectedResultsMethods.Add("ExceptionOnFail");
expectedResultsMethods.Add("UnexpectedExceptionThrown");
}
[Test]
public void CorrectMethodsAreTestedTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var names = new List<string>();
foreach (var res in TestsResults)
{
names.Add(res.MethodName);
}
Assert.AreEqual(names.Intersect(expectedResultsMethods).Count(), expectedResultsMethods.Count);
}
[Test]
public void RegularTestPassedTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var successInfo = TestsResults.Find(i => i.MethodName == "SuccessfulMethod");
Assert.IsTrue(successInfo.IsSuccessful);
}
[Test]
public void IgnoreTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var ignoreInfo = TestsResults.Find(i => i.MethodName == "IgnoreMethod");
var exceptionIgnoreInfo = TestsResults.Find(i => i.MethodName == "IgnoreMethodThrowingException");
Assert.IsTrue(ignoreInfo.IsIgnored);
Assert.AreEqual("Some reason to ignore this test.", ignoreInfo.ReasonToIgnore);
Assert.IsTrue(exceptionIgnoreInfo.IsIgnored);
}
[Test]
public void ExpectedExceptionTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var expectedInfo = TestsResults.Find(i => i.MethodName == "ExpectedExceptionThrown");
Assert.AreEqual(expectedInfo.ExpectedException, expectedInfo.ActualException);
Assert.IsTrue(expectedInfo.IsSuccessful);
}
[Test]
public void FailExceptionTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var failInfo = TestsResults.Find(i => i.MethodName == "ExceptionOnFail");
Assert.IsNull(failInfo.ExpectedException);
Assert.IsNotNull(failInfo.ActualException);
Assert.IsFalse(failInfo.IsSuccessful);
}
[Test]
public void UnexpectedExceptionTest()
{
var resultsTestPath = path;
var regularTestsReport = MyNUnit.RunTestsAndGetReport(resultsTestPath);
foreach (var list in regularTestsReport.Values)
{
foreach (var info in list)
{
TestsResults.Add(info);
}
}
var exceptionInfo = TestsResults.Find(i => i.MethodName == "UnexpectedExceptionThrown");
Assert.AreNotEqual(exceptionInfo.ActualException, exceptionInfo.ExpectedException);
Assert.IsFalse(exceptionInfo.IsSuccessful);
}
}
}
| 31.055901 | 110 | 0.5668 | [
"MIT"
] | Inzilbeth/SPbU3 | Homework5/Task1/Task1Tests/MyNUnitTests.cs | 5,000 | C# |
using CourseLibrary.API.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace CourseLibrary.API.Helpers
{
public static class IQueryableExtensions
{
public static IQueryable<T> ApplySort<T>(this IQueryable<T> source, string orderBy,
Dictionary<string, PropertyMappingValue> mappingDictionary)
{
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
if (mappingDictionary == null)
{
throw new ArgumentNullException(nameof(mappingDictionary));
}
if (string.IsNullOrWhiteSpace(orderBy))
{
return source;
}
var orderByString = string.Empty;
// the orderBy string is separated by ",", so we split it.
var orderByAfterSplit = orderBy.Split(',');
// apply each orderby clause
foreach (var orderByClause in orderByAfterSplit)
{
// trim the orderBy clause, as it might contain leading
// or trailing spaces. Can't trim the var in foreach,
// so use another var.
var trimmedOrderByClause = orderByClause.Trim();
// if the sort option ends with with " desc", we order
// descending, ortherwise ascending
var orderDescending = trimmedOrderByClause.EndsWith(" desc");
// remove " asc" or " desc" from the orderBy clause, so we
// get the property name to look for in the mapping dictionary
var indexOfFirstSpace = trimmedOrderByClause.IndexOf(" ");
var propertyName = indexOfFirstSpace == -1 ?
trimmedOrderByClause : trimmedOrderByClause.Remove(indexOfFirstSpace);
// find the matching property
if (!mappingDictionary.ContainsKey(propertyName))
{
throw new ArgumentException($"Key mapping for {propertyName} is missing");
}
// get the PropertyMappingValue
var propertyMappingValue = mappingDictionary[propertyName];
if (propertyMappingValue == null)
{
throw new ArgumentNullException("propertyMappingValue");
}
// Run through the property names
// so the orderby clauses are applied in the correct order
foreach (var destinationProperty in
propertyMappingValue.DestinationProperties)
{
// revert sort order if necessary
if (propertyMappingValue.Revert)
{
orderDescending = !orderDescending;
}
orderByString = orderByString +
(string.IsNullOrWhiteSpace(orderByString) ? string.Empty : ", ")
+ destinationProperty
+ (orderDescending ? " descending" : " ascending");
}
}
return source.OrderBy(orderByString);
}
}
}
| 37.494382 | 96 | 0.542104 | [
"MIT"
] | Battler45/ImplementingAdvancedRESTfulConcernsAspNetCore3 | Finished sample/CourseLibrary/CourseLibrary.API/Helpers/IQueryableExtensions.cs | 3,339 | C# |
/*
* Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
extern alias TizenSystemSettings;
using TizenSystemSettings.Tizen.System;
using System;
using System.Globalization;
using System.ComponentModel;
using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
/// <summary>
/// A control which provides a single line editable text field.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public partial class TextField : View
{
private string textFieldTextSid = null;
private string textFieldPlaceHolderTextSid = null;
private string textFieldPlaceHolderTextFocusedSid = null;
private bool systemlangTextFlag = false;
private InputMethodContext inputMethodCotext = null;
private float fontSizeScale = 1.0f;
private bool hasFontSizeChangedCallback = false;
static TextField() { }
/// <summary>
/// Creates the TextField control.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public TextField() : this(Interop.TextField.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Creates the TextField with setting the status of shown or hidden.
/// </summary>
/// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
/// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
[EditorBrowsable(EditorBrowsableState.Never)]
public TextField(bool shown) : this(Interop.TextField.New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
/// <summary>
/// Get attributes, it is abstract function and must be override.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
protected override ViewStyle CreateViewStyle()
{
return new TextFieldStyle();
}
internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(cPtr, cMemoryOwn, viewStyle)
{
if (!shown)
{
SetVisible(false);
}
}
internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn, null)
{
if (!shown)
{
SetVisible(false);
}
}
internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.NewTextField(TextField.getCPtr(handle)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (!shown)
{
SetVisible(false);
}
}
internal enum ExceedPolicyType
{
ExceedPolicyOriginal,
ExceedPolicyClip
}
/// <summary>
/// The TranslatableText property.<br />
/// The text can set the SID value.<br />
/// </summary>
/// <exception cref='ArgumentNullException'>
/// ResourceManager about multilingual is null.
/// </exception>
/// <since_tizen> 4 </since_tizen>
public string TranslatableText
{
get
{
return (string)GetValue(TranslatableTextProperty);
}
set
{
SetValue(TranslatableTextProperty, value);
}
}
private string translatableText
{
get
{
return textFieldTextSid;
}
set
{
if (NUIApplication.MultilingualResourceManager == null)
{
throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
}
textFieldTextSid = value;
Text = SetTranslatable(textFieldTextSid);
NotifyPropertyChanged();
}
}
/// <summary>
/// The TranslatablePlaceholderText property.<br />
/// The text can set the SID value.<br />
/// </summary>
/// <exception cref='ArgumentNullException'>
/// ResourceManager about multilingual is null.
/// </exception>
/// <since_tizen> 4 </since_tizen>
public string TranslatablePlaceholderText
{
get
{
return (string)GetValue(TranslatablePlaceholderTextProperty);
}
set
{
SetValue(TranslatablePlaceholderTextProperty, value);
}
}
private string translatablePlaceholderText
{
get
{
return textFieldPlaceHolderTextSid;
}
set
{
if (NUIApplication.MultilingualResourceManager == null)
{
throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
}
textFieldPlaceHolderTextSid = value;
PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
NotifyPropertyChanged();
}
}
/// <summary>
/// The TranslatablePlaceholderTextFocused property.<br />
/// The text can set the SID value.<br />
/// </summary>
/// <exception cref='ArgumentNullException'>
/// ResourceManager about multilingual is null.
/// </exception>
/// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string TranslatablePlaceholderTextFocused
{
get
{
return (string)GetValue(TranslatablePlaceholderTextFocusedProperty);
}
set
{
SetValue(TranslatablePlaceholderTextFocusedProperty, value);
}
}
private string translatablePlaceholderTextFocused
{
get
{
return textFieldPlaceHolderTextFocusedSid;
}
set
{
if (NUIApplication.MultilingualResourceManager == null)
{
throw new ArgumentNullException(null, "ResourceManager about multilingual is null");
}
textFieldPlaceHolderTextFocusedSid = value;
PlaceholderTextFocused = SetTranslatable(textFieldPlaceHolderTextFocusedSid);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Text property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string Text
{
get
{
return (string)GetValue(TextProperty);
}
set
{
SetValueAndForceSendChangeSignal(TextProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PlaceholderText property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string PlaceholderText
{
get
{
return (string)GetValue(PlaceholderTextProperty);
}
set
{
SetValue(PlaceholderTextProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PlaceholderTextFocused property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string PlaceholderTextFocused
{
get
{
return (string)GetValue(PlaceholderTextFocusedProperty);
}
set
{
SetValue(PlaceholderTextFocusedProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The FontFamily property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string FontFamily
{
get
{
return (string)GetValue(FontFamilyProperty);
}
set
{
SetValue(FontFamilyProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The FontStyle property.
/// The fontStyle map contains the following keys :<br />
/// <list type="table">
/// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
/// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
/// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap FontStyle
{
get
{
return (PropertyMap)GetValue(FontStyleProperty);
}
set
{
SetValue(FontStyleProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PointSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float PointSize
{
get
{
return (float)GetValue(PointSizeProperty);
}
set
{
SetValue(PointSizeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The MaxLength property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int MaxLength
{
get
{
return (int)GetValue(MaxLengthProperty);
}
set
{
SetValue(MaxLengthProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ExceedPolicy property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int ExceedPolicy
{
get
{
return (int)GetValue(ExceedPolicyProperty);
}
set
{
SetValue(ExceedPolicyProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The HorizontalAlignment property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public HorizontalAlignment HorizontalAlignment
{
get
{
return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
}
set
{
SetValue(HorizontalAlignmentProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The VerticalAlignment property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public VerticalAlignment VerticalAlignment
{
get
{
return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
}
set
{
SetValue(VerticalAlignmentProperty, value);
NotifyPropertyChanged();
NotifyPropertyChanged();
}
}
/// <summary>
/// The TextColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Color TextColor
{
get
{
Color temp = (Color)GetValue(TextColorProperty);
return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
}
set
{
SetValue(TextColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PlaceholderTextColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Vector4 PlaceholderTextColor
{
get
{
Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(PlaceholderTextColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ShadowOffset property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <remarks>
/// Deprecated.(API Level 6) Use Shadow instead.
/// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
/// </remarks>
[Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
public Vector2 ShadowOffset
{
get
{
PropertyMap map = new PropertyMap();
GetProperty(TextField.Property.SHADOW).Get(map);
Vector2 shadowOffset = new Vector2();
map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
}
set
{
PropertyMap temp = new PropertyMap();
temp.Insert("offset", new PropertyValue(value));
SetValue(ShadowProperty, temp);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ShadowColor property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
/// <remarks>
/// Deprecated.(API Level 6) Use Shadow instead.
/// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
/// </remarks>
[Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
public Vector4 ShadowColor
{
get
{
PropertyMap map = new PropertyMap();
GetProperty(TextField.Property.SHADOW).Get(map);
Vector4 shadowColor = new Vector4();
map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
}
set
{
PropertyMap temp = new PropertyMap();
temp.Insert("color", new PropertyValue(value));
SetValue(ShadowProperty, temp);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PrimaryCursorColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Vector4 PrimaryCursorColor
{
get
{
Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(PrimaryCursorColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SecondaryCursorColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Vector4 SecondaryCursorColor
{
get
{
Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(SecondaryCursorColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The EnableCursorBlink property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool EnableCursorBlink
{
get
{
return (bool)GetValue(EnableCursorBlinkProperty);
}
set
{
SetValue(EnableCursorBlinkProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The CursorBlinkInterval property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float CursorBlinkInterval
{
get
{
return (float)GetValue(CursorBlinkIntervalProperty);
}
set
{
SetValue(CursorBlinkIntervalProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The CursorBlinkDuration property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float CursorBlinkDuration
{
get
{
return (float)GetValue(CursorBlinkDurationProperty);
}
set
{
SetValue(CursorBlinkDurationProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The CursorWidth property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public int CursorWidth
{
get
{
return (int)GetValue(CursorWidthProperty);
}
set
{
SetValue(CursorWidthProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The GrabHandleImage property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string GrabHandleImage
{
get
{
return (string)GetValue(GrabHandleImageProperty);
}
set
{
SetValue(GrabHandleImageProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The GrabHandlePressedImage property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string GrabHandlePressedImage
{
get
{
return (string)GetValue(GrabHandlePressedImageProperty);
}
set
{
SetValue(GrabHandlePressedImageProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ScrollThreshold property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float ScrollThreshold
{
get
{
return (float)GetValue(ScrollThresholdProperty);
}
set
{
SetValue(ScrollThresholdProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ScrollSpeed property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float ScrollSpeed
{
get
{
return (float)GetValue(ScrollSpeedProperty);
}
set
{
SetValue(ScrollSpeedProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandleImageLeft property.
/// The selectionHandleImageLeft map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
}
set
{
SetValue(SelectionHandleImageLeftProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandleImageRight property.
/// The selectionHandleImageRight map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
}
set
{
SetValue(SelectionHandleImageRightProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandlePressedImageLeft property.
/// The selectionHandlePressedImageLeft map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandlePressedImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
}
set
{
SetValue(SelectionHandlePressedImageLeftProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandlePressedImageRight property.
/// The selectionHandlePressedImageRight map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandlePressedImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
}
set
{
SetValue(SelectionHandlePressedImageRightProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandleMarkerImageLeft property.
/// The selectionHandleMarkerImageLeft map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleMarkerImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
}
set
{
SetValue(SelectionHandleMarkerImageLeftProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHandleMarkerImageRight property.
/// The selectionHandleMarkerImageRight map contains the following key :<br />
/// <list type="table">
/// <item><term>filename (string)</term><description>The path of image file</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap SelectionHandleMarkerImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
}
set
{
SetValue(SelectionHandleMarkerImageRightProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The SelectionHighlightColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Vector4 SelectionHighlightColor
{
get
{
Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(SelectionHighlightColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The DecorationBoundingBox property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Rectangle DecorationBoundingBox
{
get
{
Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
}
set
{
SetValue(DecorationBoundingBoxProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputMethodSettings property.
/// </summary>
/// <remarks>
/// <see cref="InputMethod"/> is a class encapsulating the input method map. Please use the <see cref="InputMethod"/> class for this property.
/// </remarks>
/// <example>
/// The following example demonstrates how to set the InputMethodSettings property.
/// <code>
/// InputMethod method = new InputMethod();
/// method.PanelLayout = InputMethod.PanelLayoutType.Normal;
/// method.ActionButton = InputMethod.ActionButtonTitleType.Default;
/// method.AutoCapital = InputMethod.AutoCapitalType.Word;
/// method.Variation = 1;
/// textField.InputMethodSettings = method.OutputMap;
/// </code>
/// </example>
/// <since_tizen> 3 </since_tizen>
public PropertyMap InputMethodSettings
{
get
{
return (PropertyMap)GetValue(InputMethodSettingsProperty);
}
set
{
SetValue(InputMethodSettingsProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public Vector4 InputColor
{
get
{
Vector4 temp = (Vector4)GetValue(InputColorProperty);
return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(InputColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The EnableMarkup property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool EnableMarkup
{
get
{
return (bool)GetValue(EnableMarkupProperty);
}
set
{
SetValue(EnableMarkupProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputFontFamily property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string InputFontFamily
{
get
{
return (string)GetValue(InputFontFamilyProperty);
}
set
{
SetValue(InputFontFamilyProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputFontStyle property.
/// The inputFontStyle map contains the following keys :<br />
/// <list type="table">
/// <item><term>width (string)</term><description>The width key defines occupied by each glyph. (values: ultraCondensed, extraCondensed, condensed, semiCondensed, normal, semiExpanded, expanded, extraExpanded, ultraExpanded)</description></item>
/// <item><term>weight (string)</term><description>The weight key defines the thickness or darkness of the glyphs. (values: thin, ultraLight, extraLight, light, demiLight, semiLight, book, normal, regular, medium, demiBold, semiBold, bold, ultraBold, extraBold, black, heavy, extraBlack)</description></item>
/// <item><term>slant (string)</term><description>The slant key defines whether to use italics. (values: normal, roman, italic, oblique)</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap InputFontStyle
{
get
{
return (PropertyMap)GetValue(InputFontStyleProperty);
}
set
{
SetValue(InputFontStyleProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputPointSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float InputPointSize
{
get
{
return (float)GetValue(InputPointSizeProperty);
}
set
{
SetValue(InputPointSizeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Underline property.
/// The underline map contains the following keys :<br />
/// <list type="table">
/// <item><term>enable (bool)</term><description>Whether the underline is enabled (the default value is false)</description></item>
/// <item><term>color (Color)</term><description>The color of the underline (If not provided then the color of the text is used)</description></item>
/// <item><term>height (float)</term><description>The height in pixels of the underline (the default value is 1.f)</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap Underline
{
get
{
return (PropertyMap)GetValue(UnderlineProperty);
}
set
{
SetValue(UnderlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputUnderline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string InputUnderline
{
get
{
return (string)GetValue(InputUnderlineProperty);
}
set
{
SetValue(InputUnderlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Shadow property.
/// The shadow map contains the following keys :<br />
/// <list type="table">
/// <item><term>color (Color)</term><description>The color of the shadow (the default color is Color.Black)</description></item>
/// <item><term>offset (Vector2)</term><description>The offset in pixels of the shadow (If not provided then the shadow is not enabled)</description></item>
/// <item><term>blurRadius (float)</term><description>The radius of the Gaussian blur for the soft shadow (If not provided then the soft shadow is not enabled)</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap Shadow
{
get
{
return (PropertyMap)GetValue(ShadowProperty);
}
set
{
SetValue(ShadowProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputShadow property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string InputShadow
{
get
{
return (string)GetValue(InputShadowProperty);
}
set
{
SetValue(InputShadowProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Emboss property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string Emboss
{
get
{
return (string)GetValue(EmbossProperty);
}
set
{
SetValue(EmbossProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputEmboss property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string InputEmboss
{
get
{
return (string)GetValue(InputEmbossProperty);
}
set
{
SetValue(InputEmbossProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Outline property.
/// The outline map contains the following keys :<br />
/// <list type="table">
/// <item><term>color (Color)</term><description>The color of the outline (the default color is Color.White)</description></item>
/// <item><term>width (float)</term><description>The width in pixels of the outline (If not provided then the outline is not enabled)</description></item>
/// </list>
/// </summary>
/// <since_tizen> 3 </since_tizen>
public PropertyMap Outline
{
get
{
return (PropertyMap)GetValue(OutlineProperty);
}
set
{
SetValue(OutlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The InputOutline property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public string InputOutline
{
get
{
return (string)GetValue(InputOutlineProperty);
}
set
{
SetValue(InputOutlineProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The HiddenInputSettings property.
/// The hiddenInputSettings map contains the following keys :<br />
/// <list type="table">
/// <item><term>HiddenInputProperty.Mode (int)</term><description>The mode for input text display (Use HiddenInputModeType)</description></item>
/// <item><term>HiddenInputProperty.SubstituteCharacter (int)</term><description>All input characters are substituted by this character</description></item>
/// <item><term>HiddenInputProperty.SubstituteCount (int)</term><description>Length of text to show or hide, available when HideCount/ShowCount mode is used</description></item>
/// <item><term>HiddenInputProperty.ShowLastCharacterDuration (int)</term><description>Hide last character after this duration, available when ShowLastCharacter mode</description></item>
/// </list>
/// </summary>
/// <remarks>
/// See <see cref="HiddenInputProperty"/> and <see cref="HiddenInputModeType"/> for a detailed description.
/// </remarks>
/// <example>
/// The following example demonstrates how to set the HiddenInputSettings property.
/// <code>
/// PropertyMap map = new PropertyMap();
/// map.Add(HiddenInputProperty.Mode, new PropertyValue((int)HiddenInputModeType.ShowLastCharacter));
/// map.Add(HiddenInputProperty.ShowLastCharacterDuration, new PropertyValue(500));
/// map.Add(HiddenInputProperty.SubstituteCharacter, new PropertyValue(0x2A));
/// textField.HiddenInputSettings = map;
/// </code>
/// </example>
/// <since_tizen> 3 </since_tizen>
public Tizen.NUI.PropertyMap HiddenInputSettings
{
get
{
return (PropertyMap)GetValue(HiddenInputSettingsProperty);
}
set
{
SetValue(HiddenInputSettingsProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The PixelSize property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public float PixelSize
{
get
{
return (float)GetValue(PixelSizeProperty);
}
set
{
SetValue(PixelSizeProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Enable selection property.
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool EnableSelection
{
get
{
return (bool)GetValue(EnableSelectionProperty);
}
set
{
SetValue(EnableSelectionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Enable selection property.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableGrabHandle
{
get
{
return (bool)GetValue(EnableGrabHandleProperty);
}
set
{
SetValue(EnableGrabHandleProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Enable selection property.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableGrabHandlePopup
{
get
{
return (bool)GetValue(EnableGrabHandlePopupProperty);
}
set
{
SetValue(EnableGrabHandlePopupProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Selected Text property.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string SelectedText
{
get
{
string temp;
GetProperty(TextField.Property.SelectedText).Get(out temp);
return temp;
}
}
/// <summary>
/// The start index for selection.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public int SelectedTextStart
{
get
{
int temp;
GetProperty(TextField.Property.SelectedTextStart).Get(out temp);
return temp;
}
set
{
SetProperty(TextField.Property.SelectedTextStart, new PropertyValue(value));
NotifyPropertyChanged();
}
}
/// <summary>
/// The end index for selection.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public int SelectedTextEnd
{
get
{
int temp;
GetProperty(TextField.Property.SelectedTextEnd).Get(out temp);
return temp;
}
set
{
SetProperty(TextField.Property.SelectedTextEnd, new PropertyValue(value));
NotifyPropertyChanged();
}
}
/// <summary>
/// Enable editing in text control.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableEditing
{
get
{
bool temp;
GetProperty(TextField.Property.EnableEditing).Get(out temp);
return temp;
}
set
{
SetProperty(TextField.Property.EnableEditing, new PropertyValue(value));
NotifyPropertyChanged();
}
}
/// <summary>
/// Specify primary cursor (caret) position in text control.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public int PrimaryCursorPosition
{
get
{
int temp;
using (PropertyValue propertyValue = GetProperty(TextField.Property.PrimaryCursorPosition))
{
propertyValue.Get(out temp);
}
return temp;
}
set
{
using (PropertyValue propertyValue = new PropertyValue(value))
{
SetProperty(TextField.Property.PrimaryCursorPosition, propertyValue);
NotifyPropertyChanged();
}
}
}
/// <summary>
/// The GrabHandleColor property.
/// </summary>
/// <remarks>
/// The property cascade chaining set is possible. For example, this (textField.GrabHandleColor.X = 0.1f;) is possible.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
public Color GrabHandleColor
{
get
{
Color temp = (Color)GetValue(GrabHandleColorProperty);
return new Color(OnGrabHandleColorChanged, temp.R, temp.G, temp.B, temp.A);
}
set
{
SetValue(GrabHandleColorProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The ellipsis position of the text.
/// The ellipsis position type when the text size over the layout size.<br />
/// The ellipsis position: End, Start or Middle.<br />
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public EllipsisPosition EllipsisPosition
{
get
{
return (EllipsisPosition)GetValue(EllipsisPositionProperty);
}
set
{
SetValue(EllipsisPositionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Placeholder property.
/// The placeholder map contains the following keys :<br />
/// <list type="table">
/// <item><term>text (string)</term><description>The text to display when the TextField is empty and inactive</description></item>
/// <item><term>textFocused (string)</term><description>The text to display when the placeholder has focus</description></item>
/// <item><term>color (Color)</term><description>The color of the placeholder text</description></item>
/// <item><term>fontFamily (string)</term><description>The fontFamily of the placeholder text</description></item>
/// <item><term>fontStyle (PropertyMap)</term><description>The fontStyle of the placeholder text</description></item>
/// <item><term>pointSize (float)</term><description>The pointSize of the placeholder text</description></item>
/// <item><term>pixelSize (float)</term><description>The pixelSize of the placeholder text</description></item>
/// <item><term>ellipsis (bool)</term><description>The ellipsis of the placeholder text</description></item>
/// </list>
/// </summary>
/// <example>
/// The following example demonstrates how to set the Placeholder property.
/// <code>
/// PropertyMap propertyMap = new PropertyMap();
/// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
/// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
/// propertyMap.Add("color", new PropertyValue(Color.Red));
/// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
/// propertyMap.Add("pointSize", new PropertyValue(12.0f));
///
/// PropertyMap fontStyleMap = new PropertyMap();
/// fontStyleMap.Add("weight", new PropertyValue("bold"));
/// fontStyleMap.Add("width", new PropertyValue("condensed"));
/// fontStyleMap.Add("slant", new PropertyValue("italic"));
/// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
///
/// TextField field = new TextField();
/// field.Placeholder = propertyMap;
/// </code>
/// </example>
/// <since_tizen> 3 </since_tizen>
public Tizen.NUI.PropertyMap Placeholder
{
get
{
PropertyMap map = (PropertyMap)GetValue(PlaceholderProperty);
PropertyValue value = null;
// text
value = map.Find(0);
if (null != value)
{
value.Get(out string text);
map.Add("text", new PropertyValue(text));
}
// textFocused
value = map.Find(1);
if (null != value)
{
value.Get(out string textFocused);
map.Add("textFocused", new PropertyValue(textFocused));
}
// color
value = map.Find(2);
if (null != value)
{
Color color = new Color();
value.Get(color);
map.Add("color", new PropertyValue(color));
}
// fontFamily
value = map.Find(3);
if (null != value)
{
value.Get(out string fontFamily);
map.Add("fontFamily", new PropertyValue(fontFamily));
}
// fontStyle
value = map.Find(4);
if (null != value)
{
PropertyMap fontStyle = new PropertyMap();
value.Get(fontStyle);
map.Add("fontStyle", new PropertyValue(fontStyle));
}
// pointSize
value = map.Find(5);
if (null != value)
{
value.Get(out float pointSize);
map.Add("pointSize", new PropertyValue(pointSize));
}
// pixelSize
value = map.Find(6);
if (null != value)
{
value.Get(out float pixelSize);
map.Add("pixelSize", new PropertyValue(pixelSize));
}
// ellipsis
value = map.Find(7);
if (null != value)
{
value.Get(out bool ellipsis);
map.Add("ellipsis", new PropertyValue(ellipsis));
}
return map;
}
set
{
SetValue(PlaceholderProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The Ellipsis property.<br />
/// Enable or disable the ellipsis.<br />
/// Placeholder PropertyMap is used to add ellipsis to placeholder text.
/// </summary>
/// <since_tizen> 4 </since_tizen>
public bool Ellipsis
{
get
{
return (bool)GetValue(EllipsisProperty);
}
set
{
SetValue(EllipsisProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// Enables selection of the text using the Shift key.
/// </summary>
/// <since_tizen> 5 </since_tizen>
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableShiftSelection
{
get
{
return (bool)GetValue(EnableShiftSelectionProperty);
}
set
{
SetValue(EnableShiftSelectionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The text alignment to match the direction of the system language.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public bool MatchSystemLanguageDirection
{
get
{
return (bool)GetValue(MatchSystemLanguageDirectionProperty);
}
set
{
SetValue(MatchSystemLanguageDirectionProperty, value);
NotifyPropertyChanged();
}
}
/// <summary>
/// The FontSizeScale property. <br />
/// The default value is 1.0. <br />
/// If FontSizeScale.UseSystemSetting, will use the SystemSettings.FontSize internally. <br />
/// </summary>
/// <since_tizen> 9 </since_tizen>
public float FontSizeScale
{
get
{
return fontSizeScale;
}
set
{
float newFontSizeScale;
if (fontSizeScale == value) return;
fontSizeScale = value;
if (fontSizeScale == Tizen.NUI.FontSizeScale.UseSystemSetting)
{
SystemSettingsFontSize systemSettingsFontSize;
try
{
systemSettingsFontSize = SystemSettings.FontSize;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
systemSettingsFontSize = SystemSettingsFontSize.Normal;
}
newFontSizeScale = TextUtils.GetFontSizeScale(systemSettingsFontSize);
addFontSizeChangedCallback();
}
else
{
newFontSizeScale = fontSizeScale;
removeFontSizeChangedCallback();
}
SetValue(FontSizeScaleProperty, newFontSizeScale);
NotifyPropertyChanged();
}
}
/// Only used by the IL of xaml, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool IsCreateByXaml
{
get
{
return base.IsCreateByXaml;
}
set
{
base.IsCreateByXaml = value;
if (value == true)
{
this.TextChanged += (obj, e) =>
{
this.Text = e.TextField.Text;
};
}
}
}
/// <summary>
/// Get the InputMethodContext instance.
/// </summary>
/// <returns>The InputMethodContext instance.</returns>
/// <since_tizen> 5 </since_tizen>
public InputMethodContext GetInputMethodContext()
{
if (inputMethodCotext == null)
{
/*Avoid raising InputMethodContext reference count.*/
inputMethodCotext = new InputMethodContext(Interop.TextField.GetInputMethodContext(SwigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
return inputMethodCotext;
}
/// <summary>
/// Select the whole text.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SelectWholeText()
{
Interop.TextField.SelectWholeText(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <summary>
/// Clear selection of the text.
/// </summary>
/// <since_tizen> 8 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done, Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SelectNone()
{
_ = Interop.TextField.SelectNone(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
}
internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
{
SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.InputStyleChangedSignal(SwigCPtr));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
/// <summary>
/// Dispose.
/// </summary>
/// <since_tizen> 3 </since_tizen>
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
DisposeQueue.Instance.Add(this);
return;
}
if (systemlangTextFlag)
{
SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
}
removeFontSizeChangedCallback();
if (type == DisposeTypes.Explicit)
{
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (this.HasBody())
{
if (textFieldMaxLengthReachedCallbackDelegate != null)
{
this.MaxLengthReachedSignal().Disconnect(textFieldMaxLengthReachedCallbackDelegate);
}
if (textFieldTextChangedCallbackDelegate != null)
{
TextChangedSignal().Disconnect(textFieldTextChangedCallbackDelegate);
}
}
base.Dispose(type);
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
// In order to speed up IME hide, temporarily add
GetInputMethodContext()?.DestroyContext();
Interop.TextField.DeleteTextField(swigCPtr);
}
private string SetTranslatable(string textFieldSid)
{
string translatableText = null;
translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
if (translatableText != null)
{
if (systemlangTextFlag == false)
{
SystemSettings.LocaleLanguageChanged += SystemSettings_LocaleLanguageChanged;
systemlangTextFlag = true;
}
return translatableText;
}
else
{
translatableText = "";
return translatableText;
}
}
private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
{
if (textFieldTextSid != null)
{
Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
}
if (textFieldPlaceHolderTextSid != null)
{
PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
}
if (textFieldPlaceHolderTextFocusedSid != null)
{
PlaceholderTextFocused = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextFocusedSid, new CultureInfo(e.Value.Replace("_", "-")));
}
}
private void SystemSettingsFontSizeChanged(object sender, FontSizeChangedEventArgs e)
{
float newFontSizeScale = TextUtils.GetFontSizeScale(e.Value);
SetValue(FontSizeScaleProperty, newFontSizeScale);
NotifyPropertyChanged();
}
private void addFontSizeChangedCallback()
{
if (hasFontSizeChangedCallback != true)
{
try
{
SystemSettings.FontSizeChanged += SystemSettingsFontSizeChanged;
hasFontSizeChangedCallback = true;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
hasFontSizeChangedCallback = false;
}
}
}
private void removeFontSizeChangedCallback()
{
if (hasFontSizeChangedCallback == true)
{
try
{
SystemSettings.FontSizeChanged -= SystemSettingsFontSizeChanged;
hasFontSizeChangedCallback = false;
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught.", e);
hasFontSizeChangedCallback = true;
}
}
}
internal new class Property
{
internal static readonly int TEXT = Interop.TextField.TextGet();
internal static readonly int PlaceholderText = Interop.TextField.PlaceholderTextGet();
internal static readonly int PlaceholderTextFocused = Interop.TextField.PlaceholderTextFocusedGet();
internal static readonly int FontFamily = Interop.TextField.FontFamilyGet();
internal static readonly int FontStyle = Interop.TextField.FontStyleGet();
internal static readonly int PointSize = Interop.TextField.PointSizeGet();
internal static readonly int MaxLength = Interop.TextField.MaxLengthGet();
internal static readonly int ExceedPolicy = Interop.TextField.ExceedPolicyGet();
internal static readonly int HorizontalAlignment = Interop.TextField.HorizontalAlignmentGet();
internal static readonly int VerticalAlignment = Interop.TextField.VerticalAlignmentGet();
internal static readonly int TextColor = Interop.TextField.TextColorGet();
internal static readonly int PlaceholderTextColor = Interop.TextField.PlaceholderTextColorGet();
internal static readonly int PrimaryCursorColor = Interop.TextField.PrimaryCursorColorGet();
internal static readonly int SecondaryCursorColor = Interop.TextField.SecondaryCursorColorGet();
internal static readonly int EnableCursorBlink = Interop.TextField.EnableCursorBlinkGet();
internal static readonly int CursorBlinkInterval = Interop.TextField.CursorBlinkIntervalGet();
internal static readonly int CursorBlinkDuration = Interop.TextField.CursorBlinkDurationGet();
internal static readonly int CursorWidth = Interop.TextField.CursorWidthGet();
internal static readonly int GrabHandleImage = Interop.TextField.GrabHandleImageGet();
internal static readonly int GrabHandlePressedImage = Interop.TextField.GrabHandlePressedImageGet();
internal static readonly int ScrollThreshold = Interop.TextField.ScrollThresholdGet();
internal static readonly int ScrollSpeed = Interop.TextField.ScrollSpeedGet();
internal static readonly int SelectionHandleImageLeft = Interop.TextField.SelectionHandleImageLeftGet();
internal static readonly int SelectionHandleImageRight = Interop.TextField.SelectionHandleImageRightGet();
internal static readonly int SelectionHandlePressedImageLeft = Interop.TextField.SelectionHandlePressedImageLeftGet();
internal static readonly int SelectionHandlePressedImageRight = Interop.TextField.SelectionHandlePressedImageRightGet();
internal static readonly int SelectionHandleMarkerImageLeft = Interop.TextField.SelectionHandleMarkerImageLeftGet();
internal static readonly int SelectionHandleMarkerImageRight = Interop.TextField.SelectionHandleMarkerImageRightGet();
internal static readonly int SelectionHighlightColor = Interop.TextField.SelectionHighlightColorGet();
internal static readonly int DecorationBoundingBox = Interop.TextField.DecorationBoundingBoxGet();
internal static readonly int InputMethodSettings = Interop.TextField.InputMethodSettingsGet();
internal static readonly int InputColor = Interop.TextField.InputColorGet();
internal static readonly int EnableMarkup = Interop.TextField.EnableMarkupGet();
internal static readonly int InputFontFamily = Interop.TextField.InputFontFamilyGet();
internal static readonly int InputFontStyle = Interop.TextField.InputFontStyleGet();
internal static readonly int InputPointSize = Interop.TextField.InputPointSizeGet();
internal static readonly int UNDERLINE = Interop.TextField.UnderlineGet();
internal static readonly int InputUnderline = Interop.TextField.InputUnderlineGet();
internal static readonly int SHADOW = Interop.TextField.ShadowGet();
internal static readonly int InputShadow = Interop.TextField.InputShadowGet();
internal static readonly int EMBOSS = Interop.TextField.EmbossGet();
internal static readonly int InputEmboss = Interop.TextField.InputEmbossGet();
internal static readonly int OUTLINE = Interop.TextField.OutlineGet();
internal static readonly int InputOutline = Interop.TextField.InputOutlineGet();
internal static readonly int HiddenInputSettings = Interop.TextField.HiddenInputSettingsGet();
internal static readonly int PixelSize = Interop.TextField.PixelSizeGet();
internal static readonly int EnableSelection = Interop.TextField.EnableSelectionGet();
internal static readonly int PLACEHOLDER = Interop.TextField.PlaceholderGet();
internal static readonly int ELLIPSIS = Interop.TextField.EllipsisGet();
internal static readonly int EnableShiftSelection = Interop.TextField.EnableShiftSelectionGet();
internal static readonly int MatchSystemLanguageDirection = Interop.TextField.MatchSystemLanguageDirectionGet();
internal static readonly int EnableGrabHandle = Interop.TextField.EnableGrabHandleGet();
internal static readonly int EnableGrabHandlePopup = Interop.TextField.EnableGrabHandlePopupGet();
internal static readonly int SelectedText = Interop.TextField.SelectedTextGet();
internal static readonly int SelectedTextStart = Interop.TextField.SelectedTextStartGet();
internal static readonly int SelectedTextEnd = Interop.TextField.SelectedTextEndGet();
internal static readonly int EnableEditing = Interop.TextField.EnableEditingGet();
internal static readonly int PrimaryCursorPosition = Interop.TextField.PrimaryCursorPositionGet();
internal static readonly int FontSizeScale = Interop.TextField.FontSizeScaleGet();
internal static readonly int GrabHandleColor = Interop.TextField.GrabHandleColorGet();
internal static readonly int EllipsisPosition = Interop.TextField.EllipsisPositionGet();
}
internal class InputStyle
{
internal enum Mask
{
None = 0x0000,
Color = 0x0001,
FontFamily = 0x0002,
PointSize = 0x0004,
FontStyle = 0x0008,
Underline = 0x0010,
Shadow = 0x0020,
Emboss = 0x0040,
Outline = 0x0080
}
}
private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
{
DecorationBoundingBox = new Rectangle(x, y, width, height);
}
private void OnInputColorChanged(float x, float y, float z, float w)
{
InputColor = new Vector4(x, y, z, w);
}
private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
{
PlaceholderTextColor = new Vector4(r, g, b, a);
}
private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
{
PrimaryCursorColor = new Vector4(x, y, z, w);
}
private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
{
SecondaryCursorColor = new Vector4(x, y, z, w);
}
private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
{
SelectionHighlightColor = new Vector4(x, y, z, w);
}
private void OnShadowColorChanged(float x, float y, float z, float w)
{
ShadowColor = new Vector4(x, y, z, w);
}
private void OnShadowOffsetChanged(float x, float y)
{
ShadowOffset = new Vector2(x, y);
}
private void OnTextColorChanged(float r, float g, float b, float a)
{
TextColor = new Color(r, g, b, a);
}
private void OnGrabHandleColorChanged(float r, float g, float b, float a)
{
GrabHandleColor = new Color(r, g, b, a);
}
}
}
| 36.709812 | 316 | 0.546193 | [
"Apache-2.0",
"MIT"
] | again4you/TizenFX | src/Tizen.NUI/src/public/BaseComponents/TextField.cs | 70,336 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;
namespace Paint_
{
public class TransparentToBool : IValueConverter
{
public object Convert(object value, System.Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
Color transColor = Colors.Transparent;
Color color = (Color)value;
if (color != null)
{
return (color.A == transColor.A &&
color.R == transColor.R &&
color.G == transColor.G &&
color.B == transColor.B);
}
return false;
}
public object ConvertBack(object value, System.Type targetType,
object parameter, System.Globalization.CultureInfo culture)
{
return new NotImplementedException();
}
}
}
| 28.297297 | 95 | 0.559694 | [
"Apache-2.0"
] | tqbdev/paint-nmcnpm | Paint+/Converters/TransparentToBool.cs | 1,049 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
namespace Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101
{
using Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Runtime.PowerShell;
/// <summary>Common IoT Connector destination properties.</summary>
[System.ComponentModel.TypeConverter(typeof(IotDestinationPropertiesTypeConverter))]
public partial class IotDestinationProperties
{
/// <summary>
/// <c>AfterDeserializeDictionary</c> will be called after the deserialization has finished, allowing customization of the
/// object before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content);
/// <summary>
/// <c>AfterDeserializePSObject</c> will be called after the deserialization has finished, allowing customization of the object
/// before it is returned. Implement this method in a partial class to enable this behavior
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content);
/// <summary>
/// <c>BeforeDeserializeDictionary</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow);
/// <summary>
/// <c>BeforeDeserializePSObject</c> will be called before the deserialization has commenced, allowing complete customization
/// of the object before it is deserialized.
/// If you wish to disable the default deserialization entirely, return <c>true</c> in the <see "returnNow" /> output parameter.
/// Implement this method in a partial class to enable this behavior.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <param name="returnNow">Determines if the rest of the serialization should be processed, or if the method should return
/// instantly.</param>
partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow);
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IotDestinationProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationProperties"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content)
{
return new IotDestinationProperties(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IotDestinationProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
/// <returns>
/// an instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationProperties"
/// />.
/// </returns>
public static Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content)
{
return new IotDestinationProperties(content);
}
/// <summary>
/// Creates a new instance of <see cref="IotDestinationProperties" />, deserializing the content from a json string.
/// </summary>
/// <param name="jsonText">a string containing a JSON serialized instance of this model.</param>
/// <returns>an instance of the <see cref="className" /> model class.</returns>
public static Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Runtime.Json.JsonNode.Parse(jsonText));
/// <summary>
/// Deserializes a <see cref="global::System.Collections.IDictionary" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IotDestinationProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Collections.IDictionary content that should be used.</param>
internal IotDestinationProperties(global::System.Collections.IDictionary content)
{
bool returnNow = false;
BeforeDeserializeDictionary(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
if (content.Contains("ProvisioningState"))
{
((Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Support.ProvisioningState.CreateFrom);
}
AfterDeserializeDictionary(content);
}
/// <summary>
/// Deserializes a <see cref="global::System.Management.Automation.PSObject" /> into a new instance of <see cref="Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IotDestinationProperties"
/// />.
/// </summary>
/// <param name="content">The global::System.Management.Automation.PSObject content that should be used.</param>
internal IotDestinationProperties(global::System.Management.Automation.PSObject content)
{
bool returnNow = false;
BeforeDeserializePSObject(content, ref returnNow);
if (returnNow)
{
return;
}
// actually deserialize
if (content.Contains("ProvisioningState"))
{
((Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Models.Api20211101.IIotDestinationPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Support.ProvisioningState.CreateFrom);
}
AfterDeserializePSObject(content);
}
/// <summary>Serializes this instance to a json string.</summary>
/// <returns>a <see cref="System.String" /> containing this model serialized to JSON text.</returns>
public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.HealthcareApis.Runtime.SerializationMode.IncludeAll)?.ToString();
}
/// Common IoT Connector destination properties.
[System.ComponentModel.TypeConverter(typeof(IotDestinationPropertiesTypeConverter))]
public partial interface IIotDestinationProperties
{
}
} | 63.229167 | 493 | 0.695442 | [
"MIT"
] | yifanz0/azure-powershell | src/HealthcareApis/generated/api/Models/Api20211101/IotDestinationProperties.PowerShell.cs | 8,962 | C# |
using System;
using UnityEngine;
namespace Player
{
public class CameraController : MonoBehaviour
{
[SerializeField] private Camera viewCamera;
[SerializeField] private float sensitivityX = 1f;
[SerializeField] private float sensitivityY = 1f;
[SerializeField] private bool clampRotation = true;
[SerializeField] private float clampMinX = -90f;
[SerializeField] private float clampMaxX = 90f;
[SerializeField] private bool enableCameraBob = true;
[SerializeField] private float crouchBobSpeed = 10f;
[SerializeField] private float crouchBobAmount = 0.02f;
[SerializeField] private float walkBobSpeed = 15f;
[SerializeField] private float walkBobAmount = 0.05f;
[SerializeField] private float sprintBobSpeed = 20f;
[SerializeField] private float sprintBobAmount = 0.1f;
[SerializeField] private bool lockCursor = true;
private FirstPersonController _firstPersonInstance;
private float _originalPositionY;
private float _bobTimer;
private void Awake()
{
_firstPersonInstance = FirstPersonController.Instance;
_originalPositionY = viewCamera.transform.localPosition.y;
if (lockCursor)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
else
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
private void Update()
{
var mouseDelta = InputController.GetMouseDelta();
var rotationY = mouseDelta.x * sensitivityX;
var rotationX = mouseDelta.y * sensitivityY;
var characterRotation = transform.localRotation;
var cameraRotation = viewCamera.transform.localRotation;
characterRotation *= Quaternion.Euler(0f, rotationY, 0f);
cameraRotation *= Quaternion.Euler(-rotationX, 0f, 0f);
if (clampRotation)
{
cameraRotation = ClampRotationAroundXAxis(cameraRotation);
}
transform.localRotation = characterRotation;
viewCamera.transform.localRotation = cameraRotation;
}
private Quaternion ClampRotationAroundXAxis(Quaternion q)
{
q.x /= q.w;
q.y /= q.w;
q.z /= q.w;
q.w = 1.0f;
var angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan (q.x);
angleX = Mathf.Clamp (angleX, clampMinX, clampMaxX);
q.x = Mathf.Tan (0.5f * Mathf.Deg2Rad * angleX);
return q;
}
public void UpdateCameraOnMovement(Vector3 movement)
{
if (!enableCameraBob)
{
return;
}
var speed = walkBobSpeed;
var amount = walkBobAmount;
if (_firstPersonInstance.IsCrouching)
{
speed = crouchBobSpeed;
amount = crouchBobAmount;
}
else if (_firstPersonInstance.IsSprinting)
{
speed = sprintBobSpeed;
amount = sprintBobAmount;
}
else if (_firstPersonInstance.IsJumping)
{
speed *= 0f;
amount *= 0f;
}
if (Mathf.Abs(movement.x) > 0.1f || Mathf.Abs(movement.z) > 0.1)
{
_bobTimer += Time.deltaTime * speed;
viewCamera.transform.localPosition = new Vector3(viewCamera.transform.localPosition.x, _originalPositionY + Mathf.Sin(_bobTimer) * amount, viewCamera.transform.localPosition.z);
}
else
{
_bobTimer = 0;
viewCamera.transform.localPosition = new Vector3(viewCamera.transform.localPosition.x, Mathf.Lerp(viewCamera.transform.localPosition.y, _originalPositionY, Time.deltaTime * speed), viewCamera.transform.localPosition.z);
}
}
}
} | 26.261905 | 223 | 0.713811 | [
"MIT"
] | deeming-games/unity-fps-asset | Assets/Scripts/Player/CameraController.cs | 3,309 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UniRx;
using Zenject;
namespace PianoToRhythmGame.Input
{
public class MidiInputProviderDebugger : MonoBehaviour
{
[Inject]
IMidiInputProvider _inputProvider;
// Start is called before the first frame update
void Start()
{
for (var noteNumber = 0; noteNumber < _inputProvider.NumTotalNotes; noteNumber++)
{
var noteSt = noteNumber.ToString();
_inputProvider.GetVelocity(noteNumber)
.Where(v => v >= 0.1f)
.Subscribe(v =>
{
OutputLog($"note:{noteSt}, velocity:{v}");
});
}
}
void OutputLog(string message)
{
Debug.Log(message);
}
}
}
| 26.138889 | 93 | 0.498406 | [
"MIT"
] | torano111/PianoToRhythmGame | Assets/PianoToRhythmGame/Scripts/Input/MidiInputProviderDebugger.cs | 943 | C# |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System;
using Bakery.Models;
namespace Bakery.Tests
{
[TestClass]
public class OrderTests : IDisposable
{
public void Dispose()
{
Order.ClearAll();
}
[TestMethod]
public void OrderConstractor_CreateInstanceOfOrder_OrderTitleBread()
{
Order newOrder = new Order("Bread", "wow", "3/05", 22);
Assert.AreEqual("Bread", newOrder.Title);
}
[TestMethod]
public void GetId_OrdersInstantiateWithIdAndGetterReturns_IntOne()
{
Order newOrder = new Order("Bread", "wow", "3/05", 22);
int result = newOrder.Id;
Assert.AreEqual(1, result);
}
[TestMethod]
public void GetAll_ReturnOrders_OrderList()
{
Order order1 = new Order("Bread", "wow", "3/05", 22);
Order order2 = new Order("Pastry", "7 paistries for kids", "3/05", 30);
List<Order> newList = new List<Order> { order1, order2 };
List<Order> result = Order.GetAll();
CollectionAssert.AreEqual(newList, result);
}
[TestMethod]
public void Find_ReturnsCorrectOrder_Order()
{
Order newOrder1 = new Order("Bread", "wow", "3/05", 22);
Order newOrder2 = new Order("Pastry", "7 paistries for kids", "3/05", 30);
Order result = Order.Find(2);
Assert.AreEqual(newOrder2, result);
}
}
}
| 28.215686 | 81 | 0.622655 | [
"MIT"
] | DanielAdeyemi/Epicodus_Project8 | Bakery.Tests/ModelTests/OrderTests.cs | 1,439 | C# |
using System.Threading.Tasks;
using Google.Apis.Sheets.v4;
using Google.Apis.Sheets.v4.Data;
namespace SheetToObjects.Adapters.ProtectedGoogleSheets
{
public class SheetsServiceWrapper : ISheetsServiceWrapper
{
private readonly SheetsService _sheetsService;
public SheetsServiceWrapper(SheetsService sheetsService)
{
_sheetsService = sheetsService;
}
public async Task<ValueRange> Get(string sheetId, string range)
{
return await _sheetsService.Spreadsheets.Values.Get(sheetId, range).ExecuteAsync();
}
}
} | 28.666667 | 95 | 0.700997 | [
"MIT"
] | josdeweger/SheetToObjects | src/SheetToObjects.Adapters.ProtectedGoogleSheets/SheetsServiceWrapper.cs | 604 | C# |
namespace PlutoNetCoreTemplate.Infrastructure.EntityFrameworkCore
{
using Domain.SeedWork;
using global::EntityFrameworkCore.Extension.UnitOfWork;
/// <summary>
/// 系统基础仓储
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public class SystemBaseRepository<TEntity> : Repository<SystemDbContext, TEntity>, ISystemBaseRepository<TEntity> where TEntity : class, new()
{
public SystemBaseRepository(SystemDbContext dbContext) : base(dbContext)
{
}
}
} | 30.470588 | 146 | 0.694981 | [
"MIT"
] | pluto-arch/dotnet-project-template | template/content/src/PlutoNetCoreTemplate.Infrastructure/EntityFrameworkCore/System/SystemBaseRepository.cs | 532 | C# |
namespace Oppgave1d
{
internal class Program
{
public static void Main(string[] args)
{
double value = 0, converted = 0;
System.String tokens;
System.Console.Write("Enter command: ");
tokens = System.Console.ReadLine();
System.String[] arrTokens = tokens.Split();
if (arrTokens[0].ToLower() == "konverter" && System.Double.TryParse(arrTokens[1], out value) &&
(arrTokens[2].ToLower() == "c" || arrTokens[2].ToLower() == "f")) {
switch (arrTokens[2].ToLower())
{
case "c":
converted = cel2fahr(value);
System.Console.WriteLine($"{value} celsius is {converted} fahrenheit");
break;
case "f":
converted = fahr2cel(value);
System.Console.WriteLine($"{value} fahrenheit is {converted} celsius");
break;
}
}
}
private static double cel2fahr(double celsius){
return celsius*1.8+32;
}
private static double fahr2cel(double fahrenheit) {
return (fahrenheit - 32) * (5 / 9);
}
}
} | 36.25 | 107 | 0.472031 | [
"MIT"
] | Unicron2k/dte_bsc | DTE2802/module1/Oppgave1d/Program.cs | 1,307 | 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 rds-2014-10-31.normal.json service model.
*/
using System;
using System.Net;
using Amazon.Runtime;
namespace Amazon.RDS.Model
{
///<summary>
/// RDS exception
/// </summary>
public class InvalidOptionGroupStateException : AmazonRDSException
{
/// <summary>
/// Constructs a new InvalidOptionGroupStateException with the specified error
/// message.
/// </summary>
/// <param name="message">
/// Describes the error encountered.
/// </param>
public InvalidOptionGroupStateException(string message)
: base(message) {}
public InvalidOptionGroupStateException(string message, Exception innerException)
: base(message, innerException) {}
public InvalidOptionGroupStateException(Exception innerException)
: base(innerException) {}
public InvalidOptionGroupStateException(string message, Exception innerException, ErrorType errorType, string errorCode, string RequestId, HttpStatusCode statusCode)
: base(message, innerException, errorType, errorCode, RequestId, statusCode) {}
public InvalidOptionGroupStateException(string message, ErrorType errorType, string errorCode, string RequestId, HttpStatusCode statusCode)
: base(message, errorType, errorCode, RequestId, statusCode) {}
}
} | 38.811321 | 174 | 0.688381 | [
"Apache-2.0"
] | samritchie/aws-sdk-net | AWSSDK_DotNet35/Amazon.RDS/Model/InvalidOptionGroupStateException.cs | 2,057 | C# |
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version: 15.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
namespace ServiceClientGenerator.Generators.Marshallers
{
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System;
/// <summary>
/// Class to produce the template output
/// </summary>
#line 1 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "15.0.0.0")]
public partial class EndpointDiscoveryMarshaller : BaseMarshaller
{
#line hidden
/// <summary>
/// Create the template output
/// </summary>
public override string TransformText()
{
#line 6 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
AddLicenseHeader();
AddCommonUsingStatements();
AddSource();
#line default
#line hidden
return this.GenerationEnvironment.ToString();
}
#line 12 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
// The operation to unmarshall a response from
public Operation Operation { get; set; }
protected void AddSingletonMethod()
{
#line default
#line hidden
#line 18 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(" private static ");
#line default
#line hidden
#line 19 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 19 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("EndpointDiscoveryMarshaller _instance = new ");
#line default
#line hidden
#line 19 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 19 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("EndpointDiscoveryMarshaller();\r\n\r\n /// <summary>\r\n /// Gets the sin" +
"gleton.\r\n /// </summary> \r\n\t\tpublic static ");
#line default
#line hidden
#line 24 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 24 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("EndpointDiscoveryMarshaller Instance\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\treturn _instance;\r\n\t" +
"\t\t}\r\n\t\t}\r\n");
#line default
#line hidden
#line 31 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
}
protected void ProcessRequestEndpointDiscoveryIds(string variableName, IEnumerable<Member> members)
{
foreach(var member in members)
{
#line default
#line hidden
#line 38 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("\t\t\tif(");
#line default
#line hidden
#line 39 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(variableName));
#line default
#line hidden
#line 39 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(".IsSet");
#line default
#line hidden
#line 39 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName));
#line default
#line hidden
#line 39 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("())\r\n\t\t\t\tendpointDiscoveryData.Identifiers.Add(\"");
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName));
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("\", ");
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(member.PrimitiveMarshaller));
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("(");
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(variableName));
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(".");
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(member.PropertyName));
#line default
#line hidden
#line 40 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("));\r\n");
#line default
#line hidden
#line 41 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
}
}
protected void AddSource()
{
#line default
#line hidden
#line 47 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("namespace ");
#line default
#line hidden
#line 48 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.Namespace));
#line default
#line hidden
#line 48 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(".Model.Internal.MarshallTransformations\r\n{\r\n /// <summary>\r\n /// Endpoint d" +
"iscovery parameters for ");
#line default
#line hidden
#line 51 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 51 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(" operation\r\n /// </summary> \r\n public class ");
#line default
#line hidden
#line 53 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 53 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("EndpointDiscoveryMarshaller : IMarshaller<EndpointDiscoveryDataBase, ");
#line default
#line hidden
#line 53 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 53 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(@"Request> , IMarshaller<EndpointDiscoveryDataBase,AmazonWebServiceRequest>
{
/// <summary>
/// Marshaller the endpoint discovery object.
/// </summary>
/// <param name=""input""></param>
/// <returns></returns>
public EndpointDiscoveryDataBase Marshall(AmazonWebServiceRequest input)
{
return this.Marshall((");
#line default
#line hidden
#line 62 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 62 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(@"Request)input);
}
/// <summary>
/// Marshaller the request object to the HTTP request.
/// </summary>
/// <param name=""publicRequest""></param>
/// <returns></returns>
public EndpointDiscoveryDataBase Marshall(");
#line default
#line hidden
#line 70 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.Name));
#line default
#line hidden
#line 70 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("Request publicRequest)\r\n\t\t{\r\n\t\t\tvar endpointDiscoveryData = new EndpointDiscovery" +
"Data(");
#line default
#line hidden
#line 72 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Operation.IsEndpointDiscoveryRequired.ToString().ToLowerInvariant()));
#line default
#line hidden
#line 72 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(");\r\n\r\n");
#line default
#line hidden
#line 74 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
if(this.Operation.RequestHasEndpointDiscoveryIdMembers)
{
ProcessRequestEndpointDiscoveryIds("publicRequest", this.Operation.RequestEndpointDiscoveryIdMembers);
}
#line default
#line hidden
#line 79 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write("\t\t\treturn endpointDiscoveryData;\r\n\t\t}\r\n \r\n");
#line default
#line hidden
#line 83 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.AddSingletonMethod();
#line default
#line hidden
#line 85 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
this.Write(" \r\n }\r\n}\r\n");
#line default
#line hidden
#line 88 "C:\Dev\Worktrees\crr\generator\ServiceClientGeneratorLib\Generators\Marshallers\EndpointDiscoveryMarshaller.tt"
}
#line default
#line hidden
}
#line default
#line hidden
}
| 34.21883 | 132 | 0.665601 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | generator/ServiceClientGeneratorLib/Generators/Marshallers/EndpointDiscoveryMarshaller.cs | 13,448 | C# |
namespace BlockchainWallet.Utils.Globals
{
public class TempDataKeys
{
public const string BalanceDto = "tdk-balance-dto";
public const string TransactionDto = "tdk-transaction-dto";
public const string ResultDto = "tdk-result";
public const string FaucetDto = "tdk-faucet";
}
}
| 29.454545 | 67 | 0.67284 | [
"MIT"
] | blockchain-dev-camp/blockchain-wallet | BlockchainWallet/BlockchainWallet.Utils/Globals/TempDataKeys.cs | 326 | C# |
namespace PixelNLayers.Wpf.Shared.Interfaces;
internal interface IPagination
{
} | 16.4 | 46 | 0.829268 | [
"MIT"
] | PerfectlyFineCode/PixelNLayers | src/PixelNLayers.Wpf.Shared/Interfaces/IPagination.cs | 84 | C# |
// Sirawat Pitaksarit / 5argon - Exceed7 Experiments
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
[ExecuteInEditMode]
[RequireComponent(typeof(GridLayoutGroup))]
/// <summary>
/// Instead of constraining only row or column, constrain both and let the cell size fill the parent.
/// </summary>
public class DynamicGridLayoutGroup : MonoBehaviour
{
public int column = 1;
public int row = 1;
private int Column {
get{
if( column < 1)
{
column = 1;
}
return column;
}
}
private int Row {
get{
if( row < 1)
{
row = 1;
}
return row;
}
}
private RectTransform parent;
private GridLayoutGroup grid;
void Awake()
{
parent = gameObject.GetComponent<RectTransform>();
grid = gameObject.GetComponent<GridLayoutGroup>();
OnRectTransformDimensionsChange();
}
#if UNITY_EDITOR
void Update()
{
if(Application.isEditor)
{
OnRectTransformDimensionsChange();
}
}
#endif
void OnRectTransformDimensionsChange()
{
if(parent == null)
{
parent = gameObject.GetComponent<RectTransform>();
}
if(grid == null)
{
grid = gameObject.GetComponent<GridLayoutGroup>();
}
grid.constraint = GridLayoutGroup.Constraint.Flexible;
float cellX = (parent.rect.width / Column) - ((grid.spacing.x * (Column - 1))/Column) - (grid.padding.left/(float)Column) - (grid.padding.right/(float)Column);
float cellY = (parent.rect.height / row) - ((grid.spacing.y * (Row - 1))/Row) - (grid.padding.top/(float)Row) - (grid.padding.bottom/(float)Row);
if(float.IsInfinity(cellX) || float.IsNaN(cellX) || float.IsInfinity(cellY) || float.IsNaN(cellY))
{
grid.cellSize = Vector2.zero;
}
else
{
grid.cellSize = new Vector2(cellX,cellY);
}
}
} | 22.3125 | 167 | 0.659384 | [
"MIT"
] | 5argon/E7Unity | DynamicGridLayoutGroup/DynamicGridLayoutGroup.cs | 1,787 | C# |
using ProjetoModeloDDD.Domain.Entities;
using ProjetoModeloDDD.Domain.Interfaces.Repositories;
namespace ProjetoModeloDDD.Infra.Data.Repositories
{
public class EstadoRepository : RepositoryBase<Estado>, IEstadoRepository
{
}
}
| 20.25 | 77 | 0.798354 | [
"MIT"
] | LeonardoVanelli/Gest-oSpaca | PrismaWEB.Infra.Data/Repositories/EstadoRepository.cs | 243 | C# |
namespace Octokit.GraphQL.Model
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Octokit.GraphQL.Core;
using Octokit.GraphQL.Core.Builders;
/// <summary>
/// The connection type for CWE.
/// </summary>
public class CWEConnection : QueryableValue<CWEConnection>, IPagingConnection<CWE>
{
internal CWEConnection(Expression expression) : base(expression)
{
}
/// <summary>
/// A list of edges.
/// </summary>
public IQueryableList<CWEEdge> Edges => this.CreateProperty(x => x.Edges);
/// <summary>
/// A list of nodes.
/// </summary>
public IQueryableList<CWE> Nodes => this.CreateProperty(x => x.Nodes);
/// <summary>
/// Information to aid in pagination.
/// </summary>
public PageInfo PageInfo => this.CreateProperty(x => x.PageInfo, Octokit.GraphQL.Model.PageInfo.Create);
/// <summary>
/// Identifies the total count of items in the connection.
/// </summary>
public int TotalCount { get; }
IPageInfo IPagingConnection.PageInfo => PageInfo;
internal static CWEConnection Create(Expression expression)
{
return new CWEConnection(expression);
}
}
} | 29.622222 | 112 | 0.604651 | [
"MIT"
] | grokys/Octokit.GraphQL | Octokit.GraphQL/Model/CWEConnection.cs | 1,333 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: IEntityRequest.cs.tt
namespace Microsoft.Graph
{
using System;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Linq.Expressions;
/// <summary>
/// The interface ITeamworkTagRequest.
/// </summary>
public partial interface ITeamworkTagRequest : IBaseRequest
{
/// <summary>
/// Creates the specified TeamworkTag using POST.
/// </summary>
/// <param name="teamworkTagToCreate">The TeamworkTag to create.</param>
/// <returns>The created TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> CreateAsync(TeamworkTag teamworkTagToCreate); /// <summary>
/// Creates the specified TeamworkTag using POST.
/// </summary>
/// <param name="teamworkTagToCreate">The TeamworkTag to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The created TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> CreateAsync(TeamworkTag teamworkTagToCreate, CancellationToken cancellationToken);
/// <summary>
/// Deletes the specified TeamworkTag.
/// </summary>
/// <returns>The task to await.</returns>
System.Threading.Tasks.Task DeleteAsync();
/// <summary>
/// Deletes the specified TeamworkTag.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The task to await.</returns>
System.Threading.Tasks.Task DeleteAsync(CancellationToken cancellationToken);
/// <summary>
/// Gets the specified TeamworkTag.
/// </summary>
/// <returns>The TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> GetAsync();
/// <summary>
/// Gets the specified TeamworkTag.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <returns>The TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> GetAsync(CancellationToken cancellationToken);
/// <summary>
/// Updates the specified TeamworkTag using PATCH.
/// </summary>
/// <param name="teamworkTagToUpdate">The TeamworkTag to update.</param>
/// <returns>The updated TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> UpdateAsync(TeamworkTag teamworkTagToUpdate);
/// <summary>
/// Updates the specified TeamworkTag using PATCH.
/// </summary>
/// <param name="teamworkTagToUpdate">The TeamworkTag to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
/// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
/// <returns>The updated TeamworkTag.</returns>
System.Threading.Tasks.Task<TeamworkTag> UpdateAsync(TeamworkTag teamworkTagToUpdate, CancellationToken cancellationToken);
/// <summary>
/// Adds the specified expand value to the request.
/// </summary>
/// <param name="value">The expand value.</param>
/// <returns>The request object to send.</returns>
ITeamworkTagRequest Expand(string value);
/// <summary>
/// Adds the specified expand value to the request.
/// </summary>
/// <param name="expandExpression">The expression from which to calculate the expand value.</param>
/// <returns>The request object to send.</returns>
ITeamworkTagRequest Expand(Expression<Func<TeamworkTag, object>> expandExpression);
/// <summary>
/// Adds the specified select value to the request.
/// </summary>
/// <param name="value">The select value.</param>
/// <returns>The request object to send.</returns>
ITeamworkTagRequest Select(string value);
/// <summary>
/// Adds the specified select value to the request.
/// </summary>
/// <param name="selectExpression">The expression from which to calculate the select value.</param>
/// <returns>The request object to send.</returns>
ITeamworkTagRequest Select(Expression<Func<TeamworkTag, object>> selectExpression);
}
}
| 45.425926 | 153 | 0.627395 | [
"MIT"
] | larslynch/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Generated/requests/ITeamworkTagRequest.cs | 4,906 | 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 cloudfront-2020-05-31.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.CloudFront.Model
{
/// <summary>
/// This is the response object from the GetOriginRequestPolicyConfig operation.
/// </summary>
public partial class GetOriginRequestPolicyConfigResponse : AmazonWebServiceResponse
{
private string _eTag;
private OriginRequestPolicyConfig _originRequestPolicyConfig;
/// <summary>
/// Gets and sets the property ETag.
/// <para>
/// The current version of the origin request policy.
/// </para>
/// </summary>
public string ETag
{
get { return this._eTag; }
set { this._eTag = value; }
}
// Check to see if ETag property is set
internal bool IsSetETag()
{
return this._eTag != null;
}
/// <summary>
/// Gets and sets the property OriginRequestPolicyConfig.
/// <para>
/// The origin request policy configuration.
/// </para>
/// </summary>
public OriginRequestPolicyConfig OriginRequestPolicyConfig
{
get { return this._originRequestPolicyConfig; }
set { this._originRequestPolicyConfig = value; }
}
// Check to see if OriginRequestPolicyConfig property is set
internal bool IsSetOriginRequestPolicyConfig()
{
return this._originRequestPolicyConfig != null;
}
}
} | 31.565789 | 109 | 0.626094 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/CloudFront/Generated/Model/GetOriginRequestPolicyConfigResponse.cs | 2,399 | C# |
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
namespace henningboat.CubeMarching.Runtime.BinaryAssets
{
public struct SDF2DHeader : IBinaryAssetHeader
{
public int DataIndex { get; set; }
public int DataLength { get; set; }
public int AssetInstanceID { get; set; }
public int2 Size => _size;
private int2 _size;
public float Sample(float2 uv, NativeSlice<float> data)
{
uv = math.clamp(uv, 0, _size - 2);
var flooredUV = (int2) math.floor(uv);
var c00 = SamplePixel(flooredUV, data);
var c10 = SamplePixel(flooredUV + new int2(1, 0), data);
var c01 = SamplePixel(flooredUV + new int2(0, 1), data);
var c11 = SamplePixel(flooredUV + new int2(1, 1), data);
var subPixelPosition = uv % 1;
var row0 = math.lerp(c00, c10, subPixelPosition.x);
var row1 = math.lerp(c01, c11, subPixelPosition.x);
var interpolatedValue = math.lerp(row0, row1, subPixelPosition.y);
return interpolatedValue;
}
public float SamplePixel(int2 pixel, NativeSlice<float> data)
{
var index = DistanceFieldGeneration.Utils.PositionToIndex(pixel, _size);
return data[index];
}
public static void CreateSDF(BinaryDataStorage binaryDataStorage, Texture2D sdfTexture)
{
var size = new int2(sdfTexture.width, sdfTexture.height);
var header = new SDF2DHeader()
{_size = size, DataLength = size.x * size.y, AssetInstanceID = sdfTexture.GetInstanceID()};
binaryDataStorage.CreateSDF2DData(header, out NativeSlice<float> data);
var textureData = sdfTexture.GetPixels();
for (var i = 0; i < size.x * size.y; i++) data[i] = (0.5f - textureData[i].r);
}
}
} | 34.267857 | 107 | 0.600313 | [
"MIT"
] | henningboat/MarchingCubesPackages | Runtime/BinaryAssets/SDF2DHeader.cs | 1,921 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AnZwDev.ALTools.ALSymbols;
namespace AnZwDev.ALTools.ALSymbolReferences
{
public class ALAppQuery : ALAppObject
{
public ALAppElementsCollection<ALAppQueryDataItem> Elements { get; set; }
public ALAppQuery()
{
}
public override ALSymbolKind GetALSymbolKind()
{
return ALSymbolKind.QueryObject;
}
protected override void AddChildALSymbols(ALSymbol symbol)
{
this.Elements?.AddToALSymbol(symbol, ALSymbolKind.QueryElements, "elements");
base.AddChildALSymbols(symbol);
}
public ALAppQueryDataItem FindDataItem(string name)
{
if ((this.Elements != null) && (!String.IsNullOrWhiteSpace(name)))
return this.FindDataItem(this.Elements, name);
return null;
}
protected ALAppQueryDataItem FindDataItem(ALAppElementsCollection<ALAppQueryDataItem> dataItemsCollection, string name)
{
foreach (ALAppQueryDataItem dataItem in dataItemsCollection)
{
if (name.Equals(dataItem.Name, StringComparison.CurrentCultureIgnoreCase))
return dataItem;
if (dataItem.DataItems != null)
{
ALAppQueryDataItem foundDataItem = this.FindDataItem(dataItem.DataItems, name);
if (foundDataItem != null)
return foundDataItem;
}
}
return null;
}
}
}
| 30.145455 | 127 | 0.606755 | [
"MIT"
] | anzwdev/az-al-dev-tools-server | AZALDevToolsServer/Shared.AnZwDev.ALTools/ALSymbolReferences/ALAppQuery.cs | 1,660 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttackBoxTargetHit : MonoBehaviour {
public Knife knife;
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.tag == "Target") {
knife.Stop();
knife.transform.parent = collision.transform;
GameManager.Instance.EventManager.CallOnTargetHit();
if (knife.IsLastKnife)
GameManager.Instance.EventManager.CallOnAllKnifesShoot();
}
}
}
| 23.5 | 61 | 0.76383 | [
"MIT"
] | Team-on/Knife-hit | KnifeHit/Assets/Scripts/Knife/AttackBoxTargetHit.cs | 472 | C# |
// Copyright (c) 2007-2018 Thong Nguyen (tumtumtum@gmail.com)
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Transactions;
using NUnit.Framework;
using Shaolinq.Persistence;
using Shaolinq.Tests.TestModel;
namespace Shaolinq.Tests
{
[TestFixture("MySql")]
[TestFixture("Postgres")]
[TestFixture("Postgres.DotConnect")]
[TestFixture("Postgres.DotConnect.Unprepared")]
[TestFixture("SqlServer")]
[TestFixture("Sqlite")]
[TestFixture("Sqlite:DataAccessScope")]
[TestFixture("SqliteInMemory")]
[TestFixture("SqliteClassicInMemory")]
public class DeleteTests
: BaseTests<TestDataAccessModel>
{
public DeleteTests(string providerName)
: base(providerName)
{
}
[Test]
public void Test_Use_Deflated_Reference_To_Update_Related_Object_That_Was_Deleted()
{
Guid student1Id, student2Id;
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
scope.Flush();
var student1 = school.Students.Create();
var student2 = school.Students.Create();
student1Id = student1.Id;
student2Id = student2.Id;
student1.BestFriend = student2;
scope.Complete();
}
using (var scope = new TransactionScope())
{
if (!this.model.GetCurrentSqlDatabaseContext().SqlDialect.SupportsCapability(SqlCapability.SetNullAction))
{
this.model.Students.Single(c => c.Id == student1Id).BestFriend = null;
scope.Save();
}
var count = this.model.Students.Where(c => c.Id != Guid.Empty).Where(c => c.Id != Guid.NewGuid()).Delete(c => c.Id == student2Id);
Assert.AreEqual(1, count);
scope.Complete();
}
using (var scope = new TransactionScope())
{
Assert.IsNull(this.model.Students.FirstOrDefault(c => c.Id == student2Id));
var student1 = this.model.Students.First(c => c.Id == student1Id);
Assert.IsNull(student1.BestFriend);
scope.Complete();
}
}
[Test]
public void Test_Delete_Object_With_Deflated_Reference()
{
long schoolId;
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
scope.Flush();
Assert.IsEmpty(((IDataAccessObjectAdvanced)school).GetChangedPropertiesFlattened());
Assert.IsFalse(((IDataAccessObjectAdvanced)school).HasObjectChanged);
schoolId = school.Id;
scope.Complete();
}
using (var scope = new TransactionScope())
{
var school = this.model.Schools.GetReference(schoolId);
school.Delete();
Assert.IsTrue(((IDataAccessObjectAdvanced)school).IsDeleted);
scope.Flush();
Assert.IsNull(this.model.Schools.FirstOrDefault(c => c.Id == schoolId));
scope.Complete();
}
using (var scope = new TransactionScope())
{
Assert.IsNull(this.model.Schools.FirstOrDefault(c => c.Id == schoolId));
}
}
[Test]
public void Test_Delete_Object_With_Invalid_Deflated_Reference()
{
using (var scope = new TransactionScope())
{
var school = this.model.Schools.GetReference(100000);
school.Delete();
scope.Complete();
}
}
[Test]
public void Test_DeleteAsync()
{
Func<Task> func = async delegate
{
using (var scope = new DataAccessScope())
{
var school = this.model.Schools.Create();
await scope.FlushAsync();
var id = school.Id;
var item = await this.model.Schools.FirstOrDefaultAsync(c => c.Id == id);
Assert.IsNotNull(item);
await this.model.Schools.Where(c => c.Id == id).DeleteAsync();
item = await this.model.Schools.FirstOrDefaultAsync(c => c.Id == id);
Assert.IsNull(item);
await scope.CompleteAsync();
}
};
var task = Task.Run(func);
task.GetAwaiter().GetResult();
}
[Test]
public void Test_Object_Deleted_Flushed_Still_Deleted()
{
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
Assert.IsFalse(school.IsDeleted());
school.Delete();
Assert.IsTrue(school.IsDeleted());
scope.Flush();
Assert.IsTrue(school.IsDeleted());
scope.Complete();
}
}
[Test]
public void Test_Modify_Deleted_Object()
{
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
school.Delete();
Assert.Catch<DeletedDataAccessObjectException>(() =>
{
school.Name = "Hello";
});
scope.Complete();
}
}
[Test]
public void Test_Query_Then_Delete_Object_Then_Query_Then_Access()
{
long schoolId;
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
school.Name = "Yoga Decorum";
scope.Flush();
schoolId = school.Id;
scope.Complete();
}
using (var scope = new TransactionScope())
{
var school = this.model.Schools.First(c => c.Id == schoolId);
Assert.IsFalse(school.IsDeleted());
school.Delete();
Assert.IsTrue(school.IsDeleted());
school = this.model.Schools.First(c => c.Id == schoolId);
Assert.IsTrue(school.IsDeleted());
}
using (var scope = new TransactionScope())
{
Assert.IsNotNull(this.model.Schools.Single(c => c.Id == schoolId));
}
using (var scope = new TransactionScope())
{
var school = this.model.Schools.First(c => c.Id == schoolId);
Assert.IsFalse(school.IsDeleted());
school.Delete();
Assert.IsTrue(school.IsDeleted());
school = this.model.Schools.First(c => c.Id == schoolId);
Assert.IsTrue(school.IsDeleted());
Assert.AreEqual("Yoga Decorum", school.Name);
scope.Complete();
}
using (var scope = new TransactionScope())
{
Assert.IsNull(this.model.Schools.FirstOrDefault(c => c.Id == schoolId));
}
}
[Test]
public void Test_Query_Access_Deleted_Object_Via_DeflatedReference()
{
Assert.Catch<MissingDataAccessObjectException>(() =>
{
long schoolId;
using (var scope = new TransactionScope())
{
var school = this.model.Schools.Create();
school.Name = "Yoga Decorum";
scope.Flush();
schoolId = school.Id;
scope.Complete();
}
using (var scope = new TransactionScope())
{
this.model.Schools.Where(c => c.Id == schoolId).Delete();
scope.Complete();
}
Assert.AreEqual(0, this.model.Schools.Count(c => c.Id == schoolId));
try
{
using (var scope = new TransactionScope())
{
var school = this.model.Schools.GetReference(schoolId);
school.Name = "Yoga Decorum!!!";
scope.Complete();
}
}
catch (TransactionAbortedException e)
{
throw e.InnerException;
}
});
}
}
}
| 22.526144 | 135 | 0.624547 | [
"MIT"
] | asizikov/Shaolinq | tests/Shaolinq.Tests/DeleteTests.cs | 6,895 | C# |
using AspAutoSelfUpdater.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace AspAutoSelfUpdater.Services
{
class SettingService
{
public Setting _Setting { get; set; }
private static SettingService settingService=null;
public static Setting Setting
{
get
{
if (settingService == null)
settingService = new SettingService();
return settingService._Setting;
}
}
public SettingService()
{
try
{
if (File.Exists("AspAutoSelfUpdater.Setting.json"))
{
var settingData = File.ReadAllText("AspAutoSelfUpdater.Setting.json");
_Setting = JsonConvert.DeserializeObject<Setting>(settingData);
_Setting.SuccessfullyLoaded = true;
return;
}
else {
Console.WriteLine($"Setting File not exist!");
}
}
catch (Exception ex)
{
Console.WriteLine($"Errir Reading Setting file: {ex}");
}
_Setting = new Setting {
SuccessfullyLoaded = false
};
}
}
}
| 26.730769 | 90 | 0.502878 | [
"MIT"
] | ahmed-eg/asp_auto_self_updater | Services/SettingService.cs | 1,392 | C# |
using System;
using Board.Domain.AggregatesModel.BoardAggregate;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Board.Infrastructure.EntityConfigurations
{
public class MemberEntityTypeConfiguration : IEntityTypeConfiguration<Member>
{
public void Configure(EntityTypeBuilder<Member> builder)
{
builder.ToTable("members");
builder.Ignore(e => e.DomainEvents);
builder.HasKey(e => e.Id);
builder.Property(e => e.Id).ValueGeneratedNever().HasColumnName("id").HasMaxLength(36).IsRequired();
builder.Property(e => e.CreatedAt).HasColumnName("created_at").IsRequired();
builder.Property(e => e.UpdatedAt).HasColumnName("updated_at").IsRequired();
builder
.Property<Guid>("BoardId")
.HasColumnName("board_id")
.IsRequired();
builder
.Property<string>("_userId")
.UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("user_id")
.HasMaxLength(36)
.IsRequired();
builder
.Property<int>("_roleId")
.UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("role_id")
.IsRequired();
builder
.HasOne(e => e.Role)
.WithMany()
.HasForeignKey("_roleId")
.OnDelete(DeleteBehavior.Cascade);
builder.HasIndex("BoardId", "_userId", "_roleId").IsUnique();
builder.HasIndex(e => e.UpdatedAt);
builder.HasIndex("_userId");
}
}
} | 35.176471 | 112 | 0.560201 | [
"MIT"
] | iagapie/cards-system | src/services/board/src/Board.Infrastructure/EntityConfigurations/MemberEntityTypeConfiguration.cs | 1,794 | C# |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Network.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Information on the configuration of flow log and traffic analytics
/// (optional) .
/// </summary>
[Rest.Serialization.JsonTransformation]
public partial class FlowLogInformation
{
/// <summary>
/// Initializes a new instance of the FlowLogInformation class.
/// </summary>
public FlowLogInformation()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the FlowLogInformation class.
/// </summary>
/// <param name="targetResourceId">The ID of the resource to configure
/// for flow log and traffic analytics (optional) .</param>
/// <param name="storageId">ID of the storage account which is used to
/// store the flow log.</param>
/// <param name="enabled">Flag to enable/disable flow logging.</param>
public FlowLogInformation(string targetResourceId, string storageId, bool enabled, RetentionPolicyParameters retentionPolicy = default(RetentionPolicyParameters), TrafficAnalyticsProperties flowAnalyticsConfiguration = default(TrafficAnalyticsProperties))
{
TargetResourceId = targetResourceId;
StorageId = storageId;
Enabled = enabled;
RetentionPolicy = retentionPolicy;
FlowAnalyticsConfiguration = flowAnalyticsConfiguration;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the ID of the resource to configure for flow log and
/// traffic analytics (optional) .
/// </summary>
[JsonProperty(PropertyName = "targetResourceId")]
public string TargetResourceId { get; set; }
/// <summary>
/// Gets or sets ID of the storage account which is used to store the
/// flow log.
/// </summary>
[JsonProperty(PropertyName = "properties.storageId")]
public string StorageId { get; set; }
/// <summary>
/// Gets or sets flag to enable/disable flow logging.
/// </summary>
[JsonProperty(PropertyName = "properties.enabled")]
public bool Enabled { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "properties.retentionPolicy")]
public RetentionPolicyParameters RetentionPolicy { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "flowAnalyticsConfiguration")]
public TrafficAnalyticsProperties FlowAnalyticsConfiguration { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (TargetResourceId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceId");
}
if (StorageId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "StorageId");
}
if (FlowAnalyticsConfiguration != null)
{
FlowAnalyticsConfiguration.Validate();
}
}
}
}
| 36.385321 | 263 | 0.614473 | [
"MIT"
] | 216Giorgiy/azure-sdk-for-net | src/SDKs/Network/Management.Network/Generated/Models/FlowLogInformation.cs | 3,966 | C# |
using Microsoft.ML.Data;
using Microsoft.ML.Transforms.Image;
using System.Drawing;
namespace YOLOV3MLNetSO.DataStructures
{
public class YoloV3BitmapData
{
[ColumnName("bitmap")]
[ImageType(416, 416)]
public Bitmap Image { get; set; }
[ColumnName("width")]
public float ImageWidth => Image.Width;
[ColumnName("height")]
public float ImageHeight => Image.Height;
}
}
| 21.95 | 49 | 0.640091 | [
"MIT"
] | BobLd/YOLOv3MLNet | YOLOV3MLNetSO/DataStructures/YoloV3BitmapData.cs | 441 | C# |
using System.Collections;
using System.Collections.Generic;
using System;
using NetRuntimeSystem = System;
using System.ComponentModel;
using NetOffice.Attributes;
using NetOffice.CollectionsGeneric;
using NetOffice.OutlookApi;
namespace NetOffice.OutlookApi.Behind
{
/// <summary>
/// DispatchInterface Pages
/// SupportByVersion Outlook, 9,10,11,12,14,15,16
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff869772.aspx </remarks>
public class Pages : COMObject, NetOffice.OutlookApi.Pages
{
#pragma warning disable
#region Type Information
/// <summary>
/// Contract Type
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden]
public override Type ContractType
{
get
{
if(null == _contractType)
_contractType = typeof(NetOffice.OutlookApi.Pages);
return _contractType;
}
}
private static Type _contractType;
/// <summary>
/// Instance Type
/// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden]
public override Type InstanceType
{
get
{
return LateBindingApiWrapperType;
}
}
private static Type _type;
[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
public static Type LateBindingApiWrapperType
{
get
{
if (null == _type)
_type = typeof(Pages);
return _type;
}
}
#endregion
#region Ctor
/// <summary>
/// Stub Ctor, not indented to use
/// </summary>
public Pages() : base()
{
}
#endregion
#region Properties
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// Get
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff861598.aspx </remarks>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
[BaseResult]
public virtual NetOffice.OutlookApi._Application Application
{
get
{
return InvokerService.InvokeInternal.ExecuteBaseReferencePropertyGet<NetOffice.OutlookApi._Application>(this, "Application");
}
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// Get
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff864422.aspx </remarks>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
public virtual NetOffice.OutlookApi.Enums.OlObjectClass Class
{
get
{
return InvokerService.InvokeInternal.ExecuteEnumPropertyGet<NetOffice.OutlookApi.Enums.OlObjectClass>(this, "Class");
}
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// Get
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff869177.aspx </remarks>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
[BaseResult]
public virtual NetOffice.OutlookApi._NameSpace Session
{
get
{
return InvokerService.InvokeInternal.ExecuteBaseReferencePropertyGet<NetOffice.OutlookApi._NameSpace>(this, "Session");
}
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// Get
/// Unknown COM Proxy
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff866038.aspx </remarks>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16), ProxyResult]
public virtual object Parent
{
get
{
return InvokerService.InvokeInternal.ExecuteReferencePropertyGet(this, "Parent");
}
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// Get
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff869854.aspx </remarks>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
public virtual Int32 Count
{
get
{
return InvokerService.InvokeInternal.ExecuteInt32PropertyGet(this, "Count");
}
}
#endregion
#region Methods
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <param name="index">object index</param>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
[NetRuntimeSystem.Runtime.CompilerServices.IndexerName("Item"), IndexProperty]
public virtual object this[object index]
{
get
{
return InvokerService.InvokeInternal.ExecuteVariantMethodGet(this, "Item", index);
}
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff864465.aspx </remarks>
/// <param name="name">optional object name</param>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
public virtual object Add(object name)
{
return InvokerService.InvokeInternal.ExecuteVariantMethodGet(this, "Add", name);
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff864465.aspx </remarks>
[CustomMethod]
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
public virtual object Add()
{
return InvokerService.InvokeInternal.ExecuteVariantMethodGet(this, "Add");
}
/// <summary>
/// SupportByVersion Outlook 9, 10, 11, 12, 14, 15, 16
/// </summary>
/// <remarks> MSDN Online: http://msdn.microsoft.com/en-us/en-us/library/office/ff862212.aspx </remarks>
/// <param name="index">Int32 index</param>
[SupportByVersion("Outlook", 9,10,11,12,14,15,16)]
public virtual void Remove(Int32 index)
{
InvokerService.InvokeInternal.ExecuteMethod(this, "Remove", index);
}
#endregion
#region IEnumerableProvider<object>
ICOMObject IEnumerableProvider<object>.GetComObjectEnumerator(ICOMObject parent)
{
return this;
}
IEnumerable IEnumerableProvider<object>.FetchVariantComObjectEnumerator(ICOMObject parent, ICOMObject enumerator)
{
NetRuntimeSystem.Collections.IEnumerable innerEnumerator = (this as NetRuntimeSystem.Collections.IEnumerable);
foreach (NetOffice.OutlookApi.Link item in innerEnumerator)
yield return item;
}
#endregion
#region IEnumerable<object>
/// <summary>
/// SupportByVersion Outlook, 9,10,11,12,14,15,16
/// This is a custom enumerator from NetOffice
/// </summary>
[SupportByVersion("Outlook", 9, 10, 11, 12, 14, 15, 16)]
[CustomEnumerator]
public virtual IEnumerator<object> GetEnumerator()
{
NetRuntimeSystem.Collections.IEnumerable innerEnumerator = (this as NetRuntimeSystem.Collections.IEnumerable);
foreach (object item in innerEnumerator)
yield return item;
}
#endregion
#region IEnumerable
/// <summary>
/// SupportByVersion Outlook, 9,10,11,12,14,15,16
/// This is a custom enumerator from NetOffice
/// </summary>
[SupportByVersion("Outlook", 9, 10, 11, 12, 14, 15, 16)]
[CustomEnumerator]
IEnumerator NetRuntimeSystem.Collections.IEnumerable.GetEnumerator()
{
int count = Count;
object[] enumeratorObjects = new object[count];
for (int i = 0; i < count; i++)
enumeratorObjects[i] = this[i + 1];
foreach (object item in enumeratorObjects)
yield return item;
}
#endregion
#pragma warning restore
}
}
| 29.543726 | 129 | 0.644402 | [
"MIT"
] | igoreksiz/NetOffice | Source/Outlook/Behind/DispatchInterfaces/Pages.cs | 7,772 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dice.DAL.Interfaces
{
public interface IUnitOfWork : IDisposable
{
IPlayerRepository PlayerRepo { get; }
IGameRepository GameRepo { get; }
IDiceRepository DiceRepo { get; }
IPlayerSessionRepository PlayerSessionRepo { get; }
IStepRepository StepRepo { get; }
IRoundRepository RoundRepo { get; }
void Save();
}
}
| 26.35 | 60 | 0.656546 | [
"MIT"
] | P-Hayk/Dice | Dice/Dice/Dice.DAL/Interfaces/IUnitOfWork.cs | 529 | C# |
using RestSharp;
using System;
using System.Collections.Generic;
using System.Net;
using Syncfusion.Dashboard.Server.Api.Helper.Utilities;
using Syncfusion.Dashboard.Server.Api.Helper.Authentication;
namespace Syncfusion.Dashboard.Server.API.Helper
{
public class ServerApiHelper
{
private Authenticate _authenticator;
public string BaseUrl { get; set; }
/// <summary>
///
/// </summary>
/// <param name="serverUrl"></param>
/// <param name="username"></param>
/// <param name="password"></param>
public OAuth2 Connect(string serverUrl, string username, string password)
{
_authenticator = new OAuth2(serverUrl, username, password);
((OAuth2)_authenticator).GetToken();
return (OAuth2)_authenticator;
}
private DataResponse<T> Send<T>(T body, Method method, string overrideUrl = null, Dictionary<string, object> requestParameters = null)
{
var relativeUrl = overrideUrl;
DataResponse<T> response;
try
{
response = _authenticator.GetResponse(relativeUrl, method, body, requestParameters);
}
catch (WebException ex)
{
Console.WriteLine(ex.Message);
response = default(DataResponse<T>);
}
return response;
}
internal DataResponse<T> Get<T>(T body, string overrideUrl, object requestParameters = null)
{
var parameterDictionary = requestParameters.ToDictionary();
return Send(body, Method.GET, overrideUrl, parameterDictionary);
}
internal DataResponse<T> Post<T>(T body, string overrideUrl, object requestParameters = null)
{
var parameterDictionary = requestParameters.ToDictionary();
return Send(body, Method.POST, overrideUrl, parameterDictionary);
}
internal DataResponse<T> Put<T>(T body, string overrideUrl, object requestParameters = null)
{
var parameterDictionary = requestParameters.ToDictionary();
return Send(body, Method.PUT, overrideUrl, parameterDictionary);
}
internal DataResponse<T> Delete<T>(T body, string overrideUrl, object requestParameters = null)
{
var parameterDictionary = requestParameters.ToDictionary();
return Send(body, Method.DELETE, overrideUrl, parameterDictionary);
}
}
}
| 36.042857 | 142 | 0.623464 | [
"MIT"
] | mohamedaslamm/enterpriseserver-dashboardapiclient | Src/API.Helper/ServerApiHelper.cs | 2,525 | C# |
using UnityEngine;
namespace Avoidance
{
/// <summary>
/// Responsible for playing background audio music for main menu, game scene, and game over scene.
/// </summary>
public class BGMManager : MonoBehaviour
{
/// <summary>
/// Clip to play during game scene.
/// </summary>
public AudioClip audioGameClip;
/// <summary>
/// Clip to play during the main menu.
/// </summary>
public AudioClip audioUIClip;
/// <summary>
/// Clip to play during the game over scene.
/// </summary>
public AudioClip gameOverClip;
/// <summary>
/// Time to fade between clips.
/// </summary>
public float fadeTime = 1f;
/// <summary>
/// Plays the user interface audio.
/// </summary>
public void PlayUIAudio()
{
if (audioUIClip != null)
{
MusicAudioPlayer.instance.Play(audioUIClip, fadeTime);
}
}
/// <summary>
/// Plays the game audio.
/// </summary>
public void PlayGameAudio()
{
if (audioGameClip != null)
{
MusicAudioPlayer.instance.Play(audioGameClip, fadeTime);
}
}
/// <summary>
/// Plays the game over audio.
/// </summary>
public void PlayGameOverAudio()
{
if(gameOverClip != null)
{
MusicAudioPlayer.instance.Play(gameOverClip, fadeTime);
}
}
}
} | 24.174603 | 102 | 0.523966 | [
"MIT"
] | canerozdemirr/Avoid-Remake | Assets/Avoid/Scripts/Audio/BGMManager.cs | 1,525 | C# |
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace LubyTasks.Domain.Utils
{
public class OperationResult<T>
{
public T[] Data { get; set; }
public HttpStatusCode? StatusCode { get; set; }
public string ErrorMessage { get; set; }
public int? TotalRows { get; set; }
public OperationResult(HttpStatusCode statusCode, IEnumerable<T> data)
{
Data = data?.ToArray();
TotalRows = Data?.Count();
StatusCode = statusCode;
}
public OperationResult(HttpStatusCode statusCode, string errorMessage)
{
TotalRows = Data?.Length;
StatusCode = statusCode;
ErrorMessage = errorMessage;
}
public OperationResult(HttpStatusCode statusCode, int totalRows)
{
TotalRows = totalRows;
StatusCode = statusCode;
}
public object GetTokenResult(object token)
{
return new
{
TotalRows,
Data = new[] { token },
StatusCode,
ErrorMessage
};
}
}
}
| 25.804348 | 78 | 0.543387 | [
"Apache-2.0"
] | vanderley1998/luby_tasks | LubyTasks.Domain/Utils/OperationResult.cs | 1,189 | 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 ecs-2014-11-13.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Net;
using Amazon.ECS.Model;
using Amazon.ECS.Model.Internal.MarshallTransformations;
using Amazon.ECS.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.ECS
{
/// <summary>
/// Implementation for accessing ECS
///
/// Amazon Elastic Container Service
/// <para>
/// Amazon Elastic Container Service (Amazon ECS) is a highly scalable, fast, container
/// management service that makes it easy to run, stop, and manage Docker containers on
/// a cluster. You can host your cluster on a serverless infrastructure that is managed
/// by Amazon ECS by launching your services or tasks using the Fargate launch type. For
/// more control, you can host your tasks on a cluster of Amazon Elastic Compute Cloud
/// (Amazon EC2) instances that you manage by using the EC2 launch type. For more information
/// about launch types, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html">Amazon
/// ECS Launch Types</a>.
/// </para>
///
/// <para>
/// Amazon ECS lets you launch and stop container-based applications with simple API calls,
/// allows you to get the state of your cluster from a centralized service, and gives
/// you access to many familiar Amazon EC2 features.
/// </para>
///
/// <para>
/// You can use Amazon ECS to schedule the placement of containers across your cluster
/// based on your resource needs, isolation policies, and availability requirements. Amazon
/// ECS eliminates the need for you to operate your own cluster management and configuration
/// management systems or worry about scaling your management infrastructure.
/// </para>
/// </summary>
public partial class AmazonECSClient : AmazonServiceClient, IAmazonECS
{
private static IServiceMetadata serviceMetadata = new AmazonECSMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonECSClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
public AmazonECSClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonECSConfig()) { }
/// <summary>
/// Constructs AmazonECSClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="region">The region to connect.</param>
public AmazonECSClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonECSConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonECSClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonECSClient Configuration Object</param>
public AmazonECSClient(AmazonECSConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonECSClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonECSClient(AWSCredentials credentials)
: this(credentials, new AmazonECSConfig())
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonECSClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonECSConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Credentials and an
/// AmazonECSClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonECSClient Configuration Object</param>
public AmazonECSClient(AWSCredentials credentials, AmazonECSConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonECSConfig())
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="region">The region to connect.</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonECSConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonECSClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonECSClient Configuration Object</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonECSConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonECSConfig())
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="region">The region to connect.</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonECSConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonECSClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonECSClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonECSClient Configuration Object</param>
public AmazonECSClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonECSConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region CreateCapacityProvider
/// <summary>
/// Creates a new capacity provider. Capacity providers are associated with an Amazon
/// ECS cluster and are used in capacity provider strategies to facilitate cluster auto
/// scaling.
///
///
/// <para>
/// Only capacity providers using an Auto Scaling group can be created. Amazon ECS tasks
/// on AWS Fargate use the <code>FARGATE</code> and <code>FARGATE_SPOT</code> capacity
/// providers which are already created and available to all accounts in Regions supported
/// by AWS Fargate.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateCapacityProvider service method.</param>
///
/// <returns>The response from the CreateCapacityProvider service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.LimitExceededException">
/// The limit for the resource has been exceeded.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UpdateInProgressException">
/// There is already a current Amazon ECS container agent update in progress on the specified
/// container instance. If the container agent becomes disconnected while it is in a transitional
/// stage, such as <code>PENDING</code> or <code>STAGING</code>, the update process can
/// get stuck in that state. However, when the agent reconnects, it resumes where it stopped
/// previously.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCapacityProvider">REST API Reference for CreateCapacityProvider Operation</seealso>
public virtual CreateCapacityProviderResponse CreateCapacityProvider(CreateCapacityProviderRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateCapacityProviderResponseUnmarshaller.Instance;
return Invoke<CreateCapacityProviderResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateCapacityProvider operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateCapacityProvider operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateCapacityProvider
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCapacityProvider">REST API Reference for CreateCapacityProvider Operation</seealso>
public virtual IAsyncResult BeginCreateCapacityProvider(CreateCapacityProviderRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateCapacityProviderResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateCapacityProvider operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateCapacityProvider.</param>
///
/// <returns>Returns a CreateCapacityProviderResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCapacityProvider">REST API Reference for CreateCapacityProvider Operation</seealso>
public virtual CreateCapacityProviderResponse EndCreateCapacityProvider(IAsyncResult asyncResult)
{
return EndInvoke<CreateCapacityProviderResponse>(asyncResult);
}
#endregion
#region CreateCluster
/// <summary>
/// Creates a new Amazon ECS cluster. By default, your account receives a <code>default</code>
/// cluster when you launch your first container instance. However, you can create your
/// own cluster with a unique name with the <code>CreateCluster</code> action.
///
/// <note>
/// <para>
/// When you call the <a>CreateCluster</a> API operation, Amazon ECS attempts to create
/// the Amazon ECS service-linked role for your account so that required resources in
/// other AWS services can be managed on your behalf. However, if the IAM user that makes
/// the call does not have permissions to create the service-linked role, it is not created.
/// For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using-service-linked-roles.html">Using
/// Service-Linked Roles for Amazon ECS</a> in the <i>Amazon Elastic Container Service
/// Developer Guide</i>.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateCluster service method.</param>
///
/// <returns>The response from the CreateCluster service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCluster">REST API Reference for CreateCluster Operation</seealso>
public virtual CreateClusterResponse CreateCluster(CreateClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateClusterResponseUnmarshaller.Instance;
return Invoke<CreateClusterResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateCluster operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateCluster operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateCluster
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCluster">REST API Reference for CreateCluster Operation</seealso>
public virtual IAsyncResult BeginCreateCluster(CreateClusterRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateClusterResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateCluster operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateCluster.</param>
///
/// <returns>Returns a CreateClusterResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateCluster">REST API Reference for CreateCluster Operation</seealso>
public virtual CreateClusterResponse EndCreateCluster(IAsyncResult asyncResult)
{
return EndInvoke<CreateClusterResponse>(asyncResult);
}
#endregion
#region CreateService
/// <summary>
/// Runs and maintains a desired number of tasks from a specified task definition. If
/// the number of tasks running in a service drops below the <code>desiredCount</code>,
/// Amazon ECS runs another copy of the task in the specified cluster. To update an existing
/// service, see the UpdateService action.
///
///
/// <para>
/// In addition to maintaining the desired count of tasks in your service, you can optionally
/// run your service behind one or more load balancers. The load balancers distribute
/// traffic across the tasks that are associated with the service. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html">Service
/// Load Balancing</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
///
/// <para>
/// Tasks for services that <i>do not</i> use a load balancer are considered healthy if
/// they're in the <code>RUNNING</code> state. Tasks for services that <i>do</i> use a
/// load balancer are considered healthy if they're in the <code>RUNNING</code> state
/// and the container instance that they're hosted on is reported as healthy by the load
/// balancer.
/// </para>
///
/// <para>
/// There are two service scheduler strategies available:
/// </para>
/// <ul> <li>
/// <para>
/// <code>REPLICA</code> - The replica scheduling strategy places and maintains the desired
/// number of tasks across your cluster. By default, the service scheduler spreads tasks
/// across Availability Zones. You can use task placement strategies and constraints to
/// customize task placement decisions. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html">Service
/// Scheduler Concepts</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
/// </li> <li>
/// <para>
/// <code>DAEMON</code> - The daemon scheduling strategy deploys exactly one task on
/// each active container instance that meets all of the task placement constraints that
/// you specify in your cluster. The service scheduler also evaluates the task placement
/// constraints for running tasks and will stop tasks that do not meet the placement constraints.
/// When using this strategy, you don't need to specify a desired number of tasks, a task
/// placement strategy, or use Service Auto Scaling policies. For more information, see
/// <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html">Service
/// Scheduler Concepts</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
/// </li> </ul>
/// <para>
/// You can optionally specify a deployment configuration for your service. The deployment
/// is triggered by changing properties, such as the task definition or the desired count
/// of a service, with an <a>UpdateService</a> operation. The default value for a replica
/// service for <code>minimumHealthyPercent</code> is 100%. The default value for a daemon
/// service for <code>minimumHealthyPercent</code> is 0%.
/// </para>
///
/// <para>
/// If a service is using the <code>ECS</code> deployment controller, the minimum healthy
/// percent represents a lower limit on the number of tasks in a service that must remain
/// in the <code>RUNNING</code> state during a deployment, as a percentage of the desired
/// number of tasks (rounded up to the nearest integer), and while any container instances
/// are in the <code>DRAINING</code> state if the service contains tasks using the EC2
/// launch type. This parameter enables you to deploy without using additional cluster
/// capacity. For example, if your service has a desired number of four tasks and a minimum
/// healthy percent of 50%, the scheduler might stop two existing tasks to free up cluster
/// capacity before starting two new tasks. Tasks for services that <i>do not</i> use
/// a load balancer are considered healthy if they're in the <code>RUNNING</code> state.
/// Tasks for services that <i>do</i> use a load balancer are considered healthy if they're
/// in the <code>RUNNING</code> state and they're reported as healthy by the load balancer.
/// The default value for minimum healthy percent is 100%.
/// </para>
///
/// <para>
/// If a service is using the <code>ECS</code> deployment controller, the <b>maximum percent</b>
/// parameter represents an upper limit on the number of tasks in a service that are allowed
/// in the <code>RUNNING</code> or <code>PENDING</code> state during a deployment, as
/// a percentage of the desired number of tasks (rounded down to the nearest integer),
/// and while any container instances are in the <code>DRAINING</code> state if the service
/// contains tasks using the EC2 launch type. This parameter enables you to define the
/// deployment batch size. For example, if your service has a desired number of four tasks
/// and a maximum percent value of 200%, the scheduler may start four new tasks before
/// stopping the four older tasks (provided that the cluster resources required to do
/// this are available). The default value for maximum percent is 200%.
/// </para>
///
/// <para>
/// If a service is using either the <code>CODE_DEPLOY</code> or <code>EXTERNAL</code>
/// deployment controller types and tasks that use the EC2 launch type, the <b>minimum
/// healthy percent</b> and <b>maximum percent</b> values are used only to define the
/// lower and upper limit on the number of the tasks in the service that remain in the
/// <code>RUNNING</code> state while the container instances are in the <code>DRAINING</code>
/// state. If the tasks in the service use the Fargate launch type, the minimum healthy
/// percent and maximum percent values aren't used, although they're currently visible
/// when describing your service.
/// </para>
///
/// <para>
/// When creating a service that uses the <code>EXTERNAL</code> deployment controller,
/// you can specify only parameters that aren't controlled at the task set level. The
/// only required parameter is the service name. You control your services using the <a>CreateTaskSet</a>
/// operation. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
///
/// <para>
/// When the service scheduler launches new tasks, it determines task placement in your
/// cluster using the following logic:
/// </para>
/// <ul> <li>
/// <para>
/// Determine which of the container instances in your cluster can support your service's
/// task definition (for example, they have the required CPU, memory, ports, and container
/// instance attributes).
/// </para>
/// </li> <li>
/// <para>
/// By default, the service scheduler attempts to balance tasks across Availability Zones
/// in this manner (although you can choose a different placement strategy) with the <code>placementStrategy</code>
/// parameter):
/// </para>
/// <ul> <li>
/// <para>
/// Sort the valid container instances, giving priority to instances that have the fewest
/// number of running tasks for this service in their respective Availability Zone. For
/// example, if zone A has one running service task and zones B and C each have zero,
/// valid container instances in either zone B or C are considered optimal for placement.
/// </para>
/// </li> <li>
/// <para>
/// Place the new service task on a valid container instance in an optimal Availability
/// Zone (based on the previous steps), favoring container instances with the fewest number
/// of running tasks for this service.
/// </para>
/// </li> </ul> </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateService service method.</param>
///
/// <returns>The response from the CreateService service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformTaskDefinitionIncompatibilityException">
/// The specified platform version does not satisfy the task definition's required capabilities.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformUnknownException">
/// The specified platform version does not exist.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateService">REST API Reference for CreateService Operation</seealso>
public virtual CreateServiceResponse CreateService(CreateServiceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateServiceResponseUnmarshaller.Instance;
return Invoke<CreateServiceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateService operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateService operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateService
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateService">REST API Reference for CreateService Operation</seealso>
public virtual IAsyncResult BeginCreateService(CreateServiceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateServiceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateService operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateService.</param>
///
/// <returns>Returns a CreateServiceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateService">REST API Reference for CreateService Operation</seealso>
public virtual CreateServiceResponse EndCreateService(IAsyncResult asyncResult)
{
return EndInvoke<CreateServiceResponse>(asyncResult);
}
#endregion
#region CreateTaskSet
/// <summary>
/// Create a task set in the specified cluster and service. This is used when a service
/// uses the <code>EXTERNAL</code> deployment controller type. For more information, see
/// <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateTaskSet service method.</param>
///
/// <returns>The response from the CreateTaskSet service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformTaskDefinitionIncompatibilityException">
/// The specified platform version does not satisfy the task definition's required capabilities.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformUnknownException">
/// The specified platform version does not exist.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateTaskSet">REST API Reference for CreateTaskSet Operation</seealso>
public virtual CreateTaskSetResponse CreateTaskSet(CreateTaskSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateTaskSetResponseUnmarshaller.Instance;
return Invoke<CreateTaskSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateTaskSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateTaskSet operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateTaskSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateTaskSet">REST API Reference for CreateTaskSet Operation</seealso>
public virtual IAsyncResult BeginCreateTaskSet(CreateTaskSetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateTaskSetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateTaskSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateTaskSet.</param>
///
/// <returns>Returns a CreateTaskSetResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/CreateTaskSet">REST API Reference for CreateTaskSet Operation</seealso>
public virtual CreateTaskSetResponse EndCreateTaskSet(IAsyncResult asyncResult)
{
return EndInvoke<CreateTaskSetResponse>(asyncResult);
}
#endregion
#region DeleteAccountSetting
/// <summary>
/// Disables an account setting for a specified IAM user, IAM role, or the root user for
/// an account.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteAccountSetting service method.</param>
///
/// <returns>The response from the DeleteAccountSetting service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAccountSetting">REST API Reference for DeleteAccountSetting Operation</seealso>
public virtual DeleteAccountSettingResponse DeleteAccountSetting(DeleteAccountSettingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAccountSettingRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAccountSettingResponseUnmarshaller.Instance;
return Invoke<DeleteAccountSettingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteAccountSetting operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteAccountSetting operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteAccountSetting
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAccountSetting">REST API Reference for DeleteAccountSetting Operation</seealso>
public virtual IAsyncResult BeginDeleteAccountSetting(DeleteAccountSettingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAccountSettingRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAccountSettingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteAccountSetting operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteAccountSetting.</param>
///
/// <returns>Returns a DeleteAccountSettingResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAccountSetting">REST API Reference for DeleteAccountSetting Operation</seealso>
public virtual DeleteAccountSettingResponse EndDeleteAccountSetting(IAsyncResult asyncResult)
{
return EndInvoke<DeleteAccountSettingResponse>(asyncResult);
}
#endregion
#region DeleteAttributes
/// <summary>
/// Deletes one or more custom attributes from an Amazon ECS resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteAttributes service method.</param>
///
/// <returns>The response from the DeleteAttributes service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.TargetNotFoundException">
/// The specified target could not be found. You can view your available container instances
/// with <a>ListContainerInstances</a>. Amazon ECS container instances are cluster-specific
/// and Region-specific.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAttributes">REST API Reference for DeleteAttributes Operation</seealso>
public virtual DeleteAttributesResponse DeleteAttributes(DeleteAttributesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAttributesResponseUnmarshaller.Instance;
return Invoke<DeleteAttributesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteAttributes operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAttributes">REST API Reference for DeleteAttributes Operation</seealso>
public virtual IAsyncResult BeginDeleteAttributes(DeleteAttributesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteAttributesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteAttributes.</param>
///
/// <returns>Returns a DeleteAttributesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteAttributes">REST API Reference for DeleteAttributes Operation</seealso>
public virtual DeleteAttributesResponse EndDeleteAttributes(IAsyncResult asyncResult)
{
return EndInvoke<DeleteAttributesResponse>(asyncResult);
}
#endregion
#region DeleteCapacityProvider
/// <summary>
/// Deletes the specified capacity provider.
///
/// <note>
/// <para>
/// The <code>FARGATE</code> and <code>FARGATE_SPOT</code> capacity providers are reserved
/// and cannot be deleted. You can disassociate them from a cluster using either the <a>PutClusterCapacityProviders</a>
/// API or by deleting the cluster.
/// </para>
/// </note>
/// <para>
/// Prior to a capacity provider being deleted, the capacity provider must be removed
/// from the capacity provider strategy from all services. The <a>UpdateService</a> API
/// can be used to remove a capacity provider from a service's capacity provider strategy.
/// When updating a service, the <code>forceNewDeployment</code> option can be used to
/// ensure that any tasks using the Amazon EC2 instance capacity provided by the capacity
/// provider are transitioned to use the capacity from the remaining capacity providers.
/// Only capacity providers that are not associated with a cluster can be deleted. To
/// remove a capacity provider from a cluster, you can either use <a>PutClusterCapacityProviders</a>
/// or delete the cluster.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteCapacityProvider service method.</param>
///
/// <returns>The response from the DeleteCapacityProvider service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCapacityProvider">REST API Reference for DeleteCapacityProvider Operation</seealso>
public virtual DeleteCapacityProviderResponse DeleteCapacityProvider(DeleteCapacityProviderRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteCapacityProviderResponseUnmarshaller.Instance;
return Invoke<DeleteCapacityProviderResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteCapacityProvider operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteCapacityProvider operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteCapacityProvider
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCapacityProvider">REST API Reference for DeleteCapacityProvider Operation</seealso>
public virtual IAsyncResult BeginDeleteCapacityProvider(DeleteCapacityProviderRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteCapacityProviderResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteCapacityProvider operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteCapacityProvider.</param>
///
/// <returns>Returns a DeleteCapacityProviderResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCapacityProvider">REST API Reference for DeleteCapacityProvider Operation</seealso>
public virtual DeleteCapacityProviderResponse EndDeleteCapacityProvider(IAsyncResult asyncResult)
{
return EndInvoke<DeleteCapacityProviderResponse>(asyncResult);
}
#endregion
#region DeleteCluster
/// <summary>
/// Deletes the specified cluster. The cluster will transition to the <code>INACTIVE</code>
/// state. Clusters with an <code>INACTIVE</code> status may remain discoverable in your
/// account for a period of time. However, this behavior is subject to change in the future,
/// so you should not rely on <code>INACTIVE</code> clusters persisting.
///
///
/// <para>
/// You must deregister all container instances from this cluster before you may delete
/// it. You can list the container instances in a cluster with <a>ListContainerInstances</a>
/// and deregister them with <a>DeregisterContainerInstance</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteCluster service method.</param>
///
/// <returns>The response from the DeleteCluster service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterContainsContainerInstancesException">
/// You cannot delete a cluster that has registered container instances. First, deregister
/// the container instances before you can delete the cluster. For more information, see
/// <a>DeregisterContainerInstance</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterContainsServicesException">
/// You cannot delete a cluster that contains services. First, update the service to reduce
/// its desired task count to 0 and then delete the service. For more information, see
/// <a>UpdateService</a> and <a>DeleteService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterContainsTasksException">
/// You cannot delete a cluster that has active tasks.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UpdateInProgressException">
/// There is already a current Amazon ECS container agent update in progress on the specified
/// container instance. If the container agent becomes disconnected while it is in a transitional
/// stage, such as <code>PENDING</code> or <code>STAGING</code>, the update process can
/// get stuck in that state. However, when the agent reconnects, it resumes where it stopped
/// previously.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCluster">REST API Reference for DeleteCluster Operation</seealso>
public virtual DeleteClusterResponse DeleteCluster(DeleteClusterRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteClusterResponseUnmarshaller.Instance;
return Invoke<DeleteClusterResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteCluster operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteCluster operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteCluster
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCluster">REST API Reference for DeleteCluster Operation</seealso>
public virtual IAsyncResult BeginDeleteCluster(DeleteClusterRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteClusterRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteClusterResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteCluster operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteCluster.</param>
///
/// <returns>Returns a DeleteClusterResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteCluster">REST API Reference for DeleteCluster Operation</seealso>
public virtual DeleteClusterResponse EndDeleteCluster(IAsyncResult asyncResult)
{
return EndInvoke<DeleteClusterResponse>(asyncResult);
}
#endregion
#region DeleteService
/// <summary>
/// Deletes a specified service within a cluster. You can delete a service if you have
/// no running tasks in it and the desired task count is zero. If the service is actively
/// maintaining tasks, you cannot delete it, and you must update the service to a desired
/// task count of zero. For more information, see <a>UpdateService</a>.
///
/// <note>
/// <para>
/// When you delete a service, if there are still running tasks that require cleanup,
/// the service status moves from <code>ACTIVE</code> to <code>DRAINING</code>, and the
/// service is no longer visible in the console or in the <a>ListServices</a> API operation.
/// After all tasks have transitioned to either <code>STOPPING</code> or <code>STOPPED</code>
/// status, the service status moves from <code>DRAINING</code> to <code>INACTIVE</code>.
/// Services in the <code>DRAINING</code> or <code>INACTIVE</code> status can still be
/// viewed with the <a>DescribeServices</a> API operation. However, in the future, <code>INACTIVE</code>
/// services may be cleaned up and purged from Amazon ECS record keeping, and <a>DescribeServices</a>
/// calls on those services return a <code>ServiceNotFoundException</code> error.
/// </para>
/// </note> <important>
/// <para>
/// If you attempt to create a new service with the same name as an existing service in
/// either <code>ACTIVE</code> or <code>DRAINING</code> status, you receive an error.
/// </para>
/// </important>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteService service method.</param>
///
/// <returns>The response from the DeleteService service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteService">REST API Reference for DeleteService Operation</seealso>
public virtual DeleteServiceResponse DeleteService(DeleteServiceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteServiceResponseUnmarshaller.Instance;
return Invoke<DeleteServiceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteService operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteService operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteService
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteService">REST API Reference for DeleteService Operation</seealso>
public virtual IAsyncResult BeginDeleteService(DeleteServiceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteServiceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteService operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteService.</param>
///
/// <returns>Returns a DeleteServiceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteService">REST API Reference for DeleteService Operation</seealso>
public virtual DeleteServiceResponse EndDeleteService(IAsyncResult asyncResult)
{
return EndInvoke<DeleteServiceResponse>(asyncResult);
}
#endregion
#region DeleteTaskSet
/// <summary>
/// Deletes a specified task set within a service. This is used when a service uses the
/// <code>EXTERNAL</code> deployment controller type. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteTaskSet service method.</param>
///
/// <returns>The response from the DeleteTaskSet service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.TaskSetNotFoundException">
/// The specified task set could not be found. You can view your available task sets with
/// <a>DescribeTaskSets</a>. Task sets are specific to each cluster, service and Region.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteTaskSet">REST API Reference for DeleteTaskSet Operation</seealso>
public virtual DeleteTaskSetResponse DeleteTaskSet(DeleteTaskSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteTaskSetResponseUnmarshaller.Instance;
return Invoke<DeleteTaskSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteTaskSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteTaskSet operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteTaskSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteTaskSet">REST API Reference for DeleteTaskSet Operation</seealso>
public virtual IAsyncResult BeginDeleteTaskSet(DeleteTaskSetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteTaskSetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteTaskSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteTaskSet.</param>
///
/// <returns>Returns a DeleteTaskSetResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeleteTaskSet">REST API Reference for DeleteTaskSet Operation</seealso>
public virtual DeleteTaskSetResponse EndDeleteTaskSet(IAsyncResult asyncResult)
{
return EndInvoke<DeleteTaskSetResponse>(asyncResult);
}
#endregion
#region DeregisterContainerInstance
/// <summary>
/// Deregisters an Amazon ECS container instance from the specified cluster. This instance
/// is no longer available to run tasks.
///
///
/// <para>
/// If you intend to use the container instance for some other purpose after deregistration,
/// you should stop all of the tasks running on the container instance before deregistration.
/// That prevents any orphaned tasks from consuming resources.
/// </para>
///
/// <para>
/// Deregistering a container instance removes the instance from a cluster, but it does
/// not terminate the EC2 instance. If you are finished using the instance, be sure to
/// terminate it in the Amazon EC2 console to stop billing.
/// </para>
/// <note>
/// <para>
/// If you terminate a running container instance, Amazon ECS automatically deregisters
/// the instance from your cluster (stopped container instances or instances with disconnected
/// agents are not automatically deregistered when terminated).
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeregisterContainerInstance service method.</param>
///
/// <returns>The response from the DeregisterContainerInstance service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterContainerInstance">REST API Reference for DeregisterContainerInstance Operation</seealso>
public virtual DeregisterContainerInstanceResponse DeregisterContainerInstance(DeregisterContainerInstanceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeregisterContainerInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeregisterContainerInstanceResponseUnmarshaller.Instance;
return Invoke<DeregisterContainerInstanceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeregisterContainerInstance operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeregisterContainerInstance operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeregisterContainerInstance
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterContainerInstance">REST API Reference for DeregisterContainerInstance Operation</seealso>
public virtual IAsyncResult BeginDeregisterContainerInstance(DeregisterContainerInstanceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeregisterContainerInstanceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeregisterContainerInstanceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeregisterContainerInstance operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeregisterContainerInstance.</param>
///
/// <returns>Returns a DeregisterContainerInstanceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterContainerInstance">REST API Reference for DeregisterContainerInstance Operation</seealso>
public virtual DeregisterContainerInstanceResponse EndDeregisterContainerInstance(IAsyncResult asyncResult)
{
return EndInvoke<DeregisterContainerInstanceResponse>(asyncResult);
}
#endregion
#region DeregisterTaskDefinition
/// <summary>
/// Deregisters the specified task definition by family and revision. Upon deregistration,
/// the task definition is marked as <code>INACTIVE</code>. Existing tasks and services
/// that reference an <code>INACTIVE</code> task definition continue to run without disruption.
/// Existing services that reference an <code>INACTIVE</code> task definition can still
/// scale up or down by modifying the service's desired count.
///
///
/// <para>
/// You cannot use an <code>INACTIVE</code> task definition to run new tasks or create
/// new services, and you cannot update an existing service to reference an <code>INACTIVE</code>
/// task definition. However, there may be up to a 10-minute window following deregistration
/// where these restrictions have not yet taken effect.
/// </para>
/// <note>
/// <para>
/// At this time, <code>INACTIVE</code> task definitions remain discoverable in your account
/// indefinitely. However, this behavior is subject to change in the future, so you should
/// not rely on <code>INACTIVE</code> task definitions persisting beyond the lifecycle
/// of any associated tasks and services.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeregisterTaskDefinition service method.</param>
///
/// <returns>The response from the DeregisterTaskDefinition service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterTaskDefinition">REST API Reference for DeregisterTaskDefinition Operation</seealso>
public virtual DeregisterTaskDefinitionResponse DeregisterTaskDefinition(DeregisterTaskDefinitionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeregisterTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeregisterTaskDefinitionResponseUnmarshaller.Instance;
return Invoke<DeregisterTaskDefinitionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeregisterTaskDefinition operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeregisterTaskDefinition operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeregisterTaskDefinition
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterTaskDefinition">REST API Reference for DeregisterTaskDefinition Operation</seealso>
public virtual IAsyncResult BeginDeregisterTaskDefinition(DeregisterTaskDefinitionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeregisterTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeregisterTaskDefinitionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeregisterTaskDefinition operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeregisterTaskDefinition.</param>
///
/// <returns>Returns a DeregisterTaskDefinitionResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DeregisterTaskDefinition">REST API Reference for DeregisterTaskDefinition Operation</seealso>
public virtual DeregisterTaskDefinitionResponse EndDeregisterTaskDefinition(IAsyncResult asyncResult)
{
return EndInvoke<DeregisterTaskDefinitionResponse>(asyncResult);
}
#endregion
#region DescribeCapacityProviders
/// <summary>
/// Describes one or more of your capacity providers.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeCapacityProviders service method.</param>
///
/// <returns>The response from the DescribeCapacityProviders service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeCapacityProviders">REST API Reference for DescribeCapacityProviders Operation</seealso>
public virtual DescribeCapacityProvidersResponse DescribeCapacityProviders(DescribeCapacityProvidersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeCapacityProvidersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeCapacityProvidersResponseUnmarshaller.Instance;
return Invoke<DescribeCapacityProvidersResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeCapacityProviders operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeCapacityProviders operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeCapacityProviders
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeCapacityProviders">REST API Reference for DescribeCapacityProviders Operation</seealso>
public virtual IAsyncResult BeginDescribeCapacityProviders(DescribeCapacityProvidersRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeCapacityProvidersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeCapacityProvidersResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeCapacityProviders operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeCapacityProviders.</param>
///
/// <returns>Returns a DescribeCapacityProvidersResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeCapacityProviders">REST API Reference for DescribeCapacityProviders Operation</seealso>
public virtual DescribeCapacityProvidersResponse EndDescribeCapacityProviders(IAsyncResult asyncResult)
{
return EndInvoke<DescribeCapacityProvidersResponse>(asyncResult);
}
#endregion
#region DescribeClusters
/// <summary>
/// Describes one or more of your clusters.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeClusters service method.</param>
///
/// <returns>The response from the DescribeClusters service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeClusters">REST API Reference for DescribeClusters Operation</seealso>
public virtual DescribeClustersResponse DescribeClusters(DescribeClustersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeClustersResponseUnmarshaller.Instance;
return Invoke<DescribeClustersResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeClusters operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeClusters operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeClusters
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeClusters">REST API Reference for DescribeClusters Operation</seealso>
public virtual IAsyncResult BeginDescribeClusters(DescribeClustersRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeClustersResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeClusters operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeClusters.</param>
///
/// <returns>Returns a DescribeClustersResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeClusters">REST API Reference for DescribeClusters Operation</seealso>
public virtual DescribeClustersResponse EndDescribeClusters(IAsyncResult asyncResult)
{
return EndInvoke<DescribeClustersResponse>(asyncResult);
}
#endregion
#region DescribeContainerInstances
/// <summary>
/// Describes Amazon Elastic Container Service container instances. Returns metadata about
/// registered and remaining resources on each container instance requested.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeContainerInstances service method.</param>
///
/// <returns>The response from the DescribeContainerInstances service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeContainerInstances">REST API Reference for DescribeContainerInstances Operation</seealso>
public virtual DescribeContainerInstancesResponse DescribeContainerInstances(DescribeContainerInstancesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeContainerInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeContainerInstancesResponseUnmarshaller.Instance;
return Invoke<DescribeContainerInstancesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeContainerInstances operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeContainerInstances operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeContainerInstances
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeContainerInstances">REST API Reference for DescribeContainerInstances Operation</seealso>
public virtual IAsyncResult BeginDescribeContainerInstances(DescribeContainerInstancesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeContainerInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeContainerInstancesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeContainerInstances operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeContainerInstances.</param>
///
/// <returns>Returns a DescribeContainerInstancesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeContainerInstances">REST API Reference for DescribeContainerInstances Operation</seealso>
public virtual DescribeContainerInstancesResponse EndDescribeContainerInstances(IAsyncResult asyncResult)
{
return EndInvoke<DescribeContainerInstancesResponse>(asyncResult);
}
#endregion
#region DescribeServices
/// <summary>
/// Describes the specified services running in your cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeServices service method.</param>
///
/// <returns>The response from the DescribeServices service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
public virtual DescribeServicesResponse DescribeServices(DescribeServicesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeServicesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeServicesResponseUnmarshaller.Instance;
return Invoke<DescribeServicesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeServices operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeServices operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeServices
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
public virtual IAsyncResult BeginDescribeServices(DescribeServicesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeServicesRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeServicesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeServices operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeServices.</param>
///
/// <returns>Returns a DescribeServicesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeServices">REST API Reference for DescribeServices Operation</seealso>
public virtual DescribeServicesResponse EndDescribeServices(IAsyncResult asyncResult)
{
return EndInvoke<DescribeServicesResponse>(asyncResult);
}
#endregion
#region DescribeTaskDefinition
/// <summary>
/// Describes a task definition. You can specify a <code>family</code> and <code>revision</code>
/// to find information about a specific task definition, or you can simply specify the
/// family to find the latest <code>ACTIVE</code> revision in that family.
///
/// <note>
/// <para>
/// You can only describe <code>INACTIVE</code> task definitions while an active task
/// or service references them.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeTaskDefinition service method.</param>
///
/// <returns>The response from the DescribeTaskDefinition service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskDefinition">REST API Reference for DescribeTaskDefinition Operation</seealso>
public virtual DescribeTaskDefinitionResponse DescribeTaskDefinition(DescribeTaskDefinitionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTaskDefinitionResponseUnmarshaller.Instance;
return Invoke<DescribeTaskDefinitionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeTaskDefinition operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeTaskDefinition operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeTaskDefinition
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskDefinition">REST API Reference for DescribeTaskDefinition Operation</seealso>
public virtual IAsyncResult BeginDescribeTaskDefinition(DescribeTaskDefinitionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTaskDefinitionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeTaskDefinition operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeTaskDefinition.</param>
///
/// <returns>Returns a DescribeTaskDefinitionResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskDefinition">REST API Reference for DescribeTaskDefinition Operation</seealso>
public virtual DescribeTaskDefinitionResponse EndDescribeTaskDefinition(IAsyncResult asyncResult)
{
return EndInvoke<DescribeTaskDefinitionResponse>(asyncResult);
}
#endregion
#region DescribeTasks
/// <summary>
/// Describes a specified task or tasks.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeTasks service method.</param>
///
/// <returns>The response from the DescribeTasks service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTasks">REST API Reference for DescribeTasks Operation</seealso>
public virtual DescribeTasksResponse DescribeTasks(DescribeTasksRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTasksRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTasksResponseUnmarshaller.Instance;
return Invoke<DescribeTasksResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeTasks operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeTasks operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeTasks
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTasks">REST API Reference for DescribeTasks Operation</seealso>
public virtual IAsyncResult BeginDescribeTasks(DescribeTasksRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTasksRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTasksResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeTasks operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeTasks.</param>
///
/// <returns>Returns a DescribeTasksResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTasks">REST API Reference for DescribeTasks Operation</seealso>
public virtual DescribeTasksResponse EndDescribeTasks(IAsyncResult asyncResult)
{
return EndInvoke<DescribeTasksResponse>(asyncResult);
}
#endregion
#region DescribeTaskSets
/// <summary>
/// Describes the task sets in the specified cluster and service. This is used when a
/// service uses the <code>EXTERNAL</code> deployment controller type. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeTaskSets service method.</param>
///
/// <returns>The response from the DescribeTaskSets service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskSets">REST API Reference for DescribeTaskSets Operation</seealso>
public virtual DescribeTaskSetsResponse DescribeTaskSets(DescribeTaskSetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTaskSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTaskSetsResponseUnmarshaller.Instance;
return Invoke<DescribeTaskSetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeTaskSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeTaskSets operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeTaskSets
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskSets">REST API Reference for DescribeTaskSets Operation</seealso>
public virtual IAsyncResult BeginDescribeTaskSets(DescribeTaskSetsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTaskSetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTaskSetsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeTaskSets operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeTaskSets.</param>
///
/// <returns>Returns a DescribeTaskSetsResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/DescribeTaskSets">REST API Reference for DescribeTaskSets Operation</seealso>
public virtual DescribeTaskSetsResponse EndDescribeTaskSets(IAsyncResult asyncResult)
{
return EndInvoke<DescribeTaskSetsResponse>(asyncResult);
}
#endregion
#region ListAccountSettings
/// <summary>
/// Lists the account settings for a specified principal.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListAccountSettings service method.</param>
///
/// <returns>The response from the ListAccountSettings service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAccountSettings">REST API Reference for ListAccountSettings Operation</seealso>
public virtual ListAccountSettingsResponse ListAccountSettings(ListAccountSettingsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAccountSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAccountSettingsResponseUnmarshaller.Instance;
return Invoke<ListAccountSettingsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListAccountSettings operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListAccountSettings operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListAccountSettings
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAccountSettings">REST API Reference for ListAccountSettings Operation</seealso>
public virtual IAsyncResult BeginListAccountSettings(ListAccountSettingsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAccountSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAccountSettingsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListAccountSettings operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListAccountSettings.</param>
///
/// <returns>Returns a ListAccountSettingsResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAccountSettings">REST API Reference for ListAccountSettings Operation</seealso>
public virtual ListAccountSettingsResponse EndListAccountSettings(IAsyncResult asyncResult)
{
return EndInvoke<ListAccountSettingsResponse>(asyncResult);
}
#endregion
#region ListAttributes
/// <summary>
/// Lists the attributes for Amazon ECS resources within a specified target type and cluster.
/// When you specify a target type and cluster, <code>ListAttributes</code> returns a
/// list of attribute objects, one for each attribute on each resource. You can filter
/// the list of results to a single attribute name to only return results that have that
/// name. You can also filter the results by attribute name and value, for example, to
/// see which container instances in a cluster are running a Linux AMI (<code>ecs.os-type=linux</code>).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListAttributes service method.</param>
///
/// <returns>The response from the ListAttributes service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAttributes">REST API Reference for ListAttributes Operation</seealso>
public virtual ListAttributesResponse ListAttributes(ListAttributesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAttributesResponseUnmarshaller.Instance;
return Invoke<ListAttributesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListAttributes operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAttributes">REST API Reference for ListAttributes Operation</seealso>
public virtual IAsyncResult BeginListAttributes(ListAttributesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListAttributesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListAttributes.</param>
///
/// <returns>Returns a ListAttributesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListAttributes">REST API Reference for ListAttributes Operation</seealso>
public virtual ListAttributesResponse EndListAttributes(IAsyncResult asyncResult)
{
return EndInvoke<ListAttributesResponse>(asyncResult);
}
#endregion
#region ListClusters
/// <summary>
/// Returns a list of existing clusters.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListClusters service method.</param>
///
/// <returns>The response from the ListClusters service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListClusters">REST API Reference for ListClusters Operation</seealso>
public virtual ListClustersResponse ListClusters(ListClustersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListClustersResponseUnmarshaller.Instance;
return Invoke<ListClustersResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListClusters operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListClusters operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListClusters
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListClusters">REST API Reference for ListClusters Operation</seealso>
public virtual IAsyncResult BeginListClusters(ListClustersRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListClustersRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListClustersResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListClusters operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListClusters.</param>
///
/// <returns>Returns a ListClustersResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListClusters">REST API Reference for ListClusters Operation</seealso>
public virtual ListClustersResponse EndListClusters(IAsyncResult asyncResult)
{
return EndInvoke<ListClustersResponse>(asyncResult);
}
#endregion
#region ListContainerInstances
/// <summary>
/// Returns a list of container instances in a specified cluster. You can filter the results
/// of a <code>ListContainerInstances</code> operation with cluster query language statements
/// inside the <code>filter</code> parameter. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html">Cluster
/// Query Language</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListContainerInstances service method.</param>
///
/// <returns>The response from the ListContainerInstances service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListContainerInstances">REST API Reference for ListContainerInstances Operation</seealso>
public virtual ListContainerInstancesResponse ListContainerInstances(ListContainerInstancesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListContainerInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListContainerInstancesResponseUnmarshaller.Instance;
return Invoke<ListContainerInstancesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListContainerInstances operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListContainerInstances operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListContainerInstances
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListContainerInstances">REST API Reference for ListContainerInstances Operation</seealso>
public virtual IAsyncResult BeginListContainerInstances(ListContainerInstancesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListContainerInstancesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListContainerInstancesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListContainerInstances operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListContainerInstances.</param>
///
/// <returns>Returns a ListContainerInstancesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListContainerInstances">REST API Reference for ListContainerInstances Operation</seealso>
public virtual ListContainerInstancesResponse EndListContainerInstances(IAsyncResult asyncResult)
{
return EndInvoke<ListContainerInstancesResponse>(asyncResult);
}
#endregion
#region ListServices
/// <summary>
/// Lists the services that are running in a specified cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListServices service method.</param>
///
/// <returns>The response from the ListServices service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListServices">REST API Reference for ListServices Operation</seealso>
public virtual ListServicesResponse ListServices(ListServicesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListServicesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListServicesResponseUnmarshaller.Instance;
return Invoke<ListServicesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListServices operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListServices operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListServices
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListServices">REST API Reference for ListServices Operation</seealso>
public virtual IAsyncResult BeginListServices(ListServicesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListServicesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListServicesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListServices operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListServices.</param>
///
/// <returns>Returns a ListServicesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListServices">REST API Reference for ListServices Operation</seealso>
public virtual ListServicesResponse EndListServices(IAsyncResult asyncResult)
{
return EndInvoke<ListServicesResponse>(asyncResult);
}
#endregion
#region ListTagsForResource
/// <summary>
/// List the tags for an Amazon ECS resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return Invoke<ListTagsForResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTagsForResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual IAsyncResult BeginListTagsForResource(ListTagsForResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTagsForResource.</param>
///
/// <returns>Returns a ListTagsForResourceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse EndListTagsForResource(IAsyncResult asyncResult)
{
return EndInvoke<ListTagsForResourceResponse>(asyncResult);
}
#endregion
#region ListTaskDefinitionFamilies
/// <summary>
/// Returns a list of task definition families that are registered to your account (which
/// may include task definition families that no longer have any <code>ACTIVE</code> task
/// definition revisions).
///
///
/// <para>
/// You can filter out task definition families that do not contain any <code>ACTIVE</code>
/// task definition revisions by setting the <code>status</code> parameter to <code>ACTIVE</code>.
/// You can also filter the results with the <code>familyPrefix</code> parameter.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTaskDefinitionFamilies service method.</param>
///
/// <returns>The response from the ListTaskDefinitionFamilies service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitionFamilies">REST API Reference for ListTaskDefinitionFamilies Operation</seealso>
public virtual ListTaskDefinitionFamiliesResponse ListTaskDefinitionFamilies(ListTaskDefinitionFamiliesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTaskDefinitionFamiliesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTaskDefinitionFamiliesResponseUnmarshaller.Instance;
return Invoke<ListTaskDefinitionFamiliesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTaskDefinitionFamilies operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTaskDefinitionFamilies operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTaskDefinitionFamilies
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitionFamilies">REST API Reference for ListTaskDefinitionFamilies Operation</seealso>
public virtual IAsyncResult BeginListTaskDefinitionFamilies(ListTaskDefinitionFamiliesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTaskDefinitionFamiliesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTaskDefinitionFamiliesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTaskDefinitionFamilies operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTaskDefinitionFamilies.</param>
///
/// <returns>Returns a ListTaskDefinitionFamiliesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitionFamilies">REST API Reference for ListTaskDefinitionFamilies Operation</seealso>
public virtual ListTaskDefinitionFamiliesResponse EndListTaskDefinitionFamilies(IAsyncResult asyncResult)
{
return EndInvoke<ListTaskDefinitionFamiliesResponse>(asyncResult);
}
#endregion
#region ListTaskDefinitions
/// <summary>
/// Returns a list of task definitions that are registered to your account. You can filter
/// the results by family name with the <code>familyPrefix</code> parameter or by status
/// with the <code>status</code> parameter.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTaskDefinitions service method.</param>
///
/// <returns>The response from the ListTaskDefinitions service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitions">REST API Reference for ListTaskDefinitions Operation</seealso>
public virtual ListTaskDefinitionsResponse ListTaskDefinitions(ListTaskDefinitionsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTaskDefinitionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTaskDefinitionsResponseUnmarshaller.Instance;
return Invoke<ListTaskDefinitionsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTaskDefinitions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTaskDefinitions operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTaskDefinitions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitions">REST API Reference for ListTaskDefinitions Operation</seealso>
public virtual IAsyncResult BeginListTaskDefinitions(ListTaskDefinitionsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTaskDefinitionsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTaskDefinitionsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTaskDefinitions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTaskDefinitions.</param>
///
/// <returns>Returns a ListTaskDefinitionsResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTaskDefinitions">REST API Reference for ListTaskDefinitions Operation</seealso>
public virtual ListTaskDefinitionsResponse EndListTaskDefinitions(IAsyncResult asyncResult)
{
return EndInvoke<ListTaskDefinitionsResponse>(asyncResult);
}
#endregion
#region ListTasks
/// <summary>
/// Returns a list of tasks for a specified cluster. You can filter the results by family
/// name, by a particular container instance, or by the desired status of the task with
/// the <code>family</code>, <code>containerInstance</code>, and <code>desiredStatus</code>
/// parameters.
///
///
/// <para>
/// Recently stopped tasks might appear in the returned results. Currently, stopped tasks
/// appear in the returned results for at least one hour.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTasks service method.</param>
///
/// <returns>The response from the ListTasks service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTasks">REST API Reference for ListTasks Operation</seealso>
public virtual ListTasksResponse ListTasks(ListTasksRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTasksRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTasksResponseUnmarshaller.Instance;
return Invoke<ListTasksResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTasks operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTasks operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTasks
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTasks">REST API Reference for ListTasks Operation</seealso>
public virtual IAsyncResult BeginListTasks(ListTasksRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTasksRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTasksResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTasks operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTasks.</param>
///
/// <returns>Returns a ListTasksResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/ListTasks">REST API Reference for ListTasks Operation</seealso>
public virtual ListTasksResponse EndListTasks(IAsyncResult asyncResult)
{
return EndInvoke<ListTasksResponse>(asyncResult);
}
#endregion
#region PutAccountSetting
/// <summary>
/// Modifies an account setting. Account settings are set on a per-Region basis.
///
///
/// <para>
/// If you change the account setting for the root user, the default settings for all
/// of the IAM users and roles for which no individual account setting has been specified
/// are reset. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html">Account
/// Settings</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
///
/// <para>
/// When <code>serviceLongArnFormat</code>, <code>taskLongArnFormat</code>, or <code>containerInstanceLongArnFormat</code>
/// are specified, the Amazon Resource Name (ARN) and resource ID format of the resource
/// type for a specified IAM user, IAM role, or the root user for an account is affected.
/// The opt-in and opt-out account setting must be set for each Amazon ECS resource separately.
/// The ARN and resource ID format of a resource will be defined by the opt-in status
/// of the IAM user or role that created the resource. You must enable this setting to
/// use Amazon ECS features such as resource tagging.
/// </para>
///
/// <para>
/// When <code>awsvpcTrunking</code> is specified, the elastic network interface (ENI)
/// limit for any new container instances that support the feature is changed. If <code>awsvpcTrunking</code>
/// is enabled, any new container instances that support the feature are launched have
/// the increased ENI limits available to them. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-eni.html">Elastic
/// Network Interface Trunking</a> in the <i>Amazon Elastic Container Service Developer
/// Guide</i>.
/// </para>
///
/// <para>
/// When <code>containerInsights</code> is specified, the default setting indicating whether
/// CloudWatch Container Insights is enabled for your clusters is changed. If <code>containerInsights</code>
/// is enabled, any new clusters that are created will have Container Insights enabled
/// unless you disable it during cluster creation. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch-container-insights.html">CloudWatch
/// Container Insights</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutAccountSetting service method.</param>
///
/// <returns>The response from the PutAccountSetting service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSetting">REST API Reference for PutAccountSetting Operation</seealso>
public virtual PutAccountSettingResponse PutAccountSetting(PutAccountSettingRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAccountSettingRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAccountSettingResponseUnmarshaller.Instance;
return Invoke<PutAccountSettingResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutAccountSetting operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutAccountSetting operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutAccountSetting
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSetting">REST API Reference for PutAccountSetting Operation</seealso>
public virtual IAsyncResult BeginPutAccountSetting(PutAccountSettingRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAccountSettingRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAccountSettingResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutAccountSetting operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutAccountSetting.</param>
///
/// <returns>Returns a PutAccountSettingResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSetting">REST API Reference for PutAccountSetting Operation</seealso>
public virtual PutAccountSettingResponse EndPutAccountSetting(IAsyncResult asyncResult)
{
return EndInvoke<PutAccountSettingResponse>(asyncResult);
}
#endregion
#region PutAccountSettingDefault
/// <summary>
/// Modifies an account setting for all IAM users on an account for whom no individual
/// account setting has been specified. Account settings are set on a per-Region basis.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutAccountSettingDefault service method.</param>
///
/// <returns>The response from the PutAccountSettingDefault service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSettingDefault">REST API Reference for PutAccountSettingDefault Operation</seealso>
public virtual PutAccountSettingDefaultResponse PutAccountSettingDefault(PutAccountSettingDefaultRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAccountSettingDefaultRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAccountSettingDefaultResponseUnmarshaller.Instance;
return Invoke<PutAccountSettingDefaultResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutAccountSettingDefault operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutAccountSettingDefault operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutAccountSettingDefault
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSettingDefault">REST API Reference for PutAccountSettingDefault Operation</seealso>
public virtual IAsyncResult BeginPutAccountSettingDefault(PutAccountSettingDefaultRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAccountSettingDefaultRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAccountSettingDefaultResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutAccountSettingDefault operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutAccountSettingDefault.</param>
///
/// <returns>Returns a PutAccountSettingDefaultResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAccountSettingDefault">REST API Reference for PutAccountSettingDefault Operation</seealso>
public virtual PutAccountSettingDefaultResponse EndPutAccountSettingDefault(IAsyncResult asyncResult)
{
return EndInvoke<PutAccountSettingDefaultResponse>(asyncResult);
}
#endregion
#region PutAttributes
/// <summary>
/// Create or update an attribute on an Amazon ECS resource. If the attribute does not
/// exist, it is created. If the attribute exists, its value is replaced with the specified
/// value. To delete an attribute, use <a>DeleteAttributes</a>. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html#attributes">Attributes</a>
/// in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutAttributes service method.</param>
///
/// <returns>The response from the PutAttributes service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AttributeLimitExceededException">
/// You can apply up to 10 custom attributes per resource. You can view the attributes
/// of a resource with <a>ListAttributes</a>. You can remove existing attributes on a
/// resource with <a>DeleteAttributes</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.TargetNotFoundException">
/// The specified target could not be found. You can view your available container instances
/// with <a>ListContainerInstances</a>. Amazon ECS container instances are cluster-specific
/// and Region-specific.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAttributes">REST API Reference for PutAttributes Operation</seealso>
public virtual PutAttributesResponse PutAttributes(PutAttributesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAttributesResponseUnmarshaller.Instance;
return Invoke<PutAttributesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutAttributes operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAttributes">REST API Reference for PutAttributes Operation</seealso>
public virtual IAsyncResult BeginPutAttributes(PutAttributesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutAttributesRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutAttributesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutAttributes.</param>
///
/// <returns>Returns a PutAttributesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutAttributes">REST API Reference for PutAttributes Operation</seealso>
public virtual PutAttributesResponse EndPutAttributes(IAsyncResult asyncResult)
{
return EndInvoke<PutAttributesResponse>(asyncResult);
}
#endregion
#region PutClusterCapacityProviders
/// <summary>
/// Modifies the available capacity providers and the default capacity provider strategy
/// for a cluster.
///
///
/// <para>
/// You must specify both the available capacity providers and a default capacity provider
/// strategy for the cluster. If the specified cluster has existing capacity providers
/// associated with it, you must specify all existing capacity providers in addition to
/// any new ones you want to add. Any existing capacity providers associated with a cluster
/// that are omitted from a <a>PutClusterCapacityProviders</a> API call will be disassociated
/// with the cluster. You can only disassociate an existing capacity provider from a cluster
/// if it's not being used by any existing tasks.
/// </para>
///
/// <para>
/// When creating a service or running a task on a cluster, if no capacity provider or
/// launch type is specified, then the cluster's default capacity provider strategy is
/// used. It is recommended to define a default capacity provider strategy for your cluster,
/// however you may specify an empty array (<code>[]</code>) to bypass defining a default
/// strategy.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutClusterCapacityProviders service method.</param>
///
/// <returns>The response from the PutClusterCapacityProviders service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ResourceInUseException">
/// The specified resource is in-use and cannot be removed.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UpdateInProgressException">
/// There is already a current Amazon ECS container agent update in progress on the specified
/// container instance. If the container agent becomes disconnected while it is in a transitional
/// stage, such as <code>PENDING</code> or <code>STAGING</code>, the update process can
/// get stuck in that state. However, when the agent reconnects, it resumes where it stopped
/// previously.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutClusterCapacityProviders">REST API Reference for PutClusterCapacityProviders Operation</seealso>
public virtual PutClusterCapacityProvidersResponse PutClusterCapacityProviders(PutClusterCapacityProvidersRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutClusterCapacityProvidersRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutClusterCapacityProvidersResponseUnmarshaller.Instance;
return Invoke<PutClusterCapacityProvidersResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutClusterCapacityProviders operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutClusterCapacityProviders operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutClusterCapacityProviders
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutClusterCapacityProviders">REST API Reference for PutClusterCapacityProviders Operation</seealso>
public virtual IAsyncResult BeginPutClusterCapacityProviders(PutClusterCapacityProvidersRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutClusterCapacityProvidersRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutClusterCapacityProvidersResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutClusterCapacityProviders operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutClusterCapacityProviders.</param>
///
/// <returns>Returns a PutClusterCapacityProvidersResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/PutClusterCapacityProviders">REST API Reference for PutClusterCapacityProviders Operation</seealso>
public virtual PutClusterCapacityProvidersResponse EndPutClusterCapacityProviders(IAsyncResult asyncResult)
{
return EndInvoke<PutClusterCapacityProvidersResponse>(asyncResult);
}
#endregion
#region RegisterTaskDefinition
/// <summary>
/// Registers a new task definition from the supplied <code>family</code> and <code>containerDefinitions</code>.
/// Optionally, you can add data volumes to your containers with the <code>volumes</code>
/// parameter. For more information about task definition parameters and defaults, see
/// <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html">Amazon
/// ECS Task Definitions</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
///
///
/// <para>
/// You can specify an IAM role for your task with the <code>taskRoleArn</code> parameter.
/// When you specify an IAM role for a task, its containers can then use the latest versions
/// of the AWS CLI or SDKs to make API requests to the AWS services that are specified
/// in the IAM policy associated with the role. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html">IAM
/// Roles for Tasks</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
///
/// <para>
/// You can specify a Docker networking mode for the containers in your task definition
/// with the <code>networkMode</code> parameter. The available network modes correspond
/// to those described in <a href="https://docs.docker.com/engine/reference/run/#/network-settings">Network
/// settings</a> in the Docker run reference. If you specify the <code>awsvpc</code> network
/// mode, the task is allocated an elastic network interface, and you must specify a <a>NetworkConfiguration</a>
/// when you create a service or run a task with the task definition. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html">Task
/// Networking</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RegisterTaskDefinition service method.</param>
///
/// <returns>The response from the RegisterTaskDefinition service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RegisterTaskDefinition">REST API Reference for RegisterTaskDefinition Operation</seealso>
public virtual RegisterTaskDefinitionResponse RegisterTaskDefinition(RegisterTaskDefinitionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RegisterTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RegisterTaskDefinitionResponseUnmarshaller.Instance;
return Invoke<RegisterTaskDefinitionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RegisterTaskDefinition operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RegisterTaskDefinition operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRegisterTaskDefinition
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RegisterTaskDefinition">REST API Reference for RegisterTaskDefinition Operation</seealso>
public virtual IAsyncResult BeginRegisterTaskDefinition(RegisterTaskDefinitionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RegisterTaskDefinitionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RegisterTaskDefinitionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RegisterTaskDefinition operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRegisterTaskDefinition.</param>
///
/// <returns>Returns a RegisterTaskDefinitionResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RegisterTaskDefinition">REST API Reference for RegisterTaskDefinition Operation</seealso>
public virtual RegisterTaskDefinitionResponse EndRegisterTaskDefinition(IAsyncResult asyncResult)
{
return EndInvoke<RegisterTaskDefinitionResponse>(asyncResult);
}
#endregion
#region RunTask
/// <summary>
/// Starts a new task using the specified task definition.
///
///
/// <para>
/// You can allow Amazon ECS to place tasks for you, or you can customize how Amazon ECS
/// places tasks using placement constraints and placement strategies. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduling_tasks.html">Scheduling
/// Tasks</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
///
/// <para>
/// Alternatively, you can use <a>StartTask</a> to use your own scheduler or place tasks
/// manually on specific container instances.
/// </para>
///
/// <para>
/// The Amazon ECS API follows an eventual consistency model, due to the distributed nature
/// of the system supporting the API. This means that the result of an API command you
/// run that affects your Amazon ECS resources might not be immediately visible to all
/// subsequent commands you run. Keep this in mind when you carry out an API command that
/// immediately follows a previous API command.
/// </para>
///
/// <para>
/// To manage eventual consistency, you can do the following:
/// </para>
/// <ul> <li>
/// <para>
/// Confirm the state of the resource before you run a command to modify it. Run the DescribeTasks
/// command using an exponential backoff algorithm to ensure that you allow enough time
/// for the previous command to propagate through the system. To do this, run the DescribeTasks
/// command repeatedly, starting with a couple of seconds of wait time and increasing
/// gradually up to five minutes of wait time.
/// </para>
/// </li> <li>
/// <para>
/// Add wait time between subsequent commands, even if the DescribeTasks command returns
/// an accurate response. Apply an exponential backoff algorithm starting with a couple
/// of seconds of wait time, and increase gradually up to about five minutes of wait time.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RunTask service method.</param>
///
/// <returns>The response from the RunTask service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.BlockedException">
/// Your AWS account has been blocked. For more information, contact <a href="http://aws.amazon.com/contact-us/">AWS
/// Support</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformTaskDefinitionIncompatibilityException">
/// The specified platform version does not satisfy the task definition's required capabilities.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformUnknownException">
/// The specified platform version does not exist.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RunTask">REST API Reference for RunTask Operation</seealso>
public virtual RunTaskResponse RunTask(RunTaskRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RunTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = RunTaskResponseUnmarshaller.Instance;
return Invoke<RunTaskResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RunTask operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RunTask operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRunTask
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RunTask">REST API Reference for RunTask Operation</seealso>
public virtual IAsyncResult BeginRunTask(RunTaskRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RunTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = RunTaskResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RunTask operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRunTask.</param>
///
/// <returns>Returns a RunTaskResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/RunTask">REST API Reference for RunTask Operation</seealso>
public virtual RunTaskResponse EndRunTask(IAsyncResult asyncResult)
{
return EndInvoke<RunTaskResponse>(asyncResult);
}
#endregion
#region StartTask
/// <summary>
/// Starts a new task from the specified task definition on the specified container instance
/// or instances.
///
///
/// <para>
/// Alternatively, you can use <a>RunTask</a> to place tasks for you. For more information,
/// see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduling_tasks.html">Scheduling
/// Tasks</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartTask service method.</param>
///
/// <returns>The response from the StartTask service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StartTask">REST API Reference for StartTask Operation</seealso>
public virtual StartTaskResponse StartTask(StartTaskRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StartTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartTaskResponseUnmarshaller.Instance;
return Invoke<StartTaskResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the StartTask operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the StartTask operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStartTask
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StartTask">REST API Reference for StartTask Operation</seealso>
public virtual IAsyncResult BeginStartTask(StartTaskRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = StartTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartTaskResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the StartTask operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginStartTask.</param>
///
/// <returns>Returns a StartTaskResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StartTask">REST API Reference for StartTask Operation</seealso>
public virtual StartTaskResponse EndStartTask(IAsyncResult asyncResult)
{
return EndInvoke<StartTaskResponse>(asyncResult);
}
#endregion
#region StopTask
/// <summary>
/// Stops a running task. Any tags associated with the task will be deleted.
///
///
/// <para>
/// When <a>StopTask</a> is called on a task, the equivalent of <code>docker stop</code>
/// is issued to the containers running in the task. This results in a <code>SIGTERM</code>
/// value and a default 30-second timeout, after which the <code>SIGKILL</code> value
/// is sent and the containers are forcibly stopped. If the container handles the <code>SIGTERM</code>
/// value gracefully and exits within 30 seconds from receiving it, no <code>SIGKILL</code>
/// value is sent.
/// </para>
/// <note>
/// <para>
/// The default 30-second timeout can be configured on the Amazon ECS container agent
/// with the <code>ECS_CONTAINER_STOP_TIMEOUT</code> variable. For more information, see
/// <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html">Amazon
/// ECS Container Agent Configuration</a> in the <i>Amazon Elastic Container Service Developer
/// Guide</i>.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StopTask service method.</param>
///
/// <returns>The response from the StopTask service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StopTask">REST API Reference for StopTask Operation</seealso>
public virtual StopTaskResponse StopTask(StopTaskRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StopTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopTaskResponseUnmarshaller.Instance;
return Invoke<StopTaskResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the StopTask operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the StopTask operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndStopTask
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StopTask">REST API Reference for StopTask Operation</seealso>
public virtual IAsyncResult BeginStopTask(StopTaskRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = StopTaskRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopTaskResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the StopTask operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginStopTask.</param>
///
/// <returns>Returns a StopTaskResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/StopTask">REST API Reference for StopTask Operation</seealso>
public virtual StopTaskResponse EndStopTask(IAsyncResult asyncResult)
{
return EndInvoke<StopTaskResponse>(asyncResult);
}
#endregion
#region SubmitAttachmentStateChanges
/// <summary>
/// <note>
/// <para>
/// This action is only used by the Amazon ECS agent, and it is not intended for use outside
/// of the agent.
/// </para>
/// </note>
/// <para>
/// Sent to acknowledge that an attachment changed states.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the SubmitAttachmentStateChanges service method.</param>
///
/// <returns>The response from the SubmitAttachmentStateChanges service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/SubmitAttachmentStateChanges">REST API Reference for SubmitAttachmentStateChanges Operation</seealso>
public virtual SubmitAttachmentStateChangesResponse SubmitAttachmentStateChanges(SubmitAttachmentStateChangesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = SubmitAttachmentStateChangesRequestMarshaller.Instance;
options.ResponseUnmarshaller = SubmitAttachmentStateChangesResponseUnmarshaller.Instance;
return Invoke<SubmitAttachmentStateChangesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the SubmitAttachmentStateChanges operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the SubmitAttachmentStateChanges operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSubmitAttachmentStateChanges
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/SubmitAttachmentStateChanges">REST API Reference for SubmitAttachmentStateChanges Operation</seealso>
public virtual IAsyncResult BeginSubmitAttachmentStateChanges(SubmitAttachmentStateChangesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = SubmitAttachmentStateChangesRequestMarshaller.Instance;
options.ResponseUnmarshaller = SubmitAttachmentStateChangesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the SubmitAttachmentStateChanges operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginSubmitAttachmentStateChanges.</param>
///
/// <returns>Returns a SubmitAttachmentStateChangesResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/SubmitAttachmentStateChanges">REST API Reference for SubmitAttachmentStateChanges Operation</seealso>
public virtual SubmitAttachmentStateChangesResponse EndSubmitAttachmentStateChanges(IAsyncResult asyncResult)
{
return EndInvoke<SubmitAttachmentStateChangesResponse>(asyncResult);
}
#endregion
#region TagResource
/// <summary>
/// Associates the specified tags to a resource with the specified <code>resourceArn</code>.
/// If existing tags on a resource are not specified in the request parameters, they are
/// not changed. When a resource is deleted, the tags associated with that resource are
/// deleted as well.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
///
/// <returns>The response from the TagResource service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ResourceNotFoundException">
/// The specified resource could not be found.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke<TagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TagResource operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual IAsyncResult BeginTagResource(TagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginTagResource.</param>
///
/// <returns>Returns a TagResourceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse EndTagResource(IAsyncResult asyncResult)
{
return EndInvoke<TagResourceResponse>(asyncResult);
}
#endregion
#region UntagResource
/// <summary>
/// Deletes specified tags from a resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
///
/// <returns>The response from the UntagResource service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ResourceNotFoundException">
/// The specified resource could not be found.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke<UntagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UntagResource operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUntagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual IAsyncResult BeginUntagResource(UntagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUntagResource.</param>
///
/// <returns>Returns a UntagResourceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse EndUntagResource(IAsyncResult asyncResult)
{
return EndInvoke<UntagResourceResponse>(asyncResult);
}
#endregion
#region UpdateCapacityProvider
/// <summary>
/// Modifies the parameters for a capacity provider.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateCapacityProvider service method.</param>
///
/// <returns>The response from the UpdateCapacityProvider service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateCapacityProvider">REST API Reference for UpdateCapacityProvider Operation</seealso>
public virtual UpdateCapacityProviderResponse UpdateCapacityProvider(UpdateCapacityProviderRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateCapacityProviderResponseUnmarshaller.Instance;
return Invoke<UpdateCapacityProviderResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateCapacityProvider operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateCapacityProvider operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateCapacityProvider
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateCapacityProvider">REST API Reference for UpdateCapacityProvider Operation</seealso>
public virtual IAsyncResult BeginUpdateCapacityProvider(UpdateCapacityProviderRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateCapacityProviderRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateCapacityProviderResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateCapacityProvider operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateCapacityProvider.</param>
///
/// <returns>Returns a UpdateCapacityProviderResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateCapacityProvider">REST API Reference for UpdateCapacityProvider Operation</seealso>
public virtual UpdateCapacityProviderResponse EndUpdateCapacityProvider(IAsyncResult asyncResult)
{
return EndInvoke<UpdateCapacityProviderResponse>(asyncResult);
}
#endregion
#region UpdateClusterSettings
/// <summary>
/// Modifies the settings to use for a cluster.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateClusterSettings service method.</param>
///
/// <returns>The response from the UpdateClusterSettings service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateClusterSettings">REST API Reference for UpdateClusterSettings Operation</seealso>
public virtual UpdateClusterSettingsResponse UpdateClusterSettings(UpdateClusterSettingsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateClusterSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateClusterSettingsResponseUnmarshaller.Instance;
return Invoke<UpdateClusterSettingsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateClusterSettings operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateClusterSettings operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateClusterSettings
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateClusterSettings">REST API Reference for UpdateClusterSettings Operation</seealso>
public virtual IAsyncResult BeginUpdateClusterSettings(UpdateClusterSettingsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateClusterSettingsRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateClusterSettingsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateClusterSettings operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateClusterSettings.</param>
///
/// <returns>Returns a UpdateClusterSettingsResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateClusterSettings">REST API Reference for UpdateClusterSettings Operation</seealso>
public virtual UpdateClusterSettingsResponse EndUpdateClusterSettings(IAsyncResult asyncResult)
{
return EndInvoke<UpdateClusterSettingsResponse>(asyncResult);
}
#endregion
#region UpdateContainerAgent
/// <summary>
/// Updates the Amazon ECS container agent on a specified container instance. Updating
/// the Amazon ECS container agent does not interrupt running tasks or services on the
/// container instance. The process for updating the agent differs depending on whether
/// your container instance was launched with the Amazon ECS-optimized AMI or another
/// operating system.
///
///
/// <para>
/// <code>UpdateContainerAgent</code> requires the Amazon ECS-optimized AMI or Amazon
/// Linux with the <code>ecs-init</code> service installed and running. For help updating
/// the Amazon ECS container agent on other operating systems, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html#manually_update_agent">Manually
/// Updating the Amazon ECS Container Agent</a> in the <i>Amazon Elastic Container Service
/// Developer Guide</i>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateContainerAgent service method.</param>
///
/// <returns>The response from the UpdateContainerAgent service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.MissingVersionException">
/// Amazon ECS is unable to determine the current version of the Amazon ECS container
/// agent on the container instance and does not have enough information to proceed with
/// an update. This could be because the agent running on the container instance is an
/// older or custom version that does not use our version information.
/// </exception>
/// <exception cref="Amazon.ECS.Model.NoUpdateAvailableException">
/// There is no update available for this Amazon ECS container agent. This could be because
/// the agent is already running the latest version, or it is so old that there is no
/// update path to the current version.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UpdateInProgressException">
/// There is already a current Amazon ECS container agent update in progress on the specified
/// container instance. If the container agent becomes disconnected while it is in a transitional
/// stage, such as <code>PENDING</code> or <code>STAGING</code>, the update process can
/// get stuck in that state. However, when the agent reconnects, it resumes where it stopped
/// previously.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerAgent">REST API Reference for UpdateContainerAgent Operation</seealso>
public virtual UpdateContainerAgentResponse UpdateContainerAgent(UpdateContainerAgentRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateContainerAgentRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateContainerAgentResponseUnmarshaller.Instance;
return Invoke<UpdateContainerAgentResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateContainerAgent operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateContainerAgent operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateContainerAgent
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerAgent">REST API Reference for UpdateContainerAgent Operation</seealso>
public virtual IAsyncResult BeginUpdateContainerAgent(UpdateContainerAgentRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateContainerAgentRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateContainerAgentResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateContainerAgent operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateContainerAgent.</param>
///
/// <returns>Returns a UpdateContainerAgentResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerAgent">REST API Reference for UpdateContainerAgent Operation</seealso>
public virtual UpdateContainerAgentResponse EndUpdateContainerAgent(IAsyncResult asyncResult)
{
return EndInvoke<UpdateContainerAgentResponse>(asyncResult);
}
#endregion
#region UpdateContainerInstancesState
/// <summary>
/// Modifies the status of an Amazon ECS container instance.
///
///
/// <para>
/// Once a container instance has reached an <code>ACTIVE</code> state, you can change
/// the status of a container instance to <code>DRAINING</code> to manually remove an
/// instance from a cluster, for example to perform system updates, update the Docker
/// daemon, or scale down the cluster size.
/// </para>
/// <important>
/// <para>
/// A container instance cannot be changed to <code>DRAINING</code> until it has reached
/// an <code>ACTIVE</code> status. If the instance is in any other status, an error will
/// be received.
/// </para>
/// </important>
/// <para>
/// When you set a container instance to <code>DRAINING</code>, Amazon ECS prevents new
/// tasks from being scheduled for placement on the container instance and replacement
/// service tasks are started on other container instances in the cluster if the resources
/// are available. Service tasks on the container instance that are in the <code>PENDING</code>
/// state are stopped immediately.
/// </para>
///
/// <para>
/// Service tasks on the container instance that are in the <code>RUNNING</code> state
/// are stopped and replaced according to the service's deployment configuration parameters,
/// <code>minimumHealthyPercent</code> and <code>maximumPercent</code>. You can change
/// the deployment configuration of your service using <a>UpdateService</a>.
/// </para>
/// <ul> <li>
/// <para>
/// If <code>minimumHealthyPercent</code> is below 100%, the scheduler can ignore <code>desiredCount</code>
/// temporarily during task replacement. For example, <code>desiredCount</code> is four
/// tasks, a minimum of 50% allows the scheduler to stop two existing tasks before starting
/// two new tasks. If the minimum is 100%, the service scheduler can't remove existing
/// tasks until the replacement tasks are considered healthy. Tasks for services that
/// do not use a load balancer are considered healthy if they are in the <code>RUNNING</code>
/// state. Tasks for services that use a load balancer are considered healthy if they
/// are in the <code>RUNNING</code> state and the container instance they are hosted on
/// is reported as healthy by the load balancer.
/// </para>
/// </li> <li>
/// <para>
/// The <code>maximumPercent</code> parameter represents an upper limit on the number
/// of running tasks during task replacement, which enables you to define the replacement
/// batch size. For example, if <code>desiredCount</code> is four tasks, a maximum of
/// 200% starts four new tasks before stopping the four tasks to be drained, provided
/// that the cluster resources required to do this are available. If the maximum is 100%,
/// then replacement tasks can't start until the draining tasks have stopped.
/// </para>
/// </li> </ul>
/// <para>
/// Any <code>PENDING</code> or <code>RUNNING</code> tasks that do not belong to a service
/// are not affected. You must wait for them to finish or stop them manually.
/// </para>
///
/// <para>
/// A container instance has completed draining when it has no more <code>RUNNING</code>
/// tasks. You can verify this using <a>ListTasks</a>.
/// </para>
///
/// <para>
/// When a container instance has been drained, you can set a container instance to <code>ACTIVE</code>
/// status and once it has reached that status the Amazon ECS scheduler can begin scheduling
/// tasks on the instance again.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateContainerInstancesState service method.</param>
///
/// <returns>The response from the UpdateContainerInstancesState service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerInstancesState">REST API Reference for UpdateContainerInstancesState Operation</seealso>
public virtual UpdateContainerInstancesStateResponse UpdateContainerInstancesState(UpdateContainerInstancesStateRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateContainerInstancesStateRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateContainerInstancesStateResponseUnmarshaller.Instance;
return Invoke<UpdateContainerInstancesStateResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateContainerInstancesState operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateContainerInstancesState operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateContainerInstancesState
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerInstancesState">REST API Reference for UpdateContainerInstancesState Operation</seealso>
public virtual IAsyncResult BeginUpdateContainerInstancesState(UpdateContainerInstancesStateRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateContainerInstancesStateRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateContainerInstancesStateResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateContainerInstancesState operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateContainerInstancesState.</param>
///
/// <returns>Returns a UpdateContainerInstancesStateResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateContainerInstancesState">REST API Reference for UpdateContainerInstancesState Operation</seealso>
public virtual UpdateContainerInstancesStateResponse EndUpdateContainerInstancesState(IAsyncResult asyncResult)
{
return EndInvoke<UpdateContainerInstancesStateResponse>(asyncResult);
}
#endregion
#region UpdateService
/// <summary>
/// <important>
/// <para>
/// Updating the task placement strategies and constraints on an Amazon ECS service remains
/// in preview and is a Beta Service as defined by and subject to the Beta Service Participation
/// Service Terms located at <a href="https://aws.amazon.com/service-terms">https://aws.amazon.com/service-terms</a>
/// ("Beta Terms"). These Beta Terms apply to your participation in this preview.
/// </para>
/// </important>
/// <para>
/// Modifies the parameters of a service.
/// </para>
///
/// <para>
/// For services using the rolling update (<code>ECS</code>) deployment controller, the
/// desired count, deployment configuration, network configuration, task placement constraints
/// and strategies, or task definition used can be updated.
/// </para>
///
/// <para>
/// For services using the blue/green (<code>CODE_DEPLOY</code>) deployment controller,
/// only the desired count, deployment configuration, task placement constraints and strategies,
/// and health check grace period can be updated using this API. If the network configuration,
/// platform version, or task definition need to be updated, a new AWS CodeDeploy deployment
/// should be created. For more information, see <a href="https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_CreateDeployment.html">CreateDeployment</a>
/// in the <i>AWS CodeDeploy API Reference</i>.
/// </para>
///
/// <para>
/// For services using an external deployment controller, you can update only the desired
/// count, task placement constraints and strategies, and health check grace period using
/// this API. If the launch type, load balancer, network configuration, platform version,
/// or task definition need to be updated, you should create a new task set. For more
/// information, see <a>CreateTaskSet</a>.
/// </para>
///
/// <para>
/// You can add to or subtract from the number of instantiations of a task definition
/// in a service by specifying the cluster that the service is running in and a new <code>desiredCount</code>
/// parameter.
/// </para>
///
/// <para>
/// If you have updated the Docker image of your application, you can create a new task
/// definition with that image and deploy it to your service. The service scheduler uses
/// the minimum healthy percent and maximum percent parameters (in the service's deployment
/// configuration) to determine the deployment strategy.
/// </para>
/// <note>
/// <para>
/// If your updated Docker image uses the same tag as what is in the existing task definition
/// for your service (for example, <code>my_image:latest</code>), you do not need to create
/// a new revision of your task definition. You can update the service using the <code>forceNewDeployment</code>
/// option. The new tasks launched by the deployment pull the current image/tag combination
/// from your repository when they start.
/// </para>
/// </note>
/// <para>
/// You can also update the deployment configuration of a service. When a deployment is
/// triggered by updating the task definition of a service, the service scheduler uses
/// the deployment configuration parameters, <code>minimumHealthyPercent</code> and <code>maximumPercent</code>,
/// to determine the deployment strategy.
/// </para>
/// <ul> <li>
/// <para>
/// If <code>minimumHealthyPercent</code> is below 100%, the scheduler can ignore <code>desiredCount</code>
/// temporarily during a deployment. For example, if <code>desiredCount</code> is four
/// tasks, a minimum of 50% allows the scheduler to stop two existing tasks before starting
/// two new tasks. Tasks for services that do not use a load balancer are considered healthy
/// if they are in the <code>RUNNING</code> state. Tasks for services that use a load
/// balancer are considered healthy if they are in the <code>RUNNING</code> state and
/// the container instance they are hosted on is reported as healthy by the load balancer.
/// </para>
/// </li> <li>
/// <para>
/// The <code>maximumPercent</code> parameter represents an upper limit on the number
/// of running tasks during a deployment, which enables you to define the deployment batch
/// size. For example, if <code>desiredCount</code> is four tasks, a maximum of 200% starts
/// four new tasks before stopping the four older tasks (provided that the cluster resources
/// required to do this are available).
/// </para>
/// </li> </ul>
/// <para>
/// When <a>UpdateService</a> stops a task during a deployment, the equivalent of <code>docker
/// stop</code> is issued to the containers running in the task. This results in a <code>SIGTERM</code>
/// and a 30-second timeout, after which <code>SIGKILL</code> is sent and the containers
/// are forcibly stopped. If the container handles the <code>SIGTERM</code> gracefully
/// and exits within 30 seconds from receiving it, no <code>SIGKILL</code> is sent.
/// </para>
///
/// <para>
/// When the service scheduler launches new tasks, it determines task placement in your
/// cluster with the following logic:
/// </para>
/// <ul> <li>
/// <para>
/// Determine which of the container instances in your cluster can support your service's
/// task definition (for example, they have the required CPU, memory, ports, and container
/// instance attributes).
/// </para>
/// </li> <li>
/// <para>
/// By default, the service scheduler attempts to balance tasks across Availability Zones
/// in this manner (although you can choose a different placement strategy):
/// </para>
/// <ul> <li>
/// <para>
/// Sort the valid container instances by the fewest number of running tasks for this
/// service in the same Availability Zone as the instance. For example, if zone A has
/// one running service task and zones B and C each have zero, valid container instances
/// in either zone B or C are considered optimal for placement.
/// </para>
/// </li> <li>
/// <para>
/// Place the new service task on a valid container instance in an optimal Availability
/// Zone (based on the previous steps), favoring container instances with the fewest number
/// of running tasks for this service.
/// </para>
/// </li> </ul> </li> </ul>
/// <para>
/// When the service scheduler stops running tasks, it attempts to maintain balance across
/// the Availability Zones in your cluster using the following logic:
/// </para>
/// <ul> <li>
/// <para>
/// Sort the container instances by the largest number of running tasks for this service
/// in the same Availability Zone as the instance. For example, if zone A has one running
/// service task and zones B and C each have two, container instances in either zone B
/// or C are considered optimal for termination.
/// </para>
/// </li> <li>
/// <para>
/// Stop the task on a container instance in an optimal Availability Zone (based on the
/// previous steps), favoring container instances with the largest number of running tasks
/// for this service.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateService service method.</param>
///
/// <returns>The response from the UpdateService service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformTaskDefinitionIncompatibilityException">
/// The specified platform version does not satisfy the task definition's required capabilities.
/// </exception>
/// <exception cref="Amazon.ECS.Model.PlatformUnknownException">
/// The specified platform version does not exist.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateService">REST API Reference for UpdateService Operation</seealso>
public virtual UpdateServiceResponse UpdateService(UpdateServiceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateServiceResponseUnmarshaller.Instance;
return Invoke<UpdateServiceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateService operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateService operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateService
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateService">REST API Reference for UpdateService Operation</seealso>
public virtual IAsyncResult BeginUpdateService(UpdateServiceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateServiceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateServiceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateService operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateService.</param>
///
/// <returns>Returns a UpdateServiceResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateService">REST API Reference for UpdateService Operation</seealso>
public virtual UpdateServiceResponse EndUpdateService(IAsyncResult asyncResult)
{
return EndInvoke<UpdateServiceResponse>(asyncResult);
}
#endregion
#region UpdateServicePrimaryTaskSet
/// <summary>
/// Modifies which task set in a service is the primary task set. Any parameters that
/// are updated on the primary task set in a service will transition to the service. This
/// is used when a service uses the <code>EXTERNAL</code> deployment controller type.
/// For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateServicePrimaryTaskSet service method.</param>
///
/// <returns>The response from the UpdateServicePrimaryTaskSet service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.TaskSetNotFoundException">
/// The specified task set could not be found. You can view your available task sets with
/// <a>DescribeTaskSets</a>. Task sets are specific to each cluster, service and Region.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateServicePrimaryTaskSet">REST API Reference for UpdateServicePrimaryTaskSet Operation</seealso>
public virtual UpdateServicePrimaryTaskSetResponse UpdateServicePrimaryTaskSet(UpdateServicePrimaryTaskSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateServicePrimaryTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateServicePrimaryTaskSetResponseUnmarshaller.Instance;
return Invoke<UpdateServicePrimaryTaskSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateServicePrimaryTaskSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateServicePrimaryTaskSet operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateServicePrimaryTaskSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateServicePrimaryTaskSet">REST API Reference for UpdateServicePrimaryTaskSet Operation</seealso>
public virtual IAsyncResult BeginUpdateServicePrimaryTaskSet(UpdateServicePrimaryTaskSetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateServicePrimaryTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateServicePrimaryTaskSetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateServicePrimaryTaskSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateServicePrimaryTaskSet.</param>
///
/// <returns>Returns a UpdateServicePrimaryTaskSetResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateServicePrimaryTaskSet">REST API Reference for UpdateServicePrimaryTaskSet Operation</seealso>
public virtual UpdateServicePrimaryTaskSetResponse EndUpdateServicePrimaryTaskSet(IAsyncResult asyncResult)
{
return EndInvoke<UpdateServicePrimaryTaskSetResponse>(asyncResult);
}
#endregion
#region UpdateTaskSet
/// <summary>
/// Modifies a task set. This is used when a service uses the <code>EXTERNAL</code> deployment
/// controller type. For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html">Amazon
/// ECS Deployment Types</a> in the <i>Amazon Elastic Container Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateTaskSet service method.</param>
///
/// <returns>The response from the UpdateTaskSet service method, as returned by ECS.</returns>
/// <exception cref="Amazon.ECS.Model.AccessDeniedException">
/// You do not have authorization to perform the requested action.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClientException">
/// These errors are usually caused by a client action, such as using an action or resource
/// on behalf of a user that doesn't have permissions to use the action or resource, or
/// specifying an identifier that is not valid.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ClusterNotFoundException">
/// The specified cluster could not be found. You can view your available clusters with
/// <a>ListClusters</a>. Amazon ECS clusters are Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.InvalidParameterException">
/// The specified parameter is invalid. Review the available parameters for the API request.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServerException">
/// These errors are usually caused by a server issue.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotActiveException">
/// The specified service is not active. You can't update a service that is inactive.
/// If you have previously deleted a service, you can re-create it with <a>CreateService</a>.
/// </exception>
/// <exception cref="Amazon.ECS.Model.ServiceNotFoundException">
/// The specified service could not be found. You can view your available services with
/// <a>ListServices</a>. Amazon ECS services are cluster-specific and Region-specific.
/// </exception>
/// <exception cref="Amazon.ECS.Model.TaskSetNotFoundException">
/// The specified task set could not be found. You can view your available task sets with
/// <a>DescribeTaskSets</a>. Task sets are specific to each cluster, service and Region.
/// </exception>
/// <exception cref="Amazon.ECS.Model.UnsupportedFeatureException">
/// The specified task is not supported in this Region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateTaskSet">REST API Reference for UpdateTaskSet Operation</seealso>
public virtual UpdateTaskSetResponse UpdateTaskSet(UpdateTaskSetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateTaskSetResponseUnmarshaller.Instance;
return Invoke<UpdateTaskSetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateTaskSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateTaskSet operation on AmazonECSClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateTaskSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateTaskSet">REST API Reference for UpdateTaskSet Operation</seealso>
public virtual IAsyncResult BeginUpdateTaskSet(UpdateTaskSetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateTaskSetRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateTaskSetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UpdateTaskSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateTaskSet.</param>
///
/// <returns>Returns a UpdateTaskSetResult from ECS.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/ecs-2014-11-13/UpdateTaskSet">REST API Reference for UpdateTaskSet Operation</seealso>
public virtual UpdateTaskSetResponse EndUpdateTaskSet(IAsyncResult asyncResult)
{
return EndInvoke<UpdateTaskSetResponse>(asyncResult);
}
#endregion
}
} | 59.503534 | 200 | 0.670162 | [
"Apache-2.0"
] | PureKrome/aws-sdk-net | sdk/src/Services/ECS/Generated/_bcl35/AmazonECSClient.cs | 252,533 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HealthCollectable : MonoBehaviour
{
[SerializeField] int healthToReturn = 10;
[SerializeField] AudioClip soundToPlay;
PlayerHealthManager playerHealthManager;
CharacterSelector characterSelector;
AudioManager audioManager;
private int maxHealth;
private int currentHealth;
void Update()
{
characterSelector = FindObjectOfType<CharacterSelector>();
audioManager = FindObjectOfType<AudioManager>();
try //hastily done because a non-gamebreaking error was being thrown once the player is killed
{
if (characterSelector.GetCharacterActive()) //checks if the character is active
{
playerHealthManager = characterSelector.GetCharacterObject().GetComponent<PlayerHealthManager>(); //gets the current player instance's health manager
maxHealth = playerHealthManager.GetMaxHealth();
currentHealth = playerHealthManager.GetCurrentHealth();
}
}
catch
{
//pass
}
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.tag == "Player")
{
if (soundToPlay != null)
{
audioManager.PlaySoundFXAudio(soundToPlay);
}
playerHealthManager.SetCurrentHealth(currentHealth + healthToReturn); //health is checked in PlayerHealthManager to ensure the value isn't larger than it's max health
Destroy(gameObject);
}
}
}
| 33.22449 | 178 | 0.65602 | [
"MIT"
] | HaloSeventy7/CI-Project-GitHub | Project Dungeon/Assets/Scripts/Managers/Health/HealthCollectable.cs | 1,630 | C# |
/* ====================================================================
*/
// 20022008 AJM GJL - Added Second Y axis support
using System;
using System.Xml;
namespace Oranikle.Report.Engine
{
///<summary>
/// Chart series definition and processing.
///</summary>
[Serializable]
public class ChartSeries : ReportLink
{
String _Colour;
DataPoints _Datapoints; // Data points within a series
PlotTypeEnum _PlotType; // Indicates whether the series should be plotted
// as a line in a Column chart. If set to auto,
// should be plotted per the primary chart type.
// Auto (Default) | Line
String _YAxis; //Indicates if the series uses the left or right axis. GJL 140208
bool _NoMarker; //Indicates if the series should not show its plot markers. GJL 300508
String _LineSize;
public ChartSeries(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
{
_Datapoints=null;
_PlotType=PlotTypeEnum.Auto;
_YAxis = "Left";
_NoMarker = false;
_LineSize = "Regular";
// Loop thru all the child nodes
foreach(XmlNode xNodeLoop in xNode.ChildNodes)
{
if (xNodeLoop.NodeType != XmlNodeType.Element)
continue;
switch (xNodeLoop.Name)
{
case "DataPoints":
_Datapoints = new DataPoints(r, this, xNodeLoop);
break;
case "PlotType":
_PlotType = Oranikle.Report.Engine.PlotType.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
break;
case "YAxis":
case "fyi:YAxis":
_YAxis = xNodeLoop.InnerText;
break;
case "NoMarker":
case "fyi:NoMarker":
_NoMarker = Boolean.Parse(xNodeLoop.InnerText);
break;
case "LineSize":
case "fyi:LineSize":
_LineSize = xNodeLoop.InnerText;
break;
case "fyi:Color":
case "Color":
case "Colour":
_Colour = xNodeLoop.InnerText;
break;
default:
// don't know this element - log it
OwnerReport.rl.LogError(4, "Unknown ChartSeries element '" + xNodeLoop.Name + "' ignored.");
break;
}
}
if (_Datapoints == null)
OwnerReport.rl.LogError(8, "ChartSeries requires the DataPoints element.");
}
override public void FinalPass()
{
if (_Datapoints != null)
_Datapoints.FinalPass();
return;
}
public DataPoints Datapoints
{
get { return _Datapoints; }
set { _Datapoints = value; }
}
public PlotTypeEnum PlotType
{
get { return _PlotType; }
set { _PlotType = value; }
}
public String Colour
{
get { return _Colour; }
set { _Colour = value; }
}
public String YAxis
{
get { return _YAxis; }
set { _YAxis = value; }
}
public bool NoMarker
{
get { return _NoMarker; }
set { _NoMarker = value; }
}
public string LineSize
{
get { return _LineSize; }
set { _LineSize = value; }
}
}
}
| 24.941176 | 103 | 0.521226 | [
"Apache-2.0"
] | hnjm/rdlc.report.engine | Oranikle.Report.Engine/Definition/ChartSeries.cs | 3,392 | C# |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft 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.
// ----------------------------------------------------------------------------------
namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using ServiceManagemenet.Common.Models;
using Xunit;
using Xunit.Abstractions;
public class DRConfigurationTests : RMTestBase
{
public DRConfigurationTests(ITestOutputHelper output)
{
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void DRConfigurationsCURD()
{
EventHubsController.NewInstance.RunPsTest("DRConfigurationTests");
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void DRConfigurationsCURDAlternateName()
{
EventHubsController.NewInstance.RunPsTest("DRConfigurationTestsAlternateName");
}
}
}
| 40.25 | 92 | 0.632411 | [
"MIT"
] | AzureDataBox/azure-powershell | src/ResourceManager/EventHub/Commands.EventHub.Test/ScenarioTests/DRConfigurations.cs | 1,730 | C# |
using MovieManager.Core.Contracts;
using MovieManager.Core.Entities;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace MovieManager.Persistence
{
internal class CategoryRepository : ICategoryRepository
{
private readonly ApplicationDbContext _dbContext;
public CategoryRepository(ApplicationDbContext dbContext)
{
_dbContext = dbContext;
}
public void AddRange(IEnumerable<Category> categories)
{
_dbContext.AddRange(categories);
}
public IEnumerable<Category> GetAll()
{
return _dbContext.Categories.Include(m => m.Movies).ToArray();
}
}
} | 24.166667 | 74 | 0.674483 | [
"MIT"
] | racs0/csharp_samples_ef_uow_moviemanager-template | source/MovieManager.Persistence/CategoryRepository.cs | 727 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: Templates\CSharp\Requests\IEntityCollectionPage.cs.tt
namespace Microsoft.Graph
{
using System;
using Newtonsoft.Json;
/// <summary>
/// The interface IApplicationExtensionPropertiesCollectionPage.
/// </summary>
[JsonConverter(typeof(InterfaceConverter<ApplicationExtensionPropertiesCollectionPage>))]
public interface IApplicationExtensionPropertiesCollectionPage : ICollectionPage<ExtensionProperty>
{
/// <summary>
/// Gets the next page <see cref="IApplicationExtensionPropertiesCollectionRequest"/> instance.
/// </summary>
IApplicationExtensionPropertiesCollectionRequest NextPageRequest { get; }
/// <summary>
/// Initializes the NextPageRequest property.
/// </summary>
void InitializeNextPageRequest(IBaseClient client, string nextPageLinkString);
}
}
| 39.69697 | 153 | 0.635115 | [
"MIT"
] | OfficeGlobal/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Requests/Generated/IApplicationExtensionPropertiesCollectionPage.cs | 1,310 | C# |
using GodelTech.StoryLine.Contracts;
namespace GodelTech.StoryLine.Rest.Actions
{
public interface IHttpRequest : IActionBuilder
{
IHttpRequest Service(string value);
IHttpRequest Method(string value);
IHttpRequest Url(string value);
IHttpRequest QueryParam(string parameter, string value);
IHttpRequest Header(string header, string value);
IHttpRequest Body(byte[] value);
}
} | 31.285714 | 64 | 0.707763 | [
"BSD-3-Clause"
] | GodelTech/GodelTech.StoryLine.Rest | src/GodelTech.StoryLine.Rest/Actions/IHttpRequest.cs | 438 | C# |
namespace PressCenters.Services.Sources.MainNews
{
public class ReutersMainNewsProvider : BaseMainNewsProvider
{
public override string BaseUrl { get; } = "https://www.reuters.com";
public override RemoteMainNews GetMainNews()
{
var document = this.GetDocument(this.BaseUrl);
var titleElement = document.QuerySelector("#topStory .story-title a");
var title = titleElement.TextContent.Trim();
var url = this.BaseUrl + titleElement.Attributes["href"].Value.Trim();
var imageElement = document.QuerySelector("#topStory .story-photo img");
var imageUrl = imageElement?.Attributes["src"]?.Value?.Trim();
if (imageUrl != null && !imageUrl.StartsWith("http"))
{
imageUrl = "https:" + imageUrl;
}
return new RemoteMainNews(title, url, imageUrl);
}
}
}
| 34.444444 | 84 | 0.604301 | [
"MIT"
] | IliyanAng/PressCenters.com | src/Services/PressCenters.Services.Sources/MainNews/ReutersMainNewsProvider.cs | 932 | 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 iotanalytics-2017-11-27.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.IoTAnalytics.Model
{
/// <summary>
/// Summary information about dataset contents.
/// </summary>
public partial class DatasetContentSummary
{
private DateTime? _completionTime;
private DateTime? _creationTime;
private DateTime? _scheduleTime;
private DatasetContentStatus _status;
private string _version;
/// <summary>
/// Gets and sets the property CompletionTime.
/// <para>
/// The time the dataset content status was updated to SUCCEEDED or FAILED.
/// </para>
/// </summary>
public DateTime CompletionTime
{
get { return this._completionTime.GetValueOrDefault(); }
set { this._completionTime = value; }
}
// Check to see if CompletionTime property is set
internal bool IsSetCompletionTime()
{
return this._completionTime.HasValue;
}
/// <summary>
/// Gets and sets the property CreationTime.
/// <para>
/// The actual time the creation of the dataset contents was started.
/// </para>
/// </summary>
public DateTime CreationTime
{
get { return this._creationTime.GetValueOrDefault(); }
set { this._creationTime = value; }
}
// Check to see if CreationTime property is set
internal bool IsSetCreationTime()
{
return this._creationTime.HasValue;
}
/// <summary>
/// Gets and sets the property ScheduleTime.
/// <para>
/// The time the creation of the dataset contents was scheduled to start.
/// </para>
/// </summary>
public DateTime ScheduleTime
{
get { return this._scheduleTime.GetValueOrDefault(); }
set { this._scheduleTime = value; }
}
// Check to see if ScheduleTime property is set
internal bool IsSetScheduleTime()
{
return this._scheduleTime.HasValue;
}
/// <summary>
/// Gets and sets the property Status.
/// <para>
/// The status of the dataset contents.
/// </para>
/// </summary>
public DatasetContentStatus Status
{
get { return this._status; }
set { this._status = value; }
}
// Check to see if Status property is set
internal bool IsSetStatus()
{
return this._status != null;
}
/// <summary>
/// Gets and sets the property Version.
/// <para>
/// The version of the dataset contents.
/// </para>
/// </summary>
[AWSProperty(Min=7, Max=36)]
public string Version
{
get { return this._version; }
set { this._version = value; }
}
// Check to see if Version property is set
internal bool IsSetVersion()
{
return this._version != null;
}
}
} | 29.507463 | 110 | 0.58523 | [
"Apache-2.0"
] | ChristopherButtars/aws-sdk-net | sdk/src/Services/IoTAnalytics/Generated/Model/DatasetContentSummary.cs | 3,954 | C# |
using FluentValidation;
using FluentValidation.Results;
using NLog;
using RLabs.Cielo.SDK.Model.Request;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RLabs.Cielo.SDK.Util;
namespace RLabs.Cielo.SDK.Model.Validators
{
internal sealed class AuthorizationRequestValidator : BaseValidator<AuthorizationRequest>
{
private readonly ILogger logger;
public AuthorizationRequestValidator(ILogger logger) : base(logger)
{
this.logger = logger;
SetRules();
}
public override void SetRules()
{
logger.InfoWithMetadata(new Dictionary<string, string>() { { "Message", "Adicionando regras de autorização" } });
RuleFor(authRequest => authRequest.Payment.Amount).NotEqual(0).WithMessage("O valor da transação não pode ser zero para esta operação");
}
}
}
| 29.65625 | 148 | 0.687039 | [
"MIT"
] | danruziska/Cielo-eCommerce-SDK | RLabs.Cielo.SDK/Model/Validators/AuthorizationRequestValidator.cs | 958 | C# |
using System;
using System.Xml.Serialization;
using System.ComponentModel.DataAnnotations;
using BroadWorksConnector.Ocip.Validation;
using System.Collections.Generic;
namespace BroadWorksConnector.Ocip.Models
{
/// <summary>
/// Response to UserOutgoingCallingPlanCallMeNowGetRequest.
/// <see cref="UserOutgoingCallingPlanCallMeNowGetRequest"/>
/// </summary>
[Serializable]
[XmlRoot(Namespace = "")]
[Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""6f793dfca9bd3d121bb35e0f9cf1cb2e:1146""}]")]
public class UserOutgoingCallingPlanCallMeNowGetResponse : BroadWorksConnector.Ocip.Models.C.OCIDataResponse
{
private bool _useCustomSettings;
[XmlElement(ElementName = "useCustomSettings", IsNullable = false, Namespace = "")]
[Group(@"6f793dfca9bd3d121bb35e0f9cf1cb2e:1146")]
public bool UseCustomSettings
{
get => _useCustomSettings;
set
{
UseCustomSettingsSpecified = true;
_useCustomSettings = value;
}
}
[XmlIgnore]
protected bool UseCustomSettingsSpecified { get; set; }
private BroadWorksConnector.Ocip.Models.OutgoingCallingPlanCallMeNowPermissions _userPermissions;
[XmlElement(ElementName = "userPermissions", IsNullable = false, Namespace = "")]
[Group(@"6f793dfca9bd3d121bb35e0f9cf1cb2e:1146")]
public BroadWorksConnector.Ocip.Models.OutgoingCallingPlanCallMeNowPermissions UserPermissions
{
get => _userPermissions;
set
{
UserPermissionsSpecified = true;
_userPermissions = value;
}
}
[XmlIgnore]
protected bool UserPermissionsSpecified { get; set; }
}
}
| 32.785714 | 130 | 0.659041 | [
"MIT"
] | JTOne123/broadworks-connector-net | BroadworksConnector/Ocip/Models/UserOutgoingCallingPlanCallMeNowGetResponse.cs | 1,836 | 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 chime-2018-05-01.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using System.Net;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.Chime.Model
{
/// <summary>
/// The SIP rule details, including name, triggers, and target applications. An AWS account
/// can have multiple SIP rules.
/// </summary>
public partial class SipRule
{
private DateTime? _createdTimestamp;
private bool? _disabled;
private string _name;
private string _sipRuleId;
private List<SipRuleTargetApplication> _targetApplications = new List<SipRuleTargetApplication>();
private SipRuleTriggerType _triggerType;
private string _triggerValue;
private DateTime? _updatedTimestamp;
/// <summary>
/// Gets and sets the property CreatedTimestamp.
/// <para>
/// The time at which the SIP rule was created, in ISO 8601 format.
/// </para>
/// </summary>
public DateTime CreatedTimestamp
{
get { return this._createdTimestamp.GetValueOrDefault(); }
set { this._createdTimestamp = value; }
}
// Check to see if CreatedTimestamp property is set
internal bool IsSetCreatedTimestamp()
{
return this._createdTimestamp.HasValue;
}
/// <summary>
/// Gets and sets the property Disabled.
/// <para>
/// Indicates whether the SIP rule is enabled or disabled. You must disable a rule before
/// you can delete it.
/// </para>
/// </summary>
public bool Disabled
{
get { return this._disabled.GetValueOrDefault(); }
set { this._disabled = value; }
}
// Check to see if Disabled property is set
internal bool IsSetDisabled()
{
return this._disabled.HasValue;
}
/// <summary>
/// Gets and sets the property Name.
/// <para>
/// The name of the SIP rule.
/// </para>
/// </summary>
[AWSProperty(Min=1, Max=256)]
public string Name
{
get { return this._name; }
set { this._name = value; }
}
// Check to see if Name property is set
internal bool IsSetName()
{
return this._name != null;
}
/// <summary>
/// Gets and sets the property SipRuleId.
/// <para>
/// The SIP rule ID.
/// </para>
/// </summary>
public string SipRuleId
{
get { return this._sipRuleId; }
set { this._sipRuleId = value; }
}
// Check to see if SipRuleId property is set
internal bool IsSetSipRuleId()
{
return this._sipRuleId != null;
}
/// <summary>
/// Gets and sets the property TargetApplications.
/// <para>
/// Target SIP media application and other details, such as priority and AWS Region, to
/// be specified in the SIP rule. Only one SIP rule per AWS Region can be provided.
/// </para>
/// </summary>
[AWSProperty(Min=1, Max=25)]
public List<SipRuleTargetApplication> TargetApplications
{
get { return this._targetApplications; }
set { this._targetApplications = value; }
}
// Check to see if TargetApplications property is set
internal bool IsSetTargetApplications()
{
return this._targetApplications != null && this._targetApplications.Count > 0;
}
/// <summary>
/// Gets and sets the property TriggerType.
/// <para>
/// The type of trigger assigned to the SIP rule in <code>TriggerValue</code>, currently
/// <code>RequestUriHostname</code> or <code>ToPhoneNumber</code>.
/// </para>
/// </summary>
public SipRuleTriggerType TriggerType
{
get { return this._triggerType; }
set { this._triggerType = value; }
}
// Check to see if TriggerType property is set
internal bool IsSetTriggerType()
{
return this._triggerType != null;
}
/// <summary>
/// Gets and sets the property TriggerValue.
/// <para>
/// If <code>TriggerType</code> is <code>RequestUriHostname</code>, then the value can
/// be the outbound host name of the Amazon Chime Voice Connector. If <code>TriggerType</code>
/// is <code>ToPhoneNumber</code>, then the value can be a customer-owned phone number
/// in E164 format. <code>SipRule</code> is triggered when a SIP rule requests host name
/// or <code>ToPhoneNumber</code> matches in the incoming SIP request.
/// </para>
/// </summary>
public string TriggerValue
{
get { return this._triggerValue; }
set { this._triggerValue = value; }
}
// Check to see if TriggerValue property is set
internal bool IsSetTriggerValue()
{
return this._triggerValue != null;
}
/// <summary>
/// Gets and sets the property UpdatedTimestamp.
/// <para>
/// The time at which the SIP rule was last updated, in ISO 8601 format.
/// </para>
/// </summary>
public DateTime UpdatedTimestamp
{
get { return this._updatedTimestamp.GetValueOrDefault(); }
set { this._updatedTimestamp = value; }
}
// Check to see if UpdatedTimestamp property is set
internal bool IsSetUpdatedTimestamp()
{
return this._updatedTimestamp.HasValue;
}
}
} | 33.67 | 107 | 0.566528 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/Chime/Generated/Model/SipRule.cs | 6,734 | C# |
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneLoadManager : MonoBehaviour
{
public void LoadScene(string sceneToLoad)
{
SceneManager.LoadScene(sceneToLoad);
}
public void Change(int i)
{
PrevCurrScene.prev = PrevCurrScene.curr;
PrevCurrScene.curr = i;
}
public void QuitGame()
{
// save any game data here
#if UNITY_EDITOR
// Application.Quit() does not work in the editor so
// UnityEditor.EditorApplication.isPlaying need to be set to false to end the game
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
| 21.935484 | 90 | 0.661765 | [
"MIT"
] | Gamedev-Society-IIT-Jodhpur/InteractiveCircuitGame | Assets/Scripts/Managers/SceneLoadManager.cs | 680 | C# |
#region License
// Released under Apache 2.0 License
// License: https://opensource.org/licenses/Apache2.0
// Home page: https://github.com/ffhighwind/Path-of-Exile-Utilities
// Copyright(c) 2021 Wesley Hamilton
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#endregion
using System;
namespace PathOfExile.Filter
{
public class GemLevel : IFilterComparison<int>
{
public GemLevel() { }
public GemLevel(ComparisonType comparison, int value)
: base(comparison, value) { }
public override FilterType Type => FilterType.GemLevel;
}
}
| 39.25 | 81 | 0.763057 | [
"Apache-2.0"
] | ffhighwind/Path-of-Exile-Filter-Parser | PoE Filter Parser/Filter/Criteria/GemLevel.cs | 1,572 | C# |
namespace ClassLib033
{
public class Class092
{
public static string Property => "ClassLib033";
}
}
| 15 | 55 | 0.633333 | [
"MIT"
] | 333fred/performance | src/scenarios/weblarge2.0/src/ClassLib033/Class092.cs | 120 | 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.IO;
using System.Transactions;
using Summer.Batch.Common.Transaction;
using NLog;
using System.Threading;
namespace Summer.Batch.Infrastructure.Support.Transaction
{
/// <summary>
/// File Stream with transactionnal write behaviour support.
/// </summary>
public class TransactionAwareFileStream : FileStream, ISinglePhaseNotification
{
private Semaphore _pool = new Semaphore(1, 1);
private bool _disposed = false;
private bool _shouldClose;
private readonly List<byte> _internalBuffer;
private readonly Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>
/// Custom constructor with path and FileMode.
/// </summary>
/// <param name="path"></param>
/// <param name="fileMode"></param>
public TransactionAwareFileStream(string path, FileMode fileMode) : base(path, fileMode)
{
_internalBuffer = new List<byte>();
TransactionScopeManager.RegisterResource(this);
}
/// <summary>
/// Gets or sets the current position of this stream.
/// </summary>
/// <returns>
/// The current position of this stream.
/// </returns>
public override long Position
{
get { return IsTransactionActive() ? base.Position + _internalBuffer.Count : base.Position; }
set { base.Position = value; }
}
/// <summary>
/// overrides Write(byte[] array, int offset, int count)
/// Writes to internal buffer if transaction is active, otherwise delegates
/// to direct base write.
/// </summary>
/// <param name="array"></param>
/// <param name="offset"></param>
/// <param name="count"></param>
public override void Write(byte[] array, int offset, int count)
{
if (IsTransactionActive())
{
var subArray = new byte[count];
Buffer.BlockCopy(array, offset, subArray, 0, count);
_internalBuffer.AddRange(subArray);
return;
}
//else return to default behaviour
base.Write(array, offset, count);
}
/// <summary>
/// Checks if current transaction is existing.
/// </summary>
/// <returns></returns>
private static bool IsTransactionActive()
{
return System.Transactions.Transaction.Current != null;
}
/// <summary>
/// @see ISinglePhaseNotification#Prepare .
/// </summary>
/// <param name="preparingEnlistment"></param>
public void Prepare(PreparingEnlistment preparingEnlistment)
{
preparingEnlistment.Prepared();
}
/// <summary>
/// @see ISinglePhaseNotification#Commit .
/// </summary>
/// <param name="enlistment"></param>
public void Commit(Enlistment enlistment)
{
Complete();
enlistment.Done();
}
/// <summary>
/// @see ISinglePhaseNotification#Rollback .
/// </summary>
/// <param name="enlistment"></param>
public void Rollback(Enlistment enlistment)
{
enlistment.Done();
}
/// <summary>
/// @see ISinglePhaseNotification#InDoubt .
/// </summary>
/// <param name="enlistment"></param>
public void InDoubt(Enlistment enlistment)
{
enlistment.Done();
}
/// <summary>
/// @see ISinglePhaseNotification#SinglePhaseCommit .
/// </summary>
/// <param name="singlePhaseEnlistment"></param>
public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
{
Complete();
singlePhaseEnlistment.Committed();
}
/// <summary>
/// override Stream#Flush .
/// </summary>
public override void Flush()
{
_pool.WaitOne();
//Flush is permitted only on non-transaction context
if (!IsTransactionActive())
{
if (!_disposed)
{
base.Flush();
}
else
{
Logger.Trace("Flush - writer already disposed by transaction.");
}
}
_pool.Release();
}
/// <summary>
/// @see ISinglePhaseNotification#Complete .
/// </summary>
private void Complete()
{
//write buffer
Write(_internalBuffer.ToArray(), 0, _internalBuffer.Count);
_internalBuffer.Clear();
//flush
Logger.Trace("Complete - base.Flush()");
Flush();
if (_shouldClose)
{
Logger.Trace("Complete - base.Dispose(true)");
Dispose(true);
}
}
/// <summary>
/// override Dispose .
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
Logger.Trace("WaitOne - before waitone");
_pool.WaitOne();
Logger.Trace("WaitOne - after waitone");
if (disposing)
{
TransactionScopeManager.UnregisterResource(this);
if (IsTransactionActive())
{
Logger.Trace("Dispose - _shouldClose = true");
_shouldClose = true;
}
else
{
if (!_disposed)
{
Logger.Trace("Dispose - base.Dispose(true)");
_disposed = true;
base.Dispose(true);
}
else
{
Logger.Trace("Dispose - already disposed");
}
}
}
Logger.Trace("Release - before release");
_pool.Release();
Logger.Trace("Release - after release");
}
}
} | 33.446009 | 106 | 0.512072 | [
"Apache-2.0"
] | SummerBatch/SummerBatch | Summer.Batch.Infrastructure/Support/Transaction/TransactionAwareFileStream.cs | 7,126 | C# |
using System;
/// <summary>
/// GetHashCode
/// </summary>
public class GuidGetHashCode
{
#region Private Fields
private const int c_SIZE_OF_ARRAY = 16;
#endregion
#region Public Methods
public bool RunTests()
{
bool retVal = true;
TestLibrary.TestFramework.LogInformation("[Positive]");
retVal = PosTest1() && retVal;
retVal = PosTest2() && retVal;
return retVal;
}
#region Positive Test Cases
public bool PosTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest1: GetHashCode should return the same value for two equal instances");
try
{
byte[] bytes = new byte[c_SIZE_OF_ARRAY];
TestLibrary.Generator.GetBytes(-55, bytes);
Guid guid1 = new Guid(bytes);
Guid guid2 = new Guid(bytes);
int hashCode1 = guid1.GetHashCode();
int hashCode2 = guid2.GetHashCode();
if (hashCode1 != hashCode2)
{
TestLibrary.TestFramework.LogError("001.1", "GetHashCode does not return the same value for two equal instances");
TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] hashCode1 = " + hashCode1 + ", hashCode2 = " + hashCode2);
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2: Calling GetHashCode multiple times should return the same hash value");
try
{
byte[] bytes = new byte[c_SIZE_OF_ARRAY];
TestLibrary.Generator.GetBytes(-55, bytes);
Guid guid = new Guid(bytes);
int hashCode1 = guid.GetHashCode();
int hashCode2 = guid.GetHashCode();
if (hashCode1 != hashCode2)
{
TestLibrary.TestFramework.LogError("002.1", "Calling GetHashCode multiple times does not return the same hash value");
TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLES] hashCode1 = " + hashCode1 + ", hashCode2 = " + hashCode2);
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
#endregion
#endregion
public static int Main()
{
GuidGetHashCode test = new GuidGetHashCode();
TestLibrary.TestFramework.BeginTestCase("GuidGetHashCode");
if (test.RunTests())
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("PASS");
return 100;
}
else
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("FAIL");
return 0;
}
}
}
| 28.912281 | 142 | 0.580097 | [
"MIT"
] | CyberSys/coreclr-mono | tests/src/CoreMangLib/cti/system/guid/guidgethashcode.cs | 3,296 | C# |
#region Copyright
//
// DotNetNuke® - http://www.dnnsoftware.com
// Copyright (c) 2002-2017
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Data;
using Dnn.ExportImport.Components.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Modules;
namespace Dnn.ExportImport.Components.Entities
{
[Serializable]
[TableName("ExportImportJobs")]
[PrimaryKey("JobId")]
public class ExportImportJob : IHydratable
{
public int JobId { get; set; }
public int PortalId { get; set; }
public JobType JobType { get; set; }
public JobStatus JobStatus { get; set; }
public bool IsCancelled { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public int CreatedByUserId { get; set; }
public DateTime CreatedOnDate { get; set; }
public DateTime LastModifiedOnDate { get; set; }
public DateTime? CompletedOnDate { get; set; }
public string Directory { get; set; }
public string JobObject { get; set; }
public int KeyID
{
get { return JobId; }
set { JobId = value; }
}
public void Fill(IDataReader dr)
{
JobId = Null.SetNullInteger(dr[nameof(JobId)]);
PortalId = Null.SetNullInteger(dr[nameof(PortalId)]);
JobType = (JobType)Null.SetNullInteger(dr[nameof(JobType)]);
JobStatus = (JobStatus)Null.SetNullInteger(dr[nameof(JobStatus)]);
IsCancelled = Null.SetNullBoolean(dr[nameof(IsCancelled)]);
Name = Null.SetNullString(dr[nameof(Name)]);
Description = Null.SetNullString(dr[nameof(Description)]);
CreatedByUserId = Null.SetNullInteger(dr[nameof(CreatedByUserId)]);
CreatedOnDate = Null.SetNullDateTime(dr[nameof(CreatedOnDate)]);
LastModifiedOnDate = Null.SetNullDateTime(dr[nameof(LastModifiedOnDate)]);
CompletedOnDate = Null.SetNullDateTime(dr[nameof(CompletedOnDate)]);
Directory = Null.SetNullString(dr[nameof(Directory)]);
JobObject = Null.SetNullString(dr[nameof(JobObject)]);
if (CreatedOnDate.Kind != DateTimeKind.Utc)
{
CreatedOnDate = new DateTime(
CreatedOnDate.Year, CreatedOnDate.Month, CreatedOnDate.Day,
CreatedOnDate.Hour, CreatedOnDate.Minute, CreatedOnDate.Second,
CreatedOnDate.Millisecond, DateTimeKind.Utc);
}
if (LastModifiedOnDate.Kind != DateTimeKind.Utc)
{
LastModifiedOnDate = new DateTime(
LastModifiedOnDate.Year, LastModifiedOnDate.Month, LastModifiedOnDate.Day,
LastModifiedOnDate.Hour, LastModifiedOnDate.Minute, LastModifiedOnDate.Second,
LastModifiedOnDate.Millisecond, DateTimeKind.Utc);
}
}
}
} | 46.329545 | 115 | 0.668629 | [
"MIT"
] | adambartholomew/Dnn.Platform | DNN Platform/Modules/DnnExportImport/Components/Entities/ExportImportJob.cs | 4,080 | C# |
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace dexih.transforms.Poco
{
public interface IPocoEnumerator<out T>: IEnumerator<T>
{
Task<bool> MoveNextAsync(CancellationToken cancellationToken = default);
T this[int index] { get; }
int Count { get; }
Task<int> CountAsync(CancellationToken cancellationToken = default);
}
} | 29.928571 | 80 | 0.704057 | [
"Apache-2.0"
] | DataExperts/dexih.transforms | src/dexih.transforms/Poco/IPocoEnumerator.cs | 421 | C# |
//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Security.Cryptography;
namespace Microsoft.WindowsAzure.Common.Platform
{
internal class CryptographyProvider : ICryptographyProvider
{
public byte[] ComputeHmacSha256Hash(byte[] key, byte[] data)
{
return new HMACSHA256(key).ComputeHash(data);
}
}
}
| 32.344828 | 75 | 0.719616 | [
"Apache-2.0"
] | markcowl/azure-sdk-for-net | libraries/src/Common.NetFramework/Platform/CryptographyProvider.cs | 940 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Envenom.cs" company="Adamand MUD">
// Copyright (c) Adamant MUD
// </copyright>
// <summary>
// "Envenom" skill enhancement.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Adan.Client.Plugins.StuffDatabase
{
using System;
using System.Globalization;
using System.Xml.Serialization;
using Common.Messages;
using CSLib.Net.Annotations;
using Properties;
/// <summary>
/// "Envenom" skill enhancement.
/// </summary>
public class Envenom : AppliedAffect
{
/// <summary>
/// Gets or sets the duration of applied affect.
/// </summary>
/// <value>
/// The duration of applied affect.
/// </value>
[XmlAttribute]
public int Duration
{
get;
set;
}
/// <summary>
/// Gets the info message representing this affect.
/// </summary>
/// <returns><see cref="InfoMessage"/> instance.</returns>
public override InfoMessage ConvertToInfoMessage()
{
return new InfoMessage(string.Format(CultureInfo.CurrentUICulture, " " + Resources.AffectEnvenom, GetAsciiTime(Duration)));
}
}
} | 30.183673 | 136 | 0.46856 | [
"MIT"
] | TagsRocks/mudclient | Adan.Client.Plugins.StuffDatabase/Envenom.cs | 1,481 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Football.Field
{
/// <summary>
/// Интерфейс расположения ячейки на поле
/// </summary>
public interface ILocCellToField
{
/// <summary>
/// Ряд
/// </summary>
byte Row { get; }
/// <summary>
/// Колонка
/// </summary>
byte Column { get; }
}
}
| 15.8 | 42 | 0.64557 | [
"MIT"
] | xEGOISTx/StatisticsProject | Football/IFootball/Field/ILocCellToField.cs | 440 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace parcial1
{
class alquiler
{
int carnet_del_Alumno;
int codigo_Libro;
DateTime fecha_Prestamo;
DateTime fecha_Devolucion;
public int Carnet_del_Alumno { get => carnet_del_Alumno; set => carnet_del_Alumno = value; }
public int Codigo_Libro { get => codigo_Libro; set => codigo_Libro = value; }
public DateTime Fecha_Prestamo { get => fecha_Prestamo; set => fecha_Prestamo = value; }
public DateTime Fecha_Devolucion { get => fecha_Devolucion; set => fecha_Devolucion = value; }
}
}
| 32.090909 | 103 | 0.669972 | [
"MIT"
] | Aniux2807/examen | alquiler.cs | 708 | C# |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.AspNet.Mvc.ModelBinding;
using Microsoft.AspNet.Mvc.Rendering.Expressions;
namespace Microsoft.AspNet.Mvc.Rendering
{
public class HtmlHelper<TModel> : HtmlHelper, IHtmlHelper<TModel>
{
/// <summary>
/// Initializes a new instance of the <see cref="HtmlHelper{TModel}"/> class.
/// </summary>
public HtmlHelper(
[NotNull] ICompositeViewEngine viewEngine,
[NotNull] IModelMetadataProvider metadataProvider,
[NotNull] IUrlHelper urlHelper,
[NotNull] AntiForgery antiForgeryInstance,
[NotNull] IActionBindingContextProvider actionBindingContextProvider)
: base(viewEngine, metadataProvider, urlHelper, antiForgeryInstance, actionBindingContextProvider)
{
}
/// <inheritdoc />
public new ViewDataDictionary<TModel> ViewData { get; private set; }
public override void Contextualize([NotNull] ViewContext viewContext)
{
if (viewContext.ViewData == null)
{
throw new ArgumentException(Resources.FormatPropertyOfTypeCannotBeNull(
"ViewData",
typeof(ViewContext)),
"viewContext");
}
ViewData = viewContext.ViewData as ViewDataDictionary<TModel>;
if (ViewData == null)
{
// viewContext may contain a base ViewDataDictionary instance. So complain about that type, not TModel.
throw new ArgumentException(Resources.FormatArgumentPropertyUnexpectedType(
"ViewData",
viewContext.ViewData.GetType().FullName,
typeof(ViewDataDictionary<TModel>).FullName),
"viewContext");
}
base.Contextualize(viewContext);
}
/// <inheritdoc />
public HtmlString CheckBoxFor([NotNull] Expression<Func<TModel, bool>> expression,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateCheckBox(metadata, GetExpressionName(expression), isChecked: null,
htmlAttributes: htmlAttributes);
}
/// <inheritdoc />
public HtmlString DropDownListFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression,
IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes)
{
var metadata = ExpressionMetadataProvider.FromLambdaExpression(expression, ViewData, MetadataProvider);
return GenerateDropDown(metadata, ExpressionHelper.GetExpressionText(expression), selectList,
optionLabel, htmlAttributes);
}
/// <inheritdoc />
public HtmlString DisplayFor<TValue>([NotNull] Expression<Func<TModel, TValue>> expression,
string templateName,
string htmlFieldName,
object additionalViewData)
{
var metadata = ExpressionMetadataProvider.FromLambdaExpression(expression,
ViewData,
MetadataProvider);
return GenerateDisplay(metadata,
htmlFieldName ?? ExpressionHelper.GetExpressionText(expression),
templateName,
additionalViewData);
}
/// <inheritdoc />
public string DisplayNameFor<TValue>([NotNull] Expression<Func<TModel, TValue>> expression)
{
var metadata = GetModelMetadata(expression);
return GenerateDisplayName(metadata, ExpressionHelper.GetExpressionText(expression));
}
/// <inheritdoc />
public string DisplayNameForInnerType<TModelItem, TValue>(
[NotNull] Expression<Func<TModelItem, TValue>> expression)
{
var metadata = ExpressionMetadataProvider.FromLambdaExpression<TModelItem, TValue>(
expression,
new ViewDataDictionary<TModelItem>(MetadataProvider),
MetadataProvider);
var expressionText = ExpressionHelper.GetExpressionText(expression);
if (metadata == null)
{
throw new InvalidOperationException(Resources.FormatHtmlHelper_NullModelMetadata(expressionText));
}
return GenerateDisplayName(metadata, expressionText);
}
/// <inheritdoc />
public string DisplayTextFor<TValue>([NotNull] Expression<Func<TModel, TValue>> expression)
{
return GenerateDisplayText(GetModelMetadata(expression));
}
/// <inheritdoc />
public HtmlString EditorFor<TValue>(
[NotNull] Expression<Func<TModel, TValue>> expression,
string templateName,
string htmlFieldName,
object additionalViewData)
{
var metadata = ExpressionMetadataProvider.FromLambdaExpression(expression, ViewData, MetadataProvider);
return GenerateEditor(
metadata,
htmlFieldName ?? ExpressionHelper.GetExpressionText(expression),
templateName,
additionalViewData);
}
/// <inheritdoc />
public HtmlString HiddenFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateHidden(metadata, GetExpressionName(expression), metadata.Model, useViewData: false,
htmlAttributes: htmlAttributes);
}
/// <inheritdoc />
public string IdFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression)
{
return GenerateId(GetExpressionName(expression));
}
/// <inheritdoc />
public HtmlString LabelFor<TValue>(
[NotNull] Expression<Func<TModel, TValue>> expression,
string labelText,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateLabel(metadata, ExpressionHelper.GetExpressionText(expression), labelText, htmlAttributes);
}
/// <inheritdoc />
public HtmlString ListBoxFor<TProperty>(
[NotNull] Expression<Func<TModel, TProperty>> expression,
IEnumerable<SelectListItem> selectList,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
var name = ExpressionHelper.GetExpressionText(expression);
return GenerateListBox(metadata, name, selectList, htmlAttributes);
}
/// <inheritdoc />
public string NameFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression)
{
var expressionName = GetExpressionName(expression);
return Name(expressionName);
}
/// <inheritdoc />
public HtmlString PasswordFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GeneratePassword(metadata, GetExpressionName(expression), value: null,
htmlAttributes: htmlAttributes);
}
/// <inheritdoc />
public HtmlString RadioButtonFor<TProperty>(
[NotNull] Expression<Func<TModel, TProperty>> expression,
[NotNull] object value,
object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateRadioButton(metadata, GetExpressionName(expression), value, isChecked: null,
htmlAttributes: htmlAttributes);
}
/// <inheritdoc />
public HtmlString TextAreaFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression, int rows,
int columns, object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateTextArea(metadata, GetExpressionName(expression), rows, columns, htmlAttributes);
}
/// <inheritdoc />
public HtmlString TextBoxFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression,
string format, object htmlAttributes)
{
var metadata = GetModelMetadata(expression);
return GenerateTextBox(metadata, GetExpressionName(expression), metadata.Model, format, htmlAttributes);
}
protected string GetExpressionName<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression)
{
return ExpressionHelper.GetExpressionText(expression);
}
protected ModelMetadata GetModelMetadata<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression)
{
var metadata = ExpressionMetadataProvider.FromLambdaExpression(expression, ViewData, MetadataProvider);
if (metadata == null)
{
var expressionName = GetExpressionName(expression);
throw new InvalidOperationException(Resources.FormatHtmlHelper_NullModelMetadata(expressionName));
}
return metadata;
}
/// <inheritdoc />
public HtmlString ValidationMessageFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression,
string message,
object htmlAttributes,
string tag)
{
return GenerateValidationMessage(ExpressionHelper.GetExpressionText(expression),
message,
htmlAttributes,
tag);
}
/// <inheritdoc />
public string ValueFor<TProperty>([NotNull] Expression<Func<TModel, TProperty>> expression, string format)
{
var metadata = GetModelMetadata(expression);
return GenerateValue(ExpressionHelper.GetExpressionText(expression), metadata.Model, format,
useViewData: false);
}
}
}
| 41.760784 | 119 | 0.612358 | [
"Apache-2.0"
] | Shazwazza/Mvc | src/Microsoft.AspNet.Mvc.Core/Rendering/Html/HtmlHelperOfT.cs | 10,649 | C# |
// -----------------------------------------------------------------------------
// 让 .NET 开发更简单,更通用,更流行。
// Copyright © 2020-2021 Furion, 百小僧, Baiqian Co.,Ltd.
//
// 框架名称:Furion
// 框架作者:百小僧
// 框架版本:2.14.1
// 源码地址:Gitee: https://gitee.com/dotnetchina/Furion
// Github:https://github.com/monksoul/Furion
// 开源协议:Apache-2.0(https://gitee.com/dotnetchina/Furion/blob/master/LICENSE)
// -----------------------------------------------------------------------------
using Furion.DependencyInjection;
using System.ComponentModel;
namespace Furion.TaskScheduler
{
/// <summary>
/// 任务状态
/// </summary>
[SuppressSniffer]
public enum SpareTimeStatus
{
/// <summary>
/// 运行中
/// </summary>
[Description("运行中")]
Running,
/// <summary>
/// 已停止或未启动
/// </summary>
[Description("已停止或未启动")]
Stopped,
/// <summary>
/// 单次执行失败
/// </summary>
[Description("任务停止并失败")]
Failed,
/// <summary>
/// 任务已取消或没有该任务
/// </summary>
[Description("任务已取消或没有该任务")]
CanceledOrNone
}
} | 24.020833 | 81 | 0.468343 | [
"Apache-2.0"
] | Cuixq123/Furion | framework/Furion.Pure/TaskScheduler/Enums/SpareTimeStatus.cs | 1,374 | C# |
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Semmle.Util;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
using Semmle.Extraction.Entities;
using System.IO;
namespace Semmle.Extraction.CSharp.Entities
{
public class Constructor : Method
{
private Constructor(Context cx, IMethodSymbol init)
: base(cx, init) { }
public override void Populate(TextWriter trapFile)
{
PopulateMethod(trapFile);
PopulateModifiers(trapFile);
ContainingType.PopulateGenerics();
trapFile.constructors(this, symbol.ContainingType.Name, ContainingType, (Constructor)OriginalDefinition);
trapFile.constructor_location(this, Location);
if (symbol.IsImplicitlyDeclared)
{
var lineCounts = new LineCounts() { Total = 2, Code = 1, Comment = 0 };
trapFile.numlines(this, lineCounts);
}
ExtractCompilerGenerated(trapFile);
}
protected override void ExtractInitializers(TextWriter trapFile)
{
// Do not extract initializers for constructed types.
if (!IsSourceDeclaration)
return;
var syntax = Syntax;
var initializer = syntax?.Initializer;
if (initializer == null)
return;
ITypeSymbol initializerType;
var symbolInfo = Context.GetSymbolInfo(initializer);
switch (initializer.Kind())
{
case SyntaxKind.BaseConstructorInitializer:
initializerType = symbol.ContainingType.BaseType;
break;
case SyntaxKind.ThisConstructorInitializer:
initializerType = symbol.ContainingType;
break;
default:
Context.ModelError(initializer, "Unknown initializer");
return;
}
var initInfo = new ExpressionInfo(Context,
AnnotatedTypeSymbol.CreateNotAnnotated(initializerType),
Context.Create(initializer.ThisOrBaseKeyword.GetLocation()),
Kinds.ExprKind.CONSTRUCTOR_INIT,
this,
-1,
false,
null);
var init = new Expression(initInfo);
var target = Constructor.Create(Context, (IMethodSymbol)symbolInfo.Symbol);
if (target == null)
{
Context.ModelError(symbol, "Unable to resolve call");
return;
}
trapFile.expr_call(init, target);
var child = 0;
foreach (var arg in initializer.ArgumentList.Arguments)
{
Expression.Create(Context, arg.Expression, init, child++);
}
}
private ConstructorDeclarationSyntax Syntax
{
get
{
return symbol.DeclaringSyntaxReferences
.Select(r => r.GetSyntax())
.OfType<ConstructorDeclarationSyntax>()
.FirstOrDefault();
}
}
public static new Constructor Create(Context cx, IMethodSymbol constructor)
{
if (constructor == null)
return null;
switch (constructor.MethodKind)
{
case MethodKind.StaticConstructor:
case MethodKind.Constructor:
return ConstructorFactory.Instance.CreateEntityFromSymbol(cx, constructor);
default:
throw new InternalError(constructor, "Attempt to create a Constructor from a symbol that isn't a constructor");
}
}
public override void WriteId(TextWriter trapFile)
{
if (symbol.IsStatic)
trapFile.Write("static");
trapFile.WriteSubId(ContainingType);
AddParametersToId(Context, trapFile, symbol);
trapFile.Write(";constructor");
}
private ConstructorDeclarationSyntax GetSyntax() =>
symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<ConstructorDeclarationSyntax>().FirstOrDefault();
public override Microsoft.CodeAnalysis.Location FullLocation => ReportingLocation;
public override Microsoft.CodeAnalysis.Location ReportingLocation
{
get
{
var syn = GetSyntax();
if (syn != null)
{
return syn.Identifier.GetLocation();
}
if (symbol.IsImplicitlyDeclared)
{
return ContainingType.ReportingLocation;
}
return symbol.ContainingType.Locations.FirstOrDefault();
}
}
private class ConstructorFactory : ICachedEntityFactory<IMethodSymbol, Constructor>
{
public static ConstructorFactory Instance { get; } = new ConstructorFactory();
public Constructor Create(Context cx, IMethodSymbol init) => new Constructor(cx, init);
}
}
}
| 33.532051 | 131 | 0.565093 | [
"MIT"
] | CaptainFreak/codeql | csharp/extractor/Semmle.Extraction.CSharp/Entities/Constructor.cs | 5,231 | C# |
using System;
using MilpManager.Abstraction;
namespace LpSolveMilpManager.Implementation
{
[Serializable]
public class LpSolveVariable : IVariable
{
[NonSerialized]
private IMilpManager _milpManager;
public IMilpManager MilpManager
{
get { return _milpManager; }
set { _milpManager = value; }
}
public Domain Domain { get; set; }
public double? ConstantValue { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public string Expression { get; set; }
public override string ToString()
{
return $"[Name = {Name}, Domain = {Domain}, ConstantValue = {ConstantValue}, Id = {Id}, Expressoin = {Expression}";
}
}
} | 28.214286 | 127 | 0.589873 | [
"MIT"
] | afish/LpSolveMilpSolver | Implementation/LpSolveVariable.cs | 792 | C# |
using System.Windows.Controls;
namespace iPhone.Applications.Phone.Views
{
public partial class GroupsView : Page
{
public GroupsView()
{
InitializeComponent();
}
}
}
| 17.615385 | 43 | 0.567686 | [
"MIT"
] | CADbloke/magellan-framework | src/Samples/iPhone/Applications/Phone/Views/GroupsView.xaml.cs | 231 | C# |
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace Alipay.AopSdk.Core.Domain
{
/// <summary>
/// InsLiability Data Structure.
/// </summary>
[Serializable]
public class InsLiability : AopObject
{
/// <summary>
/// 保额
/// </summary>
[XmlElement("coverage")]
public string Coverage { get; set; }
/// <summary>
/// 是否可以编辑,0-可选; 1-不可选,不支持; 2-必选,目前不打开
/// </summary>
[XmlElement("disabled")]
public string Disabled { get; set; }
/// <summary>
/// 不计免赔 0,1,2
/// </summary>
[XmlElement("iop")]
public string Iop { get; set; }
/// <summary>
/// 不计免赔保费
/// </summary>
[XmlElement("iop_premium")]
public string IopPremium { get; set; }
/// <summary>
/// 责任描述
/// </summary>
[XmlElement("liability_desc")]
public string LiabilityDesc { get; set; }
/// <summary>
/// 责任名称
/// </summary>
[XmlElement("liability_name")]
public string LiabilityName { get; set; }
/// <summary>
/// 责任编码
/// </summary>
[XmlElement("liability_no")]
public string LiabilityNo { get; set; }
/// <summary>
/// 责任保费
/// </summary>
[XmlElement("liability_premium")]
public string LiabilityPremium { get; set; }
/// <summary>
/// 责任险种比率
/// </summary>
[XmlElement("liability_rates")]
public string LiabilityRates { get; set; }
/// <summary>
/// options
/// </summary>
[XmlArray("options")]
[XmlArrayItem("ins_option")]
public List<InsOption> Options { get; set; }
/// <summary>
/// 责任保费
/// </summary>
[XmlElement("premium")]
public string Premium { get; set; }
/// <summary>
/// 保额
/// </summary>
[XmlElement("sum_insured")]
public InsSumInsured SumInsured { get; set; }
}
}
| 24.183908 | 53 | 0.494297 | [
"MIT"
] | leixf2005/Alipay.AopSdk.Core | Alipay.AopSdk.Core/Domain/InsLiability.cs | 2,230 | C# |
// <auto-generated />
namespace SMOSEC.Infrastructure.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
public sealed partial class AddDepartment : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AddDepartment));
string IMigrationMetadata.Id
{
get { return "201805070241293_AddDepartment"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
| 27.733333 | 96 | 0.626202 | [
"MIT"
] | SuperOldDriver/SmoSEC | Source/SMOSEC.Infrastructure/Migrations/201805070241293_AddDepartment.Designer.cs | 832 | C# |
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace LC.Newtonsoft.Json
{
/// <summary>
/// Specifies how constructors are used when initializing objects during deserialization by the <see cref="JsonSerializer"/>.
/// </summary>
public enum ConstructorHandling
{
/// <summary>
/// First attempt to use the public default constructor, then fall back to a single parameterized constructor, then to the non-public default constructor.
/// </summary>
Default = 0,
/// <summary>
/// Json.NET will use a non-public default constructor before falling back to a parameterized constructor.
/// </summary>
AllowNonPublicDefaultConstructor = 1
}
} | 42.674419 | 162 | 0.722616 | [
"MIT"
] | leancloud/csharp-sdk | Libs/Newtonsoft.Json.AOT/ConstructorHandling.cs | 1,837 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные с этой сборкой.
[assembly: AssemblyTitle("EPAM.Task1.2.4.Validator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EPAM.Task1.2.4.Validator")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM задайте для атрибута ComVisible этого типа значение true.
[assembly: ComVisible(false)]
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
[assembly: Guid("298c30fb-2884-4d7c-8a9a-576eae1a3515")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 39.594595 | 93 | 0.762457 | [
"MIT"
] | KlimovKirill/EPAM.XT_NET_WEB | EPAM.Task1/EPAM.Task1.2.4.Validator/Properties/AssemblyInfo.cs | 2,049 | C# |
using BL.Rentas;
using System;
using System.Windows.Forms;
namespace Win.Rentas
{
public partial class FormLogin : Form
{
SeguridadBL _seguridad;
public FormLogin()
{
InitializeComponent();
_seguridad = new SeguridadBL();
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button1_Click(object sender, EventArgs e)
{
string usuario;
string contrasena;
usuario = textBox1.Text;
contrasena = textBox2.Text;
var resultado = _seguridad.Autorizar(usuario, contrasena);
if (resultado == true)
{
MessageBox.Show("Usuario Ingresado Correctamente");
this.Close();
}
else
{
MessageBox.Show("Usuario o contraseña incorrecta");
}
}
}
}
| 22.133333 | 70 | 0.51506 | [
"MIT"
] | edwinmurillo22/Rentas2 | Rentas/Win.Rentas/FormLogin.cs | 999 | C# |
namespace Terka.FontBuilder.Compiler
{
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Terka.FontBuilder.Compiler.Output;
using Terka.FontBuilder.Compiler.Testing;
using Terka.FontBuilder.Extensions;
using Terka.FontBuilder.Parser.Output;
using Terka.FontBuilder.Parser.Output.Context;
using Terka.FontBuilder.Parser.Output.Substitution;
// ReSharper disable InconsistentNaming
// ReSharper disable ObjectCreationAsStatement
/// <summary>
/// Tests for the <see cref="TransformationCompilerBase"/> class.
/// </summary>
[TestFixture]
public class TransformationCompilerBaseTests
{
/// <summary>
/// Tests that <see cref="SubstitutionCompiler.CompileTransformation" /> calls builder correctly on given transformaton.
/// </summary>
/// <param name="table">The table.</param>
/// <param name="expected">The expected.</param>
public void TestCompileTransformation(IGlyphTransformationTable table, IEnumerable<ITransition>[] expected)
{
var builder = new StateMachineBuilderStub();
var compiler = new SubstitutionCompiler();
compiler.CompileTransformation(table, builder);
Assert.IsTrue(expected.ValuesEqual(builder.Paths, new PathEqualityComparer()));
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_GlyphContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 2 in 1 2 3 4 for 5 and 3 in the same context for 6.
* Replaces 8 in 7 8 9 10 for 11 and 9 in the same context for 12.
*/
var table = new GlyphContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 1, 7 }) },
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationRules = new[]
{
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 2, 3, 4 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 2, 3 }) },
ReplacementGlyphIds = new ushort[] { 5, 6 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
},
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 8, 9, 10 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 8, 9 }) },
ReplacementGlyphIds = new ushort[] { 11, 12 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 5 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 6 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 8, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 10, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 8, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 11 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 8, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 10, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 9, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 12 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 8, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 10, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_ClassContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 102 in (101|201) (102|202) (103|203) (104|204) for 105 and 103 in the same context for 106.
* Replaces 108 in (107|207) (108|208) (109|209) (110|210) for 111 and 109 in the same context for 112.
*/
var table = new ClassContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 101, 107 }) },
ClassDefinitions = new RangeGlyphClassDefinition
{
ClassRanges = new Dictionary<Tuple<ushort, ushort>, ushort>
{
{ new Tuple<ushort, ushort>(101, 101), 1 },
{ new Tuple<ushort, ushort>(201, 201), 1 },
{ new Tuple<ushort, ushort>(102, 102), 2 },
{ new Tuple<ushort, ushort>(202, 202), 2 },
{ new Tuple<ushort, ushort>(103, 103), 3 },
{ new Tuple<ushort, ushort>(203, 203), 3 },
{ new Tuple<ushort, ushort>(104, 104), 4 },
{ new Tuple<ushort, ushort>(204, 204), 4 },
{ new Tuple<ushort, ushort>(105, 105), 5 },
{ new Tuple<ushort, ushort>(205, 205), 5 },
{ new Tuple<ushort, ushort>(106, 106), 6 },
{ new Tuple<ushort, ushort>(206, 206), 6 },
{ new Tuple<ushort, ushort>(107, 107), 7 },
{ new Tuple<ushort, ushort>(207, 207), 7 },
{ new Tuple<ushort, ushort>(108, 108), 8 },
{ new Tuple<ushort, ushort>(208, 208), 8 },
{ new Tuple<ushort, ushort>(109, 109), 9 },
{ new Tuple<ushort, ushort>(209, 209), 9 },
{ new Tuple<ushort, ushort>(110, 110), 10 },
{ new Tuple<ushort, ushort>(210, 210), 10 }
}
},
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationRules = new[]
{
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 2, 3, 4 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 102, 103 }) },
ReplacementGlyphIds = new ushort[] { 105, 106 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
},
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 8, 9, 10 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 108, 109 }) },
ReplacementGlyphIds = new ushort[] { 111, 112 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 102, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 105 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 103, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 106 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 108, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 111 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 109, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 112 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_CoverageContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 102 in (101|201) (102|202) (103|203) (104|204) for 105 and 103 in the same context for 106.
*/
var table = new CoverageContextTransformationTable
{
Coverages = new ICoverageTable[]
{
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 101, 201 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 102, 202 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 103, 203 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 104, 204 }) }
},
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationSets = new[] {
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 102, 103 }) },
ReplacementGlyphIds = new ushort[] { 105, 106 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 102, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 105 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 103, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 106 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = -4, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_ChainingGlyphContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 5 in 1 2 3 | 4 5 6 | 7 5 9 for 105 and 6 in the same context for 106.
* Replaces 14 in 10 11 12 | 13 14 15 | 16 17 18 for 114 and 15 in the same context for 115.
*/
var table = new ChainingGlyphContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 4, 13 }) },
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationRules = new[]
{
new[]
{
new ChainingContextTransformationRule
{
Lookback = new ushort[] { 3, 2, 1 },
Context = new ushort[] { 5, 6 },
Lookahead = new ushort[] { 7, 5, 9 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 5, 6 }) },
ReplacementGlyphIds = new ushort[] { 105, 106 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
},
new[]
{
new ChainingContextTransformationRule
{
Lookback = new ushort[] { 12, 11, 10 },
Context = new ushort[] { 14, 15 },
Lookahead = new ushort[] { 16, 17, 18 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 14, 15 }) },
ReplacementGlyphIds = new ushort[] { 114, 115 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 6, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 105 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 6, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 6, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 106 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 6, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 7, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 9, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
},
// Second rule
new[]
{
(ITransition)new SimpleTransition { GlyphId = 10, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 11, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 12, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 13, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 14, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 15, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 16, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 17, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 18, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 14, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 114 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 10, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 11, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 12, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 13, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 14, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 15, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 16, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 17, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 18, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 15, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 115 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 10, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 11, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 12, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 13, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 14, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 15, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 16, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 17, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 18, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_ChainingClassContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 105 in (101|201) (102|202) (103|203) | (104|204) (105|205) (106|206) | (107|207) (108|208) (109|209) for 305 and 106 in the same context for 306.
* Replaces 105 in (110|210) (111|211) (112|212) | (113|213) (114|214) (115|215) | (116|216) (117|217) (118|218) for 305 and 106 in the same context for 306.
*/
var table = new ChainingClassContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 104, 113 }) },
LookupFlags = LookupFlags.IgnoreLigatures,
ContextClassDefinitions = new RangeGlyphClassDefinition
{
ClassRanges = new Dictionary<Tuple<ushort, ushort>, ushort>
{
{ new Tuple<ushort, ushort>(104, 104), 1 },
{ new Tuple<ushort, ushort>(204, 204), 1 },
{ new Tuple<ushort, ushort>(105, 105), 2 },
{ new Tuple<ushort, ushort>(205, 205), 2 },
{ new Tuple<ushort, ushort>(106, 106), 3 },
{ new Tuple<ushort, ushort>(206, 206), 3 },
{ new Tuple<ushort, ushort>(113, 113), 4 },
{ new Tuple<ushort, ushort>(213, 213), 4 },
{ new Tuple<ushort, ushort>(114, 114), 5 },
{ new Tuple<ushort, ushort>(214, 214), 5 },
{ new Tuple<ushort, ushort>(115, 115), 6 },
{ new Tuple<ushort, ushort>(215, 215), 6 },
}
},
LookbackClassDefinition = new RangeGlyphClassDefinition
{
ClassRanges = new Dictionary<Tuple<ushort, ushort>, ushort>
{
{ new Tuple<ushort, ushort>(101, 101), 7 },
{ new Tuple<ushort, ushort>(201, 201), 7 },
{ new Tuple<ushort, ushort>(102, 102), 8 },
{ new Tuple<ushort, ushort>(202, 202), 8 },
{ new Tuple<ushort, ushort>(103, 103), 9 },
{ new Tuple<ushort, ushort>(203, 203), 9 },
{ new Tuple<ushort, ushort>(110, 110), 10 },
{ new Tuple<ushort, ushort>(210, 210), 10 },
{ new Tuple<ushort, ushort>(111, 111), 11 },
{ new Tuple<ushort, ushort>(211, 211), 11 },
{ new Tuple<ushort, ushort>(112, 112), 12 },
{ new Tuple<ushort, ushort>(212, 212), 12 },
}
},
LookaheadClassDefinition = new RangeGlyphClassDefinition
{
ClassRanges = new Dictionary<Tuple<ushort, ushort>, ushort>
{
{ new Tuple<ushort, ushort>(107, 107), 13 },
{ new Tuple<ushort, ushort>(207, 207), 13 },
{ new Tuple<ushort, ushort>(108, 108), 14 },
{ new Tuple<ushort, ushort>(208, 208), 14 },
{ new Tuple<ushort, ushort>(109, 109), 15 },
{ new Tuple<ushort, ushort>(209, 209), 15 },
{ new Tuple<ushort, ushort>(116, 116), 16 },
{ new Tuple<ushort, ushort>(216, 216), 16 },
{ new Tuple<ushort, ushort>(117, 117), 17 },
{ new Tuple<ushort, ushort>(217, 217), 17 },
{ new Tuple<ushort, ushort>(118, 118), 18 },
{ new Tuple<ushort, ushort>(218, 218), 18 }
}
},
TransformationRules = new[]
{
new[]
{
new ChainingContextTransformationRule
{
Lookback = new ushort[] { 9, 8, 7 },
Context = new ushort[] { 2, 3 },
Lookahead = new ushort[] { 13, 14, 15 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 105, 106 }) },
ReplacementGlyphIds = new ushort[] { 305, 306 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
},
new[]
{
new ChainingContextTransformationRule
{
Lookback = new ushort[] { 12, 11, 10 },
Context = new ushort[] { 5, 6 },
Lookahead = new ushort[] { 16, 17, 18 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 114, 115 }) },
ReplacementGlyphIds = new ushort[] { 314, 315 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 105, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 305 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 106, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 306 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
},
// Second rule
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 111, 211 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 112, 212 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 113, 213 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 114, 214 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 115, 215 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 116, 216 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 117, 217 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 118, 218 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 114, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 314 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 111, 211 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 112, 212 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 113, 213 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 114, 214 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 115, 215 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 116, 216 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 117, 217 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 118, 218 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 115, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 315 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 110, 210 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 111, 211 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 112, 212 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 113, 213 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 114, 214 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 115, 215 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 116, 216 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 117, 217 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 118, 218 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly.
/// </summary>
[Test]
public void CompileTransformation_ChainingCoverageContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 104 in (101|201) (102|202) (103|203) | (104|204) (105|205) (106|206) | (107|207) (108|208) (109|209) for 304 and 105 in the same context for 305.
*/
var table = new ChainingCoverageContextSubstitutionTable
{
ContextCoverages = new ICoverageTable[]
{
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 104, 204 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 105, 205 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 106, 206 }) }
},
LookbackCoverages = new ICoverageTable[]
{
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 103, 203 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 102, 202 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 101, 201 }) }
},
LookaheadCoverages = new ICoverageTable[]
{
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 107, 207 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 108, 208 }) },
new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 109, 209 }) }
},
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationSets = new[] {
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 104, 105 }) },
ReplacementGlyphIds = new ushort[] { 304, 305 },
LookupFlags = LookupFlags.IgnoreMarks
}
}
}
}
};
var subMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 104, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 304 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 105, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 305 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SetTransition { GlyphIdSet = new HashSet<ushort>{ 101, 201 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 102, 202 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 103, 203 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 104, 204 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 105, 205 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 106, 206 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 107, 207 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 108, 208 }, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SetTransition { GlyphIdSet = new HashSet<ushort>{ 109, 209 }, HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures },
new AlwaysTransition { HeadShift = -3, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
/// <summary>
/// Tests that CompileTransformation calls builder correctly when given two nested context transformations.
/// </summary>
[Test]
public void CompileTransformation_NestedGlyphContextTransformation_CallsBuilderCorrectly()
{
/* Replaces 3 in context 2 3 4 in context 1 2 3 4 5 for 6.
*/
var table = new GlyphContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 1 }) },
LookupFlags = LookupFlags.IgnoreLigatures,
TransformationRules = new[]
{
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 2, 3, 4, 5 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new GlyphContextTransformationTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 2 }) },
LookupFlags = LookupFlags.IgnoreMarks,
TransformationRules = new[]
{
new[]
{
new ContextTransformationRule
{
Context = new ushort[] { 3, 4 },
TransformationSets = new[]
{
new ContextTransformationSet
{
FirstGlyphIndex = 1,
Transformations = new[]
{
new SimpleReplacementSubstitutionTable
{
Coverage = new ListCoverageTable { CoveredGlyphIdList = new HashSet<ushort>(new ushort[] { 3 }) },
ReplacementGlyphIds = new ushort[] { 6 },
LookupFlags = LookupFlags.IgnoreBaseGlyphs
}
}
}
}
}
}
}
}
}
}
}
}
}
}
};
var subMachineEntryState = new State();
var subSubMachineEntryState = new State();
var expected = new IEnumerable<ITransition>[]
{
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = -5, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new SimpleTransition { GlyphId = 4, HeadShift = -3, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new AlwaysTransition { HeadShift = 0, TargetState = subSubMachineEntryState },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreBaseGlyphs, Action = new SubstitutionAction { ReplacedGlyphCount = 1, ReplacementGlyphIds = new ushort[] { 6 } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subSubMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = -5, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreMarks, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new SimpleTransition { GlyphId = 4, HeadShift = -3, LookupFlags = LookupFlags.IgnoreMarks, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } },
new AlwaysTransition { HeadShift = 0, TargetState = subSubMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1 }, TargetState = new State { Transitions = new ITransition[] { new AlwaysTransition { TargetState = subMachineEntryState } } } }
},
new[]
{
(ITransition)new SimpleTransition { GlyphId = 1, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures } ,
new SimpleTransition { GlyphId = 2, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 3, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 4, HeadShift = 1, LookupFlags = LookupFlags.IgnoreLigatures },
new SimpleTransition { GlyphId = 5, HeadShift = -5, LookupFlags = LookupFlags.IgnoreLigatures, Action = new SubstitutionAction { ReplacedGlyphCount = 0, ReplacementGlyphIds = new[] { SubMachineBuilder.ContextTerminatorGlyphId } } },
new AlwaysTransition { HeadShift = 0, TargetState = subMachineEntryState },
new SimpleTransition { GlyphId = SubMachineBuilder.ContextTerminatorGlyphId, HeadShift = 0, Action = new SubstitutionAction { ReplacedGlyphCount = 1} }
}
};
this.TestCompileTransformation(table, expected);
}
}
}
| 80.617944 | 373 | 0.556588 | [
"Apache-2.0"
] | miloush/Terka.TinyFonts | TerkaFont Builder.Tests.Unit/Compiler/TransformationCompilerBaseTests.cs | 79,975 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.Serialization;
namespace Microsoft.CodeAnalysis.Completion.Providers
{
[DataContract]
internal readonly struct SerializableImportCompletionItem
{
[DataMember(Order = 0)]
public readonly string SymbolKeyData;
[DataMember(Order = 1)]
public readonly string Name;
[DataMember(Order = 2)]
public readonly int Arity;
[DataMember(Order = 3)]
public readonly Glyph Glyph;
[DataMember(Order = 4)]
public readonly string ContainingNamespace;
[DataMember(Order = 5)]
public readonly int AdditionalOverloadCount;
public SerializableImportCompletionItem(string symbolKeyData, string name, int arity, Glyph glyph, string containingNamespace, int additionalOverloadCount)
{
SymbolKeyData = symbolKeyData;
Arity = arity;
Name = name;
Glyph = glyph;
ContainingNamespace = containingNamespace;
AdditionalOverloadCount = additionalOverloadCount;
}
}
}
| 31.097561 | 163 | 0.669804 | [
"MIT"
] | BrianFreemanAtlanta/roslyn | src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/SerializableImportCompletionItem.cs | 1,277 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("10. Format Code")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("10. Format Code")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("55044ac0-bd7b-4863-ab8c-48918c650aad")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.918919 | 84 | 0.741981 | [
"MIT"
] | zachdimitrov/Homework | CSharp-Part-1/01.Introduction-to-Programming/10. Format Code/Properties/AssemblyInfo.cs | 1,406 | C# |
using System;
using System.Linq;
using System.Reactive.Linq;
using Foundation;
using MvvmCross.Platforms.Ios.Presenters.Attributes;
using MvvmCross.Platforms.Ios.Views;
using MvvmCross.Plugin.Color.Platforms.Ios;
using Toggl.Daneel.Extensions;
using Toggl.Daneel.Extensions.Reactive;
using Toggl.Foundation;
using Toggl.Foundation.MvvmCross.Extensions;
using Toggl.Foundation.MvvmCross.Helper;
using Toggl.Foundation.MvvmCross.ViewModels;
using Toggl.Multivac;
using Toggl.Multivac.Extensions;
using UIKit;
using static Toggl.Daneel.Extensions.LoginSignupViewExtensions;
using static Toggl.Daneel.Extensions.ViewExtensions;
namespace Toggl.Daneel.ViewControllers
{
[MvxRootPresentation(WrapInNavigationController = true)]
[MvxFromStoryboard("Login")]
public sealed partial class LoginViewController : ReactiveViewController<LoginViewModel>
{
private const int iPhoneSeScreenHeight = 568;
private bool keyboardIsOpen = false;
private const int topConstraintForBiggerScreens = 72;
private const int topConstraintForBiggerScreensWithKeyboard = 40;
private const int emailTopConstraint = 42;
private const int emailTopConstraintWithKeyboard = 12;
public LoginViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
NavigationController.NavigationBarHidden = true;
PasswordManagerButton.Hidden = !ViewModel.IsPasswordManagerAvailable;
UIKeyboard.Notifications.ObserveWillShow(KeyboardWillShow);
UIKeyboard.Notifications.ObserveWillHide(KeyboardWillHide);
//Text
ViewModel.Email
.Subscribe(EmailTextField.Rx().TextObserver())
.DisposedBy(DisposeBag);
ViewModel.ErrorMessage
.Subscribe(ErrorLabel.Rx().Text())
.DisposedBy(DisposeBag);
ViewModel.Password
.Subscribe(PasswordTextField.Rx().TextObserver())
.DisposedBy(DisposeBag);
EmailTextField.Rx().Text()
.Select(Email.From)
.Subscribe(ViewModel.SetEmail)
.DisposedBy(DisposeBag);
PasswordTextField.Rx().Text()
.Select(Password.From)
.Subscribe(ViewModel.SetPassword)
.DisposedBy(DisposeBag);
ViewModel.IsLoading.Select(loginButtonTitle)
.Subscribe(LoginButton.Rx().AnimatedTitle())
.DisposedBy(DisposeBag);
//Visibility
ViewModel.HasError
.Subscribe(ErrorLabel.Rx().AnimatedIsVisible())
.DisposedBy(DisposeBag);
ViewModel.IsLoading
.Subscribe(ActivityIndicator.Rx().IsVisibleWithFade())
.DisposedBy(DisposeBag);
ViewModel.IsPasswordMasked
.Skip(1)
.Subscribe(PasswordTextField.Rx().SecureTextEntry())
.DisposedBy(DisposeBag);
ViewModel.IsShowPasswordButtonVisible
.Subscribe(ShowPasswordButton.Rx().IsVisible())
.DisposedBy(DisposeBag);
PasswordTextField.FirstResponder
.Subscribe(ViewModel.SetIsShowPasswordButtonVisible)
.DisposedBy(DisposeBag);
//Commands
SignupCard.Rx()
.BindAction(ViewModel.Signup)
.DisposedBy(DisposeBag);
LoginButton.Rx().Tap()
.Subscribe(ViewModel.Login)
.DisposedBy(DisposeBag);
GoogleLoginButton.Rx().Tap()
.Subscribe(ViewModel.GoogleLogin)
.DisposedBy(DisposeBag);
ForgotPasswordButton.Rx()
.BindAction(ViewModel.ForgotPassword)
.DisposedBy(DisposeBag);
PasswordManagerButton.Rx()
.BindAction(ViewModel.StartPasswordManager)
.DisposedBy(DisposeBag);
ShowPasswordButton.Rx().Tap()
.Subscribe(ViewModel.TogglePasswordVisibility)
.DisposedBy(DisposeBag);
//Color
ViewModel.HasError
.Select(loginButtonTintColor)
.Subscribe(LoginButton.Rx().TintColor())
.DisposedBy(DisposeBag);
ViewModel.LoginEnabled
.Select(loginButtonTitleColor)
.Subscribe(LoginButton.Rx().TitleColor())
.DisposedBy(DisposeBag);
//Animation
ViewModel.Shake
.Subscribe(shakeTargets =>
{
if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Email))
EmailTextField.Shake();
if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Password))
PasswordTextField.Shake();
})
.DisposedBy(DisposeBag);
prepareViews();
UIColor loginButtonTintColor(bool hasError)
=> hasError ? UIColor.White : UIColor.Black;
UIColor loginButtonTitleColor(bool enabled) => enabled
? Color.Login.EnabledButtonColor.ToNativeColor()
: Color.Login.DisabledButtonColor.ToNativeColor();
}
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
NavigationController?.SetNavigationBarHidden(true, true);
}
public override void ViewWillDisappear(bool animated)
{
base.ViewWillDisappear(animated);
NavigationController?.SetNavigationBarHidden(false, true);
}
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
if (View.Frame.Height > iPhoneSeScreenHeight && !keyboardIsOpen)
TopConstraint.Constant = topConstraintForBiggerScreens;
SignupCard.SetupBottomCard();
GoogleLoginButton.SetupGoogleButton();
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
ActivityIndicator.Alpha = 0;
ActivityIndicator.StartSpinning();
PasswordTextField.ResignFirstResponder();
}
private void KeyboardWillShow(object sender, UIKeyboardEventArgs e)
{
keyboardIsOpen = true;
if (View.Frame.Height > iPhoneSeScreenHeight)
{
TopConstraint.Constant = topConstraintForBiggerScreensWithKeyboard;
}
else
{
EmailFieldTopConstraint.Constant = emailTopConstraintWithKeyboard;
}
UIView.Animate(Animation.Timings.EnterTiming, () => View.LayoutIfNeeded());
}
private void KeyboardWillHide(object sender, UIKeyboardEventArgs e)
{
keyboardIsOpen = false;
if (View.Frame.Height > iPhoneSeScreenHeight)
{
TopConstraint.Constant = topConstraintForBiggerScreens;
}
else
{
EmailFieldTopConstraint.Constant = emailTopConstraint;
}
UIView.Animate(Animation.Timings.EnterTiming, () => View.LayoutIfNeeded());
}
private void prepareViews()
{
NavigationController.NavigationBarHidden = true;
LoginButton.SetTitleColor(
Color.Login.DisabledButtonColor.ToNativeColor(),
UIControlState.Disabled
);
EmailTextField.ShouldReturn += _ =>
{
PasswordTextField.BecomeFirstResponder();
return false;
};
PasswordTextField.ShouldReturn += _ =>
{
ViewModel.Login();
PasswordTextField.ResignFirstResponder();
return false;
};
View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
{
EmailTextField.ResignFirstResponder();
PasswordTextField.ResignFirstResponder();
}));
prepareForgotPasswordButton();
ShowPasswordButton.SetupShowPasswordButton();
}
private void prepareForgotPasswordButton()
{
var boldFont = UIFont.SystemFontOfSize(12, UIFontWeight.Medium);
var color = Color.Login.ForgotPassword.ToNativeColor();
var text = new NSMutableAttributedString(
Resources.LoginForgotPassword, foregroundColor: color);
var boldText = new NSAttributedString(
Resources.LoginGetHelpLoggingIn,
foregroundColor: color,
font: boldFont);
text.Append(boldText);
ForgotPasswordButton.SetAttributedTitle(text, UIControlState.Normal);
}
private string loginButtonTitle(bool isLoading)
=> isLoading ? "" : Resources.LoginTitle;
}
}
| 34.157303 | 92 | 0.597259 | [
"BSD-3-Clause"
] | undeadinu/mobileapp | Toggl.Daneel/ViewControllers/LoginViewController.cs | 9,122 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using System;
public class ResetButton : MonoBehaviour
{
public GameObject bSphere;
[SerializeField] private float threshold= 0.1f;
[SerializeField] private float deadZone = 0.025f;
private bool _isPressed;
private Vector3 _startPos;
private ConfigurableJoint _joint;
public UnityEvent onPressed, onReleased;
void Start()
{
//basic button functionality
_startPos = transform.localPosition;
_joint = GetComponent<ConfigurableJoint>();
}
// Update is called once per frame
void Update()
{
if ( !_isPressed && GetValue() + threshold >= 1)
Pressed();
if (_isPressed && GetValue() - threshold <= 0)
Released();
}
private float GetValue()
{
var value = Vector3.Distance(_startPos, transform.localPosition) / _joint.linearLimit.limit;
if (Math.Abs(value) < deadZone)
value = 0;
return Mathf.Clamp(value, -1f, 1f);
}
private void Pressed()
{
_isPressed = true;
onPressed.Invoke();
resetBloch();
}
private void Released()
{
_isPressed = false;
onReleased.Invoke();
}
private void resetBloch()
{
//configures blochsphere game object's initial position && current position
bSphere = GameObject.Find("BlochSphere");
Transform blochTransform = bSphere.transform;
Vector3 curBlochPos = blochTransform.position;
Vector3 intiialPos = new Vector3(1.0615f, 1.224f, -0.0152725f); //predefined initial pos for Bloch
if (curBlochPos != intiialPos) //reset position if necessary
{
bSphere.transform.position = intiialPos;
}
}
}
| 23.820513 | 106 | 0.624327 | [
"MIT"
] | Ernesto905/Unity-VR-Bloch-Sphere | Assets/Scripts/ResetButton.cs | 1,858 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assets.Scripts.Utilities
{
[Serializable]
public class Test
{
private string test;
public Test(string test)
{
this.test = test;
}
}
}
| 14.772727 | 34 | 0.621538 | [
"MIT"
] | MindFlare56/Minecrraft2.1 | Assets/Scripts/Utilities/Test.cs | 327 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.EntityFrameworkCore.Query
{
public class SimpleQuerySqliteTest : SimpleQueryTestBase<NorthwindQuerySqliteFixture<NoopModelCustomizer>>
{
// ReSharper disable once UnusedParameter.Local
public SimpleQuerySqliteTest(NorthwindQuerySqliteFixture<NoopModelCustomizer> fixture, ITestOutputHelper testOutputHelper)
: base(fixture)
{
Fixture.TestSqlLoggerFactory.Clear();
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}
// SQLite client-eval
public override async Task Sum_with_division_on_decimal(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Sum_with_division_on_decimal(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Sum_with_division_on_decimal_no_significant_digits(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Sum_with_division_on_decimal_no_significant_digits(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Average_with_division_on_decimal(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Average_with_division_on_decimal(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Average_with_division_on_decimal_no_significant_digits(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Average_with_division_on_decimal_no_significant_digits(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToByte(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToByte(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToDecimal(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToDecimal(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToDouble(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToDouble(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToInt16(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToInt16(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToInt32(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToInt32(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToInt64(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToInt64(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Convert_ToString(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Convert_ToString(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Projecting_Math_Truncate_and_ordering_by_it_twice(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice2(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Projecting_Math_Truncate_and_ordering_by_it_twice2(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Projecting_Math_Truncate_and_ordering_by_it_twice3(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Projecting_Math_Truncate_and_ordering_by_it_twice3(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Query_expression_with_to_string_and_contains(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Query_expression_with_to_string_and_contains(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_datetimeoffset_now_component(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_datetimeoffset_now_component(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_datetimeoffset_utcnow_component(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_datetimeoffset_utcnow_component(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_functions_nested(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_functions_nested(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_guid_newguid(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_guid_newguid(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_abs3(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_abs3(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_acos(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_acos(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_asin(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_asin(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_atan(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_atan(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_atan2(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_atan2(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_ceiling1(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_ceiling1(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_ceiling2(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_ceiling2(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_cos(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_cos(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_exp(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_exp(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_floor(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_floor(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_log(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_log(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_log_new_base(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_log_new_base(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_log10(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_log10(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_power(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_power(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_round(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_round(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_round2(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_round2(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_sign(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_sign(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_sin(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_sin(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_sqrt(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_sqrt(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_tan(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_tan(isAsync)))
.Message);
}
// SQLite client-eval
public override async Task Where_math_truncate(bool isAsync)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Where_math_truncate(isAsync)))
.Message);
}
public override async Task Take_Skip(bool isAsync)
{
await base.Take_Skip(isAsync);
AssertSql(
@"@__p_0='10' (DbType = String)
@__p_1='5' (DbType = String)
SELECT ""t"".""CustomerID"", ""t"".""Address"", ""t"".""City"", ""t"".""CompanyName"", ""t"".""ContactName"", ""t"".""ContactTitle"", ""t"".""Country"", ""t"".""Fax"", ""t"".""Phone"", ""t"".""PostalCode"", ""t"".""Region""
FROM (
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
ORDER BY ""c"".""ContactName""
LIMIT @__p_0
) AS ""t""
ORDER BY ""t"".""ContactName""
LIMIT -1 OFFSET @__p_1");
}
public override async Task Where_datetime_now(bool isAsync)
{
await base.Where_datetime_now(isAsync);
AssertSql(
@"@__myDatetime_0='2015-04-10T00:00:00' (DbType = String)
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', 'now', 'localtime'), '0'), '.') <> @__myDatetime_0) OR @__myDatetime_0 IS NULL");
}
public override async Task Where_datetime_utcnow(bool isAsync)
{
await base.Where_datetime_utcnow(isAsync);
AssertSql(
@"@__myDatetime_0='2015-04-10T00:00:00' (DbType = String)
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', 'now'), '0'), '.') <> @__myDatetime_0) OR @__myDatetime_0 IS NULL");
}
public override async Task Where_datetime_today(bool isAsync)
{
await base.Where_datetime_today(isAsync);
AssertSql(
@"SELECT ""e"".""EmployeeID"", ""e"".""City"", ""e"".""Country"", ""e"".""FirstName"", ""e"".""ReportsTo"", ""e"".""Title""
FROM ""Employees"" AS ""e""
WHERE rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', 'now', 'localtime', 'start of day'), '0'), '.') = rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', 'now', 'localtime', 'start of day'), '0'), '.')");
}
public override async Task Where_datetime_date_component(bool isAsync)
{
await base.Where_datetime_date_component(isAsync);
AssertSql(
@"@__myDatetime_0='1998-05-04T00:00:00' (DbType = String)
SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ((rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", 'start of day'), '0'), '.') = @__myDatetime_0) AND (rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", 'start of day'), '0'), '.') IS NOT NULL AND @__myDatetime_0 IS NOT NULL)) OR (rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", 'start of day'), '0'), '.') IS NULL AND @__myDatetime_0 IS NULL)");
}
public override async Task Where_datetime_year_component(bool isAsync)
{
await base.Where_datetime_year_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%Y', ""o"".""OrderDate"") AS INTEGER) = 1998) AND CAST(strftime('%Y', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_month_component(bool isAsync)
{
await base.Where_datetime_month_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%m', ""o"".""OrderDate"") AS INTEGER) = 4) AND CAST(strftime('%m', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_dayOfYear_component(bool isAsync)
{
await base.Where_datetime_dayOfYear_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%j', ""o"".""OrderDate"") AS INTEGER) = 68) AND CAST(strftime('%j', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_day_component(bool isAsync)
{
await base.Where_datetime_day_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%d', ""o"".""OrderDate"") AS INTEGER) = 4) AND CAST(strftime('%d', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_hour_component(bool isAsync)
{
await base.Where_datetime_hour_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%H', ""o"".""OrderDate"") AS INTEGER) = 14) AND CAST(strftime('%H', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_minute_component(bool isAsync)
{
await base.Where_datetime_minute_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%M', ""o"".""OrderDate"") AS INTEGER) = 23) AND CAST(strftime('%M', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
public override async Task Where_datetime_second_component(bool isAsync)
{
await base.Where_datetime_second_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE (CAST(strftime('%S', ""o"".""OrderDate"") AS INTEGER) = 44) AND CAST(strftime('%S', ""o"".""OrderDate"") AS INTEGER) IS NOT NULL");
}
[ConditionalTheory(Skip = "Issue#15586")]
public override async Task Where_datetime_millisecond_component(bool isAsync)
{
await base.Where_datetime_millisecond_component(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""CustomerID"", ""o"".""EmployeeID"", ""o"".""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ((CAST(strftime('%f', ""o"".""OrderDate"") AS REAL) * 1000) % 1000) = 88");
}
public override async Task String_StartsWith_Literal(bool isAsync)
{
await base.String_StartsWith_Literal(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE 'M%')");
}
public override async Task String_StartsWith_Identity(bool isAsync)
{
await base.String_StartsWith_Identity(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))");
}
public override async Task String_StartsWith_Column(bool isAsync)
{
await base.String_StartsWith_Column(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))");
}
public override async Task String_StartsWith_MethodCall(bool isAsync)
{
await base.String_StartsWith_MethodCall(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE 'M%')");
}
public override async Task String_EndsWith_Literal(bool isAsync)
{
await base.String_EndsWith_Literal(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE '%b')");
}
public override async Task String_EndsWith_Identity(bool isAsync)
{
await base.String_EndsWith_Identity(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))");
}
public override async Task String_EndsWith_Column(bool isAsync)
{
await base.String_EndsWith_Column(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))");
}
public override async Task String_EndsWith_MethodCall(bool isAsync)
{
await base.String_EndsWith_MethodCall(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE '%m')");
}
public override async Task String_Contains_Literal(bool isAsync)
{
await base.String_Contains_Literal(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ('M' = '') OR (instr(""c"".""ContactName"", 'M') > 0)");
}
public override async Task String_Contains_Identity(bool isAsync)
{
await base.String_Contains_Identity(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (instr(""c"".""ContactName"", ""c"".""ContactName"") > 0)");
}
public override async Task String_Contains_Column(bool isAsync)
{
await base.String_Contains_Column(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((""c"".""ContactName"" = '') AND ""c"".""ContactName"" IS NOT NULL) OR (instr(""c"".""ContactName"", ""c"".""ContactName"") > 0)");
}
public override async Task String_Contains_MethodCall(bool isAsync)
{
await base.String_Contains_MethodCall(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ('M' = '') OR (instr(""c"".""ContactName"", 'M') > 0)");
}
public override async Task IsNullOrWhiteSpace_in_predicate(bool isAsync)
{
await base.IsNullOrWhiteSpace_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ""c"".""Region"" IS NULL OR ((trim(""c"".""Region"") = '') AND trim(""c"".""Region"") IS NOT NULL)");
}
public override async Task Where_string_length(bool isAsync)
{
await base.Where_string_length(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (length(""c"".""City"") = 6) AND length(""c"".""City"") IS NOT NULL");
}
public override async Task Where_string_indexof(bool isAsync)
{
await base.Where_string_indexof(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE ((instr(""c"".""City"", 'Sea') - 1) <> -1) OR instr(""c"".""City"", 'Sea') - 1 IS NULL");
}
public override async Task Indexof_with_emptystring(bool isAsync)
{
await base.Indexof_with_emptystring(isAsync);
AssertSql(
@"SELECT instr(""c"".""ContactName"", '') - 1
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Where_string_replace(bool isAsync)
{
await base.Where_string_replace(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (replace(""c"".""City"", 'Sea', 'Rea') = 'Reattle') AND replace(""c"".""City"", 'Sea', 'Rea') IS NOT NULL");
}
public override async Task Replace_with_emptystring(bool isAsync)
{
await base.Replace_with_emptystring(isAsync);
AssertSql(
@"SELECT replace(""c"".""ContactName"", 'ari', '')
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Where_string_substring(bool isAsync)
{
await base.Where_string_substring(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (substr(""c"".""City"", 1 + 1, 2) = 'ea') AND substr(""c"".""City"", 1 + 1, 2) IS NOT NULL");
}
public override async Task Substring_with_zero_startindex(bool isAsync)
{
await base.Substring_with_zero_startindex(isAsync);
AssertSql(
@"SELECT substr(""c"".""ContactName"", 0 + 1, 3)
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Substring_with_constant(bool isAsync)
{
await base.Substring_with_constant(isAsync);
AssertSql(
@"SELECT substr(""c"".""ContactName"", 1 + 1, 3)
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Substring_with_closure(bool isAsync)
{
await base.Substring_with_closure(isAsync);
AssertSql(
@"@__start_0='2' (DbType = String)
SELECT substr(""c"".""ContactName"", @__start_0 + 1, 3)
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Substring_with_Index_of(bool isAsync)
{
await base.Substring_with_Index_of(isAsync);
AssertSql(
@"SELECT substr(""c"".""ContactName"", (instr(""c"".""ContactName"", 'a') - 1) + 1, 3)
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Substring_with_zero_length(bool isAsync)
{
await base.Substring_with_zero_length(isAsync);
AssertSql(
@"SELECT substr(""c"".""ContactName"", 2 + 1, 0)
FROM ""Customers"" AS ""c""
WHERE ""c"".""CustomerID"" = 'ALFKI'");
}
public override async Task Where_math_abs1(bool isAsync)
{
await base.Where_math_abs1(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice""
FROM ""Order Details"" AS ""o""
WHERE abs(""o"".""ProductID"") > 10");
}
public override async Task Where_math_abs2(bool isAsync)
{
await base.Where_math_abs2(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice""
FROM ""Order Details"" AS ""o""
WHERE abs(""o"".""Quantity"") > 10");
}
public override async Task Where_math_abs_uncorrelated(bool isAsync)
{
await base.Where_math_abs_uncorrelated(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice""
FROM ""Order Details"" AS ""o""
WHERE 10 < ""o"".""ProductID""");
}
public override async Task Select_math_round_int(bool isAsync)
{
await base.Select_math_round_int(isAsync);
AssertSql(
@"SELECT round(CAST(""o"".""OrderID"" AS REAL)) AS ""A""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderID"" < 10250");
}
public override async Task Where_math_min(bool isAsync)
{
await base.Where_math_min(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice""
FROM ""Order Details"" AS ""o""
WHERE (""o"".""OrderID"" = 11077) AND (min(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""ProductID"")");
}
public override async Task Where_math_max(bool isAsync)
{
await base.Where_math_max(isAsync);
AssertSql(
@"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice""
FROM ""Order Details"" AS ""o""
WHERE (""o"".""OrderID"" = 11077) AND (max(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""OrderID"")");
}
public override async Task Where_string_to_lower(bool isAsync)
{
await base.Where_string_to_lower(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE lower(""c"".""CustomerID"") = 'alfki'");
}
public override async Task Where_string_to_upper(bool isAsync)
{
await base.Where_string_to_upper(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE upper(""c"".""CustomerID"") = 'ALFKI'");
}
public override async Task TrimStart_without_arguments_in_predicate(bool isAsync)
{
await base.TrimStart_without_arguments_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (ltrim(""c"".""ContactTitle"") = 'Owner') AND ltrim(""c"".""ContactTitle"") IS NOT NULL");
}
public override async Task TrimStart_with_char_argument_in_predicate(bool isAsync)
{
await base.TrimStart_with_char_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (ltrim(""c"".""ContactTitle"", 'O') = 'wner') AND ltrim(""c"".""ContactTitle"", 'O') IS NOT NULL");
}
public override async Task TrimStart_with_char_array_argument_in_predicate(bool isAsync)
{
await base.TrimStart_with_char_array_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (ltrim(""c"".""ContactTitle"", 'Ow') = 'ner') AND ltrim(""c"".""ContactTitle"", 'Ow') IS NOT NULL");
}
public override async Task TrimEnd_without_arguments_in_predicate(bool isAsync)
{
await base.TrimEnd_without_arguments_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (rtrim(""c"".""ContactTitle"") = 'Owner') AND rtrim(""c"".""ContactTitle"") IS NOT NULL");
}
public override async Task TrimEnd_with_char_argument_in_predicate(bool isAsync)
{
await base.TrimEnd_with_char_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (rtrim(""c"".""ContactTitle"", 'r') = 'Owne') AND rtrim(""c"".""ContactTitle"", 'r') IS NOT NULL");
}
public override async Task TrimEnd_with_char_array_argument_in_predicate(bool isAsync)
{
await base.TrimEnd_with_char_array_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (rtrim(""c"".""ContactTitle"", 'er') = 'Own') AND rtrim(""c"".""ContactTitle"", 'er') IS NOT NULL");
}
public override async Task Trim_without_argument_in_predicate(bool isAsync)
{
await base.Trim_without_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (trim(""c"".""ContactTitle"") = 'Owner') AND trim(""c"".""ContactTitle"") IS NOT NULL");
}
public override async Task Trim_with_char_argument_in_predicate(bool isAsync)
{
await base.Trim_with_char_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (trim(""c"".""ContactTitle"", 'O') = 'wner') AND trim(""c"".""ContactTitle"", 'O') IS NOT NULL");
}
public override async Task Trim_with_char_array_argument_in_predicate(bool isAsync)
{
await base.Trim_with_char_array_argument_in_predicate(isAsync);
AssertSql(
@"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
WHERE (trim(""c"".""ContactTitle"", 'Or') = 'wne') AND trim(""c"".""ContactTitle"", 'Or') IS NOT NULL");
}
public override async Task Select_datetime_year_component(bool isAsync)
{
await base.Select_datetime_year_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%Y', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual async Task Select_datetime_year_component_composed(bool isAsync)
{
await AssertQueryScalar(
isAsync,
ss => ss.Set<Order>().Select(o => o.OrderDate.Value.AddYears(1).Year));
AssertSql(
@"SELECT CAST(strftime('%Y', ""o"".""OrderDate"", CAST(1 AS TEXT) || ' years') AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_month_component(bool isAsync)
{
await base.Select_datetime_month_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%m', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_day_of_year_component(bool isAsync)
{
await base.Select_datetime_day_of_year_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%j', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_day_component(bool isAsync)
{
await base.Select_datetime_day_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%d', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_hour_component(bool isAsync)
{
await base.Select_datetime_hour_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%H', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_minute_component(bool isAsync)
{
await base.Select_datetime_minute_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%M', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_second_component(bool isAsync)
{
await base.Select_datetime_second_component(isAsync);
AssertSql(
@"SELECT CAST(strftime('%S', ""o"".""OrderDate"") AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_millisecond_component(bool isAsync)
{
await base.Select_datetime_millisecond_component(isAsync);
AssertSql(
@"SELECT (CAST(strftime('%f', ""o"".""OrderDate"") AS REAL) * 1000.0) % 1000.0
FROM ""Orders"" AS ""o""");
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual async Task Select_datetime_millisecond_component_composed(bool isAsync)
{
await AssertQueryScalar(
isAsync,
ss => ss.Set<Order>().Select(o => o.OrderDate.Value.AddYears(1).Millisecond));
AssertSql(
@"SELECT (CAST(strftime('%f', ""o"".""OrderDate"", CAST(1 AS TEXT) || ' years') AS REAL) * 1000.0) % 1000.0
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_DayOfWeek_component(bool isAsync)
{
await base.Select_datetime_DayOfWeek_component(isAsync);
AssertSql(
@"SELECT CAST(CAST(strftime('%w', ""o"".""OrderDate"") AS INTEGER) AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_Ticks_component(bool isAsync)
{
await base.Select_datetime_Ticks_component(isAsync);
AssertSql(
@"SELECT CAST(((julianday(""o"".""OrderDate"") - 1721425.5) * 864000000000.0) AS INTEGER)
FROM ""Orders"" AS ""o""");
}
public override async Task Select_datetime_TimeOfDay_component(bool isAsync)
{
await base.Select_datetime_TimeOfDay_component(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%H:%M:%f', ""o"".""OrderDate""), '0'), '.')
FROM ""Orders"" AS ""o""");
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual async Task Select_datetime_TimeOfDay_component_composed(bool isAsync)
{
await AssertQueryScalar(
isAsync,
ss => ss.Set<Order>().Select(o => o.OrderDate.Value.AddYears(1).TimeOfDay));
AssertSql(
@"SELECT rtrim(rtrim(strftime('%H:%M:%f', ""o"".""OrderDate"", CAST(1 AS TEXT) || ' years'), '0'), '.')
FROM ""Orders"" AS ""o""");
}
public override async Task Select_expression_date_add_year(bool isAsync)
{
await base.Select_expression_date_add_year(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(1 AS TEXT) || ' years'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_datetime_add_month(bool isAsync)
{
await base.Select_expression_datetime_add_month(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(1 AS TEXT) || ' months'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_datetime_add_hour(bool isAsync)
{
await base.Select_expression_datetime_add_hour(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(1.0 AS TEXT) || ' hours'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_datetime_add_minute(bool isAsync)
{
await base.Select_expression_datetime_add_minute(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(1.0 AS TEXT) || ' minutes'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_datetime_add_second(bool isAsync)
{
await base.Select_expression_datetime_add_second(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(1.0 AS TEXT) || ' seconds'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_datetime_add_ticks(bool isAsync)
{
await base.Select_expression_datetime_add_ticks(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST((10000 / 864000000000) AS TEXT) || ' seconds'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_date_add_milliseconds_above_the_range(bool isAsync)
{
await base.Select_expression_date_add_milliseconds_above_the_range(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST((1000000000000.0 / 1000.0) AS TEXT) || ' seconds'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_date_add_milliseconds_below_the_range(bool isAsync)
{
await base.Select_expression_date_add_milliseconds_below_the_range(isAsync);
AssertSql(
@"SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST((-1000000000000.0 / 1000.0) AS TEXT) || ' seconds'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Select_expression_date_add_milliseconds_large_number_divided(bool isAsync)
{
await base.Select_expression_date_add_milliseconds_large_number_divided(isAsync);
AssertSql(
@"@__millisecondsPerDay_0='86400000' (DbType = String)
SELECT rtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f', ""o"".""OrderDate"", CAST(CAST((CAST(((CAST(strftime('%f', ""o"".""OrderDate"") AS REAL) * 1000.0) % 1000.0) AS INTEGER) / @__millisecondsPerDay_0) AS REAL) AS TEXT) || ' days', CAST((CAST((CAST(((CAST(strftime('%f', ""o"".""OrderDate"") AS REAL) * 1000.0) % 1000.0) AS INTEGER) % @__millisecondsPerDay_0) AS REAL) / 1000.0) AS TEXT) || ' seconds'), '0'), '.') AS ""OrderDate""
FROM ""Orders"" AS ""o""
WHERE ""o"".""OrderDate"" IS NOT NULL");
}
public override async Task Decimal_cast_to_double_works(bool isAsync)
{
await base.Decimal_cast_to_double_works(isAsync);
AssertSql(
@"SELECT ""p"".""ProductID"", ""p"".""Discontinued"", ""p"".""ProductName"", ""p"".""SupplierID"", ""p"".""UnitPrice"", ""p"".""UnitsInStock""
FROM ""Products"" AS ""p""
WHERE CAST(""p"".""UnitPrice"" AS REAL) > 100.0");
}
public override async Task Select_distinct_long_count(bool isAsync)
{
await base.Select_distinct_long_count(isAsync);
AssertSql(
@"SELECT COUNT(*)
FROM (
SELECT DISTINCT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
) AS ""t""");
}
public override async Task Select_orderBy_skip_long_count(bool isAsync)
{
await base.Select_orderBy_skip_long_count(isAsync);
AssertSql(
@"@__p_0='7' (DbType = String)
SELECT COUNT(*)
FROM (
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
ORDER BY ""c"".""Country""
LIMIT -1 OFFSET @__p_0
) AS ""t""");
}
public override async Task Select_orderBy_take_long_count(bool isAsync)
{
await base.Select_orderBy_take_long_count(isAsync);
AssertSql(
@"@__p_0='7' (DbType = String)
SELECT COUNT(*)
FROM (
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
ORDER BY ""c"".""Country""
LIMIT @__p_0
) AS ""t""");
}
public override async Task Select_skip_long_count(bool isAsync)
{
await base.Select_skip_long_count(isAsync);
AssertSql(
@"@__p_0='7' (DbType = String)
SELECT COUNT(*)
FROM (
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
ORDER BY (SELECT 1)
LIMIT -1 OFFSET @__p_0
) AS ""t""");
}
public override async Task Select_take_long_count(bool isAsync)
{
await base.Select_take_long_count(isAsync);
AssertSql(
@"@__p_0='7' (DbType = String)
SELECT COUNT(*)
FROM (
SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region""
FROM ""Customers"" AS ""c""
LIMIT @__p_0
) AS ""t""");
}
[ConditionalTheory(Skip = "SQLite bug")]
public override Task Project_single_element_from_collection_with_multiple_OrderBys_Take_and_FirstOrDefault_2(bool isAsync)
=> base.Project_single_element_from_collection_with_multiple_OrderBys_Take_and_FirstOrDefault_2(isAsync);
// Sqlite does not support cross/outer apply
public override void Select_nested_collection_multi_level()
{
}
public override Task SelectMany_correlated_with_outer_1(bool isAsync) => null;
public override Task SelectMany_correlated_with_outer_2(bool isAsync) => null;
public override Task SelectMany_correlated_with_outer_3(bool isAsync) => null;
public override Task SelectMany_correlated_with_outer_4(bool isAsync) => null;
public override Task Complex_nested_query_doesnt_try_binding_to_grandparent_when_parent_returns_complex_result(bool isAsync) => null;
public override Task SelectMany_correlated_subquery_hard(bool isAsync) => null;
public override Task SelectMany_whose_selector_references_outer_source(bool isAsync) => null;
public override Task AsQueryable_in_query_server_evals(bool isAsync) => null;
[ConditionalTheory(Skip = "Issue#17324")]
public override Task Project_single_element_from_collection_with_OrderBy_over_navigation_Take_and_FirstOrDefault_2(bool isAsync)
{
return base.Project_single_element_from_collection_with_OrderBy_over_navigation_Take_and_FirstOrDefault_2(isAsync);
}
[ConditionalTheory(Skip = "Issue#17223")]
public override Task Like_with_non_string_column_using_ToString(bool isAsync)
{
return base.Like_with_non_string_column_using_ToString(isAsync);
}
public override async Task Member_binding_after_ctor_arguments_fails_with_client_eval(bool isAsync)
{
Assert.Equal(
CoreStrings.TranslationFailed("OrderBy<Customer, string>( source: DbSet<Customer>, keySelector: (c) => new CustomerListItem( c.CustomerID, c.City ).City)"),
RemoveNewLines(
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Member_binding_after_ctor_arguments_fails_with_client_eval(isAsync))).Message));
}
[ConditionalTheory(Skip = "Issue#17230")]
public override Task SelectMany_with_collection_being_correlated_subquery_which_references_inner_and_outer_entity(bool isAsync)
{
return base.SelectMany_with_collection_being_correlated_subquery_which_references_inner_and_outer_entity(isAsync);
}
private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);
}
}
| 42.927622 | 426 | 0.554263 | [
"Apache-2.0"
] | ZhuangXiaoMi/EntityFrameworkCore | test/EFCore.Sqlite.FunctionalTests/Query/SimpleQuerySqliteTest.cs | 58,126 | C# |
using System;
using System.Reflection;
using Newtonsoft.Json;
namespace Nest
{
internal class ReserializeJsonConverter<TReadAs, TInterface> : JsonConverter
where TReadAs : class, TInterface
where TInterface : class
{
protected ReadAsTypeJsonConverter<TReadAs> Reader { get; } = new ReadAsTypeJsonConverter<TReadAs>();
public override bool CanRead => true;
public override bool CanWrite => true;
public override bool CanConvert(Type objectType) => typeof(TInterface).IsAssignableFrom(objectType);
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType != JsonToken.StartObject) return null;
var depth = reader.Depth;
var deserialized = this.DeserializeJson(reader, objectType, existingValue, serializer);
return reader.ReadToEnd(depth, deserialized);
}
protected TReadAs ReadAs(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
return this.Reader.ReadJson(reader, objectType, existingValue, serializer) as TReadAs;
}
protected virtual object DeserializeJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) =>
this.ReadAs(reader, objectType, existingValue, serializer);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (!(value is TInterface v)) return;
this.SerializeJson(writer, value, v, serializer);
}
protected virtual void SerializeJson(JsonWriter writer, object value, TInterface castValue, JsonSerializer serializer)
{
this.Reserialize(writer, value, serializer);
}
protected virtual bool SkipWriteProperty(string propertyName) => false;
protected void Reserialize(JsonWriter writer, object value, JsonSerializer serializer, Action<JsonWriter> inlineWriter = null)
{
var properties = value.GetType().GetCachedObjectProperties();
if (properties.Count == 0) return;
writer.WriteStartObject();
inlineWriter?.Invoke(writer);
foreach (var p in properties)
{
if (p.Ignored || SkipWriteProperty(p.PropertyName)) continue;
var vv = p.ValueProvider.GetValue(value);
if (vv == null) continue;
writer.WritePropertyName(p.PropertyName);
if (p.Converter?.GetType() == typeof(SourceValueWriteConverter))
SourceValueWriteConverter.Write(writer, vv, serializer);
else
serializer.Serialize(writer, vv);
}
writer.WriteEndObject();
}
}
}
| 35.385714 | 130 | 0.758579 | [
"Apache-2.0"
] | Tchami/elasticsearch-net | src/Nest/CommonAbstractions/SerializationBehavior/GenericJsonConverters/ReserializeJsonConverter.cs | 2,477 | C# |
namespace CloudYourself.Backend.AppServices.Aws.Aggregates.TennantSettings
{
/// <summary>
/// Contains infos about the necessary AWS IAM account to work with AWS apis.
/// </summary>
public class IamAccount
{
/// <summary>
/// Gets or sets the access key identifier.
/// </summary>
/// <value>
/// The access key identifier.
/// </value>
public string AccessKeyId { get; set; }
/// <summary>
/// Gets or sets the secret.
/// </summary>
/// <value>
/// The secret.
/// </value>
public string Secret { get; set; }
}
}
| 26.2 | 81 | 0.528244 | [
"Apache-2.0"
] | continental/cloud-yourself | Backend/AppServices/Aws/Src/Aggregates/TennantSettings/IamAccount.cs | 657 | C# |
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace RealEstate.Models
{
public class Address
{
[Key]
public int AddressId { get; set; }
[Display(Name = "Address:")]
public string StreetAddress { get; set; }
[Display(Name = "City:")]
public string City { get; set; }
[Display(Name = "State:")]
public string State { get; set; }
[Display(Name = "Zip Code:")]
public int Zip { get; set; }
[Display(Name = "Longitude:")]
public double Longitude { get; set; }
[Display(Name = "Latitude:")]
public double Latitude { get; set; }
public Int64 PropertyId { get; set; }
[ForeignKey("PropertyInfo")]
public int? PropertyInfoId { get; set; }
public PropertyInfo PropertyInfo { get; set; }
}
}
| 24.857143 | 54 | 0.613985 | [
"MIT"
] | rzh1999/RealEstateProject | RealEstate/Models/Address.cs | 1,046 | C# |
using System;
using System.Collections.Generic;
using System.Threading;
using Pathfinding.RVO.Sampled;
using UnityEngine;
namespace Pathfinding.RVO
{
// Token: 0x0200006D RID: 109
public class Simulator
{
// Token: 0x060004D0 RID: 1232 RVA: 0x0001ABCC File Offset: 0x00018FCC
public Simulator(int workers, bool doubleBuffering, MovementPlane movementPlane)
{
this.workers = new Simulator.Worker[workers];
this.doubleBuffering = doubleBuffering;
this.DesiredDeltaTime = 1f;
this.movementPlane = movementPlane;
this.Quadtree = new RVOQuadtree();
for (int i = 0; i < workers; i++)
{
this.workers[i] = new Simulator.Worker(this);
}
this.agents = new List<Agent>();
this.obstacles = new List<ObstacleVertex>();
}
// Token: 0x170000DD RID: 221
// (get) Token: 0x060004D1 RID: 1233 RVA: 0x0001AC78 File Offset: 0x00019078
// (set) Token: 0x060004D2 RID: 1234 RVA: 0x0001AC80 File Offset: 0x00019080
public RVOQuadtree Quadtree { get; private set; }
// Token: 0x170000DE RID: 222
// (get) Token: 0x060004D3 RID: 1235 RVA: 0x0001AC89 File Offset: 0x00019089
public float DeltaTime
{
get
{
return this.deltaTime;
}
}
// Token: 0x170000DF RID: 223
// (get) Token: 0x060004D4 RID: 1236 RVA: 0x0001AC91 File Offset: 0x00019091
public bool Multithreading
{
get
{
return this.workers != null && this.workers.Length > 0;
}
}
// Token: 0x170000E0 RID: 224
// (get) Token: 0x060004D5 RID: 1237 RVA: 0x0001ACAC File Offset: 0x000190AC
// (set) Token: 0x060004D6 RID: 1238 RVA: 0x0001ACB4 File Offset: 0x000190B4
public float DesiredDeltaTime
{
get
{
return this.desiredDeltaTime;
}
set
{
this.desiredDeltaTime = Math.Max(value, 0f);
}
}
// Token: 0x060004D7 RID: 1239 RVA: 0x0001ACC7 File Offset: 0x000190C7
public List<Agent> GetAgents()
{
return this.agents;
}
// Token: 0x060004D8 RID: 1240 RVA: 0x0001ACCF File Offset: 0x000190CF
public List<ObstacleVertex> GetObstacles()
{
return this.obstacles;
}
// Token: 0x060004D9 RID: 1241 RVA: 0x0001ACD8 File Offset: 0x000190D8
public void ClearAgents()
{
this.BlockUntilSimulationStepIsDone();
for (int i = 0; i < this.agents.Count; i++)
{
this.agents[i].simulator = null;
}
this.agents.Clear();
}
// Token: 0x060004DA RID: 1242 RVA: 0x0001AD24 File Offset: 0x00019124
public void OnDestroy()
{
if (this.workers != null)
{
for (int i = 0; i < this.workers.Length; i++)
{
this.workers[i].Terminate();
}
}
}
// Token: 0x060004DB RID: 1243 RVA: 0x0001AD64 File Offset: 0x00019164
~Simulator()
{
this.OnDestroy();
}
// Token: 0x060004DC RID: 1244 RVA: 0x0001AD94 File Offset: 0x00019194
public IAgent AddAgent(IAgent agent)
{
if (agent == null)
{
throw new ArgumentNullException("Agent must not be null");
}
Agent agent2 = agent as Agent;
if (agent2 == null)
{
throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
}
if (agent2.simulator != null && agent2.simulator == this)
{
throw new ArgumentException("The agent is already in the simulation");
}
if (agent2.simulator != null)
{
throw new ArgumentException("The agent is already added to another simulation");
}
agent2.simulator = this;
this.BlockUntilSimulationStepIsDone();
this.agents.Add(agent2);
return agent;
}
// Token: 0x060004DD RID: 1245 RVA: 0x0001AE27 File Offset: 0x00019227
[Obsolete("Use AddAgent(Vector2,float) instead")]
public IAgent AddAgent(Vector3 position)
{
return this.AddAgent(new Vector2(position.x, position.z), position.y);
}
// Token: 0x060004DE RID: 1246 RVA: 0x0001AE49 File Offset: 0x00019249
public IAgent AddAgent(Vector2 position, float elevationCoordinate)
{
return this.AddAgent(new Agent(position, elevationCoordinate));
}
// Token: 0x060004DF RID: 1247 RVA: 0x0001AE58 File Offset: 0x00019258
public void RemoveAgent(IAgent agent)
{
if (agent == null)
{
throw new ArgumentNullException("Agent must not be null");
}
Agent agent2 = agent as Agent;
if (agent2 == null)
{
throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
}
if (agent2.simulator != this)
{
throw new ArgumentException("The agent is not added to this simulation");
}
this.BlockUntilSimulationStepIsDone();
agent2.simulator = null;
if (!this.agents.Remove(agent2))
{
throw new ArgumentException("Critical Bug! This should not happen. Please report this.");
}
}
// Token: 0x060004E0 RID: 1248 RVA: 0x0001AED9 File Offset: 0x000192D9
public ObstacleVertex AddObstacle(ObstacleVertex v)
{
if (v == null)
{
throw new ArgumentNullException("Obstacle must not be null");
}
this.BlockUntilSimulationStepIsDone();
this.obstacles.Add(v);
this.UpdateObstacles();
return v;
}
// Token: 0x060004E1 RID: 1249 RVA: 0x0001AF05 File Offset: 0x00019305
public ObstacleVertex AddObstacle(Vector3[] vertices, float height, bool cycle = true)
{
return this.AddObstacle(vertices, height, Matrix4x4.identity, RVOLayer.DefaultObstacle, cycle);
}
// Token: 0x060004E2 RID: 1250 RVA: 0x0001AF18 File Offset: 0x00019318
public ObstacleVertex AddObstacle(Vector3[] vertices, float height, Matrix4x4 matrix, RVOLayer layer = RVOLayer.DefaultObstacle, bool cycle = true)
{
if (vertices == null)
{
throw new ArgumentNullException("Vertices must not be null");
}
if (vertices.Length < 2)
{
throw new ArgumentException("Less than 2 vertices in an obstacle");
}
ObstacleVertex obstacleVertex = null;
ObstacleVertex obstacleVertex2 = null;
this.BlockUntilSimulationStepIsDone();
for (int i = 0; i < vertices.Length; i++)
{
ObstacleVertex obstacleVertex3 = new ObstacleVertex
{
prev = obstacleVertex2,
layer = layer,
height = height
};
if (obstacleVertex == null)
{
obstacleVertex = obstacleVertex3;
}
else
{
obstacleVertex2.next = obstacleVertex3;
}
obstacleVertex2 = obstacleVertex3;
}
if (cycle)
{
obstacleVertex2.next = obstacleVertex;
obstacleVertex.prev = obstacleVertex2;
}
this.UpdateObstacle(obstacleVertex, vertices, matrix);
this.obstacles.Add(obstacleVertex);
return obstacleVertex;
}
// Token: 0x060004E3 RID: 1251 RVA: 0x0001AFCC File Offset: 0x000193CC
public ObstacleVertex AddObstacle(Vector3 a, Vector3 b, float height)
{
ObstacleVertex obstacleVertex = new ObstacleVertex();
ObstacleVertex obstacleVertex2 = new ObstacleVertex();
obstacleVertex.layer = RVOLayer.DefaultObstacle;
obstacleVertex2.layer = RVOLayer.DefaultObstacle;
obstacleVertex.prev = obstacleVertex2;
obstacleVertex2.prev = obstacleVertex;
obstacleVertex.next = obstacleVertex2;
obstacleVertex2.next = obstacleVertex;
obstacleVertex.position = a;
obstacleVertex2.position = b;
obstacleVertex.height = height;
obstacleVertex2.height = height;
obstacleVertex2.ignore = true;
ObstacleVertex obstacleVertex3 = obstacleVertex;
Vector2 vector = new Vector2(b.x - a.x, b.z - a.z);
obstacleVertex3.dir = vector.normalized;
obstacleVertex2.dir = -obstacleVertex.dir;
this.BlockUntilSimulationStepIsDone();
this.obstacles.Add(obstacleVertex);
this.UpdateObstacles();
return obstacleVertex;
}
// Token: 0x060004E4 RID: 1252 RVA: 0x0001B090 File Offset: 0x00019490
public void UpdateObstacle(ObstacleVertex obstacle, Vector3[] vertices, Matrix4x4 matrix)
{
if (vertices == null)
{
throw new ArgumentNullException("Vertices must not be null");
}
if (obstacle == null)
{
throw new ArgumentNullException("Obstacle must not be null");
}
if (vertices.Length < 2)
{
throw new ArgumentException("Less than 2 vertices in an obstacle");
}
bool flag = matrix == Matrix4x4.identity;
this.BlockUntilSimulationStepIsDone();
int i = 0;
ObstacleVertex obstacleVertex = obstacle;
while (i < vertices.Length)
{
obstacleVertex.position = ((!flag) ? matrix.MultiplyPoint3x4(vertices[i]) : vertices[i]);
obstacleVertex = obstacleVertex.next;
i++;
if (obstacleVertex == obstacle || obstacleVertex == null)
{
obstacleVertex = obstacle;
do
{
if (obstacleVertex.next == null)
{
obstacleVertex.dir = Vector2.zero;
}
else
{
Vector3 vector = obstacleVertex.next.position - obstacleVertex.position;
ObstacleVertex obstacleVertex2 = obstacleVertex;
Vector2 vector2 = new Vector2(vector.x, vector.z);
obstacleVertex2.dir = vector2.normalized;
}
obstacleVertex = obstacleVertex.next;
}
while (obstacleVertex != obstacle && obstacleVertex != null);
this.ScheduleCleanObstacles();
this.UpdateObstacles();
return;
}
}
Debug.DrawLine(obstacleVertex.prev.position, obstacleVertex.position, Color.red);
throw new ArgumentException("Obstacle has more vertices than supplied for updating (" + vertices.Length + " supplied)");
}
// Token: 0x060004E5 RID: 1253 RVA: 0x0001B1E8 File Offset: 0x000195E8
private void ScheduleCleanObstacles()
{
this.doCleanObstacles = true;
}
// Token: 0x060004E6 RID: 1254 RVA: 0x0001B1F1 File Offset: 0x000195F1
private void CleanObstacles()
{
}
// Token: 0x060004E7 RID: 1255 RVA: 0x0001B1F3 File Offset: 0x000195F3
public void RemoveObstacle(ObstacleVertex v)
{
if (v == null)
{
throw new ArgumentNullException("Vertex must not be null");
}
this.BlockUntilSimulationStepIsDone();
this.obstacles.Remove(v);
this.UpdateObstacles();
}
// Token: 0x060004E8 RID: 1256 RVA: 0x0001B21F File Offset: 0x0001961F
public void UpdateObstacles()
{
this.doUpdateObstacles = true;
}
// Token: 0x060004E9 RID: 1257 RVA: 0x0001B228 File Offset: 0x00019628
private void BuildQuadtree()
{
this.Quadtree.Clear();
if (this.agents.Count > 0)
{
Rect bounds = Rect.MinMaxRect(this.agents[0].position.x, this.agents[0].position.y, this.agents[0].position.x, this.agents[0].position.y);
for (int i = 1; i < this.agents.Count; i++)
{
Vector2 position = this.agents[i].position;
bounds = Rect.MinMaxRect(Mathf.Min(bounds.xMin, position.x), Mathf.Min(bounds.yMin, position.y), Mathf.Max(bounds.xMax, position.x), Mathf.Max(bounds.yMax, position.y));
}
this.Quadtree.SetBounds(bounds);
for (int j = 0; j < this.agents.Count; j++)
{
this.Quadtree.Insert(this.agents[j]);
}
}
this.Quadtree.CalculateSpeeds();
}
// Token: 0x060004EA RID: 1258 RVA: 0x0001B37C File Offset: 0x0001977C
private void BlockUntilSimulationStepIsDone()
{
if (this.Multithreading && this.doubleBuffering)
{
for (int i = 0; i < this.workers.Length; i++)
{
this.workers[i].WaitOne();
}
}
}
// Token: 0x060004EB RID: 1259 RVA: 0x0001B3C8 File Offset: 0x000197C8
private void PreCalculation()
{
for (int i = 0; i < this.agents.Count; i++)
{
this.agents[i].PreCalculation();
}
}
// Token: 0x060004EC RID: 1260 RVA: 0x0001B402 File Offset: 0x00019802
private void CleanAndUpdateObstaclesIfNecessary()
{
if (this.doCleanObstacles)
{
this.CleanObstacles();
this.doCleanObstacles = false;
this.doUpdateObstacles = true;
}
if (this.doUpdateObstacles)
{
this.doUpdateObstacles = false;
}
}
// Token: 0x060004ED RID: 1261 RVA: 0x0001B438 File Offset: 0x00019838
public void Update()
{
if (this.lastStep < 0f)
{
this.lastStep = Time.time;
this.deltaTime = this.DesiredDeltaTime;
}
if (Time.time - this.lastStep >= this.DesiredDeltaTime)
{
this.deltaTime = Time.time - this.lastStep;
this.lastStep = Time.time;
this.deltaTime = Math.Max(this.deltaTime, 0.0005f);
if (this.Multithreading)
{
if (this.doubleBuffering)
{
for (int i = 0; i < this.workers.Length; i++)
{
this.workers[i].WaitOne();
}
for (int j = 0; j < this.agents.Count; j++)
{
this.agents[j].PostCalculation();
}
}
this.PreCalculation();
this.CleanAndUpdateObstaclesIfNecessary();
this.BuildQuadtree();
for (int k = 0; k < this.workers.Length; k++)
{
this.workers[k].start = k * this.agents.Count / this.workers.Length;
this.workers[k].end = (k + 1) * this.agents.Count / this.workers.Length;
}
for (int l = 0; l < this.workers.Length; l++)
{
this.workers[l].Execute(1);
}
for (int m = 0; m < this.workers.Length; m++)
{
this.workers[m].WaitOne();
}
for (int n = 0; n < this.workers.Length; n++)
{
this.workers[n].Execute(0);
}
if (!this.doubleBuffering)
{
for (int num = 0; num < this.workers.Length; num++)
{
this.workers[num].WaitOne();
}
for (int num2 = 0; num2 < this.agents.Count; num2++)
{
this.agents[num2].PostCalculation();
}
}
}
else
{
this.PreCalculation();
this.CleanAndUpdateObstaclesIfNecessary();
this.BuildQuadtree();
for (int num3 = 0; num3 < this.agents.Count; num3++)
{
this.agents[num3].BufferSwitch();
}
for (int num4 = 0; num4 < this.agents.Count; num4++)
{
this.agents[num4].CalculateNeighbours();
this.agents[num4].CalculateVelocity(this.coroutineWorkerContext);
}
for (int num5 = 0; num5 < this.agents.Count; num5++)
{
this.agents[num5].PostCalculation();
}
}
}
}
// Token: 0x040002F7 RID: 759
private readonly bool doubleBuffering = true;
// Token: 0x040002F8 RID: 760
private float desiredDeltaTime = 0.05f;
// Token: 0x040002F9 RID: 761
private readonly Simulator.Worker[] workers;
// Token: 0x040002FA RID: 762
private List<Agent> agents;
// Token: 0x040002FB RID: 763
public List<ObstacleVertex> obstacles;
// Token: 0x040002FD RID: 765
private float deltaTime;
// Token: 0x040002FE RID: 766
private float lastStep = -99999f;
// Token: 0x040002FF RID: 767
private bool doUpdateObstacles;
// Token: 0x04000300 RID: 768
private bool doCleanObstacles;
// Token: 0x04000301 RID: 769
public float symmetryBreakingBias = 0.1f;
// Token: 0x04000302 RID: 770
public readonly MovementPlane movementPlane;
// Token: 0x04000303 RID: 771
private Simulator.WorkerContext coroutineWorkerContext = new Simulator.WorkerContext();
// Token: 0x0200006E RID: 110
internal class WorkerContext
{
// Token: 0x04000304 RID: 772
public Agent.VOBuffer vos = new Agent.VOBuffer(16);
// Token: 0x04000305 RID: 773
public const int KeepCount = 3;
// Token: 0x04000306 RID: 774
public Vector2[] bestPos = new Vector2[3];
// Token: 0x04000307 RID: 775
public float[] bestSizes = new float[3];
// Token: 0x04000308 RID: 776
public float[] bestScores = new float[4];
// Token: 0x04000309 RID: 777
public Vector2[] samplePos = new Vector2[50];
// Token: 0x0400030A RID: 778
public float[] sampleSize = new float[50];
}
// Token: 0x0200006F RID: 111
private class Worker
{
// Token: 0x060004EF RID: 1263 RVA: 0x0001B7A0 File Offset: 0x00019BA0
public Worker(Simulator sim)
{
this.simulator = sim;
new Thread(new ThreadStart(this.Run))
{
IsBackground = true,
Name = "RVO Simulator Thread"
}.Start();
}
// Token: 0x060004F0 RID: 1264 RVA: 0x0001B807 File Offset: 0x00019C07
public void Execute(int task)
{
this.task = task;
this.waitFlag.Reset();
this.runFlag.Set();
}
// Token: 0x060004F1 RID: 1265 RVA: 0x0001B828 File Offset: 0x00019C28
public void WaitOne()
{
if (!this.terminate)
{
this.waitFlag.WaitOne();
}
}
// Token: 0x060004F2 RID: 1266 RVA: 0x0001B841 File Offset: 0x00019C41
public void Terminate()
{
this.WaitOne();
this.terminate = true;
this.Execute(-1);
}
// Token: 0x060004F3 RID: 1267 RVA: 0x0001B858 File Offset: 0x00019C58
public void Run()
{
this.runFlag.WaitOne();
while (!this.terminate)
{
try
{
List<Agent> agents = this.simulator.GetAgents();
if (this.task == 0)
{
for (int i = this.start; i < this.end; i++)
{
agents[i].CalculateNeighbours();
agents[i].CalculateVelocity(this.context);
}
}
else if (this.task == 1)
{
for (int j = this.start; j < this.end; j++)
{
agents[j].BufferSwitch();
}
}
else
{
if (this.task != 2)
{
Debug.LogError("Invalid Task Number: " + this.task);
throw new Exception("Invalid Task Number: " + this.task);
}
this.simulator.BuildQuadtree();
}
}
catch (Exception message)
{
Debug.LogError(message);
}
this.waitFlag.Set();
this.runFlag.WaitOne();
}
}
// Token: 0x0400030B RID: 779
public int start;
// Token: 0x0400030C RID: 780
public int end;
// Token: 0x0400030D RID: 781
private readonly AutoResetEvent runFlag = new AutoResetEvent(false);
// Token: 0x0400030E RID: 782
private readonly ManualResetEvent waitFlag = new ManualResetEvent(true);
// Token: 0x0400030F RID: 783
private readonly Simulator simulator;
// Token: 0x04000310 RID: 784
private int task;
// Token: 0x04000311 RID: 785
private bool terminate;
// Token: 0x04000312 RID: 786
private Simulator.WorkerContext context = new Simulator.WorkerContext();
}
}
}
| 27.45356 | 174 | 0.660333 | [
"Unlicense"
] | larryeedwards/openyan | Assembly-CSharp/Pathfinding/RVO/Simulator.cs | 17,737 | C# |
using HPTK.Input;
using HPTK.Settings;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HPTK.Models.Avatar
{
public class InputModel : HPTKModel
{
public ProxyHandModel proxyHand;
public InputConfiguration configuration;
public InputDataProvider inputDataProvider;
public bool isActive = true;
[HideInInspector]
public MasterBoneModel[] bonesToUpdate;
[HideInInspector]
public float highestLinearSpeed = 1000.0f;
[HideInInspector]
public float highestAngularSpeed = 1000.0f;
/*
* 0 - wrist
* 1 - forearm
*
* 2 - thumb0
* 3 - thumb1
* 4 - thumb2
* 5 - thumb3
*
* 6 - index1
* 7 - index2
* 8 - index3
*
* 9 - middle1
* 10 - middle2
* 11 - middle3
*
* 12 - ring1
* 13 - ring2
* 14 - ring3
*
* 15 - pinky0
* 16 - pinky1
* 17 - pinky2
* 18 - pinky3
*
* 19 - thumbTip
* 20 - indexTip
* 21 - middleTip
* 22 - ringTip
* 23 - pinkyTip
*/
[Header("Master rig mapping")]
public bool updateBonesOnValidate = true;
public MasterBoneModel wrist;
public MasterBoneModel forearm;
public MasterBoneModel thumb0;
public MasterBoneModel thumb1;
public MasterBoneModel thumb2;
public MasterBoneModel thumb3;
public MasterBoneModel index1;
public MasterBoneModel index2;
public MasterBoneModel index3;
public MasterBoneModel middle1;
public MasterBoneModel middle2;
public MasterBoneModel middle3;
public MasterBoneModel ring1;
public MasterBoneModel ring2;
public MasterBoneModel ring3;
public MasterBoneModel pinky0;
public MasterBoneModel pinky1;
public MasterBoneModel pinky2;
public MasterBoneModel pinky3;
[Header("Updated by Controller")]
public bool handIsTracked = false;
public bool fingersAreTracked = false;
public bool isPredicting = false;
// Noise reduction
public float[] wmaWeights; // Assuming that window size won't change
public AbstractTsf[][] boneRecords; // Assuming that bonesToUpdate and window size won't change. [boneToUpdate][record]
public void OnValidate()
{
if (updateBonesOnValidate)
MasterRigMapping();
}
void MasterRigMapping ()
{
if (proxyHand != null && proxyHand.master != null)
{
if (proxyHand.master.wrist) wrist = proxyHand.master.wrist as MasterBoneModel;
if (proxyHand.master.forearm) forearm = proxyHand.master.forearm as MasterBoneModel;
MasterBoneModel bone;
if (proxyHand.master.thumb)
{
for (int b = 0; b < proxyHand.master.thumb.bones.Length; b++)
{
bone = proxyHand.master.thumb.bones[b] as MasterBoneModel;
if (bone != null)
{
switch (b)
{
case 0:
thumb0 = bone;
break;
case 1:
thumb1 = bone;
break;
case 2:
thumb2 = bone;
break;
case 3:
thumb3 = bone;
break;
}
}
}
}
if (proxyHand.master.index)
{
for (int b = 0; b < proxyHand.master.index.bones.Length; b++)
{
bone = proxyHand.master.index.bones[b] as MasterBoneModel;
if (bone != null)
{
switch (b)
{
case 0:
index1 = bone;
break;
case 1:
index2 = bone;
break;
case 2:
index3 = bone;
break;
}
}
}
}
if (proxyHand.master.middle)
{
for (int b = 0; b < proxyHand.master.middle.bones.Length; b++)
{
bone = proxyHand.master.middle.bones[b] as MasterBoneModel;
if (bone != null)
{
switch (b)
{
case 0:
middle1 = bone;
break;
case 1:
middle2 = bone;
break;
case 2:
middle3 = bone;
break;
}
}
}
}
if (proxyHand.master.ring)
{
for (int b = 0; b < proxyHand.master.ring.bones.Length; b++)
{
bone = proxyHand.master.ring.bones[b] as MasterBoneModel;
if (bone != null)
{
switch (b)
{
case 0:
ring1 = bone;
break;
case 1:
ring2 = bone;
break;
case 2:
ring3 = bone;
break;
}
}
}
}
if (proxyHand.master.pinky)
{
for (int b = 0; b < proxyHand.master.pinky.bones.Length; b++)
{
bone = proxyHand.master.pinky.bones[b] as MasterBoneModel;
if (bone != null)
{
switch (b)
{
case 0:
pinky0 = bone;
break;
case 1:
pinky1 = bone;
break;
case 2:
pinky2 = bone;
break;
case 3:
pinky3 = bone;
break;
}
}
}
}
}
else
{
Debug.LogWarning("ProxyHand field or ProxyHand.master are NULL");
}
}
}
}
| 33.127119 | 127 | 0.35495 | [
"MIT"
] | cs-util/HPTK | Runtime/Modules/Input/InputModel.cs | 7,820 | C# |
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("CFDG.ACAD.Installer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CFDG.ACAD.Installer")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 42.607143 | 98 | 0.709556 | [
"Apache-2.0"
] | NWhite421/CFDG-SurveyTools | CFDG.ACAD.Installer/Properties/AssemblyInfo.cs | 2,389 | C# |
// Copyright (c) 2021 Alachisoft
//
// 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 Alachisoft.NCache.Runtime.Serialization.IO;
using System.Diagnostics;
using Alachisoft.NCache.Runtime.Serialization;
using Alachisoft.NCache.Common.Pooling;
namespace Alachisoft.NCache.Common.Stats
{
/// <summary>
/// HPTime represents the time based on the ticks of High Performance coutners.
/// It is a relative time not synchronized with system time. The time accuracy
/// is upto micro seconds.
/// </summary>
/// <author></author>
public class HPTime : IComparable, ICompactSerializable
{
private int _hr;
private int _min;
private int _sec;
private int _mlSec;
private int _micSec;
private static long _frequency;
private static long _baseTicks;
private static object _synObj = new Object();
private static string _col = ":";
private double _baseTime;
private double _baseRem;
static HPTime()
{
lock (_synObj)
{
_frequency = Stopwatch.Frequency;
_baseTicks = Stopwatch.GetTimestamp();
}
}
/// <summary>
/// Gets the hours component of the time of this instance.
/// </summary>
public int Hours
{
get { return _hr; }
}
/// <summary>
/// Gets the hours component of the time of this instance.
/// </summary>
public int Minutes
{
get { return _min; }
}
/// <summary>
/// Gets the Secnds component of the time of this instance.
/// </summary>
public int Seconds
{
get { return _sec; }
}
/// <summary>
/// Gets the MilliSecond component of the time of this instance.
/// </summary>
public int MilliSeconds
{
get { return _mlSec; }
}
/// <summary>
/// Gets the MicroSeconds component of the time of this instance.
/// </summary>
public int MicroSeconds
{
get { return _micSec; }
}
public double BaseTime
{
get { return _baseTime; }
set { _baseRem = value; }
}
public double ServerTicks
{
get { return _baseRem; }
}
/// <summary>
/// Gets current HP time
/// </summary>
public HPTime CurrentTime
{
get
{
double rem = 0;
long currentTicks = 0;
long diff;
HPTime time = new HPTime();
currentTicks = Stopwatch.GetTimestamp();
diff = currentTicks - _baseTicks;
rem = ((double)diff / (double)_frequency) * 1000;
//double baseTime = 0;//it will be server time;
_baseTime = rem;
time._baseTime = rem;
rem += _baseRem;
time._hr = (int)(rem / 3600000);
rem = rem - (time._hr * 3600000);
time._min = (int)rem / 60000;
rem = rem - (time._min * 60000);
time._sec = (int)rem / 1000;
rem = rem - (time._sec * 1000);
time._mlSec = (int)rem;
rem = (rem - (double)time._mlSec) * 1000;
time._micSec = (int)rem;
return time;
}
}
/// <summary>
/// Gets current HP time
/// </summary>
public static HPTime Now
{
get
{
double rem = 0;
long currentTicks = 0;
long diff;
HPTime time = new HPTime();
currentTicks = Stopwatch.GetTimestamp();
diff = currentTicks - _baseTicks;
rem = ((double)diff / (double)_frequency) * 1000;
time._hr = (int)(rem / 3600000);
rem = rem - (time._hr * 3600000);
time._min = (int)rem / 60000;
rem = rem - (time._min * 60000);
time._sec = (int)rem / 1000;
rem = rem - (time._sec * 1000);
time._mlSec = (int)rem;
rem = (rem - (double)time._mlSec) * 1000;
time._micSec = (int)rem;
return time;
}
}
/// <summary>
/// Gets the string representation of the current instance of HP time.
/// </summary>
/// <returns></returns>
public override string ToString()
{
return _hr % 24 + _col + _min % 60 + _col + _sec % 60 + _col + (long)_mlSec + _col + _micSec;
}
/// <summary>
/// Gets the string representation of the current instance of HP time.
/// </summary>
/// <returns></returns>
public string ToAbsoluteTimeString()
{
return _hr + _col + _min + _col + _sec + _col + (long)_mlSec + _col + _micSec;
}
#region IComparable Members
public int CompareTo(object obj)
{
if (obj is HPTime)
{
HPTime other = (HPTime)obj;
int result = this.Hours.CompareTo(other.Hours);
if (result == 0)
{
result = this.Minutes.CompareTo(other.Minutes);
if (result == 0)
{
result = this.Seconds.CompareTo(other.Seconds);
if (result == 0)
{
result = this.MilliSeconds.CompareTo(other.MilliSeconds);
if (result == 0)
{
return this.MicroSeconds.CompareTo(other.MicroSeconds);
}
return result;
}
return result;
}
return result;
}
return result;
}
return 1;
}
#endregion
#region ICompactSerializable Members
public void Deserialize(CompactReader reader)
{
_hr = reader.ReadInt32();
_micSec = reader.ReadInt32();
_min = reader.ReadInt32();
_mlSec = reader.ReadInt32();
_sec = reader.ReadInt32();
}
public void Serialize(CompactWriter writer)
{
writer.Write(_hr);
writer.Write(_micSec);
writer.Write(_min);
writer.Write(_mlSec);
writer.Write(_sec);
}
#endregion
#region - [Deep Cloning] -
public HPTime DeepClone(PoolManager poolManager)
{
var clonedHPTime = new HPTime();
clonedHPTime._baseRem = _baseRem;
clonedHPTime._baseTime = _baseTime;
clonedHPTime._hr = _hr;
clonedHPTime._micSec = _micSec;
clonedHPTime._min = _min;
clonedHPTime._mlSec = _mlSec;
clonedHPTime._sec = _sec;
return clonedHPTime;
}
#endregion
}
}
| 29.191882 | 105 | 0.486791 | [
"Apache-2.0"
] | Alachisoft/NCache | Src/NCCommon/Stats/HPTime.cs | 7,911 | C# |
using System;
using System.Runtime.CompilerServices;
namespace Server.Mixin
{
public static class Kotlinize
{
/// <summary>
/// Calls the specified function <see cref="block">block</see> and returns its result.<br/>
///
/// For detailed usage information see the documentation for <a href="https://kotlinlang.org/docs/reference/scope-functions.html#let">scope functions</a><br/>
/// </summary>
/// <param name="block"></param>
/// <typeparam name="R"></typeparam>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static R Run<R>(Func<R> block)
=> block();
/// <summary>
/// Calls the specified function <see cref="block">block</see> with <c>this</c> value as its argument and returns its result.<br/>
///
/// For detailed usage information see the documentation for <a href="https://kotlinlang.org/docs/reference/scope-functions.html#let">scope functions</a><br/>
/// </summary>
/// <param name="self"></param>
/// <param name="block"></param>
/// <typeparam name="T"></typeparam>
/// <typeparam name="R"></typeparam>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static R Let<T, R>(this T self, Func<T, R> block)
=> block(self);
/// <summary>
/// Calls the specified function <see cref="block">block</see> with <c>this</c> value as its argument and returns <c>this</c> value.<br/>
///
/// For detailed usage information see the documentation for <a href="https://kotlinlang.org/docs/reference/scope-functions.html#let">scope functions</a><br/>
/// </summary>
/// <param name="self"></param>
/// <param name="block"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T Also<T>(this T self, Action<T> block)
{
block(self);
return self;
}
}
}
| 41.326923 | 166 | 0.584923 | [
"MIT"
] | SudoPack/SudoDrive | Server/Mixin/Kotlinize.cs | 2,151 | C# |
using System;
namespace yase_core.Models
{
public static class ShortUrlModelExtension
{
public static ShortUrl To(this HashingModel model)
{
return new ShortUrl
{
OriginalUrl = model.OriginalUrl.AbsoluteUri,
TinyUrl = model.HashedUrl,
ttl = model.ttl
};
}
public static HashingModel To(this ShortUrl model, string baseUrl)
{
return new HashingModel
{
OriginalUrl = new Uri(model.OriginalUrl),
TinyUrl = new Uri(string.Format("{0}/{1}", baseUrl, model.TinyUrl)),
HashedUrl = model.TinyUrl
};
}
}
} | 26.962963 | 84 | 0.523352 | [
"MIT"
] | FrancoMelandri/yase | src/yase-core/source/Models/Mapping.cs | 728 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
//
// This file was autogenerated by a tool.
// Do not modify it.
//
namespace Microsoft.Azure.Batch
{
using Models = Microsoft.Azure.Batch.Protocol.Models;
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The destination to which a file should be uploaded.
/// </summary>
public partial class OutputFileDestination : ITransportObjectProvider<Models.OutputFileDestination>, IPropertyMetadata
{
#region Constructors
internal OutputFileDestination(Models.OutputFileDestination protocolObject)
{
this.Container = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Container, o => new OutputFileBlobContainerDestination(o).Freeze());
}
#endregion Constructors
#region OutputFileDestination
/// <summary>
/// Gets a location in Azure blob storage to which files are uploaded.
/// </summary>
public OutputFileBlobContainerDestination Container { get; }
#endregion // OutputFileDestination
#region IPropertyMetadata
bool IModifiable.HasBeenModified
{
//This class is compile time readonly so it cannot have been modified
get { return false; }
}
bool IReadOnly.IsReadOnly
{
get { return true; }
set
{
// This class is compile time readonly already
}
}
#endregion // IPropertyMetadata
#region Internal/private methods
/// <summary>
/// Return a protocol object of the requested type.
/// </summary>
/// <returns>The protocol object of the requested type.</returns>
Models.OutputFileDestination ITransportObjectProvider<Models.OutputFileDestination>.GetTransportObject()
{
Models.OutputFileDestination result = new Models.OutputFileDestination()
{
Container = UtilitiesInternal.CreateObjectWithNullCheck(this.Container, (o) => o.GetTransportObject()),
};
return result;
}
#endregion // Internal/private methods
}
} | 30.888889 | 156 | 0.647482 | [
"MIT"
] | 0rland0Wats0n/azure-sdk-for-net | sdk/batch/Microsoft.Azure.Batch/src/Generated/OutputFileDestination.cs | 2,502 | C# |
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using WebPlatform.Core.Validation;
namespace WebPlatform.Core
{
/// <summary>
/// Provides reflection extensions.
/// </summary>
public static class Reflector
{
/// <summary>
/// Defines a forwarding delegate.
/// </summary>
/// <typeparam name="TResult">The type of the result.</typeparam>
/// <param name="arguments">The method arguments. Must not be <see langword="null"/>.</param>
/// <returns>The method result. May be <see langword="null"/>.</returns>
public delegate TResult Forwarding<TResult>([NotNull] params object[] arguments);
/// <summary>
/// Tries to get an attribute value.
/// </summary>
/// <typeparam name="TAttribute">The type of the attribute.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="attributeProvider">The attribute provider to get the attribute value for. Must not be <see langword="null"/>.</param>
/// <param name="selector">The selector. Must not be <see langword="null"/>.</param>
/// <param name="value">The value.</param>
/// <returns><see langword="true"/>, if the a attribute value exists; otherwise <see langword="false"/>.</returns>
public static bool TryGetAttributeValue<TAttribute, TValue>([NotNull] this ICustomAttributeProvider attributeProvider, [NotNull] Func<TAttribute, TValue> selector, out TValue value)
where TAttribute : Attribute
{
var attribute = attributeProvider.GetCustomAttributes(typeof(TAttribute), true).FirstOrDefault() as TAttribute;
if (attribute != null)
{
value = selector(attribute);
return true;
}
value = default(TValue);
return false;
}
/// <summary>
/// Gets a method info the lambda expression selects.
/// </summary>
/// <typeparam name="TSource">The type of the source.</typeparam>
/// <typeparam name="TResult">The type of the result.</typeparam>
/// <param name="lambda">The lambda expression. Must not be <see langword="null" />.</param>
/// <returns>
/// The method info. Never <see langword="null" />.
/// </returns>
[return: NotNull]
public static MethodInfo GetMethod<TSource, TResult>([NotNull] Expression<Func<TSource, TResult>> lambda)
{
var call = lambda.Body as MethodCallExpression;
if (call == null)
return null;
var method = call.Method;
if (method.IsGenericMethod)
method = method.GetGenericMethodDefinition();
return method;
}
/// <summary>
/// Forwards a call to the specified method on the specified object .
/// </summary>
/// <typeparam name="TResult">The type of the result.</typeparam>
/// <param name="source">The source object. Must not be <see langword="null"/>.</param>
/// <param name="methodInfo">The method information. Must not be <see langword="null"/>.</param>
/// <param name="typeArguments">The type arguments. Must not be <see langword="null"/>.</param>
/// <returns>The call delegate. Never <see langword="null"/>.</returns>
[return: NotNull]
public static Forwarding<TResult> ForwardTo<TResult>([NotNull] this object source, [NotNull] MethodInfo methodInfo, [NotNull] params Type[] typeArguments)
{
if (typeArguments.Length > 0)
methodInfo = methodInfo.MakeGenericMethod(typeArguments);
return (object[] arguments) => (TResult)methodInfo.Invoke(source, arguments);
}
}
} | 44.130952 | 187 | 0.632857 | [
"MIT"
] | urahnung/webplatform | src/Core/Core/Reflector.cs | 3,709 | C# |
//-----------------------------------------------------------------------
// <copyright file="Windows10Api.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation.
// </copyright>
//-----------------------------------------------------------------------
namespace Microsoft.Isam.Esent.Interop.Windows10
{
using Microsoft.Isam.Esent.Interop;
using Microsoft.Isam.Esent.Interop.Windows8;
/// <summary>
/// Api calls introduced in Windows 10.
/// </summary>
public static class Windows10Api
{
#region Session Parameters
/// <summary>
/// Sets a parameter on the provided session state, used for the lifetime of this session or until reset.
/// </summary>
/// <param name="sesid">The session to set the parameter on.</param>
/// <param name="sesparamid">The ID of the session parameter to retrieve.</param>
/// <param name="operationContext">An operation context to retrieve.</param>
/// <seealso cref="JET_OPERATIONCONTEXT"/>
public static void JetGetSessionParameter(
JET_SESID sesid,
JET_sesparam sesparamid,
out JET_OPERATIONCONTEXT operationContext)
{
Api.Check(Api.Impl.JetGetSessionParameter(sesid, sesparamid, out operationContext));
}
/// <summary>
/// Sets a parameter on the provided session state, used for the lifetime of this session or until reset.
/// </summary>
/// <param name="sesid">The session to set the parameter on.</param>
/// <param name="sesparamid">The ID of the session parameter to set.</param>
/// <param name="operationContext">An operation context to set.</param>
/// <seealso cref="JET_OPERATIONCONTEXT"/>
public static void JetSetSessionParameter(JET_SESID sesid, JET_sesparam sesparamid, JET_OPERATIONCONTEXT operationContext)
{
Api.Check(Api.Impl.JetSetSessionParameter(sesid, sesparamid, operationContext));
}
#endregion
#region Sessions
/// <summary>
/// Retrieves performance information from the database engine for the
/// current thread. Multiple calls can be used to collect statistics
/// that reflect the activity of the database engine on this thread
/// between those calls.
/// </summary>
/// <param name="threadstats">Returns the thread statistics data.</param>
public static void JetGetThreadStats(out JET_THREADSTATS2 threadstats)
{
Api.Check(Api.Impl.JetGetThreadStats(out threadstats));
}
#endregion
}
}
| 43.222222 | 131 | 0.598237 | [
"MIT"
] | Bhaskers-Blu-Org2/ManagedEsent | EsentInterop/Windows10Api.cs | 2,725 | C# |
#nullable disable
namespace PasPasPas.Parsing.SyntaxTree.Standard {
/// <summary>
/// symbol kind
/// </summary>
public enum AsmPrefixSymbolKind {
/// <summary>
/// unknown symbol
/// </summary>
Unknown,
/// <summary>
/// push operation
/// </summary>
PushEnvOperation,
/// <summary>
/// params operation
/// </summary>
ParamsOperation,
/// <summary>
/// no frame statement
/// </summary>
NoFrame,
/// <summary>
/// push env operation
/// </summary>
SaveEnvOperation
};
}
| 20.485714 | 50 | 0.439331 | [
"Apache-2.0"
] | prjm/paspaspas | PasPasPas.Parsing/src/SyntaxTree/Standard/AsmPrefixSymbolKind.cs | 719 | 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 iam-2010-05-08.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
namespace Amazon.IdentityManagement.Model
{
/// <summary>
/// Contains information about a version of a managed policy.
///
///
/// <para>
/// This data type is used as a response element in the <a>CreatePolicyVersion</a>, <a>GetPolicyVersion</a>,
/// <a>ListPolicyVersions</a>, and <a>GetAccountAuthorizationDetails</a> operations.
/// </para>
///
/// <para>
/// For more information about managed policies, refer to <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html">Managed
/// Policies and Inline Policies</a> in the <i>Using IAM</i> guide.
/// </para>
/// </summary>
public partial class PolicyVersion
{
private DateTime? _createDate;
private string _document;
private bool? _isDefaultVersion;
private string _versionId;
/// <summary>
/// Gets and sets the property CreateDate.
/// <para>
/// The date and time, in <a href="http://www.iso.org/iso/iso8601">ISO 8601 date-time
/// format</a>, when the policy version was created.
/// </para>
/// </summary>
public DateTime CreateDate
{
get { return this._createDate.GetValueOrDefault(); }
set { this._createDate = value; }
}
// Check to see if CreateDate property is set
internal bool IsSetCreateDate()
{
return this._createDate.HasValue;
}
/// <summary>
/// Gets and sets the property Document.
/// <para>
/// The policy document.
/// </para>
///
/// <para>
/// The policy document is returned in the response to the <a>GetPolicyVersion</a> and
/// <a>GetAccountAuthorizationDetails</a> operations. It is not returned in the response
/// to the <a>CreatePolicyVersion</a> or <a>ListPolicyVersions</a> operations.
/// </para>
///
/// <para>
/// The policy document returned in this structure is URL-encoded compliant with <a href="https://tools.ietf.org/html/rfc3986">RFC
/// 3986</a>. You can use a URL decoding method to convert the policy back to plain JSON
/// text. For example, if you use Java, you can use the <code>decode</code> method of
/// the <code>java.net.URLDecoder</code> utility class in the Java SDK. Other languages
/// and SDKs provide similar functionality.
/// </para>
/// </summary>
public string Document
{
get { return this._document; }
set { this._document = value; }
}
// Check to see if Document property is set
internal bool IsSetDocument()
{
return this._document != null;
}
/// <summary>
/// Gets and sets the property IsDefaultVersion.
/// <para>
/// Specifies whether the policy version is set as the policy's default version.
/// </para>
/// </summary>
public bool IsDefaultVersion
{
get { return this._isDefaultVersion.GetValueOrDefault(); }
set { this._isDefaultVersion = value; }
}
// Check to see if IsDefaultVersion property is set
internal bool IsSetIsDefaultVersion()
{
return this._isDefaultVersion.HasValue;
}
/// <summary>
/// Gets and sets the property VersionId.
/// <para>
/// The identifier for the policy version.
/// </para>
///
/// <para>
/// Policy version identifiers always begin with <code>v</code> (always lowercase). When
/// a policy is created, the first policy version is <code>v1</code>.
/// </para>
/// </summary>
public string VersionId
{
get { return this._versionId; }
set { this._versionId = value; }
}
// Check to see if VersionId property is set
internal bool IsSetVersionId()
{
return this._versionId != null;
}
}
} | 34.6875 | 159 | 0.595796 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/IdentityManagement/Generated/Model/PolicyVersion.cs | 4,995 | C# |
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Swisschain.Sdk.Server.Common;
using Swisschain.Sdk.Server.Logging;
namespace Publisher.Worker
{
public class Program
{
private sealed class RemoteSettingsConfig
{
public IReadOnlyCollection<string> RemoteSettingsUrls { get; set; }
}
public static void Main(string[] args)
{
Console.Title = "Examples Publisher Worker";
var remoteSettingsConfig = ApplicationEnvironment.Config.Get<RemoteSettingsConfig>();
using var loggerFactory = LogConfigurator.Configure("Examples", remoteSettingsConfig.RemoteSettingsUrls ?? Array.Empty<string>());
var logger = loggerFactory.CreateLogger<Program>();
try
{
logger.LogInformation("Application is being started");
CreateHostBuilder(loggerFactory, remoteSettingsConfig).Build().Run();
logger.LogInformation("Application has been stopped");
}
catch (Exception ex)
{
logger.LogCritical(ex, "Application has been terminated unexpectedly");
}
}
private static IHostBuilder CreateHostBuilder(ILoggerFactory loggerFactory, RemoteSettingsConfig remoteSettingsConfig) =>
new HostBuilder()
.SwisschainService<Startup>(options =>
{
options.UseLoggerFactory(loggerFactory);
options.AddWebJsonConfigurationSources(remoteSettingsConfig.RemoteSettingsUrls ?? Array.Empty<string>());
});
}
}
| 34.607843 | 142 | 0.63966 | [
"Apache-2.0"
] | SC-Poc/Example.Messaging | PubSub/Publisher/src/Publisher.Worker/Program.cs | 1,767 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace LoggingKata
{
class TacoBell:ITrackable
{
public TacoBell()
{
}
public string Name { get; set; }
public Point Location { get; set; }
}
}
| 15.823529 | 43 | 0.591078 | [
"MIT"
] | Sindukova/Taco-Parser | LoggingKata/TacoBell.cs | 271 | C# |
/*
Test.cs
Testing class to test every possible function with good and bad data
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace GameOfLife
{
class Test
{
public Test()
{
TestGrid();
TestCell();
}
public void TestGrid()
{
//Grid Test A: Good data - simple, should always succeed
Console.WriteLine("Grid Test A");
try
{
Grid testingGridA = new Grid(5, 5);
testingGridA.PopulateRandom();
testingGridA.Display();
testingGridA.PopulateInterim();
testingGridA.NextGeneration();
Console.WriteLine();
testingGridA.Display();
Console.WriteLine("Grid Test A Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Grid Test A Failed");
}
//Grid Test B: Good data - Zero dimensions - shouldn't throw and error but wouldn't display anything
Console.WriteLine("Grid Test B");
try
{
Grid testingGridB = new Grid(0, 0);
testingGridB.PopulateRandom();
testingGridB.Display();
testingGridB.PopulateInterim();
testingGridB.NextGeneration();
testingGridB.Display();
Console.WriteLine("Grid Test B Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Grid Test B Failed");
}
//Grid Test C: Bad data - Negative dimensions - should fail
Console.WriteLine("Grid Test C");
try
{
Grid testingGridC = new Grid(-2,-4);
testingGridC.PopulateRandom();
testingGridC.Display();
testingGridC.PopulateInterim();
testingGridC.NextGeneration();
testingGridC.Display();
Console.WriteLine("Grid Test C Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Grid Test C Failed");
}
//Grid Test D: Good data - large dimensions - should succeed albeit probably will be rather slow
Console.WriteLine("Grid Test D");
try
{
Grid testingGridD= new Grid(250, 250);
testingGridD.PopulateRandom();
testingGridD.Display();
testingGridD.PopulateInterim();
testingGridD.NextGeneration();
testingGridD.Display();
Console.WriteLine("Grid Test D Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Grid Test D Failed");
}
}
public void TestCell()
{
//Cell Test A: Good Data
Console.WriteLine("Cell Test A");
try
{
Cell[,] testingArrayA = new Cell[8, 8];
//Populate testingArrayA completely with living cells
for (int i = 0; i< 8; i++)
{
for (int j = 0; j<8; j++)
{
testingArrayA[i, j] = new Cell(1, i, j);
}
}
//Set a specific cell to dead
testingArrayA[2, 2].SetStatus(0);
//Should print 0
Console.WriteLine(testingArrayA[2, 2].GetStatus());
//Populate neighbours array for that cell, get and print new state (should be 0)
testingArrayA[2, 2].PopulateNeighbours(testingArrayA);
Console.WriteLine(testingArrayA[2, 2].GetStatus());
//Print coordinates (should be 2 and 2)
Console.WriteLine(testingArrayA[2, 2].GetRowLocation());
Console.WriteLine(testingArrayA[2, 2].GetColumnLocation());
//Testing what state the ApplyRules function will return
//Should return a 0, because at this point the cell is dead and all surrounding neighbours are alive
Console.WriteLine(testingArrayA[2, 2].CheckNeighbours());
Console.WriteLine("Cell Test A Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Cell Test A Failed");
}
//Cell Test B: Bad Data - same test as before, but without actually putting cells in the cell array - should fail
{
try
{
Cell[,] testingArrayB = new Cell[8, 8];
testingArrayB[2, 2].SetStatus(0);
Console.WriteLine(testingArrayB[2, 2].GetStatus());
testingArrayB[2, 2].PopulateNeighbours(testingArrayB);
Console.WriteLine(testingArrayB[2, 2].GetStatus());
Console.WriteLine(testingArrayB[2, 2].GetRowLocation());
Console.WriteLine(testingArrayB[2, 2].GetColumnLocation());
Console.WriteLine(testingArrayB[2, 2].CheckNeighbours());
Console.WriteLine("Cell Test B Successful");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Cell Test B Failed");
}
}
//Cell Test C: Testing the ApplyRules function
{
try
{
Cell liveCell = new Cell(1, 0, 5);
Cell deadCell = new Cell(0, 4, 7);
//Testing every possible amount of neighbours for the alive cell
//Should print 00110000
Console.Write(liveCell.ApplyRules(0));
Console.Write(liveCell.ApplyRules(1));
Console.Write(liveCell.ApplyRules(2));
Console.Write(liveCell.ApplyRules(3));
Console.Write(liveCell.ApplyRules(4));
Console.Write(liveCell.ApplyRules(5));
Console.Write(liveCell.ApplyRules(6));
Console.Write(liveCell.ApplyRules(7));
Console.Write(liveCell.ApplyRules(8));
Console.WriteLine();
//Testing every possible amount of neighbours for the dead cell
//Should print 000100000
Console.Write(deadCell.ApplyRules(0));
Console.Write(deadCell.ApplyRules(1));
Console.Write(deadCell.ApplyRules(2));
Console.Write(deadCell.ApplyRules(3));
Console.Write(deadCell.ApplyRules(4));
Console.Write(deadCell.ApplyRules(5));
Console.Write(deadCell.ApplyRules(6));
Console.Write(deadCell.ApplyRules(7));
Console.Write(deadCell.ApplyRules(8));
Console.WriteLine();
/*Testing passing in large positive and large negative numbers
These are not technically valid values for # of living neighbours, because logically you can have no more than 8 and no
less than 0 living neighbours
Regardless, these should all technically still work, as the function is set to return the original state of the cell
if it can't find any rules to apply, and some rules can still apply when you pass very large positive/negatives in
*/
/*
Should return 00
This is because the overpopulation rule means that a live cell with >3 neighbours dies, and 10000000 is >3
Same applies because the underpopulation rule means that a live cell with <2 neighbours dies, and -10000000 is <3
*/
Console.Write(liveCell.ApplyRules(10000000));
Console.Write(liveCell.ApplyRules(-10000900));
Console.WriteLine();
//Should return 00, because the only way the state of a dead cell changes is if the # of live neighbours is exactly 3
Console.Write(liveCell.ApplyRules(10000000));
Console.Write(liveCell.ApplyRules(-10000000));
Console.WriteLine();
Console.WriteLine("Cell Test C Successful");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("Cell Test C Failed");
}
}
}
}
}
| 43.480952 | 139 | 0.508926 | [
"MIT"
] | DamanjitG/Game-Of-Life | Test.cs | 9,133 | C# |
using Autofac;
using Autofac.Integration.Mvc;
using Autofac.Integration.WebApi;
using Microsoft.Owin;
using Owin;
using System;
using System.IO;
using System.Reflection;
using System.Web.Http;
using System.Web.Http.Cors;
using AirPortWebApi.BusinessLogic.Services;
using AirPortWebApi.Infrastructure.Service;
using AirPortWebApi.Infrastructure.Services;
using Microsoft.AspNet.Identity.Owin;
namespace AirPortWebApi
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
var builder = new ContainerBuilder();
var config = new HttpConfiguration();
var corsAttr = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(corsAttr);
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
config.MapHttpAttributeRoutes();
config.EnableCors();
AutofacTypeRegister.RegisterTypes(builder);
var container = builder.Build();
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
app.UseAutofacMiddleware(container);
app.UseAutofacWebApi(config);
app.UseWebApi(config);
ConfigureAuth(app);
}
string getTime()
{
return DateTime.Now.Millisecond.ToString();
}
}
}
| 26.224138 | 87 | 0.626561 | [
"MIT"
] | AlexOAnder/AirportProject | AirPortWebApi/Startup.cs | 1,523 | C# |
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace SASave
{
[DefaultEvent("CheckedChanged")]
public partial class EmblemControl : UserControl
{
public EmblemControl()
{
InitializeComponent();
}
public event EventHandler CheckedChanged = delegate { };
private void pictureBox1_Click(object sender, EventArgs e)
{
Checked = !Checked;
}
private bool @checked;
[DefaultValue(false)]
public bool Checked
{
get { return @checked; }
set
{
@checked = value;
pictureBox1.Image = value ? Properties.Resources.emblem : Properties.Resources.noemblem;
CheckedChanged(this, EventArgs.Empty);
}
}
}
} | 18.861111 | 92 | 0.702504 | [
"MIT",
"BSD-3-Clause"
] | X-Hax/sa_tools | SA1Tools/SASave/EmblemControl.cs | 681 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.