content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
namespace Cake.Core.Scripting
{
/// <summary>
/// The script host works as a context for scripts.
/// </summary>
public abstract class ScriptHost : IScriptHost
{
private readonly ICakeEngine _engine;
private readonly ICakeContext _context;
/// <summary>
/// Gets the engine.
/// </summary>
/// <value>The engine.</value>
protected ICakeEngine Engine
{
get { return _engine; }
}
/// <summary>
/// Gets the context.
/// </summary>
/// <value>The context.</value>
public ICakeContext Context
{
get { return _context; }
}
/// <summary>
/// Initializes a new instance of the <see cref="ScriptHost"/> class.
/// </summary>
/// <param name="engine">The engine.</param>
/// <param name="context">The context.</param>
protected ScriptHost(ICakeEngine engine, ICakeContext context)
{
if (engine == null)
{
throw new ArgumentNullException("engine");
}
if (context == null)
{
throw new ArgumentNullException("context");
}
_engine = engine;
_context = context;
}
/// <summary>
/// Gets all registered tasks.
/// </summary>
/// <value>The registered tasks.</value>
public IReadOnlyList<CakeTask> Tasks
{
get { return _engine.Tasks; }
}
/// <summary>
/// Registers a new task.
/// </summary>
/// <param name="name">The name of the task.</param>
/// <returns>A <see cref="CakeTaskBuilder{ActionTask}"/>.</returns>
public CakeTaskBuilder<ActionTask> Task(string name)
{
return _engine.RegisterTask(name);
}
/// <summary>
/// Allows registration of an action that's executed before any tasks are run.
/// If setup fails, no tasks will be executed but teardown will be performed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void Setup(Action action)
{
_engine.RegisterSetupAction(action);
}
/// <summary>
/// Allows registration of an action that's executed after all other tasks have been run.
/// If a setup action or a task fails with or without recovery, the specified teardown action will still be executed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void Teardown(Action action)
{
_engine.RegisterTeardownAction(action);
}
/// <summary>
/// Allows registration of an action that's executed before each task is run.
/// If the task setup fails, its task will not be executed but the task teardown will be performed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void TaskSetup(Action<ICakeContext, ITaskSetupContext> action)
{
_engine.RegisterTaskSetupAction(action);
}
/// <summary>
/// Allows registration of an action that's executed after each task has been run.
/// If a task setup action or a task fails with or without recovery, the specified task teardown action will still be executed.
/// </summary>
/// <param name="action">The action to be executed.</param>
public void TaskTeardown(Action<ICakeContext, ITaskTeardownContext> action)
{
_engine.RegisterTaskTeardownAction(action);
}
/// <summary>
/// Runs the specified target.
/// </summary>
/// <param name="target">The target to run.</param>
/// <returns>The resulting report.</returns>
public abstract CakeReport RunTarget(string target);
}
} | 34.444444 | 135 | 0.566749 | [
"MIT"
] | EvilMindz/cake | src/Cake.Core/Scripting/ScriptHost.cs | 4,032 | 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.Billing.Models
{
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// The Amount.
/// </summary>
public partial class Amount
{
/// <summary>
/// Initializes a new instance of the Amount class.
/// </summary>
public Amount()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the Amount class.
/// </summary>
/// <param name="currency">The currency for the amount value.</param>
/// <param name="value">Amount value.</param>
public Amount(string currency = default(string), double? value = default(double?))
{
Currency = currency;
Value = value;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets the currency for the amount value.
/// </summary>
[JsonProperty(PropertyName = "currency")]
public string Currency { get; private set; }
/// <summary>
/// Gets amount value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public double? Value { get; private set; }
}
}
| 28.666667 | 90 | 0.580814 | [
"MIT"
] | 0xced/azure-sdk-for-net | src/SDKs/Billing/Management.Billing/Generated/Models/Amount.cs | 1,720 | 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("org.secc.QR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Southeast Christian Church")]
[assembly: AssemblyProduct("org.secc.QR")]
[assembly: AssemblyCopyright("Copyright © Southeast Christian Church 2019")]
[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("95f034b1-4563-49ae-838f-3630dcecca22")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.972973 | 84 | 0.75104 | [
"ECL-2.0"
] | Northside-CC/RockPlugins | Plugins/org.secc.QRManager/Properties/AssemblyInfo.cs | 1,445 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Simile.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Simile.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
| 38.458333 | 172 | 0.601661 | [
"MIT"
] | sibbydavy/Simile | Properties/Resources.Designer.cs | 2,771 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
namespace me.cqp.luohuaming.WordCloud.Tool.IniConfig.Linq
{
/// <summary>
/// 用于描述 Ini 配置项节的类
/// </summary>
[Serializable]
[Obsolete ("请改用 ISection 类型")]
public class IniSection : Dictionary<string, IniValue>
{
#region --字段--
private string _name = string.Empty;
#endregion
#region --属性--
/// <summary>
/// 获取或设置与指定键关联的值 (此索引器允许直接对不存在的键进行设置)
/// </summary>
/// <param name="name">要获取或设置的值的键</param>
/// <returns></returns>
public new IniValue this[string name]
{
get
{
if (base.ContainsKey (name))
{
return base[name];
}
else
{
return IniValue.Empty;
}
}
set
{
if (base.ContainsKey (name))
{
base[name] = value;
}
else
{
base.Add (name, value);
}
}
}
/// <summary>
/// 获取或设置当前节名称
/// </summary>
public string Name { get { return this._name; } set { this._name = value; } }
#endregion
#region --构造函数--
/// <summary>
/// 初始化 IniSection 类的新实例,该实例为空,具有默认的初始容量并为键类型使用默认的相等比较器。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
public IniSection (string name) : base ()
{
this._name = name;
}
/// <summary>
/// 初始化 IniSection 类的新实例,该实例为空,具有指定的初始容量并为键类型使用默认的相等比较器。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="capacity">IniSection 可包含的初始元素数。</param>
public IniSection (string name, int capacity) : base (capacity)
{
this._name = name;
}
/// <summary>
/// 初始化 IniSection 类的新实例,该实例为空,具有默认的初始容量并使用指定的 IEqualityComparer<in string>。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="comparer">比较键时要使用的 IEqualityComparer 实现,或者为 null,以便为键类型使用默认的 IEqualityComparer。</param>
public IniSection (string name, IEqualityComparer<string> comparer) : base (comparer)
{
this._name = name;
}
/// <summary>
/// 初始化 IniSection 类的新实例,该实例包含从指定的 IniSection 复制的元素并为键类型使用默认的相等比较器。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="dictionary">IDictionary<string, IniValue>,它的元素被复制到新 IniSection。</param>
public IniSection (string name, IDictionary<string, IniValue> dictionary) : base (dictionary)
{
this._name = name;
}
/// <summary>
/// 初始化 IniSection 类的新实例,该实例为空,具有指定的初始容量并使用指定的 IEqualityComparer。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="capacity">IniSection 可包含的初始元素数。</param>
/// <param name="comparer">比较键时要使用的 IEqualityComparer<in string>实现,或者为 null,以便为键类型使用默认的 EqualityComparer。</param>
public IniSection (string name, int capacity, IEqualityComparer<string> comparer) : base (capacity, comparer)
{
this._name = name;
}
/// <summary>
/// 初始化 IniSection 类的新实例,该实例包含从指定的 IDictionary<string, IniValue> 中复制的元素并使用指定的 IEqualityComparer<in string>。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="dictionary">IDictionary<string, IniValue>,它的元素被复制到新 IniSection。</param>
/// <param name="comparer">比较键时要使用的 IEqualityComparer<in string>实现,或者为 null,以便为键类型使用默认的 EqualityComparer。</param>
public IniSection (string name, IDictionary<string, IniValue> dictionary, IEqualityComparer<string> comparer) : base (dictionary, comparer)
{
this._name = name;
}
/// <summary>
/// 用序列化数据初始化 IniSection 类的新实例。
/// </summary>
/// <param name="name">IniSection 关联的名称</param>
/// <param name="info">一个 System.Runtime.Serialization.SerializationInfo 对象包含序列化 IniSection 所需的信息。</param>
/// <param name="context">一个 System.Runtime.Serialization.StreamingContext 结构包含与 IniSection 关联的序列化流的源和目标。</param>
protected IniSection (string name, SerializationInfo info, StreamingContext context) : base (info, context)
{
this._name = name;
}
/// <summary>
/// 用序列化数据初始化 <see cref="IniSection"/> 类的新实例
/// </summary>
/// <param name="serializationInfo">一个 <see cref="SerializationInfo"/> 包含 <see cref="IniSection"/> 所需的信息。</param>
/// <param name="streamingContext">一个 <see cref="StreamingContext"/> 结构包含与 <see cref="IniSection"/> 关联的序列化流的源和目标。</param>
protected IniSection (SerializationInfo serializationInfo, StreamingContext streamingContext)
: base (serializationInfo, streamingContext)
{
}
#endregion
#region --公开方法--
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, bool value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, byte value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, char value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, DateTime value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, decimal value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, double value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, short value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, int value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, long value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, sbyte value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, float value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将建和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value, 若此参数为 null, 将用 IniSection.Empty 代替</param>
public void Add (string key, string value)
{
this.Add (key, new IniValue (value));
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, ushort value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, uint value)
{
this.Add (key, value.ToString ());
}
/// <summary>
/// 将键和值添加到 IniSection 的结尾处
/// </summary>
/// <param name="key">要添加到 IniSection 结尾处的对象的 Key. 此参数不可为 null 或者 string.Empty</param>
/// <param name="value">要添加到 IniSection 结尾处的对象的 Value</param>
public void Add (string key, ulong value)
{
this.Add (key, value.ToString ());
}
#endregion
#region --重写方法--
/// <summary>
/// 将当前实例转换为其等效的字符串
/// </summary>
/// <returns></returns>
public override string ToString ()
{
StringBuilder iniStr = new StringBuilder ();
using (TextWriter textWriter = new StringWriter (iniStr))
{
textWriter.WriteLine ("[{0}]", this.Name.Trim ()); //添加 "节"
foreach (KeyValuePair<string, IniValue> item in this)
{
textWriter.WriteLine ("{0}={1}", item.Key.Trim (), item.Value.Value.Trim ());
}
}
return iniStr.ToString ();
}
#endregion
}
}
| 31.150641 | 141 | 0.664266 | [
"Apache-2.0"
] | Hellobaka/WordCloud | me.cqp.luohuaming.WordCloud.Tool/IniConfig/Linq/IniSection.cs | 12,097 | C# |
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma warning disable SA1310 // Field names should not contain underscore - Following roslyn naming conventions
namespace StyleCop.Analyzers.Lightup
{
using Microsoft.CodeAnalysis.CSharp;
internal static class LanguageVersionEx
{
public const LanguageVersion Default = 0;
public const LanguageVersion CSharp7 = (LanguageVersion)7;
public const LanguageVersion CSharp7_1 = (LanguageVersion)701;
public const LanguageVersion CSharp7_2 = (LanguageVersion)702;
public const LanguageVersion CSharp7_3 = (LanguageVersion)703;
public const LanguageVersion CSharp8 = (LanguageVersion)800;
public const LanguageVersion CSharp9 = (LanguageVersion)900;
public const LanguageVersion CSharp10 = (LanguageVersion)1000;
public const LanguageVersion LatestMajor = (LanguageVersion)int.MaxValue - 2;
public const LanguageVersion Preview = (LanguageVersion)int.MaxValue - 1;
public const LanguageVersion Latest = (LanguageVersion)int.MaxValue;
}
}
#pragma warning restore SA1310 // Field names should not contain underscore
| 47.407407 | 113 | 0.752344 | [
"MIT"
] | AraHaan/StyleCopAnalyzers | StyleCop.Analyzers/StyleCop.Analyzers/Lightup/LanguageVersionEx.cs | 1,282 | C# |
//
// EmbeddedSettings.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System;
using System.IO;
using System.Linq;
using Bind.Generators.Bases;
using Bind.Versioning;
namespace Bind.Generators.ES
{
/// <summary>
/// Generates API bindings for the OpenGL ES 3.1 API.
/// </summary>
internal class EmbeddedSettings : OpenGLGeneratorSettingsBase
{
/// <inheritdoc/>
public override string APIIdentifier => "OpenGLES";
/// <inheritdoc/>
public override string Namespace => "OpenToolkit.OpenGLES";
/// <inheritdoc/>
public override string SpecificationDocumentationPath => "es3";
/// <inheritdoc/>
public override string ProfileName => "gles2";
/// <inheritdoc/>
public override VersionRange Versions => new VersionRange(new Version(2, 0), new Version(3, 2));
/// <inheritdoc />
public override NameContainer NameContainer => new NameContainer()
{
Android = "libGLESv2.so",
Linux = "libGLESv2.so",
Windows = "libGLESv2.dll",
ClassName = "OpenGLESLibraryNameContainer",
IOS = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES",
MacOS = "/System/Library/Frameworks/OpenGLES.framework/OpenGLES",
};
/// <summary>
/// Initializes a new instance of the <see cref="EmbeddedSettings"/> class.
/// </summary>
public EmbeddedSettings()
{
var overrideFileDirectoryPath = Path.Combine(Program.Arguments.InputPath, "OpenGL", "ES", "3.2");
var extraOverrides = Directory.GetFiles(overrideFileDirectoryPath, "*.xml", SearchOption.AllDirectories);
OverrideFiles = new[]
{
Path.Combine(Program.Arguments.InputPath, "OpenGL", "overrides.xml"),
}
.Concat(extraOverrides);
}
}
}
| 31.323077 | 117 | 0.615422 | [
"MIT"
] | raedok/opentk | src/Generators/Generator.Bind/Generators/OpenGL/EmbeddedSettings.cs | 2,038 | C# |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// Modifies the MedLaunch splashscreen to include the latest version number and build date
/// </summary>
namespace SplashScreenUpdater
{
class Program
{
/// <summary>
/// 0 = version string
/// 1 = base image path
/// 2 = destination image path
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
if (args == null || args.Length != 3)
{
Console.WriteLine("Usage: SplashScreenUpdater version-string in-file out-file");
return;
}
string baseLocation = AppDomain.CurrentDomain.BaseDirectory;
string imgLocation = baseLocation + @"..\..\..\MedLaunch\MedLaunch\Data\Graphics\";
string verString = string.Empty;
DirectoryInfo di = Directory.GetParent(imgLocation);
string baseImgPath = di.FullName + @"\mediconsplash-base.png";
string outputImgPath = di.FullName + @"\mediconsplash-newTest.png";
for (int i = 0; i < args.Length; i++)
{
switch (i)
{
case 0:
verString = args[i];
break;
case 1:
baseImgPath = args[i];
break;
case 2:
outputImgPath = args[i];
break;
}
}
System.Console.WriteLine("Version string:\t" + verString);
System.Console.WriteLine("In file:\t" + baseImgPath);
System.Console.WriteLine("Out file:\t" + outputImgPath);
string currDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + " UTC";
try
{
// create the bitmap
Image bitmap = (Image)Bitmap.FromFile(baseImgPath);
// create the text
Font font = new Font("Tahoma", 12 * (bitmap.Width >= 1000 ? 2 : 1), FontStyle.Bold, GraphicsUnit.Pixel);
Font font2 = new Font("Tahoma", 13 * (bitmap.Width >= 1000 ? 2 : 1), FontStyle.Bold, GraphicsUnit.Pixel);
Font font3 = new Font("Tahoma", 12 * (bitmap.Width >= 1000 ? 2 : 1), FontStyle.Bold, GraphicsUnit.Pixel);
Color color = Color.LightGray;
Point atPoint = new Point(0, (bitmap.Height));
Point atPoint2 = new Point(bitmap.Width, (bitmap.Height));
Point atPoint3 = new Point(bitmap.Width / 2, (int)((bitmap.Height)*0.2225));
SolidBrush brush = new SolidBrush(color);
SolidBrush brush2 = new SolidBrush(Color.Brown);
Graphics graphics = Graphics.FromImage(bitmap);
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Far;
sf.LineAlignment = StringAlignment.Far;
StringFormat sf2 = new StringFormat();
sf2.Alignment = StringAlignment.Near;
sf2.LineAlignment = StringAlignment.Far;
StringFormat sf3 = new StringFormat();
sf3.Alignment = StringAlignment.Center;
sf3.LineAlignment = StringAlignment.Far;
graphics.DrawString(verString, font, brush, atPoint, sf2);
graphics.DrawString(currDate, font3, brush, atPoint2, sf);
graphics.DrawString("https://medlaunch.info", font2, brush2, atPoint3, sf3);
graphics.Dispose();
bitmap.Save(outputImgPath, System.Drawing.Imaging.ImageFormat.Png);
bitmap.Dispose();
}
catch (Exception e)
{
System.Console.WriteLine("Exception: " + e.Message);
}
}
}
}
| 37.518519 | 121 | 0.528381 | [
"Apache-2.0",
"MIT"
] | peter277/MedLaunch | SplashScreenUpdater/Program.cs | 4,054 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace discovery.Library.zip
{
public interface IUnzipper
{
string unzip();
}
}
| 15.538462 | 33 | 0.707921 | [
"MIT"
] | javadbayzavi/PatternDiscovery | discovery/Library/zip/IUnzipper.cs | 204 | C# |
namespace Google_Exercise
{
public class Car
{
private string carModel;
public int carSpeed;
public Car()
{
}
public Car(string carModel, int carSpeed)
{
this.carModel = carModel;
this.carSpeed = carSpeed;
}
public string CarModel => this.carModel;
}
} | 18.2 | 49 | 0.524725 | [
"MIT"
] | mayapeneva/C-Sharp-OOP-Basic | 01.DefiningClasses/Google_Exercise/Car.cs | 366 | C# |
using FoodVault.Framework.Domain;
using System;
namespace FoodVault.Modules.UserAccess.Domain.Users
{
/// <summary>
/// Identifier for a <see cref="User"/> object.
/// </summary>
public sealed class UserId : EntityId
{
/// <summary>
/// Initializes a new instance of the <see cref="UserId" /> class.
/// </summary>
/// <param name="value">Identifiers value.</param>
public UserId(Guid value) : base(value)
{
}
}
}
| 24.8 | 74 | 0.578629 | [
"MIT"
] | chrishanzlik/FoodVault | src/Modules/UserAccess/Domain/Users/UserId.cs | 498 | C# |
using System;
using System.IO;
namespace WhiteRabbit.Protobuf
{
public class ProtobufSerializer : ISerializer
{
public string ContentType => "application/protobuf";
public byte[] Serialize<T>(T obj)
{
byte[] result;
using (var stream = new MemoryStream())
{
ProtoBuf.Serializer.Serialize(stream, obj);
result = stream.ToArray();
}
return result;
}
public T Deserialize<T>(byte[] bytes)
{
using (var stream = new MemoryStream(bytes))
{
return ProtoBuf.Serializer.Deserialize<T>(stream);
}
}
public object DeserializeObject(byte[] bytes, Type type)
{
if (type.AssemblyQualifiedName == null)
{
throw new Exception($"AssemblyQualifiedName not set for {type}");
}
var clrType = Type.GetType(type.AssemblyQualifiedName);
if (clrType == null)
{
throw new Exception($"Unable to find type for {type.AssemblyQualifiedName}");
}
using (var stream = new MemoryStream(bytes))
{
var obj = ProtoBuf.Serializer.NonGeneric.Deserialize(clrType, stream);
return Convert.ChangeType(obj, clrType);
}
}
}
}
| 26.698113 | 93 | 0.523675 | [
"MIT"
] | RagtimeWilly/WhiteRabbit | src/WhiteRabbit.Protobuf/ProtobufSerializer.cs | 1,417 | C# |
// Copyright (c) 2008-2020, Hazelcast, Inc. 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 Hazelcast.Client.Test.Serialization;
using Hazelcast.Config;
using Hazelcast.Core;
using NUnit.Framework;
namespace Hazelcast.Client.Test
{
[TestFixture]
public class PredicateExtTest : SingleMemberBaseTest
{
private IMap<NamedPortable, NamedPortable> map;
[SetUp]
public void Init()
{
map = Client.GetMap<NamedPortable, NamedPortable>(TestSupport.RandomString());
}
[TearDown]
public void Destroy()
{
map.Clear();
}
protected override void ConfigureClient(Configuration config)
{
base.ConfigureClient(config);
config.SerializationConfig.PortableFactories.Add(1, new PortableSerializationTest.TestPortableFactory());
}
private void FillMap()
{
for (var i = 0; i < 100; i++)
{
map.Put(new NamedPortable("key-" + i, i), new NamedPortable("value-" + i, i));
}
}
[Test]
public virtual void TestPredicate_key_property()
{
FillMap();
var predicate = Predicates.Key("myint").GreaterThanOrEqual(50);
var values = map.Values(predicate);
Assert.AreEqual(50, values.Count);
}
[Test]
public virtual void TestPredicate_value_property()
{
FillMap();
var predicate = Predicates.Property("name").Like("value-%");
var values = map.Values(predicate);
Assert.AreEqual(100, values.Count);
}
[Test]
public virtual void TestPredicate_value_property_keyset()
{
FillMap();
var predicate = Predicates.Property("name").Like("value-%");
var values = map.KeySet(predicate);
Assert.AreEqual(100, values.Count);
}
[Test]
public virtual void TestPredicateExt_key_property()
{
var predicateProperty = Predicates.Key("id");
Assert.AreEqual(predicateProperty.Property, "__key.id");
}
[Test]
public virtual void TestPredicateExt_value_property()
{
var predicateProperty = Predicates.Property("name");
Assert.AreEqual(predicateProperty.Property, "name");
}
[Test]
public virtual void TestPredicateExt_key_equal()
{
var predicate = Predicates.Key("name").Equal("value-1");
Assert.AreEqual(predicate, new EqualPredicate("__key.name", "value-1"));
}
[Test]
public virtual void TestPredicateExt_value_equal()
{
var predicate = Predicates.Property("name").Equal("value-1");
Assert.AreEqual(predicate, new EqualPredicate("name", "value-1"));
}
[Test]
public virtual void TestPredicateExt_complex_chained()
{
var predicate = Predicates.Key("id").Equal("id-1").And(Predicates.Property("name").ILike("a%"));
var predicate2 = Predicates.And(Predicates.IsEqual("__key.id", "id-1"),
Predicates.IsILike("name", "a%")
);
Assert.AreEqual(predicate, predicate2);
}
[Test]
public virtual void TestPredicateExt_And()
{
var predicate1 = Predicates.Property("name").Equal("val")
.And(Predicates.Property("id").GreaterThan(10));
var predicate2 = Predicates.And(Predicates.IsEqual("name", "val"), Predicates.IsGreaterThan("id", 10));
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_Between()
{
var predicate1 = Predicates.Property("name").Between(10, 20);
var predicate2 = Predicates.IsBetween("name", 10, 20);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_Equal()
{
var predicate1 = Predicates.Property("name").Equal("val");
var predicate2 = Predicates.IsEqual("name", "val");
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_NotEqual()
{
var predicate1 = Predicates.Property("name").NotEqual("val");
var predicate2 = Predicates.IsNotEqual("name", "val");
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_GreaterThan()
{
var predicate1 = Predicates.Property("name").GreaterThan(10);
var predicate2 = Predicates.IsGreaterThan("name", 10);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_GreaterThanOrEqual()
{
var predicate1 = Predicates.Property("name").GreaterThanOrEqual(10);
var predicate2 = Predicates.IsGreaterThanOrEqual("name", 10);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_In()
{
var predicate1 = Predicates.Property("name").In(10, 20, 30);
var predicate2 = Predicates.IsIn("name", 10, 20, 30);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_ILike()
{
var predicate1 = Predicates.Property("name").ILike("val");
var predicate2 = Predicates.IsILike("name", "val");
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_Like()
{
var predicate1 = Predicates.Property("name").Like("val");
var predicate2 = Predicates.IsLike("name", "val");
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_MatchesRegex()
{
var predicate1 = Predicates.Property("name").MatchesRegex("[a-z]");
var predicate2 = Predicates.MatchesRegex("name", "[a-z]");
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_LessThan()
{
var predicate1 = Predicates.Property("name").LessThan(10);
var predicate2 = Predicates.IsLessThan("name", 10);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_LessThanOrEqual()
{
var predicate1 = Predicates.Property("name").LessThanOrEqual(10);
var predicate2 = Predicates.IsLessThanOrEqual("name", 10);
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_Or()
{
var predicate1 = Predicates.Property("name").Equal("val")
.Or(Predicates.Property("id").GreaterThan(10));
var predicate2 = Predicates.Or(Predicates.IsEqual("name", "val"), Predicates.IsGreaterThan("id", 10));
Assert.AreEqual(predicate1, predicate2);
}
[Test]
public virtual void TestPredicateExt_Not()
{
var predicate1 = Predicates.Property("name").Equal("val").Not();
var predicate2 = Predicates.Not(Predicates.IsEqual("name", "val"));
Assert.AreEqual(predicate1, predicate2);
}
}
} | 34.275424 | 117 | 0.590926 | [
"Apache-2.0"
] | mogatti/hazelcast-csharp-client | Hazelcast.Test/Hazelcast.Client.Test/PredicateExtTest.cs | 8,091 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using BezierMaster.MeshesCreating;
using UnityEngine.Networking;
namespace BezierMaster
{
// #if UNITY_EDITOR
// using Input = GoogleARCore.InstantPreviewInput;
// #endif
public enum Using
{
Objects,
Mesh,
None
}
public enum MeshType
{
Line,
Cylinder,
Tube
}
[SelectionBase]
[RequireComponent(typeof(BezierSpline))]
public class BezierMaster : NetworkBehaviour
{
public BezierSpline spline;
public bool showCurveEditor;
public bool showObjectsOptions;
public bool showAnimationOptions;
public bool showObjRandomisationOptions;
public bool showRotationsOptions;
public bool autoUpdate;
public bool randomise;
public int seed = 0;
public Using usingOfSpline;
public MeshType meshType;
private int selectedIndex = -1;
//
// ----- objects creating variables -----
//
[SerializeField]
private int objectsCount = 5;
public int ObjectsCount
{
get
{
return objectsCount;
}
set
{
if (value > 1 && value < 300)
objectsCount = value;
}
}
[SerializeField]
public GameObject[] objectsPrefabs = new GameObject[0];
int objectN = 0;
[SerializeField]
int[] objectsRandomIndexes;
[SerializeField]
Vector3[] objectRandomScales;
[SerializeField]
Vector3[] objectRandomOffsets;
[SerializeField]
Quaternion[] objectRandomRotation;
public Vector3 scaleRandomMaximum = Vector3.one;
public Vector3 offsetRandomMaximum = Vector3.one;
public Vector3 rotationRandomMaximum = Vector3.zero;
[SerializeField]
public GameObject[] instantiatedObjects = new GameObject[0];
[SerializeField]
Vector3[] objectsScales;
public bool ApplyRotationX = false;
public bool ApplyRotationY = false;
public bool ApplyRotationZ = false;
public Quaternion addRotation = Quaternion.identity;
//
// ----- mesh creating variables -----
//
[SerializeField]
private int lenghtSegmentsCount = 299;
public int LenghtSegmentsCount
{
get
{
return lenghtSegmentsCount;
}
set
{
if (value > 2 && value < 300)
lenghtSegmentsCount = value;
}
}
[SerializeField]
private int widhtSegmentsCount = 5;
public int WidthSegmentsCount
{
get
{
return widhtSegmentsCount;
}
set
{
if (value > 2 && value < 300)
widhtSegmentsCount = value;
}
}
[SerializeField]
public float radius1 = 0.04f;
[SerializeField]
public float radius2 = 1;
[SerializeField]
public GameObject meshGO;
private Mesh mesh;
[SerializeField]
public bool twoSided = false;
[SerializeField]
public bool capStart = true;
[SerializeField]
public bool capEnd = true;
[SerializeField]
public bool textureOrientation = false;
public CreateMeshBase meshCreator;
public int verticesCount = 0;
public int trianglesCount = 0;
private int countTouch = 0;
Vector3 prevPosition = Vector3.zero;
Vector3 touchPoint = Vector3.zero;
private bool firstTime = true;
public bool stop = false;
public float coneDistance = 0.3f;
public bool touchedIcecream = false;
public Transform icecreamTransform;
//commented out all the icecream things to make it a pure doodling tool for now
void Update()
{
//set stop when user presses right key
if(stop){
return;
}
//check if it has network authority first,
//and do nothing if it doesn't
if(!hasAuthority){
return;
}
countTouch += 1;
if (countTouch % 3 != 0)
return;
Ray raycast = Camera.main.ScreenPointToRay(Input.mousePosition);
prevPosition = touchPoint;
//inverse transform point transforms the coordinates to local instead of global
touchPoint = transform.InverseTransformPoint(raycast.GetPoint(coneDistance));
Debug.Log("(" + touchPoint.x + ", " + touchPoint.y + ", " + touchPoint.z + ")");
//touchPoint = raycast.GetPoint(coneDistance);
if (Vector3.Distance(prevPosition, touchPoint) > 0.05f)
{
//let server tell all clients to generate points
CmdUpdatePoints(touchPoint);
}
// }
}
public void updatePointsWithAuthority(Vector3 point){
if(!hasAuthority){
return;
}else{
CmdUpdatePoints(point);
}
}
//tell the server to run function and update the points on the server so
//the server can propagate to all the clients or else it's just local
[Command]
public void CmdUpdatePoints(Vector3 pointToGen){
// if (firstTime == true)
// {
// usingOfSpline = Using.Mesh;
// meshType = MeshType.Cylinder;
// CreateCylinderMesh();
// firstTime = false;
// coneDistance = 2;
// }
// spline.AddCurve(pointToGen);
// UpdateMesh();
// Debug.Log("update in SERVER");
//update the points to the clients
RpcUpdateToClients(pointToGen);
Debug.Log("draw in SERVER");
}
//after command need to rpc to all the clients about the updated points??
[ClientRpc]
public void RpcUpdateToClients(Vector3 pointToGen){
//if is local then don't need to do this
// if(hasAuthority){
// return;
// }
if (firstTime == true)
{
usingOfSpline = Using.Mesh;
meshType = MeshType.Cylinder;
CreateCylinderMesh();
firstTime = false;
coneDistance = 0.3f;
}
spline.AddCurve(pointToGen);
UpdateMesh();
//Debug.Log("draw in CLIENT");
}
public void Reset()
{
if (spline == null)
spline = GetComponent<BezierSpline>();
showCurveEditor = true;
showObjectsOptions = true;
showAnimationOptions = false;
showObjRandomisationOptions = false;
showRotationsOptions = false;
randomise = false;
autoUpdate = true;
objectN = 0;
objectsPrefabs = new GameObject[] { };
Clear(true);
objectsCount = 5;
ApplyRotationX = false;
ApplyRotationY = false;
ApplyRotationZ = false;
addRotation = Quaternion.identity;
lenghtSegmentsCount = 10;
widhtSegmentsCount = 5;
radius1 = 10;
radius2 = 5;
twoSided = false;
capStart = true;
capEnd = true;
textureOrientation = false;
Vector3 scaleRandomMaximum = Vector3.one;
Vector3 offsetRandomMaximum = Vector3.zero;
Vector3 rotationRandomMaximum = Vector3.zero;
}
public void Clear(bool destroy)
{
if (destroy)
for (int i = 0; i < instantiatedObjects.Length; i++)
{
if (instantiatedObjects[i] != null)
DestroyImmediate(instantiatedObjects[i]);
}
instantiatedObjects = new GameObject[objectsCount];
objectsRandomIndexes = new int[objectsCount];
objectsScales = new Vector3[objectsCount];
objectRandomScales = new Vector3[objectsCount];
objectRandomOffsets = new Vector3[objectsCount];
objectRandomRotation = new Quaternion[objectsCount];
}
public void UpdateMaster(bool updateRandom)
{
switch (usingOfSpline)
{
case Using.Mesh:
UpdateMesh();
break;
case Using.Objects:
UpdateObjects(updateRandom);
break;
}
if (updateRandom && randomise)
InitRandom();
//Debug.Log("update!");
}
public void DetachObjects()
{
switch (usingOfSpline)
{
case Using.Mesh:
meshGO.transform.parent = null;
meshGO = null;
break;
case Using.Objects:
var parent = new GameObject("Parent").transform;
parent.position = transform.position;
parent.rotation = transform.rotation;
for (int i = 0; i < instantiatedObjects.Length; i++)
{
instantiatedObjects[i].transform.SetParent(parent);
}
Clear(false);
break;
}
}
void UpdateObjects(bool updateRandom)
{
if (objectsPrefabs.Length == 0 || objectsPrefabs[0] == null)
return;
if (instantiatedObjects == null || instantiatedObjects.Length != objectsCount || instantiatedObjects[0] == null || updateRandom)
{
Clear(true);
for (int i = 0; i < objectsCount; i++)
{
float t = i / (float)(objectsCount - 1);
if (spline.Loop)
t = i / (float)(objectsCount);
instantiatedObjects[i] = Instantiate(GetObject(), transform.TransformPoint(spline.GetPoint(t)), GetRotation(i, t), transform) as GameObject;
objectsScales[i] = instantiatedObjects[i].transform.localScale;
instantiatedObjects[i].transform.localScale = GetScale(i, t);
if (updateRandom)
{
instantiatedObjects[i].transform.position = transform.TransformPoint(spline.GetPoint(t)) + objectRandomOffsets[i];
instantiatedObjects[i].transform.localScale = GetScale(i, t);
instantiatedObjects[i].transform.rotation = GetRotation(i, t);
}
instantiatedObjects[i].name += " (" + (i + 1) + ")";
}
}
else if (instantiatedObjects.Length > 0 && instantiatedObjects[0] != null)
{
for (int i = 0; i < objectsCount; i++)
{
float t = i / (float)(objectsCount - 1);
if (spline.Loop)
t = i / (float)(objectsCount);
instantiatedObjects[i].transform.position = transform.TransformPoint(spline.GetPoint(t)) + objectRandomOffsets[i];
instantiatedObjects[i].transform.localScale = GetScale(i, t);
instantiatedObjects[i].transform.rotation = GetRotation(i, t);
// Debug.DrawLine(transform.TransformPoint(spline.GetPoint(t)), transform.TransformPoint(spline.GetPoint(t)) + spline.GetDirection(t));
}
}
}
void UpdateMesh()
{
if (meshGO == null)
{
//create empty game object
meshGO = new GameObject("Mesh");
meshGO.transform.position = transform.position;
meshGO.transform.rotation = transform.rotation;
meshGO.transform.SetParent(transform);
var mr = meshGO.AddComponent<MeshRenderer>();
mr.material = new Material(Shader.Find("Diffuse"));
}
mesh = meshCreator.CreateMesh();
verticesCount = meshCreator.GetVertexCount();
trianglesCount = meshCreator.GetTrianglesCount();
var mf = meshGO.GetComponent<MeshFilter>();
if (!mf)
mf = meshGO.AddComponent<MeshFilter>();
mf.mesh = mesh;
}
Quaternion GetRotation(int i, float t)
{
Quaternion rotation;
if (ApplyRotationX || ApplyRotationY || ApplyRotationZ)
{
rotation = Quaternion.LookRotation(spline.GetDirection(t));
rotation = Quaternion.Euler(ApplyRotationX ? rotation.eulerAngles.x : 0,
ApplyRotationY ? rotation.eulerAngles.y : 0,
ApplyRotationZ ? rotation.eulerAngles.z + spline.GetRotationZ(t) : 0);
}
else
rotation = Quaternion.identity;
rotation = rotation * addRotation;
rotation = transform.rotation * rotation;
if (randomise)
rotation *= objectRandomRotation[i];
return rotation;
}
Vector3 GetScale(int i, float t)
{
Vector3 scale = new Vector3(objectsScales[i].x * spline.GetScale(t).x, objectsScales[i].y * spline.GetScale(t).y, objectsScales[i].z * spline.GetScale(t).z);
if (randomise)
scale += objectRandomScales[i];
return scale;
}
public void InitRandom()
{
for (int i = 0; i < objectsCount; i++)
{
objectsScales[i] = instantiatedObjects[i].transform.localScale;
objectsRandomIndexes[i] = (int)(Random.value * (objectsPrefabs.Length - 1));
objectRandomRotation[i] = Quaternion.Euler(Random.value * rotationRandomMaximum.x, Random.value * rotationRandomMaximum.y, Random.value * rotationRandomMaximum.z);
objectRandomOffsets[i] = new Vector3(Random.value * offsetRandomMaximum.x, Random.value * offsetRandomMaximum.y, Random.value * offsetRandomMaximum.z);
objectRandomScales[i] = new Vector3(Random.value * scaleRandomMaximum.x, Random.value * scaleRandomMaximum.y, Random.value * scaleRandomMaximum.z);
}
}
GameObject GetObject()
{
if (randomise)
{
if (objectsPrefabs.Length == 0 || objectsPrefabs[0] == null)
return null;
if (objectN > objectsRandomIndexes.Length - 1)
objectN = 0;
return objectsPrefabs[objectsRandomIndexes[objectN++]];
}
else
{
if (objectN > objectsPrefabs.Length - 1)
objectN = 0;
return objectsPrefabs[objectN++];
}
}
#if UNITY_EDITOR
[MenuItem("Bezier Master/Create Bezier")]
public static void CreateBezierMaster()
{
var master = new GameObject("Bezier Master");
master.AddComponent<BezierMaster>().Reset();
}
#endif
/// <summary>
/// Return array of points positions along curve.
/// </summary>
/// <param name="pointsCount"></param>
/// <returns></returns>
public Vector3[] GetPath(int pointsCount)
{
if (spline == null || pointsCount <= 0)
return null;
Vector3[] path = new Vector3[pointsCount];
for (int i = 0; i < pointsCount; i++)
{
float t = i / (float)(pointsCount - 1);
if (spline.Loop)
t = i / (float)(pointsCount);
path[i] = transform.TransformPoint(spline.GetPoint(t));
}
return path;
}
private void CreateCylinderMesh()
{
//Clear(true);
meshCreator = new CreateCylinder(spline);
}
}
} | 30.407273 | 179 | 0.516742 | [
"MIT"
] | katie-chiang/SinglePlayerFPS | Assets/Scripts/BezierMaster/Scripts/BezierMaster.cs | 16,726 | C# |
// <auto-generated>
// 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 CRM.Interface.Models
{
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Collection of appointment
/// </summary>
/// <remarks>
/// Microsoft.Dynamics.CRM.appointmentCollection
/// </remarks>
public partial class MicrosoftDynamicsCRMappointmentCollection
{
/// <summary>
/// Initializes a new instance of the
/// MicrosoftDynamicsCRMappointmentCollection class.
/// </summary>
public MicrosoftDynamicsCRMappointmentCollection()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the
/// MicrosoftDynamicsCRMappointmentCollection class.
/// </summary>
public MicrosoftDynamicsCRMappointmentCollection(IList<MicrosoftDynamicsCRMappointment> value = default(IList<MicrosoftDynamicsCRMappointment>))
{
Value = value;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "value")]
public IList<MicrosoftDynamicsCRMappointment> Value { get; set; }
}
}
| 29.433962 | 152 | 0.632051 | [
"MIT"
] | msehudi/cms-accelerator | OData.OpenAPI/odata2openapi/Client/Models/MicrosoftDynamicsCRMappointmentCollection.cs | 1,560 | C# |
using UnityEngine;
using UnityEngine.UI;
using InteroAPI.OAuth;
public class ClassUiItem : MonoBehaviour{
//Class name
public Text className;
//Class time
public Text classStart;
//Class day
public Text Day;
//Id to the other scene
// public string idItem;
public WorkoutJSON workout;
public SegmentFiller segmentFiller;
public void ChangeScene()
{
segmentFiller.ShowSelectedWorkout(workout);
// SingletonWorkouts.instancia.id = idItem;
// SceneManager.LoadScene("LobbyEscene");
}
}
| 20.033333 | 52 | 0.637271 | [
"MIT"
] | InteroOpen/intero-tutorials | Assets/InteroAPI/Tutorials/Tutorial7Schedule/ClassUiItem.cs | 603 | C# |
using System;
using System.Management.Automation;
using PowerForensics.Formats;
using PowerForensics.Ntfs;
namespace PowerForensics.Cmdlets
{
#region FormatMactimeCommand
/// <summary>
/// This class implements the Format-Mactime cmdlet.
/// </summary>
[Cmdlet(VerbsCommon.Format, "Mactime")]
public class FormatMactimeCommand : PSCmdlet
{
#region Parameters
/// <summary>
/// This parameter provides the MFTRecord object(s) to
/// derive Mactime objects from.
/// </summary>
[Parameter(Mandatory = true, ValueFromPipeline = true)]
public FileRecord MFTRecord
{
get { return mftRecord; }
set { mftRecord = value; }
}
private FileRecord mftRecord;
#endregion Parameters
#region Cmdlet Overrides
/// <summary>
/// The ProcessRecord method calls Mactime.Get()
/// method to return an array of Mactime objects
/// for the inputted MFTRecord object.
/// </summary>
protected override void ProcessRecord()
{
// Create an array of Mactime objects for the current MFTRecord object
WriteObject(Mactime.Get(mftRecord));
}
#endregion Cmdlet Overrides
}
#endregion FormatMactimeCommand
}
| 26.98 | 82 | 0.613047 | [
"Apache-2.0"
] | darkoperator/PowerForensics_Source | Invoke-IR.PowerForensics/PowerForensics/_Cmdlets/Formats/Format-Mactime.cs | 1,351 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Moq;
namespace Microsoft.VisualStudio.ProjectSystem.VS
{
internal static class IUserNotificationServicesFactory
{
public static IUserNotificationServices Create()
{
return Mock.Of<IUserNotificationServices>();
}
public static IUserNotificationServices Implement(bool confirmRename)
{
var mock = new Mock<IUserNotificationServices>();
mock.Setup(h => h.Confirm(It.IsAny<string>()))
.Returns(confirmRename);
return mock.Object;
}
public static IUserNotificationServices ImplementReportErrorInfo()
{
var mock = new Mock<IUserNotificationServices>();
mock.Setup(h => h.ReportErrorInfo(It.IsAny<int>()));
return mock.Object;
}
}
}
| 29.323529 | 161 | 0.630893 | [
"Apache-2.0"
] | 333fred/roslyn-project-system | src/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/Mocks/IUserNotificationServicesFactory.cs | 999 | C# |
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace Elasticsearch.Net.Integration.Yaml.Create4
{
public partial class Create4YamlTests
{
[NCrunch.Framework.ExclusivelyUses("ElasticsearchYamlTests")]
public class ExternalVersion1Tests : YamlTestsBase
{
[Test]
public void ExternalVersion1Test()
{
//do create
_body = new {
foo= "bar"
};
this.Do(()=> _client.Index("test_1", "test", "1", _body, nv=>nv
.Add("version_type", @"external")
.Add("version", 5)
.Add("op_type", @"create")
));
//match _response._version:
this.IsMatch(_response._version, 5);
//do create
_body = new {
foo= "bar"
};
this.Do(()=> _client.Index("test_1", "test", "1", _body, nv=>nv
.Add("version_type", @"external")
.Add("version", 5)
.Add("op_type", @"create")
), shouldCatch: @"conflict");
//do create
_body = new {
foo= "bar"
};
this.Do(()=> _client.Index("test_1", "test", "1", _body, nv=>nv
.Add("version_type", @"external")
.Add("version", 6)
.Add("op_type", @"create")
), shouldCatch: @"conflict");
}
}
}
}
| 21.098361 | 67 | 0.605284 | [
"MIT"
] | amitstefen/elasticsearch-net | src/Tests/Elasticsearch.Net.Integration.Yaml/create/35_external_version.yaml.cs | 1,287 | C# |
#if !DISABLE_PLAYFABENTITY_API
using System;
using System.Collections.Generic;
using PlayFab.SharedModels;
namespace PlayFab.LocalizationModels
{
[Serializable]
public class GetLanguageListRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags;
}
[Serializable]
public class GetLanguageListResponse : PlayFabResultCommon
{
/// <summary>
/// The list of allowed languages, in BCP47 two-letter format
/// </summary>
public List<string> LanguageList;
}
}
#endif
| 26.666667 | 119 | 0.675 | [
"MIT"
] | 101Bunker/1017 | Assets/PlayFabSDK/Localization/PlayFabLocalizationModels.cs | 720 | C# |
// ReSharper disable once CheckNamespace
namespace Fluent
{
using System.Collections;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Data;
using System.Windows.Markup;
using Fluent.Helpers;
using Fluent.Internal.KnownBoxes;
/// <summary>
/// Represents Fluent UI specific RadioButton
/// </summary>
[ContentProperty(nameof(Header))]
public class RadioButton : System.Windows.Controls.RadioButton, IRibbonControl, IQuickAccessItemProvider, ILargeIconProvider, IMediumIconProvider, ISimplifiedRibbonControl
{
#region Properties
#region Size
/// <inheritdoc />
public RibbonControlSize Size
{
get { return (RibbonControlSize)this.GetValue(SizeProperty); }
set { this.SetValue(SizeProperty, value); }
}
/// <summary>Identifies the <see cref="Size"/> dependency property.</summary>
public static readonly DependencyProperty SizeProperty = RibbonProperties.SizeProperty.AddOwner(typeof(RadioButton));
#endregion
#region SizeDefinition
/// <inheritdoc />
public RibbonControlSizeDefinition SizeDefinition
{
get { return (RibbonControlSizeDefinition)this.GetValue(SizeDefinitionProperty); }
set { this.SetValue(SizeDefinitionProperty, value); }
}
/// <summary>Identifies the <see cref="SizeDefinition"/> dependency property.</summary>
public static readonly DependencyProperty SizeDefinitionProperty = RibbonProperties.SizeDefinitionProperty.AddOwner(typeof(RadioButton));
#endregion
#region SimplifiedSizeDefinition
/// <inheritdoc />
public RibbonControlSizeDefinition SimplifiedSizeDefinition
{
get { return (RibbonControlSizeDefinition)this.GetValue(SimplifiedSizeDefinitionProperty); }
set { this.SetValue(SimplifiedSizeDefinitionProperty, value); }
}
/// <summary>Identifies the <see cref="SimplifiedSizeDefinition"/> dependency property.</summary>
public static readonly DependencyProperty SimplifiedSizeDefinitionProperty = RibbonProperties.SimplifiedSizeDefinitionProperty.AddOwner(typeof(RadioButton));
#endregion
#region KeyTip
/// <inheritdoc />
public string? KeyTip
{
get { return (string?)this.GetValue(KeyTipProperty); }
set { this.SetValue(KeyTipProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for Keys.
/// This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty KeyTipProperty = Fluent.KeyTip.KeysProperty.AddOwner(typeof(RadioButton));
#endregion
#region Header
/// <inheritdoc />
public object? Header
{
get { return this.GetValue(HeaderProperty); }
set { this.SetValue(HeaderProperty, value); }
}
/// <summary>Identifies the <see cref="Header"/> dependency property.</summary>
public static readonly DependencyProperty HeaderProperty = RibbonControl.HeaderProperty.AddOwner(typeof(RadioButton), new PropertyMetadata(LogicalChildSupportHelper.OnLogicalChildPropertyChanged));
#endregion
#region Icon
/// <inheritdoc />
public object? Icon
{
get { return this.GetValue(IconProperty); }
set { this.SetValue(IconProperty, value); }
}
/// <summary>Identifies the <see cref="Icon"/> dependency property.</summary>
public static readonly DependencyProperty IconProperty = RibbonControl.IconProperty.AddOwner(typeof(RadioButton), new PropertyMetadata(LogicalChildSupportHelper.OnLogicalChildPropertyChanged));
#endregion
#region LargeIcon
/// <inheritdoc />
public object? LargeIcon
{
get { return this.GetValue(LargeIconProperty); }
set { this.SetValue(LargeIconProperty, value); }
}
/// <summary>Identifies the <see cref="LargeIcon"/> dependency property.</summary>
public static readonly DependencyProperty LargeIconProperty = LargeIconProviderProperties.LargeIconProperty.AddOwner(typeof(RadioButton), new PropertyMetadata(LogicalChildSupportHelper.OnLogicalChildPropertyChanged));
#endregion
#region MediumIcon
/// <inheritdoc />
public object? MediumIcon
{
get { return this.GetValue(MediumIconProperty); }
set { this.SetValue(MediumIconProperty, value); }
}
/// <summary>Identifies the <see cref="MediumIcon"/> dependency property.</summary>
public static readonly DependencyProperty MediumIconProperty = MediumIconProviderProperties.MediumIconProperty.AddOwner(typeof(RadioButton), new PropertyMetadata(LogicalChildSupportHelper.OnLogicalChildPropertyChanged));
#endregion
#region IsSimplified
/// <summary>
/// Gets or sets whether or not the ribbon is in Simplified mode
/// </summary>
public bool IsSimplified
{
get { return (bool)this.GetValue(IsSimplifiedProperty); }
private set { this.SetValue(IsSimplifiedPropertyKey, BooleanBoxes.Box(value)); }
}
private static readonly DependencyPropertyKey IsSimplifiedPropertyKey =
DependencyProperty.RegisterReadOnly(nameof(IsSimplified), typeof(bool), typeof(RadioButton), new PropertyMetadata(BooleanBoxes.FalseBox));
/// <summary>Identifies the <see cref="IsSimplified"/> dependency property.</summary>
public static readonly DependencyProperty IsSimplifiedProperty = IsSimplifiedPropertyKey.DependencyProperty;
#endregion
#endregion Properties
#region Constructors
/// <summary>
/// Static constructor
/// </summary>
static RadioButton()
{
var type = typeof(RadioButton);
DefaultStyleKeyProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(type));
ContextMenuService.Attach(type);
ToolTipService.Attach(type);
}
/// <summary>
/// Default constructor
/// </summary>
public RadioButton()
{
ContextMenuService.Coerce(this);
}
#endregion
#region Quick Access Item Creating
/// <inheritdoc />
public virtual FrameworkElement CreateQuickAccessItem()
{
var button = new RadioButton();
RibbonControl.Bind(this, button, nameof(this.IsChecked), IsCheckedProperty, BindingMode.TwoWay);
button.Click += (sender, e) => this.RaiseEvent(e);
RibbonControl.BindQuickAccessItem(this, button);
return button;
}
/// <inheritdoc />
public bool CanAddToQuickAccessToolBar
{
get { return (bool)this.GetValue(CanAddToQuickAccessToolBarProperty); }
set { this.SetValue(CanAddToQuickAccessToolBarProperty, BooleanBoxes.Box(value)); }
}
/// <summary>Identifies the <see cref="CanAddToQuickAccessToolBar"/> dependency property.</summary>
public static readonly DependencyProperty CanAddToQuickAccessToolBarProperty = RibbonControl.CanAddToQuickAccessToolBarProperty.AddOwner(typeof(RadioButton), new PropertyMetadata(BooleanBoxes.TrueBox, RibbonControl.OnCanAddToQuickAccessToolBarChanged));
#endregion
#region Implementation of IKeyTipedControl
/// <inheritdoc />
public KeyTipPressedResult OnKeyTipPressed()
{
this.OnClick();
return KeyTipPressedResult.Empty;
}
/// <inheritdoc />
public void OnKeyTipBack()
{
}
#endregion
/// <inheritdoc />
void ISimplifiedStateControl.UpdateSimplifiedState(bool isSimplified)
{
this.IsSimplified = isSimplified;
}
/// <inheritdoc />
void ILogicalChildSupport.AddLogicalChild(object child)
{
this.AddLogicalChild(child);
}
/// <inheritdoc />
void ILogicalChildSupport.RemoveLogicalChild(object child)
{
this.RemoveLogicalChild(child);
}
/// <inheritdoc />
protected override IEnumerator LogicalChildren
{
get
{
var baseEnumerator = base.LogicalChildren;
while (baseEnumerator?.MoveNext() == true)
{
yield return baseEnumerator.Current;
}
if (this.Icon is not null)
{
yield return this.Icon;
}
if (this.MediumIcon is not null)
{
yield return this.MediumIcon;
}
if (this.LargeIcon is not null)
{
yield return this.LargeIcon;
}
if (this.Header is not null)
{
yield return this.Header;
}
}
}
/// <inheritdoc />
protected override AutomationPeer OnCreateAutomationPeer() => new Fluent.Automation.Peers.RibbonRadioButtonAutomationPeer(this);
}
} | 34.289855 | 261 | 0.630178 | [
"MIT"
] | DevTown/Fluent.Ribbon | Fluent.Ribbon/Controls/RadioButton.cs | 9,466 | C# |
#region BSD License
/*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE.md file or at
* https://github.com/Wagnerp/Krypton-Toolkit-Suite-Extended-NET-5.450/blob/master/LICENSE
*
*/
#endregion
using ComponentFactory.Krypton.Toolkit;
namespace Playground
{
public class LineNumberedTextBox : KryptonForm
{
private KryptonPanel kryptonPanel1;
private void InitializeComponent()
{
this.kryptonPanel1 = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).BeginInit();
this.SuspendLayout();
//
// kryptonPanel1
//
this.kryptonPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.kryptonPanel1.Location = new System.Drawing.Point(0, 0);
this.kryptonPanel1.Name = "kryptonPanel1";
this.kryptonPanel1.Size = new System.Drawing.Size(1241, 707);
this.kryptonPanel1.TabIndex = 0;
//
// LineNumberedTextBox
//
this.ClientSize = new System.Drawing.Size(1241, 707);
this.Controls.Add(this.kryptonPanel1);
this.Name = "LineNumberedTextBox";
((System.ComponentModel.ISupportInitialize)(this.kryptonPanel1)).EndInit();
this.ResumeLayout(false);
}
}
} | 34.142857 | 90 | 0.629707 | [
"BSD-3-Clause"
] | Wagnerp/Krypton-Toolkit-Suite-Extended-NET-5.450 | Source/Krypton Toolkit Suite Extended/Demos/Playground/LineNumberedTextBox.cs | 1,436 | C# |
using System;
using System.Diagnostics.CodeAnalysis;
namespace ModulesRegistry.Data.Extensions
{
public static class StringExtensions
{
public static bool HasValue([NotNullWhen(true)] this string? me) =>
!string.IsNullOrWhiteSpace(me);
public static bool HasNoValue([NotNullWhen(false)] this string? me) =>
string.IsNullOrWhiteSpace(me);
public static string FirstItem(this string? me, string defaultValue = "") =>
me is null || me.Length == 0 ? defaultValue : me.Split(',')[0] ?? defaultValue;
}
public static class DateTimeExtensions
{
public static string AsPeriod(this (DateTime? from, DateTime? to) period, string format = "d") =>
period.from.HasValue && period.to.HasValue ? $"{period.from.Value.ToString(format)} - {period.to.Value.ToString(format)}" :
period.from.HasValue ? $"{period.from.Value.ToString(format)} - " :
period.to.HasValue ? $"- {period.to.Value.ToString(format)}" :
string.Empty;
public static string AsPeriod(this (short? from, short? to) period) =>
period.from.HasValue && period.to.HasValue ? $"{period.from.Value} - {period.to.Value}" :
period.from.HasValue ? $"{period.from.Value} - " :
period.to.HasValue ? $"- {period.to.Value}" :
string.Empty;
}
}
| 40.705882 | 135 | 0.623555 | [
"MIT"
] | tellurianinteractive/Tellurian.Trains.ModulesRegistryApp | SourceCode/Data/Extensions/StringExtensions.cs | 1,386 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Unity.Collections;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class FlareStatusData
{
public Vector3 sourceCoordinate;
public Vector3[] flareWorldPosCenter;
public float fadeoutScale;
public int fadeState; //0:normal, 1:fade in, 2: fade out, 3:unrendered
public Vector4 sourceScreenPos;
public Mesh flareMesh;
public Vector3[] vertices;
public Vector2[] uv;
public Color[] vertColor;
public int[] triangle;
}
public class MFLensFlare : MonoBehaviour
{
public bool DebugMode;
[Space(10)]
public Material material;
public float fadeoutTime;
public Dictionary<MFFlareLauncher, FlareStatusData> FlareDict => _flareDict;
private Dictionary<MFFlareLauncher, FlareStatusData> _flareDict;
private Camera _camera;
private Vector2 _halfScreen;
private MaterialPropertyBlock _propertyBlock;
private Vector3 _screenCenter;
private Queue<Mesh> _meshPool;
private static readonly int STATIC_FLARESCREENPOS = Shader.PropertyToID("_FlareScreenPos");
private static readonly int STATIC_BaseMap = Shader.PropertyToID("_MainTex");
private static readonly float DISTANCE = 1f;
private void Awake()
{
_camera = GetComponent<Camera>();
_propertyBlock = new MaterialPropertyBlock();
_flareDict = new Dictionary<MFFlareLauncher, FlareStatusData>();
_meshPool = new Queue<Mesh>();
}
private FlareStatusData InitFlareData(MFFlareLauncher mfFlareLauncher)
{
int flareCount = mfFlareLauncher.asset.spriteBlocks.Count;
FlareStatusData statusData = new FlareStatusData
{
sourceCoordinate = Vector3.zero,
flareWorldPosCenter = new Vector3[mfFlareLauncher.asset.spriteBlocks.Count],
// edgeScale = 1,
fadeoutScale = 0,
fadeState = 1,
sourceScreenPos = Vector4.zero,
flareMesh = _meshPool.Count > 0 ? _meshPool.Dequeue() : new Mesh(),
vertices = new Vector3[flareCount * 4],
triangle = new int[flareCount * 6],
uv = new Vector2[flareCount * 4],
vertColor = new Color[flareCount * 4]
};
for (int i = 0; i < mfFlareLauncher.asset.spriteBlocks.Count; i++)
{
Rect rect = mfFlareLauncher.asset.spriteBlocks[i].block;
statusData.uv[i * 4] = rect.position;
statusData.uv[i * 4 + 1] = rect.position + new Vector2(rect.width, 0);
statusData.uv[i * 4 + 2] = rect.position + new Vector2(0, rect.height);
statusData.uv[i * 4 + 3] = rect.position + rect.size;
statusData.triangle[i * 6] = i * 4;
statusData.triangle[i * 6 + 1] = i * 4 + 3;
statusData.triangle[i * 6 + 2] = i * 4 + 1;
statusData.triangle[i * 6 + 3] = i * 4;
statusData.triangle[i * 6 + 4] = i * 4 + 2;
statusData.triangle[i * 6 + 5] = i * 4 + 3;
}
return statusData;
}
public void AddLight(MFFlareLauncher mfFlareLauncher)
{
if (DebugMode)
{
Debug.Log("Add Light " + mfFlareLauncher.gameObject.name + " to FlareList");
}
var flareData = InitFlareData(mfFlareLauncher);
_flareDict.Add(mfFlareLauncher, flareData);
}
public void RemoveLight(MFFlareLauncher mfFlareLauncher)
{
if(DebugMode)Debug.Log("Remove Light " + mfFlareLauncher.gameObject.name + " from FlareList");
if (_flareDict.TryGetValue(mfFlareLauncher, out FlareStatusData flareState))
{
flareState.flareMesh.Clear();
_meshPool.Enqueue(flareState.flareMesh);
_flareDict.Remove(mfFlareLauncher);
}
}
private void Update()
{
_halfScreen = new Vector2(_camera.scaledPixelWidth / 2 + _camera.pixelRect.xMin, _camera.scaledPixelHeight / 2 + _camera.pixelRect.yMin);
var cameraTransform = _camera.transform;
_screenCenter = cameraTransform.position + cameraTransform.forward * 0.1f;
foreach (var pair in _flareDict)
{
FlareStatusData flareStatusData = pair.Value;
MFFlareLauncher lightSource = pair.Key;
GetSourceCoordinate(lightSource, ref flareStatusData);
bool isIn = CheckIn(lightSource, ref flareStatusData);
if (flareStatusData.fadeoutScale > 0)
{
// if (flareData.fadeState == 3)
// {
// _totalMesh.Add(new Mesh());
// }
if (!isIn)
{
flareStatusData.fadeState = 2;
}
}
if(flareStatusData.fadeoutScale < 1)
{
if (isIn)
{
flareStatusData.fadeState = 1;
}
}
if (!isIn && flareStatusData.fadeoutScale <=0 )
{
if (flareStatusData.fadeState != 3)
{
flareStatusData.fadeState = 3;
}
}
else
{
CalculateMeshData(lightSource, ref flareStatusData);
}
switch (flareStatusData.fadeState)
{
case 1:
flareStatusData.fadeoutScale += Time.deltaTime / fadeoutTime;
flareStatusData.fadeoutScale = Mathf.Clamp(flareStatusData.fadeoutScale, 0, 1);
break;
case 2:
flareStatusData.fadeoutScale -= Time.deltaTime / fadeoutTime;
flareStatusData.fadeoutScale = Mathf.Clamp(flareStatusData.fadeoutScale, 0, 1);
break;
case 3:
// RemoveLight(lightSource[i]);
break;
default:
break;
}
CreateMesh(lightSource, ref flareStatusData);
if(DebugMode)DebugDrawMeshPos(lightSource, flareStatusData);
}
if (DebugMode)
{
Debug.Log("Lens Flare : " + _flareDict.Count + " lights");
}
}
void GetSourceCoordinate(MFFlareLauncher lightSource, ref FlareStatusData statusData)
{
var lightSourceTransform = lightSource.transform;
Vector3 sourceScreenPos = _camera.WorldToScreenPoint(
lightSource.directionalLight
?_camera.transform.position - lightSourceTransform.forward * 10000
:lightSourceTransform.position
);
statusData.sourceCoordinate = sourceScreenPos;
}
bool CheckIn(MFFlareLauncher lightSource, ref FlareStatusData statusData)
{
if (statusData.sourceCoordinate.x < _camera.pixelRect.xMin || statusData.sourceCoordinate.y < _camera.pixelRect.yMin
|| statusData.sourceCoordinate.x > _camera.pixelRect.xMax || statusData.sourceCoordinate.y > _camera.pixelRect.yMax
|| Vector3.Dot(lightSource.directionalLight ? -lightSource.transform.forward : lightSource.transform.position - _camera.transform.position, _camera.transform.forward) < 0.25f)
{
statusData.sourceScreenPos = Vector4.zero;
return false;
}
else
{
// var camPos = _camera.transform.position;
// var targetPos = lightSource.directionalLight
// ? -lightSource.transform.forward * 10000f
// : lightSource.transform.position;
// Ray ray = new Ray(camPos, targetPos - camPos );
// RaycastHit hit;
// Physics.Raycast(ray, out hit);
// if (Vector3.Distance(hit.point, camPos) < Vector3.Distance(targetPos, camPos))
// {
// if (hit.point == Vector3.zero) return true;
// return false;
// }
Vector4 screenUV = statusData.sourceCoordinate;
screenUV.x = screenUV.x / _camera.pixelWidth;
screenUV.y = screenUV.y / _camera.pixelHeight;
screenUV.w = lightSource.directionalLight ? 1 : 0;
statusData.sourceScreenPos = screenUV;
return true;
}
}
void CalculateMeshData(MFFlareLauncher lightSource, ref FlareStatusData statusData)
{
Vector3[] oneFlareLine = new Vector3[lightSource.asset.spriteBlocks.Count];
float[] useLightColor = new float[lightSource.asset.spriteBlocks.Count];
for (int i = 0; i < lightSource.asset.spriteBlocks.Count; i++)
{
Vector2 realSourceCoordinateOffset = new Vector2(statusData.sourceCoordinate.x - _halfScreen.x, statusData.sourceCoordinate.y - _halfScreen.y);
Vector2 realOffset = realSourceCoordinateOffset * lightSource.asset.spriteBlocks[i].offset;
oneFlareLine[i] = new Vector3(_halfScreen.x + realOffset.x, _halfScreen.y + realOffset.y, DISTANCE);
useLightColor[i] = lightSource.asset.spriteBlocks[i].useLightColor;
}
statusData.flareWorldPosCenter = oneFlareLine;
}
void CreateMesh(MFFlareLauncher lightSource, ref FlareStatusData statusData)
{
var flareCount = lightSource.asset.spriteBlocks.Count;
if (statusData.fadeoutScale > 0)
{
Texture2D tex = lightSource.asset.flareSprite;
float angle = (45 +Vector2.SignedAngle(Vector2.up, new Vector2(statusData.sourceCoordinate.x - _halfScreen.x, statusData.sourceCoordinate.y - _halfScreen.y))) / 180 * Mathf.PI;
for (int i = 0; i < lightSource.asset.spriteBlocks.Count; i++)
{
Rect rect = lightSource.asset.spriteBlocks[i].block;
Vector2 halfSize = new Vector2(
tex.width * rect.width / 2 * lightSource.asset.spriteBlocks[i].scale * (lightSource.asset.fadeWithScale ? ( statusData.fadeoutScale * 0.5f + 0.5f) : 1),
tex.height * rect.height / 2 * lightSource.asset.spriteBlocks[i].scale * (lightSource.asset.fadeWithScale ? ( statusData.fadeoutScale * 0.5f + 0.5f) : 1));
Vector3 flarePos = statusData.flareWorldPosCenter[i];
if (lightSource.asset.spriteBlocks[i].useRotation)
{
float magnitude = Mathf.Sqrt(halfSize.x * halfSize.x + halfSize.y * halfSize.y);
float cos = magnitude * Mathf.Cos(angle);
float sin = magnitude * Mathf.Sin(angle);
statusData.vertices[i * 4] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x - sin, flarePos.y + cos, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 1] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x - cos, flarePos.y - sin, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 2] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x + cos, flarePos.y + sin, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 3] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x + sin, flarePos.y - cos, flarePos.z)) - _screenCenter;
}
else
{
statusData.vertices[i * 4] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x - halfSize.x, flarePos.y + halfSize.y, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 1] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x - halfSize.x, flarePos.y - halfSize.y, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 2] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x + halfSize.x, flarePos.y + halfSize.y, flarePos.z)) - _screenCenter;
statusData.vertices[i * 4 + 3] = _camera.ScreenToWorldPoint(new Vector3(flarePos.x + halfSize.x, flarePos.y - halfSize.y, flarePos.z)) - _screenCenter;
}
Color vertexAddColor = lightSource.asset.spriteBlocks[i].color;
Color lightColor = default;
Light source = lightSource.GetComponent<Light>();
lightColor.r = Mathf.Lerp(1, source.color.r,
lightSource.asset.spriteBlocks[i].useLightColor);
lightColor.g = Mathf.Lerp(1, source.color.g,
lightSource.asset.spriteBlocks[i].useLightColor);
lightColor.b = Mathf.Lerp(1, source.color.b,
lightSource.asset.spriteBlocks[i].useLightColor);
lightColor.a = 1;
lightColor *= lightSource.useLightIntensity ? source.intensity : 1;
vertexAddColor *= new Vector4(lightColor.r, lightColor.g, lightColor.b,
(1.5f - Mathf.Abs(lightSource.asset.spriteBlocks[i].offset)) / 1.5f
* (1 - Mathf.Min(1, new Vector2(flarePos.x - _halfScreen.x, flarePos.y - _halfScreen.y).magnitude / new Vector2(_halfScreen.x, _halfScreen.y).magnitude))
) * ((lightSource.asset.fadeWithAlpha ? statusData.fadeoutScale: 1));
vertexAddColor = vertexAddColor.linear;
statusData.vertColor[i * 4] = _ = vertexAddColor;
statusData.vertColor[i * 4 + 1] = vertexAddColor;
statusData.vertColor[i * 4 + 2] = vertexAddColor;
statusData.vertColor[i * 4 + 3] = vertexAddColor;
}
statusData.flareMesh.vertices = statusData.vertices;
statusData.flareMesh.uv = statusData.uv;
statusData.flareMesh.triangles = statusData.triangle;
statusData.flareMesh.colors = statusData.vertColor;
_propertyBlock.SetTexture(STATIC_BaseMap, lightSource.asset.flareSprite);
_propertyBlock.SetVector(STATIC_FLARESCREENPOS, statusData.sourceScreenPos);
Graphics.DrawMesh(statusData.flareMesh, _screenCenter, Quaternion.identity, material, 0, _camera, 0, _propertyBlock);
}
}
void DebugDrawMeshPos(MFFlareLauncher lightSource, FlareStatusData statusData)
{
for (int i = 0; i < lightSource.asset.spriteBlocks.Count; i++)
{
Debug.DrawLine(_camera.transform.position, _camera.ScreenToWorldPoint(statusData.flareWorldPosCenter[i]));
}
}
private void OnDestroy()
{
foreach (var pair in _flareDict)
{
_meshPool.Enqueue(pair.Value.flareMesh);
}
while (_meshPool.Count > 0)
{
Destroy(_meshPool.Dequeue());
}
_meshPool.Clear();
}
}
#if UNITY_EDITOR
[CustomEditor(typeof(MFLensFlare))]
public class MFLensflareEditor : Editor
{
public MFLensFlare _target;
private void OnEnable()
{
_target = target as MFLensFlare;
}
public override void OnInspectorGUI()
{
EditorGUILayout.LabelField("Light Count: ", _target.FlareDict.Count.ToString());
base.OnInspectorGUI();
}
}
#endif
| 45.422961 | 188 | 0.606319 | [
"MIT"
] | Reguluz/Moonflow-Lensflare-System | Assets/MoonFlowLensFlare/MFLensFlare.cs | 15,037 | C# |
using Default_BlazorWebAssemblyAppPwaAspNetCoreHosted.Shared;
using Microsoft.AspNetCore.Mvc;
namespace Default_BlazorWebAssemblyAppPwaAspNetCoreHosted.Server.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
} | 32.029412 | 106 | 0.62259 | [
"Apache-2.0"
] | vincoss/blazor-samples | src/Default_BlazorWebAssemblyAppPwaAspNetCoreHosted/Server/Controllers/WeatherForecastController.cs | 1,089 | C# |
using UnityEngine;
using System;
using System.Collections.Generic;
using UnityEngine.Events;
namespace UMA
{
/// <summary>
/// UMA data holds the recipe for creating a character and skeleton and Unity references for a built character.
/// </summary>
public class UMAData : MonoBehaviour
{
[Obsolete("UMA 2.5 myRenderer is now obsolete, an uma can have multiple renderers. Use int rendererCount { get; } and GetRenderer(int) instead.", false)]
public SkinnedMeshRenderer myRenderer;
private SkinnedMeshRenderer[] renderers;
public int rendererCount { get { return renderers == null ? 0 : renderers.Length; } }
public SkinnedMeshRenderer GetRenderer(int idx)
{
return renderers[idx];
}
public SkinnedMeshRenderer[] GetRenderers()
{
return renderers;
}
public void SetRenderers(SkinnedMeshRenderer[] renderers)
{
#pragma warning disable 618
myRenderer = (renderers != null && renderers.Length > 0) ? renderers[0] : null;
#pragma warning restore 618
this.renderers = renderers;
}
[NonSerialized]
public bool firstBake;
public UMAGeneratorBase umaGenerator;
[NonSerialized]
public GeneratedMaterials generatedMaterials = new GeneratedMaterials();
private LinkedListNode<UMAData> listNode;
public void MoveToList(LinkedList<UMAData> list)
{
if (listNode.List != null)
{
listNode.List.Remove(listNode);
}
list.AddLast(listNode);
}
public float atlasResolutionScale = 1f;
/// <summary>
/// Has the character mesh changed?
/// </summary>
public bool isMeshDirty;
/// <summary>
/// Has the character skeleton changed?
/// </summary>
public bool isShapeDirty;
/// <summary>
/// Have the overlay textures changed?
/// </summary>
public bool isTextureDirty;
/// <summary>
/// Have the texture atlases changed?
/// </summary>
public bool isAtlasDirty;
public BlendShapeSettings blendShapeSettings = new BlendShapeSettings();
public RuntimeAnimatorController animationController;
private Dictionary<int, int> animatedBonesTable;
public void ResetAnimatedBones()
{
if (animatedBonesTable == null)
{
animatedBonesTable = new Dictionary<int, int>();
}
else
{
animatedBonesTable.Clear();
}
}
public void RegisterAnimatedBone(int hash)
{
if (!animatedBonesTable.ContainsKey(hash))
{
animatedBonesTable.Add(hash, animatedBonesTable.Count);
}
}
public Transform GetGlobalTransform()
{
return (renderers != null && renderers.Length > 0) ? renderers[0].rootBone : umaRoot.transform.Find("Global");
}
public void RegisterAnimatedBoneHierarchy(int hash)
{
if (!animatedBonesTable.ContainsKey(hash))
{
animatedBonesTable.Add(hash, animatedBonesTable.Count);
}
}
public bool cancelled { get; private set; }
[NonSerialized]
public bool dirty = false;
private bool isOfficiallyCreated = false;
/// <summary>
/// Callback event when character has been updated.
/// </summary>
public event Action<UMAData> OnCharacterUpdated { add { if (CharacterUpdated == null) CharacterUpdated = new UMADataEvent(); CharacterUpdated.AddListener(new UnityAction<UMAData>(value)); } remove { CharacterUpdated.RemoveListener(new UnityAction<UMAData>(value)); } }
/// <summary>
/// Callback event when character has been completely created.
/// </summary>
public event Action<UMAData> OnCharacterCreated { add { if (CharacterCreated == null) CharacterCreated = new UMADataEvent(); CharacterCreated.AddListener(new UnityAction<UMAData>(value)); } remove { CharacterCreated.RemoveListener(new UnityAction<UMAData>(value)); } }
/// <summary>
/// Callback event when character has been destroyed.
/// </summary>
public event Action<UMAData> OnCharacterDestroyed { add { if (CharacterDestroyed == null) CharacterDestroyed = new UMADataEvent(); CharacterDestroyed.AddListener(new UnityAction<UMAData>(value)); } remove { CharacterDestroyed.RemoveListener(new UnityAction<UMAData>(value)); } }
/// Callback event when character DNA has been updated.
/// </summary>
public event Action<UMAData> OnCharacterDnaUpdated { add { if (CharacterDnaUpdated == null) CharacterDnaUpdated = new UMADataEvent(); CharacterDnaUpdated.AddListener(new UnityAction<UMAData>(value)); } remove { CharacterDnaUpdated.RemoveListener(new UnityAction<UMAData>(value)); } }
public UMADataEvent CharacterCreated;
public UMADataEvent CharacterDestroyed;
public UMADataEvent CharacterUpdated;
public UMADataEvent CharacterDnaUpdated;
public GameObject umaRoot;
public UMARecipe umaRecipe;
public Animator animator;
public UMASkeleton skeleton;
/// <summary>
/// The approximate height of the character. Calculated by DNA converters.
/// </summary>
public float characterHeight = 2f;
/// <summary>
/// The approximate radius of the character. Calculated by DNA converters.
/// </summary>
public float characterRadius = 0.25f;
/// <summary>
/// The approximate mass of the character. Calculated by DNA converters.
/// </summary>
public float characterMass = 50f;
public UMAData()
{
listNode = new LinkedListNode<UMAData>(this);
}
void Awake()
{
firstBake = true;
if (!umaGenerator)
{
var generatorGO = GameObject.Find("UMAGenerator");
if (generatorGO == null) return;
umaGenerator = generatorGO.GetComponent<UMAGeneratorBase>();
}
if (umaRecipe == null)
{
umaRecipe = new UMARecipe();
}
else
{
SetupOnAwake();
}
}
public void SetupOnAwake()
{
umaRoot = gameObject;
animator = umaRoot.GetComponent<Animator>();
}
#pragma warning disable 618
/// <summary>
/// Shallow copy from another UMAData.
/// </summary>
/// <param name="other">Source UMAData.</param>
public void Assign(UMAData other)
{
animator = other.animator;
//myRenderer = other.myRenderer;
renderers = other.renderers;
umaRoot = other.umaRoot;
if (animationController == null)
{
animationController = other.animationController;
}
}
#pragma warning restore 618
public bool Validate()
{
bool valid = true;
if (umaGenerator == null)
{
Debug.LogError("UMA data missing required generator!");
valid = false;
}
if (umaRecipe == null)
{
Debug.LogError("UMA data missing required recipe!");
valid = false;
}
else
{
valid = valid && umaRecipe.Validate();
}
if (animationController == null)
{
if (Application.isPlaying)
Debug.LogWarning("No animation controller supplied.");
}
#if UNITY_EDITOR
if (!valid && UnityEditor.EditorApplication.isPlaying)
{
Debug.LogError("UMAData: Recipe or Generator is not valid!");
UnityEditor.EditorApplication.isPaused = true;
}
#endif
return valid;
}
[System.Serializable]
public class GeneratedMaterials
{
public List<GeneratedMaterial> materials = new List<GeneratedMaterial>();
public int rendererCount;
}
[System.Serializable]
public class GeneratedMaterial
{
public UMAMaterial umaMaterial;
public Material material;
public List<MaterialFragment> materialFragments = new List<MaterialFragment>();
public Texture[] resultingAtlasList;
public Vector2 cropResolution;
public float resolutionScale;
public string[] textureNameList;
public int renderer;
}
[System.Serializable]
public class MaterialFragment
{
public int size;
public Color baseColor;
public UMAMaterial umaMaterial;
public Rect[] rects;
public textureData[] overlays;
public Color32[] overlayColors;
public Color[][] channelMask;
public Color[][] channelAdditiveMask;
public SlotData slotData;
public OverlayData[] overlayData;
public Rect atlasRegion;
public bool isRectShared;
public List<OverlayData> overlayList;
public MaterialFragment rectFragment;
public textureData baseOverlay;
public Color GetMultiplier(int overlay, int textureType)
{
if (channelMask[overlay] != null && channelMask[overlay].Length > 0)
{
return channelMask[overlay][textureType];
}
else
{
if (textureType > 0) return Color.white;
if (overlay == 0) return baseColor;
return overlayColors[overlay - 1];
}
}
public Color32 GetAdditive(int overlay, int textureType)
{
if (channelAdditiveMask[overlay] != null && channelAdditiveMask[overlay].Length > 0)
{
return channelAdditiveMask[overlay][textureType];
}
else
{
return new Color32(0, 0, 0, 0);
}
}
}
public void Show()
{
for (int i = 0; i < rendererCount; i++)
GetRenderer(i).enabled = true;
}
public void Hide()
{
for (int i = 0; i < rendererCount; i++)
GetRenderer(i).enabled = false;
}
[System.Serializable]
public class textureData
{
public Texture[] textureList;
public Texture alphaTexture;
public OverlayDataAsset.OverlayType overlayType;
}
[System.Serializable]
public class resultAtlasTexture
{
public Texture[] textureList;
}
/// <summary>
/// The UMARecipe class contains the race, DNA, and color data required to build a UMA character.
/// </summary>
[System.Serializable]
public class UMARecipe
{
public RaceData raceData;
Dictionary<int, UMADnaBase> _umaDna;
protected Dictionary<int, UMADnaBase> umaDna
{
get
{
if (_umaDna == null)
{
_umaDna = new Dictionary<int, UMADnaBase>();
for (int i = 0; i < dnaValues.Count; i++)
_umaDna.Add(dnaValues[i].DNATypeHash, dnaValues[i]);
}
return _umaDna;
}
set
{
_umaDna = value;
}
}
protected Dictionary<int, DnaConverterBehaviour.DNAConvertDelegate> umaDnaConverter = new Dictionary<int, DnaConverterBehaviour.DNAConvertDelegate>();
protected Dictionary<string, int> mergedSharedColors = new Dictionary<string, int>();
public List<UMADnaBase> dnaValues = new List<UMADnaBase>();
public SlotData[] slotDataList;
public OverlayColorData[] sharedColors;
public bool Validate()
{
bool valid = true;
if (raceData == null)
{
Debug.LogError("UMA recipe missing required race!");
valid = false;
}
else
{
valid = valid && raceData.Validate();
}
if (slotDataList == null || slotDataList.Length == 0)
{
Debug.LogError("UMA recipe slot list is empty!");
valid = false;
}
int slotDataCount = 0;
for (int i = 0; i < slotDataList.Length; i++)
{
var slotData = slotDataList[i];
if (slotData != null)
{
slotDataCount++;
valid = valid && slotData.Validate();
}
}
if (slotDataCount < 1)
{
Debug.LogError("UMA recipe slot list contains only null objects!");
valid = false;
}
return valid;
}
#pragma warning disable 618
/// <summary>
/// Gets the DNA array.
/// </summary>
/// <returns>The DNA array.</returns>
public UMADnaBase[] GetAllDna()
{
if ((raceData == null) || (slotDataList == null))
{
return new UMADnaBase[0];
}
return dnaValues.ToArray();
}
/// <summary>
/// Adds the DNA specified.
/// </summary>
/// <param name="dna">DNA.</param>
public void AddDna(UMADnaBase dna)
{
umaDna.Add(dna.DNATypeHash, dna);
dnaValues.Add(dna);
}
/// <summary>
/// Get DNA of specified type.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <typeparam name="T">Type.</typeparam>
public T GetDna<T>()
where T : UMADnaBase
{
UMADnaBase dna;
if (umaDna.TryGetValue(UMAUtils.StringToHash(typeof(T).Name), out dna))
{
return dna as T;
}
return null;
}
/// <summary>
/// Removes all DNA.
/// </summary>
public void ClearDna()
{
umaDna.Clear();
dnaValues.Clear();
}
/// <summary>
/// DynamicUMADna:: a version of RemoveDna that uses the dnaTypeNameHash
/// </summary>
/// <param name="dnaTypeNameHash"></param>
public void RemoveDna(int dnaTypeNameHash)
{
dnaValues.Remove(umaDna[dnaTypeNameHash]);
umaDna.Remove(dnaTypeNameHash);
}
/// <summary>
/// Removes the specified DNA.
/// </summary>
/// <param name="type">Type.</param>
public void RemoveDna(Type type)
{
int dnaTypeNameHash = UMAUtils.StringToHash(type.Name);
dnaValues.Remove(umaDna[dnaTypeNameHash]);
umaDna.Remove(dnaTypeNameHash);
}
/// <summary>
/// Get DNA of specified type.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <param name="type">Type.</param>
public UMADnaBase GetDna(Type type)
{
UMADnaBase dna;
if (umaDna.TryGetValue(UMAUtils.StringToHash(type.Name), out dna))
{
return dna;
}
return null;
}
/// <summary>
/// Get DNA of specified type.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <param name="dnaTypeNameHash">Type.</param>
public UMADnaBase GetDna(int dnaTypeNameHash)
{
UMADnaBase dna;
if (umaDna.TryGetValue(dnaTypeNameHash, out dna))
{
return dna;
}
return null;
}
/// <summary>
/// Get DNA of specified type, adding if not found.
/// </summary>
/// <returns>The DNA.</returns>
/// <typeparam name="T">Type.</typeparam>
public T GetOrCreateDna<T>()
where T : UMADnaBase
{
T res = GetDna<T>();
if (res == null)
{
res = typeof(T).GetConstructor(System.Type.EmptyTypes).Invoke(null) as T;
umaDna.Add(res.DNATypeHash, res);
dnaValues.Add(res);
}
return res;
}
/// <summary>
/// Get DNA of specified type, adding if not found.
/// </summary>
/// <returns>The DNA.</returns>
/// <param name="type">Type.</param>
public UMADnaBase GetOrCreateDna(Type type)
{
UMADnaBase dna;
var typeNameHash = UMAUtils.StringToHash(type.Name);
if (umaDna.TryGetValue(typeNameHash, out dna))
{
return dna;
}
dna = type.GetConstructor(System.Type.EmptyTypes).Invoke(null) as UMADnaBase;
umaDna.Add(typeNameHash, dna);
dnaValues.Add(dna);
return dna;
}
/// <summary>
/// Get DNA of specified type, adding if not found.
/// </summary>
/// <returns>The DNA.</returns>
/// <param name="type">Type.</param>
public UMADnaBase GetOrCreateDna(Type type, int dnaTypeHash)
{
UMADnaBase dna;
if (umaDna.TryGetValue(dnaTypeHash, out dna))
{
return dna;
}
dna = type.GetConstructor(System.Type.EmptyTypes).Invoke(null) as UMADnaBase;
dna.DNATypeHash = dnaTypeHash;
umaDna.Add(dnaTypeHash, dna);
dnaValues.Add(dna);
return dna;
}
#pragma warning restore 618
/// <summary>
/// Sets the race.
/// </summary>
/// <param name="raceData">Race.</param>
public void SetRace(RaceData raceData)
{
this.raceData = raceData;
ClearDNAConverters();
}
/// <summary>
/// Gets the race.
/// </summary>
/// <returns>The race.</returns>
public RaceData GetRace()
{
return this.raceData;
}
/// <summary>
/// Sets the slot at a given index.
/// </summary>
/// <param name="index">Index.</param>
/// <param name="slot">Slot.</param>
public void SetSlot(int index, SlotData slot)
{
if (slotDataList == null)
{
slotDataList = new SlotData[1];
}
if (index >= slotDataList.Length)
{
System.Array.Resize<SlotData>(ref slotDataList, index + 1);
}
slotDataList[index] = slot;
}
/// <summary>
/// Sets the entire slot array.
/// </summary>
/// <param name="slots">Slots.</param>
public void SetSlots(SlotData[] slots)
{
slotDataList = slots;
}
/// <summary>
/// Combine additional slot with current data.
/// </summary>
/// <param name="slot">Slot.</param>
/// <param name="dontSerialize">If set to <c>true</c> slot will not be serialized.</param>
public SlotData MergeSlot(SlotData slot, bool dontSerialize)
{
if ((slot == null) || (slot.asset == null))
return null;
int overlayCount = 0;
for (int i = 0; i < slotDataList.Length; i++)
{
if (slotDataList[i] == null)
continue;
if (slot.asset == slotDataList[i].asset)
{
SlotData originalSlot = slotDataList[i];
overlayCount = slot.OverlayCount;
for (int j = 0; j < overlayCount; j++)
{
OverlayData overlay = slot.GetOverlay(j);
//DynamicCharacterSystem:: Needs to use alternative methods that find equivalent overlays since they may not be Equal if they were in an assetBundle
OverlayData originalOverlay = originalSlot.GetEquivalentUsedOverlay(overlay);
if (originalOverlay != null)
{
originalOverlay.CopyColors(overlay);//also copies textures
if (overlay.colorData.HasName())
{
int sharedIndex;
if (mergedSharedColors.TryGetValue(overlay.colorData.name, out sharedIndex))
{
originalOverlay.colorData = sharedColors[sharedIndex];
}
}
}
else
{
OverlayData overlayCopy = overlay.Duplicate();
if (overlayCopy.colorData.HasName())
{
int sharedIndex;
if (mergedSharedColors.TryGetValue(overlayCopy.colorData.name, out sharedIndex))
{
overlayCopy.colorData = sharedColors[sharedIndex];
}
}
originalSlot.AddOverlay(overlayCopy);
}
}
originalSlot.dontSerialize = dontSerialize;
return originalSlot;
}
}
int insertIndex = slotDataList.Length;
System.Array.Resize<SlotData>(ref slotDataList, slotDataList.Length + 1);
SlotData slotCopy = slot.Copy();
slotCopy.dontSerialize = dontSerialize;
overlayCount = slotCopy.OverlayCount;
for (int j = 0; j < overlayCount; j++)
{
OverlayData overlay = slotCopy.GetOverlay(j);
if (overlay.colorData.HasName())
{
int sharedIndex;
if (mergedSharedColors.TryGetValue(overlay.colorData.name, out sharedIndex))
{
overlay.colorData = sharedColors[sharedIndex];
}
}
}
slotDataList[insertIndex] = slotCopy;
MergeMatchingOverlays();
return slotCopy;
}
/// <summary>
/// Gets a slot by index.
/// </summary>
/// <returns>The slot.</returns>
/// <param name="index">Index.</param>
public SlotData GetSlot(int index)
{
if (index < slotDataList.Length)
return slotDataList[index];
return null;
}
/// <summary>
/// Gets the complete array of slots.
/// </summary>
/// <returns>The slot array.</returns>
public SlotData[] GetAllSlots()
{
return slotDataList;
}
/// <summary>
/// Gets the number of slots.
/// </summary>
/// <returns>The slot array size.</returns>
public int GetSlotArraySize()
{
return slotDataList.Length;
}
/// <summary>
/// Are two overlay lists the same?
/// </summary>
/// <returns><c>true</c>, if lists match, <c>false</c> otherwise.</returns>
/// <param name="list1">List1.</param>
/// <param name="list2">List2.</param>
public static bool OverlayListsMatch(List<OverlayData> list1, List<OverlayData> list2)
{
if ((list1 == null) || (list2 == null))
return false;
if ((list1.Count == 0) || (list1.Count != list2.Count))
return false;
for (int i = 0; i < list1.Count; i++)
{
OverlayData overlay1 = list1[i];
if (!(overlay1))
continue;
bool found = false;
for (int j = 0; j < list2.Count; j++)
{
OverlayData overlay2 = list2[i];
if (!(overlay2))
continue;
if (OverlayData.Equivalent(overlay1, overlay2))
{
found = true;
break;
}
}
if (!found)
return false;
}
return true;
}
/// <summary>
/// Ensures slots with matching overlays will share the same references.
/// </summary>
public void MergeMatchingOverlays()
{
for (int i = 0; i < slotDataList.Length; i++)
{
if (slotDataList[i] == null)
continue;
List<OverlayData> slotOverlays = slotDataList[i].GetOverlayList();
for (int j = i + 1; j < slotDataList.Length; j++)
{
if (slotDataList[j] == null)
continue;
List<OverlayData> slot2Overlays = slotDataList[j].GetOverlayList();
if (OverlayListsMatch(slotOverlays, slot2Overlays))
{
slotDataList[j].SetOverlayList(slotOverlays);
}
}
}
}
#pragma warning disable 618
/// <summary>
/// Applies each DNA converter to the UMA data and skeleton.
/// </summary>
/// <param name="umaData">UMA data.</param>
public void ApplyDNA(UMAData umaData, bool fixUpUMADnaToDynamicUMADna = false)
{
EnsureAllDNAPresent();
//DynamicUMADna:: when loading an older recipe that has UMADnaHumanoid/Tutorial into a race that now uses DynamicUmaDna the following wont work
//so check that and fix it if it happens
if (fixUpUMADnaToDynamicUMADna)
DynamicDNAConverterBehaviourBase.FixUpUMADnaToDynamicUMADna(this);
foreach (var dnaEntry in umaDna)
{
DnaConverterBehaviour.DNAConvertDelegate dnaConverter;
if (umaDnaConverter.TryGetValue(dnaEntry.Key, out dnaConverter))
{
dnaConverter(umaData, umaData.GetSkeleton());
}
else
{
//DynamicUMADna:: try again this time calling FixUpUMADnaToDynamicUMADna first
if (fixUpUMADnaToDynamicUMADna == false)
{
ApplyDNA(umaData, true);
break;
}
else
{
Debug.LogWarning("Cannot apply dna: " + dnaEntry.Value.GetType().Name + " using key " + dnaEntry.Key);
}
}
}
}
/// <summary>
/// Ensures all DNA convertes from slot and race data are defined.
/// </summary>
public void EnsureAllDNAPresent()
{
List<int> requiredDnas = new List<int>();
if (raceData != null)
{
foreach (var converter in raceData.dnaConverterList)
{
var dnaTypeHash = converter.DNATypeHash;
//'old' dna converters return a typehash based on the type name.
//Dynamic DNA Converters return the typehash of their dna asset or 0 if none is assigned- we dont want to include those
if (dnaTypeHash == 0)
continue;
requiredDnas.Add(dnaTypeHash);
if (!umaDna.ContainsKey(dnaTypeHash))
{
var dna = converter.DNAType.GetConstructor(System.Type.EmptyTypes).Invoke(null) as UMADnaBase;
dna.DNATypeHash = dnaTypeHash;
//DynamicUMADna:: needs the DNAasset from the converter - moved because this might change
if (converter is DynamicDNAConverterBehaviourBase)
{
((DynamicUMADnaBase)dna).dnaAsset = ((DynamicDNAConverterBehaviourBase)converter).dnaAsset;
}
umaDna.Add(dnaTypeHash, dna);
dnaValues.Add(dna);
}
else if (converter is DynamicDNAConverterBehaviourBase)
{
var dna = umaDna[dnaTypeHash];
((DynamicUMADnaBase)dna).dnaAsset = ((DynamicDNAConverterBehaviourBase)converter).dnaAsset;
}
}
}
foreach (var slotData in slotDataList)
{
if (slotData != null && slotData.asset.slotDNA != null)
{
var dnaTypeHash = slotData.asset.slotDNA.DNATypeHash;
//'old' dna converters return a typehash based on the type name.
//Dynamic DNA Converters return the typehash of their dna asset or 0 if none is assigned- we dont want to include those
if (dnaTypeHash == 0)
continue;
requiredDnas.Add(dnaTypeHash);
if (!umaDna.ContainsKey(dnaTypeHash))
{
var dna = slotData.asset.slotDNA.DNAType.GetConstructor(System.Type.EmptyTypes).Invoke(null) as UMADnaBase;
dna.DNATypeHash = dnaTypeHash;
//DynamicUMADna:: needs the DNAasset from the converter TODO are there other places where I heed to sort out this slotDNA?
if (slotData.asset.slotDNA is DynamicDNAConverterBehaviourBase)
{
((DynamicUMADnaBase)dna).dnaAsset = ((DynamicDNAConverterBehaviourBase)slotData.asset.slotDNA).dnaAsset;
}
umaDna.Add(dnaTypeHash, dna);
dnaValues.Add(dna);
}
else if (slotData.asset.slotDNA is DynamicDNAConverterBehaviourBase)
{
var dna = umaDna[dnaTypeHash];
((DynamicUMADnaBase)dna).dnaAsset = ((DynamicDNAConverterBehaviourBase)slotData.asset.slotDNA).dnaAsset;
}
}
}
foreach (int addedDNAHash in umaDnaConverter.Keys)
{
requiredDnas.Add(addedDNAHash);
}
//now remove any we no longer need
var keysToRemove = new List<int>();
foreach(var kvp in umaDna)
{
if (!requiredDnas.Contains(kvp.Key))
keysToRemove.Add(kvp.Key);
}
for(int i = 0; i < keysToRemove.Count; i++)
{
RemoveDna(keysToRemove[i]);
}
}
#pragma warning restore 618
/// <summary>
/// Resets the DNA converters to those defined in the race.
/// </summary>
public void ClearDNAConverters()
{
umaDnaConverter.Clear();
if (raceData != null)
{
foreach (var converter in raceData.dnaConverterList)
{
if(converter == null)
{
Debug.LogWarning("RaceData " + raceData.raceName + " has a missing DNAConverter");
continue;
}
//'old' dna converters return a typehash based on the type name.
//Dynamic DNA Converters return the typehash of their dna asset or 0 if none is assigned- we dont want to include those
if (converter.DNATypeHash == 0)
continue;
if (!umaDnaConverter.ContainsKey(converter.DNATypeHash))
{
umaDnaConverter.Add(converter.DNATypeHash, converter.ApplyDnaAction);
}
else
{
//We MUST NOT give DynamicDNA the same hash a UMADnaHumanoid or else we loose the values
Debug.Log(raceData.raceName + " has multiple dna converters that are trying to use the same dna (" + converter.DNATypeHash + "). This is not allowed.");
}
}
}
}
/// <summary>
/// Adds a DNA converter.
/// </summary>
/// <param name="dnaConverter">DNA converter.</param>
public void AddDNAUpdater(DnaConverterBehaviour dnaConverter)
{
if (dnaConverter == null) return;
//DynamicDNAConverter:: We need to SET these values using the TypeHash since
//just getting the hash of the DNAType will set the same value for all instance of a DynamicDNAConverter
if (!umaDnaConverter.ContainsKey(dnaConverter.DNATypeHash))
{
umaDnaConverter.Add(dnaConverter.DNATypeHash, dnaConverter.ApplyDnaAction);
}
else
{
Debug.Log(raceData.raceName + " has multiple dna converters that are trying to use the same dna ("+ dnaConverter.DNATypeHash+"). This is not allowed.");
}
}
/// <summary>
/// Shallow copy of UMARecipe.
/// </summary>
public UMARecipe Mirror()
{
var newRecipe = new UMARecipe();
newRecipe.raceData = raceData;
newRecipe.umaDna = umaDna;
newRecipe.dnaValues = dnaValues;
newRecipe.slotDataList = slotDataList;
return newRecipe;
}
/// <summary>
/// Combine additional recipe with current data.
/// </summary>
/// <param name="recipe">Recipe.</param>
/// <param name="dontSerialize">If set to <c>true</c> recipe will not be serialized.</param>
public void Merge(UMARecipe recipe, bool dontSerialize)
{
if (recipe == null)
return;
if ((recipe.raceData != null) && (recipe.raceData != raceData))
{
Debug.LogWarning("Merging recipe with conflicting race data: " + recipe.raceData.name);
}
foreach (var dnaEntry in recipe.umaDna)
{
var destDNA = GetOrCreateDna(dnaEntry.Value.GetType(), dnaEntry.Key);
destDNA.Values = dnaEntry.Value.Values;
}
mergedSharedColors.Clear();
if (sharedColors == null)
sharedColors = new OverlayColorData[0];
if (recipe.sharedColors != null)
{
for (int i = 0; i < sharedColors.Length; i++)
{
if (sharedColors[i] != null && sharedColors[i].HasName())
{
while (mergedSharedColors.ContainsKey(sharedColors[i].name))
{
sharedColors[i].name = sharedColors[i].name + ".";
}
mergedSharedColors.Add(sharedColors[i].name, i);
}
}
for (int i = 0; i < recipe.sharedColors.Length; i++)
{
OverlayColorData sharedColor = recipe.sharedColors[i];
if (sharedColor != null && sharedColor.HasName())
{
int sharedIndex;
if (!mergedSharedColors.TryGetValue(sharedColor.name, out sharedIndex))
{
int index = sharedColors.Length;
mergedSharedColors.Add(sharedColor.name, index);
Array.Resize<OverlayColorData>(ref sharedColors, index + 1);
sharedColors[index] = sharedColor.Duplicate();
}
}
}
}
if (slotDataList == null)
slotDataList = new SlotData[0];
if (recipe.slotDataList != null)
{
for (int i = 0; i < recipe.slotDataList.Length; i++)
{
MergeSlot(recipe.slotDataList[i], dontSerialize);
}
}
}
}
[System.Serializable]
public class BoneData
{
public Transform boneTransform;
public Vector3 originalBoneScale;
public Vector3 originalBonePosition;
public Quaternion originalBoneRotation;
}
/// <summary>
/// Calls character updated and/or created events.
/// </summary>
public void FireUpdatedEvent(bool cancelled)
{
this.cancelled = cancelled;
if (!this.cancelled && !isOfficiallyCreated)
{
isOfficiallyCreated = true;
if (CharacterCreated != null)
{
CharacterCreated.Invoke(this);
}
}
if (CharacterUpdated != null)
{
CharacterUpdated.Invoke(this);
}
dirty = false;
}
public void ApplyDNA()
{
umaRecipe.ApplyDNA(this);
}
public virtual void Dirty()
{
if (dirty) return;
dirty = true;
if (!umaGenerator)
{
umaGenerator = GameObject.Find("UMAGenerator").GetComponent<UMAGeneratorBase>();
}
if (umaGenerator)
{
umaGenerator.addDirtyUMA(this);
}
}
void OnDestroy()
{
if (isOfficiallyCreated)
{
if (CharacterDestroyed != null)
{
CharacterDestroyed.Invoke(this);
}
isOfficiallyCreated = false;
}
if (umaRoot != null)
{
CleanTextures();
CleanMesh(true);
CleanAvatar();
UMAUtils.DestroySceneObject(umaRoot);
}
}
/// <summary>
/// Destory Mecanim avatar and animator.
/// </summary>
public void CleanAvatar()
{
animationController = null;
if (animator != null)
{
if (animator.avatar) UMAUtils.DestroySceneObject(animator.avatar);
if (animator) UMAUtils.DestroySceneObject(animator);
}
}
/// <summary>
/// Destroy textures used to render mesh.
/// </summary>
public void CleanTextures()
{
for (int atlasIndex = 0; atlasIndex < generatedMaterials.materials.Count; atlasIndex++)
{
if (generatedMaterials.materials[atlasIndex] != null && generatedMaterials.materials[atlasIndex].resultingAtlasList != null)
{
for (int textureIndex = 0; textureIndex < generatedMaterials.materials[atlasIndex].resultingAtlasList.Length; textureIndex++)
{
if (generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] != null)
{
Texture tempTexture = generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex];
if (tempTexture is RenderTexture)
{
RenderTexture tempRenderTexture = tempTexture as RenderTexture;
tempRenderTexture.Release();
UMAUtils.DestroySceneObject(tempRenderTexture);
}
else
{
UMAUtils.DestroySceneObject(tempTexture);
}
generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] = null;
}
}
}
}
}
/// <summary>
/// Destroy materials used to render mesh.
/// </summary>
/// <param name="destroyRenderer">If set to <c>true</c> destroy mesh renderer.</param>
public void CleanMesh(bool destroyRenderer)
{
for(int j = 0; j < rendererCount; j++)
{
var renderer = GetRenderer(j);
var mats = renderer.sharedMaterials;
for (int i = 0; i < mats.Length; i++)
{
if (mats[i])
{
UMAUtils.DestroySceneObject(mats[i]);
}
}
if (destroyRenderer)
{
UMAUtils.DestroySceneObject(renderer.sharedMesh);
UMAUtils.DestroySceneObject(renderer);
}
}
}
public Texture[] backUpTextures()
{
List<Texture> textureList = new List<Texture>();
for (int atlasIndex = 0; atlasIndex < generatedMaterials.materials.Count; atlasIndex++)
{
if (generatedMaterials.materials[atlasIndex] != null && generatedMaterials.materials[atlasIndex].resultingAtlasList != null)
{
for (int textureIndex = 0; textureIndex < generatedMaterials.materials[atlasIndex].resultingAtlasList.Length; textureIndex++)
{
if (generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] != null)
{
Texture tempTexture = generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex];
textureList.Add(tempTexture);
generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] = null;
}
}
}
}
return textureList.ToArray();
}
public RenderTexture GetFirstRenderTexture()
{
for (int atlasIndex = 0; atlasIndex < generatedMaterials.materials.Count; atlasIndex++)
{
if (generatedMaterials.materials[atlasIndex] != null && generatedMaterials.materials[atlasIndex].resultingAtlasList != null)
{
for (int textureIndex = 0; textureIndex < generatedMaterials.materials[atlasIndex].resultingAtlasList.Length; textureIndex++)
{
if (generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] != null)
{
RenderTexture tempTexture = generatedMaterials.materials[atlasIndex].resultingAtlasList[textureIndex] as RenderTexture;
if (tempTexture != null)
{
return tempTexture;
}
}
}
}
}
return null;
}
/// <summary>
/// Gets the game object for a bone by name.
/// </summary>
/// <returns>The game object (or null if hash not in skeleton).</returns>
/// <param name="boneName">Bone name.</param>
public GameObject GetBoneGameObject(string boneName)
{
return GetBoneGameObject(UMAUtils.StringToHash(boneName));
}
/// <summary>
/// Gets the game object for a bone by name hash.
/// </summary>
/// <returns>The game object (or null if hash not in skeleton).</returns>
/// <param name="boneHash">Bone name hash.</param>
public GameObject GetBoneGameObject(int boneHash)
{
return skeleton.GetBoneGameObject(boneHash);
}
/// <summary>
/// Gets the complete DNA array.
/// </summary>
/// <returns>The DNA array.</returns>
public UMADnaBase[] GetAllDna()
{
return umaRecipe.GetAllDna();
}
/// <summary>
/// DynamicUMADna:: Retrieve DNA by dnaTypeNameHash.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <param name="dnaTypeNameHash">dnaTypeNameHash.</param>
public UMADnaBase GetDna(int dnaTypeNameHash)
{
return umaRecipe.GetDna(dnaTypeNameHash);
}
/// <summary>
/// Retrieve DNA by type.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <param name="type">Type.</param>
public UMADnaBase GetDna(Type type)
{
return umaRecipe.GetDna(type);
}
/// <summary>
/// Retrieve DNA by type.
/// </summary>
/// <returns>The DNA (or null if not found).</returns>
/// <typeparam name="T">The type od DNA requested.</typeparam>
public T GetDna<T>()
where T : UMADnaBase
{
return umaRecipe.GetDna<T>();
}
/// <summary>
/// Marks portions of the UMAData as modified.
/// </summary>
/// <param name="dnaDirty">If set to <c>true</c> DNA has changed.</param>
/// <param name="textureDirty">If set to <c>true</c> texture has changed.</param>
/// <param name="meshDirty">If set to <c>true</c> mesh has changed.</param>
public void Dirty(bool dnaDirty, bool textureDirty, bool meshDirty)
{
isShapeDirty |= dnaDirty;
isTextureDirty |= textureDirty;
isMeshDirty |= meshDirty;
Dirty();
}
/// <summary>
/// Sets the slot at a given index.
/// </summary>
/// <param name="index">Index.</param>
/// <param name="slot">Slot.</param>
public void SetSlot(int index, SlotData slot)
{
umaRecipe.SetSlot(index, slot);
}
/// <summary>
/// Sets the entire slot array.
/// </summary>
/// <param name="slots">Slots.</param>
public void SetSlots(SlotData[] slots)
{
umaRecipe.SetSlots(slots);
}
/// <summary>
/// Gets a slot by index.
/// </summary>
/// <returns>The slot.</returns>
/// <param name="index">Index.</param>
public SlotData GetSlot(int index)
{
return umaRecipe.GetSlot(index);
}
/// <summary>
/// Gets the number of slots.
/// </summary>
/// <returns>The slot array size.</returns>
public int GetSlotArraySize()
{
return umaRecipe.GetSlotArraySize();
}
/// <summary>
/// Gets the skeleton.
/// </summary>
/// <returns>The skeleton.</returns>
public UMASkeleton GetSkeleton()
{
return skeleton;
}
/// <summary>
/// Align skeleton to the TPose.
/// </summary>
public void GotoTPose()
{
if ((umaRecipe.raceData != null) && (umaRecipe.raceData.TPose != null))
{
var tpose = umaRecipe.raceData.TPose;
tpose.DeSerialize();
for (int i = 0; i < tpose.boneInfo.Length; i++)
{
var bone = tpose.boneInfo[i];
var hash = UMAUtils.StringToHash(bone.name);
if (!skeleton.HasBone(hash)) continue;
skeleton.Set(hash, bone.position, bone.scale, bone.rotation);
}
}
}
public int[] GetAnimatedBones()
{
var res = new int[animatedBonesTable.Count];
foreach (var entry in animatedBonesTable)
{
res[entry.Value] = entry.Key;
}
return res;
}
/// <summary>
/// Calls character begun events on slots.
/// </summary>
public void FireCharacterBegunEvents()
{
foreach (var slotData in umaRecipe.slotDataList)
{
if (slotData != null && slotData.asset.CharacterBegun != null)
{
slotData.asset.CharacterBegun.Invoke(this);
}
}
}
/// <summary>
/// Calls DNA applied events on slots.
/// </summary>
public void FireDNAAppliedEvents()
{
if (CharacterDnaUpdated != null)
{
CharacterDnaUpdated.Invoke(this);
}
foreach (var slotData in umaRecipe.slotDataList)
{
if (slotData != null && slotData.asset.DNAApplied != null)
{
slotData.asset.DNAApplied.Invoke(this);
}
}
}
/// <summary>
/// Calls character completed events on slots.
/// </summary>
public void FireCharacterCompletedEvents()
{
foreach (var slotData in umaRecipe.slotDataList)
{
if (slotData != null && slotData.asset.CharacterCompleted != null)
{
slotData.asset.CharacterCompleted.Invoke(this);
}
}
}
/// <summary>
/// Adds additional, non serialized, recipes.
/// </summary>
/// <param name="umaAdditionalRecipes">Additional recipes.</param>
/// <param name="context">Context.</param>
public void AddAdditionalRecipes(UMARecipeBase[] umaAdditionalRecipes, UMAContext context)
{
if (umaAdditionalRecipes != null)
{
foreach (var umaAdditionalRecipe in umaAdditionalRecipes)
{
UMARecipe cachedRecipe = umaAdditionalRecipe.GetCachedRecipe(context);
umaRecipe.Merge(cachedRecipe, true);
}
}
}
#region BlendShape Support
public class BlendShapeSettings
{
public bool ignoreBlendShapes; //default false
public Dictionary<string,float> bakeBlendShapes;
public BlendShapeSettings()
{
ignoreBlendShapes = false;
bakeBlendShapes = new Dictionary<string, float>();
}
}
//For future multiple renderer support
public struct BlendShapeLocation
{
public int shapeIndex;
public int rendererIndex;
}
/// <summary>
/// Sets the blendshape by index and renderer.
/// </summary>
/// <param name="shapeIndex">Name of the blendshape.</param>
/// <param name="weight">Weight(float) to set this blendshape to.</param>
/// <param name="rIndex">index (default first) of the renderer this blendshape is on.</param>
public void SetBlendShape(int shapeIndex, float weight, int rIndex = 0)
{
if (rIndex >= rendererCount) //for multi-renderer support
{
Debug.LogError ("SetBlendShape: This renderer doesn't exist!");
return;
}
if (shapeIndex < 0)
{
Debug.LogError ("SetBlendShape: Index is less than zero!");
return;
}
if (shapeIndex >= renderers [rIndex].sharedMesh.blendShapeCount) //for multi-renderer support
{
Debug.LogError ("SetBlendShape: Index is greater than blendShapeCount!");
return;
}
if (weight < 0.0f || weight > 1.0f)
Debug.LogError ("SetBlendShape: Weight is out of range, clamping...");
weight = Mathf.Clamp01 (weight);
weight *= 100.0f; //Scale up to 1-100 for SetBlendShapeWeight.
renderers [rIndex].SetBlendShapeWeight (shapeIndex, weight);//for multi-renderer support
}
/// <summary>
/// Set the blendshape by it's name.
/// </summary>
/// <param name="name">Name of the blendshape.</param
/// <param name="weight">Weight(float) to set this blendshape to.</param>
public void SetBlendShape(string name, float weight)
{
BlendShapeLocation loc = GetBlendShapeIndex (name);
if (loc.shapeIndex < 0)
return;
if (weight < 0.0f || weight > 1.0f)
Debug.LogError ("SetBlendShape: Weight is out of range, clamping...");
weight = Mathf.Clamp01 (weight);
weight *= 100.0f; //Scale up to 1-100 for SetBlendShapeWeight.
renderers [loc.rendererIndex].SetBlendShapeWeight (loc.shapeIndex, weight);//for multi-renderer support
}
/// <summary>
/// Gets the first found index of the blendshape by name in the renderers
/// </summary>
/// <param name="name">Name of the blendshape.</param>
public BlendShapeLocation GetBlendShapeIndex(string name)
{
BlendShapeLocation loc = new BlendShapeLocation ();
loc.shapeIndex = -1;
loc.rendererIndex = -1;
for (int i = 0; i < rendererCount; i++) //for multi-renderer support
{
int index = renderers [i].sharedMesh.GetBlendShapeIndex (name);
if (index >= 0)
{
loc.shapeIndex = index;
loc.rendererIndex = i;
return loc;
}
}
//Debug.LogError ("GetBlendShapeIndex: blendshape " + name + " not found!");
return loc;
}
/// <summary>
/// Gets the name of the blendshape by index and renderer
/// </summary>
/// <param name="shapeIndex">Index of the blendshape.</param>
/// <param name="rendererIndex">Index of the renderer (default = 0).</param>
public string GetBlendShapeName(int shapeIndex, int rendererIndex = 0)
{
if (shapeIndex < 0)
{
Debug.LogError ("GetBlendShapeName: Index is less than zero!");
return "";
}
if (rendererIndex >= rendererCount) //for multi-renderer support
{
Debug.LogError ("GetBlendShapeName: This renderer doesn't exist!");
return "";
}
//for multi-renderer support
if( shapeIndex < renderers [rendererIndex].sharedMesh.blendShapeCount )
return renderers [rendererIndex].sharedMesh.GetBlendShapeName (shapeIndex);
Debug.LogError ("GetBlendShapeName: no blendshape at index " + shapeIndex + "!");
return "";
}
#endregion
}
}
| 28.027114 | 285 | 0.65062 | [
"Apache-2.0"
] | stonedbastardstudios/FLUX-ONLINE-ACTIVE | Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs | 43,414 | C# |
#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5F1C5EBC87E587923A1A199E8D21F00F"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using Demo_CircleFitter;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
namespace Demo_CircleFitter {
/// <summary>
/// MainWindow
/// </summary>
public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/Demo_CircleFitter;component/mainwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\MainWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
this._contentLoaded = true;
}
}
}
| 37.776316 | 141 | 0.66597 | [
"MIT"
] | M-Coast/MathGraph | Demo_CircleFitter/obj/Debug/MainWindow.g.cs | 2,979 | C# |
using HarmonyLib;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;
using Verse.AI;
using System.Reflection;
using UnityEngine;
using Verse.AI.Group;
namespace RimQuest
{
[StaticConstructorOnStartup]
public static class HarmonyPatches
{
static HarmonyPatches()
{
var harmony = new Harmony("rimworld.rimquest");
//harmony.Patch(AccessTools.Method(typeof(PawnUIOverlay), "DrawPawnGUIOverlay"),
// null, new HarmonyMethod(typeof(HarmonyPatches), nameof(DrawPawnGUIOverlay)));
harmony.Patch(AccessTools.Method(typeof(PawnRenderer), "RenderPawnAt", new []{typeof(Vector3), typeof(RotDrawMode), typeof(bool), typeof(bool)}),
null, new HarmonyMethod(typeof(HarmonyPatches), nameof(RenderPawnAt)));
harmony.Patch(AccessTools.Method(typeof(IncidentWorker_VisitorGroup), "TryConvertOnePawnToSmallTrader"),
null, new HarmonyMethod(typeof(HarmonyPatches), nameof(AddQuestGiver)));
harmony.Patch(AccessTools.Method(typeof(PawnGroupKindWorker_Trader), "GenerateGuards"),
null, new HarmonyMethod(typeof(HarmonyPatches), nameof(AddQuestGiverTwo)));
harmony.Patch(AccessTools.Method(typeof(FloatMenuMakerMap), "AddHumanlikeOrders"),
null, new HarmonyMethod(typeof(HarmonyPatches), nameof(AddHumanlikeOrders)));
harmony.Patch(AccessTools.Method(typeof(IncidentWorker_NeutralGroup), "SpawnPawns"),
null, new HarmonyMethod(typeof(HarmonyPatches), nameof(AddQuestGiverThree)));
}
public static void RenderPawnAt(PawnRenderer __instance, Pawn ___pawn, Vector3 drawLoc, RotDrawMode bodyDrawType, bool headStump, bool invisible)
{
if (___pawn.GetQuestPawn() != null)
{
RenderExclamationPointOverlay(___pawn);
}
}
//PawnGroupKindWorker_Trader
public static void AddQuestGiverTwo(PawnGroupMakerParms parms, PawnGroupMaker groupMaker, Pawn trader,
List<Thing> wares, List<Pawn> outPawns)
{
LongEventHandler.QueueLongEvent(() =>
{
var pawn = outPawns.FirstOrDefault(x => x.Spawned);
Map map = pawn?.MapHeld;
if (map != null)
{
List<Pawn> newPawnList = map.mapPawns.AllPawnsSpawned.FindAll(x => x.Faction == pawn.Faction && !x.IsPrisoner);
var newQuestPawn = RimQuestUtility.GetNewQuestGiver(outPawns);
if (newQuestPawn?.Faction == null)
{
return;
}
var questPawns = RimQuestTracker.Instance.questPawns;
if (!questPawns.Any(x => x.pawn == newQuestPawn))
{
var questPawn = new QuestPawn(newQuestPawn);
if (questPawn != null)
{
questPawns.Add(questPawn);
}
}
}
}, "RQ_LoadingScreen".Translate(), true, null);
}
//FloatMenuMakerMap
public static void AddHumanlikeOrders(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{
foreach (var localTargetInfo4 in GenUI.TargetsAt(clickPos, ForQuest(), true))
{
var dest = localTargetInfo4;
if (!pawn.CanReach(dest, PathEndMode.OnCell, Danger.Deadly))
{
opts.Add(new FloatMenuOption("RQ_CannotQuest".Translate() + " (" + "NoPath".Translate() + ")", null));
}
else if (pawn.skills.GetSkill(SkillDefOf.Social).TotallyDisabled)
{
opts.Add(new FloatMenuOption("CannotPrioritizeWorkTypeDisabled".Translate(SkillDefOf.Social.LabelCap), null));
}
else
{
var pTarg = (Pawn)dest.Thing;
void Action4()
{
var job = new Job(RimQuestDefOf.RQ_QuestWithPawn, pTarg)
{
playerForced = true
};
pawn.jobs.TryTakeOrderedJob(job);
}
var str = string.Empty;
if (pTarg.Faction != null)
{
str = " (" + pTarg.Faction.Name + ")";
}
var label = "RQ_QuestWith".Translate(pTarg.LabelShort) + str;
var action = (Action) Action4;
var priority2 = MenuOptionPriority.InitiateSocial;
var thing = dest.Thing;
opts.Add(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(label, action, priority2, null, thing), pawn, pTarg));
}
}
}
//public class PawnUIOverlay
//public static void DrawPawnGUIOverlay(PawnUIOverlay __instance)
//{
//}
//IncidentWorker_VisitorGroup
//TryConvertOneSmallTrader
public static void AddQuestGiver(List<Pawn> pawns, Faction faction, Map map, ref bool __result)
{
if (!__result || !(pawns?.Count > 1))
{
return;
}
var newQuestPawn = RimQuestUtility.GetNewQuestGiver(pawns);
if (newQuestPawn == null || newQuestPawn?.Faction == null)
{
return;
}
var questPawns = RimQuestTracker.Instance.questPawns;
if (!questPawns.Any(x => x.pawn == newQuestPawn))
{
var questPawn = new QuestPawn(newQuestPawn);
if (questPawn != null)
{
questPawns.Add(questPawn);
}
}
}
public static void AddQuestGiverThree(IncidentParms parms, List<Pawn> __result, IncidentWorker_TravelerGroup __instance)
{
if (__result == null|| __result.Count == 0)
{
return;
}
if(__instance.def.defName != "TravelerGroup")
{
//Log.Message($"Skip Incident: {__instance.def.defName}");
return;
}
var newQuestPawn = RimQuestUtility.GetNewQuestGiver(__result);
if (newQuestPawn == null || newQuestPawn?.Faction == null)
{
return;
}
var questPawns = RimQuestTracker.Instance.questPawns;
if (!questPawns.Any(x => x.pawn == newQuestPawn))
{
var questPawn = new QuestPawn(newQuestPawn);
if (questPawn != null)
{
questPawns.Add(questPawn);
}
}
}
private static TargetingParameters ForQuest()
{
var targetingParameters = new TargetingParameters
{
canTargetPawns = true,
canTargetBuildings = false,
mapObjectTargetsMustBeAutoAttackable = false,
validator = x =>
x.Thing is Pawn pawn &&
pawn.GetQuestPawn() != null
};
return targetingParameters;
}
private static void RenderExclamationPointOverlay(Thing t)
{
if (!t.Spawned)
{
return;
}
var drawPos = t.DrawPos;
drawPos.y = Altitudes.AltitudeFor(AltitudeLayer.MetaOverlays) + 0.28125f;
if (t is Pawn)
{
drawPos.x += t.def.size.x - 0.52f;
drawPos.z += t.def.size.z - 0.45f;
}
RenderPulsingOverlayQuest(t, HarmonyPatches.ExclamationPointMat, drawPos, MeshPool.plane05);
}
private static readonly Material ExclamationPointMat =
MaterialPool.MatFrom("UI/Overlays/RQ_ExclamationPoint", ShaderDatabase.MetaOverlay);
private static void RenderPulsingOverlayQuest(Thing thing, Material mat, Vector3 drawPos, Mesh mesh)
{
var num = (Time.realtimeSinceStartup + (397f * (thing.thingIDNumber % 571))) * 4f;
var num2 = ((float)Math.Sin(num) + 1f) * 0.5f;
num2 = 0.3f + (num2 * 0.7f);
var material = FadedMaterialPool.FadedVersionOf(mat, num2);
Graphics.DrawMesh(mesh, drawPos, Quaternion.identity, material, 0);
}
}
}
| 38.078261 | 157 | 0.534483 | [
"MIT"
] | Taranchuk/RimQuest | Source/RimQuest/HarmonyRimQuest.cs | 8,760 | C# |
using ChatCore.Interfaces;
using ChatCore.Models.Twitch;
using ChatCore.Models.BiliBili;
using SongRequestManagerV2.Configuration;
using SongRequestManagerV2.Interfaces;
using SongRequestManagerV2.SimpleJSON;
using SongRequestManagerV2.Statics;
using System;
using System.IO;
using System.Linq;
namespace SongRequestManagerV2.Utils
{
public static class Utility
{
public static void EmptyDirectory(string directory, bool delete = true)
{
if (Directory.Exists(directory)) {
var directoryInfo = new DirectoryInfo(directory);
foreach (var file in directoryInfo.GetFiles())
file.Delete();
foreach (var subDirectory in directoryInfo.GetDirectories())
subDirectory.Delete(true);
if (delete)
Directory.Delete(directory);
}
}
public static TimeSpan GetFileAgeDifference(string filename)
{
var lastModified = File.GetLastWriteTime(filename);
return DateTime.Now - lastModified;
}
public static bool HasRights(ISRMCommand botcmd, IChatUser user, CmdFlags flags)
{
if (flags.HasFlag(CmdFlags.Local))
return true;
if (botcmd.Flags.HasFlag(CmdFlags.Disabled))
return false;
if (botcmd.Flags.HasFlag(CmdFlags.Everyone))
return true; // Not sure if this is the best approach actually, not worth thinking about right now
if (user.IsModerator & RequestBotConfig.Instance.ModFullRights)
return true;
if (user.IsBroadcaster & botcmd.Flags.HasFlag(CmdFlags.Broadcaster))
return true;
if (user.IsModerator & botcmd.Flags.HasFlag(CmdFlags.Mod))
return true;
if ((user is TwitchUser twitchUser && twitchUser.IsSubscriber & botcmd.Flags.HasFlag(CmdFlags.Sub)) || (user is BiliBiliChatUser biliBiliChatUser && biliBiliChatUser.IsFan & botcmd.Flags.HasFlag(CmdFlags.Sub)))
return true;
if ((user is TwitchUser twitchUser1 && twitchUser1.IsVip & botcmd.Flags.HasFlag(CmdFlags.VIP)) || (user is BiliBiliChatUser biliBiliChatUser1 && biliBiliChatUser1.GuardLevel > 0 & botcmd.Flags.HasFlag(CmdFlags.VIP)))
return true;
return false;
}
public static string GetStarRating(JSONObject song, bool mode = true)
{
if (!mode)
return "";
var version = song["versions"].AsArray.Children.FirstOrDefault(x => x["state"].Value == MapStatus.Published.ToString());
if (version == null) {
return "";
}
var maxstar = 0f;
foreach (var diff in version["diffs"].AsArray.Children) {
if (maxstar < diff["stars"].AsFloat) {
maxstar = diff["stars"].AsFloat;
}
}
var stars = "******";
var rating = maxstar;
if (rating < 0 || rating > 100)
rating = 0;
var starrating = stars.Substring(0, (int)(rating / 17)); // 17 is used to produce a 5 star rating from 80ish to 100.
return starrating;
}
public static string GetRating(JSONObject song, bool mode = true)
{
if (!mode)
return "";
var rating = song["stats"]["score"].AsFloat * 100f;
if (rating == 0)
return "";
return $"{rating:0.0}%";
}
}
}
| 39.648352 | 228 | 0.579268 | [
"MIT"
] | baoziii/SongRequestManagerV2 | SongRequestManagerV2/Utils/Utility.cs | 3,610 | C# |
using DDD.DomainLayer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using PackagesManagementDB.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace PackagesManagementDB.Extensions
{
public static class DBExtensions
{
public static IServiceCollection AddDbLayer(this IServiceCollection services,
string connectionString)
{
services.AddDbContext<MainDbContext>(options =>
options.UseSqlServer(connectionString, b => b.MigrationsAssembly("PackagesManagementDB")));
services.AddIdentity<IdentityUser<int>, IdentityRole<int>>()
.AddEntityFrameworkStores<MainDbContext>()
.AddDefaultTokenProviders();
services.AddAllRepositories(typeof(DBExtensions).Assembly);
return services;
}
public static async Task Seed(this MainDbContext context, IServiceScope serviceScope)
{
await context.Database.MigrateAsync();
if (!await context.Roles.AnyAsync())
{
var roleManager = serviceScope.ServiceProvider.GetService<RoleManager<IdentityRole<int>>>();
var role = new IdentityRole<int> { Name = "Admins" };
if (roleManager == null ) return;
await roleManager.CreateAsync(role);
}
if (!await context.Users.AnyAsync())
{
var userManager = serviceScope.ServiceProvider.GetService<UserManager<IdentityUser<int>>>();
if (userManager != null)
{
string user = "Admin";
string password = "_Admin_pwd1";
IdentityUser<int> currUser = null;
var result = await userManager.CreateAsync(currUser = new IdentityUser<int> { UserName = user, Email = "admin@fakedomain.com", EmailConfirmed = true }, password);
await userManager.AddToRoleAsync(currUser, "Admins");
}
}
if (!await context.Destinations.AnyAsync())
{
var firstDestination = new Destination
{
Name = "Florence",
Country = "Italy",
Packages = new List<Package>()
{
new Package
{
Name = "Summer in Florence",
StartValidityDate = new DateTime(2019, 6, 1),
EndValidityDate = new DateTime(2019, 10, 1),
DurationInDays=7,
Price=1000,
EntityVersion=1
},
new Package
{
Name = "Winter in Florence",
StartValidityDate = new DateTime(2019, 12, 1),
EndValidityDate = new DateTime(2020, 2, 1),
DurationInDays=7,
Price=500,
EntityVersion=1
}
}
};
context.Destinations.Add(firstDestination);
await context.SaveChangesAsync();
}
}
}
}
| 40.563218 | 182 | 0.503259 | [
"MIT"
] | LuohuaRain/Software-Architecture-with-C-10-and-.NET-6-3E | ch16/PackagesManagement/PackagesManagementDB/Extensions/DBExtensions.cs | 3,531 | C# |
using System;
using CoreGraphics;
using FFImageLoading;
using Steepshot.iOS.Helpers;
using UIKit;
namespace Steepshot.iOS.Views
{
public partial class ImagePreviewViewController : UIViewController
{
private UIImage _imageForPreview;
private string _imageUrl;
protected ImagePreviewViewController(IntPtr handle) : base(handle) { }
public ImagePreviewViewController(string imageUrl, UIImage ImageForPreview = null)
{
_imageUrl = imageUrl;
_imageForPreview = ImageForPreview;
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
var margin = NavigationController.NavigationBar.Frame.Height + UIApplication.SharedApplication.StatusBarFrame.Height;
var imageScrollView = new UIScrollView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - margin));
View.AddSubview(imageScrollView);
var imageView = new UIImageView(new CGRect(0, 0, imageScrollView.Frame.Width, imageScrollView.Frame.Height));
imageScrollView.MinimumZoomScale = 1f;
imageScrollView.MaximumZoomScale = 6.0f;
imageScrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
View.BackgroundColor = UIColor.White;
if (_imageForPreview != null)
imageView.Image = _imageForPreview;
else
imageView.Image = UIImage.FromBundle("ic_photo_holder");
ImageService.Instance.LoadUrl(_imageUrl, Constants.ImageCacheDuration)
.Retry(5)
.Into(imageView);
imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
imageScrollView.ContentSize = imageView.Image.Size;
imageScrollView.AddSubview(imageView);
imageScrollView.ContentSize = new CGSize(imageScrollView.Frame.Width, imageScrollView.Frame.Height);
SetBackButton();
}
private void SetBackButton()
{
NavigationItem.Title = "Photo preview";
var leftBarButton = new UIBarButtonItem(UIImage.FromBundle("ic_back_arrow"), UIBarButtonItemStyle.Plain, GoBack);
leftBarButton.TintColor = Helpers.Constants.R15G24B30;
NavigationItem.LeftBarButtonItem = leftBarButton;
}
private void GoBack(object sender, EventArgs e)
{
NavigationController.PopViewController(true);
}
}
}
| 40.5625 | 147 | 0.643297 | [
"MIT"
] | Chainers/steepshot-mobile | Sources/Steepshot/Steepshot.iOS/Views/ImagePreviewViewController.cs | 2,598 | C# |
using System.Linq;
using NUnit.Framework;
namespace ServiceStack.OrmLite.MySql.Tests
{
public class EnumTests : OrmLiteTestBase
{
[Test]
public void CanCreateTable()
{
ConnectionString.OpenDbConnection().CreateTable<TypeWithEnum>(true);
}
[Test]
public void CanStoreEnumValue()
{
using(var con = ConnectionString.OpenDbConnection())
{
con.CreateTable<TypeWithEnum>(true);
con.Save(new TypeWithEnum {Id = 1, EnumValue = SomeEnum.Value1});
}
}
[Test]
public void CanGetEnumValue()
{
using (var con = ConnectionString.OpenDbConnection())
{
con.CreateTable<TypeWithEnum>(true);
var obj = new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value1 };
con.Save(obj);
var target = con.GetById<TypeWithEnum>(obj.Id);
Assert.AreEqual(obj.Id, target.Id);
Assert.AreEqual(obj.EnumValue, target.EnumValue);
}
}
[Test]
public void CanQueryByEnumValue_using_select_with_expression()
{
using (var con = ConnectionString.OpenDbConnection())
{
con.CreateTable<TypeWithEnum>(true);
con.Save(new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value1 });
con.Save(new TypeWithEnum { Id = 2, EnumValue = SomeEnum.Value1});
con.Save(new TypeWithEnum { Id = 3, EnumValue = SomeEnum.Value2 });
var target = con.Select<TypeWithEnum>(q => q.EnumValue == SomeEnum.Value1);
Assert.AreEqual(2, target.Count());
}
}
[Test]
public void CanQueryByEnumValue_using_select_with_string()
{
using (var con = ConnectionString.OpenDbConnection())
{
con.CreateTable<TypeWithEnum>(true);
con.Save(new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value1 });
con.Save(new TypeWithEnum { Id = 2, EnumValue = SomeEnum.Value1 });
con.Save(new TypeWithEnum { Id = 3, EnumValue = SomeEnum.Value2 });
var target = con.Select<TypeWithEnum>("EnumValue = {0}", SomeEnum.Value1);
Assert.AreEqual(2, target.Count());
}
}
[Test]
public void CanQueryByEnumValue_using_where_with_AnonType()
{
using (var con = ConnectionString.OpenDbConnection())
{
con.CreateTable<TypeWithEnum>(true);
con.Save(new TypeWithEnum { Id = 1, EnumValue = SomeEnum.Value1 });
con.Save(new TypeWithEnum { Id = 2, EnumValue = SomeEnum.Value1 });
con.Save(new TypeWithEnum { Id = 3, EnumValue = SomeEnum.Value2 });
var target = con.Where<TypeWithEnum>(new { EnumValue = SomeEnum.Value1 });
Assert.AreEqual(2, target.Count());
}
}
}
public enum SomeEnum : long
{
Value1 = 2147483648,
Value2,
Value3
}
public class TypeWithEnum
{
public int Id { get; set; }
public SomeEnum EnumValue { get; set; }
}
}
| 33.02 | 91 | 0.545124 | [
"BSD-3-Clause"
] | augustoproiete-forks/ServiceStack--ServiceStack.OrmLite | src/ServiceStack.OrmLite.MySql.Tests/EnumTests.cs | 3,304 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.DocumentDB.V20160331.Outputs
{
/// <summary>
/// Cosmos DB capability object
/// </summary>
[OutputType]
public sealed class CapabilityResponse
{
/// <summary>
/// Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin".
/// </summary>
public readonly string? Name;
[OutputConstructor]
private CapabilityResponse(string? name)
{
Name = name;
}
}
}
| 27.806452 | 148 | 0.655452 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/DocumentDB/V20160331/Outputs/CapabilityResponse.cs | 862 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.Compute.V20190701.Outputs
{
[OutputType]
public sealed class GalleryImageVersionStorageProfileResponse
{
/// <summary>
/// A list of data disk images.
/// </summary>
public readonly ImmutableArray<Outputs.GalleryDataDiskImageResponse> DataDiskImages;
/// <summary>
/// This is the OS disk image.
/// </summary>
public readonly Outputs.GalleryOSDiskImageResponse? OsDiskImage;
/// <summary>
/// The gallery artifact version source.
/// </summary>
public readonly Outputs.GalleryArtifactVersionSourceResponse? Source;
[OutputConstructor]
private GalleryImageVersionStorageProfileResponse(
ImmutableArray<Outputs.GalleryDataDiskImageResponse> dataDiskImages,
Outputs.GalleryOSDiskImageResponse? osDiskImage,
Outputs.GalleryArtifactVersionSourceResponse? source)
{
DataDiskImages = dataDiskImages;
OsDiskImage = osDiskImage;
Source = source;
}
}
}
| 32.395349 | 92 | 0.673367 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/Compute/V20190701/Outputs/GalleryImageVersionStorageProfileResponse.cs | 1,393 | C# |
using Godot;
using SpaceDodgeRL.library.encounter;
using SpaceDodgeRL.library.encounter.rulebook;
using SpaceDodgeRL.library.encounter.rulebook.actions;
using SpaceDodgeRL.scenes.encounter.state;
using SpaceDodgeRL.scenes.entities;
using System.Collections.Generic;
using System.Text.Json;
namespace SpaceDodgeRL.scenes.components.AI {
public class ScoutAIComponent : ActivatableAIComponent {
public static readonly string ENTITY_GROUP = "SCOUT_AI_COMPONENT_GROUP";
public override string EntityGroup => ENTITY_GROUP;
public ScoutAIComponent(string activationGroupId) : base(activationGroupId) { }
public static ScoutAIComponent Create(string saveData) {
return JsonSerializer.Deserialize<ScoutAIComponent>(saveData);
}
public override List<EncounterAction> _DecideNextAction(EncounterState state, Entity parent) {
var actions = new List<EncounterAction>();
var parentPos = parent.GetComponent<PositionComponent>().EncounterPosition;
var playerPos = state.Player.GetComponent<PositionComponent>().EncounterPosition;
// Close distance if further than 5
if (parentPos.DistanceTo(playerPos) >= 5f) {
// TODO: We may want to make pathfinding stateful/cache it or something, to save on turn times
var path = Pathfinder.AStarWithNewGrid(parentPos, playerPos, state);
if (path != null) {
actions.Add(new MoveAction(parent.EntityId, path[0]));
}
}
// Always fire shotgun (spread=2, pellets=3)
var fire = FireProjectileAction.CreateSmallShotgunAction(parent.EntityId, playerPos, numPellets: 3, spread: 2, state.EncounterRand);
actions.AddRange(fire);
return actions;
}
public override string Save() {
return JsonSerializer.Serialize(this);
}
public override void NotifyAttached(Entity parent) { }
public override void NotifyDetached(Entity parent) { }
}
} | 37.627451 | 138 | 0.737363 | [
"MIT"
] | MoyTW/SpaceDodgeRL | scenes/components/AI/ScoutAIComponent.cs | 1,919 | C# |
//Original Scripts by IIColour (IIColour_Spectrum)
using UnityEngine;
using System.Collections;
public class InteractBookshelf : MonoBehaviour
{
private static string english = "This bookshelf";
private static string spanish = "Esta estantería";
public string engDialog = english + " has lots of books in it.";
public string spanDialog = spanish + " has lots of books in it.";
private bool hasSwitched = false;
private DialogBoxHandler Dialog;
private NPCHandler thisNPC;
private DictionaryHandler dictHandler;
void Awake()
{
Dialog = GameObject.Find("GUI").GetComponent<DialogBoxHandler>();
if (transform.GetComponent<NPCHandler>() != null)
{
thisNPC = transform.GetComponent<NPCHandler>();
}
dictHandler = GameObject.Find("GUI").GetComponent<DictionaryHandler>();
if (transform.GetComponent<DictionaryHandler>() != null)
{
dictHandler = transform.GetComponent<DictionaryHandler>();
}
}
public IEnumerator interact()
{
if (PlayerMovement.player.setCheckBusyWith(this.gameObject))
{
if (thisNPC != null)
{
int direction;
//calculate player's position relative to this npc's and set direction accordingly.
float xDistance = thisNPC.transform.position.x - PlayerMovement.player.transform.position.x;
float zDistance = thisNPC.transform.position.z - PlayerMovement.player.transform.position.z;
if (xDistance >= Mathf.Abs(zDistance))
{
//Mathf.Abs() converts zDistance to a positive always.
direction = 3;
} //this allows for better accuracy when checking orientation.
else if (xDistance <= Mathf.Abs(zDistance) * -1)
{
direction = 1;
}
else if (zDistance >= Mathf.Abs(xDistance))
{
direction = 2;
}
else
{
direction = 0;
}
thisNPC.setDirection(direction);
}
//start of interaction
Dialog.drawDialogBox();
if (dictHandler.getDict().ContainsKey(english))
{
yield return StartCoroutine(Dialog.drawText(spanDialog));
while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
{
yield return null;
}
Dialog.undrawDialogBox();
}
else
{
yield return StartCoroutine(Dialog.drawText(engDialog));
while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
{
yield return null;
}
Dialog.undrawDialogBox();
Dialog.drawDialogBox();
yield return StartCoroutine(Dialog.drawText(spanDialog));
while (!Input.GetButtonDown("Select") && !Input.GetButtonDown("Back"))
{
yield return null;
}
Dialog.undrawDialogBox();
if (!dictHandler.getDict().ContainsKey(english))
{
dictHandler.addToDict(english, spanish);
}
print("Dictionary:");
dictHandler.printDict();
hasSwitched = true;
}
}
PlayerMovement.player.unsetCheckBusyWith(this.gameObject);
}
} | 34.952381 | 108 | 0.532153 | [
"BSD-3-Clause"
] | nihlan97/PokemonUnity-develop | Pokemon Unity/Assets/InteractBookshelf.cs | 3,673 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompactMPC.Virtualization
{
public class VirtualBit
{
public static readonly VirtualBit Zero = new VirtualBit(-1);
public static readonly VirtualBit One = new VirtualBit(-2);
private int _id;
private VirtualBit(int id)
{
_id = id;
}
public static VirtualBit FromId(int id)
{
if (id < 0)
throw new ArgumentOutOfRangeException(nameof(id));
return new VirtualBit(id);
}
public int Id
{
get
{
return _id;
}
}
}
}
| 20.052632 | 68 | 0.536745 | [
"MIT"
] | lumip/CompactMPC | CompactMPC/Virtualization/VirtualBit.cs | 764 | C# |
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using SimpleASPXPage.Models;
namespace SimpleASPXPage.Account
{
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
//string code = manager.GenerateEmailConfirmationToken(user.Id);
//string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
//manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");
signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else
{
ErrorMessage.Text = result.Errors.FirstOrDefault();
}
}
}
} | 43.777778 | 155 | 0.65165 | [
"MIT"
] | todor-enikov/TelerikAcademy | ASP .NET Web Forms/2.ASP .NET Web Forms Intro/SimpleASPXPage/Account/Register.aspx.cs | 1,578 | C# |
// Copyright © Amer Koleci and Contributors.
// Licensed under the MIT License (MIT). See LICENSE in the repository root for more information.
namespace Vortice.Graphics;
/// <summary>
/// A bitmask indicating how a <see cref="Buffer"/> is permitted to be used.
/// </summary>
[Flags]
public enum BufferUsage
{
None = 0,
/// <summary>
/// Supports input assembly access as VertexBuffer.
/// </summary>
Vertex = 1 << 0,
/// <summary>
/// Supports input assembly access as IndexBuffer.
/// </summary>
Index = 1 << 1,
/// <summary>
/// Supports constant buffer access.
/// </summary>
Constant = 1 << 2,
/// <summary>
/// Supports shader read access.
/// </summary>
ShaderRead = 1 << 3,
/// <summary>
/// Supports write read access.
/// </summary>
ShaderWrite = 1 << 4,
/// <summary>
/// Supports shader read and write access.
/// </summary>
ShaderReadWrite = ShaderRead | ShaderWrite,
/// <summary>
/// Supports indirect buffer access for indirect draw/dispatch.
/// </summary>
Indirect = 1 << 5,
/// <summary>
/// Supports predication access for conditional rendering.
/// </summary>
Predication = 1 << 6,
/// <summary>
/// Supports ray tracing acceleration structure usage.
/// </summary>
RayTracing = 1 << 7,
}
| 27.24 | 97 | 0.595448 | [
"MIT"
] | Sina-Ebrahimi/vortice | src/Vortice/Graphics/BufferUsage.cs | 1,365 | C# |
using System;
namespace Server.Api.Helpers.Exceptions
{
public class DuplicateUserException : Exception
{
public DuplicateUserException(string message) : base(message)
{
}
}
} | 18.833333 | 69 | 0.619469 | [
"MIT"
] | LuisMarques99/MultiSnake | Server/Api/Helpers/Exceptions/DuplicateUserException.cs | 228 | 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 pinpoint-email-2018-07-26.normal.json service model.
*/
using System;
using System.Collections.Generic;
using Amazon.Runtime;
using Amazon.PinpointEmail.Model;
namespace Amazon.PinpointEmail
{
/// <summary>
/// Interface for accessing PinpointEmail
///
/// Amazon Pinpoint Email Service
/// <para>
/// Welcome to the <i>Amazon Pinpoint Email API Reference</i>. This guide provides information
/// about the Amazon Pinpoint Email API (version 1.0), including supported operations,
/// data types, parameters, and schemas.
/// </para>
///
/// <para>
/// <a href="https://aws.amazon.com/pinpoint">Amazon Pinpoint</a> is an AWS service that
/// you can use to engage with your customers across multiple messaging channels. You
/// can use Amazon Pinpoint to send email, SMS text messages, voice messages, and push
/// notifications. The Amazon Pinpoint Email API provides programmatic access to options
/// that are unique to the email channel and supplement the options provided by the Amazon
/// Pinpoint API.
/// </para>
///
/// <para>
/// If you're new to Amazon Pinpoint, you might find it helpful to also review the <a
/// href="https://docs.aws.amazon.com/pinpoint/latest/developerguide/welcome.html">Amazon
/// Pinpoint Developer Guide</a>. The <i>Amazon Pinpoint Developer Guide</i> provides
/// tutorials, code samples, and procedures that demonstrate how to use Amazon Pinpoint
/// features programmatically and how to integrate Amazon Pinpoint functionality into
/// mobile apps and other types of applications. The guide also provides information about
/// key topics such as Amazon Pinpoint integration with other AWS services and the limits
/// that apply to using the service.
/// </para>
///
/// <para>
/// The Amazon Pinpoint Email API is available in several AWS Regions and it provides
/// an endpoint for each of these Regions. For a list of all the Regions and endpoints
/// where the API is currently available, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#pinpoint_region">AWS
/// Service Endpoints</a> in the <i>Amazon Web Services General Reference</i>. To learn
/// more about AWS Regions, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande-manage.html">Managing
/// AWS Regions</a> in the <i>Amazon Web Services General Reference</i>.
/// </para>
///
/// <para>
/// In each Region, AWS maintains multiple Availability Zones. These Availability Zones
/// are physically isolated from each other, but are united by private, low-latency, high-throughput,
/// and highly redundant network connections. These Availability Zones enable us to provide
/// very high levels of availability and redundancy, while also minimizing latency. To
/// learn more about the number of Availability Zones that are available in each Region,
/// see <a href="http://aws.amazon.com/about-aws/global-infrastructure/">AWS Global Infrastructure</a>.
/// </para>
/// </summary>
public partial interface IAmazonPinpointEmail : IAmazonService, IDisposable
{
#if BCL45 || AWS_ASYNC_ENUMERABLES_API
/// <summary>
/// Paginators for the service
/// </summary>
IPinpointEmailPaginatorFactory Paginators { get; }
#endif
#region CreateConfigurationSet
/// <summary>
/// Create a configuration set. <i>Configuration sets</i> are groups of rules that you
/// can apply to the emails you send using Amazon Pinpoint. You apply a configuration
/// set to an email by including a reference to the configuration set in the headers of
/// the email. When you apply a configuration set to an email, all of the rules in that
/// configuration set are applied to the email.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateConfigurationSet service method.</param>
///
/// <returns>The response from the CreateConfigurationSet service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AlreadyExistsException">
/// The resource specified in your request already exists.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSet">REST API Reference for CreateConfigurationSet Operation</seealso>
CreateConfigurationSetResponse CreateConfigurationSet(CreateConfigurationSetRequest request);
/// <summary>
/// Initiates the asynchronous execution of the CreateConfigurationSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateConfigurationSet operation on AmazonPinpointEmailClient.</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 EndCreateConfigurationSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSet">REST API Reference for CreateConfigurationSet Operation</seealso>
IAsyncResult BeginCreateConfigurationSet(CreateConfigurationSetRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the CreateConfigurationSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateConfigurationSet.</param>
///
/// <returns>Returns a CreateConfigurationSetResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSet">REST API Reference for CreateConfigurationSet Operation</seealso>
CreateConfigurationSetResponse EndCreateConfigurationSet(IAsyncResult asyncResult);
#endregion
#region CreateConfigurationSetEventDestination
/// <summary>
/// Create an event destination. In Amazon Pinpoint, <i>events</i> include message sends,
/// deliveries, opens, clicks, bounces, and complaints. <i>Event destinations</i> are
/// places that you can send information about these events to. For example, you can send
/// event data to Amazon SNS to receive notifications when you receive bounces or complaints,
/// or you can use Amazon Kinesis Data Firehose to stream data to Amazon S3 for long-term
/// storage.
///
///
/// <para>
/// A single configuration set can include more than one event destination.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateConfigurationSetEventDestination service method.</param>
///
/// <returns>The response from the CreateConfigurationSetEventDestination service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AlreadyExistsException">
/// The resource specified in your request already exists.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSetEventDestination">REST API Reference for CreateConfigurationSetEventDestination Operation</seealso>
CreateConfigurationSetEventDestinationResponse CreateConfigurationSetEventDestination(CreateConfigurationSetEventDestinationRequest request);
/// <summary>
/// Initiates the asynchronous execution of the CreateConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateConfigurationSetEventDestination operation on AmazonPinpointEmailClient.</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 EndCreateConfigurationSetEventDestination
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSetEventDestination">REST API Reference for CreateConfigurationSetEventDestination Operation</seealso>
IAsyncResult BeginCreateConfigurationSetEventDestination(CreateConfigurationSetEventDestinationRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the CreateConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateConfigurationSetEventDestination.</param>
///
/// <returns>Returns a CreateConfigurationSetEventDestinationResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateConfigurationSetEventDestination">REST API Reference for CreateConfigurationSetEventDestination Operation</seealso>
CreateConfigurationSetEventDestinationResponse EndCreateConfigurationSetEventDestination(IAsyncResult asyncResult);
#endregion
#region CreateDedicatedIpPool
/// <summary>
/// Create a new pool of dedicated IP addresses. A pool can include one or more dedicated
/// IP addresses that are associated with your Amazon Pinpoint account. You can associate
/// a pool with a configuration set. When you send an email that uses that configuration
/// set, Amazon Pinpoint sends it using only the IP addresses in the associated pool.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDedicatedIpPool service method.</param>
///
/// <returns>The response from the CreateDedicatedIpPool service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AlreadyExistsException">
/// The resource specified in your request already exists.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDedicatedIpPool">REST API Reference for CreateDedicatedIpPool Operation</seealso>
CreateDedicatedIpPoolResponse CreateDedicatedIpPool(CreateDedicatedIpPoolRequest request);
/// <summary>
/// Initiates the asynchronous execution of the CreateDedicatedIpPool operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateDedicatedIpPool operation on AmazonPinpointEmailClient.</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 EndCreateDedicatedIpPool
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDedicatedIpPool">REST API Reference for CreateDedicatedIpPool Operation</seealso>
IAsyncResult BeginCreateDedicatedIpPool(CreateDedicatedIpPoolRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the CreateDedicatedIpPool operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateDedicatedIpPool.</param>
///
/// <returns>Returns a CreateDedicatedIpPoolResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDedicatedIpPool">REST API Reference for CreateDedicatedIpPool Operation</seealso>
CreateDedicatedIpPoolResponse EndCreateDedicatedIpPool(IAsyncResult asyncResult);
#endregion
#region CreateDeliverabilityTestReport
/// <summary>
/// Create a new predictive inbox placement test. Predictive inbox placement tests can
/// help you predict how your messages will be handled by various email providers around
/// the world. When you perform a predictive inbox placement test, you provide a sample
/// message that contains the content that you plan to send to your customers. Amazon
/// Pinpoint then sends that message to special email addresses spread across several
/// major email providers. After about 24 hours, the test is complete, and you can use
/// the <code>GetDeliverabilityTestReport</code> operation to view the results of the
/// test.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateDeliverabilityTestReport service method.</param>
///
/// <returns>The response from the CreateDeliverabilityTestReport service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AccountSuspendedException">
/// The message can't be sent because the account's ability to send email has been permanently
/// restricted.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.MailFromDomainNotVerifiedException">
/// The message can't be sent because the sending domain isn't verified.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.MessageRejectedException">
/// The message can't be sent because it contains invalid content.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.SendingPausedException">
/// The message can't be sent because the account's ability to send email is currently
/// paused.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDeliverabilityTestReport">REST API Reference for CreateDeliverabilityTestReport Operation</seealso>
CreateDeliverabilityTestReportResponse CreateDeliverabilityTestReport(CreateDeliverabilityTestReportRequest request);
/// <summary>
/// Initiates the asynchronous execution of the CreateDeliverabilityTestReport operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateDeliverabilityTestReport operation on AmazonPinpointEmailClient.</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 EndCreateDeliverabilityTestReport
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDeliverabilityTestReport">REST API Reference for CreateDeliverabilityTestReport Operation</seealso>
IAsyncResult BeginCreateDeliverabilityTestReport(CreateDeliverabilityTestReportRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the CreateDeliverabilityTestReport operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateDeliverabilityTestReport.</param>
///
/// <returns>Returns a CreateDeliverabilityTestReportResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateDeliverabilityTestReport">REST API Reference for CreateDeliverabilityTestReport Operation</seealso>
CreateDeliverabilityTestReportResponse EndCreateDeliverabilityTestReport(IAsyncResult asyncResult);
#endregion
#region CreateEmailIdentity
/// <summary>
/// Verifies an email identity for use with Amazon Pinpoint. In Amazon Pinpoint, an identity
/// is an email address or domain that you use when you send email. Before you can use
/// an identity to send email with Amazon Pinpoint, you first have to verify it. By verifying
/// an address, you demonstrate that you're the owner of the address, and that you've
/// given Amazon Pinpoint permission to send email from the address.
///
///
/// <para>
/// When you verify an email address, Amazon Pinpoint sends an email to the address. Your
/// email address is verified as soon as you follow the link in the verification email.
///
/// </para>
///
/// <para>
/// When you verify a domain, this operation provides a set of DKIM tokens, which you
/// can convert into CNAME tokens. You add these CNAME tokens to the DNS configuration
/// for your domain. Your domain is verified when Amazon Pinpoint detects these records
/// in the DNS configuration for your domain. It usually takes around 72 hours to complete
/// the domain verification process.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateEmailIdentity service method.</param>
///
/// <returns>The response from the CreateEmailIdentity service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateEmailIdentity">REST API Reference for CreateEmailIdentity Operation</seealso>
CreateEmailIdentityResponse CreateEmailIdentity(CreateEmailIdentityRequest request);
/// <summary>
/// Initiates the asynchronous execution of the CreateEmailIdentity operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateEmailIdentity operation on AmazonPinpointEmailClient.</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 EndCreateEmailIdentity
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateEmailIdentity">REST API Reference for CreateEmailIdentity Operation</seealso>
IAsyncResult BeginCreateEmailIdentity(CreateEmailIdentityRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the CreateEmailIdentity operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateEmailIdentity.</param>
///
/// <returns>Returns a CreateEmailIdentityResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/CreateEmailIdentity">REST API Reference for CreateEmailIdentity Operation</seealso>
CreateEmailIdentityResponse EndCreateEmailIdentity(IAsyncResult asyncResult);
#endregion
#region DeleteConfigurationSet
/// <summary>
/// Delete an existing configuration set.
///
///
/// <para>
/// In Amazon Pinpoint, <i>configuration sets</i> are groups of rules that you can apply
/// to the emails you send. You apply a configuration set to an email by including a reference
/// to the configuration set in the headers of the email. When you apply a configuration
/// set to an email, all of the rules in that configuration set are applied to the email.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteConfigurationSet service method.</param>
///
/// <returns>The response from the DeleteConfigurationSet service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSet">REST API Reference for DeleteConfigurationSet Operation</seealso>
DeleteConfigurationSetResponse DeleteConfigurationSet(DeleteConfigurationSetRequest request);
/// <summary>
/// Initiates the asynchronous execution of the DeleteConfigurationSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteConfigurationSet operation on AmazonPinpointEmailClient.</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 EndDeleteConfigurationSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSet">REST API Reference for DeleteConfigurationSet Operation</seealso>
IAsyncResult BeginDeleteConfigurationSet(DeleteConfigurationSetRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the DeleteConfigurationSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteConfigurationSet.</param>
///
/// <returns>Returns a DeleteConfigurationSetResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSet">REST API Reference for DeleteConfigurationSet Operation</seealso>
DeleteConfigurationSetResponse EndDeleteConfigurationSet(IAsyncResult asyncResult);
#endregion
#region DeleteConfigurationSetEventDestination
/// <summary>
/// Delete an event destination.
///
///
/// <para>
/// In Amazon Pinpoint, <i>events</i> include message sends, deliveries, opens, clicks,
/// bounces, and complaints. <i>Event destinations</i> are places that you can send information
/// about these events to. For example, you can send event data to Amazon SNS to receive
/// notifications when you receive bounces or complaints, or you can use Amazon Kinesis
/// Data Firehose to stream data to Amazon S3 for long-term storage.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteConfigurationSetEventDestination service method.</param>
///
/// <returns>The response from the DeleteConfigurationSetEventDestination service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSetEventDestination">REST API Reference for DeleteConfigurationSetEventDestination Operation</seealso>
DeleteConfigurationSetEventDestinationResponse DeleteConfigurationSetEventDestination(DeleteConfigurationSetEventDestinationRequest request);
/// <summary>
/// Initiates the asynchronous execution of the DeleteConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteConfigurationSetEventDestination operation on AmazonPinpointEmailClient.</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 EndDeleteConfigurationSetEventDestination
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSetEventDestination">REST API Reference for DeleteConfigurationSetEventDestination Operation</seealso>
IAsyncResult BeginDeleteConfigurationSetEventDestination(DeleteConfigurationSetEventDestinationRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the DeleteConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteConfigurationSetEventDestination.</param>
///
/// <returns>Returns a DeleteConfigurationSetEventDestinationResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteConfigurationSetEventDestination">REST API Reference for DeleteConfigurationSetEventDestination Operation</seealso>
DeleteConfigurationSetEventDestinationResponse EndDeleteConfigurationSetEventDestination(IAsyncResult asyncResult);
#endregion
#region DeleteDedicatedIpPool
/// <summary>
/// Delete a dedicated IP pool.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteDedicatedIpPool service method.</param>
///
/// <returns>The response from the DeleteDedicatedIpPool service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteDedicatedIpPool">REST API Reference for DeleteDedicatedIpPool Operation</seealso>
DeleteDedicatedIpPoolResponse DeleteDedicatedIpPool(DeleteDedicatedIpPoolRequest request);
/// <summary>
/// Initiates the asynchronous execution of the DeleteDedicatedIpPool operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteDedicatedIpPool operation on AmazonPinpointEmailClient.</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 EndDeleteDedicatedIpPool
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteDedicatedIpPool">REST API Reference for DeleteDedicatedIpPool Operation</seealso>
IAsyncResult BeginDeleteDedicatedIpPool(DeleteDedicatedIpPoolRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the DeleteDedicatedIpPool operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteDedicatedIpPool.</param>
///
/// <returns>Returns a DeleteDedicatedIpPoolResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteDedicatedIpPool">REST API Reference for DeleteDedicatedIpPool Operation</seealso>
DeleteDedicatedIpPoolResponse EndDeleteDedicatedIpPool(IAsyncResult asyncResult);
#endregion
#region DeleteEmailIdentity
/// <summary>
/// Deletes an email identity that you previously verified for use with Amazon Pinpoint.
/// An identity can be either an email address or a domain name.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteEmailIdentity service method.</param>
///
/// <returns>The response from the DeleteEmailIdentity service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteEmailIdentity">REST API Reference for DeleteEmailIdentity Operation</seealso>
DeleteEmailIdentityResponse DeleteEmailIdentity(DeleteEmailIdentityRequest request);
/// <summary>
/// Initiates the asynchronous execution of the DeleteEmailIdentity operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteEmailIdentity operation on AmazonPinpointEmailClient.</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 EndDeleteEmailIdentity
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteEmailIdentity">REST API Reference for DeleteEmailIdentity Operation</seealso>
IAsyncResult BeginDeleteEmailIdentity(DeleteEmailIdentityRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the DeleteEmailIdentity operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteEmailIdentity.</param>
///
/// <returns>Returns a DeleteEmailIdentityResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/DeleteEmailIdentity">REST API Reference for DeleteEmailIdentity Operation</seealso>
DeleteEmailIdentityResponse EndDeleteEmailIdentity(IAsyncResult asyncResult);
#endregion
#region GetAccount
/// <summary>
/// Obtain information about the email-sending status and capabilities of your Amazon
/// Pinpoint account in the current AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetAccount service method.</param>
///
/// <returns>The response from the GetAccount service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetAccount">REST API Reference for GetAccount Operation</seealso>
GetAccountResponse GetAccount(GetAccountRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetAccount operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetAccount operation on AmazonPinpointEmailClient.</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 EndGetAccount
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetAccount">REST API Reference for GetAccount Operation</seealso>
IAsyncResult BeginGetAccount(GetAccountRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetAccount operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetAccount.</param>
///
/// <returns>Returns a GetAccountResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetAccount">REST API Reference for GetAccount Operation</seealso>
GetAccountResponse EndGetAccount(IAsyncResult asyncResult);
#endregion
#region GetBlacklistReports
/// <summary>
/// Retrieve a list of the blacklists that your dedicated IP addresses appear on.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetBlacklistReports service method.</param>
///
/// <returns>The response from the GetBlacklistReports service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetBlacklistReports">REST API Reference for GetBlacklistReports Operation</seealso>
GetBlacklistReportsResponse GetBlacklistReports(GetBlacklistReportsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetBlacklistReports operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetBlacklistReports operation on AmazonPinpointEmailClient.</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 EndGetBlacklistReports
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetBlacklistReports">REST API Reference for GetBlacklistReports Operation</seealso>
IAsyncResult BeginGetBlacklistReports(GetBlacklistReportsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetBlacklistReports operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetBlacklistReports.</param>
///
/// <returns>Returns a GetBlacklistReportsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetBlacklistReports">REST API Reference for GetBlacklistReports Operation</seealso>
GetBlacklistReportsResponse EndGetBlacklistReports(IAsyncResult asyncResult);
#endregion
#region GetConfigurationSet
/// <summary>
/// Get information about an existing configuration set, including the dedicated IP pool
/// that it's associated with, whether or not it's enabled for sending email, and more.
///
///
/// <para>
/// In Amazon Pinpoint, <i>configuration sets</i> are groups of rules that you can apply
/// to the emails you send. You apply a configuration set to an email by including a reference
/// to the configuration set in the headers of the email. When you apply a configuration
/// set to an email, all of the rules in that configuration set are applied to the email.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetConfigurationSet service method.</param>
///
/// <returns>The response from the GetConfigurationSet service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSet">REST API Reference for GetConfigurationSet Operation</seealso>
GetConfigurationSetResponse GetConfigurationSet(GetConfigurationSetRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetConfigurationSet operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetConfigurationSet operation on AmazonPinpointEmailClient.</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 EndGetConfigurationSet
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSet">REST API Reference for GetConfigurationSet Operation</seealso>
IAsyncResult BeginGetConfigurationSet(GetConfigurationSetRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetConfigurationSet operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetConfigurationSet.</param>
///
/// <returns>Returns a GetConfigurationSetResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSet">REST API Reference for GetConfigurationSet Operation</seealso>
GetConfigurationSetResponse EndGetConfigurationSet(IAsyncResult asyncResult);
#endregion
#region GetConfigurationSetEventDestinations
/// <summary>
/// Retrieve a list of event destinations that are associated with a configuration set.
///
///
/// <para>
/// In Amazon Pinpoint, <i>events</i> include message sends, deliveries, opens, clicks,
/// bounces, and complaints. <i>Event destinations</i> are places that you can send information
/// about these events to. For example, you can send event data to Amazon SNS to receive
/// notifications when you receive bounces or complaints, or you can use Amazon Kinesis
/// Data Firehose to stream data to Amazon S3 for long-term storage.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetConfigurationSetEventDestinations service method.</param>
///
/// <returns>The response from the GetConfigurationSetEventDestinations service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSetEventDestinations">REST API Reference for GetConfigurationSetEventDestinations Operation</seealso>
GetConfigurationSetEventDestinationsResponse GetConfigurationSetEventDestinations(GetConfigurationSetEventDestinationsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetConfigurationSetEventDestinations operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetConfigurationSetEventDestinations operation on AmazonPinpointEmailClient.</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 EndGetConfigurationSetEventDestinations
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSetEventDestinations">REST API Reference for GetConfigurationSetEventDestinations Operation</seealso>
IAsyncResult BeginGetConfigurationSetEventDestinations(GetConfigurationSetEventDestinationsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetConfigurationSetEventDestinations operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetConfigurationSetEventDestinations.</param>
///
/// <returns>Returns a GetConfigurationSetEventDestinationsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetConfigurationSetEventDestinations">REST API Reference for GetConfigurationSetEventDestinations Operation</seealso>
GetConfigurationSetEventDestinationsResponse EndGetConfigurationSetEventDestinations(IAsyncResult asyncResult);
#endregion
#region GetDedicatedIp
/// <summary>
/// Get information about a dedicated IP address, including the name of the dedicated
/// IP pool that it's associated with, as well information about the automatic warm-up
/// process for the address.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDedicatedIp service method.</param>
///
/// <returns>The response from the GetDedicatedIp service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIp">REST API Reference for GetDedicatedIp Operation</seealso>
GetDedicatedIpResponse GetDedicatedIp(GetDedicatedIpRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDedicatedIp operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDedicatedIp operation on AmazonPinpointEmailClient.</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 EndGetDedicatedIp
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIp">REST API Reference for GetDedicatedIp Operation</seealso>
IAsyncResult BeginGetDedicatedIp(GetDedicatedIpRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDedicatedIp operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDedicatedIp.</param>
///
/// <returns>Returns a GetDedicatedIpResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIp">REST API Reference for GetDedicatedIp Operation</seealso>
GetDedicatedIpResponse EndGetDedicatedIp(IAsyncResult asyncResult);
#endregion
#region GetDedicatedIps
/// <summary>
/// List the dedicated IP addresses that are associated with your Amazon Pinpoint account.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDedicatedIps service method.</param>
///
/// <returns>The response from the GetDedicatedIps service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIps">REST API Reference for GetDedicatedIps Operation</seealso>
GetDedicatedIpsResponse GetDedicatedIps(GetDedicatedIpsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDedicatedIps operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDedicatedIps operation on AmazonPinpointEmailClient.</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 EndGetDedicatedIps
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIps">REST API Reference for GetDedicatedIps Operation</seealso>
IAsyncResult BeginGetDedicatedIps(GetDedicatedIpsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDedicatedIps operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDedicatedIps.</param>
///
/// <returns>Returns a GetDedicatedIpsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDedicatedIps">REST API Reference for GetDedicatedIps Operation</seealso>
GetDedicatedIpsResponse EndGetDedicatedIps(IAsyncResult asyncResult);
#endregion
#region GetDeliverabilityDashboardOptions
/// <summary>
/// Retrieve information about the status of the Deliverability dashboard for your Amazon
/// Pinpoint account. When the Deliverability dashboard is enabled, you gain access to
/// reputation, deliverability, and other metrics for the domains that you use to send
/// email using Amazon Pinpoint. You also gain the ability to perform predictive inbox
/// placement tests.
///
///
/// <para>
/// When you use the Deliverability dashboard, you pay a monthly subscription charge,
/// in addition to any other fees that you accrue by using Amazon Pinpoint. For more information
/// about the features and cost of a Deliverability dashboard subscription, see <a href="http://aws.amazon.com/pinpoint/pricing/">Amazon
/// Pinpoint Pricing</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDeliverabilityDashboardOptions service method.</param>
///
/// <returns>The response from the GetDeliverabilityDashboardOptions service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityDashboardOptions">REST API Reference for GetDeliverabilityDashboardOptions Operation</seealso>
GetDeliverabilityDashboardOptionsResponse GetDeliverabilityDashboardOptions(GetDeliverabilityDashboardOptionsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDeliverabilityDashboardOptions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDeliverabilityDashboardOptions operation on AmazonPinpointEmailClient.</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 EndGetDeliverabilityDashboardOptions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityDashboardOptions">REST API Reference for GetDeliverabilityDashboardOptions Operation</seealso>
IAsyncResult BeginGetDeliverabilityDashboardOptions(GetDeliverabilityDashboardOptionsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDeliverabilityDashboardOptions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDeliverabilityDashboardOptions.</param>
///
/// <returns>Returns a GetDeliverabilityDashboardOptionsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityDashboardOptions">REST API Reference for GetDeliverabilityDashboardOptions Operation</seealso>
GetDeliverabilityDashboardOptionsResponse EndGetDeliverabilityDashboardOptions(IAsyncResult asyncResult);
#endregion
#region GetDeliverabilityTestReport
/// <summary>
/// Retrieve the results of a predictive inbox placement test.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDeliverabilityTestReport service method.</param>
///
/// <returns>The response from the GetDeliverabilityTestReport service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityTestReport">REST API Reference for GetDeliverabilityTestReport Operation</seealso>
GetDeliverabilityTestReportResponse GetDeliverabilityTestReport(GetDeliverabilityTestReportRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDeliverabilityTestReport operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDeliverabilityTestReport operation on AmazonPinpointEmailClient.</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 EndGetDeliverabilityTestReport
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityTestReport">REST API Reference for GetDeliverabilityTestReport Operation</seealso>
IAsyncResult BeginGetDeliverabilityTestReport(GetDeliverabilityTestReportRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDeliverabilityTestReport operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDeliverabilityTestReport.</param>
///
/// <returns>Returns a GetDeliverabilityTestReportResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDeliverabilityTestReport">REST API Reference for GetDeliverabilityTestReport Operation</seealso>
GetDeliverabilityTestReportResponse EndGetDeliverabilityTestReport(IAsyncResult asyncResult);
#endregion
#region GetDomainDeliverabilityCampaign
/// <summary>
/// Retrieve all the deliverability data for a specific campaign. This data is available
/// for a campaign only if the campaign sent email by using a domain that the Deliverability
/// dashboard is enabled for (<code>PutDeliverabilityDashboardOption</code> operation).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDomainDeliverabilityCampaign service method.</param>
///
/// <returns>The response from the GetDomainDeliverabilityCampaign service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainDeliverabilityCampaign">REST API Reference for GetDomainDeliverabilityCampaign Operation</seealso>
GetDomainDeliverabilityCampaignResponse GetDomainDeliverabilityCampaign(GetDomainDeliverabilityCampaignRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDomainDeliverabilityCampaign operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDomainDeliverabilityCampaign operation on AmazonPinpointEmailClient.</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 EndGetDomainDeliverabilityCampaign
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainDeliverabilityCampaign">REST API Reference for GetDomainDeliverabilityCampaign Operation</seealso>
IAsyncResult BeginGetDomainDeliverabilityCampaign(GetDomainDeliverabilityCampaignRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDomainDeliverabilityCampaign operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDomainDeliverabilityCampaign.</param>
///
/// <returns>Returns a GetDomainDeliverabilityCampaignResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainDeliverabilityCampaign">REST API Reference for GetDomainDeliverabilityCampaign Operation</seealso>
GetDomainDeliverabilityCampaignResponse EndGetDomainDeliverabilityCampaign(IAsyncResult asyncResult);
#endregion
#region GetDomainStatisticsReport
/// <summary>
/// Retrieve inbox placement and engagement rates for the domains that you use to send
/// email.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetDomainStatisticsReport service method.</param>
///
/// <returns>The response from the GetDomainStatisticsReport service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainStatisticsReport">REST API Reference for GetDomainStatisticsReport Operation</seealso>
GetDomainStatisticsReportResponse GetDomainStatisticsReport(GetDomainStatisticsReportRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetDomainStatisticsReport operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetDomainStatisticsReport operation on AmazonPinpointEmailClient.</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 EndGetDomainStatisticsReport
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainStatisticsReport">REST API Reference for GetDomainStatisticsReport Operation</seealso>
IAsyncResult BeginGetDomainStatisticsReport(GetDomainStatisticsReportRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetDomainStatisticsReport operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetDomainStatisticsReport.</param>
///
/// <returns>Returns a GetDomainStatisticsReportResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetDomainStatisticsReport">REST API Reference for GetDomainStatisticsReport Operation</seealso>
GetDomainStatisticsReportResponse EndGetDomainStatisticsReport(IAsyncResult asyncResult);
#endregion
#region GetEmailIdentity
/// <summary>
/// Provides information about a specific identity associated with your Amazon Pinpoint
/// account, including the identity's verification status, its DKIM authentication status,
/// and its custom Mail-From settings.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GetEmailIdentity service method.</param>
///
/// <returns>The response from the GetEmailIdentity service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetEmailIdentity">REST API Reference for GetEmailIdentity Operation</seealso>
GetEmailIdentityResponse GetEmailIdentity(GetEmailIdentityRequest request);
/// <summary>
/// Initiates the asynchronous execution of the GetEmailIdentity operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the GetEmailIdentity operation on AmazonPinpointEmailClient.</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 EndGetEmailIdentity
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetEmailIdentity">REST API Reference for GetEmailIdentity Operation</seealso>
IAsyncResult BeginGetEmailIdentity(GetEmailIdentityRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the GetEmailIdentity operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginGetEmailIdentity.</param>
///
/// <returns>Returns a GetEmailIdentityResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/GetEmailIdentity">REST API Reference for GetEmailIdentity Operation</seealso>
GetEmailIdentityResponse EndGetEmailIdentity(IAsyncResult asyncResult);
#endregion
#region ListConfigurationSets
/// <summary>
/// List all of the configuration sets associated with your Amazon Pinpoint account in
/// the current region.
///
///
/// <para>
/// In Amazon Pinpoint, <i>configuration sets</i> are groups of rules that you can apply
/// to the emails you send. You apply a configuration set to an email by including a reference
/// to the configuration set in the headers of the email. When you apply a configuration
/// set to an email, all of the rules in that configuration set are applied to the email.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListConfigurationSets service method.</param>
///
/// <returns>The response from the ListConfigurationSets service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListConfigurationSets">REST API Reference for ListConfigurationSets Operation</seealso>
ListConfigurationSetsResponse ListConfigurationSets(ListConfigurationSetsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListConfigurationSets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListConfigurationSets operation on AmazonPinpointEmailClient.</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 EndListConfigurationSets
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListConfigurationSets">REST API Reference for ListConfigurationSets Operation</seealso>
IAsyncResult BeginListConfigurationSets(ListConfigurationSetsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the ListConfigurationSets operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListConfigurationSets.</param>
///
/// <returns>Returns a ListConfigurationSetsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListConfigurationSets">REST API Reference for ListConfigurationSets Operation</seealso>
ListConfigurationSetsResponse EndListConfigurationSets(IAsyncResult asyncResult);
#endregion
#region ListDedicatedIpPools
/// <summary>
/// List all of the dedicated IP pools that exist in your Amazon Pinpoint account in the
/// current AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListDedicatedIpPools service method.</param>
///
/// <returns>The response from the ListDedicatedIpPools service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDedicatedIpPools">REST API Reference for ListDedicatedIpPools Operation</seealso>
ListDedicatedIpPoolsResponse ListDedicatedIpPools(ListDedicatedIpPoolsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListDedicatedIpPools operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListDedicatedIpPools operation on AmazonPinpointEmailClient.</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 EndListDedicatedIpPools
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDedicatedIpPools">REST API Reference for ListDedicatedIpPools Operation</seealso>
IAsyncResult BeginListDedicatedIpPools(ListDedicatedIpPoolsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the ListDedicatedIpPools operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListDedicatedIpPools.</param>
///
/// <returns>Returns a ListDedicatedIpPoolsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDedicatedIpPools">REST API Reference for ListDedicatedIpPools Operation</seealso>
ListDedicatedIpPoolsResponse EndListDedicatedIpPools(IAsyncResult asyncResult);
#endregion
#region ListDeliverabilityTestReports
/// <summary>
/// Show a list of the predictive inbox placement tests that you've performed, regardless
/// of their statuses. For predictive inbox placement tests that are complete, you can
/// use the <code>GetDeliverabilityTestReport</code> operation to view the results.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListDeliverabilityTestReports service method.</param>
///
/// <returns>The response from the ListDeliverabilityTestReports service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDeliverabilityTestReports">REST API Reference for ListDeliverabilityTestReports Operation</seealso>
ListDeliverabilityTestReportsResponse ListDeliverabilityTestReports(ListDeliverabilityTestReportsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListDeliverabilityTestReports operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListDeliverabilityTestReports operation on AmazonPinpointEmailClient.</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 EndListDeliverabilityTestReports
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDeliverabilityTestReports">REST API Reference for ListDeliverabilityTestReports Operation</seealso>
IAsyncResult BeginListDeliverabilityTestReports(ListDeliverabilityTestReportsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the ListDeliverabilityTestReports operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListDeliverabilityTestReports.</param>
///
/// <returns>Returns a ListDeliverabilityTestReportsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDeliverabilityTestReports">REST API Reference for ListDeliverabilityTestReports Operation</seealso>
ListDeliverabilityTestReportsResponse EndListDeliverabilityTestReports(IAsyncResult asyncResult);
#endregion
#region ListDomainDeliverabilityCampaigns
/// <summary>
/// Retrieve deliverability data for all the campaigns that used a specific domain to
/// send email during a specified time range. This data is available for a domain only
/// if you enabled the Deliverability dashboard (<code>PutDeliverabilityDashboardOption</code>
/// operation) for the domain.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListDomainDeliverabilityCampaigns service method.</param>
///
/// <returns>The response from the ListDomainDeliverabilityCampaigns service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDomainDeliverabilityCampaigns">REST API Reference for ListDomainDeliverabilityCampaigns Operation</seealso>
ListDomainDeliverabilityCampaignsResponse ListDomainDeliverabilityCampaigns(ListDomainDeliverabilityCampaignsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListDomainDeliverabilityCampaigns operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListDomainDeliverabilityCampaigns operation on AmazonPinpointEmailClient.</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 EndListDomainDeliverabilityCampaigns
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDomainDeliverabilityCampaigns">REST API Reference for ListDomainDeliverabilityCampaigns Operation</seealso>
IAsyncResult BeginListDomainDeliverabilityCampaigns(ListDomainDeliverabilityCampaignsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the ListDomainDeliverabilityCampaigns operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListDomainDeliverabilityCampaigns.</param>
///
/// <returns>Returns a ListDomainDeliverabilityCampaignsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListDomainDeliverabilityCampaigns">REST API Reference for ListDomainDeliverabilityCampaigns Operation</seealso>
ListDomainDeliverabilityCampaignsResponse EndListDomainDeliverabilityCampaigns(IAsyncResult asyncResult);
#endregion
#region ListEmailIdentities
/// <summary>
/// Returns a list of all of the email identities that are associated with your Amazon
/// Pinpoint account. An identity can be either an email address or a domain. This operation
/// returns identities that are verified as well as those that aren't.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEmailIdentities service method.</param>
///
/// <returns>The response from the ListEmailIdentities service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListEmailIdentities">REST API Reference for ListEmailIdentities Operation</seealso>
ListEmailIdentitiesResponse ListEmailIdentities(ListEmailIdentitiesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListEmailIdentities operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListEmailIdentities operation on AmazonPinpointEmailClient.</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 EndListEmailIdentities
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListEmailIdentities">REST API Reference for ListEmailIdentities Operation</seealso>
IAsyncResult BeginListEmailIdentities(ListEmailIdentitiesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the ListEmailIdentities operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListEmailIdentities.</param>
///
/// <returns>Returns a ListEmailIdentitiesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListEmailIdentities">REST API Reference for ListEmailIdentities Operation</seealso>
ListEmailIdentitiesResponse EndListEmailIdentities(IAsyncResult asyncResult);
#endregion
#region ListTagsForResource
/// <summary>
/// Retrieve a list of the tags (keys and values) that are associated with a specified
/// resource. A <i>tag</i> is a label that you optionally define and associate with a
/// resource in Amazon Pinpoint. Each tag consists of a required <i>tag key</i> and an
/// optional associated <i>tag value</i>. A tag key is a general label that acts as a
/// category for more specific tag values. A tag value acts as a descriptor within a tag
/// key.
/// </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 PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request);
/// <summary>
/// Initiates the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource operation on AmazonPinpointEmailClient.</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/pinpoint-email-2018-07-26/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
IAsyncResult BeginListTagsForResource(ListTagsForResourceRequest request, AsyncCallback callback, object 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 PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
ListTagsForResourceResponse EndListTagsForResource(IAsyncResult asyncResult);
#endregion
#region PutAccountDedicatedIpWarmupAttributes
/// <summary>
/// Enable or disable the automatic warm-up feature for dedicated IP addresses.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutAccountDedicatedIpWarmupAttributes service method.</param>
///
/// <returns>The response from the PutAccountDedicatedIpWarmupAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountDedicatedIpWarmupAttributes">REST API Reference for PutAccountDedicatedIpWarmupAttributes Operation</seealso>
PutAccountDedicatedIpWarmupAttributesResponse PutAccountDedicatedIpWarmupAttributes(PutAccountDedicatedIpWarmupAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutAccountDedicatedIpWarmupAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutAccountDedicatedIpWarmupAttributes operation on AmazonPinpointEmailClient.</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 EndPutAccountDedicatedIpWarmupAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountDedicatedIpWarmupAttributes">REST API Reference for PutAccountDedicatedIpWarmupAttributes Operation</seealso>
IAsyncResult BeginPutAccountDedicatedIpWarmupAttributes(PutAccountDedicatedIpWarmupAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutAccountDedicatedIpWarmupAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutAccountDedicatedIpWarmupAttributes.</param>
///
/// <returns>Returns a PutAccountDedicatedIpWarmupAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountDedicatedIpWarmupAttributes">REST API Reference for PutAccountDedicatedIpWarmupAttributes Operation</seealso>
PutAccountDedicatedIpWarmupAttributesResponse EndPutAccountDedicatedIpWarmupAttributes(IAsyncResult asyncResult);
#endregion
#region PutAccountSendingAttributes
/// <summary>
/// Enable or disable the ability of your account to send email.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutAccountSendingAttributes service method.</param>
///
/// <returns>The response from the PutAccountSendingAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountSendingAttributes">REST API Reference for PutAccountSendingAttributes Operation</seealso>
PutAccountSendingAttributesResponse PutAccountSendingAttributes(PutAccountSendingAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutAccountSendingAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutAccountSendingAttributes operation on AmazonPinpointEmailClient.</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 EndPutAccountSendingAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountSendingAttributes">REST API Reference for PutAccountSendingAttributes Operation</seealso>
IAsyncResult BeginPutAccountSendingAttributes(PutAccountSendingAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutAccountSendingAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutAccountSendingAttributes.</param>
///
/// <returns>Returns a PutAccountSendingAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutAccountSendingAttributes">REST API Reference for PutAccountSendingAttributes Operation</seealso>
PutAccountSendingAttributesResponse EndPutAccountSendingAttributes(IAsyncResult asyncResult);
#endregion
#region PutConfigurationSetDeliveryOptions
/// <summary>
/// Associate a configuration set with a dedicated IP pool. You can use dedicated IP pools
/// to create groups of dedicated IP addresses for sending specific types of email.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetDeliveryOptions service method.</param>
///
/// <returns>The response from the PutConfigurationSetDeliveryOptions service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetDeliveryOptions">REST API Reference for PutConfigurationSetDeliveryOptions Operation</seealso>
PutConfigurationSetDeliveryOptionsResponse PutConfigurationSetDeliveryOptions(PutConfigurationSetDeliveryOptionsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutConfigurationSetDeliveryOptions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetDeliveryOptions operation on AmazonPinpointEmailClient.</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 EndPutConfigurationSetDeliveryOptions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetDeliveryOptions">REST API Reference for PutConfigurationSetDeliveryOptions Operation</seealso>
IAsyncResult BeginPutConfigurationSetDeliveryOptions(PutConfigurationSetDeliveryOptionsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutConfigurationSetDeliveryOptions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutConfigurationSetDeliveryOptions.</param>
///
/// <returns>Returns a PutConfigurationSetDeliveryOptionsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetDeliveryOptions">REST API Reference for PutConfigurationSetDeliveryOptions Operation</seealso>
PutConfigurationSetDeliveryOptionsResponse EndPutConfigurationSetDeliveryOptions(IAsyncResult asyncResult);
#endregion
#region PutConfigurationSetReputationOptions
/// <summary>
/// Enable or disable collection of reputation metrics for emails that you send using
/// a particular configuration set in a specific AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetReputationOptions service method.</param>
///
/// <returns>The response from the PutConfigurationSetReputationOptions service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetReputationOptions">REST API Reference for PutConfigurationSetReputationOptions Operation</seealso>
PutConfigurationSetReputationOptionsResponse PutConfigurationSetReputationOptions(PutConfigurationSetReputationOptionsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutConfigurationSetReputationOptions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetReputationOptions operation on AmazonPinpointEmailClient.</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 EndPutConfigurationSetReputationOptions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetReputationOptions">REST API Reference for PutConfigurationSetReputationOptions Operation</seealso>
IAsyncResult BeginPutConfigurationSetReputationOptions(PutConfigurationSetReputationOptionsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutConfigurationSetReputationOptions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutConfigurationSetReputationOptions.</param>
///
/// <returns>Returns a PutConfigurationSetReputationOptionsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetReputationOptions">REST API Reference for PutConfigurationSetReputationOptions Operation</seealso>
PutConfigurationSetReputationOptionsResponse EndPutConfigurationSetReputationOptions(IAsyncResult asyncResult);
#endregion
#region PutConfigurationSetSendingOptions
/// <summary>
/// Enable or disable email sending for messages that use a particular configuration set
/// in a specific AWS Region.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetSendingOptions service method.</param>
///
/// <returns>The response from the PutConfigurationSetSendingOptions service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetSendingOptions">REST API Reference for PutConfigurationSetSendingOptions Operation</seealso>
PutConfigurationSetSendingOptionsResponse PutConfigurationSetSendingOptions(PutConfigurationSetSendingOptionsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutConfigurationSetSendingOptions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetSendingOptions operation on AmazonPinpointEmailClient.</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 EndPutConfigurationSetSendingOptions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetSendingOptions">REST API Reference for PutConfigurationSetSendingOptions Operation</seealso>
IAsyncResult BeginPutConfigurationSetSendingOptions(PutConfigurationSetSendingOptionsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutConfigurationSetSendingOptions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutConfigurationSetSendingOptions.</param>
///
/// <returns>Returns a PutConfigurationSetSendingOptionsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetSendingOptions">REST API Reference for PutConfigurationSetSendingOptions Operation</seealso>
PutConfigurationSetSendingOptionsResponse EndPutConfigurationSetSendingOptions(IAsyncResult asyncResult);
#endregion
#region PutConfigurationSetTrackingOptions
/// <summary>
/// Specify a custom domain to use for open and click tracking elements in email that
/// you send using Amazon Pinpoint.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetTrackingOptions service method.</param>
///
/// <returns>The response from the PutConfigurationSetTrackingOptions service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetTrackingOptions">REST API Reference for PutConfigurationSetTrackingOptions Operation</seealso>
PutConfigurationSetTrackingOptionsResponse PutConfigurationSetTrackingOptions(PutConfigurationSetTrackingOptionsRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutConfigurationSetTrackingOptions operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutConfigurationSetTrackingOptions operation on AmazonPinpointEmailClient.</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 EndPutConfigurationSetTrackingOptions
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetTrackingOptions">REST API Reference for PutConfigurationSetTrackingOptions Operation</seealso>
IAsyncResult BeginPutConfigurationSetTrackingOptions(PutConfigurationSetTrackingOptionsRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutConfigurationSetTrackingOptions operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutConfigurationSetTrackingOptions.</param>
///
/// <returns>Returns a PutConfigurationSetTrackingOptionsResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutConfigurationSetTrackingOptions">REST API Reference for PutConfigurationSetTrackingOptions Operation</seealso>
PutConfigurationSetTrackingOptionsResponse EndPutConfigurationSetTrackingOptions(IAsyncResult asyncResult);
#endregion
#region PutDedicatedIpInPool
/// <summary>
/// Move a dedicated IP address to an existing dedicated IP pool.
///
/// <note>
/// <para>
/// The dedicated IP address that you specify must already exist, and must be associated
/// with your Amazon Pinpoint account.
/// </para>
///
/// <para>
/// The dedicated IP pool you specify must already exist. You can create a new pool by
/// using the <code>CreateDedicatedIpPool</code> operation.
/// </para>
/// </note>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutDedicatedIpInPool service method.</param>
///
/// <returns>The response from the PutDedicatedIpInPool service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpInPool">REST API Reference for PutDedicatedIpInPool Operation</seealso>
PutDedicatedIpInPoolResponse PutDedicatedIpInPool(PutDedicatedIpInPoolRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutDedicatedIpInPool operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutDedicatedIpInPool operation on AmazonPinpointEmailClient.</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 EndPutDedicatedIpInPool
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpInPool">REST API Reference for PutDedicatedIpInPool Operation</seealso>
IAsyncResult BeginPutDedicatedIpInPool(PutDedicatedIpInPoolRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutDedicatedIpInPool operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutDedicatedIpInPool.</param>
///
/// <returns>Returns a PutDedicatedIpInPoolResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpInPool">REST API Reference for PutDedicatedIpInPool Operation</seealso>
PutDedicatedIpInPoolResponse EndPutDedicatedIpInPool(IAsyncResult asyncResult);
#endregion
#region PutDedicatedIpWarmupAttributes
/// <summary>
///
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutDedicatedIpWarmupAttributes service method.</param>
///
/// <returns>The response from the PutDedicatedIpWarmupAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpWarmupAttributes">REST API Reference for PutDedicatedIpWarmupAttributes Operation</seealso>
PutDedicatedIpWarmupAttributesResponse PutDedicatedIpWarmupAttributes(PutDedicatedIpWarmupAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutDedicatedIpWarmupAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutDedicatedIpWarmupAttributes operation on AmazonPinpointEmailClient.</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 EndPutDedicatedIpWarmupAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpWarmupAttributes">REST API Reference for PutDedicatedIpWarmupAttributes Operation</seealso>
IAsyncResult BeginPutDedicatedIpWarmupAttributes(PutDedicatedIpWarmupAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutDedicatedIpWarmupAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutDedicatedIpWarmupAttributes.</param>
///
/// <returns>Returns a PutDedicatedIpWarmupAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDedicatedIpWarmupAttributes">REST API Reference for PutDedicatedIpWarmupAttributes Operation</seealso>
PutDedicatedIpWarmupAttributesResponse EndPutDedicatedIpWarmupAttributes(IAsyncResult asyncResult);
#endregion
#region PutDeliverabilityDashboardOption
/// <summary>
/// Enable or disable the Deliverability dashboard for your Amazon Pinpoint account. When
/// you enable the Deliverability dashboard, you gain access to reputation, deliverability,
/// and other metrics for the domains that you use to send email using Amazon Pinpoint.
/// You also gain the ability to perform predictive inbox placement tests.
///
///
/// <para>
/// When you use the Deliverability dashboard, you pay a monthly subscription charge,
/// in addition to any other fees that you accrue by using Amazon Pinpoint. For more information
/// about the features and cost of a Deliverability dashboard subscription, see <a href="http://aws.amazon.com/pinpoint/pricing/">Amazon
/// Pinpoint Pricing</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutDeliverabilityDashboardOption service method.</param>
///
/// <returns>The response from the PutDeliverabilityDashboardOption service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AlreadyExistsException">
/// The resource specified in your request already exists.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDeliverabilityDashboardOption">REST API Reference for PutDeliverabilityDashboardOption Operation</seealso>
PutDeliverabilityDashboardOptionResponse PutDeliverabilityDashboardOption(PutDeliverabilityDashboardOptionRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutDeliverabilityDashboardOption operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutDeliverabilityDashboardOption operation on AmazonPinpointEmailClient.</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 EndPutDeliverabilityDashboardOption
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDeliverabilityDashboardOption">REST API Reference for PutDeliverabilityDashboardOption Operation</seealso>
IAsyncResult BeginPutDeliverabilityDashboardOption(PutDeliverabilityDashboardOptionRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutDeliverabilityDashboardOption operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutDeliverabilityDashboardOption.</param>
///
/// <returns>Returns a PutDeliverabilityDashboardOptionResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutDeliverabilityDashboardOption">REST API Reference for PutDeliverabilityDashboardOption Operation</seealso>
PutDeliverabilityDashboardOptionResponse EndPutDeliverabilityDashboardOption(IAsyncResult asyncResult);
#endregion
#region PutEmailIdentityDkimAttributes
/// <summary>
/// Used to enable or disable DKIM authentication for an email identity.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityDkimAttributes service method.</param>
///
/// <returns>The response from the PutEmailIdentityDkimAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityDkimAttributes">REST API Reference for PutEmailIdentityDkimAttributes Operation</seealso>
PutEmailIdentityDkimAttributesResponse PutEmailIdentityDkimAttributes(PutEmailIdentityDkimAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutEmailIdentityDkimAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityDkimAttributes operation on AmazonPinpointEmailClient.</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 EndPutEmailIdentityDkimAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityDkimAttributes">REST API Reference for PutEmailIdentityDkimAttributes Operation</seealso>
IAsyncResult BeginPutEmailIdentityDkimAttributes(PutEmailIdentityDkimAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutEmailIdentityDkimAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutEmailIdentityDkimAttributes.</param>
///
/// <returns>Returns a PutEmailIdentityDkimAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityDkimAttributes">REST API Reference for PutEmailIdentityDkimAttributes Operation</seealso>
PutEmailIdentityDkimAttributesResponse EndPutEmailIdentityDkimAttributes(IAsyncResult asyncResult);
#endregion
#region PutEmailIdentityFeedbackAttributes
/// <summary>
/// Used to enable or disable feedback forwarding for an identity. This setting determines
/// what happens when an identity is used to send an email that results in a bounce or
/// complaint event.
///
///
/// <para>
/// When you enable feedback forwarding, Amazon Pinpoint sends you email notifications
/// when bounce or complaint events occur. Amazon Pinpoint sends this notification to
/// the address that you specified in the Return-Path header of the original email.
/// </para>
///
/// <para>
/// When you disable feedback forwarding, Amazon Pinpoint sends notifications through
/// other mechanisms, such as by notifying an Amazon SNS topic. You're required to have
/// a method of tracking bounces and complaints. If you haven't set up another mechanism
/// for receiving bounce or complaint notifications, Amazon Pinpoint sends an email notification
/// when these events occur (even if this setting is disabled).
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityFeedbackAttributes service method.</param>
///
/// <returns>The response from the PutEmailIdentityFeedbackAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityFeedbackAttributes">REST API Reference for PutEmailIdentityFeedbackAttributes Operation</seealso>
PutEmailIdentityFeedbackAttributesResponse PutEmailIdentityFeedbackAttributes(PutEmailIdentityFeedbackAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutEmailIdentityFeedbackAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityFeedbackAttributes operation on AmazonPinpointEmailClient.</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 EndPutEmailIdentityFeedbackAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityFeedbackAttributes">REST API Reference for PutEmailIdentityFeedbackAttributes Operation</seealso>
IAsyncResult BeginPutEmailIdentityFeedbackAttributes(PutEmailIdentityFeedbackAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutEmailIdentityFeedbackAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutEmailIdentityFeedbackAttributes.</param>
///
/// <returns>Returns a PutEmailIdentityFeedbackAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityFeedbackAttributes">REST API Reference for PutEmailIdentityFeedbackAttributes Operation</seealso>
PutEmailIdentityFeedbackAttributesResponse EndPutEmailIdentityFeedbackAttributes(IAsyncResult asyncResult);
#endregion
#region PutEmailIdentityMailFromAttributes
/// <summary>
/// Used to enable or disable the custom Mail-From domain configuration for an email identity.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityMailFromAttributes service method.</param>
///
/// <returns>The response from the PutEmailIdentityMailFromAttributes service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityMailFromAttributes">REST API Reference for PutEmailIdentityMailFromAttributes Operation</seealso>
PutEmailIdentityMailFromAttributesResponse PutEmailIdentityMailFromAttributes(PutEmailIdentityMailFromAttributesRequest request);
/// <summary>
/// Initiates the asynchronous execution of the PutEmailIdentityMailFromAttributes operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutEmailIdentityMailFromAttributes operation on AmazonPinpointEmailClient.</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 EndPutEmailIdentityMailFromAttributes
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityMailFromAttributes">REST API Reference for PutEmailIdentityMailFromAttributes Operation</seealso>
IAsyncResult BeginPutEmailIdentityMailFromAttributes(PutEmailIdentityMailFromAttributesRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the PutEmailIdentityMailFromAttributes operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutEmailIdentityMailFromAttributes.</param>
///
/// <returns>Returns a PutEmailIdentityMailFromAttributesResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/PutEmailIdentityMailFromAttributes">REST API Reference for PutEmailIdentityMailFromAttributes Operation</seealso>
PutEmailIdentityMailFromAttributesResponse EndPutEmailIdentityMailFromAttributes(IAsyncResult asyncResult);
#endregion
#region SendEmail
/// <summary>
/// Sends an email message. You can use the Amazon Pinpoint Email API to send two types
/// of messages:
///
/// <ul> <li>
/// <para>
/// <b>Simple</b> – A standard email message. When you create this type of message, you
/// specify the sender, the recipient, and the message body, and Amazon Pinpoint assembles
/// the message for you.
/// </para>
/// </li> <li>
/// <para>
/// <b>Raw</b> – A raw, MIME-formatted email message. When you send this type of email,
/// you have to specify all of the message headers, as well as the message body. You can
/// use this message type to send messages that contain attachments. The message that
/// you specify has to be a valid MIME message.
/// </para>
/// </li> </ul>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the SendEmail service method.</param>
///
/// <returns>The response from the SendEmail service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.AccountSuspendedException">
/// The message can't be sent because the account's ability to send email has been permanently
/// restricted.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.LimitExceededException">
/// There are too many instances of the specified resource type.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.MailFromDomainNotVerifiedException">
/// The message can't be sent because the sending domain isn't verified.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.MessageRejectedException">
/// The message can't be sent because it contains invalid content.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.SendingPausedException">
/// The message can't be sent because the account's ability to send email is currently
/// paused.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/SendEmail">REST API Reference for SendEmail Operation</seealso>
SendEmailResponse SendEmail(SendEmailRequest request);
/// <summary>
/// Initiates the asynchronous execution of the SendEmail operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the SendEmail operation on AmazonPinpointEmailClient.</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 EndSendEmail
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/SendEmail">REST API Reference for SendEmail Operation</seealso>
IAsyncResult BeginSendEmail(SendEmailRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the SendEmail operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginSendEmail.</param>
///
/// <returns>Returns a SendEmailResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/SendEmail">REST API Reference for SendEmail Operation</seealso>
SendEmailResponse EndSendEmail(IAsyncResult asyncResult);
#endregion
#region TagResource
/// <summary>
/// Add one or more tags (keys and values) to a specified resource. A <i>tag</i> is a
/// label that you optionally define and associate with a resource in Amazon Pinpoint.
/// Tags can help you categorize and manage resources in different ways, such as by purpose,
/// owner, environment, or other criteria. A resource can have as many as 50 tags.
///
///
/// <para>
/// Each tag consists of a required <i>tag key</i> and an associated <i>tag value</i>,
/// both of which you define. A tag key is a general label that acts as a category for
/// more specific tag values. A tag value acts as a descriptor within a tag key.
/// </para>
/// </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 PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/TagResource">REST API Reference for TagResource Operation</seealso>
TagResourceResponse TagResource(TagResourceRequest request);
/// <summary>
/// Initiates the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TagResource operation on AmazonPinpointEmailClient.</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/pinpoint-email-2018-07-26/TagResource">REST API Reference for TagResource Operation</seealso>
IAsyncResult BeginTagResource(TagResourceRequest request, AsyncCallback callback, object 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 PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/TagResource">REST API Reference for TagResource Operation</seealso>
TagResourceResponse EndTagResource(IAsyncResult asyncResult);
#endregion
#region UntagResource
/// <summary>
/// Remove one or more tags (keys and values) from a specified 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 PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.ConcurrentModificationException">
/// The resource is being modified by another operation or thread.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/UntagResource">REST API Reference for UntagResource Operation</seealso>
UntagResourceResponse UntagResource(UntagResourceRequest request);
/// <summary>
/// Initiates the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UntagResource operation on AmazonPinpointEmailClient.</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/pinpoint-email-2018-07-26/UntagResource">REST API Reference for UntagResource Operation</seealso>
IAsyncResult BeginUntagResource(UntagResourceRequest request, AsyncCallback callback, object 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 PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/UntagResource">REST API Reference for UntagResource Operation</seealso>
UntagResourceResponse EndUntagResource(IAsyncResult asyncResult);
#endregion
#region UpdateConfigurationSetEventDestination
/// <summary>
/// Update the configuration of an event destination for a configuration set.
///
///
/// <para>
/// In Amazon Pinpoint, <i>events</i> include message sends, deliveries, opens, clicks,
/// bounces, and complaints. <i>Event destinations</i> are places that you can send information
/// about these events to. For example, you can send event data to Amazon SNS to receive
/// notifications when you receive bounces or complaints, or you can use Amazon Kinesis
/// Data Firehose to stream data to Amazon S3 for long-term storage.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateConfigurationSetEventDestination service method.</param>
///
/// <returns>The response from the UpdateConfigurationSetEventDestination service method, as returned by PinpointEmail.</returns>
/// <exception cref="Amazon.PinpointEmail.Model.BadRequestException">
/// The input you provided is invalid.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.NotFoundException">
/// The resource you attempted to access doesn't exist.
/// </exception>
/// <exception cref="Amazon.PinpointEmail.Model.TooManyRequestsException">
/// Too many requests have been made to the operation.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/UpdateConfigurationSetEventDestination">REST API Reference for UpdateConfigurationSetEventDestination Operation</seealso>
UpdateConfigurationSetEventDestinationResponse UpdateConfigurationSetEventDestination(UpdateConfigurationSetEventDestinationRequest request);
/// <summary>
/// Initiates the asynchronous execution of the UpdateConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateConfigurationSetEventDestination operation on AmazonPinpointEmailClient.</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 EndUpdateConfigurationSetEventDestination
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/UpdateConfigurationSetEventDestination">REST API Reference for UpdateConfigurationSetEventDestination Operation</seealso>
IAsyncResult BeginUpdateConfigurationSetEventDestination(UpdateConfigurationSetEventDestinationRequest request, AsyncCallback callback, object state);
/// <summary>
/// Finishes the asynchronous execution of the UpdateConfigurationSetEventDestination operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUpdateConfigurationSetEventDestination.</param>
///
/// <returns>Returns a UpdateConfigurationSetEventDestinationResult from PinpointEmail.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/pinpoint-email-2018-07-26/UpdateConfigurationSetEventDestination">REST API Reference for UpdateConfigurationSetEventDestination Operation</seealso>
UpdateConfigurationSetEventDestinationResponse EndUpdateConfigurationSetEventDestination(IAsyncResult asyncResult);
#endregion
}
} | 63.837132 | 214 | 0.686294 | [
"Apache-2.0"
] | philasmar/aws-sdk-net | sdk/src/Services/PinpointEmail/Generated/_bcl35/IAmazonPinpointEmail.cs | 154,052 | C# |
/********************************************************************++
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System;
using System.Collections.Concurrent;
using System.ComponentModel;
using System.Globalization;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Activities;
using System.Diagnostics;
using System.Management.Automation;
using System.Management.Automation.Language;
using System.Management.Automation.Runspaces;
namespace Microsoft.PowerShell.Activities
{
/// <summary>
/// Evaluate the Powershell expression and return the value of type T.
/// </summary>
public sealed class PowerShellValue<T> : NativeActivity<T>
{
/// <summary>
/// The PowerShell expression, which will be evaluated and retuned a type of T value.
/// </summary>
[RequiredArgument]
public string Expression { get; set; }
/// <summary>
/// Determines whether to connect the input stream for this activity.
/// </summary>
[DefaultValue(false)]
public bool UseDefaultInput
{
get;
set;
}
/// <summary>
/// Validates the syntax of the script text for this activity.
/// </summary>
/// <param name="metadata">Activity metatdata for this activity</param>
protected override void CacheMetadata(NativeActivityMetadata metadata)
{
base.CacheMetadata(metadata);
if (!string.IsNullOrWhiteSpace(Expression))
{
var errors = new Collection<PSParseError>();
PSParser.Tokenize(Expression, out errors);
if (errors != null && errors.Count > 0)
{
string compositeErrorString = "";
foreach (var e in errors)
{
// Format and add each error message...
compositeErrorString += string.Format(CultureInfo.InvariantCulture,
"[{0}, {1}]: {2}\n", e.Token.StartLine, e.Token.StartColumn, e.Message);
}
metadata.AddValidationError(compositeErrorString);
}
}
}
/// <summary>
/// Get the scriptblock for this activity, caching it once it's compiled.
/// </summary>
private ScriptBlock ExpressionScriptBlock
{
get
{
if (_expressionScriptBlock == null)
{
lock (syncroot)
{
if (_expressionScriptBlock == null)
{
// The guard check for a null expression string is done in Execute() instead
// of in this property. It's also done in the validation check for CacheMetadata
string updatedExpression = Expression;
// Hack to make sure the $input *does* get unrolled...
if (string.Equals("$input", Expression.Trim(), StringComparison.OrdinalIgnoreCase))
{
updatedExpression = "$(" + updatedExpression + "\n)";
}
else
{
Token[] tokens;
ParseError[] errors;
ScriptBlockAst exprAst = Parser.ParseInput(updatedExpression, out tokens, out errors);
if (errors.Length > 0)
{
throw new ParseException(errors);
}
if (exprAst.BeginBlock == null && exprAst.ProcessBlock == null && exprAst.EndBlock != null)
{
var statements = exprAst.EndBlock.Statements;
if (statements != null && statements.Count == 1)
{
PipelineAst pipeline = statements[0] as PipelineAst;
if (pipeline != null && pipeline.GetPureExpression() != null)
{
// It is very difficult to get equivalent expression semantics in workflow because the engine
// APIs get in the way necessitating a lot of fiddling with the actual expression as well as post-processing
// the result of the expression.
// We wrap a pure expression in an array so that PowerShell's loop unrolling doesn't impact our
// ability to return collections. We also add a trap/break so that terminating errors in expressions
// are turned into exceptions for the PowerShell object. The trap and closing ')' go on their own line
// for the XAML designer case where the expression might have a trailing '#' making the rest of the
// line into a comment.
updatedExpression = ",(" + updatedExpression + "\n); trap { break }";
}
}
}
}
_expressionScriptBlock = ScriptBlock.Create(updatedExpression);
}
}
}
return _expressionScriptBlock;
}
}
ScriptBlock _expressionScriptBlock;
/// <summary>
/// Check to see if the expression only uses elements of the restricted language
/// as well as only using the allowed commands and variables.
/// </summary>
/// <param name="allowedCommands">
/// List of command names to allow in the expression
/// </param>
/// <param name="allowedVariables">
/// List of variable names to allow in the expression. If the collection contains a single
/// element "*", all variables will be allowed including environment variables
/// functions, etc.
/// </param>
/// <param name="allowEnvironmentVariables">
/// If true, environment variables are allowed even if the allowedVariables list is empty.
/// </param>
public void ValidateExpressionConstraints(IEnumerable<string> allowedCommands, IEnumerable<string> allowedVariables, bool allowEnvironmentVariables)
{
ExpressionScriptBlock.CheckRestrictedLanguage(allowedCommands, allowedVariables, allowEnvironmentVariables);
}
/// <summary>
/// Execution of PowerShell value activity.
/// PowerShell expression will be evaluated using PowerShell runspace and the value of Type T will be returned.
/// </summary>
/// <param name="context"></param>
protected override void Execute(NativeActivityContext context)
{
Token[] tokens;
ParseError[] errors;
ScriptBlockAst exprAst = Parser.ParseInput(Expression, out tokens, out errors);
bool hasErrorActionPreference = false;
bool hasWarningPreference = false;
bool hasInformationPreference = false;
// Custom activity participant tracker for updating debugger with current variables and sequence stop points.
// Regex looks for debugger sequence points like: Expression="'3:5:WFFunc1'".
// We specifically disallow TimeSpan values that look like sequence points: Expression="'00:00:01'".
bool isDebugSequencePoint = (!string.IsNullOrEmpty(Expression) && (System.Text.RegularExpressions.Regex.IsMatch(Expression, @"^'\d+:\d+:\S+'$")) &&
(typeof(T) != typeof(System.TimeSpan)));
var dataProperties = context.DataContext.GetProperties();
if (isDebugSequencePoint || (dataProperties.Count > 0))
{
System.Activities.Tracking.CustomTrackingRecord customRecord = new System.Activities.Tracking.CustomTrackingRecord("PSWorkflowCustomUpdateDebugVariablesTrackingRecord");
foreach (System.ComponentModel.PropertyDescriptor property in dataProperties)
{
if (String.Equals(property.Name, "ParameterDefaults", StringComparison.OrdinalIgnoreCase)) { continue; }
Object value = property.GetValue(context.DataContext);
if (value != null)
{
object tempValue = value;
PSDataCollection<PSObject> collectionObject = value as PSDataCollection<PSObject>;
if (collectionObject != null && collectionObject.Count == 1)
{
tempValue = collectionObject[0];
}
customRecord.Data.Add(property.Name, tempValue);
}
}
if (isDebugSequencePoint)
{
customRecord.Data.Add("DebugSequencePoint", Expression);
}
context.Track(customRecord);
}
if (tokens != null)
{
foreach(Token token in tokens)
{
VariableToken variable = token as VariableToken;
if (variable != null)
{
if (variable.Name.Equals("ErrorActionPreference", StringComparison.OrdinalIgnoreCase))
{
hasErrorActionPreference = true;
}
else if (variable.Name.Equals("WarningPreference", StringComparison.OrdinalIgnoreCase))
{
hasWarningPreference = true;
}
else if (variable.Name.Equals("InformationPreference", StringComparison.OrdinalIgnoreCase))
{
hasInformationPreference = true;
}
}
}
}
if (string.IsNullOrEmpty(Expression))
{
throw new ArgumentException(ActivityResources.NullArgumentExpression);
}
if (_ci == null)
{
lock (syncroot)
{
// Invoke using the CommandInfo for Invoke-Command directly, rather than going through
// command discovery (which is very slow).
if (_ci == null)
{
_ci = new CmdletInfo("Invoke-Command", typeof(Microsoft.PowerShell.Commands.InvokeCommandCommand));
}
}
}
Collection<PSObject> returnedvalue;
Runspace runspace = null;
bool borrowedRunspace = false;
PSWorkflowHost workflowHost = null;
if (typeof(ScriptBlock).IsAssignableFrom(typeof(T)))
{
Result.Set(context, ScriptBlock.Create(Expression));
return;
}
else if (typeof(ScriptBlock[]).IsAssignableFrom(typeof(T)))
{
Result.Set(context, new ScriptBlock[] { ScriptBlock.Create(Expression) });
return;
}
PropertyDescriptorCollection col = context.DataContext.GetProperties();
HostParameterDefaults hostValues = context.GetExtension<HostParameterDefaults>();
// Borrow a runspace from the host if we're not trying to create a ScriptBlock.
// If we are trying to create one, we need to keep it around so that it can be
// invoked multiple times.
if (hostValues != null)
{
workflowHost = hostValues.Runtime;
try
{
runspace = workflowHost.UnboundedLocalRunspaceProvider.GetRunspace(null, 0, 0);
borrowedRunspace = true;
}
catch (Exception)
{
// it is fine to catch generic exception here
// if the local runspace provider does not give us
// a runspace we will create one locally (fallback)
}
}
if (runspace == null)
{
// Not running with the PowerShell workflow host so directly create the runspace...
runspace = RunspaceFactory.CreateRunspace(InitialSessionState.CreateDefault2());
runspace.Open();
}
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create())
{
try
{
ps.Runspace = runspace;
// Subscribe to DataAdding on the error stream so that we can add position tracking information
if (hostValues != null)
{
HostSettingCommandMetadata sourceCommandMetadata = hostValues.HostCommandMetadata;
CommandMetadataTable.TryAdd(ps.InstanceId, sourceCommandMetadata);
ps.Streams.Error.DataAdding += HandleErrorDataAdding;
}
// First, set the variables from the host defaults
if ((hostValues != null) && (hostValues.Parameters != null))
{
if (hostValues.Parameters.ContainsKey("PSCurrentDirectory"))
{
string path = hostValues.Parameters["PSCurrentDirectory"] as string;
if (path != null)
{
ps.Runspace.SessionStateProxy.Path.SetLocation(path);
}
}
foreach (string hostDefault in hostValues.Parameters.Keys)
{
string mappedHostDefault = hostDefault;
if (hostDefault.Equals("ErrorAction", StringComparison.OrdinalIgnoreCase))
{
if (hasErrorActionPreference)
{
mappedHostDefault = "ErrorActionPreference";
}
else
{
continue;
}
}
else if (hostDefault.Equals("WarningAction", StringComparison.OrdinalIgnoreCase))
{
if (hasWarningPreference)
{
mappedHostDefault = "WarningPreference";
}
else
{
continue;
}
}
else if (hostDefault.Equals("InformationAction", StringComparison.OrdinalIgnoreCase))
{
if (hasInformationPreference)
{
mappedHostDefault = "InformationPreference";
}
else
{
continue;
}
}
object propertyValue = hostValues.Parameters[hostDefault];
if (propertyValue != null)
{
ps.Runspace.SessionStateProxy.PSVariable.Set(mappedHostDefault, propertyValue);
}
}
}
// Then, set the variables from the workflow
foreach (PropertyDescriptor p in col)
{
string name = p.Name;
object value = p.GetValue(context.DataContext);
if (value != null)
{
object tempValue = value;
PSDataCollection<PSObject> collectionObject = value as PSDataCollection<PSObject>;
if (collectionObject != null && collectionObject.Count == 1)
{
tempValue = collectionObject[0];
}
ps.Runspace.SessionStateProxy.PSVariable.Set(name, tempValue);
}
}
ps.AddCommand(_ci).AddParameter("NoNewScope").AddParameter("ScriptBlock", ExpressionScriptBlock);
// If this needs to consume input, take it from the host stream.
PSDataCollection<PSObject> inputStream = null;
if (UseDefaultInput)
{
// Retrieve our host overrides
hostValues = context.GetExtension<HostParameterDefaults>();
if (hostValues != null)
{
Dictionary<string, object> incomingArguments = hostValues.Parameters;
if (incomingArguments.ContainsKey("Input"))
{
inputStream = incomingArguments["Input"] as PSDataCollection<PSObject>;
}
}
}
// Now invoke the pipeline
try
{
if (inputStream != null)
{
returnedvalue = ps.Invoke(inputStream);
inputStream.Clear();
}
else
{
returnedvalue = ps.Invoke();
}
}
catch (CmdletInvocationException cie)
{
if (cie.ErrorRecord != null && cie.ErrorRecord.Exception != null)
{
throw cie.InnerException;
}
else
{
throw;
}
}
}
finally
{
if (hostValues != null)
{
ps.Streams.Error.DataAdding -= HandleErrorDataAdding;
HostSettingCommandMetadata removedValue;
CommandMetadataTable.TryRemove(ps.InstanceId, out removedValue);
}
if (borrowedRunspace)
{
workflowHost.UnboundedLocalRunspaceProvider.ReleaseRunspace(runspace);
}
else
{
// This will be disposed when the command is done with it.
runspace.Dispose();
runspace = null;
}
}
if (ps.Streams.Error != null && ps.Streams.Error.Count > 0)
{
PSDataCollection<ErrorRecord> errorStream = null;
// Retrieve our host overrides
hostValues = context.GetExtension<HostParameterDefaults>();
if (hostValues != null)
{
Dictionary<string, object> incomingArguments = hostValues.Parameters;
if (incomingArguments.ContainsKey("PSError"))
{
errorStream = incomingArguments["PSError"] as PSDataCollection<ErrorRecord>;
}
}
if (errorStream != null && errorStream.IsOpen)
{
foreach (ErrorRecord record in ps.Streams.Error)
{
errorStream.Add(record);
}
}
}
T valueToReturn = default(T);
if (returnedvalue != null && returnedvalue.Count > 0)
{
try
{
if (returnedvalue.Count == 1)
{
if (returnedvalue[0] != null)
{
Object result = returnedvalue[0];
Object baseObject = ((PSObject)result).BaseObject;
if (! (baseObject is PSCustomObject))
{
result = baseObject;
}
// Try regular PowerShell conversion
valueToReturn = LanguagePrimitives.ConvertTo<T>( result );
}
}
else
{
valueToReturn = LanguagePrimitives.ConvertTo<T>(returnedvalue);
}
}
catch (PSInvalidCastException)
{
// Handle the special case of emitting a PSDataCollection - use its array constructor.
// This special case is why we aren't using PowerShell.Invoke<T>
if (typeof(T) == typeof(PSDataCollection<PSObject>))
{
Object tempValueToReturn = new PSDataCollection<PSObject>(
new List<PSObject> { LanguagePrimitives.ConvertTo<PSObject>(returnedvalue[0]) });
valueToReturn = (T)tempValueToReturn;
}
else
{
throw;
}
}
Result.Set(context, valueToReturn);
}
}
}
private static void HandleErrorDataAdding(object sender, DataAddingEventArgs e)
{
HostSettingCommandMetadata commandMetadata;
CommandMetadataTable.TryGetValue(e.PowerShellInstanceId, out commandMetadata);
if (commandMetadata != null)
{
PowerShellInvocation_ErrorAdding(sender, e, commandMetadata);
}
}
private static readonly ConcurrentDictionary<Guid, HostSettingCommandMetadata> CommandMetadataTable =
new ConcurrentDictionary<Guid, HostSettingCommandMetadata>();
private static void PowerShellInvocation_ErrorAdding(object sender, DataAddingEventArgs e, HostSettingCommandMetadata commandMetadata)
{
ErrorRecord errorRecord = e.ItemAdded as ErrorRecord;
if (errorRecord != null)
{
if (commandMetadata != null)
{
ScriptPosition scriptStart = new ScriptPosition(
commandMetadata.CommandName,
commandMetadata.StartLineNumber,
commandMetadata.StartColumnNumber,
null);
ScriptPosition scriptEnd = new ScriptPosition(
commandMetadata.CommandName,
commandMetadata.EndLineNumber,
commandMetadata.EndColumnNumber,
null);
ScriptExtent extent = new ScriptExtent(scriptStart, scriptEnd);
if (errorRecord.InvocationInfo != null)
{
errorRecord.InvocationInfo.DisplayScriptPosition = extent;
}
}
}
}
static CommandInfo _ci;
static object syncroot = new object();
}
}
| 44.339823 | 185 | 0.460203 | [
"Apache-2.0",
"MIT"
] | HydAu/PowerShell | src/Microsoft.PowerShell.Activities/Activities/PowerShellValue.cs | 25,054 | C# |
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace ModComponentMapper
{
public struct GearSpawnInfo
{
public Vector3 Position;
public string PrefabName;
public Quaternion Rotation;
public float SpawnChance;
}
public struct LootTableEntry
{
public string PrefabName;
public int Weight;
}
public class GearSpawner
{
private static Dictionary<string, List<GearSpawnInfo>> gearSpawnInfos = new Dictionary<string, List<GearSpawnInfo>>();
private static Dictionary<string, List<LootTableEntry>> lootTableEntries = new Dictionary<string, List<LootTableEntry>>();
internal static void AddGearSpawnInfo(string sceneName, GearSpawnInfo gearSpawnInfo)
{
string normalizedSceneName = GetNormalizedSceneName(sceneName);
if (!gearSpawnInfos.ContainsKey(normalizedSceneName))
{
gearSpawnInfos.Add(normalizedSceneName, new List<GearSpawnInfo>());
}
List<GearSpawnInfo> sceneGearSpawnInfos = gearSpawnInfos[normalizedSceneName];
sceneGearSpawnInfos.Add(gearSpawnInfo);
}
internal static void AddLootTableEntry(string lootTable, LootTableEntry entry)
{
string normalizedLootTableName = GetNormalizedLootTableName(lootTable);
if (!lootTableEntries.ContainsKey(normalizedLootTableName))
{
lootTableEntries.Add(normalizedLootTableName, new List<LootTableEntry>());
}
entry.PrefabName = NormalizePrefabName(entry.PrefabName);
entry.Weight = Mathf.Clamp(entry.Weight, 0, int.MaxValue);
lootTableEntries[normalizedLootTableName].Add(entry);
}
internal static void Initialize()
{
UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
GearSpawnReader.ReadDefinitions();
}
private static void AddEntries(LootTable lootTable, List<LootTableEntry> entries)
{
foreach (LootTableEntry eachEntry in entries)
{
int index = GetIndex(lootTable, eachEntry.PrefabName);
if (index != -1)
{
lootTable.m_Weights[index] = eachEntry.Weight;
continue;
}
GameObject prefab = (GameObject)Resources.Load(eachEntry.PrefabName);
if (prefab == null)
{
LogUtils.Log("Could not find prefab '" + eachEntry.PrefabName + "'.");
continue;
}
lootTable.m_Prefabs.Add(prefab);
lootTable.m_Weights.Add(eachEntry.Weight);
}
}
private static void ConfigureLootTables(string sceneName)
{
LootTable[] lootTables = Resources.FindObjectsOfTypeAll<LootTable>();
foreach (LootTable eachLootTable in lootTables)
{
List<LootTableEntry> entries;
if (lootTableEntries.TryGetValue(eachLootTable.name.ToLower(), out entries))
{
AddEntries(eachLootTable, entries);
}
}
}
private static int GetIndex(LootTable lootTable, string prefabName)
{
for (int i = 0; i < lootTable.m_Prefabs.Count; i++)
{
if (lootTable.m_Prefabs[i] != null && lootTable.m_Prefabs[i].name.Equals(prefabName, System.StringComparison.InvariantCultureIgnoreCase))
{
return i;
}
}
return -1;
}
private static string GetNormalizedGearName(string gearName)
{
if (gearName != null && !gearName.ToLower().StartsWith("gear_"))
{
return "gear_" + gearName;
}
return gearName;
}
private static string GetNormalizedLootTableName(string lootTable)
{
if (lootTable.StartsWith("Loot", System.StringComparison.InvariantCultureIgnoreCase))
{
return lootTable.ToLower();
}
if (lootTable.StartsWith("Cargo", System.StringComparison.InvariantCultureIgnoreCase))
{
return "loot" + lootTable.ToLower();
}
return "loottable" + lootTable.ToLower();
}
private static string GetNormalizedSceneName(string sceneName)
{
return sceneName.ToLower();
}
private static IEnumerable<GearSpawnInfo> GetSpawnInfos(string sceneName)
{
List<GearSpawnInfo> result;
gearSpawnInfos.TryGetValue(sceneName, out result);
return result;
}
private static string NormalizePrefabName(string prefabName)
{
if (!prefabName.StartsWith("gear_", System.StringComparison.InvariantCultureIgnoreCase))
{
return "gear_" + prefabName;
}
return prefabName;
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (scene != null && !string.IsNullOrEmpty(scene.name) && scene.name != "Empty" && mode == LoadSceneMode.Single)
{
PrepareScene(scene.name);
}
}
private static void PrepareScene(string sceneName)
{
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();
string normalizedSceneName = GetNormalizedSceneName(sceneName);
ConfigureLootTables(normalizedSceneName);
SpawnGearForScene(normalizedSceneName);
stopwatch.Stop();
LogUtils.Log("Prepared scene '{0}' in {1} ms", sceneName, stopwatch.ElapsedMilliseconds);
}
private static void SpawnGearForScene(string sceneName)
{
IEnumerable<GearSpawnInfo> sceneGearSpawnInfos = GetSpawnInfos(sceneName);
if (sceneGearSpawnInfos == null)
{
return;
}
foreach (GearSpawnInfo eachGearSpawnInfo in sceneGearSpawnInfos)
{
string normalizedGearName = GetNormalizedGearName(eachGearSpawnInfo.PrefabName);
Object prefab = Resources.Load(normalizedGearName);
if (prefab == null)
{
LogUtils.Log("Could not find prefab '{0}' to spawn in scene '{1}'.", eachGearSpawnInfo.PrefabName, sceneName);
continue;
}
if (Utils.RollChance(eachGearSpawnInfo.SpawnChance))
{
Object gear = Object.Instantiate(prefab, eachGearSpawnInfo.Position, eachGearSpawnInfo.Rotation);
gear.name = prefab.name;
}
}
}
}
} | 34.317073 | 153 | 0.579673 | [
"MIT"
] | nbakulev/ModComponent | ModComponentMapper/src/GearSpawner.cs | 7,037 | C# |
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace aws
{
#pragma warning disable CS8618
[JsiiByValue(fqn: "aws.ConfigConfigurationAggregatorConfig")]
public class ConfigConfigurationAggregatorConfig : aws.IConfigConfigurationAggregatorConfig
{
[JsiiProperty(name: "name", typeJson: "{\"primitive\":\"string\"}", isOverride: true)]
public string Name
{
get;
set;
}
/// <summary>account_aggregation_source block.</summary>
[JsiiOptional]
[JsiiProperty(name: "accountAggregationSource", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"aws.ConfigConfigurationAggregatorAccountAggregationSource\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)]
public aws.IConfigConfigurationAggregatorAccountAggregationSource[]? AccountAggregationSource
{
get;
set;
}
/// <summary>organization_aggregation_source block.</summary>
[JsiiOptional]
[JsiiProperty(name: "organizationAggregationSource", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"aws.ConfigConfigurationAggregatorOrganizationAggregationSource\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)]
public aws.IConfigConfigurationAggregatorOrganizationAggregationSource[]? OrganizationAggregationSource
{
get;
set;
}
[JsiiOptional]
[JsiiProperty(name: "tags", typeJson: "{\"collection\":{\"elementtype\":{\"primitive\":\"string\"},\"kind\":\"map\"}}", isOptional: true, isOverride: true)]
public System.Collections.Generic.IDictionary<string, string>? Tags
{
get;
set;
}
/// <remarks>
/// <strong>Stability</strong>: Experimental
/// </remarks>
[JsiiOptional]
[JsiiProperty(name: "count", typeJson: "{\"primitive\":\"number\"}", isOptional: true, isOverride: true)]
public double? Count
{
get;
set;
}
/// <remarks>
/// <strong>Stability</strong>: Experimental
/// </remarks>
[JsiiOptional]
[JsiiProperty(name: "dependsOn", typeJson: "{\"collection\":{\"elementtype\":{\"fqn\":\"cdktf.ITerraformDependable\"},\"kind\":\"array\"}}", isOptional: true, isOverride: true)]
public HashiCorp.Cdktf.ITerraformDependable[]? DependsOn
{
get;
set;
}
/// <remarks>
/// <strong>Stability</strong>: Experimental
/// </remarks>
[JsiiOptional]
[JsiiProperty(name: "lifecycle", typeJson: "{\"fqn\":\"cdktf.TerraformResourceLifecycle\"}", isOptional: true, isOverride: true)]
public HashiCorp.Cdktf.ITerraformResourceLifecycle? Lifecycle
{
get;
set;
}
/// <remarks>
/// <strong>Stability</strong>: Experimental
/// </remarks>
[JsiiOptional]
[JsiiProperty(name: "provider", typeJson: "{\"fqn\":\"cdktf.TerraformProvider\"}", isOptional: true, isOverride: true)]
public HashiCorp.Cdktf.TerraformProvider? Provider
{
get;
set;
}
}
}
| 36.4 | 241 | 0.594322 | [
"MIT"
] | scottenriquez/cdktf-alpha-csharp-testing | resources/.gen/aws/aws/ConfigConfigurationAggregatorConfig.cs | 3,276 | C# |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Windows.Data;
namespace FlightPlannerWPF.Converters
{
public class VisibilityNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is null)
{
return Visibility.Hidden;
}
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
| 23.518519 | 101 | 0.675591 | [
"MIT"
] | Daxxn/FlightPlanner | FlightPlannerWPF/Converters/VisibilityNullConverter.cs | 637 | C# |
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using PdfSharp.Pdf;
namespace PdfSharp.Explorer.Pages
{
/// <summary>
///
/// </summary>
public class MainPagesPage : MainObjectsPageBase
{
private System.ComponentModel.Container components = null;
public MainPagesPage(ExplorerPanel explorer)
: base(explorer)
{
InitializeComponent();
explorer.lvPages.SelectedIndexChanged += new System.EventHandler(this.lvPages_SelectedIndexChanged);
}
//void ActivatePage(PdfPage page)
//{
// //if (this.currentPage != null)
// //{
// // this.Controls.Remove(this.currentPage);
// // this.currentPage = null;
// //}
//
// if (this.currentPage == null)
// {
// this.currentPage = new DictionaryPage(this.explorer);
// this.Controls.Add(this.currentPage);
// this.currentPage.Dock = DockStyle.Fill;
// }
// this.currentPage.SetObject(page);
// currentPage.UpdateDocument();
//}
//PageBase currentPage;
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// MainPagesPage
//
this.Name = "MainPagesPage";
this.Tag = "Pages";
}
#endregion
private void lvPages_SelectedIndexChanged(object sender, System.EventArgs e)
{
ListView.SelectedListViewItemCollection items = this.explorer.lvPages.SelectedItems;
if (items.Count > 0)
{
ListViewItem item = items[0];
ActivatePage((PdfObject)item.Tag);
}
}
}
}
| 24.833333 | 106 | 0.620805 | [
"MIT"
] | HiraokaHyperTools/PDFsharp | PDFsharp/dev/Pdfsharp.Explorer/PdfSharp.Explorer.Pages/MainPagesPage.cs | 2,086 | C# |
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public static class Uni2DEditorContourPolygonizationUtils
{
public static List<Contour> MergeInnerAndOuterContours( List<Contour> a_rOuterContours, List<Contour> a_rInnerContours )
{
// Step 0: Sort the contours by region and their max x-value
a_rOuterContours.Sort( );
a_rInnerContours.Sort( );
// Step 1: Insert every inner contours to corresponding outer contours
List<Contour> oMergedContoursList = new List<Contour>( a_rOuterContours.Count );
foreach( Contour rOuterContour in a_rOuterContours )
{
Contour rMergedContour = rOuterContour;
// Loop over inner contours
foreach( Contour rInnerContour in a_rInnerContours )
{
if( rInnerContour.Region == rMergedContour.Region )
{
// Insert inner contour into outer contour
rMergedContour = Uni2DEditorPolygonTriangulationUtils.InsertInnerContourIntoOuterContour( rMergedContour, rInnerContour );
}
else if( rInnerContour.Region > rMergedContour.Region ) // inner contours are sorted by region...
{
break; // ... so stop if inner contour region greater than outer contour region
}
}
if( rMergedContour.Count > 2 )
{
oMergedContoursList.Add( rMergedContour );
}
}
return oMergedContoursList;
}
public static List<Contour> SimplifyContours( List<Contour> a_rOuterContours, float a_fAccuracy )
{
List<Contour> oSimplifiedContoursList = new List<Contour>( a_rOuterContours.Count );
foreach( Contour rOuterContour in a_rOuterContours )
{
// Simplify the new outer contour
List<Vector2> oOuterContourVertices = new List<Vector2>( rOuterContour.Vertices );
List<Vector2> oSimplifiedOuterContourVertices = RamerDouglasPeuker( oOuterContourVertices, 0, oOuterContourVertices.Count - 1, a_fAccuracy );
if( oSimplifiedOuterContourVertices.Count > 2 )
{
// Create the contour
Contour oSimplifiedOuterContour = new Contour( rOuterContour.Region );
oSimplifiedOuterContour.AddLast( oSimplifiedOuterContourVertices );
// Add the contour to the list
oSimplifiedContoursList.Add( oSimplifiedOuterContour );
}
}
return oSimplifiedContoursList;
}
public static List<Contour> SubdivideContours( List<Contour> a_rOuterContours, float a_fStep )
{
List<Contour> oIteratedContoursList = new List<Contour>( a_rOuterContours.Count );
foreach( Contour rOuterContour in a_rOuterContours )
{
// Simplify the new outer contour
List<Vector2> oOuterContourVertices = new List<Vector2>( rOuterContour.Vertices );
List<Vector2> oIteratedContourVertices = new List<Vector2>();
for(int i = 0; i < oOuterContourVertices.Count; ++i)
{
Vector2 f2SegmentBegin = oOuterContourVertices[i];
Vector2 f2SegmentEnd = oOuterContourVertices[(i+1)%oOuterContourVertices.Count];
Vector2 f2SegmentDirection = f2SegmentEnd - f2SegmentBegin;
float fSegmentLength = f2SegmentDirection.magnitude;
int iSubdivisionCount = Mathf.RoundToInt(fSegmentLength / a_fStep);
//iSubdivisionCount = 2;
oIteratedContourVertices.Add(f2SegmentBegin);
if(iSubdivisionCount > 1)
{
f2SegmentDirection /= fSegmentLength;
float fSubdivisionStep = fSegmentLength/(float)(iSubdivisionCount);
for(int iSubdivision = 1; iSubdivision < iSubdivisionCount; ++iSubdivision)
{
oIteratedContourVertices.Add(f2SegmentBegin + f2SegmentDirection * fSubdivisionStep * iSubdivision);
}
}
}
if( oIteratedContourVertices.Count > 2 )
{
// Create the contour
Contour oIteratedContour = new Contour( rOuterContour.Region );
oIteratedContour.AddLast( oIteratedContourVertices );
// Add the contour to the list
oIteratedContoursList.Add( oIteratedContour );
}
}
return oIteratedContoursList;
}
// The Douglas Peucker algorithm is an algorithm for reducing the number of points in a curve that is approximated by a series of points.
// The purpose of the algorithm is, given a curve composed of line segments, to find a similar curve with fewer points.
// The algorithm defines 'dissimilar' based on the maximum distance between the original curve and the simplified curve.
// The simplified curve consists of a subset of the points that defined the original curve.
public static List<Vector2> RamerDouglasPeuker( List<Vector2> a_rContour, int a_iStartingPixelIndex, int a_iEndingPixelIndex, float a_fAccuracy )
{
// List of dominant vertices that define the original curve
List<Vector2> oDominantContour = new List<Vector2>( );
// Create a line from the first vertex to the last index
Vector2 f2StartLineCoords = a_rContour[ a_iStartingPixelIndex ];
Vector2 f2EndLineCoords = a_rContour[ a_iEndingPixelIndex ];
float fDistanceMax = 0.0f;
int iDominantPixelIndex = -1;
// Looking for a dominant point which is further than the threshold distance (epsilon)
for( int iIndex = a_iStartingPixelIndex + 1; iIndex < a_iEndingPixelIndex; ++iIndex )
{
Vector2 f2ContourPointCoords = a_rContour[ iIndex ];
float fDistance = HandleUtility.DistancePointToLine( f2ContourPointCoords, f2StartLineCoords, f2EndLineCoords );
// New max distance to line
if( fDistance > fDistanceMax )
{
fDistanceMax = fDistance;
iDominantPixelIndex = iIndex;
}
}
// Dominant point found?
if( fDistanceMax > a_fAccuracy )
{
// Break the line in two at the dominant vertex and apply the algorithm recursively to these 2 segments.
List<Vector2> rDominantContourLeft = RamerDouglasPeuker( a_rContour, a_iStartingPixelIndex, iDominantPixelIndex, a_fAccuracy );
List<Vector2> rDominantContourRight = RamerDouglasPeuker( a_rContour, iDominantPixelIndex, a_iEndingPixelIndex, a_fAccuracy );
// Add the results
oDominantContour.AddRange( rDominantContourLeft );
oDominantContour.RemoveAt( oDominantContour.Count - 1 ); // Avoid duplication of end/start shared bound ( [1..iDominantIndex] U [iDominantIndex..End] )
oDominantContour.AddRange( rDominantContourRight );
}
else
{
// No dominant point found -> only the two vertices of the line are really needed
// to define this part of the curve.
oDominantContour.Add( f2StartLineCoords );
oDominantContour.Add( f2EndLineCoords );
}
return oDominantContour;
}
}
#endif | 37.857143 | 154 | 0.750472 | [
"MIT"
] | grifdail/GGJ2016 | GGJ2016/Assets/Root/Plugins/Uni2D/Sprite/Scripts/Sprite/Texture-to-mesh/Uni2DEditorContourPolygonizationUtils.cs | 6,360 | C# |
namespace Radix.Data;
public sealed class Ok<T, TError> : Result<T, TError> where T : notnull
{
internal Ok(T t)
{
if (t is not null)
{
Value = t;
}
else
{
throw new ArgumentNullException(nameof(t));
}
}
public T Value { get; }
public static implicit operator Ok<T, TError>(T t) => new(t);
public static implicit operator T(Ok<T, TError> ok) => ok.Value;
/// <summary>
/// Type deconstructor, don't remove even though no references are obvious
/// </summary>
/// <param name="value"></param>
public void Deconstruct(out T value) => value = Value;
public bool Equals(Ok<T, TError>? other)
{
if (ReferenceEquals(null, other))
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return EqualityComparer<T>.Default.Equals(Value, other.Value);
}
public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj.GetType() != GetType())
{
return false;
}
return Equals((Ok<T, TError>)obj);
}
public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode(Value);
public static bool operator ==(Ok<T, TError>? left, Ok<T, TError>? right) => Equals(left, right);
public static bool operator !=(Ok<T, TError>? left, Ok<T, TError>? right) => !Equals(left, right);
}
| 23.084507 | 102 | 0.541184 | [
"Apache-2.0"
] | MCGPPeters/Radix | C#/src/Radix/Data/Ok.cs | 1,639 | C# |
using System;
using System.Text;
using System.Collections.Generic;
namespace AirProperties
{
class ListItem
{
public ListItem(string name, string value)
{
Name = name;
Value = value;
}
public string Name { get; set; }
public string Value { get; set; }
public override string ToString()
{
return Name;
}
}
}
| 15.777778 | 50 | 0.530516 | [
"MIT"
] | SlavaRa/flashdevelop-macros | External/Plugins/AirProperties/Controls/ListItem.cs | 428 | C# |
using UnityEngine;
using MeshBuilder;
using Unity.Mathematics;
public class MarchingSquareTest4 : MonoBehaviour
{
private const string AdditiveLabel = "Add";
private const string SubtractiveLabel = "Subtract";
private const string IncreaseLabel = "Increase Height";
private const string DecreaseLabel = "Decrease Height";
private const string FlatLabel = "Flat";
private const string SmoothLabel = "Smooth";
private string[] ModeLabels = new string[] { AdditiveLabel, SubtractiveLabel, IncreaseLabel, DecreaseLabel };
private string[] ShapeLabels = new string[] { FlatLabel, SmoothLabel };
private const float MaxHeight = 1f;
enum Mode
{
Add, Subtract, IncreaseHeight, DecreaseHeight
}
private const float HeightChangeValue = 0.01f;
[SerializeField] private Camera cam = null;
[SerializeField] private MarchingSquaresComponent march1 = null;
[SerializeField] private float radius1 = 0.5f;
[SerializeField] private MarchingSquaresComponent march2 = null;
[SerializeField] private float radius2 = 0.35f;
private int modeIndex = 0;
private int brushIndex = 0;
private float maxHeight = MaxHeight * 0.5f;
[SerializeField] private UnityEngine.UI.Text buttonLabel = null;
[SerializeField] private GameObject brushRoot = null;
[SerializeField] private UnityEngine.UI.Text shapeLabel = null;
private float CellSize1 => march1.CellSize;
private float CellSize2 => march2.CellSize;
private MarchingSquaresMesher.Data data1 => march1.Data;
private MarchingSquaresMesher.Data data2 => march2.Data;
void Start()
{
DrawAt(new Vector3(5, 0, 5));
march1.Regenerate();
march2.Regenerate();
buttonLabel.text = ModeLabels[modeIndex];
brushRoot.SetActive(false);
}
void Update()
{
if (Input.GetMouseButton(0))
{
Vector3 pos = GetHitPosition(Input.mousePosition);
if (modeIndex == (int)Mode.Subtract)
{
EraseAt(pos);
}
else
{
DrawAt(pos);
}
march1.Regenerate();
march2.Regenerate();
}
}
private void DrawAt(Vector3 pos)
{
switch ((Mode)modeIndex)
{
case Mode.Add:
{
data1.ApplyCircle(pos.x, pos.z, radius1, CellSize1);
data1.RemoveBorder();
data2.ApplyCircle(pos.x, pos.z, radius2, CellSize2);
data2.RemoveBorder();
break;
}
case Mode.IncreaseHeight:
{
if (brushIndex == 0)
{
data2.ChangeHeightCircleFlat(pos.x, pos.z, radius2, HeightChangeValue, CellSize2, 0, maxHeight);
}
else
{
data2.ChangeHeightCircleSmooth(pos.x, pos.z, radius2, HeightChangeValue, CellSize2, 0, maxHeight);
}
break;
}
case Mode.DecreaseHeight:
{
if (brushIndex == 0)
{
data2.ChangeHeightCircleFlat(pos.x, pos.z, radius2, -HeightChangeValue, CellSize2, 0, maxHeight);
}
else
{
data2.ChangeHeightCircleSmooth(pos.x, pos.z, radius2, -HeightChangeValue, CellSize2, 0, maxHeight);
}
break;
}
}
}
private void EraseAt(Vector3 pos)
{
data1.RemoveCircle(pos.x, pos.z, radius2, CellSize1);
data2.RemoveCircle(pos.x, pos.z, radius1, CellSize2);
}
public void ChangeBrushMode()
{
modeIndex = (modeIndex + 1) % ModeLabels.Length;
buttonLabel.text = ModeLabels[modeIndex];
brushRoot.SetActive(modeIndex == (int)Mode.DecreaseHeight || modeIndex == (int)Mode.IncreaseHeight);
}
public void ChangeBrushShape()
{
brushIndex = (brushIndex + 1) % ShapeLabels.Length;
shapeLabel.text = ShapeLabels[brushIndex];
}
public void SetMaxHeightIncrease(float value)
{
maxHeight = value * MaxHeight;
}
private Vector3 GetHitPosition(Vector3 pos)
{
Plane plane = new Plane(Vector3.up, 0);
var ray = cam.ScreenPointToRay(pos);
float enter;
plane.Raycast(ray, out enter);
return ray.GetPoint(enter);
}
}
| 30.137255 | 123 | 0.570375 | [
"MIT"
] | hbence/MeshBuilderExamples | Assets/samples/marching_squares/04/MarchingSquareTest4.cs | 4,613 | C# |
using System.Diagnostics;
using System.Runtime.Serialization;
using Elasticsearch.Net;
namespace Nest
{
[InterfaceDataContract]
public interface IKeywordProperty : IDocValuesProperty
{
[DataMember(Name ="boost")]
double? Boost { get; set; }
[DataMember(Name ="eager_global_ordinals")]
bool? EagerGlobalOrdinals { get; set; }
[DataMember(Name ="ignore_above")]
int? IgnoreAbove { get; set; }
[DataMember(Name ="index")]
bool? Index { get; set; }
[DataMember(Name ="index_options")]
IndexOptions? IndexOptions { get; set; }
[DataMember(Name ="normalizer")]
string Normalizer { get; set; }
[DataMember(Name ="norms")]
bool? Norms { get; set; }
[DataMember(Name ="null_value")]
string NullValue { get; set; }
/// <summary> Whether full text queries should split the input on whitespace when building a query for this field. </summary>
[DataMember(Name ="split_queries_on_whitespace")]
bool? SplitQueriesOnWhitespace { get; set; }
}
[DebuggerDisplay("{DebugDisplay}")]
public class KeywordProperty : DocValuesPropertyBase, IKeywordProperty
{
public KeywordProperty() : base(FieldType.Keyword) { }
public double? Boost { get; set; }
public bool? EagerGlobalOrdinals { get; set; }
public int? IgnoreAbove { get; set; }
public bool? Index { get; set; }
public IndexOptions? IndexOptions { get; set; }
public string Normalizer { get; set; }
public bool? Norms { get; set; }
public string NullValue { get; set; }
/// <inheritdoc cref="IKeywordProperty.SplitQueriesOnWhitespace" />
public bool? SplitQueriesOnWhitespace { get; set; }
}
[DebuggerDisplay("{DebugDisplay}")]
public class KeywordPropertyDescriptor<T>
: DocValuesPropertyDescriptorBase<KeywordPropertyDescriptor<T>, IKeywordProperty, T>, IKeywordProperty
where T : class
{
public KeywordPropertyDescriptor() : base(FieldType.Keyword) { }
double? IKeywordProperty.Boost { get; set; }
bool? IKeywordProperty.EagerGlobalOrdinals { get; set; }
int? IKeywordProperty.IgnoreAbove { get; set; }
bool? IKeywordProperty.Index { get; set; }
IndexOptions? IKeywordProperty.IndexOptions { get; set; }
string IKeywordProperty.Normalizer { get; set; }
bool? IKeywordProperty.Norms { get; set; }
string IKeywordProperty.NullValue { get; set; }
bool? IKeywordProperty.SplitQueriesOnWhitespace { get; set; }
public KeywordPropertyDescriptor<T> Boost(double? boost) => Assign(boost, (a, v) => a.Boost = v);
public KeywordPropertyDescriptor<T> EagerGlobalOrdinals(bool? eagerGlobalOrdinals = true) =>
Assign(eagerGlobalOrdinals, (a, v) => a.EagerGlobalOrdinals = v);
public KeywordPropertyDescriptor<T> IgnoreAbove(int? ignoreAbove) => Assign(ignoreAbove, (a, v) => a.IgnoreAbove = v);
public KeywordPropertyDescriptor<T> Index(bool? index = true) => Assign(index, (a, v) => a.Index = v);
public KeywordPropertyDescriptor<T> IndexOptions(IndexOptions? indexOptions) => Assign(indexOptions, (a, v) => a.IndexOptions = v);
public KeywordPropertyDescriptor<T> Norms(bool? enabled = true) => Assign(enabled, (a, v) => a.Norms = v);
/// <inheritdoc cref="IKeywordProperty.SplitQueriesOnWhitespace" />
public KeywordPropertyDescriptor<T> SplitQueriesOnWhitespace(bool? split = true) => Assign(split, (a, v) => a.SplitQueriesOnWhitespace = v);
public KeywordPropertyDescriptor<T> NullValue(string nullValue) => Assign(nullValue, (a, v) => a.NullValue = v);
public KeywordPropertyDescriptor<T> Normalizer(string normalizer) => Assign(normalizer, (a, v) => a.Normalizer = v);
}
}
| 37.326316 | 142 | 0.721658 | [
"Apache-2.0"
] | 591094733/elasticsearch-net | src/Nest/Mapping/Types/Core/Keyword/KeywordProperty.cs | 3,548 | C# |
using EppLib.Entities;
namespace EppLib.OpenProvider
{
public abstract class OpProvEppExtension : EppExtension
{
protected override string Namespace { get; set; } = "http://www.openprovider.nl/epp/xml/opprov-1.0";
}
}
| 24 | 108 | 0.7 | [
"Apache-2.0"
] | Esselink-nu/EppLib.OpenProvider | EppLib.OpenProvider/OpProvEppExtension.cs | 242 | C# |
using System.Collections.Generic;
using System.Threading.Tasks;
using Ernestoyaquello.Chess.Models;
namespace Ernestoyaquello.ChessApp.Services
{
public interface IPopupService
{
Task<Piece> ShowPawnReplacementPopup(List<Piece> availableReplacements);
}
}
| 23.166667 | 80 | 0.776978 | [
"Apache-2.0"
] | ernestoyaquello/TwoPlayerZeroSumGameEngine | Ernestoyaquello.ChessApp.Core/Services/IPopupService.cs | 280 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShortestPath.Optimization.Extensions
{
public static class EnumerableExtensions
{
public static IEnumerable<Entities.GridLocation> SurroundingLocation(this IEnumerable<Entities.GridLocation> locations, Entities.GridLocation centerPoint)
{
var minX = centerPoint.X - 1;
var maxX = centerPoint.X + 1;
var minY = centerPoint.Y - 1;
var maxY = centerPoint.Y + 1;
return locations.Where(l => l.X >= minX && l.X <= maxX && l.Y >= minY && l.Y <= maxY);
}
}
}
| 33.142857 | 163 | 0.627874 | [
"MIT"
] | bsstahl/DPDemo | ShortestPath.Optimization/Extensions/EnumerableExtensions.cs | 698 | C# |
// SPDX-License-Identifier: Apache-2.0
// Licensed to the Ed-Fi Alliance under one or more agreements.
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using log4net;
namespace EdFi.TestObjects
{
public class BuildContext
{
private Type _targetType;
public BuildContext(
string logicalPropertyPath,
Type targetType,
IDictionary<string, object> propertyValueConstraints,
Type containingType,
LinkedList<object> objectGraphLineage,
BuildMode buildMode)
{
if (targetType == null)
{
throw new ArgumentNullException("targetType");
}
LogicalPropertyPath = logicalPropertyPath;
TargetType = targetType;
//_propertyValueConstraints = propertyValueConstraints ?? new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
if (propertyValueConstraints == null)
{
PropertyValueConstraints =
new BuildContextConstraints(); // new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
}
else
{
PropertyValueConstraints =
new BuildContextConstraints(
propertyValueConstraints); // Dictionary<string, object>(propertyValueConstraints, StringComparer.InvariantCultureIgnoreCase);
}
ContainingType = containingType;
ObjectGraphLineage = objectGraphLineage ?? new LinkedList<object>();
BuildMode = buildMode;
}
public string LogicalPropertyPath { get; }
/// <summary>
/// Gets or sets the type for which a value is to be built (returning the underlying type in the case of a nullable value type).
/// </summary>
public Type TargetType
{
get { return _targetType; }
set
{
RawTargetType = value;
Type underlyingType = null;
if (value.IsGenericType)
{
underlyingType = Nullable.GetUnderlyingType(value);
}
_targetType = underlyingType ?? value;
}
}
/// <summary>
/// Gets the original target type with no processing performed to identify the underlying type of a nullable value type.
/// </summary>
public Type RawTargetType { get; private set; }
public IDictionary<string, object> PropertyValueConstraints { get; }
public Type ContainingType { get; }
public LinkedList<object> ObjectGraphLineage { get; }
public BuildMode BuildMode { get; }
/// <summary>
/// Gets the object to which the current value will be applied.
/// </summary>
/// <returns>The current instance if the value being generated is a property; otherwise <b>null</b>.</returns>
public dynamic GetContainingInstance(bool caseInsensitiveProperties)
{
if (ObjectGraphLineage.First == null)
{
return null;
}
return new CaseInsensitivePropertiesDynamicWrapper(ObjectGraphLineage.First.Value);
}
public dynamic GetContainingInstance()
{
if (ObjectGraphLineage.First == null)
{
return null;
}
return ObjectGraphLineage.First.Value;
}
/// <summary>
/// Gets the parent of the object to which the current value is to be applied (useful for navigating object graphs).
/// </summary>
/// <returns>The parent of the current instance if the value being generated is a property; otherwise <b>null</b>.</returns>
public dynamic GetParentInstance()
{
var firstNode = ObjectGraphLineage.First;
if (firstNode == null || firstNode.Next == null)
{
return null;
}
return firstNode.Next.Value;
}
/// <summary>
/// Gets the parent of the object to which the current value is to be applied (useful for navigating object graphs).
/// </summary>
/// <returns>The parent of the current instance if the value being generated is a property; otherwise <b>null</b>.</returns>
public dynamic GetParentType()
{
var parent = GetParentInstance();
if (parent == null)
{
return null;
}
return parent.GetType();
}
/// <summary>
/// Gets the last segment of the logical property path, generally indicating the property name.
/// </summary>
/// <returns></returns>
public string GetPropertyName()
{
string[] parts = LogicalPropertyPath.Split('.');
string propertyName = parts[parts.Length - 1];
return propertyName;
}
/// <summary>
/// Gets the containing type's name, if present, otherwise an empty string.
/// </summary>
/// <returns>The containing type's name if available; otherwise an empty string.</returns>
public string GetContainingTypeName()
{
if (ContainingType == null)
{
return string.Empty;
}
return ContainingType.Name;
}
public override string ToString()
{
if (PropertyValueConstraints.Count == 0)
{
return string.Format(
"[Context #{0}: Building path '{1}' using no values.]",
GetHashCode(),
string.IsNullOrEmpty(LogicalPropertyPath)
? "[empty]"
: LogicalPropertyPath);
}
return string.Format(
"[Context #{0}: Building path '{1}' using {2}.]",
GetHashCode(),
string.IsNullOrEmpty(LogicalPropertyPath)
? "[empty]"
: LogicalPropertyPath,
GetContextDisplayText());
}
private string GetContextDisplayText()
{
return string.Join(", ", PropertyValueConstraints.Select(x => string.Format("[{0}={1}]", x.Key, x.Value)));
}
}
public class BuildContextConstraints : IDictionary<string, object>
{
private readonly IDictionary<string, object> _constraints;
private readonly ILog _log = LogManager.GetLogger(typeof(BuildContextConstraints));
public BuildContextConstraints()
{
_constraints = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
}
public BuildContextConstraints(IDictionary<string, object> constraints)
{
if (constraints == null)
{
_constraints = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
return;
}
if (constraints is BuildContextConstraints)
{
_constraints = (constraints as BuildContextConstraints)._constraints;
return;
}
var constraintsAsDictionary = constraints as Dictionary<string, object>;
if (constraintsAsDictionary == null)
{
throw new ArgumentException(
string.Format(
"Constraints supplied to the build context must be backed by a Dictionary<string, object> instance (an instance of '{0}' was passed instead).",
constraints.GetType()));
}
if (constraintsAsDictionary.Comparer.GetType() != StringComparer.InvariantCultureIgnoreCase.GetType())
{
throw new ArgumentException(
"Constraints supplied to the build context must be backed by a Dictionary<string, object> instance, and must use the StringComparer.InvariantCultureIgnoreCase comparer in order to ensure correct behavior.");
}
_constraints = new Dictionary<string, object>(constraints, StringComparer.InvariantCultureIgnoreCase);
}
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
{
return _constraints.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable) _constraints).GetEnumerator();
}
public void Add(KeyValuePair<string, object> item)
{
_constraints.Add(item);
_log.DebugFormat("Added [{0}='{1}'] to property constraints.", item.Key, item.Value);
}
public void Clear()
{
_constraints.Clear();
_log.DebugFormat("Cleared context of {0} value(s).", _constraints.Count);
}
public bool Contains(KeyValuePair<string, object> item)
{
return _constraints.Contains(item);
}
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
{
_constraints.CopyTo(array, arrayIndex);
}
public bool Remove(KeyValuePair<string, object> item)
{
var result = _constraints.Remove(item);
_log.DebugFormat("Removed [{0}='{1}'] from property constraints.", item.Key, item.Value);
return result;
}
public int Count
{
get { return _constraints.Count; }
}
public bool IsReadOnly
{
get { return _constraints.IsReadOnly; }
}
public bool ContainsKey(string key)
{
return _constraints.ContainsKey(key);
}
public void Add(string key, object value)
{
_constraints.Add(key, value);
_log.DebugFormat("Added [{0}='{1}'] to property constraints.", key, value);
}
public bool Remove(string key)
{
var result = _constraints.Remove(key);
_log.DebugFormat("Removed [{0}] from property constraints.", key);
return result;
}
public bool TryGetValue(string key, out object value)
{
return _constraints.TryGetValue(key, out value);
}
public object this[string key]
{
get { return _constraints[key]; }
set
{
object existingValue;
// Detect overwriting of constraint values, and warn
if (_constraints.TryGetValue(key, out existingValue))
{
if (!value.Equals(existingValue))
{
_log.DebugFormat(
"Overwriting value for '{0}' from '{1}' to '{2}'.",
key,
existingValue,
value);
}
else
{
_log.DebugFormat(
"Overwriting value for '{0}' with same value ('{1}').",
key,
value);
}
}
_constraints[key] = value;
_log.DebugFormat("Set [{0}='{1}'] to property constraints.", key, value);
}
}
public ICollection<string> Keys
{
get { return _constraints.Keys; }
}
public ICollection<object> Values
{
get { return _constraints.Values; }
}
#pragma warning disable 659
public override bool Equals(object obj)
#pragma warning restore 659
{
var other = obj as IDictionary<string, object>;
if (other == null)
{
return false;
}
if (other.Count != Count)
{
return false;
}
return this.AsEnumerable()
.All(
x =>
{
object value;
if (!other.TryGetValue(x.Key, out value))
{
return false;
}
if (x.Value == null && value == null)
{
return true;
}
if (x.Value == null || value == null)
{
return false;
}
return value.Equals(x.Value);
});
}
public override int GetHashCode()
{
// ReSharper disable BaseObjectGetHashCodeCallInGetHashCode
return base.GetHashCode();
// ReSharper restore BaseObjectGetHashCodeCallInGetHashCode
}
}
public interface IValueBuilder
{
ITestObjectFactory Factory { get; set; }
ValueBuildResult TryBuild(BuildContext buildContext);
void Reset();
}
}
| 32.768116 | 227 | 0.526021 | [
"Apache-2.0"
] | AxelMarquez/Ed-Fi-ODS | Application/EdFi.TestObjects/IValueBuilder.cs | 13,566 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TVShowCleanup.Utilities
{
public sealed class LogHelper
{
static readonly Log _log = new Log();
private LogHelper()
{
}
public static Log Log
{
get
{
return _log;
}
}
}
}
| 15.62963 | 45 | 0.535545 | [
"Apache-2.0"
] | jstevenson72/TVShowCleanup | TVShowCleanup/Utilities/LogHelper.cs | 424 | C# |
// Copyright 2020 EPAM Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace HCA.Foundation.Account.Tests.Services.Authentication
{
using Account.Infrastructure.Pipelines.Login;
using Account.Infrastructure.Pipelines.Logout;
using Account.Services.Authentication;
using Base.Services.Pipeline;
using NSubstitute;
using Ploeh.AutoFixture;
using Xunit;
public class AuthenticationServiceTests
{
private readonly AuthenticationService authenticationService;
private readonly string email;
private readonly IFixture fixture;
private readonly string password;
private readonly IPipelineService pipelineService;
public AuthenticationServiceTests()
{
this.pipelineService = Substitute.For<IPipelineService>();
this.fixture = new Fixture();
this.authenticationService = new AuthenticationService(this.pipelineService);
this.email = this.fixture.Create<string>();
this.password = this.fixture.Create<string>();
}
[Fact]
public void Login_IfPipelineAborted_ShouldReturnFailResult()
{
// arrange
this.pipelineService
.When(x => x.RunPipeline(Constants.Pipelines.Login, Arg.Any<LoginPipelineArgs>()))
.Do(
info =>
{
var args = info[1] as LoginPipelineArgs;
args.AbortPipeline();
});
// act
var result = this.authenticationService.Login(this.email, this.password);
// assert
Assert.False(result.Success);
}
[Fact]
public void Login_IfPipelineAbortedAndCredentialsInvalid_ShouldReturnFailResultWithInvalidCredantialInData()
{
// arrange
this.pipelineService
.When(x => x.RunPipeline(Constants.Pipelines.Login, Arg.Any<LoginPipelineArgs>()))
.Do(
info =>
{
var args = info[1] as LoginPipelineArgs;
args.IsInvalidCredentials = true;
args.AbortPipeline();
});
// act
var result = this.authenticationService.Login(this.email, this.password);
// assert
Assert.False(result.Success);
Assert.True(result.Data.IsInvalidCredentials);
}
[Fact]
public void Login_IfPipelineNotAborted_ShouldReturnSuccessResult()
{
// act
var result = this.authenticationService.Login(this.email, this.password);
// assert
Assert.True(result.Success);
}
[Fact]
public void Login_ShouldRunLoginPipeline()
{
// act
this.authenticationService.Login(this.email, this.password);
// assert
this.pipelineService.Received(1).RunPipeline(Constants.Pipelines.Login, Arg.Any<LoginPipelineArgs>());
}
[Fact]
public void Logout_IfPipelineAborted_ShouldReturnFailResult()
{
// arrange
this.pipelineService
.When(x => x.RunPipeline(Constants.Pipelines.Logout, Arg.Any<LogoutPipelineArgs>()))
.Do(
info =>
{
var args = info[1] as LogoutPipelineArgs;
args.AbortPipeline();
});
// act
var result = this.authenticationService.Logout();
// assert
Assert.False(result.Success);
}
[Fact]
public void Logout_IfPipelineNotAborted_ShouldReturnSuccessResult()
{
// act
var result = this.authenticationService.Logout();
// assert
Assert.True(result.Success);
}
[Fact]
public void Logout_ShouldRunLogoutPipeline()
{
// act
this.authenticationService.Logout();
// assert
this.pipelineService.Received(1).RunPipeline(Constants.Pipelines.Logout, Arg.Any<LogoutPipelineArgs>());
}
}
} | 30.917197 | 116 | 0.574784 | [
"Apache-2.0"
] | Igor1306/sitecore-headless-commerce-accelerator | src/Foundation/Account/tests/Services/Authentication/AuthenticationServiceTests.cs | 4,856 | C# |
using System.Threading.Tasks;
using Lykke.Job.Messages.Core.Services.Templates;
using Lykke.Service.EmailSender;
using Lykke.Service.TemplateFormatter.Client;
using Newtonsoft.Json;
using System.Collections.Generic;
using Lykke.Job.Messages.Core.Services.Email;
using System;
namespace Lykke.Job.Messages.Services.Templates
{
public class RemoteTemplateGenerator : IRemoteTemplateGenerator
{
private readonly IEmailTemplateProvide _emailTemplateProvide;
public RemoteTemplateGenerator(IEmailTemplateProvide emailTemplateProvide)
{
_emailTemplateProvide = emailTemplateProvide;
}
public async Task<EmailMessage> GenerateAsync<T>(string partnerId, string templateName, T templateVm)
{
var parameters = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(templateVm));
var formatted = await _emailTemplateProvide.FormatAsync(templateName, partnerId, "EN", parameters);
return formatted.EmailMessage;
}
}
} | 37.37931 | 129 | 0.73155 | [
"MIT"
] | LykkeCity/Lykke.Job.Messages | src/Lykke.Job.Messages.Services/Templates/RemoteTemplateGenerator.cs | 1,084 | C# |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace WeShare
{
/// <summary>
/// Interação lógica para App.xaml
/// </summary>
public partial class App : Application
{
}
}
| 17.833333 | 42 | 0.700935 | [
"MIT"
] | Debora222254/WeShare-Github | WeShare/WeShare/App.xaml.cs | 326 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.Devices.Latest.Outputs
{
[OutputType]
public sealed class StorageEndpointPropertiesResponse
{
/// <summary>
/// Specifies authentication type being used for connecting to the storage account.
/// </summary>
public readonly string? AuthenticationType;
/// <summary>
/// The connection string for the Azure Storage account to which files are uploaded.
/// </summary>
public readonly string ConnectionString;
/// <summary>
/// The name of the root container where you upload files. The container need not exist but should be creatable using the connectionString specified.
/// </summary>
public readonly string ContainerName;
/// <summary>
/// The period of time for which the SAS URI generated by IoT Hub for file upload is valid. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options.
/// </summary>
public readonly string? SasTtlAsIso8601;
[OutputConstructor]
private StorageEndpointPropertiesResponse(
string? authenticationType,
string connectionString,
string containerName,
string? sasTtlAsIso8601)
{
AuthenticationType = authenticationType;
ConnectionString = connectionString;
ContainerName = containerName;
SasTtlAsIso8601 = sasTtlAsIso8601;
}
}
}
| 36.56 | 222 | 0.66849 | [
"Apache-2.0"
] | pulumi-bot/pulumi-azure-native | sdk/dotnet/Devices/Latest/Outputs/StorageEndpointPropertiesResponse.cs | 1,828 | C# |
using PVScan.Core.Services.Interfaces;
using PVScan.Core.Services;
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
using Moq;
using System.Net.Http;
using System.Threading.Tasks;
using Moq.Protected;
using System.Threading;
using System.Net.Http.Headers;
using PVScan.Core.Models;
using System.Linq;
namespace PVScan.Core.Tests.Services
{
public class BarcodeSorterTests : TestBase
{
public BarcodeSorterTests()
{
FillUpTestBarcodes();
}
[Fact]
public void Default_Sorting_Is_Date_Descending()
{
// Arrange & Act
var defaultSotring = Sorting.Default();
Assert.Equal(SortingField.Date, defaultSotring.Field);
Assert.True(defaultSotring.Descending);
}
[Fact]
public async Task Can_Sort_By_Date_Descending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Date;
sorting.Descending = true;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderByDescending(b => b.ScanTime).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
[Fact]
public async Task Can_Sort_By_Date_Ascending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Date;
sorting.Descending = false;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderBy(b => b.ScanTime).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
[Fact]
public async Task Can_Sort_By_Text_Descending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Text;
sorting.Descending = true;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderByDescending(b => b.Text).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
[Fact]
public async Task Can_Sort_By_Text_Ascending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Text;
sorting.Descending = false;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderBy(b => b.Text).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
[Fact]
public async Task Can_Sort_By_Format_Descending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Format;
sorting.Descending = true;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderByDescending(b => b.Format).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
[Fact]
public async Task Can_Sort_By_Format_Ascending()
{
// Arrange
var mockBarcodes = DbContext.Barcodes.ToList();
var sut = new BarcodeSorter();
var sorting = Sorting.Default();
sorting.Field = SortingField.Format;
sorting.Descending = false;
// Act
var resultBarcodes = (await sut.Sort(mockBarcodes, sorting)).ToList();
var sortedBarcodes = mockBarcodes.OrderBy(b => b.Format).ToList();
Assert.Equal(sortedBarcodes, resultBarcodes);
}
private void FillUpTestBarcodes()
{
// For mock barcodes we add 3 barcodes for each time category
// Each time category has different barcode formats
List<Barcode> barcodesToAdd = new List<Barcode>();
// Today
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddHours(2),
Format = ZXing.BarcodeFormat.QR_CODE,
Text = "Test1",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddHours(3),
Format = ZXing.BarcodeFormat.AZTEC,
Text = "Test2",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddHours(4),
Format = ZXing.BarcodeFormat.PDF_417,
Text = "Test3",
});
// This week
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddDays(-7).AddDays(1),
Format = ZXing.BarcodeFormat.QR_CODE,
Text = "Test4",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddDays(-7).AddDays(2),
Format = ZXing.BarcodeFormat.AZTEC,
Text = "Test5",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddDays(-7).AddDays(3),
Format = ZXing.BarcodeFormat.PDF_417,
Text = "Test6",
});
// This month
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddMonths(-1).AddDays(1),
Format = ZXing.BarcodeFormat.QR_CODE,
Text = "Test7",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddMonths(-1).AddDays(2),
Format = ZXing.BarcodeFormat.AZTEC,
Text = "Test8",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddMonths(-1).AddDays(3),
Format = ZXing.BarcodeFormat.PDF_417,
Text = "Test9",
});
// This year
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddYears(-1).AddDays(1),
Format = ZXing.BarcodeFormat.QR_CODE,
Text = "Test10",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddYears(-1).AddDays(2),
Format = ZXing.BarcodeFormat.AZTEC,
Text = "Test11",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = DateTime.Today.AddYears(-1).AddDays(3),
Format = ZXing.BarcodeFormat.PDF_417,
Text = "Test12",
});
// Some time ago
barcodesToAdd.Add(new Barcode()
{
ScanTime = new DateTime(2010, 1, 1),
Format = ZXing.BarcodeFormat.QR_CODE,
Text = "Test13",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = new DateTime(2010, 1, 2),
Format = ZXing.BarcodeFormat.AZTEC,
Text = "Test14",
});
barcodesToAdd.Add(new Barcode()
{
ScanTime = new DateTime(2010, 1, 3),
Format = ZXing.BarcodeFormat.PDF_417,
Text = "Test15",
});
// Shuffle
barcodesToAdd = barcodesToAdd.OrderBy(x => Guid.NewGuid()).ToList();
foreach (var b in barcodesToAdd)
{
DbContext.Barcodes.Add(b);
}
// Save changes
DbContext.SaveChanges();
}
}
}
| 31.739623 | 90 | 0.523957 | [
"MIT"
] | meJevin/PVScan | Tests/Core/PVScan.Core.Tests/Services/BarcodeSorterTests.cs | 8,413 | C# |
using System;
using System.Collections.Generic;
using UnityEngine;
public static class InputController
{
private static Dictionary<string, KeyCode[]> keymap;
static InputController()
{
keymap = new Dictionary<string, KeyCode[]>()
{
// bind name list of keys
{ "JUMP", new KeyCode[] { KeyCode.W, KeyCode.UpArrow, KeyCode.Space } },
{ "LEFT", new KeyCode[] { KeyCode.A, KeyCode.LeftArrow } },
{ "RIGHT", new KeyCode[] { KeyCode.D, KeyCode.RightArrow } },
// for Testing
{ "TEST", new KeyCode[] { KeyCode.R } }
};
}
public static bool IsAnyPressed()
{
return Input.anyKey;
}
public static bool IsPressed(string name)
{
if (!keymap.ContainsKey(name))
{
throw new Exception($"Keymap {name} does not exist");
}
if (keymap[name].Length == 0)
{
throw new Exception($"No keys are mapped to keymap {name}");
}
foreach (KeyCode key in keymap[name])
{
if (Input.GetKey(key))
{
return true;
}
}
return false;
}
} | 25.571429 | 87 | 0.502793 | [
"MIT"
] | MerijnHendriks/GGJ2022 | Assets/Code/Controllers/InputController.cs | 1,253 | C# |
using System;
namespace Trowel.Providers.Texture.Vtf
{
[Flags]
public enum VtfImageFlag : uint
{
Pointsample = 0x00000001,
Trilinear = 0x00000002,
Clamps = 0x00000004,
Clampt = 0x00000008,
Anisotropic = 0x00000010,
HintDxt5 = 0x00000020,
Srgb = 0x00000040,
DeprecatedNocompress = 0x00000040,
Normal = 0x00000080,
Nomip = 0x00000100,
Nolod = 0x00000200,
Minmip = 0x00000400,
Procedural = 0x00000800,
Onebitalpha = 0x00001000,
Eightbitalpha = 0x00002000,
Envmap = 0x00004000,
Rendertarget = 0x00008000,
Depthrendertarget = 0x00010000,
Nodebugoverride = 0x00020000,
Singlecopy = 0x00040000,
Unused0 = 0x00080000,
DeprecatedOneovermiplevelinalpha = 0x00080000,
Unused1 = 0x00100000,
DeprecatedPremultcolorbyoneovermiplevel = 0x00100000,
Unused2 = 0x00200000,
DeprecatedNormaltodudv = 0x00200000,
Unused3 = 0x00400000,
DeprecatedAlphatestmipgeneration = 0x00400000,
Nodepthbuffer = 0x00800000,
Unused4 = 0x01000000,
DeprecatedNicefiltered = 0x01000000,
Clampu = 0x02000000,
Vertextexture = 0x04000000,
Ssbump = 0x08000000,
Unused5 = 0x10000000,
DeprecatedUnfilterableOk = 0x10000000,
Border = 0x20000000,
DeprecatedSpecvarRed = 0x40000000,
DeprecatedSpecvarAlpha = 0x80000000,
Last = 0x20000000
}
} | 31.244898 | 61 | 0.633573 | [
"BSD-3-Clause"
] | mattiascibien/trowel | Trowel.Providers/Texture/Vtf/VtfImageFlag.cs | 1,533 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
[CompilerTrait(CompilerFeature.IOperation)]
public partial class IOperationTests : SemanticModelTestBase
{
[Fact]
public void ConstructorBody_01()
{
string source = @"
class C
{
public C()
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics(
// file.cs(4,15): error CS1002: ; expected
// public C()
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(4, 15),
// file.cs(4,12): error CS0501: 'C.C()' must declare a body because it is not marked abstract, extern, or partial
// public C()
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "C").WithArguments("C.C()").WithLocation(4, 12)
);
var tree = compilation.SyntaxTrees.Single();
var model = compilation.GetSemanticModel(tree);
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Assert.Null(model.GetOperation(node1));
}
[Fact]
public void ConstructorBody_02()
{
string source = @"
class C
{
public C() : base()
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics(
// (4,24): error CS1002: ; expected
// public C() : base()
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(4, 24),
// (4,12): error CS0501: 'C.C()' must declare a body because it is not marked abstract, extern, or partial
// public C() : base()
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "C").WithArguments("C.C()").WithLocation(4, 12)
);
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null, IsInvalid) (Syntax: 'public C() : base()
')
Initializer:
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: ': base()')
Expression:
IInvocationOperation ( System.Object..ctor()) (OperationKind.Invocation, Type: System.Void, IsInvalid) (Syntax: ': base()')
Instance Receiver:
IInstanceReferenceOperation (OperationKind.InstanceReference, Type: System.Object, IsInvalid, IsImplicit) (Syntax: ': base()')
Arguments(0)
BlockBody:
null
ExpressionBody:
null
");
}
[Fact]
public void ConstructorBody_03()
{
string source = @"
class C
{
public C() : base()
{ throw null; }
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics();
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null) (Syntax: 'public C() ... row null; }')
Initializer:
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: ': base()')
Expression:
IInvocationOperation ( System.Object..ctor()) (OperationKind.Invocation, Type: System.Void) (Syntax: ': base()')
Instance Receiver:
IInstanceReferenceOperation (OperationKind.InstanceReference, Type: System.Object, IsImplicit) (Syntax: ': base()')
Arguments(0)
BlockBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ throw null; }')
IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw null;')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'null')
ExpressionBody:
null
");
}
[Fact]
public void ConstructorBody_04()
{
string source = @"
class C
{
public C() : base()
=> throw null;
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics();
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null) (Syntax: 'public C() ... throw null;')
Initializer:
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: ': base()')
Expression:
IInvocationOperation ( System.Object..ctor()) (OperationKind.Invocation, Type: System.Void) (Syntax: ': base()')
Instance Receiver:
IInstanceReferenceOperation (OperationKind.InstanceReference, Type: System.Object, IsImplicit) (Syntax: ': base()')
Arguments(0)
BlockBody:
null
ExpressionBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '=> throw null')
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: 'throw null')
Expression:
IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw null')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'null')
");
}
[Fact]
public void ConstructorBody_05()
{
string source = @"
class C
{
public C()
{ throw null; }
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics();
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null) (Syntax: 'public C() ... row null; }')
Initializer:
null
BlockBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '{ throw null; }')
IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw null;')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'null')
ExpressionBody:
null
");
}
[Fact]
public void ConstructorBody_06()
{
string source = @"
class C
{
public C()
=> throw null;
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics();
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null) (Syntax: 'public C() ... throw null;')
Initializer:
null
BlockBody:
null
ExpressionBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null) (Syntax: '=> throw null')
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsImplicit) (Syntax: 'throw null')
Expression:
IThrowOperation (OperationKind.Throw, Type: null) (Syntax: 'throw null')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null) (Syntax: 'null')
");
}
[Fact]
public void ConstructorBody_07()
{
string source = @"
class C
{
public C()
{ throw null; }
=> throw null;
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics(
// (4,5): error CS8057: Block bodies and expression bodies cannot both be provided.
// public C()
Diagnostic(ErrorCode.ERR_BlockBodyAndExpressionBody, @"public C()
{ throw null; }
=> throw null;").WithLocation(4, 5)
);
var tree = compilation.SyntaxTrees.Single();
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
compilation.VerifyOperationTree(node1, expectedOperationTree:
@"
IConstructorBodyOperation (OperationKind.ConstructorBodyOperation, Type: null, IsInvalid) (Syntax: 'public C() ... throw null;')
Initializer:
null
BlockBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ throw null; }')
IThrowOperation (OperationKind.Throw, Type: null, IsInvalid) (Syntax: 'throw null;')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null')
ExpressionBody:
IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '=> throw null')
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw null')
Expression:
IThrowOperation (OperationKind.Throw, Type: null, IsInvalid) (Syntax: 'throw null')
ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null')
");
}
[Fact]
public void ConstructorBody_08()
{
string source = @"
class C
{
public C();
}
";
var compilation = CreateCompilation(source);
compilation.VerifyDiagnostics(
// file.cs(4,12): error CS0501: 'C.C()' must declare a body because it is not marked abstract, extern, or partial
// public C();
Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "C").WithArguments("C.C()").WithLocation(4, 12)
);
var tree = compilation.SyntaxTrees.Single();
var model = compilation.GetSemanticModel(tree);
var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Assert.Null(model.GetOperation(node1));
}
}
}
| 37.339161 | 161 | 0.638449 | [
"Apache-2.0"
] | DaiMichael/roslyn | src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IConstructorBodyOperation.cs | 10,681 | C# |
using System;
using Microsoft.Xna.Framework;
namespace RayCarrot.Ray1Editor;
public class EditorPointFieldViewModel : EditorFieldViewModel
{
public EditorPointFieldViewModel(string header, string info, Func<Point> getValueAction, Action<Point> setValueAction, int min = 0, int max = Int32.MaxValue) : base(header, info)
{
GetValueAction = getValueAction;
SetValueAction = setValueAction;
Min = min;
Max = max;
// Set initial values to avoid unnecessary settings from UI when default value is not within min/max range
_x = min;
_y = min;
}
private int _x;
private int _y;
protected Func<Point> GetValueAction { get; }
protected Action<Point> SetValueAction { get; }
public int X
{
get => _x;
set
{
_x = value;
SetValueAction(new Point(X, Y));
}
}
public int Y
{
get => _y;
set
{
_y = value;
SetValueAction(new Point(X, Y));
}
}
public int Min { get; }
public int Max { get; }
public override void Refresh()
{
var p = GetValueAction();
_x = p.X;
_y = p.Y;
OnPropertyChanged(nameof(X));
OnPropertyChanged(nameof(Y));
}
} | 22.929825 | 182 | 0.573068 | [
"MIT"
] | RayCarrot/RayCarrot.Ray1Editor | src/RayCarrot.Ray1Editor/ViewModels/Editor/Fields/EditorPointFieldViewModel.cs | 1,309 | 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 waf-2015-08-24.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.WAF.Model
{
/// <summary>
/// Container for the parameters to the GetChangeTokenStatus operation.
/// Returns the status of a <code>ChangeToken</code> that you got by calling <a>GetChangeToken</a>.
/// <code>ChangeTokenStatus</code> is one of the following values:
///
/// <ul> <li>
/// <para>
/// <code>PROVISIONED</code>: You requested the change token by calling <code>GetChangeToken</code>,
/// but you haven't used it yet in a call to create, update, or delete an AWS WAF object.
/// </para>
/// </li> <li>
/// <para>
/// <code>PENDING</code>: AWS WAF is propagating the create, update, or delete request
/// to all AWS WAF servers.
/// </para>
/// </li> <li>
/// <para>
/// <code>INSYNC</code>: Propagation is complete.
/// </para>
/// </li> </ul>
/// </summary>
public partial class GetChangeTokenStatusRequest : AmazonWAFRequest
{
private string _changeToken;
/// <summary>
/// Gets and sets the property ChangeToken.
/// <para>
/// The change token for which you want to get the status. This change token was previously
/// returned in the <code>GetChangeToken</code> response.
/// </para>
/// </summary>
[AWSProperty(Required=true, Min=1)]
public string ChangeToken
{
get { return this._changeToken; }
set { this._changeToken = value; }
}
// Check to see if ChangeToken property is set
internal bool IsSetChangeToken()
{
return this._changeToken != null;
}
}
} | 33.302632 | 105 | 0.634532 | [
"Apache-2.0"
] | FoxBearBear/aws-sdk-net | sdk/src/Services/WAF/Generated/Model/GetChangeTokenStatusRequest.cs | 2,531 | C# |
using NLog;
using System;
using System.Linq;
using TwoWholeWorms.Lumbricus.Shared;
using System.Text.RegularExpressions;
using TwoWholeWorms.Lumbricus.Shared.Model;
using TwoWholeWorms.Lumbricus.Plugins.IrcLogPlugin.Model;
namespace TwoWholeWorms.Lumbricus.Plugins.SearchLogPlugin.Commands
{
public class SearchLogCommand : AbstractCommand
{
readonly static Logger logger = LogManager.GetCurrentClassLogger();
public SearchLogCommand(IrcConnection conn) : base(conn)
{
// …
}
public override string Name {
get {
return "Search Log Command";
}
}
public override void HandleCommand(IrcLine line, Nick nick, Channel channel)
{
try {
if (!isOp(nick)) {
conn.SendPrivmsg(nick.Name, String.Format("Sorry, {0}, but that command doesn't exist. Try !help.", nick.DisplayName));
return;
}
string target = nick.Name;
if (channel != null && channel.AllowCommandsInChannel) {
target = channel.Name;
}
Regex r = new Regex(@"^!searchlog ?");
line.Args = r.Replace(line.Args, "").Trim();
if (line.Args.Length <= 0) { // Whaaaat??
conn.SendPrivmsg(target, String.Format("Usage(1): !searchlog <search> - search examples: id:1 nick:{0} $a:{1}, #lumbricus, \"Magnus Magnusson\"", nick.DisplayName, nick.Account.Name));
} else {
string[] argBits;
string search = line.Args;
string searchType = "string";
long searchId = 0;
if (line.Args.StartsWith("id:")) {
if (line.Args.Contains(" ")) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: ID searches cannot contain spaces.", nick.DisplayName));
return;
}
argBits = line.Args.Split(':');
search = argBits[1];
Int64.TryParse(search, out searchId);
if (searchId < 1) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: ID must be > 0.", nick.DisplayName));
return;
}
searchType = "id";
}
if (line.Args.StartsWith("nick:")) {
if (line.Args.Contains(" ")) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: Nick searches cannot contain spaces.", nick.DisplayName));
return;
}
argBits = line.Args.Split(':');
search = argBits[1];
searchType = "nick";
}
if (line.Args.StartsWith("$a:")) {
if (line.Args.Contains(" ")) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: Account searches cannot contain spaces.", nick.DisplayName));
return;
}
argBits = line.Args.Split(':');
search = argBits[1];
searchType = "account";
}
if (line.Args.StartsWith("#")) {
if (line.Args.Contains(" ")) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: Channel searches cannot contain spaces.", nick.DisplayName));
return;
}
search = line.Args;
searchType = "channel";
}
if (searchType == "string") {
if (!line.Args.StartsWith("\"") || !line.Args.EndsWith("\"") || line.Args.Count(f => f == '\"') != 2) {
conn.SendPrivmsg(target, String.Format("Usage(2): !searchlog <search> - search examples: id:1 nick:{0} $a:{1}, #lumbricus, \"Magnus Magnusson\"", nick.DisplayName, nick.Account.Name));
return;
}
if (line.Args.Trim().Replace("%", "").Length < 7) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: Text searches must be at least 5 characters long, not including wildcards.", nick.DisplayName));
return;
}
search = line.Args.Substring(1, (line.Args.Length - 2));
}
Log ignoreLogLine = Log.Fetch(nick);
long totalLines = 0;
Log logLine = null;
Account searchAccount = null;
Nick searchNick = null;
Channel searchChannel = null;
switch (searchType) {
case "id":
logLine = Log.Fetch(searchId);
totalLines = (logLine == null ? 0 : 1);
if (logLine != null) {
if (logLine.Channel != null) {
searchChannel = Channel.Fetch(logLine.Channel.Id);
}
} else {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: Log entry id `{1}` does not exist.", nick.DisplayName, searchId));
return;
}
break;
case "string":
if (search.Contains("\"")) search = search.Replace("\"", "");
totalLines = Log.FetchTotal(search);
logLine = Log.Fetch(search, ignoreLogLine, channel);
if (logLine != null) {
if (logLine.Channel != null) {
searchChannel = Channel.Fetch(logLine.Channel.Id);
}
} else {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: No results for search `{1}`.", nick.DisplayName, search));
return;
}
break;
case "account":
searchAccount = Account.Fetch(search.ToLower(), conn.Server);
if (searchAccount == null) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: There is no account `{1}` in the database", nick.DisplayName, search));
return;
}
if (searchAccount.MostRecentNick != null) {
searchNick = searchAccount.MostRecentNick;
totalLines = Log.FetchTotal(searchNick);
logLine = Log.Fetch(searchNick, ignoreLogLine, channel);
} else {
totalLines = Log.FetchTotal(searchAccount);
logLine = Log.Fetch(searchAccount, ignoreLogLine, channel);
}
if (logLine != null) {
if (logLine.Channel != null) {
searchChannel = Channel.Fetch(logLine.Channel.Id);
}
} else {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: $a:{1} is not in the log (?!)", nick.DisplayName, searchAccount.Name));
return;
}
break;
case "nick":
searchNick = Nick.Fetch(search.ToLower(), conn.Server);
if (searchNick == null) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: There is no nick `{1}` in the database", nick.DisplayName, search));
return;
}
if (searchNick.Account != null) {
searchAccount = searchNick.Account;
}
totalLines = Log.FetchTotal(searchNick);
logLine = Log.Fetch(searchNick, ignoreLogLine, channel);
if (logLine != null) {
if (logLine.Channel != null) {
searchChannel = Channel.Fetch(logLine.Channel.Id);
}
} else {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: nick:{1} is not in the log (?!)", nick.DisplayName, searchNick.DisplayName));
return;
}
break;
case "channel":
searchChannel = Channel.Fetch(search.ToLower(), conn.Server);
if (searchChannel == null) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: There is no channel `{1}` in the database", nick.DisplayName, search));
return;
}
totalLines = Log.FetchTotal(searchChannel);
logLine = Log.Fetch(searchChannel, ignoreLogLine);
if (logLine == null) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: {1} is not in the log (?!)", nick.DisplayName, searchChannel.Name));
return;
}
break;
}
if (logLine == null) {
conn.SendPrivmsg(target, String.Format("\x02{0}\x0f: This message should never appear, what the HELL did you DO to me?! D:", nick.DisplayName));
return;
}
string response = totalLines + " found, latest: " + (searchChannel != null ? searchChannel.Name : conn.Server.BotNick) + " [" + logLine.LoggedAt.ToString("u") + "] " + logLine.Line;
conn.SendPrivmsg(target, response);
}
} catch (Exception e) {
logger.Error(e);
conn.SendPrivmsg(nick.Name, "Oof… My spleen…! I can't do that right now. :(");
}
}
}
}
| 49.723982 | 212 | 0.420329 | [
"MIT"
] | BenjaminNolan/lumbricus | Plugins/SearchLogPlugin/Commands/SearchLogCommand.cs | 10,997 | C# |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/*=============================================================================
**
**
**
** Purpose: The base class for all "less serious" exceptions that must be
** declared or caught.
**
**
=============================================================================*/
namespace System {
using System.Runtime.Serialization;
// The ApplicationException is the base class for nonfatal,
// application errors that occur. These exceptions are generated
// (i.e., thrown) by an application, not the Runtime. Applications that need
// to create their own exceptions do so by extending this class.
// ApplicationException extends but adds no new functionality to
// RecoverableException.
//
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
public class ApplicationException : Exception {
// Creates a new ApplicationException with its message string set to
// the empty string, its HRESULT set to COR_E_APPLICATION,
// and its ExceptionInfo reference set to null.
public ApplicationException()
: base(Environment.GetResourceString("Arg_ApplicationException")) {
SetErrorCode(__HResults.COR_E_APPLICATION);
}
// Creates a new ApplicationException with its message string set to
// message, its HRESULT set to COR_E_APPLICATION,
// and its ExceptionInfo reference set to null.
//
public ApplicationException(String message)
: base(message) {
SetErrorCode(__HResults.COR_E_APPLICATION);
}
public ApplicationException(String message, Exception innerException)
: base(message, innerException) {
SetErrorCode(__HResults.COR_E_APPLICATION);
}
protected ApplicationException(SerializationInfo info, StreamingContext context) : base(info, context) {
}
}
}
| 37.625 | 112 | 0.619364 | [
"MIT"
] | CyberSys/coreclr-mono | src/mscorlib/src/System/ApplicationException.cs | 2,107 | C# |
// Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Engine.NextGen;
using Stride.Games;
using Stride.Graphics.Regression;
using Stride.Rendering.Compositing;
using Stride.Rendering.Images;
namespace Stride.Graphics.Tests
{
public class TestLightShafts : GraphicTestGameBase
{
public TestLightShafts()
{
// 2 = Fix projection issues
// 3 = Simplifiy density parameters
// 4 = Change random jitter position hash
GraphicsDeviceManager.PreferredGraphicsProfile = new[] { GraphicsProfile.Level_10_0 };
GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
}
protected override void PrepareContext()
{
base.PrepareContext();
SceneSystem.InitialGraphicsCompositorUrl = "LightShaftsGraphicsCompositor";
SceneSystem.InitialSceneUrl = "LightShafts";
}
protected override async Task LoadContent()
{
await base.LoadContent();
Window.AllowUserResizing = true;
var cameraEntity = SceneSystem.SceneInstance.First(x => x.Get<CameraComponent>() != null);
cameraEntity.Add(new FpsTestCamera() {MoveSpeed = 10.0f });
}
protected override void RegisterTests()
{
base.RegisterTests();
FrameGameSystem.TakeScreenshot(2);
}
/// <summary>
/// Run the test
/// </summary>
[Fact]
public void RunLightShafts()
{
RunGameTest(new TestLightShafts());
}
}
}
| 30.015625 | 118 | 0.634045 | [
"MIT"
] | Aggror/Stride | sources/engine/Stride.Graphics.Tests.10_0/TestLightShafts.cs | 1,921 | C# |
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
namespace Utils
{
[System.Serializable]
public class SceneField
{
[SerializeField] private Object m_SceneAsset;
[SerializeField] private string m_SceneName;
public string SceneName => m_SceneName;
public static implicit operator string(SceneField sceneField)
{
return sceneField.SceneName;
}
}
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(SceneField))]
public class SceneFieldPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, GUIContent.none, property);
var sceneAsset = property.FindPropertyRelative("m_SceneAsset");
var sceneName = property.FindPropertyRelative("m_SceneName");
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
if (sceneAsset != null)
{
sceneAsset.objectReferenceValue = EditorGUI.ObjectField(position, sceneAsset.objectReferenceValue, typeof(SceneAsset), false);
if (sceneAsset.objectReferenceValue != null)
{
sceneName.stringValue = (sceneAsset.objectReferenceValue as SceneAsset).name;
}
}
EditorGUI.EndProperty();
}
}
#endif
} | 34.857143 | 142 | 0.651639 | [
"MIT"
] | ArcturusZhang/Mahjong | Assets/Scripts/Utils/SceneField.cs | 1,464 | C# |
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
public class Bezier : MonoBehaviour {
Vector2[,] UV;
public TraceControl GenerateController;
public MeshFilter MeshGeneration;
List<Vector3> verts = new List<Vector3>();
void Start () {
UV = new Vector2[GenerateController.sphere_m, GenerateController.sphere_n];
for (int i = 0; i < GenerateController.sphere_m; i++)
{
for(int j = 0; j < GenerateController.sphere_n; j++)
{
float _u = (float)j /( GenerateController.sphere_n -1);
float _v = (float)i /( GenerateController.sphere_m -1);
UV[i, j] = new Vector2(_u, _v);
// Debug.Log("uv: "+_u+" "+_v);
}
}
}
// Update is called once per frame
void Update () {
//to texture vertices
int total = GenerateController.sphere_m* GenerateController.sphere_n;
int index=0;
for (int i = 0; i < GenerateController.sphere_m; i++)
{
for (int j = 0; j < GenerateController.sphere_n; j++)
{
Vector3 _p = P (UV [i, j].x, UV [i, j].y);
GenerateController.GetSphere (i, j).position = _p;
}
}
verts.Clear ();
for (int i = 0; i < GenerateController.sphere_m; i++)
{
for (int j = 0; j < GenerateController.sphere_n; j++)
{
verts.Add (GenerateController.GetSphere (i, j).localPosition);
// MeshGeneration.mesh.vertices [index++] = GenerateController.GetSphere (i, j).position;
}
}
MeshGeneration.mesh.SetVertices (verts);
index = 0;
}
float Factorial(int n)
{
float product=1;
while(n!= 0)
{
product *= n;
n--;
}
return product;
}
float Combin(int n,int k)
{
if(n>=k)
{
float result = Factorial(n) / (Factorial(k) * Factorial(n - k));
return result;
}
else
{
return 0;
}
}
float BEZ(int k, int n, float u)
{
float result = Combin(n, k) * Mathf.Pow(u, k) * Mathf.Pow(1-u,n-k);
return result;
}
//compute the position of the point with (u,v) image coordinate
Vector3 P(float u,float v)
{
int m = GenerateController.m;
int n = GenerateController.n;
float tempX = 0;
float tempY = 0;
float tempZ = 0;
for (int j = 0; j < m; j++)
{
for (int k = 0; k < n; k++)
{
tempX += GenerateController.GetControlPoint (j, k).position.x * BEZ (j, m - 1, v) * BEZ (k, n - 1, u);
tempY += GenerateController.GetControlPoint (j, k).position.y * BEZ (j, m - 1, v) * BEZ (k, n - 1, u);
tempZ += GenerateController.GetControlPoint (j, k).position.z * BEZ (j, m - 1, v) * BEZ (k, n - 1, u);
}
}
return new Vector3(tempX,tempY,tempZ);
}
} | 23.369369 | 106 | 0.610254 | [
"BSD-3-Clause"
] | yl3495470/Survival | Assets/Scripts/Tools/Bezier.cs | 2,596 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Generator.Models
{
public class TableInfo
{
public string Name { get; set; }
public string Desciption { get; set; }
}
}
| 17.3125 | 46 | 0.68231 | [
"MIT"
] | 280780363/efentitybuilder | src/EntityGenerateFromDb/Generator/Models/TableInfo.cs | 279 | 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 mediaconvert-2017-08-29.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.MediaConvert.Model
{
/// <summary>
/// DVB Sub Source Settings
/// </summary>
public partial class DvbSubSourceSettings
{
private int? _pid;
/// <summary>
/// Gets and sets the property Pid. When using DVB-Sub with Burn-In or SMPTE-TT, use this
/// PID for the source content. Unused for DVB-Sub passthrough. All DVB-Sub content is
/// passed through, regardless of selectors.
/// </summary>
public int Pid
{
get { return this._pid.GetValueOrDefault(); }
set { this._pid = value; }
}
// Check to see if Pid property is set
internal bool IsSetPid()
{
return this._pid.HasValue;
}
}
} | 29.909091 | 110 | 0.659574 | [
"Apache-2.0"
] | Bio2hazard/aws-sdk-net | sdk/src/Services/MediaConvert/Generated/Model/DvbSubSourceSettings.cs | 1,645 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.ResourceManager.Core;
using Azure.ResourceManager.Sql.Models;
namespace Azure.ResourceManager.Sql
{
/// <summary> A class representing collection of Advisor and their operations over its parent. </summary>
public partial class ServerDatabaseAdvisorCollection : ArmCollection, IEnumerable<ServerDatabaseAdvisor>, IAsyncEnumerable<ServerDatabaseAdvisor>
{
private readonly ClientDiagnostics _clientDiagnostics;
private readonly DatabaseAdvisorsRestOperations _databaseAdvisorsRestClient;
/// <summary> Initializes a new instance of the <see cref="ServerDatabaseAdvisorCollection"/> class for mocking. </summary>
protected ServerDatabaseAdvisorCollection()
{
}
/// <summary> Initializes a new instance of the <see cref="ServerDatabaseAdvisorCollection"/> class. </summary>
/// <param name="parent"> The resource representing the parent resource. </param>
internal ServerDatabaseAdvisorCollection(ArmResource parent) : base(parent)
{
_clientDiagnostics = new ClientDiagnostics(ClientOptions);
ClientOptions.TryGetApiVersion(ServerDatabaseAdvisor.ResourceType, out string apiVersion);
_databaseAdvisorsRestClient = new DatabaseAdvisorsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri, apiVersion);
#if DEBUG
ValidateResourceId(Id);
#endif
}
internal static void ValidateResourceId(ResourceIdentifier id)
{
if (id.ResourceType != SqlDatabase.ResourceType)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SqlDatabase.ResourceType), nameof(id));
}
// Collection level operations.
/// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}
/// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}
/// OperationId: DatabaseAdvisors_Get
/// <summary> Gets a database advisor. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public virtual Response<ServerDatabaseAdvisor> Get(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.Get");
scope.Start();
try
{
var response = _databaseAdvisorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken);
if (response.Value == null)
throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse());
return Response.FromValue(new ServerDatabaseAdvisor(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors/{advisorName}
/// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}
/// OperationId: DatabaseAdvisors_Get
/// <summary> Gets a database advisor. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public async virtual Task<Response<ServerDatabaseAdvisor>> GetAsync(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.Get");
scope.Start();
try
{
var response = await _databaseAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken).ConfigureAwait(false);
if (response.Value == null)
throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false);
return Response.FromValue(new ServerDatabaseAdvisor(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public virtual Response<ServerDatabaseAdvisor> GetIfExists(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.GetIfExists");
scope.Start();
try
{
var response = _databaseAdvisorsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken: cancellationToken);
if (response.Value == null)
return Response.FromValue<ServerDatabaseAdvisor>(null, response.GetRawResponse());
return Response.FromValue(new ServerDatabaseAdvisor(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public async virtual Task<Response<ServerDatabaseAdvisor>> GetIfExistsAsync(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.GetIfExists");
scope.Start();
try
{
var response = await _databaseAdvisorsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, advisorName, cancellationToken: cancellationToken).ConfigureAwait(false);
if (response.Value == null)
return Response.FromValue<ServerDatabaseAdvisor>(null, response.GetRawResponse());
return Response.FromValue(new ServerDatabaseAdvisor(this, response.Value), response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public virtual Response<bool> Exists(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.Exists");
scope.Start();
try
{
var response = GetIfExists(advisorName, cancellationToken: cancellationToken);
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// <summary> Tries to get details for this resource from the service. </summary>
/// <param name="advisorName"> The name of the Database Advisor. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentException"> <paramref name="advisorName"/> is empty. </exception>
/// <exception cref="ArgumentNullException"> <paramref name="advisorName"/> is null. </exception>
public async virtual Task<Response<bool>> ExistsAsync(string advisorName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNullOrEmpty(advisorName, nameof(advisorName));
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.Exists");
scope.Start();
try
{
var response = await GetIfExistsAsync(advisorName, cancellationToken: cancellationToken).ConfigureAwait(false);
return Response.FromValue(response.Value != null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
/// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors
/// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}
/// OperationId: DatabaseAdvisors_ListByDatabase
/// <summary> Gets a list of database advisors. </summary>
/// <param name="expand"> The child resources to include in the response. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <returns> A collection of <see cref="ServerDatabaseAdvisor" /> that may take multiple service requests to iterate over. </returns>
public virtual Pageable<ServerDatabaseAdvisor> GetAll(string expand = null, CancellationToken cancellationToken = default)
{
Page<ServerDatabaseAdvisor> FirstPageFunc(int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.GetAll");
scope.Start();
try
{
var response = _databaseAdvisorsRestClient.ListByDatabase(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken: cancellationToken);
return Page.FromValues(response.Value.Select(value => new ServerDatabaseAdvisor(this, value)), null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
}
/// RequestPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/advisors
/// ContextualPath: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}
/// OperationId: DatabaseAdvisors_ListByDatabase
/// <summary> Gets a list of database advisors. </summary>
/// <param name="expand"> The child resources to include in the response. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <returns> An async collection of <see cref="ServerDatabaseAdvisor" /> that may take multiple service requests to iterate over. </returns>
public virtual AsyncPageable<ServerDatabaseAdvisor> GetAllAsync(string expand = null, CancellationToken cancellationToken = default)
{
async Task<Page<ServerDatabaseAdvisor>> FirstPageFunc(int? pageSizeHint)
{
using var scope = _clientDiagnostics.CreateScope("ServerDatabaseAdvisorCollection.GetAll");
scope.Start();
try
{
var response = await _databaseAdvisorsRestClient.ListByDatabaseAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, expand, cancellationToken: cancellationToken).ConfigureAwait(false);
return Page.FromValues(response.Value.Select(value => new ServerDatabaseAdvisor(this, value)), null, response.GetRawResponse());
}
catch (Exception e)
{
scope.Failed(e);
throw;
}
}
return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
}
IEnumerator<ServerDatabaseAdvisor> IEnumerable<ServerDatabaseAdvisor>.GetEnumerator()
{
return GetAll().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetAll().GetEnumerator();
}
IAsyncEnumerator<ServerDatabaseAdvisor> IAsyncEnumerable<ServerDatabaseAdvisor>.GetAsyncEnumerator(CancellationToken cancellationToken)
{
return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken);
}
// Builders.
// public ArmBuilder<Azure.Core.ResourceIdentifier, ServerDatabaseAdvisor, AdvisorData> Construct() { }
}
}
| 55.16129 | 223 | 0.661858 | [
"MIT"
] | ElleTojaroon/azure-sdk-for-net | sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ServerDatabaseAdvisorCollection.cs | 15,390 | 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 es-2015-01-01.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Amazon.Elasticsearch.Model;
using Amazon.Elasticsearch.Model.Internal.MarshallTransformations;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.Elasticsearch
{
/// <summary>
/// Implementation for accessing Elasticsearch
///
/// Amazon Elasticsearch Configuration Service
/// <para>
/// Use the Amazon Elasticsearch configuration API to create, configure, and manage Elasticsearch
/// domains.
/// </para>
///
/// <para>
/// The endpoint for configuration service requests is region-specific: es.<i>region</i>.amazonaws.com.
/// For example, es.us-east-1.amazonaws.com. For a current list of supported regions and
/// endpoints, see <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#cloudsearch_region"
/// target="_blank">Regions and Endpoints</a>.
/// </para>
/// </summary>
public partial class AmazonElasticsearchClient : AmazonServiceClient, IAmazonElasticsearch
{
#region Constructors
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonElasticsearchConfig()) { }
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonElasticsearchConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient Configuration Object</param>
public AmazonElasticsearchClient(AmazonElasticsearchConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonElasticsearchClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonElasticsearchClient(AWSCredentials credentials)
: this(credentials, new AmazonElasticsearchConfig())
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonElasticsearchClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonElasticsearchConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient with AWS Credentials and an
/// AmazonElasticsearchClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonElasticsearchClient Configuration Object</param>
public AmazonElasticsearchClient(AWSCredentials credentials, AmazonElasticsearchConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonElasticsearchConfig())
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonElasticsearchConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonElasticsearchClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonElasticsearchClient Configuration Object</param>
public AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonElasticsearchConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonElasticsearchConfig())
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient 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 AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonElasticsearchConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonElasticsearchClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonElasticsearchClient 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 AmazonElasticsearchClient Configuration Object</param>
public AmazonElasticsearchClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonElasticsearchConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region AddTags
/// <summary>
/// Attaches tags to an existing Elasticsearch domain. Tags are a set of case-sensitive
/// key value pairs. An Elasticsearch domain may have up to 10 tags. See <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html#es-managedomains-awsresorcetagging"
/// target="_blank"> Tagging Amazon Elasticsearch Service Domains for more information.</a>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddTags service method.</param>
///
/// <returns>The response from the AddTags service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.LimitExceededException">
/// An exception for trying to create more than allowed resources or sub-resources. Gives
/// http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public AddTagsResponse AddTags(AddTagsRequest request)
{
var marshaller = new AddTagsRequestMarshaller();
var unmarshaller = AddTagsResponseUnmarshaller.Instance;
return Invoke<AddTagsRequest,AddTagsResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the AddTags operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the AddTags operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<AddTagsResponse> AddTagsAsync(AddTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new AddTagsRequestMarshaller();
var unmarshaller = AddTagsResponseUnmarshaller.Instance;
return InvokeAsync<AddTagsRequest,AddTagsResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region CreateElasticsearchDomain
/// <summary>
/// Creates a new Elasticsearch domain. For more information, see <a href="http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomains"
/// target="_blank">Creating Elasticsearch Domains</a> in the <i>Amazon Elasticsearch
/// Service Developer Guide</i>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateElasticsearchDomain service method.</param>
///
/// <returns>The response from the CreateElasticsearchDomain service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.DisabledOperationException">
/// An error occured because the client wanted to access a not supported operation. Gives
/// http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InvalidTypeException">
/// An exception for trying to create or access sub-resource that is either invalid or
/// not supported. Gives http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.LimitExceededException">
/// An exception for trying to create more than allowed resources or sub-resources. Gives
/// http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceAlreadyExistsException">
/// An exception for creating a resource that already exists. Gives http status code of
/// 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public CreateElasticsearchDomainResponse CreateElasticsearchDomain(CreateElasticsearchDomainRequest request)
{
var marshaller = new CreateElasticsearchDomainRequestMarshaller();
var unmarshaller = CreateElasticsearchDomainResponseUnmarshaller.Instance;
return Invoke<CreateElasticsearchDomainRequest,CreateElasticsearchDomainResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateElasticsearchDomain operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateElasticsearchDomain operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<CreateElasticsearchDomainResponse> CreateElasticsearchDomainAsync(CreateElasticsearchDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new CreateElasticsearchDomainRequestMarshaller();
var unmarshaller = CreateElasticsearchDomainResponseUnmarshaller.Instance;
return InvokeAsync<CreateElasticsearchDomainRequest,CreateElasticsearchDomainResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region DeleteElasticsearchDomain
/// <summary>
/// Permanently deletes the specified Elasticsearch domain and all of its data. Once a
/// domain is deleted, it cannot be recovered.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteElasticsearchDomain service method.</param>
///
/// <returns>The response from the DeleteElasticsearchDomain service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceNotFoundException">
/// An exception for accessing or deleting a resource that does not exist. Gives http
/// status code of 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public DeleteElasticsearchDomainResponse DeleteElasticsearchDomain(DeleteElasticsearchDomainRequest request)
{
var marshaller = new DeleteElasticsearchDomainRequestMarshaller();
var unmarshaller = DeleteElasticsearchDomainResponseUnmarshaller.Instance;
return Invoke<DeleteElasticsearchDomainRequest,DeleteElasticsearchDomainResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteElasticsearchDomain operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteElasticsearchDomain operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<DeleteElasticsearchDomainResponse> DeleteElasticsearchDomainAsync(DeleteElasticsearchDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new DeleteElasticsearchDomainRequestMarshaller();
var unmarshaller = DeleteElasticsearchDomainResponseUnmarshaller.Instance;
return InvokeAsync<DeleteElasticsearchDomainRequest,DeleteElasticsearchDomainResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region DescribeElasticsearchDomain
/// <summary>
/// Returns domain configuration information about the specified Elasticsearch domain,
/// including the domain ID, domain endpoint, and domain ARN.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomain service method.</param>
///
/// <returns>The response from the DescribeElasticsearchDomain service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceNotFoundException">
/// An exception for accessing or deleting a resource that does not exist. Gives http
/// status code of 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public DescribeElasticsearchDomainResponse DescribeElasticsearchDomain(DescribeElasticsearchDomainRequest request)
{
var marshaller = new DescribeElasticsearchDomainRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainResponseUnmarshaller.Instance;
return Invoke<DescribeElasticsearchDomainRequest,DescribeElasticsearchDomainResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeElasticsearchDomain operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomain operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<DescribeElasticsearchDomainResponse> DescribeElasticsearchDomainAsync(DescribeElasticsearchDomainRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new DescribeElasticsearchDomainRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainResponseUnmarshaller.Instance;
return InvokeAsync<DescribeElasticsearchDomainRequest,DescribeElasticsearchDomainResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region DescribeElasticsearchDomainConfig
/// <summary>
/// Provides cluster configuration information about the specified Elasticsearch domain,
/// such as the state, creation date, update version, and update date for cluster options.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomainConfig service method.</param>
///
/// <returns>The response from the DescribeElasticsearchDomainConfig service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceNotFoundException">
/// An exception for accessing or deleting a resource that does not exist. Gives http
/// status code of 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public DescribeElasticsearchDomainConfigResponse DescribeElasticsearchDomainConfig(DescribeElasticsearchDomainConfigRequest request)
{
var marshaller = new DescribeElasticsearchDomainConfigRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainConfigResponseUnmarshaller.Instance;
return Invoke<DescribeElasticsearchDomainConfigRequest,DescribeElasticsearchDomainConfigResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeElasticsearchDomainConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomainConfig operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<DescribeElasticsearchDomainConfigResponse> DescribeElasticsearchDomainConfigAsync(DescribeElasticsearchDomainConfigRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new DescribeElasticsearchDomainConfigRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainConfigResponseUnmarshaller.Instance;
return InvokeAsync<DescribeElasticsearchDomainConfigRequest,DescribeElasticsearchDomainConfigResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region DescribeElasticsearchDomains
/// <summary>
/// Returns domain configuration information about the specified Elasticsearch domains,
/// including the domain ID, domain endpoint, and domain ARN.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomains service method.</param>
///
/// <returns>The response from the DescribeElasticsearchDomains service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public DescribeElasticsearchDomainsResponse DescribeElasticsearchDomains(DescribeElasticsearchDomainsRequest request)
{
var marshaller = new DescribeElasticsearchDomainsRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainsResponseUnmarshaller.Instance;
return Invoke<DescribeElasticsearchDomainsRequest,DescribeElasticsearchDomainsResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeElasticsearchDomains operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeElasticsearchDomains operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<DescribeElasticsearchDomainsResponse> DescribeElasticsearchDomainsAsync(DescribeElasticsearchDomainsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new DescribeElasticsearchDomainsRequestMarshaller();
var unmarshaller = DescribeElasticsearchDomainsResponseUnmarshaller.Instance;
return InvokeAsync<DescribeElasticsearchDomainsRequest,DescribeElasticsearchDomainsResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region ListDomainNames
/// <summary>
/// Returns the name of all Elasticsearch domains owned by the current user's account.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListDomainNames service method.</param>
///
/// <returns>The response from the ListDomainNames service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public ListDomainNamesResponse ListDomainNames(ListDomainNamesRequest request)
{
var marshaller = new ListDomainNamesRequestMarshaller();
var unmarshaller = ListDomainNamesResponseUnmarshaller.Instance;
return Invoke<ListDomainNamesRequest,ListDomainNamesResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the ListDomainNames operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListDomainNames operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<ListDomainNamesResponse> ListDomainNamesAsync(ListDomainNamesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new ListDomainNamesRequestMarshaller();
var unmarshaller = ListDomainNamesResponseUnmarshaller.Instance;
return InvokeAsync<ListDomainNamesRequest,ListDomainNamesResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region ListTags
/// <summary>
/// Returns all tags for the given Elasticsearch domain.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTags service method.</param>
///
/// <returns>The response from the ListTags service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceNotFoundException">
/// An exception for accessing or deleting a resource that does not exist. Gives http
/// status code of 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public ListTagsResponse ListTags(ListTagsRequest request)
{
var marshaller = new ListTagsRequestMarshaller();
var unmarshaller = ListTagsResponseUnmarshaller.Instance;
return Invoke<ListTagsRequest,ListTagsResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTags operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTags operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<ListTagsResponse> ListTagsAsync(ListTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new ListTagsRequestMarshaller();
var unmarshaller = ListTagsResponseUnmarshaller.Instance;
return InvokeAsync<ListTagsRequest,ListTagsResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region RemoveTags
/// <summary>
/// Removes the specified set of tags from the specified Elasticsearch domain.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveTags service method.</param>
///
/// <returns>The response from the RemoveTags service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public RemoveTagsResponse RemoveTags(RemoveTagsRequest request)
{
var marshaller = new RemoveTagsRequestMarshaller();
var unmarshaller = RemoveTagsResponseUnmarshaller.Instance;
return Invoke<RemoveTagsRequest,RemoveTagsResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the RemoveTags operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RemoveTags operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<RemoveTagsResponse> RemoveTagsAsync(RemoveTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new RemoveTagsRequestMarshaller();
var unmarshaller = RemoveTagsResponseUnmarshaller.Instance;
return InvokeAsync<RemoveTagsRequest,RemoveTagsResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
#region UpdateElasticsearchDomainConfig
/// <summary>
/// Modifies the cluster configuration of the specified Elasticsearch domain, setting
/// as setting the instance type and the number of instances.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateElasticsearchDomainConfig service method.</param>
///
/// <returns>The response from the UpdateElasticsearchDomainConfig service method, as returned by Elasticsearch.</returns>
/// <exception cref="Amazon.Elasticsearch.Model.BaseException">
/// An error occurred while processing the request.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InternalException">
/// The request processing has failed because of an unknown error, exception or failure
/// (the failure is internal to the service) . Gives http status code of 500.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.InvalidTypeException">
/// An exception for trying to create or access sub-resource that is either invalid or
/// not supported. Gives http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.LimitExceededException">
/// An exception for trying to create more than allowed resources or sub-resources. Gives
/// http status code of 409.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ResourceNotFoundException">
/// An exception for accessing or deleting a resource that does not exist. Gives http
/// status code of 400.
/// </exception>
/// <exception cref="Amazon.Elasticsearch.Model.ValidationException">
/// An exception for missing / invalid input fields. Gives http status code of 400.
/// </exception>
public UpdateElasticsearchDomainConfigResponse UpdateElasticsearchDomainConfig(UpdateElasticsearchDomainConfigRequest request)
{
var marshaller = new UpdateElasticsearchDomainConfigRequestMarshaller();
var unmarshaller = UpdateElasticsearchDomainConfigResponseUnmarshaller.Instance;
return Invoke<UpdateElasticsearchDomainConfigRequest,UpdateElasticsearchDomainConfigResponse>(request, marshaller, unmarshaller);
}
/// <summary>
/// Initiates the asynchronous execution of the UpdateElasticsearchDomainConfig operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UpdateElasticsearchDomainConfig operation.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
/// <returns>The task object representing the asynchronous operation.</returns>
public Task<UpdateElasticsearchDomainConfigResponse> UpdateElasticsearchDomainConfigAsync(UpdateElasticsearchDomainConfigRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var marshaller = new UpdateElasticsearchDomainConfigRequestMarshaller();
var unmarshaller = UpdateElasticsearchDomainConfigResponseUnmarshaller.Instance;
return InvokeAsync<UpdateElasticsearchDomainConfigRequest,UpdateElasticsearchDomainConfigResponse>(request, marshaller,
unmarshaller, cancellationToken);
}
#endregion
}
} | 52.014417 | 234 | 0.677602 | [
"Apache-2.0"
] | SaschaHaertel/AmazonAWS | sdk/src/Services/Elasticsearch/Generated/_bcl45/AmazonElasticsearchClient.cs | 39,687 | 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: MethodRequestBody.cs.tt
namespace Microsoft.Graph
{
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
/// <summary>
/// The type WorkbookFunctionsDbcsRequestBody.
/// </summary>
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public partial class WorkbookFunctionsDbcsRequestBody
{
/// <summary>
/// Gets or sets Text.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "text", Required = Newtonsoft.Json.Required.Default)]
public Newtonsoft.Json.Linq.JToken Text { get; set; }
}
}
| 34.939394 | 153 | 0.593235 | [
"MIT"
] | DamienTehDemon/msgraph-sdk-dotnet | src/Microsoft.Graph/Generated/model/WorkbookFunctionsDbcsRequestBody.cs | 1,153 | C# |
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Pathoschild.Stardew.TractorMod.Framework.Attachments;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Locations;
using StardewValley.Objects;
using StardewValley.TerrainFeatures;
using xTile.Dimensions;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
using SObject = StardewValley.Object;
namespace Pathoschild.Stardew.TractorMod.Framework
{
/// <summary>The base class for tool implementations.</summary>
internal abstract class BaseAttachment : IAttachment
{
/*********
** Fields
*********/
/// <summary>Simplifies access to private code.</summary>
protected IReflectionHelper Reflection { get; }
/*********
** Accessors
*********/
/// <summary>The minimum number of ticks between each update.</summary>
public int RateLimit { get; }
/*********
** Public methods
*********/
/// <summary>Get whether the tool is currently enabled.</summary>
/// <param name="player">The current player.</param>
/// <param name="tool">The tool selected by the player (if any).</param>
/// <param name="item">The item selected by the player (if any).</param>
/// <param name="location">The current location.</param>
public abstract bool IsEnabled(Farmer player, Tool tool, Item item, GameLocation location);
/// <summary>Apply the tool to the given tile.</summary>
/// <param name="tile">The tile to modify.</param>
/// <param name="tileObj">The object on the tile.</param>
/// <param name="tileFeature">The feature on the tile.</param>
/// <param name="player">The current player.</param>
/// <param name="tool">The tool selected by the player (if any).</param>
/// <param name="item">The item selected by the player (if any).</param>
/// <param name="location">The current location.</param>
public abstract bool Apply(Vector2 tile, SObject tileObj, TerrainFeature tileFeature, Farmer player, Tool tool, Item item, GameLocation location);
/*********
** Protected methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="reflection">Simplifies access to private code.</param>
/// <param name="rateLimit">The minimum number of ticks between each update.</param>
protected BaseAttachment(IReflectionHelper reflection, int rateLimit = 0)
{
this.Reflection = reflection;
this.RateLimit = rateLimit;
}
/// <summary>Use a tool on a tile.</summary>
/// <param name="tool">The tool to use.</param>
/// <param name="tile">The tile to affect.</param>
/// <returns>Returns <c>true</c> for convenience when implementing tools.</returns>
protected bool UseToolOnTile(Tool tool, Vector2 tile)
{
// use tool on center of tile
Vector2 useAt = (tile * Game1.tileSize) + new Vector2(Game1.tileSize / 2f);
Game1.player.lastClick = useAt;
tool.DoFunction(Game1.currentLocation, (int)useAt.X, (int)useAt.Y, 0, Game1.player);
return true;
}
/// <summary>Trigger the player action on the given tile.</summary>
/// <param name="location">The location for which to trigger an action.</param>
/// <param name="tile">The tile for which to trigger an action.</param>
/// <param name="player">The player for which to trigger an action.</param>
protected bool CheckTileAction(GameLocation location, Vector2 tile, Farmer player)
{
return location.checkAction(new Location((int)tile.X, (int)tile.Y), Game1.viewport, player);
}
/// <summary>Get whether a given object is a weed.</summary>
/// <param name="obj">The world object.</param>
protected bool IsTwig(SObject obj)
{
return obj?.ParentSheetIndex == 294 || obj?.ParentSheetIndex == 295;
}
/// <summary>Get whether a given object is a weed.</summary>
/// <param name="obj">The world object.</param>
protected bool IsWeed(SObject obj)
{
return !(obj is Chest) && obj?.Name == "Weeds";
}
/// <summary>Remove the specified items from the player inventory.</summary>
/// <param name="player">The player whose inventory to edit.</param>
/// <param name="item">The item instance to deduct.</param>
/// <param name="count">The number to deduct.</param>
protected void ConsumeItem(Farmer player, Item item, int count = 1)
{
item.Stack -= 1;
if (item.Stack <= 0)
player.removeItemFromInventory(item);
}
/// <summary>Get a rectangle representing the tile area in absolute pixels from the map origin.</summary>
/// <param name="tile">The tile position.</param>
protected Rectangle GetAbsoluteTileArea(Vector2 tile)
{
Vector2 pos = tile * Game1.tileSize;
return new Rectangle((int)pos.X, (int)pos.Y, Game1.tileSize, Game1.tileSize);
}
/// <summary>Get resource clumps in a given location.</summary>
/// <param name="location">The location to search.</param>
protected IEnumerable<ResourceClump> GetResourceClumps(GameLocation location)
{
switch (location)
{
case Farm farm:
return farm.resourceClumps;
case Forest forest:
return forest.log != null
? new[] { forest.log }
: new ResourceClump[0];
case Woods woods:
return woods.stumps;
case MineShaft mineshaft:
return mineshaft.resourceClumps;
default:
if (location.Name == "DeepWoods")
return this.Reflection.GetField<IList<ResourceClump>>(location, "resourceClumps", required: false)?.GetValue() ?? new ResourceClump[0];
return new ResourceClump[0];
}
}
/// <summary>Get the resource clump which covers a given tile, if any.</summary>
/// <param name="location">The location to check.</param>
/// <param name="tile">The tile to check.</param>
protected ResourceClump GetResourceClumpCoveringTile(GameLocation location, Vector2 tile)
{
Rectangle tileArea = this.GetAbsoluteTileArea(tile);
foreach (ResourceClump clump in this.GetResourceClumps(location))
{
if (clump.getBoundingBox(clump.tile.Value).Intersects(tileArea))
return clump;
}
return null;
}
/// <summary>Get the tilled dirt for a tile, if any.</summary>
/// <param name="tileFeature">The feature on the tile.</param>
/// <param name="tileObj">The object on the tile.</param>
/// <param name="dirt">The tilled dirt found, if any.</param>
/// <param name="isCoveredByObj">Whether there's an object placed over the tilled dirt.</param>
/// <returns>Returns whether tilled dirt was found.</returns>
protected bool TryGetHoeDirt(TerrainFeature tileFeature, SObject tileObj, out HoeDirt dirt, out bool isCoveredByObj)
{
// garden pot
if (tileObj is IndoorPot pot)
{
dirt = pot.hoeDirt.Value;
isCoveredByObj = false;
return true;
}
// regular dirt
if ((dirt = tileFeature as HoeDirt) != null)
{
isCoveredByObj = tileObj != null;
return true;
}
// none found
dirt = null;
isCoveredByObj = false;
return false;
}
}
}
| 41.807292 | 159 | 0.587393 | [
"MIT"
] | FrSigma/StardewMods | TractorMod/Framework/BaseAttachment.cs | 8,027 | C# |
using System.Collections.Generic;
namespace Silky.Http.Dashboard.Configuration
{
public class DashboardOptions
{
internal static string Dashboard = "Dashboard";
public DashboardOptions()
{
StatsPollingInterval = 2000;
ExternalLinks = new List<ExternalLinkOptions>();
}
public int StatsPollingInterval { get; set; }
public bool UseAuth { get; set; }
public string DashboardLoginApi { get; set; }
public bool DisplayWebApiInSwagger { get; set; }
public string PathBase { get; set; }
public bool WrapperResponse { get; set; }
public ICollection<ExternalLinkOptions> ExternalLinks { get; set; }
}
} | 25.068966 | 75 | 0.635488 | [
"MIT"
] | Dishone/silky | framework/src/Silky.Http.Dashboard/Configuration/DashboardOptions.cs | 727 | C# |
/*
* Copyright (c) .NET Foundation and Contributors
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
* https://github.com/piranhacms/piranha.core
*
*/
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Piranha.Manager.Models;
using Piranha.Manager.Services;
namespace Piranha.Manager.Controllers
{
/// <summary>
/// Api controller for site management.
/// </summary>
[Area("Manager")]
[Route("manager/api/site")]
[Authorize(Policy = Permission.Admin)]
[ApiController]
public class SiteApiController : Controller
{
private readonly SiteService _service;
private readonly ManagerLocalizer _localizer;
/// <summary>
/// Default constructor.
/// </summary>
public SiteApiController(SiteService service, ManagerLocalizer localizer)
{
_service = service;
_localizer = localizer;
}
/// <summary>
/// Gets the site with the given id.
/// </summary>
/// <param name="id">The unique id</param>
/// <returns>The page edit model</returns>
[Route("{id:Guid}")]
[HttpGet]
[Authorize(Policy = Permission.SitesEdit)]
public async Task<SiteEditModel> Get(Guid id)
{
return await _service.GetById(id);
}
/// <summary>
/// Gets the site content with the given id.
/// </summary>
/// <param name="id">The unique id</param>
/// <returns>The page edit model</returns>
[Route("content/{id:Guid}")]
[HttpGet]
[Authorize(Policy = Permission.SitesEdit)]
public async Task<IActionResult> GetContent(Guid id)
{
var model = await _service.GetContentById(id);
if (model != null)
{
return Ok(model);
}
return NotFound();
}
/// <summary>
/// Creates a new site.
/// </summary>
/// <returns>The site edit model</returns>
[Route("create")]
[HttpGet]
[Authorize(Policy = Permission.SitesAdd)]
public async Task<SiteEditModel> Create()
{
return await _service.Create();
}
/// <summary>
/// Gets the site with the given id.
/// </summary>
/// <param name="model">The site model</param>
/// <returns>The status of the operation</returns>
[Route("save")]
[HttpPost]
[Authorize(Policy = Permission.SitesEdit)]
public async Task<StatusMessage> Save(SiteEditModel model)
{
try
{
await _service.Save(model);
}
catch (ValidationException e)
{
// Validation did not succeed
return new StatusMessage
{
Type = StatusMessage.Error,
Body = e.Message
};
}
catch
{
return new StatusMessage
{
Type = StatusMessage.Error,
Body = _localizer.Site["An error occured while saving the site"]
};
}
return new StatusMessage
{
Type = StatusMessage.Success,
Body = _localizer.Site["The site was successfully saved"]
};
}
/// <summary>
/// Gets the site with the given id.
/// </summary>
/// <param name="model">The site model</param>
/// <returns>The status of the operation</returns>
[Route("savecontent")]
[HttpPost]
[Authorize(Policy = Permission.SitesEdit)]
public async Task<StatusMessage> SaveContent(SiteContentEditModel model)
{
try
{
await _service.SaveContent(model);
}
catch (ValidationException e)
{
// Validation did not succeed
return new StatusMessage
{
Type = StatusMessage.Error,
Body = e.Message
};
}
catch
{
return new StatusMessage
{
Type = StatusMessage.Error,
Body = _localizer.Site["An error occured while saving the site"]
};
}
return new StatusMessage
{
Type = StatusMessage.Success,
Body = _localizer.Site["The site was successfully saved"]
};
}
/// <summary>
/// Deletes the site with the given id.
/// </summary>
/// <param name="id">The unique id</param>
/// <returns>The result of the operation</returns>
[Route("delete/{id}")]
[HttpGet]
[Authorize(Policy = Permission.SitesDelete)]
public async Task<StatusMessage> Delete(Guid id)
{
try
{
await _service.Delete(id);
}
catch (ValidationException e)
{
// Validation did not succeed
return new StatusMessage
{
Type = StatusMessage.Error,
Body = e.Message
};
}
catch
{
return new StatusMessage
{
Type = StatusMessage.Error,
Body = _localizer.Site["An error occured while deleting the site"]
};
}
return new StatusMessage
{
Type = StatusMessage.Success,
Body = _localizer.Site["The site was successfully deleted"]
};
}
}
} | 29.807882 | 86 | 0.499752 | [
"MIT"
] | AhmedSultanDev/Dashboard-RC | core/Piranha.Manager/Controllers/SiteApiController.cs | 6,051 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace ProjetoHemobancoWeb.Models
{
[Table("Doador")]
public class Doador : BaseModel
{
[Required(ErrorMessage = "Campo obrigatório!")]
public string Nome { get; set; }
[Required(ErrorMessage = "Campo obrigatório!")]
public string Cpf { get; set; }
[Required(ErrorMessage = "Campo obrigatório!")]
public int Idade { get; set; }
[Required(ErrorMessage = "Campo obrigatório!")]
public string Email { get; set; }
[Display(Name = "CEP:")]
[Required(ErrorMessage = "Campo obrigatório!")]
public string Cep { get; set; }
[Display(Name = "Rua:")]
[Required(ErrorMessage = "Campo obrigatório!")]
public string Logradouro { get; set; }
[Display(Name = "Bairro:")]
[Required(ErrorMessage = "Campo obrigatório!")]
public string Bairro { get; set; }
[Display(Name = "Cidade:")]
[Required(ErrorMessage = "Campo obrigatório!")]
public string Localidade { get; set; }
[Display(Name = "Estado:")]
[Required(ErrorMessage = "Campo obrigatório!")]
public string Uf { get; set; }
[Required(ErrorMessage = "Campo obrigatório!")]
public string Telefone { get; set; }
[Required(ErrorMessage = "Campo obrigatório!")]
public string Celular { get; set; }
}
}
| 30.27451 | 55 | 0.612047 | [
"MIT"
] | whateverlcs/hemobancoWeb | Models/Doador.cs | 1,557 | C# |
using System;
using System.ComponentModel;
using EfsTools.Attributes;
using EfsTools.Utils;
using Newtonsoft.Json;
namespace EfsTools.Items.Efs
{
[Serializable]
[EfsFile("/nv/item_files/rfnv/00024804", true, 0xE1FF)]
[Attributes(9)]
public class LteB19AmprNs08
{
[ElementsCount(16)]
[ElementType("uint8")]
[Description("")]
public byte[] Value { get; set; }
}
}
| 21.333333 | 60 | 0.609375 | [
"MIT"
] | HomerSp/EfsTools | EfsTools/Items/Efs/LteB19AmprNs08I.cs | 448 | C# |
using System.Text.Json.Serialization;
namespace Essensoft.AspNetCore.Payment.Alipay.Domain
{
/// <summary>
/// ZhimaCreditRiskEvaluateQueryModel Data Structure.
/// </summary>
public class ZhimaCreditRiskEvaluateQueryModel : AlipayObject
{
/// <summary>
/// 扩展字段,用来标识用户的其他描述信息,是一个JSON串
/// </summary>
[JsonPropertyName("extend_info")]
public string ExtendInfo { get; set; }
/// <summary>
/// 产品码[直接传示例值]
/// </summary>
[JsonPropertyName("product_code")]
public string ProductCode { get; set; }
/// <summary>
/// 场景码,用来标识一套特定的风控策略
/// </summary>
[JsonPropertyName("scene_code")]
public string SceneCode { get; set; }
/// <summary>
/// 商户请求的唯一标志,长度64位以内字符串,仅限字母数字下划线组合。该标识作为业务调用的唯一标识,商户要保证其业务唯一性,使用相同transaction_id的查询,芝麻在一段时间内(一般为1天)返回首次查询结果,超过有效期的查询即为无效并返回异常,有效期内的重复查询不重新计费
/// </summary>
[JsonPropertyName("transaction_id")]
public string TransactionId { get; set; }
}
}
| 30.285714 | 150 | 0.617925 | [
"MIT"
] | LuohuaRain/payment | src/Essensoft.AspNetCore.Payment.Alipay/Domain/ZhimaCreditRiskEvaluateQueryModel.cs | 1,402 | C# |
// MIT License
//
// Copyright (c) 2016 Kyle Kingsbury
//
// 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 Sitecore.ContentSearch.Fluent.Options
{
using Results;
/// <summary>
/// Filtering Options
/// </summary>
public class FilterOptions<T> : QueryableOptions<T> where T : SearchResultItem
{
}
} | 42.625 | 82 | 0.741935 | [
"MIT"
] | KKings/Sitecore.ContentSearch.Fluent | src/Sitecore.ContentSearch.Fluent/Options/FilterOptions.cs | 1,366 | C# |
using ISAAR.MSolve.LinearAlgebra.Matrices;
namespace ISAAR.MSolve.Materials.Interfaces
{
public interface IContinuumMaterial3D : IFiniteElementMaterial
{
double[] Stresses { get; }
IMatrixView ConstitutiveMatrix { get; }
void UpdateMaterial(double[] strains);
IContinuumMaterial3D Clone();
}
}
| 26.153846 | 66 | 0.7 | [
"Apache-2.0"
] | gsoim/AnsysMSolve | ISAAR.MSolve.Materials/Interfaces/IContinuumMaterial3D.cs | 342 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using Lucene.Net.Documents;
namespace SSW.RulesSearch.Lucene
{
public interface IDocumentBuilder<T> where T : class
{
Document ToDocument(T model);
T ToModel(Document doc);
string KeyField { get; }
int ToKey(T model);
}
}
| 17.08 | 56 | 0.693208 | [
"Apache-2.0"
] | brendan-ssw/SSW.RulesSearch | SSW.RulesSearch/SSW.RulesSearch.Lucene/IDocumentBuilder.cs | 429 | C# |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Telepathy.EchoClient
{
using System;
using System.Collections.Generic;
/// <summary>
/// The configurations for the EchoClient
/// </summary>
public class Config
{
private const string HeadNodeArg = "headnode";
private const string RequestArg = "numberOfRequests";
private const string TimeMSArg = "timeMS";
private const string SizeByteArg = "sizeByte";
private const string ResourceTypeArg = "resourceType";
private const string MinArg = "min";
private const string MaxArg = "max";
private const string WarmupSecArg = "warmupSec";
private const string DurableArg = "durable";
private const string AsyncArg = "async";
private const string TransportSchemeArg = "scheme";
private const string InprocessBrokerArg = "inprocessBroker";
private const string IsNoSessionArg = "isNoSession";
private const string RegPathArg = "regPath";
private const string JobTemplateArg = "jobtemplate";
private const string PriorityArg = "priority";
private const string NodeGroupsArg = "groups";
private const string NodesArg = "requestedNodes";
private const string UserNameArg = "username";
private const string PasswordArg = "password";
private const string InsecureArg = "insecure";
private const string AzureQueueArg = "azureQueue";
private const string AzureStorageConnectionStringArg = "azureStor";
private const string ServiceNameArg = "serviceName";
private const string ShareSessionArg = "shareSession";
private const string SessionPoolArg = "sessionPool";
private const string RuntimeArg = "runtime";
private const string JobNameArg = "jobName";
private const string EnvironmentArg = "environment";
private const string BrokerClientArg = "brokerClient";
private const string VerboseArg = "verbose";
private const string FlushArg = "flush";
private const string SizeKBRandomArg = "sizeKBRandom";
private const string TimeMSRandomArg = "timeMSRandom";
private const string MsgTimeoutSecArg = "msgTimeoutSec";
private const string ParentJobIdsArg = "parentIds";
private const string ServiceIdleSecArg = "serviceIdleSec";
private const string ServiceHangSecArg = "serviceHangSec";
private const string UseWindowsClientCredentialArg = "useWCC";
private const string UseAadArg = "useAad";
private const string TargetListArg = "targetList";
private bool helpInfo = false;
public bool HelpInfo
{
get { return this.helpInfo; }
}
private string headNode = "%CCP_SCHEDULER%";
public string HeadNode
{
get { return this.headNode; }
}
private int numberOfRequest = 10;
public int NumberOfRequest
{
get { return this.numberOfRequest; }
}
private int callDurationMS = 0;
public int CallDurationMS
{
get { return this.callDurationMS; }
}
private long messageSizeByte = 0;
public long MessageSizeByte
{
get { return this.messageSizeByte; }
}
private int minResource = 0;
public int MinResource
{
get { return this.minResource; }
}
private int maxResource = 0;
public int MaxResource
{
get { return this.maxResource; }
}
private string resourceType = "core";
public string ResourceType
{
get { return this.resourceType; }
}
private string transportScheme = "nettcp";
public string TransportScheme
{
get { return this.transportScheme; }
}
private int warmupTimeSec = 0;
public int WarmupTimeSec
{
get { return this.warmupTimeSec; }
}
private string jobTemplate = null;
public string JobTemplate
{
get { return this.jobTemplate; }
}
private int priority = 2000;
public int Priority
{
get { return this.priority; }
}
private string nodeGroups = string.Empty;
public string NodeGroups
{
get { return this.nodeGroups; }
}
private string nodes = string.Empty;
public string Nodes
{
get { return this.nodes; }
}
private string username;
public string Username
{
get { return this.username; }
}
private string password;
public string Password
{
get { return this.password; }
}
private bool durable = false;
public bool Durable
{
get { return this.durable; }
}
private bool asyncResponseHandler = false;
public bool AsyncResponseHandler
{
get { return this.asyncResponseHandler; }
}
private bool inprocessBroker = false;
public bool InprocessBroker
{
get { return this.inprocessBroker; }
}
private bool isNoSession = false;
public bool IsNoSession
{
get { return this.isNoSession; }
}
private string regPath = string.Empty;
public string RegPath
{
get { return this.regPath; }
}
private bool insecure = false;
public bool Insecure
{
get { return this.insecure; }
}
private bool? azureQueue = null;
public bool? AzureQueue
{
get { return this.azureQueue; }
}
private string azureStorageConnectionString = null;
public string AzureStorageConnectionString
{
get
{
return this.azureStorageConnectionString;
}
}
private bool shareSession = false;
public bool ShareSession
{
get { return this.shareSession; }
}
private bool sessionPool = false;
public bool SessionPool
{
get { return this.sessionPool; }
}
private int runtime = -1;
public int Runtime
{
get { return this.runtime; }
}
private string jobName = string.Empty;
public string JobName
{
get { return this.jobName; }
}
private string environment = string.Empty;
public string Environment
{
get { return this.environment; }
}
private int brokerClient = 1;
public int BrokerClient
{
get { return this.brokerClient; }
}
private string serviceName = "CcpEchoSvc";
public string ServiceName
{
get { return this.serviceName; }
}
private bool verbose = false;
public bool Verbose
{
get { return this.verbose; }
}
private int flush = 0;
public int Flush
{
get { return this.flush; }
}
private string sizeKBRandom = string.Empty;
public string SizeKBRandom
{
get { return this.sizeKBRandom; }
}
private string timeMSRandom = string.Empty;
public string TimeMSRandom
{
get { return this.timeMSRandom; }
}
private int msgTimeoutSec = 60 * 60; //by default, the message operation timeout is 60 minutes
public int MsgTimeoutSec
{
get { return this.msgTimeoutSec; }
}
private string parentIds = string.Empty;
public string ParentIds
{
get { return this.parentIds; }
}
private int? serviceIdleSec = null; //by default, the service idle timeout depends on that in service registration
public int? ServiceIdleSec
{
get { return this.serviceIdleSec; }
}
private int? serviceHangSec = null; //by default, the service hang timeout depends on that in service registration
public int? ServiceHangSec
{
get { return this.serviceHangSec; }
}
private bool useWCC = false;
public bool UseWCC
{
get { return this.useWCC; }
}
public bool UseAad { get; private set; } = false;
private List<string> targetList = null;
public List<string> TargetList
{
get { return this.targetList; }
}
public Config(CmdParser parser)
{
this.helpInfo = parser.GetSwitch("?") || parser.GetSwitch("help");
parser.TryGetArg<string>(HeadNodeArg, ref this.headNode);
parser.TryGetArg<int>(RequestArg, ref this.numberOfRequest);
parser.TryGetArg<int>(TimeMSArg, ref this.callDurationMS);
parser.TryGetArg<long>(SizeByteArg, ref this.messageSizeByte);
parser.TryGetArg<string>(ResourceTypeArg, ref this.resourceType);
parser.TryGetArg<int>(MinArg, ref this.minResource);
parser.TryGetArg<int>(MaxArg, ref this.maxResource);
parser.TryGetArg<int>(WarmupSecArg, ref this.warmupTimeSec);
parser.TryGetArg<string>(TransportSchemeArg, ref this.transportScheme);
parser.TryGetArg<string>(JobTemplateArg, ref this.jobTemplate);
parser.TryGetArg<int>(PriorityArg, ref this.priority);
parser.TryGetArg<string>(NodeGroupsArg, ref this.nodeGroups);
parser.TryGetArg<string>(NodesArg, ref this.nodes);
parser.TryGetArg<string>(UserNameArg, ref this.username);
parser.TryGetArg<string>(PasswordArg, ref this.password);
parser.TryGetArg<bool?>(AzureQueueArg, ref this.azureQueue);
parser.TryGetArg<int>(RuntimeArg, ref this.runtime);
parser.TryGetArg<int>(BrokerClientArg, ref this.brokerClient);
parser.TryGetArg<string>(JobNameArg, ref this.jobName);
parser.TryGetArg<string>(EnvironmentArg, ref this.environment);
parser.TryGetArg<string>(ServiceNameArg, ref this.serviceName);
parser.TryGetArg<int>(FlushArg, ref this.flush);
parser.TryGetArg<string>(TimeMSRandomArg, ref this.timeMSRandom);
parser.TryGetArg<string>(SizeKBRandomArg, ref this.sizeKBRandom);
parser.TryGetArg<int>(MsgTimeoutSecArg, ref this.msgTimeoutSec);
parser.TryGetArg<string>(ParentJobIdsArg, ref this.parentIds);
parser.TryGetArg<int?>(ServiceIdleSecArg, ref this.serviceIdleSec);
parser.TryGetArg<int?>(ServiceHangSecArg, ref this.serviceHangSec);
parser.TryGetArg<string>(RegPathArg, ref this.regPath);
parser.TryGetArgList<string>(TargetListArg, ref this.targetList);
parser.TryGetArg(AzureStorageConnectionStringArg, ref this.azureStorageConnectionString);
this.inprocessBroker = parser.GetSwitch(InprocessBrokerArg);
this.isNoSession = parser.GetSwitch(IsNoSessionArg);
this.insecure = parser.GetSwitch(InsecureArg);
this.durable = parser.GetSwitch(DurableArg);
this.asyncResponseHandler = parser.GetSwitch(AsyncArg);
this.shareSession = parser.GetSwitch(ShareSessionArg);
this.sessionPool = parser.GetSwitch(SessionPoolArg);
this.verbose = parser.GetSwitch(VerboseArg);
this.useWCC = parser.GetSwitch(UseWindowsClientCredentialArg);
this.UseAad = parser.GetSwitch(UseAadArg);
}
public void PrintHelp()
{
Console.WriteLine();
Console.WriteLine("Usage: EchoClient.exe -headnode <HeadNode> -jobName <JobName> -serviceName <ServiceName> -numberOfRequests <10> -timeMS <0> -sizeByte <0> -resourceType:<core|node|socket|gpu> -min <N> -max <N> -scheme <http|nettcp|custom> -groups <nodeGroupA,nodeGroupB> -requestedNodes <NodeA,NodeB> -priority <N> -jobTemplate <templateA> -environment <Environment> -username <Username> -password <Password> -azureQueue <True|False> -runtime <N Sec> -brokerClient <N> -flush <N> -timeMSRandom <N>_<N> -sizeKBRandom <N>_<N> -msgTimeoutSec <N> -parentIds <id,id,...> -serviceIdleSec <N> -serviceHangSec <N> -regPath <RegistrationFolderPath> -targetList <machine,machine,...> -azureStor <StorageConnectionString> -durable -insecure -async -inprocessBroker -isNoSession -useWCC -useAad -shareSession -sessionPool -verbose");
Console.WriteLine();
Console.WriteLine("Usage: EchoClient.exe /headnode:<HeadNode> /jobName:<JobName> /serviceName:<ServiceName> /numberOfRequests:<10> /timeMS:<0> /sizeByte:<0> /resourceType:<core|node|socket|gpu> /min:<N> /max:<N> /scheme:<http|nettcp|custom> /groups:<nodeGroupA,nodeGroupB> /requestedNodes:<NodeA,NodeB> /priority:<N> /jobTemplate:<templateA> /environment:<Environment> /username:<Username> /password:<Password> /azureQueue:<True|False> /runtime:<N Sec> /brokerClient:<N> /flush:<N> /timeMSRandom:<N>_<N> /sizeKBRandom:<N>_<N> /msgTimeoutSec:<N> /parentIds:<id,id,...> /serviceIdleSec:<N> /serviceHangSec:<N> /regPath:<RegistrationFolderPath> /targetList:<machine,machine,...> /azureStor:<StorageConnectionString> /durable /insecure /async /inprocessBroker /isNoSession /useWCC /useAad /shareSession /sessionPool /verbose");
Console.WriteLine();
Console.WriteLine("Sample: EchoClient.exe");
Console.WriteLine("Sample: EchoClient.exe -h HeadNode -n 20");
Console.WriteLine("Sample: EchoClient.exe -h HeadNode -n 50 -min 10 -max 10 -async -v");
Console.WriteLine("Sample: EchoClient.exe -h HeadNode -n 100 -time 5 -size 10 -res node -min 10 -max 20 -durable");
Console.WriteLine("Sample: EchoClient.exe -h HeadNode.cloudapp.net -scheme http -n 1000 -async");
}
public bool PrintUsedParams(CmdParser parser)
{
bool used = false;
Dictionary<string, string> usedArgs;
List<string> usedSwitches;
parser.Used(out usedArgs, out usedSwitches);
if (usedArgs != null && usedArgs.Count > 0)
{
foreach (var kv in usedArgs)
{
Console.WriteLine("Parameter : {0}=\"{1}\"", kv.Key, kv.Value);
}
used = true;
}
if (usedSwitches != null && usedSwitches.Count > 0)
{
foreach (string s in usedSwitches)
{
Console.WriteLine("Switch : -{0}", s);
}
used = true;
}
return used;
}
public bool PrintUnusedParams(CmdParser parser)
{
bool anyUnused = false;
Dictionary<string, string> unusedArgs;
List<string> unusedSwitches;
parser.Unused(out unusedArgs, out unusedSwitches);
ConsoleColor prevFGColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
if (unusedArgs != null && unusedArgs.Count > 0)
{
foreach (var kv in unusedArgs)
{
Console.WriteLine("Error : Unidentified parameter {0}=\"{1}\"", kv.Key, kv.Value);
}
anyUnused = true;
}
if (unusedSwitches != null && unusedSwitches.Count > 0)
{
foreach (string s in unusedSwitches)
{
Console.WriteLine("Error : Unidentified switch -{0}", s);
}
anyUnused = true;
}
Console.ForegroundColor = prevFGColor;
return anyUnused;
}
}
}
| 41.269923 | 835 | 0.600287 | [
"MIT"
] | dubrie/Telepathy | src/soa/EchoClient/Config.cs | 16,056 | C# |
//using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Linq;
//namespace GameEstate.Formats.Binary.UltimaUO.Records
//{
// [Flags]
// public enum MapRules
// {
// None = 0x0000,
// Internal = 0x0001, // Internal map (used for dragging, commodity deeds, etc)
// FreeMovement = 0x0002, // Anyone can move over anyone else without taking stamina loss
// BeneficialRestrictions = 0x0004, // Disallow performing beneficial actions on criminals/murderers
// HarmfulRestrictions = 0x0008, // Disallow performing harmful actions on innocents
// TrammelRules = FreeMovement | BeneficialRestrictions | HarmfulRestrictions,
// FeluccaRules = None
// }
// public interface IPooledEnumerable : IEnumerable
// {
// void Free();
// }
// public interface IPooledEnumerable<T> : IPooledEnumerable, IEnumerable<T> { }
// public interface IPooledEnumerator<T> : IEnumerator<T>
// {
// void Free();
// }
//#if Map_NewEnumerables || Map_AllUpdates
// public static class PooledEnumeration
// {
// public delegate IEnumerable<T> Selector<out T>(Sector sector, Rectangle2D bounds);
// public static Selector<NetState> ClientSelector { get; set; }
// public static Selector<IEntity> EntitySelector { get; set; }
// public static Selector<Mobile> MobileSelector { get; set; }
// public static Selector<Item> ItemSelector { get; set; }
// public static Selector<BaseMulti> MultiSelector { get; set; }
// public static Selector<StaticTile[]> MultiTileSelector { get; set; }
// static PooledEnumeration()
// {
// ClientSelector = SelectClients;
// EntitySelector = SelectEntities;
// MobileSelector = SelectMobiles;
// ItemSelector = SelectItems;
// MultiSelector = SelectMultis;
// MultiTileSelector = SelectMultiTiles;
// }
// public static IEnumerable<NetState> SelectClients(Sector s, Rectangle2D bounds) =>
// s.Clients.Where(o => o != null && o.Mobile != null && !o.Mobile.Deleted && bounds.Contains(o.Mobile));
// public static IEnumerable<IEntity> SelectEntities(Sector s, Rectangle2D bounds) =>
// Enumerable.Empty<IEntity>()
// .Union(s.Mobiles.Where(o => o != null && !o.Deleted))
// .Union(s.Items.Where(o => o != null && !o.Deleted && o.Parent == null))
// .Where(bounds.Contains);
// public static IEnumerable<Mobile> SelectMobiles(Sector s, Rectangle2D bounds)
// {
// return s.Mobiles.Where(o => o != null && !o.Deleted && bounds.Contains(o));
// }
// public static IEnumerable<Item> SelectItems(Sector s, Rectangle2D bounds)
// {
// return s.Items.Where(o => o != null && !o.Deleted && o.Parent == null && bounds.Contains(o));
// }
// public static IEnumerable<BaseMulti> SelectMultis(Sector s, Rectangle2D bounds)
// {
// return s.Multis.Where(o => o != null && !o.Deleted && bounds.Contains(o.Location));
// }
// public static IEnumerable<StaticTile[]> SelectMultiTiles(Sector s, Rectangle2D bounds)
// {
// foreach (var o in s.Multis.Where(o => o != null && !o.Deleted))
// {
// var c = o.Components;
// int x, y, xo, yo;
// StaticTile[] t, r;
// for (x = bounds.Start.X; x < bounds.End.X; x++)
// {
// xo = x - (o.X + c.Min.X);
// if (xo < 0 || xo >= c.Width)
// {
// continue;
// }
// for (y = bounds.Start.Y; y < bounds.End.Y; y++)
// {
// yo = y - (o.Y + c.Min.Y);
// if (yo < 0 || yo >= c.Height)
// {
// continue;
// }
// t = c.Tiles[xo][yo];
// if (t.Length <= 0)
// {
// continue;
// }
// r = new StaticTile[t.Length];
// for (var i = 0; i < t.Length; i++)
// {
// r[i] = t[i];
// r[i].Z += o.Z;
// }
// yield return r;
// }
// }
// }
// }
// public static Map.PooledEnumerable<NetState> GetClients(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<NetState>.Instantiate(map, bounds, ClientSelector ?? SelectClients);
// }
// public static Map.PooledEnumerable<IEntity> GetEntities(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<IEntity>.Instantiate(map, bounds, EntitySelector ?? SelectEntities);
// }
// public static Map.PooledEnumerable<Mobile> GetMobiles(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<Mobile>.Instantiate(map, bounds, MobileSelector ?? SelectMobiles);
// }
// public static Map.PooledEnumerable<Item> GetItems(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<Item>.Instantiate(map, bounds, ItemSelector ?? SelectItems);
// }
// public static Map.PooledEnumerable<BaseMulti> GetMultis(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<BaseMulti>.Instantiate(map, bounds, MultiSelector ?? SelectMultis);
// }
// public static Map.PooledEnumerable<StaticTile[]> GetMultiTiles(Map map, Rectangle2D bounds)
// {
// return Map.PooledEnumerable<StaticTile[]>.Instantiate(map, bounds, MultiTileSelector ?? SelectMultiTiles);
// }
// public static IEnumerable<Sector> EnumerateSectors(Map map, Rectangle2D bounds)
// {
// if (map == null || map == Map.Internal)
// {
// yield break;
// }
// int x1 = bounds.Start.X, y1 = bounds.Start.Y, x2 = bounds.End.X, y2 = bounds.End.Y, xSector, ySector;
// if (!Bound(map, ref x1, ref y1, ref x2, ref y2, out xSector, out ySector))
// {
// yield break;
// }
// Sector s;
// var index = 0;
// while (NextSector(map, x1, y1, x2, y2, ref index, ref xSector, ref ySector, out s))
// {
// yield return s;
// }
// }
// public static bool Bound(
// Map map,
// ref int x1,
// ref int y1,
// ref int x2,
// ref int y2,
// out int xSector,
// out int ySector)
// {
// if (map == null || map == Map.Internal)
// {
// xSector = ySector = 0;
// return false;
// }
// map.Bound(x1, y1, out x1, out y1);
// map.Bound(x2 - 1, y2 - 1, out x2, out y2);
// x1 >>= Map.SectorShift;
// y1 >>= Map.SectorShift;
// x2 >>= Map.SectorShift;
// y2 >>= Map.SectorShift;
// xSector = x1;
// ySector = y1;
// return true;
// }
// private static bool NextSector(
// Map map,
// int x1,
// int y1,
// int x2,
// int y2,
// ref int index,
// ref int xSector,
// ref int ySector,
// out Sector s)
// {
// if (map == null)
// {
// s = null;
// xSector = ySector = 0;
// return false;
// }
// if (map == Map.Internal)
// {
// s = map.InvalidSector;
// xSector = ySector = 0;
// return false;
// }
// if (index++ > 0)
// {
// if (++ySector > y2)
// {
// ySector = y1;
// if (++xSector > x2)
// {
// xSector = x1;
// s = map.InvalidSector;
// return false;
// }
// }
// }
// s = map.GetRealSector(xSector, ySector);
// return true;
// }
// }
//#endif
// [Parsable]
// //[CustomEnum( new string[]{ "Felucca", "Trammel", "Ilshenar", "Malas", "Internal" } )]
// public sealed class Map : IComparable, IComparable<Map>
// {
// #region Compile-Time -> Run-Time Support
//#if Map_NewEnumerables || Map_AllUpdates
// public static readonly bool NewEnumerables = true;
//#else
// public static readonly bool NewEnumerables = false;
//#endif
//#if Map_UseMaxRange || Map_AllUpdates
// public static readonly bool UseMaxRange = true;
//#else
// public static readonly bool UseMaxRange = false;
//#endif
//#if Map_PoolFixColumn || Map_AllUpdates
// public static readonly bool PoolFixColumn = true;
//#else
// public static readonly bool PoolFixColumn = false;
//#endif
//#if Map_InternalProtection || Map_AllUpdates
// public static readonly bool InternalProtection = true;
//#else
// public static readonly bool InternalProtection = false;
//#endif
// #endregion
// public const int SectorSize = 16;
// public const int SectorShift = 4;
// public static int SectorActiveRange = 2;
// private static Map[] m_Maps = new Map[0x100];
// public static Map[] Maps { get { return m_Maps; } }
// public static Map Felucca { get { return m_Maps[0]; } }
// public static Map Trammel { get { return m_Maps[1]; } }
// public static Map Ilshenar { get { return m_Maps[2]; } }
// public static Map Malas { get { return m_Maps[3]; } }
// public static Map Tokuno { get { return m_Maps[4]; } }
// public static Map TerMur { get { return m_Maps[5]; } }
// public static Map Internal { get { return m_Maps[0x7F]; } }
// private static List<Map> m_AllMaps = new List<Map>();
// public static List<Map> AllMaps { get { return m_AllMaps; } }
// private int m_MapID, m_MapIndex, m_FileIndex;
// private int m_Width, m_Height;
// private int m_SectorsWidth, m_SectorsHeight;
// private int m_Season;
// private Dictionary<string, Region> m_Regions;
// private Region m_DefaultRegion;
// public int Season { get { return m_Season; } set { m_Season = value; } }
// private string m_Name;
// private MapRules m_Rules;
// private Sector[][] m_Sectors;
// private Sector m_InvalidSector;
// private TileMatrix m_Tiles;
//#if Map_InternalProtection || Map_AllUpdates
// public static string[] GetMapNames()
// {
// return m_Maps.Where(m => m != null).Select(m => m.Name).ToArray();
// }
// public static Map[] GetMapValues()
// {
// return m_Maps.Where(m => m != null).ToArray();
// }
// public static Map Parse(string value)
// {
// if (String.IsNullOrWhiteSpace(value))
// {
// return null;
// }
// if (Insensitive.Equals(value, "Internal"))
// {
// return Internal;
// }
// int index;
// if (!Int32.TryParse(value, out index))
// {
// return m_Maps.FirstOrDefault(m => m != null && Insensitive.Equals(m.Name, value));
// }
// if (index == 127)
// {
// return Internal;
// }
// return m_Maps.FirstOrDefault(m => m != null && m.MapIndex == index);
// }
// public override string ToString()
// {
// return Name;
// }
//#else
// private static string[] m_MapNames;
// private static Map[] m_MapValues;
// public static string[] GetMapNames()
// {
// CheckNamesAndValues();
// return m_MapNames;
// }
// public static Map[] GetMapValues()
// {
// CheckNamesAndValues();
// return m_MapValues;
// }
// public static Map Parse(string value)
// {
// CheckNamesAndValues();
// for (int i = 0; i < m_MapNames.Length; ++i)
// {
// if (Insensitive.Equals(m_MapNames[i], value))
// return m_MapValues[i];
// }
// int index;
// if (int.TryParse(value, out index))
// {
// if (index >= 0 && index < m_Maps.Length && m_Maps[index] != null)
// return m_Maps[index];
// }
// throw new ArgumentException("Invalid map name");
// }
// private static void CheckNamesAndValues()
// {
// if (m_MapNames != null && m_MapNames.Length == m_AllMaps.Count)
// return;
// m_MapNames = new string[m_AllMaps.Count];
// m_MapValues = new Map[m_AllMaps.Count];
// for (int i = 0; i < m_AllMaps.Count; ++i)
// {
// Map map = m_AllMaps[i];
// m_MapNames[i] = map.Name;
// m_MapValues[i] = map;
// }
// }
// public override string ToString()
// {
// return m_Name;
// }
//#endif
// public int GetAverageZ(int x, int y)
// {
// int z = 0, avg = 0, top = 0;
// GetAverageZ(x, y, ref z, ref avg, ref top);
// return avg;
// }
// public void GetAverageZ(int x, int y, ref int z, ref int avg, ref int top)
// {
// int zTop = Tiles.GetLandTile(x, y).Z;
// int zLeft = Tiles.GetLandTile(x, y + 1).Z;
// int zRight = Tiles.GetLandTile(x + 1, y).Z;
// int zBottom = Tiles.GetLandTile(x + 1, y + 1).Z;
// z = zTop;
// if (zLeft < z)
// z = zLeft;
// if (zRight < z)
// z = zRight;
// if (zBottom < z)
// z = zBottom;
// top = zTop;
// if (zLeft > top)
// top = zLeft;
// if (zRight > top)
// top = zRight;
// if (zBottom > top)
// top = zBottom;
// if (Math.Abs(zTop - zBottom) > Math.Abs(zLeft - zRight))
// avg = FloorAverage(zLeft, zRight);
// else
// avg = FloorAverage(zTop, zBottom);
// }
// private static int FloorAverage(int a, int b)
// {
// int v = a + b;
// if (v < 0)
// --v;
// return (v / 2);
// }
//#if Map_NewEnumerables || Map_AllUpdates
// #region Get*InRange/Bounds
// public IPooledEnumerable<IEntity> GetObjectsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetObjectsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetObjectsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<IEntity> GetObjectsInRange(Point3D p, int range)
// {
// return GetObjectsInBounds(new Rectangle2D(p.X - range, p.Y - range, range * 2 + 1, range * 2 + 1));
// }
// public IPooledEnumerable<IEntity> GetObjectsInBounds(Rectangle2D bounds)
// {
// return PooledEnumeration.GetEntities(this, bounds);
// }
// public IPooledEnumerable<NetState> GetClientsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetClientsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetClientsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<NetState> GetClientsInRange(Point3D p, int range)
// {
// return GetClientsInBounds(new Rectangle2D(p.X - range, p.Y - range, range * 2 + 1, range * 2 + 1));
// }
// public IPooledEnumerable<NetState> GetClientsInBounds(Rectangle2D bounds)
// {
// return PooledEnumeration.GetClients(this, bounds);
// }
// public IPooledEnumerable<Item> GetItemsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetItemsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetItemsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<Item> GetItemsInRange(Point3D p, int range)
// {
// return GetItemsInBounds(new Rectangle2D(p.X - range, p.Y - range, range * 2 + 1, range * 2 + 1));
// }
// public IPooledEnumerable<Item> GetItemsInBounds(Rectangle2D bounds)
// {
// return PooledEnumeration.GetItems(this, bounds);
// }
// public IPooledEnumerable<Mobile> GetMobilesInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetMobilesInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetMobilesInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<Mobile> GetMobilesInRange(Point3D p, int range)
// {
// return GetMobilesInBounds(new Rectangle2D(p.X - range, p.Y - range, range * 2 + 1, range * 2 + 1));
// }
// public IPooledEnumerable<Mobile> GetMobilesInBounds(Rectangle2D bounds)
// {
// return PooledEnumeration.GetMobiles(this, bounds);
// }
// #endregion
// public IPooledEnumerable<StaticTile[]> GetMultiTilesAt(int x, int y)
// {
// return PooledEnumeration.GetMultiTiles(this, new Rectangle2D(x, y, 1, 1));
// }
//#else
// #region Get*InRange/Bounds
// public IPooledEnumerable<IEntity> GetObjectsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetObjectsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetObjectsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<IEntity> GetObjectsInRange(Point3D p, int range)
// {
// if (this == Map.Internal)
// return NullEnumerable<IEntity>.Instance;
// return PooledEnumerable<IEntity>.Instantiate(EntityEnumerator.Instantiate(this, new Rectangle2D(p.m_X - range, p.m_Y - range, range * 2 + 1, range * 2 + 1)));
// }
// public IPooledEnumerable<IEntity> GetObjectsInBounds(Rectangle2D bounds)
// {
// if (this == Map.Internal)
// return NullEnumerable<IEntity>.Instance;
// return PooledEnumerable<IEntity>.Instantiate(EntityEnumerator.Instantiate(this, bounds));
// }
// public IPooledEnumerable<NetState> GetClientsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetClientsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetClientsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<NetState> GetClientsInRange(Point3D p, int range)
// {
// if (this == Map.Internal)
// return NullEnumerable<NetState>.Instance;
// return PooledEnumerable<NetState>.Instantiate(ClientEnumerator.Instantiate(this, new Rectangle2D(p.m_X - range, p.m_Y - range, range * 2 + 1, range * 2 + 1)));
// }
// public IPooledEnumerable<NetState> GetClientsInBounds(Rectangle2D bounds)
// {
// if (this == Map.Internal)
// return NullEnumerable<NetState>.Instance;
// return PooledEnumerable<NetState>.Instantiate(ClientEnumerator.Instantiate(this, bounds));
// }
// public IPooledEnumerable<Item> GetItemsInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetItemsInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetItemsInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<Item> GetItemsInRange(Point3D p, int range)
// {
// if (this == Map.Internal)
// return NullEnumerable<Item>.Instance;
// return PooledEnumerable<Item>.Instantiate(ItemEnumerator.Instantiate(this, new Rectangle2D(p.m_X - range, p.m_Y - range, range * 2 + 1, range * 2 + 1)));
// }
// public IPooledEnumerable<Item> GetItemsInBounds(Rectangle2D bounds)
// {
// if (this == Map.Internal)
// return NullEnumerable<Item>.Instance;
// return PooledEnumerable<Item>.Instantiate(ItemEnumerator.Instantiate(this, bounds));
// }
// public IPooledEnumerable<Mobile> GetMobilesInRange(Point3D p)
// {
//#if Map_UseMaxRange || Map_AllUpdates
// return GetMobilesInRange(p, Core.GlobalMaxUpdateRange);
//#else
// return GetMobilesInRange(p, 18);
//#endif
// }
// public IPooledEnumerable<Mobile> GetMobilesInRange(Point3D p, int range)
// {
// if (this == Map.Internal)
// return NullEnumerable<Mobile>.Instance;
// return PooledEnumerable<Mobile>.Instantiate(MobileEnumerator.Instantiate(this, new Rectangle2D(p.m_X - range, p.m_Y - range, range * 2 + 1, range * 2 + 1)));
// }
// public IPooledEnumerable<Mobile> GetMobilesInBounds(Rectangle2D bounds)
// {
// if (this == Map.Internal)
// return NullEnumerable<Mobile>.Instance;
// return PooledEnumerable<Mobile>.Instantiate(MobileEnumerator.Instantiate(this, bounds));
// }
// #endregion
// public IPooledEnumerable<StaticTile[]> GetMultiTilesAt(int x, int y)
// {
// if (this == Map.Internal)
// return NullEnumerable<StaticTile[]>.Instance;
// Sector sector = GetSector(x, y);
// if (sector.Multis.Count == 0)
// return NullEnumerable<StaticTile[]>.Instance;
// return PooledEnumerable<StaticTile[]>.Instantiate(MultiTileEnumerator.Instantiate(sector, new Point2D(x, y)));
// }
//#endif
// #region CanFit
// public bool CanFit(Point3D p, int height, bool checkBlocksFit)
// {
// return CanFit(p.X, p.Y, p.Z, height, checkBlocksFit, true, true);
// }
// public bool CanFit(Point3D p, int height, bool checkBlocksFit, bool checkMobiles)
// {
// return CanFit(p.X, p.Y, p.Z, height, checkBlocksFit, checkMobiles, true);
// }
// public bool CanFit(Point2D p, int z, int height, bool checkBlocksFit)
// {
// return CanFit(p.X, p.Y, z, height, checkBlocksFit, true, true);
// }
// public bool CanFit(Point3D p, int height)
// {
// return CanFit(p.X, p.Y, p.Z, height, false, true, true);
// }
// public bool CanFit(Point2D p, int z, int height)
// {
// return CanFit(p.X, p.Y, z, height, false, true, true);
// }
// public bool CanFit(int x, int y, int z, int height)
// {
// return CanFit(x, y, z, height, false, true, true);
// }
// public bool CanFit(int x, int y, int z, int height, bool checksBlocksFit)
// {
// return CanFit(x, y, z, height, checksBlocksFit, true, true);
// }
// public bool CanFit(int x, int y, int z, int height, bool checkBlocksFit, bool checkMobiles)
// {
// return CanFit(x, y, z, height, checkBlocksFit, checkMobiles, true);
// }
// public bool CanFit(int x, int y, int z, int height, bool checkBlocksFit, bool checkMobiles, bool requireSurface)
// {
// if (this == Map.Internal)
// return false;
// if (x < 0 || y < 0 || x >= m_Width || y >= m_Height)
// return false;
// bool hasSurface = false;
// LandTile lt = Tiles.GetLandTile(x, y);
// int lowZ = 0, avgZ = 0, topZ = 0;
// GetAverageZ(x, y, ref lowZ, ref avgZ, ref topZ);
// TileFlag landFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
// if ((landFlags & TileFlag.Impassable) != 0 && avgZ > z && (z + height) > lowZ)
// return false;
// else if ((landFlags & TileFlag.Impassable) == 0 && z == avgZ && !lt.Ignored)
// hasSurface = true;
// StaticTile[] staticTiles = Tiles.GetStaticTiles(x, y, true);
// bool surface, impassable;
// for (int i = 0; i < staticTiles.Length; ++i)
// {
// ItemData id = TileData.ItemTable[staticTiles[i].ID & TileData.MaxItemValue];
// surface = id.Surface;
// impassable = id.Impassable;
// if ((surface || impassable) && (staticTiles[i].Z + id.CalcHeight) > z && (z + height) > staticTiles[i].Z)
// return false;
// else if (surface && !impassable && z == (staticTiles[i].Z + id.CalcHeight))
// hasSurface = true;
// }
// Sector sector = GetSector(x, y);
// List<Item> items = sector.Items;
// List<Mobile> mobs = sector.Mobiles;
// for (int i = 0; i < items.Count; ++i)
// {
// Item item = items[i];
// if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y))
// {
// ItemData id = item.ItemData;
// surface = id.Surface;
// impassable = id.Impassable;
// if ((surface || impassable || (checkBlocksFit && item.BlocksFit)) && (item.Z + id.CalcHeight) > z && (z + height) > item.Z)
// return false;
// else if (surface && !impassable && !item.Movable && z == (item.Z + id.CalcHeight))
// hasSurface = true;
// }
// }
// if (checkMobiles)
// {
// for (int i = 0; i < mobs.Count; ++i)
// {
// Mobile m = mobs[i];
// if (m.Location.X == x && m.Location.Y == y && (m.AccessLevel == AccessLevel.Player || !m.Hidden))
// if ((m.Z + 16) > z && (z + height) > m.Z)
// return false;
// }
// }
// return !requireSurface || hasSurface;
// }
// #endregion
// #region CanSpawnMobile
// public bool CanSpawnMobile(Point3D p)
// {
// return CanSpawnMobile(p.X, p.Y, p.Z);
// }
// public bool CanSpawnMobile(Point2D p, int z)
// {
// return CanSpawnMobile(p.X, p.Y, z);
// }
// public bool CanSpawnMobile(int x, int y, int z)
// {
// if (!Region.Find(new Point3D(x, y, z), this).AllowSpawn())
// return false;
// return CanFit(x, y, z, 16);
// }
// #endregion
// private class ZComparer : IComparer<Item>
// {
// public static readonly ZComparer Default = new ZComparer();
// public int Compare(Item x, Item y)
// {
// return x.Z.CompareTo(y.Z);
// }
// }
//#if Map_PoolFixColumn || Map_AllUpdates
// private static readonly Queue<List<Item>> _FixPool = new Queue<List<Item>>(128);
// private static readonly List<Item> _EmptyFixItems = new List<Item>();
// private static List<Item> AcquireFixItems(Map map, int x, int y)
// {
// if (map == null || map == Internal || x < 0 || x > map.Width || y < 0 || y > map.Height)
// {
// return _EmptyFixItems;
// }
// List<Item> pool = null;
// lock (_FixPool)
// {
// if (_FixPool.Count > 0)
// {
// pool = _FixPool.Dequeue();
// }
// }
// if (pool == null)
// {
// pool = new List<Item>(128); // Arbitrary limit
// }
// var eable = map.GetItemsInRange(new Point3D(x, y, 0), 0);
// pool.AddRange(
// eable.Where(item => item.ItemID <= TileData.MaxItemValue && !(item is BaseMulti))
// .OrderBy(item => item.Z)
// .Take(pool.Capacity));
// eable.Free();
// return pool;
// }
// private static void FreeFixItems(List<Item> pool)
// {
// if (pool == _EmptyFixItems)
// {
// return;
// }
// pool.Clear();
// lock (_FixPool)
// {
// if (_FixPool.Count < 128)
// {
// _FixPool.Enqueue(pool);
// }
// }
// }
// public void FixColumn(int x, int y)
// {
// var landTile = Tiles.GetLandTile(x, y);
// var tiles = Tiles.GetStaticTiles(x, y, true);
// int landZ = 0, landAvg = 0, landTop = 0;
// GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
// var items = AcquireFixItems(this, x, y);
// for (var i = 0; i < items.Count; i++)
// {
// var toFix = items[i];
// if (!toFix.Movable)
// {
// continue;
// }
// var z = int.MinValue;
// var currentZ = toFix.Z;
// if (!landTile.Ignored && landAvg <= currentZ)
// {
// z = landAvg;
// }
// foreach (var tile in tiles)
// {
// var id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
// var checkZ = tile.Z;
// var checkTop = checkZ + id.CalcHeight;
// if (checkTop == checkZ && !id.Surface)
// {
// ++checkTop;
// }
// if (checkTop > z && checkTop <= currentZ)
// {
// z = checkTop;
// }
// }
// for (var j = 0; j < items.Count; ++j)
// {
// if (j == i)
// {
// continue;
// }
// var item = items[j];
// var id = item.ItemData;
// var checkZ = item.Z;
// var checkTop = checkZ + id.CalcHeight;
// if (checkTop == checkZ && !id.Surface)
// {
// ++checkTop;
// }
// if (checkTop > z && checkTop <= currentZ)
// {
// z = checkTop;
// }
// }
// if (z != int.MinValue)
// {
// toFix.Location = new Point3D(toFix.X, toFix.Y, z);
// }
// }
// FreeFixItems(items);
// }
//#else
// public void FixColumn(int x, int y)
// {
// LandTile landTile = Tiles.GetLandTile(x, y);
// int landZ = 0, landAvg = 0, landTop = 0;
// GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
// StaticTile[] tiles = Tiles.GetStaticTiles(x, y, true);
// List<Item> items = new List<Item>();
// IPooledEnumerable<Item> eable = GetItemsInRange(new Point3D(x, y, 0), 0);
// foreach (Item item in eable)
// {
// if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue)
// {
// items.Add(item);
// if (items.Count > 100)
// break;
// }
// }
// eable.Free();
// if (items.Count > 100)
// return;
// items.Sort(ZComparer.Default);
// for (int i = 0; i < items.Count; ++i)
// {
// Item toFix = items[i];
// if (!toFix.Movable)
// continue;
// int z = int.MinValue;
// int currentZ = toFix.Z;
// if (!landTile.Ignored && landAvg <= currentZ)
// z = landAvg;
// for (int j = 0; j < tiles.Length; ++j)
// {
// StaticTile tile = tiles[j];
// ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
// int checkZ = tile.Z;
// int checkTop = checkZ + id.CalcHeight;
// if (checkTop == checkZ && !id.Surface)
// ++checkTop;
// if (checkTop > z && checkTop <= currentZ)
// z = checkTop;
// }
// for (int j = 0; j < items.Count; ++j)
// {
// if (j == i)
// continue;
// Item item = items[j];
// ItemData id = item.ItemData;
// int checkZ = item.Z;
// int checkTop = checkZ + id.CalcHeight;
// if (checkTop == checkZ && !id.Surface)
// ++checkTop;
// if (checkTop > z && checkTop <= currentZ)
// z = checkTop;
// }
// if (z != int.MinValue)
// toFix.Location = new Point3D(toFix.X, toFix.Y, z);
// }
// }
//#endif
// /* This could be probably be re-implemented if necessary (perhaps via an ITile interface?).
// public List<Tile> GetTilesAt( Point2D p, bool items, bool land, bool statics )
// {
// List<Tile> list = new List<Tile>();
// if ( this == Map.Internal )
// return list;
// if ( land )
// list.Add( Tiles.GetLandTile( p.m_X, p.m_Y ) );
// if ( statics )
// list.AddRange( Tiles.GetStaticTiles( p.m_X, p.m_Y, true ) );
// if ( items )
// {
// Sector sector = GetSector( p );
// foreach ( Item item in sector.Items )
// if ( item.AtWorldPoint( p.m_X, p.m_Y ) )
// list.Add( new StaticTile( (ushort)item.ItemID, (sbyte) item.Z ) );
// }
// return list;
// }
// */
// /// <summary>
// /// Gets the highest surface that is lower than <paramref name="p"/>.
// /// </summary>
// /// <param name="p">The reference point.</param>
// /// <returns>A surface <typeparamref name="Tile"/> or <typeparamref name="Item"/>.</returns>
// public object GetTopSurface(Point3D p)
// {
// if (this == Map.Internal)
// return null;
// object surface = null;
// int surfaceZ = int.MinValue;
// LandTile lt = Tiles.GetLandTile(p.X, p.Y);
// if (!lt.Ignored)
// {
// int avgZ = GetAverageZ(p.X, p.Y);
// if (avgZ <= p.Z)
// {
// surface = lt;
// surfaceZ = avgZ;
// if (surfaceZ == p.Z)
// return surface;
// }
// }
// StaticTile[] staticTiles = Tiles.GetStaticTiles(p.X, p.Y, true);
// for (int i = 0; i < staticTiles.Length; i++)
// {
// StaticTile tile = staticTiles[i];
// ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
// if (id.Surface || (id.Flags & TileFlag.Wet) != 0)
// {
// int tileZ = tile.Z + id.CalcHeight;
// if (tileZ > surfaceZ && tileZ <= p.Z)
// {
// surface = tile;
// surfaceZ = tileZ;
// if (surfaceZ == p.Z)
// return surface;
// }
// }
// }
// Sector sector = GetSector(p.X, p.Y);
// for (int i = 0; i < sector.Items.Count; i++)
// {
// Item item = sector.Items[i];
// if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(p.X, p.Y) && !item.Movable)
// {
// ItemData id = item.ItemData;
// if (id.Surface || (id.Flags & TileFlag.Wet) != 0)
// {
// int itemZ = item.Z + id.CalcHeight;
// if (itemZ > surfaceZ && itemZ <= p.Z)
// {
// surface = item;
// surfaceZ = itemZ;
// if (surfaceZ == p.Z)
// return surface;
// }
// }
// }
// }
// return surface;
// }
// public void Bound(int x, int y, out int newX, out int newY)
// {
// if (x < 0)
// newX = 0;
// else if (x >= m_Width)
// newX = m_Width - 1;
// else
// newX = x;
// if (y < 0)
// newY = 0;
// else if (y >= m_Height)
// newY = m_Height - 1;
// else
// newY = y;
// }
// public Point2D Bound(Point2D p)
// {
// int x = p.X, y = p.Y;
// if (x < 0)
// x = 0;
// else if (x >= m_Width)
// x = m_Width - 1;
// if (y < 0)
// y = 0;
// else if (y >= m_Height)
// y = m_Height - 1;
// return new Point2D(x, y);
// }
// public Map(int mapID, int mapIndex, int fileIndex, int width, int height, int season, string name, MapRules rules)
// {
// m_MapID = mapID;
// m_MapIndex = mapIndex;
// m_FileIndex = fileIndex;
// m_Width = width;
// m_Height = height;
// m_Season = season;
// m_Name = name;
// m_Rules = rules;
// m_Regions = new Dictionary<string, Region>(StringComparer.OrdinalIgnoreCase);
// m_InvalidSector = new Sector(0, 0, this);
// m_SectorsWidth = width >> SectorShift;
// m_SectorsHeight = height >> SectorShift;
// m_Sectors = new Sector[m_SectorsWidth][];
// }
// #region GetSector
// public Sector GetSector(Point3D p)
// {
// return InternalGetSector(p.X >> SectorShift, p.Y >> SectorShift);
// }
// public Sector GetSector(Point2D p)
// {
// return InternalGetSector(p.X >> SectorShift, p.Y >> SectorShift);
// }
// public Sector GetSector(IPoint2D p)
// {
// return InternalGetSector(p.X >> SectorShift, p.Y >> SectorShift);
// }
// public Sector GetSector(int x, int y)
// {
// return InternalGetSector(x >> SectorShift, y >> SectorShift);
// }
// public Sector GetRealSector(int x, int y)
// {
// return InternalGetSector(x, y);
// }
// private Sector InternalGetSector(int x, int y)
// {
// if (x >= 0 && x < m_SectorsWidth && y >= 0 && y < m_SectorsHeight)
// {
// Sector[] xSectors = m_Sectors[x];
// if (xSectors == null)
// m_Sectors[x] = xSectors = new Sector[m_SectorsHeight];
// Sector sec = xSectors[y];
// if (sec == null)
// xSectors[y] = sec = new Sector(x, y, this);
// return sec;
// }
// else
// {
// return m_InvalidSector;
// }
// }
// #endregion
// public void ActivateSectors(int cx, int cy)
// {
// for (int x = cx - SectorActiveRange; x <= cx + SectorActiveRange; ++x)
// {
// for (int y = cy - SectorActiveRange; y <= cy + SectorActiveRange; ++y)
// {
// Sector sect = GetRealSector(x, y);
// if (sect != m_InvalidSector)
// sect.Activate();
// }
// }
// }
// public void DeactivateSectors(int cx, int cy)
// {
// for (int x = cx - SectorActiveRange; x <= cx + SectorActiveRange; ++x)
// {
// for (int y = cy - SectorActiveRange; y <= cy + SectorActiveRange; ++y)
// {
// Sector sect = GetRealSector(x, y);
// if (sect != m_InvalidSector && !PlayersInRange(sect, SectorActiveRange))
// sect.Deactivate();
// }
// }
// }
// private bool PlayersInRange(Sector sect, int range)
// {
// for (int x = sect.X - range; x <= sect.X + range; ++x)
// {
// for (int y = sect.Y - range; y <= sect.Y + range; ++y)
// {
// Sector check = GetRealSector(x, y);
// if (check != m_InvalidSector && check.Players.Count > 0)
// return true;
// }
// }
// return false;
// }
// public void OnClientChange(NetState oldState, NetState newState, Mobile m)
// {
// if (this == Map.Internal)
// return;
// GetSector(m).OnClientChange(oldState, newState);
// }
// public void OnEnter(Mobile m)
// {
// if (this == Map.Internal)
// return;
// Sector sector = GetSector(m);
// sector.OnEnter(m);
// }
// public void OnEnter(Item item)
// {
// if (this == Map.Internal)
// return;
// GetSector(item).OnEnter(item);
// if (item is BaseMulti)
// {
// BaseMulti m = (BaseMulti)item;
// MultiComponentList mcl = m.Components;
// Sector start = GetMultiMinSector(item.Location, mcl);
// Sector end = GetMultiMaxSector(item.Location, mcl);
// AddMulti(m, start, end);
// }
// }
// public void OnLeave(Mobile m)
// {
// if (this == Map.Internal)
// return;
// Sector sector = GetSector(m);
// sector.OnLeave(m);
// }
// public void OnLeave(Item item)
// {
// if (this == Map.Internal)
// return;
// GetSector(item).OnLeave(item);
// if (item is BaseMulti)
// {
// BaseMulti m = (BaseMulti)item;
// MultiComponentList mcl = m.Components;
// Sector start = GetMultiMinSector(item.Location, mcl);
// Sector end = GetMultiMaxSector(item.Location, mcl);
// RemoveMulti(m, start, end);
// }
// }
// public void RemoveMulti(BaseMulti m, Sector start, Sector end)
// {
// if (this == Map.Internal)
// return;
// for (int x = start.X; x <= end.X; ++x)
// for (int y = start.Y; y <= end.Y; ++y)
// InternalGetSector(x, y).OnMultiLeave(m);
// }
// public void AddMulti(BaseMulti m, Sector start, Sector end)
// {
// if (this == Map.Internal)
// return;
// for (int x = start.X; x <= end.X; ++x)
// for (int y = start.Y; y <= end.Y; ++y)
// InternalGetSector(x, y).OnMultiEnter(m);
// }
// public Sector GetMultiMinSector(Point3D loc, MultiComponentList mcl)
// {
// return GetSector(Bound(new Point2D(loc.X + mcl.Min.X, loc.Y + mcl.Min.Y)));
// }
// public Sector GetMultiMaxSector(Point3D loc, MultiComponentList mcl)
// {
// return GetSector(Bound(new Point2D(loc.X + mcl.Max.X, loc.Y + mcl.Max.Y)));
// }
// public void OnMove(Point3D oldLocation, Mobile m)
// {
// if (this == Map.Internal)
// return;
// Sector oldSector = GetSector(oldLocation);
// Sector newSector = GetSector(m.Location);
// if (oldSector != newSector)
// {
// oldSector.OnLeave(m);
// newSector.OnEnter(m);
// }
// }
// public void OnMove(Point3D oldLocation, Item item)
// {
// if (this == Map.Internal)
// return;
// Sector oldSector = GetSector(oldLocation);
// Sector newSector = GetSector(item.Location);
// if (oldSector != newSector)
// {
// oldSector.OnLeave(item);
// newSector.OnEnter(item);
// }
// if (item is BaseMulti)
// {
// BaseMulti m = (BaseMulti)item;
// MultiComponentList mcl = m.Components;
// Sector start = GetMultiMinSector(item.Location, mcl);
// Sector end = GetMultiMaxSector(item.Location, mcl);
// Sector oldStart = GetMultiMinSector(oldLocation, mcl);
// Sector oldEnd = GetMultiMaxSector(oldLocation, mcl);
// if (oldStart != start || oldEnd != end)
// {
// RemoveMulti(m, oldStart, oldEnd);
// AddMulti(m, start, end);
// }
// }
// }
// private object tileLock = new object();
// public TileMatrix Tiles
// {
// get
// {
// if (m_Tiles != null)
// return m_Tiles;
// lock (tileLock)
// return m_Tiles ?? (m_Tiles = new TileMatrix(this, m_FileIndex, m_MapID, m_Width, m_Height));
// }
// }
// public int MapID
// {
// get
// {
// return m_MapID;
// }
// }
// public int MapIndex
// {
// get
// {
// return m_MapIndex;
// }
// }
// public int Width
// {
// get
// {
// return m_Width;
// }
// }
// public int Height
// {
// get
// {
// return m_Height;
// }
// }
// public Dictionary<string, Region> Regions
// {
// get
// {
// return m_Regions;
// }
// }
// public void RegisterRegion(Region reg)
// {
// string regName = reg.Name;
// if (regName != null)
// {
// if (m_Regions.ContainsKey(regName))
// Console.WriteLine("Warning: Duplicate region name '{0}' for map '{1}'", regName, this.Name);
// else
// m_Regions[regName] = reg;
// }
// }
// public void UnregisterRegion(Region reg)
// {
// string regName = reg.Name;
// if (regName != null)
// m_Regions.Remove(regName);
// }
// public Region DefaultRegion
// {
// get
// {
// if (m_DefaultRegion == null)
// m_DefaultRegion = new Region(null, this, 0, new Rectangle3D[0]);
// return m_DefaultRegion;
// }
// set
// {
// m_DefaultRegion = value;
// }
// }
// public MapRules Rules
// {
// get
// {
// return m_Rules;
// }
// set
// {
// m_Rules = value;
// }
// }
// public Sector InvalidSector
// {
// get
// {
// return m_InvalidSector;
// }
// }
// public string Name
// {
// get
// {
//#if Map_InternalProtection || Map_AllUpdates
// if (this == Internal && m_Name != "Internal")
// {
// Console.WriteLine("Internal Map Name was changed to '{0}'", m_Name);
// m_Name = "Internal";
// }
//#endif
// return m_Name;
// }
// set
// {
//#if Map_InternalProtection || Map_AllUpdates
// if (this == Internal && value != "Internal")
// {
// Console.WriteLine("Attempted to set Internal Map Name to '{0}'", value);
// value = "Internal";
// }
//#endif
// m_Name = value;
// }
// }
//#if Map_NewEnumerables || Map_AllUpdates
// public class NullEnumerable<T> : IPooledEnumerable<T>
// {
// public static readonly NullEnumerable<T> Instance = new NullEnumerable<T>();
// private readonly IEnumerable<T> _Empty;
// private NullEnumerable()
// {
// _Empty = Enumerable.Empty<T>();
// }
// IEnumerator IEnumerable.GetEnumerator()
// {
// return _Empty.GetEnumerator();
// }
// public IEnumerator<T> GetEnumerator()
// {
// return _Empty.GetEnumerator();
// }
// public void Free()
// { }
// }
// public sealed class PooledEnumerable<T> : IPooledEnumerable<T>, IDisposable
// {
// private static readonly Queue<PooledEnumerable<T>> _Buffer = new Queue<PooledEnumerable<T>>(0x400);
// public static PooledEnumerable<T> Instantiate(Map map, Rectangle2D bounds, PooledEnumeration.Selector<T> selector)
// {
// PooledEnumerable<T> e = null;
// lock (((ICollection)_Buffer).SyncRoot)
// {
// if (_Buffer.Count > 0)
// {
// e = _Buffer.Dequeue();
// }
// }
// var pool = PooledEnumeration.EnumerateSectors(map, bounds).SelectMany(s => selector(s, bounds));
// if (e != null)
// {
// e._Pool.AddRange(pool);
// }
// else
// {
// e = new PooledEnumerable<T>(pool);
// }
// return e;
// }
// private bool _IsDisposed;
// private List<T> _Pool = new List<T>(0x40);
// public PooledEnumerable(IEnumerable<T> pool)
// {
// _Pool.AddRange(pool);
// }
// IEnumerator IEnumerable.GetEnumerator()
// {
// return _Pool.GetEnumerator();
// }
// public IEnumerator<T> GetEnumerator()
// {
// return _Pool.GetEnumerator();
// }
// public void Free()
// {
// if (_IsDisposed)
// {
// return;
// }
// _Pool.Clear();
// if (_Pool.Capacity > 0x100)
// {
// _Pool.Capacity = 0x100;
// }
// lock (((ICollection)_Buffer).SyncRoot)
// {
// _Buffer.Enqueue(this);
// }
// }
// public void Dispose()
// {
// _IsDisposed = true;
// _Pool.Clear();
// _Pool.TrimExcess();
// _Pool = null;
// }
// }
//#else
// #region Enumerables
// public class NullEnumerable<T> : IPooledEnumerable<T>
// {
// private InternalEnumerator<T> m_Enumerator;
// public static readonly NullEnumerable<T> Instance = new NullEnumerable<T>();
// private NullEnumerable()
// {
// m_Enumerator = new InternalEnumerator<T>();
// }
// IEnumerator IEnumerable.GetEnumerator() { return m_Enumerator; }
// public IEnumerator<T> GetEnumerator() { return m_Enumerator; }
// public void Free() { }
// private class InternalEnumerator<K> : IEnumerator<K>
// {
// public void Reset() { }
// object IEnumerator.Current { get { return null; } }
// public K Current { get { return default(K); } }
// public bool MoveNext() { return false; }
// void IDisposable.Dispose() { }
// }
// }
// private class PooledEnumerable<T> : IPooledEnumerable<T>, IDisposable
// {
// private IPooledEnumerator<T> m_Enumerator;
// private static Queue<PooledEnumerable<T>> m_InstancePool = new Queue<PooledEnumerable<T>>();
// public static PooledEnumerable<T> Instantiate(IPooledEnumerator<T> etor)
// {
// PooledEnumerable<T> e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_Enumerator = etor;
// }
// }
// if (e == null)
// e = new PooledEnumerable<T>(etor);
// return e;
// }
// private PooledEnumerable(IPooledEnumerator<T> etor)
// {
// m_Enumerator = etor;
// }
// IEnumerator IEnumerable.GetEnumerator()
// {
// if (m_Enumerator == null)
// throw new ObjectDisposedException("PooledEnumerable", "GetEnumerator() called after Free()");
// return m_Enumerator;
// }
// public IEnumerator<T> GetEnumerator()
// {
// if (m_Enumerator == null)
// throw new ObjectDisposedException("PooledEnumerable", "GetEnumerator() called after Free()");
// return m_Enumerator;
// }
// public void Free()
// {
// if (m_Enumerator != null)
// {
// m_Enumerator.Free();
// m_Enumerator = null;
// }
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// }
// }
// public void Dispose()
// {
// // Don't return disposed objects to the instance pool
// //Free();
// if (m_Enumerator != null)
// {
// m_Enumerator.Free();
// m_Enumerator = null;
// }
// }
// }
// #endregion
// #region Enumerators
// private class ClientEnumerator : IPooledEnumerator<NetState>
// {
// private Map m_Map;
// private Rectangle2D m_Bounds;
// private int m_xSector, m_ySector;
// private int m_xSectorStart, m_ySectorStart;
// private int m_xSectorEnd, m_ySectorEnd;
// private List<NetState> m_CurrentList;
// private int m_CurrentIndex;
// private static Queue<ClientEnumerator> m_InstancePool = new Queue<ClientEnumerator>();
// public static ClientEnumerator Instantiate(Map map, Rectangle2D bounds)
// {
// ClientEnumerator e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_Map = map;
// e.m_Bounds = bounds;
// }
// }
// if (e == null)
// {
// e = new ClientEnumerator(map, bounds);
// }
// e.Reset();
// return e;
// }
// public void Free()
// {
// if (m_Map == null)
// return;
// m_Map = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// }
// }
// private ClientEnumerator(Map map, Rectangle2D bounds)
// {
// m_Map = map;
// m_Bounds = bounds;
// }
// public NetState Current
// {
// get
// {
// return m_CurrentList[m_CurrentIndex];
// }
// }
// object IEnumerator.Current { get { return m_CurrentList[m_CurrentIndex]; } }
// void IDisposable.Dispose() { }
// public bool MoveNext()
// {
// while (true)
// {
// ++m_CurrentIndex;
// if (m_CurrentIndex == m_CurrentList.Count)
// {
// ++m_ySector;
// if (m_ySector > m_ySectorEnd)
// {
// m_ySector = m_ySectorStart;
// ++m_xSector;
// if (m_xSector > m_xSectorEnd)
// {
// m_CurrentIndex = -1;
// return false;
// }
// }
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Clients;
// }
// else
// {
// Mobile m = m_CurrentList[m_CurrentIndex].Mobile;
// if (m != null && !m.Deleted && m_Bounds.Contains(m.Location))
// return true;
// }
// }
// }
// public void Reset()
// {
// m_Map.Bound(m_Bounds.Start.m_X, m_Bounds.Start.m_Y, out m_xSectorStart, out m_ySectorStart);
// m_Map.Bound(m_Bounds.End.m_X - 1, m_Bounds.End.m_Y - 1, out m_xSectorEnd, out m_ySectorEnd);
// m_xSector = m_xSectorStart >>= Map.SectorShift;
// m_ySector = m_ySectorStart >>= Map.SectorShift;
// m_xSectorEnd >>= Map.SectorShift;
// m_ySectorEnd >>= Map.SectorShift;
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Clients;
// }
// }
// private class EntityEnumerator : IPooledEnumerator<IEntity>
// {
// private Map m_Map;
// private Rectangle2D m_Bounds;
// private int m_xSector, m_ySector;
// private int m_xSectorStart, m_ySectorStart;
// private int m_xSectorEnd, m_ySectorEnd;
// private int m_Stage;
// private IList m_CurrentList;
// private int m_CurrentIndex;
// private static Queue<EntityEnumerator> m_InstancePool = new Queue<EntityEnumerator>();
// public static EntityEnumerator Instantiate(Map map, Rectangle2D bounds)
// {
// EntityEnumerator e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_Map = map;
// e.m_Bounds = bounds;
// }
// }
// if (e == null)
// {
// e = new EntityEnumerator(map, bounds);
// }
// e.Reset();
// return e;
// }
// public void Free()
// {
// if (m_Map == null)
// return;
// m_Map = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// }
// }
// private EntityEnumerator(Map map, Rectangle2D bounds)
// {
// m_Map = map;
// m_Bounds = bounds;
// }
// public IEntity Current
// {
// get
// {
// return (IEntity)m_CurrentList[m_CurrentIndex];
// }
// }
// object IEnumerator.Current { get { return m_CurrentList[m_CurrentIndex]; } }
// void IDisposable.Dispose() { }
// public bool MoveNext()
// {
// while (true)
// {
// ++m_CurrentIndex;
// if (m_CurrentIndex < 0 || m_CurrentIndex > m_CurrentList.Count)
// { // Sanity
// Console.WriteLine("EntityEnumerator OOB: {0}", m_CurrentIndex);
// return false;
// }
// if (m_CurrentIndex == m_CurrentList.Count)
// {
// ++m_ySector;
// if (m_ySector > m_ySectorEnd)
// {
// m_ySector = m_ySectorStart;
// ++m_xSector;
// if (m_xSector > m_xSectorEnd)
// {
// if (m_Stage > 0)
// {
// m_CurrentIndex = -1;
// return false;
// }
// ++m_Stage;
// m_xSector = m_xSectorStart >>= Map.SectorShift;
// m_ySector = m_ySectorStart >>= Map.SectorShift;
// }
// }
// m_CurrentIndex = -1;
// if (m_Stage == 0)
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Items;
// else
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Mobiles;
// }
// else
// {
// IEntity e = (IEntity)m_CurrentList[m_CurrentIndex];
// if (e.Deleted)
// continue;
// if (e is Item)
// {
// Item item = (Item)e;
// if (item.Parent != null)
// continue;
// }
// if (m_Bounds.Contains(e.Location))
// return true;
// }
// }
// }
// public void Reset()
// {
// m_Map.Bound(m_Bounds.Start.m_X, m_Bounds.Start.m_Y, out m_xSectorStart, out m_ySectorStart);
// m_Map.Bound(m_Bounds.End.m_X - 1, m_Bounds.End.m_Y - 1, out m_xSectorEnd, out m_ySectorEnd);
// m_xSector = m_xSectorStart >>= Map.SectorShift;
// m_ySector = m_ySectorStart >>= Map.SectorShift;
// m_xSectorEnd >>= Map.SectorShift;
// m_ySectorEnd >>= Map.SectorShift;
// m_CurrentIndex = -1;
// m_Stage = 0;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Items;
// }
// }
// private class ItemEnumerator : IPooledEnumerator<Item>
// {
// private Map m_Map;
// private Rectangle2D m_Bounds;
// private int m_xSector, m_ySector;
// private int m_xSectorStart, m_ySectorStart;
// private int m_xSectorEnd, m_ySectorEnd;
// private List<Item> m_CurrentList;
// private int m_CurrentIndex;
// private static Queue<ItemEnumerator> m_InstancePool = new Queue<ItemEnumerator>();
// public static ItemEnumerator Instantiate(Map map, Rectangle2D bounds)
// {
// ItemEnumerator e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_Map = map;
// e.m_Bounds = bounds;
// }
// }
// if (e == null)
// {
// e = new ItemEnumerator(map, bounds);
// }
// e.Reset();
// return e;
// }
// public void Free()
// {
// if (m_Map == null)
// return;
// m_Map = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// }
// }
// private ItemEnumerator(Map map, Rectangle2D bounds)
// {
// m_Map = map;
// m_Bounds = bounds;
// }
// public Item Current
// {
// get
// {
// return m_CurrentList[m_CurrentIndex];
// }
// }
// object IEnumerator.Current { get { return m_CurrentList[m_CurrentIndex]; } }
// void IDisposable.Dispose() { }
// public bool MoveNext()
// {
// while (true)
// {
// ++m_CurrentIndex;
// if (m_CurrentIndex == m_CurrentList.Count)
// {
// ++m_ySector;
// if (m_ySector > m_ySectorEnd)
// {
// m_ySector = m_ySectorStart;
// ++m_xSector;
// if (m_xSector > m_xSectorEnd)
// {
// m_CurrentIndex = -1;
// return false;
// }
// }
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Items;
// }
// else
// {
// Item item = m_CurrentList[m_CurrentIndex];
// if (!item.Deleted && item.Parent == null && m_Bounds.Contains(item.Location))
// return true;
// }
// }
// }
// public void Reset()
// {
// m_Map.Bound(m_Bounds.Start.m_X, m_Bounds.Start.m_Y, out m_xSectorStart, out m_ySectorStart);
// m_Map.Bound(m_Bounds.End.m_X - 1, m_Bounds.End.m_Y - 1, out m_xSectorEnd, out m_ySectorEnd);
// m_xSector = m_xSectorStart >>= Map.SectorShift;
// m_ySector = m_ySectorStart >>= Map.SectorShift;
// m_xSectorEnd >>= Map.SectorShift;
// m_ySectorEnd >>= Map.SectorShift;
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Items;
// }
// }
// private class MobileEnumerator : IPooledEnumerator<Mobile>
// {
// private Map m_Map;
// private Rectangle2D m_Bounds;
// private int m_xSector, m_ySector;
// private int m_xSectorStart, m_ySectorStart;
// private int m_xSectorEnd, m_ySectorEnd;
// private List<Mobile> m_CurrentList;
// private int m_CurrentIndex;
// private static Queue<MobileEnumerator> m_InstancePool = new Queue<MobileEnumerator>();
// public static MobileEnumerator Instantiate(Map map, Rectangle2D bounds)
// {
// MobileEnumerator e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_Map = map;
// e.m_Bounds = bounds;
// }
// }
// if (e == null)
// {
// e = new MobileEnumerator(map, bounds);
// }
// e.Reset();
// return e;
// }
// public void Free()
// {
// if (m_Map == null)
// return;
// m_Map = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// }
// }
// private MobileEnumerator(Map map, Rectangle2D bounds)
// {
// m_Map = map;
// m_Bounds = bounds;
// }
// public Mobile Current
// {
// get
// {
// return m_CurrentList[m_CurrentIndex];
// }
// }
// object IEnumerator.Current { get { return m_CurrentList[m_CurrentIndex]; } }
// void IDisposable.Dispose() { }
// public bool MoveNext()
// {
// while (true)
// {
// ++m_CurrentIndex;
// if (m_CurrentIndex == m_CurrentList.Count)
// {
// ++m_ySector;
// if (m_ySector > m_ySectorEnd)
// {
// m_ySector = m_ySectorStart;
// ++m_xSector;
// if (m_xSector > m_xSectorEnd)
// {
// m_CurrentIndex = -1;
// return false;
// }
// }
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Mobiles;
// }
// else
// {
// Mobile m = m_CurrentList[m_CurrentIndex];
// if (!m.Deleted && m_Bounds.Contains(m.Location))
// return true;
// }
// }
// }
// public void Reset()
// {
// m_Map.Bound(m_Bounds.Start.m_X, m_Bounds.Start.m_Y, out m_xSectorStart, out m_ySectorStart);
// m_Map.Bound(m_Bounds.End.m_X - 1, m_Bounds.End.m_Y - 1, out m_xSectorEnd, out m_ySectorEnd);
// m_xSector = m_xSectorStart >>= Map.SectorShift;
// m_ySector = m_ySectorStart >>= Map.SectorShift;
// m_xSectorEnd >>= Map.SectorShift;
// m_ySectorEnd >>= Map.SectorShift;
// m_CurrentIndex = -1;
// m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Mobiles;
// }
// }
// private class MultiTileEnumerator : IPooledEnumerator<StaticTile[]>
// {
// private List<BaseMulti> m_List;
// private Point2D m_Location;
// private StaticTile[] m_Current;
// private int m_Index;
// private static Queue<MultiTileEnumerator> m_InstancePool = new Queue<MultiTileEnumerator>();
// public static MultiTileEnumerator Instantiate(Sector sector, Point2D loc)
// {
// MultiTileEnumerator e = null;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count > 0)
// {
// e = m_InstancePool.Dequeue();
// e.m_List = sector.Multis;
// e.m_Location = loc;
// }
// }
// if (e == null)
// {
// e = new MultiTileEnumerator(sector, loc);
// }
// e.Reset();
// return e;
// }
// private MultiTileEnumerator(Sector sector, Point2D loc)
// {
// m_List = sector.Multis;
// m_Location = loc;
// }
// public StaticTile[] Current { get { return m_Current; } }
// object IEnumerator.Current { get { return m_Current; } }
// void IDisposable.Dispose() { }
// public bool MoveNext()
// {
// while (++m_Index < m_List.Count)
// {
// BaseMulti m = m_List[m_Index];
// if (m != null && !m.Deleted)
// {
// MultiComponentList list = m.Components;
// int xOffset = m_Location.m_X - (m.Location.m_X + list.Min.m_X);
// int yOffset = m_Location.m_Y - (m.Location.m_Y + list.Min.m_Y);
// if (xOffset >= 0 && xOffset < list.Width && yOffset >= 0 && yOffset < list.Height)
// {
// StaticTile[] tiles = list.Tiles[xOffset][yOffset];
// if (tiles.Length > 0)
// {
// // TODO: How to avoid this copy?
// StaticTile[] copy = new StaticTile[tiles.Length];
// for (int i = 0; i < copy.Length; ++i)
// {
// copy[i] = tiles[i];
// copy[i].Z += m.Z;
// }
// m_Current = copy;
// return true;
// }
// }
// }
// }
// return false;
// }
// public void Free()
// {
// if (m_List == null)
// return;
// lock (m_InstancePool)
// {
// if (m_InstancePool.Count < 200) // Arbitrary
// m_InstancePool.Enqueue(this);
// m_List = null;
// }
// }
// public void Reset()
// {
// m_Current = null;
// m_Index = -1;
// }
// }
// #endregion
//#endif
// public Point3D GetPoint(object o, bool eye)
// {
// Point3D p;
// if (o is Mobile)
// {
// p = ((Mobile)o).Location;
// p.Z += 14;//eye ? 15 : 10;
// }
// else if (o is Item)
// {
// p = ((Item)o).GetWorldLocation();
// p.Z += (((Item)o).ItemData.Height / 2) + 1;
// }
// else if (o is Point3D)
// {
// p = (Point3D)o;
// }
// else if (o is LandTarget)
// {
// p = ((LandTarget)o).Location;
// int low = 0, avg = 0, top = 0;
// GetAverageZ(p.X, p.Y, ref low, ref avg, ref top);
// p.Z = top + 1;
// }
// else if (o is StaticTarget)
// {
// StaticTarget st = (StaticTarget)o;
// ItemData id = TileData.ItemTable[st.ItemID & TileData.MaxItemValue];
// p = new Point3D(st.X, st.Y, st.Z - id.CalcHeight + (id.Height / 2) + 1);
// }
// else if (o is IPoint3D)
// {
// p = new Point3D((IPoint3D)o);
// }
// else
// {
// Console.WriteLine("Warning: Invalid object ({0}) in line of sight", o);
// p = Point3D.Zero;
// }
// return p;
// }
// #region Line Of Sight
// private static int m_MaxLOSDistance = 25;
// public static int MaxLOSDistance
// {
// get { return m_MaxLOSDistance; }
// set { m_MaxLOSDistance = value; }
// }
// public bool LineOfSight(Point3D org, Point3D dest)
// {
// if (this == Map.Internal)
// return false;
// if (!Utility.InRange(org, dest, m_MaxLOSDistance))
// return false;
// Point3D start = org;
// Point3D end = dest;
// if (org.X > dest.X || (org.X == dest.X && org.Y > dest.Y) || (org.X == dest.X && org.Y == dest.Y && org.Z > dest.Z))
// {
// Point3D swap = org;
// org = dest;
// dest = swap;
// }
// double rise, run, zslp;
// double sq3d;
// double x, y, z;
// int xd, yd, zd;
// int ix, iy, iz;
// int height;
// bool found;
// Point3D p;
// Point3DList path = new Point3DList();
// TileFlag flags;
// if (org == dest)
// return true;
// if (path.Count > 0)
// path.Clear();
// xd = dest.X - org.X;
// yd = dest.Y - org.Y;
// zd = dest.Z - org.Z;
// zslp = Math.Sqrt(xd * xd + yd * yd);
// if (zd != 0)
// sq3d = Math.Sqrt(zslp * zslp + zd * zd);
// else
// sq3d = zslp;
// rise = ((float)yd) / sq3d;
// run = ((float)xd) / sq3d;
// zslp = ((float)zd) / sq3d;
// y = org.Y;
// z = org.Z;
// x = org.X;
// while (Utility.NumberBetween(x, dest.X, org.X, 0.5) && Utility.NumberBetween(y, dest.Y, org.Y, 0.5) && Utility.NumberBetween(z, dest.Z, org.Z, 0.5))
// {
// ix = (int)Math.Round(x);
// iy = (int)Math.Round(y);
// iz = (int)Math.Round(z);
// if (path.Count > 0)
// {
// p = path.Last;
// if (p.X != ix || p.Y != iy || p.Z != iz)
// path.Add(ix, iy, iz);
// }
// else
// {
// path.Add(ix, iy, iz);
// }
// x += run;
// y += rise;
// z += zslp;
// }
// if (path.Count == 0)
// return true;//<--should never happen, but to be safe.
// p = path.Last;
// if (p != dest)
// path.Add(dest);
// Point3D pTop = org, pBottom = dest;
// Utility.FixPoints(ref pTop, ref pBottom);
// var pathCount = path.Count;
// var endTop = end.Z + 1;
// for (var i = 0; i < pathCount; ++i)
// {
// var point = path[i];
// var pointTop = point.Z + 1;
// LandTile landTile = Tiles.GetLandTile(point.X, point.Y);
// int landZ = 0, landAvg = 0, landTop = 0;
// GetAverageZ(point.X, point.Y, ref landZ, ref landAvg, ref landTop);
// if (landZ <= pointTop && landTop >= point.Z && (point.X != end.X || point.Y != end.Y || landZ > endTop || landTop < end.Z) && !landTile.Ignored)
// return false;
// /* --Do land tiles need to be checked? There is never land between two people, always statics.--
// LandTile landTile = Tiles.GetLandTile( point.X, point.Y );
// if ( landTile.Z-1 >= point.Z && landTile.Z+1 <= point.Z && (TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags & TileFlag.Impassable) != 0 )
// return false;
// */
// var statics = Tiles.GetStaticTiles(point.X, point.Y, true);
// var contains = false;
// var ltID = landTile.ID;
// for (var j = 0; !contains && j < m_InvalidLandTiles.Length; ++j)
// contains = (ltID == m_InvalidLandTiles[j]);
// if (contains && statics.Length == 0)
// {
// IPooledEnumerable<Item> eable = GetItemsInRange(point, 0);
// foreach (Item item in eable)
// {
// if (item.Visible)
// contains = false;
// if (!contains)
// break;
// }
// eable.Free();
// if (contains)
// return false;
// }
// for (int j = 0; j < statics.Length; ++j)
// {
// StaticTile t = statics[j];
// ItemData id = TileData.ItemTable[t.ID & TileData.MaxItemValue];
// flags = id.Flags;
// height = id.CalcHeight;
// if (t.Z <= pointTop && t.Z + height >= point.Z && (flags & (TileFlag.Window | TileFlag.NoShoot)) != 0)
// {
// if (point.X == end.X && point.Y == end.Y && t.Z <= endTop && t.Z + height >= end.Z)
// continue;
// return false;
// }
// /*if ( t.Z <= point.Z && t.Z+height >= point.Z && (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0
// && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )*/
// /*{
// //Console.WriteLine( "LoS: Blocked by Static \"{0}\" Z:{1} T:{3} P:{2} F:x{4:X}", TileData.ItemTable[t.ID&TileData.MaxItemValue].Name, t.Z, point, t.Z+height, flags );
// //Console.WriteLine( "if ( {0} && {1} && {2} && ( {3} || {4} || {5} || ({6} && {7} && {8}) ) )", t.Z <= point.Z, t.Z+height >= point.Z, (flags&TileFlag.Window)==0, (flags&TileFlag.Impassable)!=0, (flags&TileFlag.Wall)!=0, (flags&TileFlag.Roof)!=0, (flags&TileFlag.Surface)!=0, t.Z != dest.Z, zd != 0 ) ;
// return false;
// }*/
// }
// }
// Rectangle2D rect = new Rectangle2D(pTop.X, pTop.Y, (pBottom.X - pTop.X) + 1, (pBottom.Y - pTop.Y) + 1);
// IPooledEnumerable<Item> area = GetItemsInBounds(rect);
// foreach (Item i in area)
// {
// if (!i.Visible)
// continue;
// if (i is BaseMulti || i.ItemID > TileData.MaxItemValue)
// continue;
// ItemData id = i.ItemData;
// flags = id.Flags;
// if ((flags & (TileFlag.Window | TileFlag.NoShoot)) == 0)
// continue;
// height = id.CalcHeight;
// found = false;
// int count = path.Count;
// for (int j = 0; j < count; ++j)
// {
// Point3D point = path[j];
// int pointTop = point.Z + 1;
// Point3D loc = i.Location;
// //if ( t.Z <= point.Z && t.Z+height >= point.Z && ( height != 0 || ( t.Z == dest.Z && zd != 0 ) ) )
// if (loc.X == point.X && loc.Y == point.Y &&
// loc.Z <= pointTop && loc.Z + height >= point.Z)
// {
// if (loc.X == end.X && loc.Y == end.Y && loc.Z <= endTop && loc.Z + height >= end.Z)
// continue;
// found = true;
// break;
// }
// }
// if (!found)
// continue;
// area.Free();
// return false;
// /*if ( (flags & (TileFlag.Impassable | TileFlag.Surface | TileFlag.Roof)) != 0 )
// //flags = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Flags;
// //if ( (flags&TileFlag.Window)==0 && (flags&TileFlag.NoShoot)!=0 && ( (flags&TileFlag.Wall)!=0 || (flags&TileFlag.Roof)!=0 || (((flags&TileFlag.Surface)!=0 && zd != 0)) ) )
// {
// //height = TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Height;
// //Console.WriteLine( "LoS: Blocked by ITEM \"{0}\" P:{1} T:{2} F:x{3:X}", TileData.ItemTable[i.ItemID&TileData.MaxItemValue].Name, i.Location, i.Location.Z+height, flags );
// area.Free();
// return false;
// }*/
// }
// area.Free();
// return true;
// }
// public bool LineOfSight(object from, object dest)
// {
// if (from == dest || (from is Mobile && ((Mobile)from).AccessLevel > AccessLevel.Player))
// return true;
// else if (dest is Item && from is Mobile && ((Item)dest).RootParent == from)
// return true;
// return LineOfSight(GetPoint(from, true), GetPoint(dest, false));
// }
// public bool LineOfSight(Mobile from, Point3D target)
// {
// if (from.AccessLevel > AccessLevel.Player)
// return true;
// Point3D eye = from.Location;
// eye.Z += 14;
// return LineOfSight(eye, target);
// }
// public bool LineOfSight(Mobile from, Mobile to)
// {
// if (from == to || from.AccessLevel > AccessLevel.Player)
// return true;
// Point3D eye = from.Location;
// Point3D target = to.Location;
// eye.Z += 14;
// target.Z += 14;//10;
// return LineOfSight(eye, target);
// }
// #endregion
// private static int[] m_InvalidLandTiles = new int[] { 0x244 };
// public static int[] InvalidLandTiles
// {
// get { return m_InvalidLandTiles; }
// set { m_InvalidLandTiles = value; }
// }
// public int CompareTo(Map other)
// {
// if (other == null)
// return -1;
// return m_MapID.CompareTo(other.m_MapID);
// }
// public int CompareTo(object other)
// {
// if (other == null || other is Map)
// return this.CompareTo(other);
// throw new ArgumentException();
// }
// }
//}
| 32.580928 | 312 | 0.43248 | [
"MIT"
] | smorey2/GameEstate | src/GameExtensions/UO/src/GameEstate.Extensions.UO/Formats/Binary/UltimaUO/Records/Map.cs | 89,174 | C# |
using CharacterGen.CharacterClasses;
using CharacterGen.Domain.Tables;
using NUnit.Framework;
using System;
using System.Linq;
namespace CharacterGen.Tests.Integration.Tables.Magics.Spells.Known.Paladins
{
[TestFixture]
public class Level1PaladinKnownSpellsTests : AdjustmentsTests
{
protected override string tableName
{
get
{
return string.Format(TableNameConstants.Formattable.Adjustments.LevelXCLASSKnownSpells, 1, CharacterClassConstants.Paladin);
}
}
[Test]
public override void CollectionNames()
{
var names = Enumerable.Empty<String>();
AssertCollectionNames(names);
}
}
}
| 26.142857 | 140 | 0.655738 | [
"MIT"
] | DnDGen/CharacterGen | CharacterGen.Tests.Integration.Tables/Magics/Spells/Known/Paladins/Level1PaladinKnownSpellsTests.cs | 734 | C# |
#region License
// Copyright (c) Amos Voron. All rights reserved.
// Licensed under the Apache 2.0 License. See LICENSE in the project root for license information.
#endregion
using System;
using QueryTalk.Wall;
namespace QueryTalk
{
// Used only for the declaration of the SQL variables by inferring the type from the given value (DeclareArgument).
/// <summary>
/// Represents a CLR value of a SQL variable.
/// </summary>
public sealed class DeclareArgument : Argument
{
// Main constructor that all other CLR constructors call. When an argument of a certain value CLR type is passed to this constructor,
// the boxing occurs. We choose this approach due to its simplicity.
private DeclareArgument(object arg)
: base(arg)
{
if (arg is Chainer)
{
TryTakeAll((Chainer)arg);
}
else
{
Build = (buildContext, buildArgs) =>
{
return Mapping.BuildUnchecked(arg, out chainException);
};
}
}
#region QueryTalk CLR Types (including System.String)
#region System.String
internal DeclareArgument(System.String arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.String arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Boolean
internal DeclareArgument(System.Boolean arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Boolean arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Byte
internal DeclareArgument(System.Byte arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Byte arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Byte[]
internal DeclareArgument(System.Byte[] arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Byte[] arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.DateTime
internal DeclareArgument(System.DateTime arg)
: this(arg as object)
{
Build = (buildContext, buildArgs) =>
{
return BuildClr(arg, buildContext);
};
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.DateTime arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.DateTimeOffset
internal DeclareArgument(System.DateTimeOffset arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.DateTimeOffset arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Decimal
internal DeclareArgument(System.Decimal arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Decimal arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Double
internal DeclareArgument(System.Double arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Double arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Guid
internal DeclareArgument(Guid arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Guid arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Int16
internal DeclareArgument(System.Int16 arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Int16 arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Int32
internal DeclareArgument(System.Int32 arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Int32 arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Int64
internal DeclareArgument(System.Int64 arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Int64 arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.Single
internal DeclareArgument(System.Single arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.Single arg)
{
return new DeclareArgument(arg);
}
#endregion
#region System.TimeSpan
internal DeclareArgument(System.TimeSpan arg)
: this(arg as object)
{
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(System.TimeSpan arg)
{
return new DeclareArgument(arg);
}
#endregion
#endregion
#region Value
internal DeclareArgument(Value arg)
: base(arg as Chainer)
{
if (arg.IsNullReference())
{
arg = Designer.Null;
}
ArgType = arg.ClrType;
Build = arg.Build;
SetArgType(arg);
}
/// <summary>
/// Implicitly converts an argument into the object of DeclareArgument type.
/// </summary>
/// <param name="arg">An argument to convert.</param>
public static implicit operator DeclareArgument(Value arg)
{
return new DeclareArgument(arg);
}
#endregion
}
}
| 27.460177 | 142 | 0.556773 | [
"MIT"
] | amosvoron/QueryTalk | lib/arguments/DeclareArgument.cs | 9,311 | C# |
using BtcTurk.Net.Converters;
using CryptoExchange.Net.Attributes;
using CryptoExchange.Net.Converters;
using Newtonsoft.Json;
using System;
namespace BtcTurk.Net.Objects
{
public class BtcTurkOpenOrders
{
[JsonProperty("asks")]
public BtcTurkOrder[] Asks { get; set; }
[JsonProperty("bids")]
public BtcTurkOrder[] Bids { get; set; }
}
}
| 22.588235 | 48 | 0.679688 | [
"MIT"
] | burakoner/BtcTurk.Net | BtcTurk.Net/Objects/BtcTurkOpenOrders.cs | 386 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CustomList
{
public class Guitar
{
public string make;
public string model;
public int year;
public Guitar(string make, string model, int year)
{
this.make = "Brand";
this.model = "Style";
this.year = 0000;
}
}
}
| 19.863636 | 58 | 0.585812 | [
"MIT"
] | BrianRobertson/CustomList | CustomList/CustomList/Guitar.cs | 439 | C# |
using PasswordManager.Bot.Commands.Abstractions;
using PasswordManager.Bot.Commands.Enums;
using PasswordManager.Core.Entities;
using System;
using System.Collections.Generic;
namespace PasswordManager.Bot.Commands {
public class CommandFactory : ICommandFactory {
//We use Type instead of ICommand objects because we initialize commands using IServiceProvider
private Dictionary<string, Type> messageCommands;
private Dictionary<CallbackQueryCommandCode, Type> callbackQueryCommands;
private Dictionary<UserAction, Type> actionCommands;
private Dictionary<UserAction, Type> replyActionCommands;
private readonly IServiceProvider serviceProvider;
public CommandFactory(IServiceProvider serviceProvider) {
this.serviceProvider = serviceProvider;
InitCommands();
}
private void InitCommands() {
InitMessageCommands();
InitActionCommands();
InitReplyActionCommands();
InitCallbackQueryCommands();
}
private void InitMessageCommands() {
//TODO:
//Set commands to telegram bot from file using setMyCommands
//Check them through getMeCommands first if they match local commands
//and change on telegram if not
//Store commands in json file in format
//{
// "Help": {
// "Command": "help",
// "Description" : "Get help"
// }
//}
//And cast to Telegram.Bot.Types.BotCommand objects on startup
//And then use them here by Telegram.Bot.Types.BotCommand.Command key and in HelpCommand command
//
//TODO:
//Add feature to Re-Init commands at runtime
//All message commands MUST be in lower case
messageCommands = new Dictionary<string, Type>();
//TODO add manually to dictionary
Add<IMessageCommand, HelpCommand>("/help");
Add<IMessageCommand, HelpCommand>("/start");
Add<IMessageCommand, SelectLanguageCommand>("/language");
Add<IMessageCommand, ShowAllAccountsCommand>("/all");
Add<IMessageCommand, AddAccountCommand>("/add");
Add<IMessageCommand, CancelCommand>("/cancel");
Add<IMessageCommand, SetUpPasswordGeneratorCommand>("/generator");
Add<IMessageCommand, AddUserCommand>("/adduser");
Add<IMessageCommand, RemoveUserCommand>("/removeuser");
Add<IMessageCommand, UserListCommand>("/userlist");
Add<IMessageCommand, UserSettingsCommand>("/settings");
}
private void InitActionCommands() {
actionCommands = new Dictionary<UserAction, Type>();
Add<IActionCommand, SearchCommand>(UserAction.Search);
Add<IActionCommand, AddAccountCommand>(UserAction.AssembleAccount);
Add<IActionCommand, UpdateAccountCommand>(UserAction.UpdateAccount);
Add<IActionCommand, SetUpPasswordGeneratorCommand>(UserAction.SetUpPasswordGeneratorLength);
Add<IActionCommand, ShowPasswordCommand>(UserAction.EnterDecryptionKey);
Add<IActionCommand, UpdateUserSettingsCommand>(UserAction.UpdateUserSettings);
Add<IActionCommand, EncryptPasswordCommand>(UserAction.EncryptPassword);
}
private void InitReplyActionCommands() {
replyActionCommands = new Dictionary<UserAction, Type>();
Add<IReplyActionCommand, EncryptPasswordCommand>(UserAction.EncryptPassword);
}
private void InitCallbackQueryCommands() {
callbackQueryCommands = new Dictionary<CallbackQueryCommandCode, Type>();
Add<ICallbackQueryCommand, AddAccountCommand> (CallbackQueryCommandCode.AddAccount);
Add<ICallbackQueryCommand, SelectLanguageCommand> (CallbackQueryCommandCode.SelectLanguage);
Add<ICallbackQueryCommand, GeneratePasswordCommand>(CallbackQueryCommandCode.GeneratePassword);
Add<ICallbackQueryCommand, SearchCommand>(CallbackQueryCommandCode.Search);
Add<ICallbackQueryCommand, ShowPasswordCommand>(CallbackQueryCommandCode.ShowPassword);
Add<ICallbackQueryCommand, ShowAccountCommand>(CallbackQueryCommandCode.ShowAccount);
Add<ICallbackQueryCommand, DeleteMessageCommand>(CallbackQueryCommandCode.DeleteMessage);
Add<ICallbackQueryCommand, UpdateAccountCommand>(CallbackQueryCommandCode.UpdateAccount);
Add<ICallbackQueryCommand, DeleteAccountCommand>(CallbackQueryCommandCode.DeleteAccount);
Add<ICallbackQueryCommand, SetUpPasswordGeneratorCommand>(CallbackQueryCommandCode.SetUpPasswordGenerator);
Add<ICallbackQueryCommand, ShowEncryptionHintCommand/*Show hint in answer callback method as alert*/>(CallbackQueryCommandCode.ShowEncryptionKeyHint);
Add<ICallbackQueryCommand, UpdateUserSettingsCommand>(CallbackQueryCommandCode.UpdateUserSettings);
Add<ICallbackQueryCommand, EncryptPasswordCommand>(CallbackQueryCommandCode.EncryptPassword);
}
public ICallbackQueryCommand GetCallBackQueryCommand(CallbackQueryCommandCode callbackCommandCode) {
if (callbackQueryCommands.TryGetValue(callbackCommandCode, out Type type))
return (ICallbackQueryCommand)serviceProvider.GetService(type);
return null;
}
public IMessageCommand GetMessageCommand(string messageCommand) {
if (messageCommands.TryGetValue(messageCommand, out Type type))
return (IMessageCommand)serviceProvider.GetService(type);
return null;
}
public IActionCommand GetActionCommand(UserAction action) {
if (actionCommands.TryGetValue(action, out Type type))
return (IActionCommand)serviceProvider.GetService(type);
return null;
}
public IReplyActionCommand GetReplyActionCommand(UserAction action) {
if (replyActionCommands.TryGetValue(action, out Type type))
return (IReplyActionCommand)serviceProvider.GetService(type);
return null;
}
}
}
| 44.598361 | 153 | 0.794523 | [
"MIT"
] | Zankomag/PasswordManager | src/PasswordManager.Bot/Commands/CommandFactory.cs | 5,443 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
class Program
{
static int Main(string[] args)
{
System.Console.WriteLine(
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription
);
CallC();
CallB();
CallC2();
CallB2();
return 100;
}
static void CallB() => new B();
static void CallC() => new C();
static void CallB2() => new B2();
static void CallC2() => new C2();
}
abstract class A<T>
{
public abstract A<T> M();
}
abstract class A2<T>
{
public abstract A2<T> M<U>();
}
class B : A<string>
{
public override B M() => new B();
}
class B2 : A2<string>
{
public override B2 M<U>() => new B2();
}
class C : A<int>
{
public override C M() => new C();
}
class C2 : A2<int>
{
public override C2 M<U>() => new C2();
}
| 16.649123 | 82 | 0.571128 | [
"MIT"
] | belav/runtime | src/tests/Regressions/coreclr/GitHub_43763/test43763.cs | 949 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Storage
{
#if false || false || false || false || false || false || false
[global::Uno.NotImplemented]
#endif
public partial class StorageFolder : global::Windows.Storage.IStorageFolder,global::Windows.Storage.IStorageItem,global::Windows.Storage.Search.IStorageFolderQueryOperations,global::Windows.Storage.IStorageItemProperties,global::Windows.Storage.IStorageItemProperties2,global::Windows.Storage.IStorageItem2,global::Windows.Storage.IStorageFolder2,global::Windows.Storage.IStorageItemPropertiesWithProvider
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.FileAttributes Attributes
{
get
{
throw new global::System.NotImplementedException("The member FileAttributes StorageFolder.Attributes is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::System.DateTimeOffset DateCreated
{
get
{
throw new global::System.NotImplementedException("The member DateTimeOffset StorageFolder.DateCreated is not implemented in Uno.");
}
}
#endif
// Skipping already declared property Name
// Skipping already declared property Path
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string DisplayName
{
get
{
throw new global::System.NotImplementedException("The member string StorageFolder.DisplayName is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string DisplayType
{
get
{
throw new global::System.NotImplementedException("The member string StorageFolder.DisplayType is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string FolderRelativeId
{
get
{
throw new global::System.NotImplementedException("The member string StorageFolder.FolderRelativeId is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.FileProperties.StorageItemContentProperties Properties
{
get
{
throw new global::System.NotImplementedException("The member StorageItemContentProperties StorageFolder.Properties is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.StorageProvider Provider
{
get
{
throw new global::System.NotImplementedException("The member StorageProvider StorageFolder.Provider is not implemented in Uno.");
}
}
#endif
// Skipping already declared method Windows.Storage.StorageFolder.CreateFileAsync(string)
// Skipping already declared method Windows.Storage.StorageFolder.CreateFileAsync(string, Windows.Storage.CreationCollisionOption)
// Skipping already declared method Windows.Storage.StorageFolder.CreateFolderAsync(string)
// Skipping already declared method Windows.Storage.StorageFolder.CreateFolderAsync(string, Windows.Storage.CreationCollisionOption)
// Skipping already declared method Windows.Storage.StorageFolder.GetFileAsync(string)
// Skipping already declared method Windows.Storage.StorageFolder.GetFolderAsync(string)
// Skipping already declared method Windows.Storage.StorageFolder.GetItemAsync(string)
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFile>> GetFilesAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFile>> StorageFolder.GetFilesAsync() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFolder>> GetFoldersAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFolder>> StorageFolder.GetFoldersAsync() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.IStorageItem>> GetItemsAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<IStorageItem>> StorageFolder.GetItemsAsync() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncAction RenameAsync( string desiredName)
{
throw new global::System.NotImplementedException("The member IAsyncAction StorageFolder.RenameAsync(string desiredName) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncAction RenameAsync( string desiredName, global::Windows.Storage.NameCollisionOption option)
{
throw new global::System.NotImplementedException("The member IAsyncAction StorageFolder.RenameAsync(string desiredName, NameCollisionOption option) is not implemented in Uno.");
}
#endif
// Skipping already declared method Windows.Storage.StorageFolder.DeleteAsync()
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncAction DeleteAsync( global::Windows.Storage.StorageDeleteOption option)
{
throw new global::System.NotImplementedException("The member IAsyncAction StorageFolder.DeleteAsync(StorageDeleteOption option) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.BasicProperties> GetBasicPropertiesAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<BasicProperties> StorageFolder.GetBasicPropertiesAsync() is not implemented in Uno.");
}
#endif
// Forced skipping of method Windows.Storage.StorageFolder.Name.get
// Forced skipping of method Windows.Storage.StorageFolder.Path.get
// Forced skipping of method Windows.Storage.StorageFolder.Attributes.get
// Forced skipping of method Windows.Storage.StorageFolder.DateCreated.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsOfType( global::Windows.Storage.StorageItemTypes type)
{
throw new global::System.NotImplementedException("The member bool StorageFolder.IsOfType(StorageItemTypes type) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.Search.IndexedState> GetIndexedStateAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IndexedState> StorageFolder.GetIndexedStateAsync() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFileQueryResult CreateFileQuery()
{
throw new global::System.NotImplementedException("The member StorageFileQueryResult StorageFolder.CreateFileQuery() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFileQueryResult CreateFileQuery( global::Windows.Storage.Search.CommonFileQuery query)
{
throw new global::System.NotImplementedException("The member StorageFileQueryResult StorageFolder.CreateFileQuery(CommonFileQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFileQueryResult CreateFileQueryWithOptions( global::Windows.Storage.Search.QueryOptions queryOptions)
{
throw new global::System.NotImplementedException("The member StorageFileQueryResult StorageFolder.CreateFileQueryWithOptions(QueryOptions queryOptions) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFolderQueryResult CreateFolderQuery()
{
throw new global::System.NotImplementedException("The member StorageFolderQueryResult StorageFolder.CreateFolderQuery() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFolderQueryResult CreateFolderQuery( global::Windows.Storage.Search.CommonFolderQuery query)
{
throw new global::System.NotImplementedException("The member StorageFolderQueryResult StorageFolder.CreateFolderQuery(CommonFolderQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageFolderQueryResult CreateFolderQueryWithOptions( global::Windows.Storage.Search.QueryOptions queryOptions)
{
throw new global::System.NotImplementedException("The member StorageFolderQueryResult StorageFolder.CreateFolderQueryWithOptions(QueryOptions queryOptions) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageItemQueryResult CreateItemQuery()
{
throw new global::System.NotImplementedException("The member StorageItemQueryResult StorageFolder.CreateItemQuery() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.Search.StorageItemQueryResult CreateItemQueryWithOptions( global::Windows.Storage.Search.QueryOptions queryOptions)
{
throw new global::System.NotImplementedException("The member StorageItemQueryResult StorageFolder.CreateItemQueryWithOptions(QueryOptions queryOptions) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFile>> GetFilesAsync( global::Windows.Storage.Search.CommonFileQuery query, uint startIndex, uint maxItemsToRetrieve)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFile>> StorageFolder.GetFilesAsync(CommonFileQuery query, uint startIndex, uint maxItemsToRetrieve) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFile>> GetFilesAsync( global::Windows.Storage.Search.CommonFileQuery query)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFile>> StorageFolder.GetFilesAsync(CommonFileQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFolder>> GetFoldersAsync( global::Windows.Storage.Search.CommonFolderQuery query, uint startIndex, uint maxItemsToRetrieve)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFolder>> StorageFolder.GetFoldersAsync(CommonFolderQuery query, uint startIndex, uint maxItemsToRetrieve) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.StorageFolder>> GetFoldersAsync( global::Windows.Storage.Search.CommonFolderQuery query)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<StorageFolder>> StorageFolder.GetFoldersAsync(CommonFolderQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::System.Collections.Generic.IReadOnlyList<global::Windows.Storage.IStorageItem>> GetItemsAsync( uint startIndex, uint maxItemsToRetrieve)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IReadOnlyList<IStorageItem>> StorageFolder.GetItemsAsync(uint startIndex, uint maxItemsToRetrieve) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool AreQueryOptionsSupported( global::Windows.Storage.Search.QueryOptions queryOptions)
{
throw new global::System.NotImplementedException("The member bool StorageFolder.AreQueryOptionsSupported(QueryOptions queryOptions) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsCommonFolderQuerySupported( global::Windows.Storage.Search.CommonFolderQuery query)
{
throw new global::System.NotImplementedException("The member bool StorageFolder.IsCommonFolderQuerySupported(CommonFolderQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsCommonFileQuerySupported( global::Windows.Storage.Search.CommonFileQuery query)
{
throw new global::System.NotImplementedException("The member bool StorageFolder.IsCommonFileQuerySupported(CommonFileQuery query) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetThumbnailAsync(ThumbnailMode mode) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode, uint requestedSize)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetThumbnailAsync(ThumbnailMode mode, uint requestedSize) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode, uint requestedSize, global::Windows.Storage.FileProperties.ThumbnailOptions options)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetThumbnailAsync(ThumbnailMode mode, uint requestedSize, ThumbnailOptions options) is not implemented in Uno.");
}
#endif
// Forced skipping of method Windows.Storage.StorageFolder.DisplayName.get
// Forced skipping of method Windows.Storage.StorageFolder.DisplayType.get
// Forced skipping of method Windows.Storage.StorageFolder.FolderRelativeId.get
// Forced skipping of method Windows.Storage.StorageFolder.Properties.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetScaledImageAsThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode mode) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetScaledImageAsThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode, uint requestedSize)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode mode, uint requestedSize) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.FileProperties.StorageItemThumbnail> GetScaledImageAsThumbnailAsync( global::Windows.Storage.FileProperties.ThumbnailMode mode, uint requestedSize, global::Windows.Storage.FileProperties.ThumbnailOptions options)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageItemThumbnail> StorageFolder.GetScaledImageAsThumbnailAsync(ThumbnailMode mode, uint requestedSize, ThumbnailOptions options) is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.StorageFolder> GetParentAsync()
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageFolder> StorageFolder.GetParentAsync() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public bool IsEqual( global::Windows.Storage.IStorageItem item)
{
throw new global::System.NotImplementedException("The member bool StorageFolder.IsEqual(IStorageItem item) is not implemented in Uno.");
}
#endif
// Skipping already declared method Windows.Storage.StorageFolder.TryGetItemAsync(string)
// Forced skipping of method Windows.Storage.StorageFolder.Provider.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Storage.StorageLibraryChangeTracker TryGetChangeTracker()
{
throw new global::System.NotImplementedException("The member StorageLibraryChangeTracker StorageFolder.TryGetChangeTracker() is not implemented in Uno.");
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public static global::Windows.Foundation.IAsyncOperation<global::Windows.Storage.StorageFolder> GetFolderFromPathForUserAsync( global::Windows.System.User user, string path)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<StorageFolder> StorageFolder.GetFolderFromPathForUserAsync(User user, string path) is not implemented in Uno.");
}
#endif
// Skipping already declared method Windows.Storage.StorageFolder.GetFolderFromPathAsync(string)
// Processing: Windows.Storage.IStorageFolder
// Processing: Windows.Storage.IStorageItem
// Processing: Windows.Storage.Search.IStorageFolderQueryOperations
// Processing: Windows.Storage.IStorageItemProperties
// Processing: Windows.Storage.IStorageItemProperties2
// Processing: Windows.Storage.IStorageItem2
// Processing: Windows.Storage.IStorageFolder2
// Processing: Windows.Storage.IStorageItemPropertiesWithProvider
}
}
| 73.761236 | 407 | 0.775315 | [
"Apache-2.0"
] | Arlodotexe/uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Storage/StorageFolder.cs | 26,259 | 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 lambda-2015-03-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.Lambda.Model
{
/// <summary>
/// Code signing configuration policies specifies the validation failure action for signature
/// mismatch or expiry.
/// </summary>
public partial class CodeSigningPolicies
{
private CodeSigningPolicy _untrustedArtifactOnDeployment;
/// <summary>
/// Gets and sets the property UntrustedArtifactOnDeployment.
/// <para>
/// Code signing configuration policy for deployment validation failure. If you set the
/// policy to <code>Enforce</code>, Lambda blocks the deployment request if signature
/// validation checks fail. If you set the policy to <code>Warn</code>, Lambda allows
/// the deployment and creates a CloudWatch log.
/// </para>
///
/// <para>
/// Default value: <code>Warn</code>
/// </para>
/// </summary>
public CodeSigningPolicy UntrustedArtifactOnDeployment
{
get { return this._untrustedArtifactOnDeployment; }
set { this._untrustedArtifactOnDeployment = value; }
}
// Check to see if UntrustedArtifactOnDeployment property is set
internal bool IsSetUntrustedArtifactOnDeployment()
{
return this._untrustedArtifactOnDeployment != null;
}
}
} | 34.246154 | 104 | 0.675651 | [
"Apache-2.0"
] | KenHundley/aws-sdk-net | sdk/src/Services/Lambda/Generated/Model/CodeSigningPolicies.cs | 2,226 | C# |
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Ozytis.Common.Core.Utilities;
using Ozytis.Common.Core.Web.Razor;
using Ozytis.Common.Core.Web.Razor.Layout.ArchitectUI;
using WebClient.Repositories;
namespace WebClient.Pages.User
{
[Route(ActivateAccountPage.Url)]
[AllowAnonymous]
public partial class ActivateAccountPage : ComponentBase
{
public const string Url = "/activate-account";
public ActivateAccountPage()
{
}
protected override void OnInitialized()
{
var uri = this.NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
var queryParameters = QueryHelpers.ParseQuery(uri.Query);
if (queryParameters.TryGetValue("email", out var email))
{
this.Email = email;
}
if (queryParameters.TryGetValue("token", out var token))
{
this.Token = token;
}
base.OnInitialized();
}
[Parameter]
public string Token { get; set; }
[Parameter]
public string Email { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
[Inject]
public UsersRepository UsersRepository { get; set; }
public string[] Errors { get; set; }
public bool IsProcessing { get; set; }
public string NewPassword { get; set; }
public string NewPasswordConfirmation { get; set; }
public async Task ProcessAsync()
{
if (this.IsProcessing)
{
return;
}
this.IsProcessing = true;
this.Errors = null;
if (this.NewPassword != this.NewPasswordConfirmation)
{
this.IsProcessing = false;
this.Errors = new[] { "Le mot de passe et sa confirmation ne correspondent pas" };
return;
}
try
{
await this.UsersRepository.ResetPasswordAsync(this.Email, this.Token, this.NewPassword);
AnonymousLayout.Notify(Color.Success, "Votre mot de passe a été enregistré. Vous pouvez dès à présent vous connecter");
await Task.Delay(2000);
this.NavigationManager.NavigateTo(WebClient.Pages.User.LoginPage.Url);
}
catch (BusinessException ex)
{
this.Errors = ex.Messages?.Select(m => m.Replace(".,", ".")).ToArray();
}
this.IsProcessing = false;
}
}
}
| 28.115789 | 135 | 0.573568 | [
"MIT"
] | Ozytis/OzCodeReview | WebClient/Pages/User/ActivateAccountPage.razor.cs | 2,679 | C# |
using System;
using System.Globalization;
using System.Net;
using Newtonsoft.Json;
using WireMock.Logging;
using WireMock.Matchers;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
using WireMock.Settings;
namespace WireMock.Net.ConsoleApplication
{
public static class MainApp
{
public static void Run()
{
string url1 = "http://localhost:9091/";
string url2 = "http://localhost:9092/";
string url3 = "https://localhost:9443/";
var server = FluentMockServer.Start(new FluentMockServerSettings
{
Urls = new[] { url1, url2, url3 },
StartAdminInterface = true,
ReadStaticMappings = true,
WatchStaticMappings = true,
//ProxyAndRecordSettings = new ProxyAndRecordSettings
//{
// SaveMapping = true
//},
PreWireMockMiddlewareInit = app => { System.Console.WriteLine($"PreWireMockMiddlewareInit : {app.GetType()}"); },
PostWireMockMiddlewareInit = app => { System.Console.WriteLine($"PostWireMockMiddlewareInit : {app.GetType()}"); },
Logger = new WireMockConsoleLogger(),
FileSystemHandler = new CustomFileSystemFileHandler()
});
System.Console.WriteLine("FluentMockServer listening at {0}", string.Join(",", server.Urls));
server.SetBasicAuthentication("a", "b");
server.AllowPartialMapping();
server
.Given(Request.Create().WithPath(p => p.Contains("x")).UsingGet())
.AtPriority(4)
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""Contains x with FUNC 200""}"));
server
.Given(Request.Create()
.UsingGet()
.WithPath("/proxy-test-keep-alive")
)
.RespondWith(Response.Create()
.WithHeader("Keep-Alive", "timeout=1, max=1")
);
server
.Given(Request.Create()
.UsingPost()
.WithHeader("postmanecho", "post")
)
.RespondWith(Response.Create()
.WithProxy(new ProxyAndRecordSettings { Url = "http://postman-echo.com/post" })
);
server
.Given(Request.Create()
.UsingGet()
.WithHeader("postmanecho", "get")
)
.RespondWith(Response.Create()
.WithProxy(new ProxyAndRecordSettings { Url = "http://postman-echo.com/get" })
);
server
.Given(Request.Create()
.UsingGet()
.WithPath("/proxy-execute-keep-alive")
)
.RespondWith(Response.Create()
.WithProxy(new ProxyAndRecordSettings { Url = "http://localhost:9999", BlackListedHeaders = new[] { "Keep-Alive" } })
.WithHeader("Keep-Alive-Test", "stef")
);
server
.Given(Request.Create()
.WithPath("/xpath").UsingPost()
.WithBody(new XPathMatcher("/todo-list[count(todo-item) = 3]"))
)
.RespondWith(Response.Create().WithBody("XPathMatcher!"));
server
.Given(Request
.Create()
.WithPath("/jsonthings")
.WithBody(new JsonPathMatcher("$.things[?(@.name == 'RequiredThing')]"))
.UsingPut())
.RespondWith(Response.Create()
.WithBody(@"{ ""result"": ""JsonPathMatcher !!!""}"));
server
.Given(Request
.Create()
.WithPath("/jsonbodytest1")
.WithBody(new JsonMatcher("{ \"x\": 42, \"s\": \"s\" }"))
.UsingPost())
.WithGuid("debaf408-3b23-4c04-9d18-ef1c020e79f2")
.RespondWith(Response.Create()
.WithBody(@"{ ""result"": ""jsonbodytest1"" }"));
server
.Given(Request
.Create()
.WithPath("/jsonbodytest2")
.WithBody(new JsonMatcher(new { x = 42, s = "s" }))
.UsingPost())
.WithGuid("debaf408-3b23-4c04-9d18-ef1c020e79f3")
.RespondWith(Response.Create()
.WithBody(@"{ ""result"": ""jsonbodytest2"" }"));
server
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/navision/OData/Company('My Company')/School*", true))
.WithParam("$filter", "(substringof(Code, 'WA')")
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""odata""}"));
server
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/param2", true))
.WithParam("key", "test")
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "param2" }));
server
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/param3", true))
.WithParam("key", new WildcardMatcher("t*"))
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "param3" }));
server
.Given(Request.Create().WithPath("/headers", "/headers_test").UsingPost().WithHeader("Content-Type", "application/json*"))
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "data:headers posted with 201" }));
if (!System.IO.File.Exists(@"c:\temp\x.json"))
{
System.IO.File.WriteAllText(@"c:\temp\x.json", "{ \"hello\": \"world\", \"answer\": 42 }");
}
server
.Given(Request.Create().WithPath("/file").UsingGet())
.RespondWith(Response.Create()
.WithBodyFromFile(@"c:\temp\x.json", false)
);
server
.Given(Request.Create().WithPath("/filecache").UsingGet())
.RespondWith(Response.Create()
.WithBodyFromFile(@"c:\temp\x.json")
);
server
.Given(Request.Create().WithPath("/file_rel").UsingGet())
.WithGuid("0000aaaa-fcf4-4256-a0d3-1c76e4862947")
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/xml")
.WithBodyFromFile("WireMock.Net.xml", false)
);
server
.Given(Request.Create().WithHeader("ProxyThis", "true")
.UsingGet())
.RespondWith(Response.Create()
.WithProxy("http://www.google.com")
);
server
.Given(Request.Create().WithPath("/bodyasbytes.png")
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "image/png")
.WithBody(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTczbp9jAAAAJ0lEQVQoU2NgUPuPD6Hz0RCEAtJoiAxpCCBXGgmRIo0TofORkdp/AMiMdRVnV6O0AAAAAElFTkSuQmCC"))
);
server
.Given(Request.Create().WithPath("/oauth2/access").UsingPost().WithBody("grant_type=password;username=u;password=p"))
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { access_token = "AT", refresh_token = "RT" }));
server
.Given(Request.Create().WithPath("/helloworld").UsingGet().WithHeader("Authorization", new RegexMatcher("^(?i)Bearer AT$")))
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithBody("hi"));
server
.Given(Request.Create().WithPath("/data").UsingPost().WithBody(b => b.Contains("e")))
.AtPriority(999)
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "data posted with FUNC 201" }));
server
.Given(Request.Create().WithPath("/json").UsingPost().WithBody(new JsonPathMatcher("$.things[?(@.name == 'RequiredThing')]")))
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""json posted with 201""}"));
server
.Given(Request.Create().WithPath("/json2").UsingPost().WithBody("x"))
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""json posted with x - 201""}"));
server
.Given(Request.Create().WithPath("/data").UsingDelete())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""data deleted with 200""}"));
server
.Given(Request.Create()
.WithPath("/needs-a-key")
.UsingGet()
.WithHeader("api-key", "*", MatchBehaviour.AcceptOnMatch)
.UsingAnyMethod())
.RespondWith(Response.Create()
.WithStatusCode(HttpStatusCode.OK)
.WithBody(@"{ ""result"": ""api-key found""}"));
server
.Given(Request.Create()
.WithPath("/needs-a-key")
.UsingGet()
.WithHeader("api-key", "*", MatchBehaviour.RejectOnMatch)
.UsingAnyMethod())
.RespondWith(Response.Create()
.WithStatusCode(HttpStatusCode.Unauthorized)
.WithBody(@"{ ""result"": ""api-key missing""}"));
server
.Given(Request.Create().WithPath("/nobody").UsingGet())
.RespondWith(Response.Create().WithDelay(TimeSpan.FromSeconds(1))
.WithStatusCode(200));
server
.Given(Request.Create().WithPath("/partial").UsingPost().WithBody(new SimMetricsMatcher(new[] { "cat", "dog" })))
.RespondWith(Response.Create().WithStatusCode(200).WithBody("partial = 200"));
// http://localhost:8080/trans?start=1000&stop=1&stop=2
server
.Given(Request.Create().WithPath("/trans").UsingGet())
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithHeader("Transformed-Postman-Token", "token is {{request.headers.Postman-Token}}")
.WithHeader("xyz_{{request.headers.Postman-Token}}", "token is {{request.headers.Postman-Token}}")
.WithBody(@"{""msg"": ""Hello world CATCH-ALL on /*, {{request.path}}, bykey={{request.query.start}}, bykey={{request.query.stop}}, byidx0={{request.query.stop.[0]}}, byidx1={{request.query.stop.[1]}}"" }")
.WithTransformer()
.WithDelay(TimeSpan.FromMilliseconds(100))
);
server
.Given(Request.Create().WithPath("/jsonpathtestToken").UsingPost())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBody("{{JsonPath.SelectToken request.body \"$.Manufacturers[?(@.Name == 'Acme Co')]\"}}")
.WithTransformer()
);
server
.Given(Request.Create().WithPath("/zubinix").UsingPost())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBody("{ \"result\": \"{{JsonPath.SelectToken request.bodyAsJson \"username\"}}\" }")
.WithTransformer()
);
server
.Given(Request.Create().WithPath("/zubinix2").UsingPost())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { path = "{{request.path}}", result = "{{JsonPath.SelectToken request.bodyAsJson \"username\"}}" })
.WithTransformer()
);
server
.Given(Request.Create().WithPath("/jsonpathtestTokenJson").UsingPost())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { status = "OK", url = "{{request.url}}", transformed = "{{JsonPath.SelectToken request.body \"$.Manufacturers[?(@.Name == 'Acme Co')]\"}}" })
.WithTransformer()
);
server
.Given(Request.Create().WithPath("/jsonpathtestTokens").UsingPost())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBody("[{{#JsonPath.SelectTokens request.body \"$..Products[?(@.Price >= 50)].Name\"}} { \"idx\":{{id}}, \"value\":\"{{value}}\" }, {{/JsonPath.SelectTokens}} {} ]")
.WithTransformer()
);
server
.Given(Request.Create()
.WithPath("/state1")
.UsingGet())
.InScenario("s1")
.WillSetStateTo("Test state 1")
.RespondWith(Response.Create()
.WithBody("No state msg 1"));
server
.Given(Request.Create()
.WithPath("/foostate1")
.UsingGet())
.InScenario("s1")
.WhenStateIs("Test state 1")
.RespondWith(Response.Create()
.WithBody("Test state msg 1"));
server
.Given(Request.Create()
.WithPath("/state2")
.UsingGet())
.InScenario("s2")
.WillSetStateTo("Test state 2")
.RespondWith(Response.Create()
.WithBody("No state msg 2"));
server
.Given(Request.Create()
.WithPath("/foostate2")
.UsingGet())
.InScenario("s2")
.WhenStateIs("Test state 2")
.RespondWith(Response.Create()
.WithBody("Test state msg 2"));
server
.Given(Request.Create().WithPath("/encoded-test/a%20b"))
.RespondWith(Response.Create()
.WithBody("EncodedTest 1 : Path={{request.path}}, Url={{request.url}}")
.WithTransformer()
);
server
.Given(Request.Create().WithPath("/encoded-test/a b"))
.RespondWith(Response.Create()
.WithBody("EncodedTest 2 : Path={{request.path}}, Url={{request.url}}")
.WithTransformer()
);
// https://stackoverflow.com/questions/51985089/wiremock-request-matching-with-comparison-between-two-query-parameters
server
.Given(Request.Create().WithPath("/linq")
.WithParam("from", new LinqMatcher("DateTime.Parse(it) > \"2018-03-01 00:00:00\"")))
.RespondWith(Response.Create()
.WithBody("linq match !!!")
);
server
.Given(Request.Create().WithPath("/myendpoint").UsingAnyMethod())
.RespondWith(Response.Create()
.WithStatusCode(500)
.WithBody(requestMessage =>
{
return JsonConvert.SerializeObject(new
{
Message = "Test error"
});
})
);
server
.Given(Request.Create().WithPath("/random"))
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new
{
Xeger1 = "{{Xeger \"\\w{4}\\d{5}\"}}",
Xeger2 = "{{Xeger \"\\d{5}\"}}",
TextRegexPostcode = "{{Random Type=\"TextRegex\" Pattern=\"[1-9][0-9]{3}[A-Z]{2}\"}}",
Text = "{{Random Type=\"Text\" Min=8 Max=20}}",
TextLipsum = "{{Random Type=\"TextLipsum\"}}",
IBAN = "{{Random Type=\"IBAN\" CountryCode=\"NL\"}}",
TimeSpan1 = "{{Random Type=\"TimeSpan\" Format=\"c\" IncludeMilliseconds=false}}",
TimeSpan2 = "{{Random Type=\"TimeSpan\"}}",
DateTime1 = "{{Random Type=\"DateTime\"}}",
DateTimeNow = DateTime.Now,
DateTimeNowToString = DateTime.Now.ToString("s", CultureInfo.InvariantCulture),
Guid1 = "{{Random Type=\"Guid\" Uppercase=false}}",
Guid2 = "{{Random Type=\"Guid\"}}",
Boolean = "{{Random Type=\"Boolean\"}}",
Integer = "{{Random Type=\"Integer\" Min=1000 Max=9999}}",
Long = "{{#Random Type=\"Long\" Min=10000000 Max=99999999}}{{this}}{{/Random}}",
Double = "{{Random Type=\"Double\" Min=10 Max=99}}",
Float = "{{Random Type=\"Float\" Min=100 Max=999}}",
IP4Address = "{{Random Type=\"IPv4Address\" Min=\"10.2.3.4\"}}",
IP6Address = "{{Random Type=\"IPv6Address\"}}",
MACAddress = "{{Random Type=\"MACAddress\" Separator=\"-\"}}",
StringListValue = "{{Random Type=\"StringList\" Values=[\"a\", \"b\", \"c\"]}}"
})
.WithTransformer()
);
System.Console.WriteLine("Press any key to stop the server");
System.Console.ReadKey();
server.Stop();
System.Console.WriteLine("Displaying all requests");
var allRequests = server.LogEntries;
System.Console.WriteLine(JsonConvert.SerializeObject(allRequests, Formatting.Indented));
System.Console.WriteLine("Press any key to quit");
System.Console.ReadKey();
}
}
} | 45.565611 | 303 | 0.484707 | [
"Apache-2.0"
] | paulssn/WireMock.Net | examples/WireMock.Net.Console.Net452.Classic/MainApp.cs | 20,142 | C# |
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Seemon.Vault.Contracts.Services;
using Seemon.Vault.Core.Contracts.Services;
using Seemon.Vault.Core.Contracts.Views;
using Seemon.Vault.Core.Models;
using Seemon.Vault.Core.Services;
using Seemon.Vault.Helpers.Extensions;
using Seemon.Vault.Services;
using Seemon.Vault.ViewModels;
using Seemon.Vault.Views;
using Serilog;
using Serilog.Formatting.Compact;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Threading;
namespace Seemon.Vault
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private IHost _host;
public static T GetService<T>() where T : class => ((App)Current)._host.Services.GetService(typeof(T)) as T;
public App()
{
var appInfo = new ApplicationInfoService();
Log.Logger = new LoggerConfiguration()
.Enrich.WithProperty("Version", appInfo.GetVersion())
.MinimumLevel.Information()
.WriteTo.Async(a => a.File(
Path.Combine(appInfo.GetLogPath(), "log-.txt"),
rollingInterval: RollingInterval.Day,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} ({Version}) [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}"))
.WriteTo.Async(a => a.File(
new CompactJsonFormatter(), Path.Combine(appInfo.GetLogPath(), "errors.json"),
restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Error,
rollingInterval: RollingInterval.Month))
.CreateLogger();
}
private async void OnStartup(object sender, StartupEventArgs e)
{
var activationArgs = new Dictionary<string, string>
{
};
var appLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
_host = Host.CreateDefaultBuilder(e.Args)
.ConfigureAppConfiguration(c =>
{
c.SetBasePath(appLocation);
c.AddInMemoryCollection(activationArgs);
})
.ConfigureLogging((context, logging) =>
{
logging.AddSerilog();
})
.ConfigureServices(ConfigureServices)
.Build();
await _host.StartAsync();
}
private void ConfigureServices(HostBuilderContext context, IServiceCollection services)
{
// Application Host
services.AddHostedService<ApplicationHostService>();
// Core Services
services.AddSingleton<IFileService, FileService>();
services.AddSingleton<IDataService, DataService>();
services.AddSingleton<ISystemService, SystemService>();
services.AddSingleton<ISettingsService, SettingsService>();
services.AddSingleton<IApplicationInfoService, ApplicationInfoService>();
services.AddSingleton<ICommandLineService, CommandLineService>();
services.AddSingleton<IPasswordCacheService, PasswordCacheService>();
services.AddSingleton<IEncryptionService, EncryptionService>();
services.AddSingleton<IKeyStoreService, KeyStoreService>();
services.AddSingleton<IPasswordService, PasswordService>();
// Services
services.AddSingleton<IThemeSelectorService, ThemeSelectorService>();
services.AddSingleton<IPageService, PageService>();
services.AddSingleton<INavigationService, NavigationService>();
services.AddSingleton<IWindowManagerService, WindowManagerService>();
services.AddSingleton<ITaskbarIconService, TaskbarIconService>();
services.AddSingleton<IHttpService, HttpService>();
services.AddSingleton<IUpdateService, UpdateService>();
services.AddSingleton<INotificationService, NotificationService>();
services.AddSingleton<IPGPService, PGPService>();
// Views and ViewModels
services.AddSingleton<IShellWindow, ShellWindow>();
services.AddSingleton<ShellViewModel>();
services.AddTransient<WelcomeViewModel>();
services.AddTransient<WelcomePage>();
services.AddTransient<AboutViewModel>();
services.AddTransient<AboutPage>();
services.AddTransient<SettingsViewModel>();
services.AddTransient<SettingsPage>();
services.AddTransient<LicenseViewModel>();
services.AddTransient<LicensePage>();
services.AddTransient<ProfileViewModel>();
services.AddTransient<ProfileWindow>();
services.AddTransient<ReleaseNotesViewModel>();
services.AddTransient<ReleaseNotesWindow>();
services.AddTransient<PasswordViewModel>();
services.AddTransient<PasswordWindow>();
services.AddTransient<NewPasswordViewModel>();
services.AddTransient<NewPasswordWindow>();
services.AddTransient<KeyStoreViewModel>();
services.AddTransient<KeyStorePage>();
services.AddTransient<GenerateKeyPairViewModel>();
services.AddTransient<GenerateKeyPairWindow>();
services.AddTransient<ChangePasswordViewModel>();
services.AddTransient<ChangePasswordWindow>();
services.AddTransient<KeyPairViewModel>();
services.AddTransient<KeyPairPage>();
services.AddTransient<TaskbarIconViewModel>();
// Configuration
services.ConfigureDictionary<ApplicationUrls>(context.Configuration.GetSection("urls"));
}
private async void OnExit(object sender, ExitEventArgs e)
{
await _host.StopAsync();
Log.CloseAndFlush();
_host.Dispose();
_host = null;
}
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
}
}
}
| 39.31875 | 151 | 0.640598 | [
"MIT"
] | mattseemon/Vault | src/UX/App.xaml.cs | 6,293 | C# |
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace AntChain.SDK.RISKPLUS.Models
{
// 决策流
public class DecisionFlow : TeaModel {
// 输出参数
[NameInMap("decision_flow")]
[Validation(Required=false)]
public OutParams DecisionFlow_ { get; set; }
// 决策结果
[NameInMap("decision")]
[Validation(Required=true)]
public string Decision { get; set; }
// infocodes
[NameInMap("info_codes")]
[Validation(Required=false)]
public InfoCodes InfoCodes { get; set; }
}
}
| 21.096774 | 54 | 0.61315 | [
"MIT"
] | alipay/antchain-openapi-prod-sdk | riskplus/csharp/core/Models/DecisionFlow.cs | 676 | 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;
namespace Microsoft.Diagnostics.Runtime.DbgEng
{
[Flags]
internal enum DEBUG_FORMAT : uint
{
DEFAULT = 0x00000000,
CAB_SECONDARY_ALL_IMAGES = 0x10000000,
WRITE_CAB = 0x20000000,
CAB_SECONDARY_FILES = 0x40000000,
NO_OVERWRITE = 0x80000000,
USER_SMALL_FULL_MEMORY = 0x00000001,
USER_SMALL_HANDLE_DATA = 0x00000002,
USER_SMALL_UNLOADED_MODULES = 0x00000004,
USER_SMALL_INDIRECT_MEMORY = 0x00000008,
USER_SMALL_DATA_SEGMENTS = 0x00000010,
USER_SMALL_FILTER_MEMORY = 0x00000020,
USER_SMALL_FILTER_PATHS = 0x00000040,
USER_SMALL_PROCESS_THREAD_DATA = 0x00000080,
USER_SMALL_PRIVATE_READ_WRITE_MEMORY = 0x00000100,
USER_SMALL_NO_OPTIONAL_DATA = 0x00000200,
USER_SMALL_FULL_MEMORY_INFO = 0x00000400,
USER_SMALL_THREAD_INFO = 0x00000800,
USER_SMALL_CODE_SEGMENTS = 0x00001000,
USER_SMALL_NO_AUXILIARY_STATE = 0x00002000,
USER_SMALL_FULL_AUXILIARY_STATE = 0x00004000,
USER_SMALL_IGNORE_INACCESSIBLE_MEM = 0x08000000
}
}
| 36.527778 | 71 | 0.723194 | [
"MIT"
] | Bhaskers-Blu-Org2/clrmd | src/Microsoft.Diagnostics.Runtime/src/DbgEng/DEBUG_FORMAT.cs | 1,317 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.