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.Data;
using OMeta;
using OMeta.Interfaces;
namespace OMeta.Advantage
{
public class ClassFactory : IClassFactory
{
internal class MyInternalDriver : InternalDriver
{
internal MyInternalDriver(Type factory, string connString, bool isOleDB)
: base(factory, connString, isOleDB)
{
}
public override string GetDataBaseName(System.Data.IDbConnection con)
{
string result = GetDataBaseName(con).Split('.')[0];
return result;
}
}
public static void Register()
{
InternalDriver.Register("ADVANTAGE",
new MyInternalDriver
(typeof(ClassFactory)
, @"Provider=Advantage.OLEDB.1;Password="";User ID=AdsSys;Data Source=C:\Program Files\Extended Systems\Advantage\Help\examples\aep_tutorial\task1;Initial Catalog=aep_tutorial.add;Persist Security Info=True;Advantage Server Type=ADS_LOCAL_SERVER;Trim Trailing Spaces=TRUE"
, true));
}
public ClassFactory()
{
}
public ITables CreateTables()
{
return new Advantage.AdvantageTables();
}
public ITable CreateTable()
{
return new Advantage.AdvantageTable();
}
public IColumn CreateColumn()
{
return new Advantage.AdvantageColumn();
}
public IColumns CreateColumns()
{
return new Advantage.AdvantageColumns();
}
public IDatabase CreateDatabase()
{
return new Advantage.AdvantageDatabase();
}
public IDatabases CreateDatabases()
{
return new Advantage.AdvantageDatabases();
}
public IProcedure CreateProcedure()
{
return new Advantage.AdvantageProcedure();
}
public IProcedures CreateProcedures()
{
return new Advantage.AdvantageProcedures();
}
public IView CreateView()
{
return new Advantage.AdvantageView();
}
public IViews CreateViews()
{
return new Advantage.AdvantageViews();
}
public IParameter CreateParameter()
{
return new Advantage.AdvantageParameter();
}
public IParameters CreateParameters()
{
return new Advantage.AdvantageParameters();
}
public IForeignKey CreateForeignKey()
{
return new Advantage.AdvantageForeignKey();
}
public IForeignKeys CreateForeignKeys()
{
return new Advantage.AdvantageForeignKeys();
}
public IIndex CreateIndex()
{
return new Advantage.AdvantageIndex();
}
public IIndexes CreateIndexes()
{
return new Advantage.AdvantageIndexes();
}
public IResultColumn CreateResultColumn()
{
return new Advantage.AdvantageResultColumn();
}
public IResultColumns CreateResultColumns()
{
return new Advantage.AdvantageResultColumns();
}
public IDomain CreateDomain()
{
return new Advantage.AdvantageDomain();
}
public IDomains CreateDomains()
{
return new Advantage.AdvantageDomains();
}
public IProviderType CreateProviderType()
{
return new ProviderType();
}
public IProviderTypes CreateProviderTypes()
{
return new ProviderTypes();
}
public IDbConnection CreateConnection()
{
return null;
}
public void ChangeDatabase(System.Data.IDbConnection connection, string database)
{
connection.ChangeDatabase(database);
}
}
}
| 21.169811 | 288 | 0.66637 | [
"MIT"
] | kiler398/OMeta | src/OpenMetaData/Advantage/ClassFactory.cs | 3,366 | C# |
namespace ConsoleEmpresa
{
class Motor
{
public int Id { get; set; }
public string Marca { get; set; }
public string TipoDeMotor { get; set; }
public string Arrancar()
{
return "Pudeo arrancar";
}
public string Apagar()
{
return "Pudeo apagarmer";
}
}
}
| 18.380952 | 48 | 0.463731 | [
"Apache-2.0"
] | RochaSteven/clases | Empresa/ConsoleEmpresa/Motor.cs | 388 | C# |
using Glass.Mapper.Sc.Configuration.Attributes;
using Glass.Mapper.Sc.Fields;
using Ignition.Core.Models.BaseModels;
namespace Ignition.Data.Fields
{
[SitecoreType(TemplateId = "{D5BF5E98-55F0-4DA4-AA17-14E56E2AF263}")]
public interface IBackgroundImageAlternate : IModelBase
{
[SitecoreField(FieldId = "{BEBCE4EB-0F82-402C-B694-A21F9F0B194D}")]
Image BackgroundImageAlternate { get; set; }
}
} | 32.923077 | 75 | 0.738318 | [
"MIT"
] | Ali-Nasir-01/SitecoreIgnition | Ignition.Data/Fields/IBackgroundImageAlternate.cs | 430 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/ocidl.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.Windows;
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE"]/*' />
public enum READYSTATE
{
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE.READYSTATE_UNINITIALIZED"]/*' />
READYSTATE_UNINITIALIZED = 0,
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE.READYSTATE_LOADING"]/*' />
READYSTATE_LOADING = 1,
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE.READYSTATE_LOADED"]/*' />
READYSTATE_LOADED = 2,
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE.READYSTATE_INTERACTIVE"]/*' />
READYSTATE_INTERACTIVE = 3,
/// <include file='READYSTATE.xml' path='doc/member[@name="READYSTATE.READYSTATE_COMPLETE"]/*' />
READYSTATE_COMPLETE = 4,
}
| 42.076923 | 145 | 0.712066 | [
"MIT"
] | reflectronic/terrafx.interop.windows | sources/Interop/Windows/Windows/um/ocidl/READYSTATE.cs | 1,096 | C# |
//===-----------------------------------------------------------------------==//
//
// Lockpwn - blazing fast symbolic analysis for concurrent Boogie programs
//
// Copyright (c) 2015 Pantazis Deligiannis (pdeligia@me.com)
//
// This file is distributed under the MIT License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
using System;
namespace Lockpwn
{
internal enum AccessType
{
READ = 0,
WRITE
}
}
| 22.227273 | 81 | 0.466258 | [
"MIT"
] | pdeligia/lockpwn | Source/Driver/Core/AccessType.cs | 491 | C# |
using Newtonsoft.Json;
namespace Educabot.Models.Slack.Dialogs
{
public class SelectOption
{
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
}
} | 22.416667 | 42 | 0.583643 | [
"MIT"
] | sigmundftw/educabot | Educabot/Models/Slack/Dialogs/SelectOption.cs | 271 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ChangeHUDText : MonoBehaviour {
Text txt;
string tmp = "";
// Use this for initialization
void Start () {
txt = GetComponent<Text>();
if(txt == null)
Debug.Log("Cannot get txt from ChangeHUDText class");
else
txt.text = tmp;
}
// Update is called once per frame
void Update () {
}
public void changeHUD(string str)
{
if(txt)
txt.text = str;
else
tmp = str;
}
}
| 17.322581 | 59 | 0.640596 | [
"MIT"
] | atomyth/ICEcuBEAR | Assets/HoloInteraction/ChangeHUDText.cs | 539 | C# |
// 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.
//
// Copyright (c) 2008 Novell, Inc. (http://www.novell.com)
//
// Authors:
// Neville Gao <nevillegao@gmail.com>
//
using System;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using System.Windows.Forms;
using Mono.UIAutomation.Winforms.Events;
namespace Mono.UIAutomation.Winforms.Events.Splitter
{
internal class DockPatternDockPositionEvent : BaseAutomationPropertyEvent
{
#region Constructor
public DockPatternDockPositionEvent (SimpleControlProvider provider)
: base (provider, DockPatternIdentifiers.DockPositionProperty)
{
}
#endregion
#region IConnectable Overrides
public override void Connect ()
{
Provider.Control.DockChanged +=
new EventHandler (OnDockPositionChanged);
}
public override void Disconnect ()
{
Provider.Control.DockChanged -=
new EventHandler (OnDockPositionChanged);
}
#endregion
#region Private Methods
private void OnDockPositionChanged (object sender, EventArgs e)
{
RaiseAutomationPropertyChangedEvent ();
}
#endregion
}
}
| 30.619718 | 74 | 0.74609 | [
"MIT"
] | ABEMBARKA/monoUI | UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/Splitter/DockPatternDockPositionEvent.cs | 2,174 | C# |
namespace SimpleSpider.Engine
{
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
using HtmlAgilityPack;
using Nager.PublicSuffix;
using Configuration;
using Infrastructure;
using Models;
public class Spider
{
private const int startTimeInterval = 150;
private const int endTimeInterval = 3000;
private const int maxFailTime = 5;
private readonly Random random = new Random();
private readonly DomainParser domainParser = new DomainParser(new WebTldRuleProvider());
private volatile int countOfUrlsToCrawled;
private string rootUrl;
private ConcurrentDictionary<string, string> crawledLinks { get; set; }
public readonly Settings settings;
public Spider(Settings settings)
{
this.settings = settings;
this.TaskManager = new TaskManager(this.settings.MaxConcurrency);
}
public Spider()
: this(new Settings(1, startTimeInterval, endTimeInterval, maxFailTime))
{
}
public Action<Link> OnNewLink { get; set; }
public Action OnCrawlCompleteSuccessfully { get; set; }
private Action<Exception> OnException { get; set; }
public ITaskManager TaskManager { get; set; }
public void StartCrawl(string url)
{
this.countOfUrlsToCrawled = 0;
this.rootUrl = url;
this.crawledLinks = new ConcurrentDictionary<string, string>();
this.crawledLinks.TryAdd(this.rootUrl, this.rootUrl);
this.TaskManager.RunTask(this.Crawl, new KeyValuePair<string, int>(this.rootUrl, 0));
}
public void StopCrawl()
{
this.rootUrl = null;
this.crawledLinks = null;
this.TaskManager.StopAll();
}
private void Crawl(object state)
{
var kv = (KeyValuePair<string, int>)state;
try
{
List<Link> urls = new List<Link>();
var url = kv.Key;
this.countOfUrlsToCrawled++;
var web = new HtmlWeb();
var doc = web.Load(url);
HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//a[@href]");
foreach (HtmlNode linkNode in nodes)
{
string hrefValue = linkNode.GetAttributeValue("href", string.Empty);
Uri uri;
if (hrefValue.StartsWith("/") && Uri.TryCreate(url + hrefValue, UriKind.Absolute, out uri) && this.crawledLinks.TryAdd(uri.AbsoluteUri, uri.AbsoluteUri))
{
try
{
this.OnNewLink?.Invoke(this.GetLink(uri.AbsoluteUri, url, linkNode.InnerText));
}
catch
{
}
Wait();
if (this.crawledLinks.TryAdd(uri.AbsoluteUri, uri.AbsoluteUri))
{
this.TaskManager.RunTask(Crawl, new KeyValuePair<string, int>(uri.AbsoluteUri, 0));
}
continue;
}
if (hrefValue.Contains(rootUrl.Replace("http://", "").Replace("https://", "")) && this.crawledLinks.TryAdd(hrefValue, hrefValue))
{
this.Wait();
if (this.crawledLinks.TryAdd(hrefValue, hrefValue))
{
this.TaskManager.RunTask(Crawl, new KeyValuePair<string, int>(hrefValue, 0));
}
}
try
{
this.OnNewLink?.Invoke(this.GetLink(hrefValue, url, linkNode.InnerText));
}
catch { }
}
this.countOfUrlsToCrawled--;
if (this.countOfUrlsToCrawled == 0)
{
this.OnCrawlCompleteSuccessfully?.Invoke();
}
}
catch (Exception exc)
{
this.OnException?.Invoke(exc);
this.Wait();
int failTime = kv.Value + 1;
if (failTime > settings.MaxFailTimesForUrl)
{
return;
}
this.TaskManager.RunTask(Crawl, new KeyValuePair<string, int>(kv.Key, failTime));
}
}
private void Wait()
{
Thread.Sleep(random.Next(settings.MinTimeIntervalDelay, settings.MaxTimeIntervalDelay));
}
private Link GetLink(string toLink, string fromLink, string title)
{
var escapedToLink = toLink.Replace("http://", "").Replace("https://", "");
var escapedFromLink = fromLink.Replace("http://", "").Replace("https://", "");
var toInfo = this.domainParser.Get(escapedToLink);
var fromInfo = this.domainParser.Get(escapedFromLink);
return new Link()
{
ToDomain = toInfo.RegistrableDomain,
TitleToDomain = title,
ExactLinkToDomain = toLink,
IsSubDomain = string.IsNullOrWhiteSpace(fromInfo.SubDomain),
SourceDomainName = fromInfo.RegistrableDomain,
SourceDomainOrigin = fromLink
};
}
}
}
| 32.598837 | 173 | 0.514 | [
"Apache-2.0"
] | iovigi/SimpleSpider | src/SimpleSpider.Engine/Spider.cs | 5,609 | C# |
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información general de un ensamblado se controla mediante el siguiente
// conjunto de atributos. Cambie estos valores de atributo para modificar la información
// asociada con un ensamblado.
[assembly: AssemblyTitle("NetflixRoulette")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NetflixRoulette")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("es")]
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.935484 | 113 | 0.756803 | [
"MIT"
] | jsuarezruiz/Embeddinator-4000-Sample | NET Library/NetflixRoulette/Properties/AssemblyInfo.cs | 1,193 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using FluentAssertions;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using static ServiceAnnotations.Tests.AssemblyMaker;
namespace ServiceAnnotations.Tests
{
public class MixedAttributeFacts
{
[Fact]
public void Service_ConfigureServices_InvokedInTheOrderTheyWereApplied()
{
Assembly assembly = MakeAssembly(@"
[Service(ServiceLifetime.Transient), ConfigureServices]
class AnnotatedClass {
static void ConfigureServices(IServiceCollection svc) {
svc.AddTransient<AnnotatedClass, NotAnnotatedClass>() ;
}
}
class NotAnnotatedClass : AnnotatedClass { }
");
Type annotated = assembly.GetType("AnnotatedClass");
Type notAnnotated = assembly.GetType("NotAnnotatedClass");
ServiceCollection sc = new ServiceCollection().AddAnnotatedServices(assembly);
sc.Should().HaveCount(2, "1 registered by ServiceAttribute, 1 registered by ConfigureServices");
sc.First().ImplementationType.Should().Be(annotated,
"ServiceAttribute was placed first");
sc.Last().ImplementationType.Should().Be(notAnnotated,
"ConfigureServicesAttribute was placed last");
}
[Fact]
public void ConfigureServices_Service_InvokedInTheOrderTheyWereApplied()
{
Assembly assembly = MakeAssembly(@"
[ConfigureServices, Service(ServiceLifetime.Transient)]
class AnnotatedClass {
static void ConfigureServices(IServiceCollection svc) {
svc.AddTransient<AnnotatedClass, NotAnnotatedClass>() ;
}
}
class NotAnnotatedClass : AnnotatedClass { }
");
Type annotated = assembly.GetType("AnnotatedClass");
Type notAnnotated = assembly.GetType("NotAnnotatedClass");
ServiceCollection sc = new ServiceCollection().AddAnnotatedServices(assembly);
sc.Should().HaveCount(2, "1 registered by ServiceAttribute, 1 registered by ConfigureServices");
sc.First().ImplementationType.Should().Be(notAnnotated,
"ConfigureServicesAttribute was placed first");
sc.Last().ImplementationType.Should().Be(annotated,
"ServiceAttribute was placed last");
}
[Fact]
public void Service_CanUseConfigureServices_ToConfigureDependencies()
{
Assembly assembly = MakeAssembly(@"
[Service(ServiceLifetime.Transient), ConfigureServices(""RegisterDependencies"")]
class ServiceClass {
readonly HttpClient _httpClient;
public string Endpoint => _httpClient.BaseAddress.ToString();
public ServiceClass(HttpClient httpClient) => _httpClient = httpClient;
static void RegisterDependencies(IServiceCollection serviceCollection) {
serviceCollection.AddHttpClient<ServiceClass>(httpClient => {
httpClient.BaseAddress = new Uri(""https://github.com/"");
});
}
}
");
Type serviceType = assembly.GetType("ServiceClass");
PropertyInfo endpointProperty = serviceType.GetProperty("Endpoint");
var serviceInstance = new ServiceCollection()
.AddAnnotatedServices(assembly)
.BuildServiceProvider()
.GetService(serviceType);
var endpoint = endpointProperty.GetValue(serviceInstance, null);
endpoint.Should().Be("https://github.com/");
}
}
}
| 38.857143 | 108 | 0.597304 | [
"MIT"
] | tretyakov-d/service-annotations | tests/ServiceAnnotations.Facts/MixedAttributeFacts.cs | 4,082 | C# |
using System;
using System.Globalization;
using Humanizer;
using Microsoft.Build.Framework;
namespace TwitterBuild
{
public class GetHomeTimeline : BaseTwitterTask
{
public override bool Execute()
{
var tweeter = new Tweeter(ConsumerKey, TokenKey, ConsumerSecret, TokenSecret);
try {
var result = tweeter.GetHomeTimelineAsync().GetAwaiter().GetResult();
var tweets = result.Unwrap();
foreach (var tweet in tweets) {
var date = DateTime.ParseExact(tweet.CreatedAt, "ddd MMM dd HH:mm:ss zzzz yyyy", CultureInfo.CurrentCulture);
var humanTime = date.Humanize();
Log.LogMessage(MessageImportance.High, $"@{tweet.User.ScreenName}, {humanTime}: {tweet.Text}.");
}
return true;
} catch (Exception e) {
Log.LogErrorFromException(e, true, true, null);
return false;
}
}
}
}
| 32.0625 | 129 | 0.569201 | [
"MIT"
] | bojanrajkovic/TwitterBuild | TwitterBuild/GetHomeTimeline.cs | 1,028 | C# |
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Panda2.Data.Models;
namespace Panda2.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class LoginModel : PageModel
{
private readonly SignInManager<PandaUser> _signInManager;
private readonly ILogger<LoginModel> _logger;
public LoginModel(SignInManager<PandaUser> signInManager, ILogger<LoginModel> logger)
{
_signInManager = signInManager;
_logger = logger;
}
[BindProperty]
public InputModel Input { get; set; }
public IList<AuthenticationScheme> ExternalLogins { get; set; }
public string ReturnUrl { get; set; }
[TempData]
public string ErrorMessage { get; set; }
public class InputModel
{
[Required]
[Display(Name = "Username")]
public string Username { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
}
public async Task OnGetAsync(string returnUrl = null)
{
if (!string.IsNullOrEmpty(ErrorMessage))
{
ModelState.AddModelError(string.Empty, ErrorMessage);
}
returnUrl = returnUrl ?? Url.Content("~/");
// Clear the existing external cookie to ensure a clean login process
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
ReturnUrl = returnUrl;
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (!ModelState.IsValid)
{
// If we got this far, something failed, redisplay form
return Page();
}
// This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await _signInManager.PasswordSignInAsync(Input.Username, Input.Password, false, lockoutOnFailure: true);
if (result.Succeeded)
{
_logger.LogInformation("User logged in.");
return LocalRedirect(returnUrl);
}
if (result.IsLockedOut)
{
_logger.LogWarning("User account locked out.");
return RedirectToPage("./Lockout");
}
else
{
ModelState.AddModelError(string.Empty, "Invalid login attempt. If You don't have an account, You should first register.");
return Page();
}
}
}
}
| 32.378947 | 139 | 0.598505 | [
"MIT"
] | genadi60/Panda2 | Web/Areas/Identity/Pages/Account/Login.cshtml.cs | 3,078 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Text;
using System.Reflection;
namespace System.Composition.Convention
{
/// <summary>
/// Configures an export associated with a part.
/// </summary>
public sealed class ExportConventionBuilder
{
private string _contractName;
private Type _contractType;
private List<Tuple<string, object>> _metadataItems;
private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
private Func<Type, string> _getContractNameFromPartType;
internal ExportConventionBuilder() { }
/// <summary>
/// Specify the contract type for the export.
/// </summary>
/// <typeparam name="T">The contract type.</typeparam>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AsContractType<T>()
{
return AsContractType(typeof(T));
}
/// <summary>
/// Specify the contract type for the export.
/// </summary>
/// <param name="type">The contract type.</param>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AsContractType(Type type)
{
_contractType = type ?? throw new ArgumentNullException(nameof(type));
return this;
}
/// <summary>
/// Specify the contract name for the export.
/// </summary>
/// <param name="contractName">The contract name.</param>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AsContractName(string contractName)
{
if (contractName == null)
{
throw new ArgumentNullException(nameof(contractName));
}
if (contractName.Length == 0)
{
throw new ArgumentException(
SR.Format(SR.ArgumentException_EmptyString, nameof(contractName)),
nameof(contractName)
);
}
_contractName = contractName;
return this;
}
/// <summary>
/// Specify the contract name for the export.
/// </summary>
/// <param name="getContractNameFromPartType">A Func to retrieve the contract name from the part typeThe contract name.</param>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AsContractName(
Func<Type, string> getContractNameFromPartType
)
{
_getContractNameFromPartType =
getContractNameFromPartType
?? throw new ArgumentNullException(nameof(getContractNameFromPartType));
return this;
}
/// <summary>
/// Add export metadata to the export.
/// </summary>
/// <param name="name">The name of the metadata item.</param>
/// <param name="value">The value of the metadata item.</param>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AddMetadata(string name, object value)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (name.Length == 0)
{
throw new ArgumentException(
SR.Format(SR.ArgumentException_EmptyString, nameof(name)),
nameof(name)
);
}
if (_metadataItems == null)
{
_metadataItems = new List<Tuple<string, object>>();
}
_metadataItems.Add(Tuple.Create(name, value));
return this;
}
/// <summary>
/// Add export metadata to the export.
/// </summary>
/// <param name="name">The name of the metadata item.</param>
/// <param name="getValueFromPartType">A function that calculates the metadata value based on the type.</param>
/// <returns>An export builder allowing further configuration.</returns>
public ExportConventionBuilder AddMetadata(
string name,
Func<Type, object> getValueFromPartType
)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}
if (name.Length == 0)
{
throw new ArgumentException(
SR.Format(SR.ArgumentException_EmptyString, nameof(name)),
nameof(name)
);
}
if (getValueFromPartType == null)
{
throw new ArgumentNullException(nameof(getValueFromPartType));
}
if (_metadataItemFuncs == null)
{
_metadataItemFuncs = new List<Tuple<string, Func<Type, object>>>();
}
_metadataItemFuncs.Add(Tuple.Create(name, getValueFromPartType));
return this;
}
internal void BuildAttributes(Type type, ref List<Attribute> attributes)
{
if (attributes == null)
{
attributes = new List<Attribute>();
}
var contractName =
(_getContractNameFromPartType != null)
? _getContractNameFromPartType(type)
: _contractName;
attributes.Add(new ExportAttribute(contractName, _contractType));
//Add metadata attributes from direct specification
if (_metadataItems != null)
{
foreach (Tuple<string, object> item in _metadataItems)
{
attributes.Add(new ExportMetadataAttribute(item.Item1, item.Item2));
}
}
//Add metadata attributes from func specification
if (_metadataItemFuncs != null)
{
foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
{
var name = item.Item1;
var value = (item.Item2 != null) ? item.Item2(type) : null;
attributes.Add(new ExportMetadataAttribute(name, value));
}
}
}
}
}
| 36.169399 | 135 | 0.559148 | [
"MIT"
] | belav/runtime | src/libraries/System.Composition.Convention/src/System/Composition/Convention/ExportConventionBuilder.cs | 6,619 | 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.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftRightLogicalRounded_Vector64_UInt32_1()
{
var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1
{
private struct DataTable
{
private byte[] inArray;
private byte[] outArray;
private GCHandle inHandle;
private GCHandle outHandle;
private ulong alignment;
public DataTable(UInt32[] inArray, UInt32[] outArray, int alignment)
{
int sizeOfinArray = inArray.Length * Unsafe.SizeOf<UInt32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<UInt32, byte>(ref inArray[0]), (uint)sizeOfinArray);
}
public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<UInt32> _fld;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
return testStruct;
}
public void RunStructFldScenario(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1 testClass)
{
var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1 testClass)
{
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly byte Imm = 1;
private static UInt32[] _data = new UInt32[Op1ElementCount];
private static Vector64<UInt32> _clsVar;
private Vector64<UInt32> _fld;
private DataTable _dataTable;
static ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1()
{
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
}
public ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
_dataTable = new DataTable(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.ShiftRightLogicalRounded(
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.ShiftRightLogicalRounded(
_clsVar,
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<UInt32>* pClsVar = &_clsVar)
{
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(pClsVar)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr);
var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr));
var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1();
var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector64_UInt32_1();
fixed (Vector64<UInt32>* pFld = &test._fld)
{
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRounded(
AdvSimd.LoadVector64((UInt32*)(&test._fld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (Helpers.ShiftRightLogicalRounded(firstOp[i], Imm) != result[i])
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftRightLogicalRounded)}<UInt32>(Vector64<UInt32>, 1): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| 38.43513 | 186 | 0.576703 | [
"MIT"
] | 06needhamt/runtime | src/coreclr/tests/src/JIT/HardwareIntrinsics/Arm/AdvSimd/ShiftRightLogicalRounded.Vector64.UInt32.1.cs | 19,256 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace RetailDataManager.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Title = "Home Page";
return View();
}
}
}
| 17.631579 | 44 | 0.629851 | [
"MIT"
] | DionKllokoqi/RetailManager | RetailDataManager/Controllers/HomeController.cs | 337 | C# |
namespace _5.Book_Library
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
public class Program
{
public static void Main()
{
int numberOfBooks = int.Parse(Console.ReadLine()); // Number of books to read
List<Library> library = new List<Library>(); // List to store book data
/// Loop and get data for each book
for (int i = 0; i < numberOfBooks; i++)
{
string[] currBook = Console.ReadLine().Split();
Library currentBook = new Library
{
Title = currBook[0],
Author = currBook[1],
Publisher = currBook[2],
ReleaseDate = DateTime.ParseExact(currBook[3], "dd.MM.yyyy", CultureInfo.InvariantCulture),
ISBN = currBook[4],
Price = decimal.Parse(currBook[5])
};
library.Add(currentBook);
}
/// Filter library to match criteria
var result = library.GroupBy(x => x.Author)
.Select(x => new
{
Author = x.First().Author,
Price = x.Sum(y => y.Price)
}).ToList();
/// Print result
foreach (var book in result.OrderByDescending(x => x.Price).ThenBy(x => x.Author))
{
Console.WriteLine($"{book.Author} -> {book.Price:F2}");
}
}
}
}
| 31.28 | 111 | 0.483376 | [
"MIT"
] | HristoSpasov/Programing-Fundamentals-Exercises | 14. 02.07.2017-ObjectsAndClasses.Exercise/Exercise/1.CountWorkingDays/5. Book Library/5. Book Library .cs | 1,566 | C# |
using System;
using Smobiler.Core;
namespace SelectDemo.Layouts
{
partial class ZRLayout : Smobiler.Core.Controls.MobileUserControl
{
#region "SmobilerUserControl generated code "
//SmobilerUserControl overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerUserControl
//It can be modified using the SmobilerUserControl.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.panel1 = new Smobiler.Core.Controls.Panel();
this.panel2 = new Smobiler.Core.Controls.Panel();
this.fontIcon1 = new Smobiler.Core.Controls.FontIcon();
this.KeyLab = new Smobiler.Core.Controls.TextBox();
this.button1 = new Smobiler.Core.Controls.Button();
this.hisPanel = new Smobiler.Core.Controls.Panel();
this.disPanel = new Smobiler.Core.Controls.Panel();
//
// panel1
//
this.panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel2,
this.button1});
this.panel1.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.panel1.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel1.Name = "panel1";
this.panel1.Padding = new Smobiler.Core.Controls.Padding(12F, 6F, 12F, 6F);
this.panel1.Size = new System.Drawing.Size(0, 40);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.WhiteSmoke;
this.panel2.BorderRadius = 12;
this.panel2.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.fontIcon1,
this.KeyLab});
this.panel2.Direction = Smobiler.Core.Controls.LayoutDirection.Row;
this.panel2.Flex = 1;
this.panel2.ItemAlign = Smobiler.Core.Controls.LayoutItemAlign.Center;
this.panel2.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(0, 30);
//
// fontIcon1
//
this.fontIcon1.ForeColor = System.Drawing.Color.Gainsboro;
this.fontIcon1.Location = new System.Drawing.Point(6, 0);
this.fontIcon1.Name = "fontIcon1";
this.fontIcon1.ResourceID = "search";
this.fontIcon1.Size = new System.Drawing.Size(15, 19);
//
// KeyLab
//
this.KeyLab.BackColor = System.Drawing.Color.WhiteSmoke;
this.KeyLab.Flex = 1;
this.KeyLab.FontSize = 15F;
this.KeyLab.ForeColor = System.Drawing.Color.Gray;
this.KeyLab.Location = new System.Drawing.Point(10, 0);
this.KeyLab.Name = "KeyLab";
this.KeyLab.Size = new System.Drawing.Size(100, 25);
this.KeyLab.SubmitEditing += new System.EventHandler(this.KeyLab_SubmitEditing);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.FontSize = 15F;
this.button1.ForeColor = System.Drawing.Color.Gray;
this.button1.Location = new System.Drawing.Point(6, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(35, 0);
this.button1.Text = "取消";
this.button1.Press += new System.EventHandler(this.CloseDialog_Press);
//
// hisPanel
//
this.hisPanel.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.hisPanel.Name = "hisPanel";
this.hisPanel.Size = new System.Drawing.Size(0, 0);
//
// disPanel
//
this.disPanel.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.disPanel.Name = "disPanel";
this.disPanel.Size = new System.Drawing.Size(0, 0);
//
// ZRLayout
//
this.BackColor = System.Drawing.Color.White;
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.panel1,
this.hisPanel,
this.disPanel});
this.Flex = 1;
this.Layout = Smobiler.Core.Controls.LayoutPosition.Relative;
this.Name = "ZRLayout";
}
#endregion
private Smobiler.Core.Controls.Panel panel1;
private Smobiler.Core.Controls.Panel panel2;
private Smobiler.Core.Controls.FontIcon fontIcon1;
private Smobiler.Core.Controls.Button button1;
public Smobiler.Core.Controls.Panel hisPanel;
public Smobiler.Core.Controls.Panel disPanel;
private Smobiler.Core.Controls.TextBox KeyLab;
}
} | 43.355932 | 92 | 0.591673 | [
"MIT"
] | comsmobiler/BlogsCode | Source/BlogsCode_SmobilerForm/Layouts/ZRLayout.designer.cs | 5,122 | C# |
/**
* Copyright (c) 2020-2021 LG Electronics, Inc.
*
* This software contains code licensed as described in LICENSE.
*
*/
namespace Simulator.ScenarioEditor.Elements
{
using System.Collections.Generic;
using Input;
using Managers;
using ScenarioEditor.Agents;
using Undo;
using Undo.Records;
using UnityEngine;
/// <summary>
/// Abstract scenario element source
/// </summary>
public abstract class ScenarioElementSource : MonoBehaviour, IDragHandler
{
/// <summary>
/// Name of the agent type this source handles
/// </summary>
public abstract string ElementTypeName { get; }
/// <summary>
/// List of available variants in this element source
/// </summary>
public abstract List<SourceVariant> Variants { get; }
/// <summary>
/// Currently dragged element instance
/// </summary>
protected ScenarioElement draggedInstance;
/// <summary>
/// Controllable variant that is currently selected
/// </summary>
protected SourceVariant selectedVariant;
/// <summary>
/// Method invokes when this source is selected in the UI
/// </summary>
/// <param name="variant">Scenario element variant that is selected</param>
public virtual void OnVariantSelected(SourceVariant variant)
{
selectedVariant = variant;
if (variant!=null)
ScenarioManager.Instance.GetExtension<InputManager>().StartDraggingElement(this);
}
/// <summary>
/// Method that instantiates and initializes a prefab of the selected variant
/// </summary>
/// <param name="variant">Scenario element variant which model should be instantiated</param>
/// <returns>Scenario element variant model</returns>
public virtual GameObject GetModelInstance(SourceVariant variant)
{
if (variant.Prefab == null)
return null;
var instance = ScenarioManager.Instance.prefabsPools.GetInstance(variant.Prefab);
return instance;
}
/// <summary>
/// Creates an element instance for the given source variant
/// </summary>
/// <param name="variant">Source variant for the new instance</param>
/// <returns>Element instance for the given source variant</returns>
public abstract ScenarioElement GetElementInstance(SourceVariant variant);
/// <summary>
/// Method invoked when dragged instance is moved
/// </summary>
protected virtual void OnDraggedInstanceMove()
{
}
/// <inheritdoc/>
void IDragHandler.DragStarted()
{
var inputManager = ScenarioManager.Instance.GetExtension<InputManager>();
draggedInstance = GetElementInstance(selectedVariant);
draggedInstance.transform.SetParent(ScenarioManager.Instance.transform);
draggedInstance.transform.SetPositionAndRotation(inputManager.MouseRaycastPosition,
Quaternion.Euler(0.0f, 0.0f, 0.0f));
ScenarioManager.Instance.SelectedElement = draggedInstance;
OnDraggedInstanceMove();
}
/// <inheritdoc/>
void IDragHandler.DragMoved()
{
var inputManager = ScenarioManager.Instance.GetExtension<InputManager>();
if (draggedInstance == null)
{
inputManager.CancelDraggingElement(this);
return;
}
draggedInstance.transform.position = inputManager.MouseRaycastPosition;
OnDraggedInstanceMove();
}
/// <inheritdoc/>
void IDragHandler.DragFinished()
{
ScenarioManager.Instance.GetExtension<ScenarioUndoManager>()
.RegisterRecord(new UndoAddElement(draggedInstance));
draggedInstance = null;
}
/// <inheritdoc/>
void IDragHandler.DragCancelled()
{
if (draggedInstance == null)
return;
draggedInstance.RemoveFromMap();
draggedInstance.Dispose();
draggedInstance = null;
}
}
} | 34.504 | 101 | 0.603988 | [
"Apache-2.0",
"BSD-3-Clause"
] | HaoruXue/simulator | Assets/Scripts/ScenarioEditor/Elements/ScenarioElementSource.cs | 4,315 | C# |
using Newtonsoft.Json;
using Stencil.Plugins.GitHub.Integration;
using Stencil.Plugins.GitHub.Models;
using Stencil.SDK;
using Stencil.SDK.Models.Responses;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace LoadGenerator
{
class Program
{
static Random s_random = new Random();
static HttpClient s_httpClient = new HttpClient();
static JsonSerializer s_serializer = new JsonSerializer();
static async Task Main(string[] args)
{
var sdk = new StencilSDK(args[0]);
int taskCount = Int32.Parse(args[1]);
using var cts = new CancellationTokenSource();
Console.CancelKeyPress += (sender, e) =>
{
e.Cancel = true;
cts.Cancel();
};
Console.WriteLine($"[INFO] Generating load with {taskCount} tasks");
var tasks = new List<Task>();
for (int ii = 0; ii < taskCount; ++ii)
{
int account = s_random.Next(100);
var authInfo = await sdk.Auth.LoginAsync(
new Stencil.SDK.Models.Requests.AuthLoginInput
{
user = $"account{account}@example.com",
password = $"account{account}",
});
tasks.Add(GenerateLoadAsync(args[0], authInfo.item, cts.Token));
}
tasks.Add(GenerateCommitsAsync(args[0], cts.Token));
try
{
await Task.WhenAll(tasks);
}
catch (Exception ex)
{
if (ex is AggregateException aggEx)
{
ex = aggEx.Flatten();
}
Console.WriteLine($"[ERROR] {ex}");
}
}
private static async Task GenerateCommitsAsync(string baseUrl, CancellationToken token)
{
try
{
await GenerateCommitsImplAsync(baseUrl, token);
}
catch (OperationCanceledException)
{
/* CAW: Ignored */
}
catch
{
Console.WriteLine("[ERROR] Could not generate commits due to an error.");
throw;
}
}
private static async Task GenerateCommitsImplAsync(string baseUrl, CancellationToken token)
{
while (!token.IsCancellationRequested)
{
var sdk = new StencilSDK(baseUrl);
int account = s_random.Next(100);
var authInfo = await sdk.Auth.LoginAsync(
new Stencil.SDK.Models.Requests.AuthLoginInput
{
user = $"account{account}@example.com",
password = $"account{account}",
});
sdk = new StencilSDK(authInfo.item.api_key, authInfo.item.api_secret, baseUrl);
var tickets = await sdk.Ticket.GetTicketByReportedByIDAsync(authInfo.item.account_id, take: 50);
if (tickets.items.Count > 0)
{
var ticket = RandomItem(tickets.items);
Console.WriteLine($"[VERBOSE] {authInfo.item.first_name} is pushing a commit for {ticket.ticket_id}...");
var @ref = Guid.NewGuid().ToString("N");
await HttpPostEventWebHookAsync(
$@"{baseUrl}/github/webhook",
new GitHubPushEvent
{
@ref = @ref,
base_ref = Guid.NewGuid().ToString("N"),
before = Guid.NewGuid().ToString("N"),
after= Guid.Empty.ToString("N"),
created = true,
pusher = new GitHubCommitAuthor
{
name = $"{authInfo.item.first_name} {authInfo.item.last_name}",
email = authInfo.item.email,
},
commits = new[]
{
new GitHubCommit
{
id = @ref,
timestamp = DateTimeOffset.UtcNow.ToString(),
author = new GitHubCommitAuthor
{
name = $"{authInfo.item.first_name} {authInfo.item.last_name}",
email = authInfo.item.email,
},
url = $@"https://github.com/STS/STS/blob/{@ref}",
distinct = true,
message = $"Work [{ticket.ticket_id}]",
added = new List<string>(),
modified = new List<string>(),
removed = new List<string>(),
},
},
repository = new GitHubRepository
{
name = "STS",
git_url = @"https://github.com/STS/STS.git",
},
},
token);
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(5, 30)), token);
}
else
{
Console.WriteLine($"[VERBOSE] {authInfo.item.first_name} has nothing to work on...");
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(5, 10)), token);
}
}
}
private static async Task HttpPostEventWebHookAsync(string url, GitHubPushEvent gitHubPushEvent, CancellationToken token)
{
string sekret = @"how much wood could a woodchuck chuck";
byte[] jsonUtf8Bytes;
byte[] signature;
using (var ms = new MemoryStream())
{
using (var writer = new JsonTextWriter(new StreamWriter(ms, Encoding.UTF8, 2048, leaveOpen: true)))
{
s_serializer.Serialize(writer, gitHubPushEvent);
writer.Flush();
}
ms.Position = 0;
jsonUtf8Bytes = ms.ToArray();
using var hmac = new HMACSHA256(Encoding.ASCII.GetBytes(sekret));
signature = hmac.ComputeHash(jsonUtf8Bytes);
}
using var content = new ByteArrayContent(jsonUtf8Bytes);
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
content.Headers.Add(GitHubAssumptions.HEADER_EVENT_NAME, GitHubPushEvent.EventName);
content.Headers.Add(GitHubAssumptions.HEADER_DELIVERY, Guid.NewGuid().ToString());
content.Headers.Add(GitHubAssumptions.HEADER_SIGNATURE, $"{GitHubAssumptions.SIGNATURE_PREFIX}{ToHex(signature)}");
var response = await s_httpClient.PostAsync(url, content, token);
if (!response.IsSuccessStatusCode)
{
Console.WriteLine($"[ERROR] GitHubPushEvent not accepted {response.StatusCode}");
}
string ToHex(byte[] bytes)
=> String.Join("", bytes.Select(bb => bb.ToString("x2")));
}
private static async Task GenerateLoadAsync(string baseUrl, AccountInfo accountInfo, CancellationToken token)
{
try
{
await GenerateLoadImplAsync(baseUrl, accountInfo, token);
}
catch (OperationCanceledException)
{
/* CAW: Ignored */
}
catch
{
Console.WriteLine("[ERROR] Could not generate actions due to an error.");
throw;
}
}
private static async Task GenerateLoadImplAsync(string baseUrl, AccountInfo accountInfo, CancellationToken token)
{
var sdk = new StencilSDK(accountInfo.api_key, accountInfo.api_secret, baseUrl);
var products = (await sdk.Product.Find(take: 20)).items;
var ownedProducts = products.Where(pp => pp.product_owner_id == accountInfo.account_id).ToArray();
while (!token.IsCancellationRequested)
{
double value = s_random.NextDouble();
// 60% of the time, create a ticket and add some comments for a while
if (value < 0.60)
{
Console.WriteLine($"[VERBOSE] {accountInfo.first_name} is filing a new ticket...");
var affectedProducts = Enumerable.Range(0, s_random.Next(2) + 1)
.Select(_ => RandomItem(products))
.Distinct()
.ToArray();
var ticket = await sdk.Ticket.CreateTicketAsync(
new Stencil.SDK.Models.Ticket
{
ticket_title = $"Problum with {String.Join(" and ", affectedProducts.Select(pp => pp.product_name))}",
ticket_description = $"I get this error code {Guid.NewGuid()}",
ticket_type = Stencil.SDK.Models.TicketType.Bug,
});
// Wait a bit after making the ticket before adding a comment
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(5, 60)), token);
// Add a few comments
int commentCount = s_random.Next(5) + 1;
for (int ii = 0; ii < commentCount; ++ii)
{
if (token.IsCancellationRequested)
{
return;
}
await sdk.TicketComment.CreateTicketCommentAsync(
new Stencil.SDK.Models.TicketComment
{
ticket_id = ticket.item.ticket_id,
ticket_comment = $"Hello? Is anyone working on my {ticket.item.ticket_title}",
});
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(20, 60)), token);
}
}
else if (value < 0.8)
{
const int take = 10;
if (ownedProducts.Length > 0)
{
Console.WriteLine($"[VERBOSE] {accountInfo.first_name} is assigning a product to a ticket...");
// 20% of the time, pick a product you own and add it to random tickets talking about it
var product = RandomItem(ownedProducts);
var tickets = await sdk.Ticket.Find(take: take, keyword: product.product_name);
if (tickets.items.Count == take && s_random.NextDouble() < 0.2)
{
// If we've got more tickets, randomly skip the first set and take a lot more
var moreTickets = await sdk.Ticket.Find(skip: tickets.items.Count, take: take * 3, keyword: product.product_name);
if (moreTickets.success && moreTickets.items.Count > 0)
{
tickets = moreTickets;
}
}
for (int ii = 0; ii < tickets.items.Count; ++ii)
{
if (token.IsCancellationRequested)
{
return;
}
var ticketId = RandomItem(tickets.items, tt => tt.ticket_id);
await sdk.AffectedProduct.CreateAffectedProductAsync(new Stencil.SDK.Models.AffectedProduct
{
ticket_id = ticketId,
product_id = product.product_id,
});
}
}
else
{
Console.WriteLine($"[VERBOSE] {accountInfo.first_name} is just hanging out...");
}
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(20, 100)), token);
}
else
{
Console.WriteLine($"[VERBOSE] {accountInfo.first_name} is closing a ticket...");
// Otherwise, find a ticket of yours and close it
var tickets = await GetOpenTicketsAsync(accountInfo.account_id);
if (tickets.success && tickets.items.Count > 0)
{
var ticket = RandomItem(tickets.items);
await sdk.TicketComment.CreateTicketCommentAsync(new Stencil.SDK.Models.TicketComment
{
ticket_id = ticket.ticket_id,
ticket_comment = "Oh, I figured this out sorry!",
});
ticket.ticket_status = Stencil.SDK.Models.TicketStatus.Closed;
await sdk.Ticket.UpdateTicketAsync(ticket.ticket_id, ticket);
}
await Task.Delay(TimeSpan.FromSeconds(s_random.Next(20, 100)), token);
async Task<ListResult<Stencil.SDK.Models.Ticket>> GetOpenTicketsAsync(Guid account_id)
{
int skip = 0, take = 10;
var tickets = await sdk.Ticket.GetTicketByReportedByIDAsync(account_id);
if (tickets.success)
{
// While we have tickets, but none of them are open...
while (tickets.items.Count > 0
&& !tickets.items.Any(tt => tt.ticket_status != Stencil.SDK.Models.TicketStatus.Closed))
{
skip += take;
tickets = await sdk.Ticket.GetTicketByReportedByIDAsync(account_id, skip: skip, take: take);
}
}
return tickets;
}
}
}
}
private static TResult RandomItem<TItem, TResult>(IList<TItem> items, Func<TItem, TResult> selector)
=> selector(RandomItem(items));
private static TItem RandomItem<TItem>(IList<TItem> items)
=> items[s_random.Next(items.Count)];
}
}
| 42.927374 | 142 | 0.464602 | [
"MIT"
] | watfordsuzy/stencil | Source/Stencil.Server/LoadGenerator/Program.cs | 15,370 | 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("WindowsDefenderDisable")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsDefenderDisable")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[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("42967fb0-d02d-42e3-b905-f193ec4bb64d")]
// 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")]
| 39.135135 | 85 | 0.732735 | [
"BSD-3-Clause"
] | GlebYoutuber/WindowsDefenderDisable | Src Code/Properties/AssemblyInfo.cs | 1,451 | C# |
namespace Ordering.Application.Exceptions
{
public class NotFoundException : ApplicationException
{
public NotFoundException(string name, object key) : base($"Entity \"{name})\" ({key}) was not found.")
{ }
}
}
| 26.666667 | 110 | 0.65 | [
"MIT"
] | hnmendes/microservices-project | src/Ordering.Service/Ordering.Application/Exceptions/NotFoundException.cs | 242 | C# |
using ATZ.Reflection.Linq;
using FluentAssertions;
using NUnit.Framework;
using System;
using System.Linq;
using System.Reflection;
namespace ATZ.Reflection.Tests.Linq
{
[TestFixture]
public class MethodInfoEnumerableExtensionsShould
{
[Test]
public void ThrowExceptionIfParameterTypesIsNullForFiltering()
{
var ex = Assert.Throws<ArgumentNullException>(() => Enumerable.Empty<MethodInfo>().WithParameterSignature(null));
Assert.IsNotNull(ex);
ex.ParamName.Should().Be("parameterTypes");
}
}
}
| 27.318182 | 126 | 0.663894 | [
"MIT"
] | atzimler/Reflection | ATZ.Reflection.Tests/Linq/MethodInfoEnumerableExtensionsShould.cs | 603 | C# |
/************************************************************************************
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
https://developer.oculus.com/licenses/oculussdk/
Unless required by applicable law or agreed to in writing, the Utilities SDK 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 UnityEngine;
namespace Oculus.Interaction
{
public interface IRigidbodyRef
{
Rigidbody Rigidbody { get; }
}
}
| 39.090909 | 93 | 0.624419 | [
"MIT"
] | BigMeatBaoZi/SDM5002 | Unity/UI/Assets/Oculus/Interaction/Runtime/Scripts/Interaction/Core/IRigidbodyRef.cs | 860 | C# |
// Copyright (C) 2015-2021 The Neo Project.
//
// The neo is free software distributed under the MIT software license,
// see the accompanying file LICENSE in the main directory of the
// project or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.
using Neo.Cryptography.ECC;
using Neo.IO;
using Neo.IO.Json;
using Neo.SmartContract;
using Neo.VM.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Array = Neo.VM.Types.Array;
using Boolean = Neo.VM.Types.Boolean;
using Buffer = Neo.VM.Types.Buffer;
namespace Neo.VM
{
/// <summary>
/// A helper class related to NeoVM.
/// </summary>
public static class Helper
{
/// <summary>
/// Emits the opcodes for creating an array.
/// </summary>
/// <typeparam name="T">The type of the elements of the array.</typeparam>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="list">The elements of the array.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder CreateArray<T>(this ScriptBuilder builder, IReadOnlyList<T> list = null)
{
if (list is null || list.Count == 0)
return builder.Emit(OpCode.NEWARRAY0);
for (int i = list.Count - 1; i >= 0; i--)
builder.EmitPush(list[i]);
builder.EmitPush(list.Count);
return builder.Emit(OpCode.PACK);
}
/// <summary>
/// Emits the opcodes for creating a map.
/// </summary>
/// <typeparam name="TKey">The type of the key of the map.</typeparam>
/// <typeparam name="TValue">The type of the value of the map.</typeparam>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="map">The key/value pairs of the map.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder CreateMap<TKey, TValue>(this ScriptBuilder builder, IEnumerable<KeyValuePair<TKey, TValue>> map = null)
{
builder.Emit(OpCode.NEWMAP);
if (map != null)
foreach (var p in map)
{
builder.Emit(OpCode.DUP);
builder.EmitPush(p.Key);
builder.EmitPush(p.Value);
builder.Emit(OpCode.SETITEM);
}
return builder;
}
/// <summary>
/// Emits the specified opcodes.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="ops">The opcodes to emit.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder Emit(this ScriptBuilder builder, params OpCode[] ops)
{
foreach (OpCode op in ops)
builder.Emit(op);
return builder;
}
/// <summary>
/// Emits the opcodes for calling a contract dynamically.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="scriptHash">The hash of the contract to be called.</param>
/// <param name="method">The method to be called in the contract.</param>
/// <param name="args">The arguments for calling the contract.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitDynamicCall(this ScriptBuilder builder, UInt160 scriptHash, string method, params object[] args)
{
return EmitDynamicCall(builder, scriptHash, method, CallFlags.All, args);
}
/// <summary>
/// Emits the opcodes for calling a contract dynamically.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="scriptHash">The hash of the contract to be called.</param>
/// <param name="method">The method to be called in the contract.</param>
/// <param name="flags">The <see cref="CallFlags"/> for calling the contract.</param>
/// <param name="args">The arguments for calling the contract.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitDynamicCall(this ScriptBuilder builder, UInt160 scriptHash, string method, CallFlags flags, params object[] args)
{
builder.CreateArray(args);
builder.EmitPush(flags);
builder.EmitPush(method);
builder.EmitPush(scriptHash);
builder.EmitSysCall(ApplicationEngine.System_Contract_Call);
return builder;
}
/// <summary>
/// Emits the opcodes for pushing the specified data onto the stack.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="data">The data to be pushed.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitPush(this ScriptBuilder builder, ISerializable data)
{
return builder.EmitPush(data.ToArray());
}
/// <summary>
/// Emits the opcodes for pushing the specified data onto the stack.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="parameter">The data to be pushed.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitPush(this ScriptBuilder builder, ContractParameter parameter)
{
if (parameter.Value is null)
builder.Emit(OpCode.PUSHNULL);
else
switch (parameter.Type)
{
case ContractParameterType.Signature:
case ContractParameterType.ByteArray:
builder.EmitPush((byte[])parameter.Value);
break;
case ContractParameterType.Boolean:
builder.EmitPush((bool)parameter.Value);
break;
case ContractParameterType.Integer:
if (parameter.Value is BigInteger bi)
builder.EmitPush(bi);
else
builder.EmitPush((BigInteger)typeof(BigInteger).GetConstructor(new[] { parameter.Value.GetType() }).Invoke(new[] { parameter.Value }));
break;
case ContractParameterType.Hash160:
builder.EmitPush((UInt160)parameter.Value);
break;
case ContractParameterType.Hash256:
builder.EmitPush((UInt256)parameter.Value);
break;
case ContractParameterType.PublicKey:
builder.EmitPush((ECPoint)parameter.Value);
break;
case ContractParameterType.String:
builder.EmitPush((string)parameter.Value);
break;
case ContractParameterType.Array:
{
IList<ContractParameter> parameters = (IList<ContractParameter>)parameter.Value;
for (int i = parameters.Count - 1; i >= 0; i--)
builder.EmitPush(parameters[i]);
builder.EmitPush(parameters.Count);
builder.Emit(OpCode.PACK);
}
break;
case ContractParameterType.Map:
{
var pairs = (IList<KeyValuePair<ContractParameter, ContractParameter>>)parameter.Value;
builder.CreateMap(pairs);
}
break;
default:
throw new ArgumentException(null, nameof(parameter));
}
return builder;
}
/// <summary>
/// Emits the opcodes for pushing the specified data onto the stack.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="obj">The data to be pushed.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitPush(this ScriptBuilder builder, object obj)
{
switch (obj)
{
case bool data:
builder.EmitPush(data);
break;
case byte[] data:
builder.EmitPush(data);
break;
case string data:
builder.EmitPush(data);
break;
case BigInteger data:
builder.EmitPush(data);
break;
case ISerializable data:
builder.EmitPush(data);
break;
case sbyte data:
builder.EmitPush(data);
break;
case byte data:
builder.EmitPush(data);
break;
case short data:
builder.EmitPush(data);
break;
case ushort data:
builder.EmitPush(data);
break;
case int data:
builder.EmitPush(data);
break;
case uint data:
builder.EmitPush(data);
break;
case long data:
builder.EmitPush(data);
break;
case ulong data:
builder.EmitPush(data);
break;
case Enum data:
builder.EmitPush(BigInteger.Parse(data.ToString("d")));
break;
case ContractParameter data:
builder.EmitPush(data);
break;
case null:
builder.Emit(OpCode.PUSHNULL);
break;
default:
throw new ArgumentException(null, nameof(obj));
}
return builder;
}
/// <summary>
/// Emits the opcodes for invoking an interoperable service.
/// </summary>
/// <param name="builder">The <see cref="ScriptBuilder"/> to be used.</param>
/// <param name="method">The hash of the interoperable service.</param>
/// <param name="args">The arguments for calling the interoperable service.</param>
/// <returns>The same instance as <paramref name="builder"/>.</returns>
public static ScriptBuilder EmitSysCall(this ScriptBuilder builder, uint method, params object[] args)
{
for (int i = args.Length - 1; i >= 0; i--)
EmitPush(builder, args[i]);
return builder.EmitSysCall(method);
}
/// <summary>
/// Generates the script for calling a contract dynamically.
/// </summary>
/// <param name="scriptHash">The hash of the contract to be called.</param>
/// <param name="method">The method to be called in the contract.</param>
/// <param name="args">The arguments for calling the contract.</param>
/// <returns>The generated script.</returns>
public static byte[] MakeScript(this UInt160 scriptHash, string method, params object[] args)
{
using ScriptBuilder sb = new();
sb.EmitDynamicCall(scriptHash, method, args);
return sb.ToArray();
}
/// <summary>
/// Converts the <see cref="StackItem"/> to a JSON object.
/// </summary>
/// <param name="item">The <see cref="StackItem"/> to convert.</param>
/// <returns>The <see cref="StackItem"/> represented by a JSON object.</returns>
public static JObject ToJson(this StackItem item)
{
return ToJson(item, null);
}
private static JObject ToJson(StackItem item, HashSet<StackItem> context)
{
JObject json = new();
json["type"] = item.Type;
switch (item)
{
case Array array:
context ??= new HashSet<StackItem>(ReferenceEqualityComparer.Instance);
if (!context.Add(array)) throw new InvalidOperationException();
json["value"] = new JArray(array.Select(p => ToJson(p, context)));
break;
case Boolean boolean:
json["value"] = boolean.GetBoolean();
break;
case Buffer _:
case ByteString _:
json["value"] = Convert.ToBase64String(item.GetSpan());
break;
case Integer integer:
json["value"] = integer.GetInteger().ToString();
break;
case Map map:
context ??= new HashSet<StackItem>(ReferenceEqualityComparer.Instance);
if (!context.Add(map)) throw new InvalidOperationException();
json["value"] = new JArray(map.Select(p =>
{
JObject item = new();
item["key"] = ToJson(p.Key, context);
item["value"] = ToJson(p.Value, context);
return item;
}));
break;
case Pointer pointer:
json["value"] = pointer.Position;
break;
}
return json;
}
/// <summary>
/// Converts the <see cref="StackItem"/> to a <see cref="ContractParameter"/>.
/// </summary>
/// <param name="item">The <see cref="StackItem"/> to convert.</param>
/// <returns>The converted <see cref="ContractParameter"/>.</returns>
public static ContractParameter ToParameter(this StackItem item)
{
return ToParameter(item, null);
}
private static ContractParameter ToParameter(StackItem item, List<(StackItem, ContractParameter)> context)
{
if (item is null) throw new ArgumentNullException(nameof(item));
ContractParameter parameter = null;
switch (item)
{
case Array array:
if (context is null)
context = new List<(StackItem, ContractParameter)>();
else
(_, parameter) = context.FirstOrDefault(p => ReferenceEquals(p.Item1, item));
if (parameter is null)
{
parameter = new ContractParameter { Type = ContractParameterType.Array };
context.Add((item, parameter));
parameter.Value = array.Select(p => ToParameter(p, context)).ToList();
}
break;
case Map map:
if (context is null)
context = new List<(StackItem, ContractParameter)>();
else
(_, parameter) = context.FirstOrDefault(p => ReferenceEquals(p.Item1, item));
if (parameter is null)
{
parameter = new ContractParameter { Type = ContractParameterType.Map };
context.Add((item, parameter));
parameter.Value = map.Select(p => new KeyValuePair<ContractParameter, ContractParameter>(ToParameter(p.Key, context), ToParameter(p.Value, context))).ToList();
}
break;
case Boolean _:
parameter = new ContractParameter
{
Type = ContractParameterType.Boolean,
Value = item.GetBoolean()
};
break;
case ByteString array:
parameter = new ContractParameter
{
Type = ContractParameterType.ByteArray,
Value = array.GetSpan().ToArray()
};
break;
case Integer i:
parameter = new ContractParameter
{
Type = ContractParameterType.Integer,
Value = i.GetInteger()
};
break;
case InteropInterface _:
parameter = new ContractParameter
{
Type = ContractParameterType.InteropInterface
};
break;
case Null _:
parameter = new ContractParameter
{
Type = ContractParameterType.Any
};
break;
default:
throw new ArgumentException($"StackItemType({item.Type}) is not supported to ContractParameter.");
}
return parameter;
}
/// <summary>
/// Converts the <see cref="ContractParameter"/> to a <see cref="StackItem"/>.
/// </summary>
/// <param name="parameter">The <see cref="ContractParameter"/> to convert.</param>
/// <returns>The converted <see cref="StackItem"/>.</returns>
public static StackItem ToStackItem(this ContractParameter parameter)
{
return ToStackItem(parameter, null);
}
private static StackItem ToStackItem(ContractParameter parameter, List<(StackItem, ContractParameter)> context)
{
if (parameter is null) throw new ArgumentNullException(nameof(parameter));
if (parameter.Value is null) return StackItem.Null;
StackItem stackItem = null;
switch (parameter.Type)
{
case ContractParameterType.Array:
if (context is null)
context = new List<(StackItem, ContractParameter)>();
else
(stackItem, _) = context.FirstOrDefault(p => ReferenceEquals(p.Item2, parameter));
if (stackItem is null)
{
stackItem = new Array(((IList<ContractParameter>)parameter.Value).Select(p => ToStackItem(p, context)));
context.Add((stackItem, parameter));
}
break;
case ContractParameterType.Map:
if (context is null)
context = new List<(StackItem, ContractParameter)>();
else
(stackItem, _) = context.FirstOrDefault(p => ReferenceEquals(p.Item2, parameter));
if (stackItem is null)
{
Map map = new();
foreach (var pair in (IList<KeyValuePair<ContractParameter, ContractParameter>>)parameter.Value)
map[(PrimitiveType)ToStackItem(pair.Key, context)] = ToStackItem(pair.Value, context);
stackItem = map;
context.Add((stackItem, parameter));
}
break;
case ContractParameterType.Boolean:
stackItem = (bool)parameter.Value;
break;
case ContractParameterType.ByteArray:
case ContractParameterType.Signature:
stackItem = (byte[])parameter.Value;
break;
case ContractParameterType.Integer:
stackItem = (BigInteger)parameter.Value;
break;
case ContractParameterType.Hash160:
stackItem = ((UInt160)parameter.Value).ToArray();
break;
case ContractParameterType.Hash256:
stackItem = ((UInt256)parameter.Value).ToArray();
break;
case ContractParameterType.PublicKey:
stackItem = ((ECPoint)parameter.Value).EncodePoint(true);
break;
case ContractParameterType.String:
stackItem = (string)parameter.Value;
break;
default:
throw new ArgumentException($"ContractParameterType({parameter.Type}) is not supported to StackItem.");
}
return stackItem;
}
}
}
| 44.87605 | 183 | 0.51271 | [
"MIT"
] | Ashuaidehao/neo | src/neo/VM/Helper.cs | 21,361 | C# |
#region License Apache 2.0
/* Copyright 2019-2020 Octonica
*
* 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.
*/
#endregion
using System;
namespace Octonica.ClickHouseClient.Types
{
internal sealed class UInt32TableColumn : StructureTableColumn<uint>
{
public UInt32TableColumn(ReadOnlyMemory<uint> buffer)
: base(buffer)
{
}
public override IClickHouseTableColumn<T>? TryReinterpret<T>()
{
if (typeof(T) == typeof(long))
return (IClickHouseTableColumn<T>) (object) new ReinterpretedTableColumn<uint, long>(this, v => v);
if (typeof(T) == typeof(ulong))
return (IClickHouseTableColumn<T>) (object) new ReinterpretedTableColumn<uint, ulong>(this, v => v);
if (typeof(T) == typeof(long?))
return (IClickHouseTableColumn<T>) (object) new NullableStructTableColumn<long>(null, new ReinterpretedTableColumn<uint, long>(this, v => v));
if (typeof(T) == typeof(ulong?))
return (IClickHouseTableColumn<T>) (object) new NullableStructTableColumn<ulong>(null, new ReinterpretedTableColumn<uint, ulong>(this, v => v));
return base.TryReinterpret<T>();
}
}
}
| 38.955556 | 160 | 0.667998 | [
"Apache-2.0"
] | NeoRu4/ClickHouseClient | src/Octonica.ClickHouseClient/Types/UInt32TableColumn.cs | 1,755 | C# |
using System;
using MikhailKhalizev.Processor.x86.BinToCSharp;
namespace MikhailKhalizev.Max.Program
{
public partial class RawProgram
{
[MethodInfo("0x100c_d710-329519cd")]
public void Method_100c_d710()
{
ii(0x100c_d710, 5); push(0x24); /* push 0x24 */
ii(0x100c_d715, 5); call(Definitions.sys_check_available_stack_size, 0x9_8638);/* call 0x10165d52 */
ii(0x100c_d71a, 1); push(ebx); /* push ebx */
ii(0x100c_d71b, 1); push(ecx); /* push ecx */
ii(0x100c_d71c, 1); push(esi); /* push esi */
ii(0x100c_d71d, 1); push(edi); /* push edi */
ii(0x100c_d71e, 1); push(ebp); /* push ebp */
ii(0x100c_d71f, 2); mov(ebp, esp); /* mov ebp, esp */
ii(0x100c_d721, 6); sub(esp, 0xc); /* sub esp, 0xc */
ii(0x100c_d727, 3); mov(memd[ss, ebp - 8], eax); /* mov [ebp-0x8], eax */
ii(0x100c_d72a, 3); mov(memd[ss, ebp - 4], edx); /* mov [ebp-0x4], edx */
ii(0x100c_d72d, 7); test(memd[ss, ebp - 4], 4); /* test dword [ebp-0x4], 0x4 */
ii(0x100c_d734, 2); if(jz(0x100c_d74a, 0x14)) goto l_0x100c_d74a;/* jz 0x100cd74a */
ii(0x100c_d736, 5); mov(edx, 0x101b_59b4); /* mov edx, 0x101b59b4 */
ii(0x100c_d73b, 3); mov(eax, memd[ss, ebp - 8]); /* mov eax, [ebp-0x8] */
ii(0x100c_d73e, 5); call(Definitions.sys_call_dtor_arr, 0x9_8875);/* call 0x10165fb8 */
ii(0x100c_d743, 5); call(Definitions.sys_delete_arr, 0x9_8890);/* call 0x10165fd8 */
ii(0x100c_d748, 2); jmp(0x100c_d76b, 0x21); goto l_0x100c_d76b;/* jmp 0x100cd76b */
l_0x100c_d74a:
ii(0x100c_d74a, 5); mov(edx, 1); /* mov edx, 0x1 */
ii(0x100c_d74f, 3); mov(eax, memd[ss, ebp - 8]); /* mov eax, [ebp-0x8] */
ii(0x100c_d752, 5); call(0x100c_d67c, -0xdb); /* call 0x100cd67c */
ii(0x100c_d757, 3); mov(memd[ss, ebp - 8], eax); /* mov [ebp-0x8], eax */
ii(0x100c_d75a, 7); test(memd[ss, ebp - 4], 2); /* test dword [ebp-0x4], 0x2 */
ii(0x100c_d761, 2); if(jz(0x100c_d76b, 8)) goto l_0x100c_d76b;/* jz 0x100cd76b */
ii(0x100c_d763, 3); mov(eax, memd[ss, ebp - 8]); /* mov eax, [ebp-0x8] */
ii(0x100c_d766, 5); call(Definitions.sys_delete, 0x9_87f9);/* call 0x10165f64 */
l_0x100c_d76b:
ii(0x100c_d76b, 3); mov(eax, memd[ss, ebp - 8]); /* mov eax, [ebp-0x8] */
ii(0x100c_d76e, 3); mov(memd[ss, ebp - 12], eax); /* mov [ebp-0xc], eax */
ii(0x100c_d771, 3); mov(eax, memd[ss, ebp - 12]); /* mov eax, [ebp-0xc] */
ii(0x100c_d774, 2); mov(esp, ebp); /* mov esp, ebp */
ii(0x100c_d776, 1); pop(ebp); /* pop ebp */
ii(0x100c_d777, 1); pop(edi); /* pop edi */
ii(0x100c_d778, 1); pop(esi); /* pop esi */
ii(0x100c_d779, 1); pop(ecx); /* pop ecx */
ii(0x100c_d77a, 1); pop(ebx); /* pop ebx */
ii(0x100c_d77b, 1); ret(); /* ret */
}
}
}
| 71.057692 | 114 | 0.451691 | [
"Apache-2.0"
] | mikhail-khalizev/max | source/MikhailKhalizev.Max/source/Program/Auto/z-100c-d710.cs | 3,695 | C# |
using NUnit.Framework;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
namespace UniCommonTestRunner
{
public partial class UniCommonTestRunner
{
/// <summary>
/// モバイル用のシェーダがマテリアルに設定されているかどうかテストします
/// </summary>
[Test]
public void CheckMaterialShader()
{
var targets = new []
{
"Legacy Shaders/Bumped Diffuse",
"Legacy Shaders/Bumped Specular",
"Legacy Shaders/Diffuse",
"Legacy Shaders/Particles/Additive",
"Legacy Shaders/Particles/Additive (Soft)",
"Legacy Shaders/Particles/Alpha Blended",
"Legacy Shaders/Particles/Multiply",
"Legacy Shaders/Particles/VertexLit Blended",
"Particles/Standard Surface",
"Particles/Standard Unlit",
};
var list = AssetDatabase
.FindAssets( "t:Material" )
.Select( AssetDatabase.GUIDToAssetPath )
.Select( c => AssetDatabase.LoadAssetAtPath<Material>( c ) )
.Where( c => c != null )
.Where( c => targets.Any( target => target == c.shader.name ) )
.Select( c => AssetDatabase.GetAssetPath( c ) )
;
if ( !list.Any() ) return;
var sb = new StringBuilder();
foreach ( var n in list )
{
sb.AppendLine( n );
}
Assert.Fail( sb.ToString() );
}
}
} | 23.634615 | 67 | 0.659886 | [
"MIT"
] | baba-s/uni-common-test-runner | app/Assets/UniCommonTestRunner/Editor/Tests/CheckMaterialShader.cs | 1,299 | C# |
using System;
using System.Collections.Generic;
using ESFA.DC.ILR.Model.Interface;
using ESFA.DC.ILR.ValidationService.Data.Internal.AcademicYear.Interface;
using ESFA.DC.ILR.ValidationService.Interface;
using ESFA.DC.ILR.ValidationService.Rules.Abstract;
using ESFA.DC.ILR.ValidationService.Rules.Constants;
using ESFA.DC.ILR.ValidationService.Rules.Query.Interface;
namespace ESFA.DC.ILR.ValidationService.Rules.Learner.DateOfBirth
{
public class DateOfBirth_50Rule : AbstractRule, IRule<ILearner>
{
private readonly IAcademicYearQueryService _academicYearQueryService;
private readonly DateTime _julyThirtyFirst2016 = new DateTime(2016, 7, 31);
public DateOfBirth_50Rule(
IAcademicYearQueryService academicYearQueryService,
IValidationErrorHandler validationErrorHandler)
: base(validationErrorHandler, RuleNameConstants.DateOfBirth_50)
{
_academicYearQueryService = academicYearQueryService;
}
public void Validate(ILearner objectToValidate)
{
if (objectToValidate?.LearningDeliveries == null)
{
return;
}
if (objectToValidate.DateOfBirthNullable.HasValue)
{
var learnersSixteenthBirthdate = objectToValidate.DateOfBirthNullable.Value.AddYears(16);
var firstAugustForAcademicYearOfLearnersSixteenthBirthDate = _academicYearQueryService.GetAcademicYearOfLearningDate(learnersSixteenthBirthdate, AcademicYearDates.TraineeshipsAugust1);
foreach (var learningDelivery in objectToValidate.LearningDeliveries)
{
if (ConditionMet(
learningDelivery,
firstAugustForAcademicYearOfLearnersSixteenthBirthDate))
{
HandleValidationError(
objectToValidate.LearnRefNumber,
learningDelivery.AimSeqNumber,
BuildErrorMessageParameters(objectToValidate.DateOfBirthNullable, learningDelivery.LearnStartDate));
}
}
}
}
public bool ConditionMet(ILearningDelivery learningDelivery, DateTime firstAugustForAcademicYearOfLearnersSixteenthBirthDate)
{
return (learningDelivery.ProgTypeNullable.HasValue && learningDelivery.ProgTypeNullable == ProgTypes.Traineeship)
&& learningDelivery.AimType == AimTypes.ProgrammeAim
&& learningDelivery.LearnStartDate > _julyThirtyFirst2016
&& learningDelivery.LearnStartDate < firstAugustForAcademicYearOfLearnersSixteenthBirthDate;
}
public IEnumerable<IErrorMessageParameter> BuildErrorMessageParameters(DateTime? dateOfBirth, DateTime learnStartDate)
{
return new[]
{
BuildErrorMessageParameter(PropertyNameConstants.DateOfBirth, dateOfBirth),
BuildErrorMessageParameter(PropertyNameConstants.LearnStartDate, learnStartDate)
};
}
}
}
| 45.028571 | 200 | 0.67481 | [
"MIT"
] | SkillsFundingAgency/DC-ILR-2021-ValidationService | src/ESFA.DC.ILR.ValidationService.Rules/Learner/DateOfBirth/DateOfBirth_50Rule.cs | 3,154 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace Microsoft.EntityFrameworkCore.Metadata.Internal
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public class FunctionColumn : ColumnBase, IFunctionColumn
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public FunctionColumn([NotNull] string name, [NotNull] string type, [NotNull] StoreFunction function)
: base(name, type, function)
{
}
/// <inheritdoc />
public virtual IStoreFunction Function
=> (IStoreFunction)Table;
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override string ToString()
=> this.ToDebugString(MetadataDebugStringOptions.SingleLineDefault);
/// <inheritdoc />
IEnumerable<IFunctionColumnMapping> IFunctionColumn.PropertyMappings
{
[DebuggerStepThrough]
get => PropertyMappings.Cast<IFunctionColumnMapping>();
}
}
}
| 49.365385 | 113 | 0.686794 | [
"Apache-2.0"
] | 0b01/efcore | src/EFCore.Relational/Metadata/Internal/FunctionColumn.cs | 2,567 | C# |
/*
[The "BSD license"]
Copyright (c) 2009 Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Antlr4.Test.StringTemplate
{
using Antlr4.StringTemplate;
using Antlr4.Test.StringTemplate.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Antlr4.StringTemplate.Misc;
using Antlr4.StringTemplate.Compiler;
using Path = System.IO.Path;
[TestClass]
public class TestSyntaxErrors : BaseTest
{
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestEmptyExpr()
{
string template = " <> ";
TemplateGroup group = new TemplateGroup();
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
try
{
group.DefineTemplate("test", template);
}
catch (TemplateException)
{
}
string result = errors.ToString();
string expected = "test 1:0: this doesn't look like a template: \" <> \"" + newline;
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestIt()
{
string templates =
"main() ::= <<" + newline +
"<@r>a<@end>" + newline +
"<@r()>" + newline +
">>";
writeFile(tmpdir, "t.stg", templates);
TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
group.Load();
Assert.AreEqual(0, errors.Errors.Count);
Template template = group.GetInstanceOf("main");
string expected =
"a" + newline +
"a";
string result = template.Render();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestEmptyExpr2()
{
string template = "hi <> ";
TemplateGroup group = new TemplateGroup();
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
try
{
group.DefineTemplate("test", template);
}
catch (TemplateException)
{
}
string result = errors.ToString();
string expected = "test 1:3: doesn't look like an expression" + newline;
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestUnterminatedExpr()
{
string template = "hi <t()$";
TemplateGroup group = new TemplateGroup();
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
try
{
group.DefineTemplate("test", template);
}
catch (TemplateException)
{
}
string result = errors.ToString();
string expected = "test 1:7: invalid character '$'" + newline +
"test 1:7: invalid character '<EOF>'" + newline +
"test 1:7: premature EOF" + newline;
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestWeirdChar()
{
string template = " <*>";
TemplateGroup group = new TemplateGroup();
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
try
{
group.DefineTemplate("test", template);
}
catch (TemplateException)
{
}
string result = errors.ToString();
string expected = "test 1:4: invalid character '*'" + newline +
"test 1:0: this doesn't look like a template: \" <*>\"" + newline;
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestWeirdChar2()
{
string template = "\n<\\\n";
TemplateGroup group = new TemplateGroup();
ErrorBuffer errors = new ErrorBuffer();
group.Listener = errors;
try
{
group.DefineTemplate("test", template);
}
catch (TemplateException)
{
}
string result = errors.ToString();
string expected = "test 1:2: invalid escaped char: '<EOF>'" + newline +
"test 1:2: expecting '>', found '<EOF>'" + newline;
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestValidButOutOfPlaceChar()
{
string templates =
"foo() ::= <<hi <.> mom>>\n";
writeFile(tmpdir, "t.stg", templates);
ITemplateErrorListener errors = new ErrorBuffer();
TemplateGroupFile group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:15: doesn't look like an expression" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestValidButOutOfPlaceCharOnDifferentLine()
{
string templates =
"foo() ::= \"hi <\n" +
".> mom\"\n";
writeFile(tmpdir, "t.stg", templates);
ErrorBuffer errors = new ErrorBuffer();
TemplateGroupFile group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "[t.stg 1:15: \\n in string, t.stg 1:14: doesn't look like an expression]";
string result = errors.Errors.ToListString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestErrorInNestedTemplate()
{
string templates =
"foo() ::= \"hi <name:{[<aaa.bb!>]}> mom\"\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:29: mismatched input '!' expecting RDELIM" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestEOFInExpr()
{
string templates =
"foo() ::= \"hi <name:{x|[<aaa.bb>]}\"\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:34: premature EOF" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestEOFInExpr2()
{
string templates =
"foo() ::= \"hi <name:{x|[<aaa.bb>]}\"\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:34: premature EOF" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestEOFInString()
{
string templates =
"foo() ::= << <f(\"foo>>\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:20: EOF in string" + newline +
"t.stg 1:20: premature EOF" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestNonterminatedComment()
{
string templates = "foo() ::= << <!foo> >>";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected =
"t.stg 1:20: Nonterminated comment starting at 1:1: '!>' missing" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestMissingRPAREN()
{
string templates =
"foo() ::= \"hi <foo(>\"\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:19: '>' came as a complete surprise to me" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
[TestMethod][TestCategory(TestCategories.ST4)]
public void TestRotPar()
{
string templates =
"foo() ::= \"<a,b:t(),u()>\"\n";
writeFile(tmpdir, "t.stg", templates);
TemplateGroupFile group;
ITemplateErrorListener errors = new ErrorBuffer();
group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
group.Listener = errors;
group.Load(); // force load
string expected = "t.stg 1:19: mismatched input ',' expecting RDELIM" + newline;
string result = errors.ToString();
Assert.AreEqual(expected, result);
}
}
}
| 39.151899 | 105 | 0.561348 | [
"BSD-3-Clause"
] | antlr/antlrcs | Antlr4.Test.StringTemplate/TestSyntaxErrors.cs | 12,374 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Common.Core;
using Microsoft.Languages.Editor.Shell;
using Microsoft.R.Components.InteractiveWorkflow;
using Microsoft.R.Host.Client;
using Microsoft.R.Host.Client.Session;
using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.FileSystemMirroring.Project;
using Microsoft.VisualStudio.R.Package.Commands;
using Microsoft.VisualStudio.R.Package.Shell;
using Microsoft.VisualStudio.R.Packages.R;
namespace Microsoft.VisualStudio.R.Package.Repl.Workspace {
internal sealed class SaveWorkspaceCommand : PackageCommand {
private readonly IRInteractiveWorkflow _interactiveWorkflow;
private readonly IRSession _rSession;
private readonly IProjectServiceAccessor _projectServiceAccessor;
public SaveWorkspaceCommand(IRInteractiveWorkflow interactiveWorkflow, IProjectServiceAccessor projectServiceAccessor) :
base(RGuidList.RCmdSetGuid, RPackageCommandId.icmdSaveWorkspace) {
_rSession = interactiveWorkflow.RSession;
_projectServiceAccessor = projectServiceAccessor;
_interactiveWorkflow = interactiveWorkflow;
}
protected override void SetStatus() {
var window = _interactiveWorkflow.ActiveWindow;
if (window != null && window.Container.IsOnScreen) {
Visible = true;
Enabled = _rSession.IsHostRunning;
} else {
Visible = false;
}
}
protected override void Handle() {
var projectService = _projectServiceAccessor.GetProjectService();
var lastLoadedProject = projectService.LoadedUnconfiguredProjects.LastOrDefault();
var initialPath = lastLoadedProject != null ? lastLoadedProject.GetProjectDirectory() : Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var file = VsAppShell.Current.BrowseForFileSave(IntPtr.Zero, Resources.WorkspaceFileFilter, initialPath, Resources.SaveWorkspaceAsTitle);
if (file == null) {
return;
}
SaveWorkspace(file).DoNotWait();
}
private async Task SaveWorkspace(string file) {
REvaluationResult result;
using (var evaluation = await _rSession.BeginEvaluationAsync()) {
result = await evaluation.SaveWorkspace(file);
}
if (result.Error != null) {
var message = string.Format(CultureInfo.CurrentCulture, Resources.SaveWorkspaceFailedMessageFormat, file, result.Error);
VsAppShell.Current.ShowErrorMessage(message);
}
}
}
}
| 42.808824 | 165 | 0.701477 | [
"MIT"
] | AlexanderSher/RTVS-Old | src/Package/Impl/Repl/Workspace/SaveWorkspaceCommand.cs | 2,913 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Monaco.Helpers
{
public sealed class CssGlyphStyle : ICssStyle
{
public Uri GlyphImage { get; set; }
public string Name { get; private set; }
public CssGlyphStyle()
{
Name = CssStyleBroker.Instance.Register(this);
}
public string ToCss()
{
return CssStyleBroker.WrapCssClassName(this, string.Format("background: url(\"{0}\");", GlyphImage.AbsoluteUri));
}
}
}
| 22.730769 | 125 | 0.62775 | [
"MIT"
] | builttoroam/uno.monaco-editor-uwp | MonacoEditorComponent/Monaco/Helpers/CssGlyphStyle.cs | 593 | C# |
using Microsoft.VisualC;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[DebugInfoInPDB, MiscellaneousBits(64), NativeCppClass]
[StructLayout(LayoutKind.Sequential, Size = 440)]
internal struct GPEquipmentUnit
{
}
| 23.545455 | 55 | 0.826255 | [
"Unlicense"
] | stormregion/jtf_map_editor | src/GPEquipmentUnit.cs | 259 | C# |
using System;
using System.Collections.Generic;
namespace Ploeh.AutoFixture.Kernel
{
/// <summary>
/// Tracks all disposable specimens created by a decorated <see cref="ISpecimenBuilder"/> to
/// be able to dispose them when signalled.
/// </summary>
/// <remarks>
/// <para>
/// The DisposableTracker examines all specimens created by a decorated
/// <see cref="ISpecimenBuilder"/>. All specimens that implement <see cref="IDisposable"/> are
/// tracked so that they can be deterministically disposed. This happens when
/// <see cref="Dispose()"/> is invoked on the instance.
/// </para>
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The main responsibility of this class isn't to be a 'collection' (which, by the way, it isn't - it's just an Iterator).")]
public class DisposableTracker : ISpecimenBuilderNode, IDisposable
{
private readonly ISpecimenBuilder builder;
private readonly HashSet<IDisposable> disposables;
/// <summary>
/// Initializes a new instance of the <see cref="DisposableTracker"/> class.
/// </summary>
/// <param name="builder">The decorated builder.</param>
/// <remarks>
/// <para>
/// After initialization, <paramref name="builder"/> is available through the
/// <see cref="Builder"/> property.
/// </para>
/// </remarks>
public DisposableTracker(ISpecimenBuilder builder)
{
if (builder == null)
{
throw new ArgumentNullException("builder");
}
this.builder = builder;
this.disposables = new HashSet<IDisposable>();
}
/// <summary>
/// Gets the decorated builder.
/// </summary>
/// <remarks>
/// <para>
/// This property exposes the decorated builder originally supplied to the constructor.
/// </para>
/// </remarks>
/// <seealso cref="DisposableTracker(ISpecimenBuilder)"/>
public ISpecimenBuilder Builder
{
get { return this.builder; }
}
/// <summary>
/// Gets the disposable specimens currently tracked by this instance.
/// </summary>
/// <remarks>
/// <para>
/// Items are added to this list by the <see cref="Create(object, ISpecimenContext)"/>
/// method.
/// </para>
/// </remarks>
public IEnumerable<IDisposable> Disposables
{
get { return this.disposables; }
}
/// <summary>
/// Creates a new specimen based on a request.
/// </summary>
/// <param name="request">The request that describes what to create.</param>
/// <param name="context">A context that can be used to create other specimens.</param>
/// <returns>
/// The specimen created by the decorated builder.
/// </returns>
/// <remarks>
/// <para>
/// This method delegates creation of specimens to the decorated <see cref="Builder"/>.
/// However, before specimens are returned they are examined and tracked in the
/// <see cref="Disposables"/> list if they implement <see cref="IDisposable"/>. They can
/// subsequently be disposed by invoking the <see cref="Dispose()"/> method on the
/// instance.
/// </para>
/// </remarks>
public object Create(object request, ISpecimenContext context)
{
var specimen = this.Builder.Create(request, context);
var d = specimen as IDisposable;
if (d != null)
{
this.disposables.Add(d);
}
return specimen;
}
/// <summary>Composes the supplied builders.</summary>
/// <param name="builders">The builders to compose.</param>
/// <returns>
/// A new <see cref="ISpecimenBuilderNode" /> instance containing
/// <paramref name="builders" /> as child nodes.
/// </returns>
public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
{
var composedBuilder = CompositeSpecimenBuilder.ComposeIfMultiple(builders);
var d = new DisposableTracker(composedBuilder);
this.disposables.Add(d);
return d;
}
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>
/// A <see cref="IEnumerator{ISpecimenBuilder}" /> that can be used to
/// iterate through the collection.
/// </returns>
public IEnumerator<ISpecimenBuilder> GetEnumerator()
{
yield return this.builder;
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>
/// Disposes all items in the <see cref="Disposables"/> list and removes them from the
/// list.
/// </summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Disposes all items in the <see cref="Disposables"/> list and removes them from the
/// list.
/// </summary>
/// <param name="disposing">
/// <see langword="true"/> to release both managed and unmanaged resources;
/// <see langword="false"/> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
foreach(var d in this.Disposables)
{
d.Dispose();
}
this.disposables.Clear();
}
}
}
}
| 37.828221 | 258 | 0.551898 | [
"MIT"
] | TeaDrivenDev/AutoFixture | Src/AutoFixture/Kernel/DisposableTracker.cs | 6,168 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Sentakki.Objects;
namespace osu.Game.Rulesets.Sentakki.Beatmaps
{
[Flags]
public enum ConversionExperiments
{
none = 0,
twinNotes = 1,
twinSlides = 2,
touch = 4,
}
public class SentakkiBeatmapConverter : BeatmapConverter<SentakkiHitObject>
{
// todo: Check for conversion types that should be supported (ie. Beatmap.HitObjects.Any(h => h is IHasXPosition))
// https://github.com/ppy/osu/tree/master/osu.Game/Rulesets/Objects/Types
public override bool CanConvert() => Beatmap.HitObjects.All(h => h is IHasPosition);
public Bindable<ConversionExperiments> EnabledExperiments = new Bindable<ConversionExperiments>();
private SentakkiPatternGenerator patternGen;
public SentakkiBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
: base(beatmap, ruleset)
{
patternGen = new SentakkiPatternGenerator(beatmap);
patternGen.Experiments.BindTo(EnabledExperiments);
}
protected override Beatmap<SentakkiHitObject> ConvertBeatmap(IBeatmap original, CancellationToken cancellationToken)
{
var convertedBeatmap = base.ConvertBeatmap(original, cancellationToken);
// We don't use any of the standard difficulty values
// But we initialize to defaults so HR can adjust HitWindows in a controlled manner
// We clone beforehand to avoid altering the original (it really should be readonly :P)
convertedBeatmap.BeatmapInfo = convertedBeatmap.BeatmapInfo.Clone();
convertedBeatmap.BeatmapInfo.BaseDifficulty = new BeatmapDifficulty();
return convertedBeatmap;
}
protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken)
{
if ((original as IHasCombo).NewCombo)
patternGen.CreateNewPattern();
foreach (var note in patternGen.GenerateNewNote(original).ToList())
yield return note;
}
protected override Beatmap<SentakkiHitObject> CreateBeatmap() => new SentakkiBeatmap();
}
}
| 39.25 | 150 | 0.676752 | [
"MIT"
] | Flutterish/sentakki | osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiBeatmapConverter.cs | 2,451 | C# |
namespace Infrastructure.DataAccess.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class UnknownChanges : DbMigration
{
public override void Up()
{
AlterColumn("Addresses", "DriveReportId", c => c.Int());
AlterColumn("Addresses", "PersonId", c => c.Int());
AlterColumn("Addresses", "PersonalRouteId", c => c.Int());
AlterColumn("Addresses", "NextPoint_Id", c => c.Int());
AlterColumn("Addresses", "NextPoint_Id1", c => c.Int());
AlterColumn("Reports", "ApprovedById", c => c.Int());
AlterColumn("Reports", "PersonId", c => c.Int(nullable: false));
AlterColumn("Reports", "EmploymentId", c => c.Int(nullable: false));
AlterColumn("Reports", "Person_Id", c => c.Int());
AlterColumn("Employments", "PersonId", c => c.Int(nullable: false));
AlterColumn("Employments", "OrgUnitId", c => c.Int(nullable: false));
AlterColumn("OrgUnits", "ParentId", c => c.Int());
AlterColumn("Substitutes", "LeaderId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "SubId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "PersonId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "OrgUnitId", c => c.Int(nullable: false));
AlterColumn("LicensePlates", "PersonId", c => c.Int(nullable: false));
AlterColumn("MobileTokens", "PersonId", c => c.Int(nullable: false));
AlterColumn("PersonalRoutes", "PersonId", c => c.Int(nullable: false));
AlterColumn("Rates", "TypeId", c => c.Int(nullable: false));
}
public override void Down()
{
AlterColumn("Rates", "TypeId", c => c.Int(nullable: false));
AlterColumn("PersonalRoutes", "PersonId", c => c.Int(nullable: false));
AlterColumn("MobileTokens", "PersonId", c => c.Int(nullable: false));
AlterColumn("LicensePlates", "PersonId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "OrgUnitId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "PersonId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "SubId", c => c.Int(nullable: false));
AlterColumn("Substitutes", "LeaderId", c => c.Int(nullable: false));
AlterColumn("OrgUnits", "ParentId", c => c.Int());
AlterColumn("Employments", "OrgUnitId", c => c.Int(nullable: false));
AlterColumn("Employments", "PersonId", c => c.Int(nullable: false));
AlterColumn("Reports", "Person_Id", c => c.Int());
AlterColumn("Reports", "EmploymentId", c => c.Int(nullable: false));
AlterColumn("Reports", "PersonId", c => c.Int(nullable: false));
AlterColumn("Reports", "ApprovedById", c => c.Int());
AlterColumn("Addresses", "NextPoint_Id1", c => c.Int());
AlterColumn("Addresses", "NextPoint_Id", c => c.Int());
AlterColumn("Addresses", "PersonalRouteId", c => c.Int());
AlterColumn("Addresses", "PersonId", c => c.Int());
AlterColumn("Addresses", "DriveReportId", c => c.Int());
}
}
}
| 57.824561 | 83 | 0.569782 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | os2indberetning/os2indberetning | Infrastructure.DataAccess/Migrations/201504220645399_UnknownChanges.cs | 3,296 | 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;
class Program
{
static void Main(string[] args)
{
}
}
| 23.75 | 71 | 0.712281 | [
"MIT"
] | 3F/coreclr | tests/src/Regressions/coreclr/GitHub_22888/test22888resources.cs | 287 | C# |
//
// Copyright(c) 2013 Paul Betts
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Net;
namespace Xamarin.PinningAppDemo.iOS.Services.ModernHttpClient
{
/// <summary>
/// Thrown when the request goes to a captive network. This happens
/// usually with wifi networks where an authentication html form is shown
/// instead of the real content.
/// </summary>
public class CaptiveNetworkException : WebException
{
const string DefaultCaptiveNetworkErrorMessage = "Hostnames don't match, you are probably on a captive network";
/// <summary>
/// Gets the source URI.
/// </summary>
/// <value>The source URI.</value>
public Uri SourceUri { get; private set; }
/// <summary>
/// Gets the destination URI.
/// </summary>
/// <value>The destination URI.</value>
public Uri DestinationUri { get; private set; }
public CaptiveNetworkException(Uri sourceUri, Uri destinationUri) : base(DefaultCaptiveNetworkErrorMessage)
{
SourceUri = sourceUri;
DestinationUri = destinationUri;
}
}
} | 41.509434 | 120 | 0.7 | [
"MIT"
] | Orbital8/PinningAppDemo | Xamarin.PinningAppDemo.iOS/Services/ModernHttpClient/CaptiveNetworkException.cs | 2,200 | 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 keyspaces-2022-02-10.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Threading;
using System.Threading.Tasks;
using Amazon.Runtime;
namespace Amazon.Keyspaces.Model
{
/// <summary>
/// Base class for ListKeyspaces paginators.
/// </summary>
internal sealed partial class ListKeyspacesPaginator : IPaginator<ListKeyspacesResponse>, IListKeyspacesPaginator
{
private readonly IAmazonKeyspaces _client;
private readonly ListKeyspacesRequest _request;
private int _isPaginatorInUse = 0;
/// <summary>
/// Enumerable containing all full responses for the operation
/// </summary>
public IPaginatedEnumerable<ListKeyspacesResponse> Responses => new PaginatedResponse<ListKeyspacesResponse>(this);
/// <summary>
/// Enumerable containing all of the Keyspaces
/// </summary>
public IPaginatedEnumerable<KeyspaceSummary> Keyspaces =>
new PaginatedResultKeyResponse<ListKeyspacesResponse, KeyspaceSummary>(this, (i) => i.Keyspaces);
internal ListKeyspacesPaginator(IAmazonKeyspaces client, ListKeyspacesRequest request)
{
this._client = client;
this._request = request;
}
#if BCL
IEnumerable<ListKeyspacesResponse> IPaginator<ListKeyspacesResponse>.Paginate()
{
if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
{
throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
}
PaginatorUtils.SetUserAgentAdditionOnRequest(_request);
var nextToken = _request.NextToken;
ListKeyspacesResponse response;
do
{
_request.NextToken = nextToken;
response = _client.ListKeyspaces(_request);
nextToken = response.NextToken;
yield return response;
}
while (!string.IsNullOrEmpty(nextToken));
}
#endif
#if AWS_ASYNC_ENUMERABLES_API
async IAsyncEnumerable<ListKeyspacesResponse> IPaginator<ListKeyspacesResponse>.PaginateAsync(CancellationToken cancellationToken = default)
{
if (Interlocked.Exchange(ref _isPaginatorInUse, 1) != 0)
{
throw new System.InvalidOperationException("Paginator has already been consumed and cannot be reused. Please create a new instance.");
}
PaginatorUtils.SetUserAgentAdditionOnRequest(_request);
var nextToken = _request.NextToken;
ListKeyspacesResponse response;
do
{
_request.NextToken = nextToken;
response = await _client.ListKeyspacesAsync(_request, cancellationToken).ConfigureAwait(false);
nextToken = response.NextToken;
cancellationToken.ThrowIfCancellationRequested();
yield return response;
}
while (!string.IsNullOrEmpty(nextToken));
}
#endif
}
} | 39.484536 | 150 | 0.662402 | [
"Apache-2.0"
] | Hazy87/aws-sdk-net | sdk/src/Services/Keyspaces/Generated/Model/_bcl45+netstandard/ListKeyspacesPaginator.cs | 3,830 | C# |
namespace LeakShell
{
partial class AboutBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
this.pbIcon = new System.Windows.Forms.PictureBox();
this.lblTitle = new System.Windows.Forms.Label();
this.lblVersion = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbIcon)).BeginInit();
this.SuspendLayout();
//
// pbIcon
//
this.pbIcon.Image = ((System.Drawing.Image)(resources.GetObject("pbIcon.Image")));
this.pbIcon.Location = new System.Drawing.Point(17, 16);
this.pbIcon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.pbIcon.Name = "pbIcon";
this.pbIcon.Size = new System.Drawing.Size(37, 37);
this.pbIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbIcon.TabIndex = 0;
this.pbIcon.TabStop = false;
//
// lblTitle
//
this.lblTitle.AutoSize = true;
this.lblTitle.Location = new System.Drawing.Point(75, 14);
this.lblTitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(101, 17);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "LeakShell v1.1";
//
// lblVersion
//
this.lblVersion.AutoSize = true;
this.lblVersion.Location = new System.Drawing.Point(75, 41);
this.lblVersion.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(213, 17);
this.lblVersion.TabIndex = 2;
this.lblVersion.Text = "2011-2020 - Christophe Nasarre";
//
// AboutBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(301, 69);
this.ControlBox = false;
this.Controls.Add(this.lblVersion);
this.Controls.Add(this.lblTitle);
this.Controls.Add(this.pbIcon);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About";
this.Load += new System.EventHandler(this.About_Load);
this.DoubleClick += new System.EventHandler(this.About_DoubleClick);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.AboutBox_KeyUp);
((System.ComponentModel.ISupportInitialize)(this.pbIcon)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pbIcon;
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Label lblVersion;
}
} | 43.152381 | 140 | 0.587067 | [
"MIT"
] | chrisnas/DebuggingExtensions | src/LeakShell/AboutBox.Designer.cs | 4,533 | C# |
using System.Text.Json;
using ByteDev.Json.SystemTextJson.Serialization;
using ByteDev.Json.SystemTextJson.UnitTests.TestEntities;
using NUnit.Framework;
namespace ByteDev.Json.SystemTextJson.UnitTests.Serialization
{
[TestFixture]
public class EnumJsonConverterTests
{
private const string JsonNotNumberOrStringValue = "{\"lights\":true}";
private const string JsonNumber = "{\"lights\":2}";
private const string JsonNumberNoMatch = "{\"lights\":99}";
private const string JsonString = "{\"lights\":\"Off\"}";
private const string JsonStringNoAttribute = "{\"lights\":\"Faulty\"}";
private const string JsonStringAttribute = "{\"lights\":\"switchOff\"}";
private const string JsonStringNoMatch = "{\"lights\":\"InvalidValue\"}";
private EnumJsonConverter<LightSwitch> _sut;
[SetUp]
public void SetUp()
{
_sut = new EnumJsonConverter<LightSwitch>();
}
[TestFixture]
public class Read : EnumJsonConverterTests
{
[Test]
public void WhenJsonEnumIsNumber_ThenSetEnum()
{
var result = _sut.Deserialize<TestEnumEntity>(JsonNumber);
Assert.That(result.HouseLights, Is.EqualTo(LightSwitch.Off));
}
[Test]
public void WhenJsonEnumIsString_AndMatches_ThenSetEnum()
{
var result = _sut.Deserialize<TestEnumEntity>(JsonString);
Assert.That(result.HouseLights, Is.EqualTo(LightSwitch.Off));
}
[Test]
public void WhenJsonEnumIsString_AndMatchesAttribute_ThenSetEnum()
{
var result = _sut.Deserialize<TestEnumEntity>(JsonStringAttribute);
Assert.That(result.HouseLights, Is.EqualTo(LightSwitch.Off));
}
[Test]
public void WhenJsonEnumIsNumber_AndDoesNotMatch_ThenSetEnum()
{
var result = _sut.Deserialize<TestEnumEntity>(JsonNumberNoMatch);
Assert.That((int)result.HouseLights, Is.EqualTo(99));
}
[Test]
public void WhenJsonEnumIsString_AndDoesNotMatch_ThenThrowException()
{
var ex = Assert.Throws<JsonException>(() => _ = _sut.Deserialize<TestEnumEntity>(JsonStringNoMatch));
Assert.That(ex.Message, Is.EqualTo("The JSON string value does match any value in Enum: 'ByteDev.Json.SystemTextJson.UnitTests.TestEntities.LightSwitch'."));
}
[Test]
public void WhenJsonEnumIsNotNumberOrString_ThenThrowException()
{
var ex = Assert.Throws<JsonException>(() => _ = _sut.Deserialize<TestEnumEntity>(JsonNotNumberOrStringValue));
Assert.That(ex.Message, Is.EqualTo("The JSON value could not be converted to Enum: 'ByteDev.Json.SystemTextJson.UnitTests.TestEntities.LightSwitch'. Value was not a number or string."));
}
[TestCase(JsonNotNumberOrStringValue)]
[TestCase(JsonStringNoMatch)]
public void WhenDefaultEnumValueProvided_AndJsonValueNotValid_ThenSetDefault(string json)
{
var sut = new EnumJsonConverter<LightSwitch>(LightSwitch.Faulty);
var result = sut.Deserialize<TestEnumEntity>(json);
Assert.That(result.HouseLights, Is.EqualTo(LightSwitch.Faulty));
}
[Test]
public void WhenTwoEnumConverters_ThenSetCorrectValue()
{
const string json = "{" +
"\"room_color\":\"Green\"," +
"\"lights\":\"switchOff\"" +
"}";
var options = new JsonSerializerOptions();
options.Converters.Add(new EnumJsonConverter<LightSwitch>(LightSwitch.Faulty));
options.Converters.Add(new EnumJsonConverter<Color>(Color.Unknown));
var result = JsonSerializer.Deserialize<TestTwoEnumEntity>(json, options);
Assert.That(result.RoomColor, Is.EqualTo(Color.Green));
Assert.That(result.HouseLights, Is.EqualTo(LightSwitch.Off));
}
}
[TestFixture]
public class Write : EnumJsonConverterTests
{
[Test]
public void WhenWriteEnumNameIsFalse_ThenWriteEnumNumber()
{
var entity = new TestEnumEntity
{
HouseLights = LightSwitch.Off
};
var result = _sut.Serialize(entity);
Assert.That(result, Is.EqualTo(JsonNumber));
}
[Test]
public void WhenWriteEnumNameIsFalse_AndEnumValueIsNotDefined_ThenWriteEnumNumber()
{
var entity = new TestEnumEntity
{
HouseLights = (LightSwitch)99
};
var result = _sut.Serialize(entity);
Assert.That(result, Is.EqualTo("{\"lights\":99}"));
}
[Test]
public void WhenWriteName_ThenWriteEnumString()
{
var entity = new TestEnumEntity
{
HouseLights = LightSwitch.Faulty
};
_sut.WriteEnumValueType = EnumValueType.Name;
var result = _sut.Serialize(entity);
Assert.That(result, Is.EqualTo(JsonStringNoAttribute));
}
[Test]
public void WhenWriteName_AndHasAttribute_ThenWriteAttributeString()
{
var entity = new TestEnumEntity
{
HouseLights = LightSwitch.Off
};
_sut.WriteEnumValueType = EnumValueType.Name;
var result = _sut.Serialize(entity);
Assert.That(result, Is.EqualTo(JsonStringAttribute));
}
[Test]
public void WhenWriteName_AndEnumValueIsNotDefined_ThenWriteEnumNumberAsString()
{
var entity = new TestEnumEntity
{
HouseLights = (LightSwitch)99
};
_sut.WriteEnumValueType = EnumValueType.Name;
var result = _sut.Serialize(entity);
Assert.That(result, Is.EqualTo("{\"lights\":\"99\"}"));
}
}
}
} | 36.149171 | 202 | 0.564573 | [
"MIT"
] | ByteDev/ByteDev.Json.SystemTextJson | tests/ByteDev.Json.SystemTextJson.UnitTests/Serialization/EnumJsonConverterTests.cs | 6,545 | C# |
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace WebsitePanel.PasswordEncoder
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.CryptoKey = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.Value = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.Result = new System.Windows.Forms.TextBox();
this.EncryptButton = new System.Windows.Forms.Button();
this.DecryptButton = new System.Windows.Forms.Button();
this.Sha1Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(222, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Crypto key from Enterprise Server web.config:";
//
// CryptoKey
//
this.CryptoKey.Location = new System.Drawing.Point(12, 25);
this.CryptoKey.Name = "CryptoKey";
this.CryptoKey.Size = new System.Drawing.Size(294, 20);
this.CryptoKey.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 61);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(137, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Value to encrypt or decrypt:";
//
// Value
//
this.Value.Location = new System.Drawing.Point(12, 77);
this.Value.Name = "Value";
this.Value.Size = new System.Drawing.Size(294, 20);
this.Value.TabIndex = 3;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 164);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(40, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Result:";
//
// Result
//
this.Result.Location = new System.Drawing.Point(12, 180);
this.Result.Name = "Result";
this.Result.Size = new System.Drawing.Size(294, 20);
this.Result.TabIndex = 5;
//
// EncryptButton
//
this.EncryptButton.Location = new System.Drawing.Point(12, 103);
this.EncryptButton.Name = "EncryptButton";
this.EncryptButton.Size = new System.Drawing.Size(75, 23);
this.EncryptButton.TabIndex = 6;
this.EncryptButton.Text = "Encrypt";
this.EncryptButton.UseVisualStyleBackColor = true;
this.EncryptButton.Click += new System.EventHandler(this.EncryptButton_Click);
//
// DecryptButton
//
this.DecryptButton.Location = new System.Drawing.Point(93, 103);
this.DecryptButton.Name = "DecryptButton";
this.DecryptButton.Size = new System.Drawing.Size(75, 23);
this.DecryptButton.TabIndex = 7;
this.DecryptButton.Text = "Decrypt";
this.DecryptButton.UseVisualStyleBackColor = true;
this.DecryptButton.Click += new System.EventHandler(this.DecryptButton_Click);
//
// Sha1Button
//
this.Sha1Button.Location = new System.Drawing.Point(174, 103);
this.Sha1Button.Name = "Sha1Button";
this.Sha1Button.Size = new System.Drawing.Size(75, 23);
this.Sha1Button.TabIndex = 8;
this.Sha1Button.Text = "SHA1";
this.Sha1Button.UseVisualStyleBackColor = true;
this.Sha1Button.Click += new System.EventHandler(this.Sha1Button_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(322, 213);
this.Controls.Add(this.Sha1Button);
this.Controls.Add(this.DecryptButton);
this.Controls.Add(this.EncryptButton);
this.Controls.Add(this.Result);
this.Controls.Add(this.label3);
this.Controls.Add(this.Value);
this.Controls.Add(this.label2);
this.Controls.Add(this.CryptoKey);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "WebsitePanel Password Encoder";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox CryptoKey;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox Value;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox Result;
private System.Windows.Forms.Button EncryptButton;
private System.Windows.Forms.Button DecryptButton;
private System.Windows.Forms.Button Sha1Button;
}
}
| 44.854054 | 108 | 0.589178 | [
"BSD-3-Clause"
] | 9192939495969798/Websitepanel | WebsitePanel/Sources/Tools/WebsitePanel.PasswordEncoder/MainForm.Designer.cs | 8,298 | C# |
/*
Copyright (c) 2017, Nokia
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using net.nuagenetworks.bambou;
using net.nuagenetworks.vspk.v6.fetchers;
namespace net.nuagenetworks.vspk.v6
{
public class L2Domain: RestObject {
private const long serialVersionUID = 1L;
public enum EDPI {DISABLED,ENABLED };
public enum EIPType {DUALSTACK,IPV4,IPV6 };
public enum EEncryption {DISABLED,ENABLED };
public enum EEntityScope {ENTERPRISE,GLOBAL };
public enum EEntityState {MARKED_FOR_DELETION,UNDER_CONSTRUCTION };
public enum EFlowCollectionEnabled {DISABLED,ENABLED,INHERITED };
public enum EFlowLimitEnabled {DISABLED,ENABLED };
public enum EL2EncapType {MPLS,MPLSoUDP,VXLAN };
public enum EMaintenanceMode {DISABLED,ENABLED,ENABLED_INHERITED };
public enum EMulticast {DISABLED,ENABLED,INHERITED };
public enum EPolicyChangeStatus {APPLIED,DISCARDED,STARTED };
public enum EThreatIntelligenceEnabled {DISABLED,ENABLED,INHERITED };
public enum EUplinkPreference {PRIMARY,PRIMARY_SECONDARY,SECONDARY,SECONDARY_PRIMARY,SYMMETRIC };
public enum EUseGlobalMAC {DISABLED,ENABLED };
[JsonProperty("DHCPManaged")]
protected bool _DHCPManaged;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("DPI")]
protected EDPI? _DPI;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("IPType")]
protected EIPType? _IPType;
[JsonProperty("IPv6Address")]
protected String _IPv6Address;
[JsonProperty("IPv6Gateway")]
protected String _IPv6Gateway;
[JsonProperty("VXLANECMPEnabled")]
protected bool _VXLANECMPEnabled;
[JsonProperty("address")]
protected String _address;
[JsonProperty("associatedMulticastChannelMapID")]
protected String _associatedMulticastChannelMapID;
[JsonProperty("associatedSharedNetworkResourceID")]
protected String _associatedSharedNetworkResourceID;
[JsonProperty("associatedUnderlayID")]
protected String _associatedUnderlayID;
[JsonProperty("color")]
protected long? _color;
[JsonProperty("creationDate")]
protected String _creationDate;
[JsonProperty("customerID")]
protected long? _customerID;
[JsonProperty("description")]
protected String _description;
[JsonProperty("dualStackDynamicIPAllocation")]
protected bool _dualStackDynamicIPAllocation;
[JsonProperty("embeddedMetadata")]
protected System.Collections.Generic.List<Metadata> _embeddedMetadata;
[JsonProperty("enableDHCPv4")]
protected bool _enableDHCPv4;
[JsonProperty("enableDHCPv6")]
protected bool _enableDHCPv6;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("encryption")]
protected EEncryption? _encryption;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("entityScope")]
protected EEntityScope? _entityScope;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("entityState")]
protected EEntityState? _entityState;
[JsonProperty("externalID")]
protected String _externalID;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("flowCollectionEnabled")]
protected EFlowCollectionEnabled? _flowCollectionEnabled;
[JsonProperty("flowCount")]
protected long? _flowCount;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("flowLimitEnabled")]
protected EFlowLimitEnabled? _flowLimitEnabled;
[JsonProperty("gateway")]
protected String _gateway;
[JsonProperty("gatewayMACAddress")]
protected String _gatewayMACAddress;
[JsonProperty("ingressReplicationEnabled")]
protected bool _ingressReplicationEnabled;
[JsonProperty("interfaceID")]
protected long? _interfaceID;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("l2EncapType")]
protected EL2EncapType? _l2EncapType;
[JsonProperty("lastUpdatedBy")]
protected String _lastUpdatedBy;
[JsonProperty("lastUpdatedDate")]
protected String _lastUpdatedDate;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("maintenanceMode")]
protected EMaintenanceMode? _maintenanceMode;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("multicast")]
protected EMulticast? _multicast;
[JsonProperty("name")]
protected String _name;
[JsonProperty("netmask")]
protected String _netmask;
[JsonProperty("owner")]
protected String _owner;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("policyChangeStatus")]
protected EPolicyChangeStatus? _policyChangeStatus;
[JsonProperty("routeDistinguisher")]
protected String _routeDistinguisher;
[JsonProperty("routeTarget")]
protected String _routeTarget;
[JsonProperty("routedVPLSEnabled")]
protected bool _routedVPLSEnabled;
[JsonProperty("serviceID")]
protected long? _serviceID;
[JsonProperty("stretched")]
protected bool _stretched;
[JsonProperty("templateID")]
protected String _templateID;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("threatIntelligenceEnabled")]
protected EThreatIntelligenceEnabled? _threatIntelligenceEnabled;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("uplinkPreference")]
protected EUplinkPreference? _uplinkPreference;
[JsonConverter(typeof(StringEnumConverter))]
[JsonProperty("useGlobalMAC")]
protected EUseGlobalMAC? _useGlobalMAC;
[JsonProperty("vnId")]
protected long? _vnId;
[JsonIgnore]
private AddressRangesFetcher _addressRanges;
[JsonIgnore]
private AlarmsFetcher _alarms;
[JsonIgnore]
private ApplicationsFetcher _applications;
[JsonIgnore]
private ApplicationperformancemanagementbindingsFetcher _applicationperformancemanagementbindings;
[JsonIgnore]
private BridgeInterfacesFetcher _bridgeInterfaces;
[JsonIgnore]
private ContainersFetcher _containers;
[JsonIgnore]
private ContainerInterfacesFetcher _containerInterfaces;
[JsonIgnore]
private DeploymentFailuresFetcher _deploymentFailures;
[JsonIgnore]
private DHCPOptionsFetcher _dHCPOptions;
[JsonIgnore]
private DHCPv6OptionsFetcher _dHCPv6Options;
[JsonIgnore]
private EgressACLEntryTemplatesFetcher _egressACLEntryTemplates;
[JsonIgnore]
private EgressACLTemplatesFetcher _egressACLTemplates;
[JsonIgnore]
private EgressAdvFwdTemplatesFetcher _egressAdvFwdTemplates;
[JsonIgnore]
private EgressAuditACLEntryTemplatesFetcher _egressAuditACLEntryTemplates;
[JsonIgnore]
private EgressAuditACLTemplatesFetcher _egressAuditACLTemplates;
[JsonIgnore]
private EventLogsFetcher _eventLogs;
[JsonIgnore]
private GatewaysFetcher _gateways;
[JsonIgnore]
private GlobalMetadatasFetcher _globalMetadatas;
[JsonIgnore]
private GroupsFetcher _groups;
[JsonIgnore]
private HostInterfacesFetcher _hostInterfaces;
[JsonIgnore]
private IngressACLEntryTemplatesFetcher _ingressACLEntryTemplates;
[JsonIgnore]
private IngressACLTemplatesFetcher _ingressACLTemplates;
[JsonIgnore]
private IngressAdvFwdTemplatesFetcher _ingressAdvFwdTemplates;
[JsonIgnore]
private IngressAuditACLEntryTemplatesFetcher _ingressAuditACLEntryTemplates;
[JsonIgnore]
private IngressAuditACLTemplatesFetcher _ingressAuditACLTemplates;
[JsonIgnore]
private JobsFetcher _jobs;
[JsonIgnore]
private MetadatasFetcher _metadatas;
[JsonIgnore]
private MirrorDestinationGroupsFetcher _mirrorDestinationGroups;
[JsonIgnore]
private NetworkPerformanceBindingsFetcher _networkPerformanceBindings;
[JsonIgnore]
private NSGatewaySummariesFetcher _nSGatewaySummaries;
[JsonIgnore]
private OverlayMirrorDestinationsFetcher _overlayMirrorDestinations;
[JsonIgnore]
private PermissionsFetcher _permissions;
[JsonIgnore]
private PGExpressionsFetcher _pGExpressions;
[JsonIgnore]
private PolicyGroupsFetcher _policyGroups;
[JsonIgnore]
private ProxyARPFiltersFetcher _proxyARPFilters;
[JsonIgnore]
private QOSsFetcher _qOSs;
[JsonIgnore]
private RedirectionTargetsFetcher _redirectionTargets;
[JsonIgnore]
private RedundancyGroupsFetcher _redundancyGroups;
[JsonIgnore]
private StaticRoutesFetcher _staticRoutes;
[JsonIgnore]
private StatisticsFetcher _statistics;
[JsonIgnore]
private StatisticsPoliciesFetcher _statisticsPolicies;
[JsonIgnore]
private TCAsFetcher _tCAs;
[JsonIgnore]
private UplinkRDsFetcher _uplinkRDs;
[JsonIgnore]
private VirtualFirewallPoliciesFetcher _virtualFirewallPolicies;
[JsonIgnore]
private VirtualFirewallRulesFetcher _virtualFirewallRules;
[JsonIgnore]
private VMsFetcher _vMs;
[JsonIgnore]
private VMInterfacesFetcher _vMInterfaces;
[JsonIgnore]
private VMIPReservationsFetcher _vMIPReservations;
[JsonIgnore]
private VPNConnectionsFetcher _vPNConnections;
[JsonIgnore]
private VPortsFetcher _vPorts;
public L2Domain() {
_maintenanceMode = EMaintenanceMode.DISABLED;
_addressRanges = new AddressRangesFetcher(this);
_alarms = new AlarmsFetcher(this);
_applications = new ApplicationsFetcher(this);
_applicationperformancemanagementbindings = new ApplicationperformancemanagementbindingsFetcher(this);
_bridgeInterfaces = new BridgeInterfacesFetcher(this);
_containers = new ContainersFetcher(this);
_containerInterfaces = new ContainerInterfacesFetcher(this);
_deploymentFailures = new DeploymentFailuresFetcher(this);
_dHCPOptions = new DHCPOptionsFetcher(this);
_dHCPv6Options = new DHCPv6OptionsFetcher(this);
_egressACLEntryTemplates = new EgressACLEntryTemplatesFetcher(this);
_egressACLTemplates = new EgressACLTemplatesFetcher(this);
_egressAdvFwdTemplates = new EgressAdvFwdTemplatesFetcher(this);
_egressAuditACLEntryTemplates = new EgressAuditACLEntryTemplatesFetcher(this);
_egressAuditACLTemplates = new EgressAuditACLTemplatesFetcher(this);
_eventLogs = new EventLogsFetcher(this);
_gateways = new GatewaysFetcher(this);
_globalMetadatas = new GlobalMetadatasFetcher(this);
_groups = new GroupsFetcher(this);
_hostInterfaces = new HostInterfacesFetcher(this);
_ingressACLEntryTemplates = new IngressACLEntryTemplatesFetcher(this);
_ingressACLTemplates = new IngressACLTemplatesFetcher(this);
_ingressAdvFwdTemplates = new IngressAdvFwdTemplatesFetcher(this);
_ingressAuditACLEntryTemplates = new IngressAuditACLEntryTemplatesFetcher(this);
_ingressAuditACLTemplates = new IngressAuditACLTemplatesFetcher(this);
_jobs = new JobsFetcher(this);
_metadatas = new MetadatasFetcher(this);
_mirrorDestinationGroups = new MirrorDestinationGroupsFetcher(this);
_networkPerformanceBindings = new NetworkPerformanceBindingsFetcher(this);
_nSGatewaySummaries = new NSGatewaySummariesFetcher(this);
_overlayMirrorDestinations = new OverlayMirrorDestinationsFetcher(this);
_permissions = new PermissionsFetcher(this);
_pGExpressions = new PGExpressionsFetcher(this);
_policyGroups = new PolicyGroupsFetcher(this);
_proxyARPFilters = new ProxyARPFiltersFetcher(this);
_qOSs = new QOSsFetcher(this);
_redirectionTargets = new RedirectionTargetsFetcher(this);
_redundancyGroups = new RedundancyGroupsFetcher(this);
_staticRoutes = new StaticRoutesFetcher(this);
_statistics = new StatisticsFetcher(this);
_statisticsPolicies = new StatisticsPoliciesFetcher(this);
_tCAs = new TCAsFetcher(this);
_uplinkRDs = new UplinkRDsFetcher(this);
_virtualFirewallPolicies = new VirtualFirewallPoliciesFetcher(this);
_virtualFirewallRules = new VirtualFirewallRulesFetcher(this);
_vMs = new VMsFetcher(this);
_vMInterfaces = new VMInterfacesFetcher(this);
_vMIPReservations = new VMIPReservationsFetcher(this);
_vPNConnections = new VPNConnectionsFetcher(this);
_vPorts = new VPortsFetcher(this);
}
[JsonIgnore]
public bool NUDHCPManaged {
get {
return _DHCPManaged;
}
set {
this._DHCPManaged = value;
}
}
[JsonIgnore]
public EDPI? NUDPI {
get {
return _DPI;
}
set {
this._DPI = value;
}
}
[JsonIgnore]
public EIPType? NUIPType {
get {
return _IPType;
}
set {
this._IPType = value;
}
}
[JsonIgnore]
public String NUIPv6Address {
get {
return _IPv6Address;
}
set {
this._IPv6Address = value;
}
}
[JsonIgnore]
public String NUIPv6Gateway {
get {
return _IPv6Gateway;
}
set {
this._IPv6Gateway = value;
}
}
[JsonIgnore]
public bool NUVXLANECMPEnabled {
get {
return _VXLANECMPEnabled;
}
set {
this._VXLANECMPEnabled = value;
}
}
[JsonIgnore]
public String NUAddress {
get {
return _address;
}
set {
this._address = value;
}
}
[JsonIgnore]
public String NUAssociatedMulticastChannelMapID {
get {
return _associatedMulticastChannelMapID;
}
set {
this._associatedMulticastChannelMapID = value;
}
}
[JsonIgnore]
public String NUAssociatedSharedNetworkResourceID {
get {
return _associatedSharedNetworkResourceID;
}
set {
this._associatedSharedNetworkResourceID = value;
}
}
[JsonIgnore]
public String NUAssociatedUnderlayID {
get {
return _associatedUnderlayID;
}
set {
this._associatedUnderlayID = value;
}
}
[JsonIgnore]
public long? NUColor {
get {
return _color;
}
set {
this._color = value;
}
}
[JsonIgnore]
public String NUCreationDate {
get {
return _creationDate;
}
set {
this._creationDate = value;
}
}
[JsonIgnore]
public long? NUCustomerID {
get {
return _customerID;
}
set {
this._customerID = value;
}
}
[JsonIgnore]
public String NUDescription {
get {
return _description;
}
set {
this._description = value;
}
}
[JsonIgnore]
public bool NUDualStackDynamicIPAllocation {
get {
return _dualStackDynamicIPAllocation;
}
set {
this._dualStackDynamicIPAllocation = value;
}
}
[JsonIgnore]
public System.Collections.Generic.List<Metadata> NUEmbeddedMetadata {
get {
return _embeddedMetadata;
}
set {
this._embeddedMetadata = value;
}
}
[JsonIgnore]
public bool NUEnableDHCPv4 {
get {
return _enableDHCPv4;
}
set {
this._enableDHCPv4 = value;
}
}
[JsonIgnore]
public bool NUEnableDHCPv6 {
get {
return _enableDHCPv6;
}
set {
this._enableDHCPv6 = value;
}
}
[JsonIgnore]
public EEncryption? NUEncryption {
get {
return _encryption;
}
set {
this._encryption = value;
}
}
[JsonIgnore]
public EEntityScope? NUEntityScope {
get {
return _entityScope;
}
set {
this._entityScope = value;
}
}
[JsonIgnore]
public EEntityState? NUEntityState {
get {
return _entityState;
}
set {
this._entityState = value;
}
}
[JsonIgnore]
public String NUExternalID {
get {
return _externalID;
}
set {
this._externalID = value;
}
}
[JsonIgnore]
public EFlowCollectionEnabled? NUFlowCollectionEnabled {
get {
return _flowCollectionEnabled;
}
set {
this._flowCollectionEnabled = value;
}
}
[JsonIgnore]
public long? NUFlowCount {
get {
return _flowCount;
}
set {
this._flowCount = value;
}
}
[JsonIgnore]
public EFlowLimitEnabled? NUFlowLimitEnabled {
get {
return _flowLimitEnabled;
}
set {
this._flowLimitEnabled = value;
}
}
[JsonIgnore]
public String NUGateway {
get {
return _gateway;
}
set {
this._gateway = value;
}
}
[JsonIgnore]
public String NUGatewayMACAddress {
get {
return _gatewayMACAddress;
}
set {
this._gatewayMACAddress = value;
}
}
[JsonIgnore]
public bool NUIngressReplicationEnabled {
get {
return _ingressReplicationEnabled;
}
set {
this._ingressReplicationEnabled = value;
}
}
[JsonIgnore]
public long? NUInterfaceID {
get {
return _interfaceID;
}
set {
this._interfaceID = value;
}
}
[JsonIgnore]
public EL2EncapType? NUL2EncapType {
get {
return _l2EncapType;
}
set {
this._l2EncapType = value;
}
}
[JsonIgnore]
public String NULastUpdatedBy {
get {
return _lastUpdatedBy;
}
set {
this._lastUpdatedBy = value;
}
}
[JsonIgnore]
public String NULastUpdatedDate {
get {
return _lastUpdatedDate;
}
set {
this._lastUpdatedDate = value;
}
}
[JsonIgnore]
public EMaintenanceMode? NUMaintenanceMode {
get {
return _maintenanceMode;
}
set {
this._maintenanceMode = value;
}
}
[JsonIgnore]
public EMulticast? NUMulticast {
get {
return _multicast;
}
set {
this._multicast = value;
}
}
[JsonIgnore]
public String NUName {
get {
return _name;
}
set {
this._name = value;
}
}
[JsonIgnore]
public String NUNetmask {
get {
return _netmask;
}
set {
this._netmask = value;
}
}
[JsonIgnore]
public String NUOwner {
get {
return _owner;
}
set {
this._owner = value;
}
}
[JsonIgnore]
public EPolicyChangeStatus? NUPolicyChangeStatus {
get {
return _policyChangeStatus;
}
set {
this._policyChangeStatus = value;
}
}
[JsonIgnore]
public String NURouteDistinguisher {
get {
return _routeDistinguisher;
}
set {
this._routeDistinguisher = value;
}
}
[JsonIgnore]
public String NURouteTarget {
get {
return _routeTarget;
}
set {
this._routeTarget = value;
}
}
[JsonIgnore]
public bool NURoutedVPLSEnabled {
get {
return _routedVPLSEnabled;
}
set {
this._routedVPLSEnabled = value;
}
}
[JsonIgnore]
public long? NUServiceID {
get {
return _serviceID;
}
set {
this._serviceID = value;
}
}
[JsonIgnore]
public bool NUStretched {
get {
return _stretched;
}
set {
this._stretched = value;
}
}
[JsonIgnore]
public String NUTemplateID {
get {
return _templateID;
}
set {
this._templateID = value;
}
}
[JsonIgnore]
public EThreatIntelligenceEnabled? NUThreatIntelligenceEnabled {
get {
return _threatIntelligenceEnabled;
}
set {
this._threatIntelligenceEnabled = value;
}
}
[JsonIgnore]
public EUplinkPreference? NUUplinkPreference {
get {
return _uplinkPreference;
}
set {
this._uplinkPreference = value;
}
}
[JsonIgnore]
public EUseGlobalMAC? NUUseGlobalMAC {
get {
return _useGlobalMAC;
}
set {
this._useGlobalMAC = value;
}
}
[JsonIgnore]
public long? NUVnId {
get {
return _vnId;
}
set {
this._vnId = value;
}
}
public AddressRangesFetcher getAddressRanges() {
return _addressRanges;
}
public AlarmsFetcher getAlarms() {
return _alarms;
}
public ApplicationsFetcher getApplications() {
return _applications;
}
public ApplicationperformancemanagementbindingsFetcher getApplicationperformancemanagementbindings() {
return _applicationperformancemanagementbindings;
}
public BridgeInterfacesFetcher getBridgeInterfaces() {
return _bridgeInterfaces;
}
public ContainersFetcher getContainers() {
return _containers;
}
public ContainerInterfacesFetcher getContainerInterfaces() {
return _containerInterfaces;
}
public DeploymentFailuresFetcher getDeploymentFailures() {
return _deploymentFailures;
}
public DHCPOptionsFetcher getDHCPOptions() {
return _dHCPOptions;
}
public DHCPv6OptionsFetcher getDHCPv6Options() {
return _dHCPv6Options;
}
public EgressACLEntryTemplatesFetcher getEgressACLEntryTemplates() {
return _egressACLEntryTemplates;
}
public EgressACLTemplatesFetcher getEgressACLTemplates() {
return _egressACLTemplates;
}
public EgressAdvFwdTemplatesFetcher getEgressAdvFwdTemplates() {
return _egressAdvFwdTemplates;
}
public EgressAuditACLEntryTemplatesFetcher getEgressAuditACLEntryTemplates() {
return _egressAuditACLEntryTemplates;
}
public EgressAuditACLTemplatesFetcher getEgressAuditACLTemplates() {
return _egressAuditACLTemplates;
}
public EventLogsFetcher getEventLogs() {
return _eventLogs;
}
public GatewaysFetcher getGateways() {
return _gateways;
}
public GlobalMetadatasFetcher getGlobalMetadatas() {
return _globalMetadatas;
}
public GroupsFetcher getGroups() {
return _groups;
}
public HostInterfacesFetcher getHostInterfaces() {
return _hostInterfaces;
}
public IngressACLEntryTemplatesFetcher getIngressACLEntryTemplates() {
return _ingressACLEntryTemplates;
}
public IngressACLTemplatesFetcher getIngressACLTemplates() {
return _ingressACLTemplates;
}
public IngressAdvFwdTemplatesFetcher getIngressAdvFwdTemplates() {
return _ingressAdvFwdTemplates;
}
public IngressAuditACLEntryTemplatesFetcher getIngressAuditACLEntryTemplates() {
return _ingressAuditACLEntryTemplates;
}
public IngressAuditACLTemplatesFetcher getIngressAuditACLTemplates() {
return _ingressAuditACLTemplates;
}
public JobsFetcher getJobs() {
return _jobs;
}
public MetadatasFetcher getMetadatas() {
return _metadatas;
}
public MirrorDestinationGroupsFetcher getMirrorDestinationGroups() {
return _mirrorDestinationGroups;
}
public NetworkPerformanceBindingsFetcher getNetworkPerformanceBindings() {
return _networkPerformanceBindings;
}
public NSGatewaySummariesFetcher getNSGatewaySummaries() {
return _nSGatewaySummaries;
}
public OverlayMirrorDestinationsFetcher getOverlayMirrorDestinations() {
return _overlayMirrorDestinations;
}
public PermissionsFetcher getPermissions() {
return _permissions;
}
public PGExpressionsFetcher getPGExpressions() {
return _pGExpressions;
}
public PolicyGroupsFetcher getPolicyGroups() {
return _policyGroups;
}
public ProxyARPFiltersFetcher getProxyARPFilters() {
return _proxyARPFilters;
}
public QOSsFetcher getQOSs() {
return _qOSs;
}
public RedirectionTargetsFetcher getRedirectionTargets() {
return _redirectionTargets;
}
public RedundancyGroupsFetcher getRedundancyGroups() {
return _redundancyGroups;
}
public StaticRoutesFetcher getStaticRoutes() {
return _staticRoutes;
}
public StatisticsFetcher getStatistics() {
return _statistics;
}
public StatisticsPoliciesFetcher getStatisticsPolicies() {
return _statisticsPolicies;
}
public TCAsFetcher getTCAs() {
return _tCAs;
}
public UplinkRDsFetcher getUplinkRDs() {
return _uplinkRDs;
}
public VirtualFirewallPoliciesFetcher getVirtualFirewallPolicies() {
return _virtualFirewallPolicies;
}
public VirtualFirewallRulesFetcher getVirtualFirewallRules() {
return _virtualFirewallRules;
}
public VMsFetcher getVMs() {
return _vMs;
}
public VMInterfacesFetcher getVMInterfaces() {
return _vMInterfaces;
}
public VMIPReservationsFetcher getVMIPReservations() {
return _vMIPReservations;
}
public VPNConnectionsFetcher getVPNConnections() {
return _vPNConnections;
}
public VPortsFetcher getVPorts() {
return _vPorts;
}
public String toString() {
return "L2Domain [" + "DHCPManaged=" + _DHCPManaged + ", DPI=" + _DPI + ", IPType=" + _IPType + ", IPv6Address=" + _IPv6Address + ", IPv6Gateway=" + _IPv6Gateway + ", VXLANECMPEnabled=" + _VXLANECMPEnabled + ", address=" + _address + ", associatedMulticastChannelMapID=" + _associatedMulticastChannelMapID + ", associatedSharedNetworkResourceID=" + _associatedSharedNetworkResourceID + ", associatedUnderlayID=" + _associatedUnderlayID + ", color=" + _color + ", creationDate=" + _creationDate + ", customerID=" + _customerID + ", description=" + _description + ", dualStackDynamicIPAllocation=" + _dualStackDynamicIPAllocation + ", embeddedMetadata=" + _embeddedMetadata + ", enableDHCPv4=" + _enableDHCPv4 + ", enableDHCPv6=" + _enableDHCPv6 + ", encryption=" + _encryption + ", entityScope=" + _entityScope + ", entityState=" + _entityState + ", externalID=" + _externalID + ", flowCollectionEnabled=" + _flowCollectionEnabled + ", flowCount=" + _flowCount + ", flowLimitEnabled=" + _flowLimitEnabled + ", gateway=" + _gateway + ", gatewayMACAddress=" + _gatewayMACAddress + ", ingressReplicationEnabled=" + _ingressReplicationEnabled + ", interfaceID=" + _interfaceID + ", l2EncapType=" + _l2EncapType + ", lastUpdatedBy=" + _lastUpdatedBy + ", lastUpdatedDate=" + _lastUpdatedDate + ", maintenanceMode=" + _maintenanceMode + ", multicast=" + _multicast + ", name=" + _name + ", netmask=" + _netmask + ", owner=" + _owner + ", policyChangeStatus=" + _policyChangeStatus + ", routeDistinguisher=" + _routeDistinguisher + ", routeTarget=" + _routeTarget + ", routedVPLSEnabled=" + _routedVPLSEnabled + ", serviceID=" + _serviceID + ", stretched=" + _stretched + ", templateID=" + _templateID + ", threatIntelligenceEnabled=" + _threatIntelligenceEnabled + ", uplinkPreference=" + _uplinkPreference + ", useGlobalMAC=" + _useGlobalMAC + ", vnId=" + _vnId + ", id=" + NUId + ", parentId=" + NUParentId + ", parentType=" + NUParentType + "]";
}
public static String getResourceName()
{
return "l2domains";
}
public static String getRestName()
{
return "l2domain";
}
}
} | 24.483471 | 1,948 | 0.668017 | [
"BSD-3-Clause"
] | nuagenetworks/vspk-csharp | vspk/vspk/L2Domain.cs | 29,625 | C# |
using System.Threading.Tasks;
using Tweetinvi.Models;
namespace Tweetinvi
{
public static class RateLimitAsync
{
public static async Task<ICredentialsRateLimits> GetCurrentCredentialsRateLimits()
{
return await Sync.ExecuteTaskAsync(() => RateLimit.GetCurrentCredentialsRateLimits());
}
public static async Task<ICredentialsRateLimits> GetCredentialsRateLimits(ITwitterCredentials credentials)
{
return await Sync.ExecuteTaskAsync(() => RateLimit.GetCredentialsRateLimits(credentials));
}
}
}
| 30.526316 | 114 | 0.708621 | [
"MIT"
] | evadremlab/tweetinvi-1.3-issue-850-fix | Tweetinvi/RateLimitAsync.cs | 582 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InfectionSpawner : MonoBehaviour
{
public float minRadius = 3f;
public float maxRadius = 7f;
public int pointAmount = 100;
public GameObject prefab;
public int InfectionChance = 20;
bool spawning;
void Start()
{
spawning = true;
StartCoroutine(SpawnerTimer());
}
public Vector2 RandomPointInAnnulus(Vector2 origin, float minRadius, float maxRadius)
{
var randomDirection = (Random.insideUnitCircle * origin).normalized;
var randomDistance = Random.Range(minRadius, maxRadius);
var point = origin + randomDirection * randomDistance;
return point;
}
IEnumerator SpawnerTimer()
{
while (true)
{
if (spawning == true)
{
yield return new WaitForSeconds(5);
float infectionRoll = Random.Range(1, 100);
if (infectionRoll <= InfectionChance)
{
Spawninfection();
}
}
}
}
void Spawninfection()
{
var origin = transform.position;
for (int i = 0; i < pointAmount; i++)
{
var pointToSpawnAt = RandomPointInAnnulus(origin, minRadius, maxRadius);
GameObject SpawnedInfection = Instantiate(prefab, pointToSpawnAt, prefab.transform.rotation);
MoveMeRandom SpawnedInfectionMovement = SpawnedInfection.GetComponent<MoveMeRandom>();
SpawnedInfectionMovement.body = this.gameObject;
}
}
} | 26.387097 | 105 | 0.603301 | [
"MIT"
] | rafalink1996/BodyIdle | Idle Body/Assets/Scripts/MedriTestingScripts/Infection/InfectionSpawner.cs | 1,638 | C# |
using System;
using essentialMix.Helpers;
using essentialMix.Web.Handlers;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
// ReSharper disable once CheckNamespace
namespace essentialMix.Extensions
{
public static class IEndpointRouteBuilderExtension
{
[NotNull]
public static IEndpointRouteBuilder MapAreaDefaultRoutes([NotNull] this IEndpointRouteBuilder thisValue, [AspMvcArea] string areaName, object defaults = null, string prefix = null)
{
areaName = areaName?.Trim();
if (string.IsNullOrEmpty(areaName)) throw new ArgumentNullException(nameof(areaName));
prefix = prefix?.Trim('/', ' ') ?? string.Empty;
string prefixWithArea = string.Join("/", prefix, areaName);
thisValue.MapAreaControllerRoute(null,
areaName,
prefixWithArea + "/{controller}/{action}/{id?}",
new
{
area = areaName,
action = "Index"
},
null,
new
{
UseNamespaceFallback = false
});
thisValue.MapAreaControllerRoute(areaName + "_default",
areaName,
prefixWithArea + "/{controller}/{action}/{id?}",
defaults ??
new
{
area = areaName,
controller = "Home",
action = "Index"
},
null,
new
{
UseNamespaceFallback = false
});
return thisValue;
}
[NotNull]
public static IEndpointRouteBuilder MapDefaultRoutes([NotNull] this IEndpointRouteBuilder thisValue, object defaults = null, string prefix = null, string swaggerUrl = null)
{
prefix = UriHelper.Trim(prefix);
if (!string.IsNullOrEmpty(prefix)) prefix += "/";
prefix ??= string.Empty;
thisValue.MapControllerRoute("areas",
prefix + "{area:exists}/{controller}/{action}/{id?}",
new
{
action = "Index"
},
null,
new
{
UseNamespaceFallback = false
});
if (!string.IsNullOrWhiteSpace(swaggerUrl))
{
thisValue.MapControllerRoute("Swagger",
string.Empty,
null,
null,
new RedirectHandler(swaggerUrl));
}
thisValue.MapControllerRoute("Default",
prefix + "{controller}/{action}/{id?}",
defaults ??
new
{
controller = "Home",
action = "Index"
},
null,
new
{
UseNamespaceFallback = false
});
return thisValue;
}
}
} | 26.484536 | 182 | 0.581938 | [
"MIT"
] | asm2025/asm | Core/essentialMix.Core.Web/Extensions/IEndpointRouteBuilderExtension.cs | 2,571 | C# |
using Pokloni.ba.WebAPI.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Pokloni.ba.Model.Requests.Proizvodi;
namespace Pokloni.ba.WebAPI.Services.Proizvodi
{
public interface IKategorijeService : IBaseInterface<Kategorije>
{
}
}
| 22.214286 | 68 | 0.787781 | [
"MIT"
] | tarikcosovic/Cross-Platform-Application-Pokloni.ba- | Pokloni.ba.WebAPI/Services/Proizvodi/IKategorijeService.cs | 313 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Concordion.Api.Extension;
namespace Concordion.Spec.Concordion.Extension.Configuration
{
public class ExampleFixtureWithFieldAttributes
{
[Extension]
public IConcordionExtension extension = new FakeExtension1();
[Extension]
public FakeExtension2 extension2 = new FakeExtension2();
}
}
| 23.823529 | 69 | 0.735802 | [
"ECL-2.0",
"Apache-2.0"
] | KidFashion/concordion-net | Concordion.Spec/Concordion/Extension/Configuration/ExampleFixtureWithFieldAttributes.cs | 407 | C# |
#if UNITY_EDITOR
using System;
using UnityEditor;
using UnityEngine;
namespace MufflonUtil
{
public class AssetModificationProcessor : UnityEditor.AssetModificationProcessor
{
public static event Action<ScriptableObject> DeletingScriptableObject;
public static event Action<GameObject> DeletingPrefab;
private static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
{
var asset = AssetDatabase.LoadAssetAtPath<ScriptableObject>(assetPath);
if (asset != null) DeletingScriptableObject?.Invoke(asset);
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
if (prefab != null) DeletingPrefab?.Invoke(prefab);
return AssetDeleteResult.DidNotDelete;
}
}
}
#endif | 34.125 | 104 | 0.71917 | [
"MIT"
] | OJuergen/MufflonUtil | Assets/MufflonUtil/Runtime/AssetModificationProcessor.cs | 821 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace algos.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
| 34.193548 | 151 | 0.579245 | [
"MIT"
] | skotz/algos | visualizations/Properties/Settings.Designer.cs | 1,062 | C# |
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RubiksCube.OpenCV
{
public class Cube
{
// helper function:
// finds a cosine of angle between vectors
// from pt0->pt1 and from pt0->pt2
static double Angle(Point pt1, Point pt2, Point pt0)
{
double dx1 = pt1.X - pt0.X;
double dy1 = pt1.Y - pt0.Y;
double dx2 = pt2.X - pt0.X;
double dy2 = pt2.Y - pt0.Y;
return (dx1 * dx2 + dy1 * dy2) / Math.Sqrt((dx1 * dx1 + dy1 * dy1) * (dx2 * dx2 + dy2 * dy2) + 1e-10);
}
public static void DrawSquares(Mat image, List<List<Point>> squares)
{
for (int i = 0; i < squares.Count; i++)
{
Point p = squares[i][0];
int n = (int)squares[i].Count;
int shift = 1;
Rect r = Cv2.BoundingRect(InputArray.Create<Point>(squares[i]));
r.X = r.X + r.Width / 4;
r.Y = r.Y + r.Height / 4;
r.Width = r.Width / 2;
r.Height = r.Height / 2;
Mat roi = new Mat(image, r);
Scalar color = Scalar.Red;// Cv2.Mean(roi);
Cv2.Polylines(image, squares, true, color, 2, LineTypes.AntiAlias, shift);
var center = new Point(r.X + r.Width / 2, r.Y + r.Height / 2);
Cv2.Ellipse(image, center, new Size(r.Width / 2, r.Height / 2), 0, 0, 360, color, 2, LineTypes.AntiAlias);
}
}
// returns sequence of squares detected on the image.
// the sequence is stored in the specified memory storage
public static void FindSquares(Mat image, List<List<Point>> squares, bool inv = false)
{
squares.Clear();
Mat grey = image.CvtColor(ColorConversionCodes.BGR2GRAY);
Mat blur = grey.GaussianBlur(new Size(7, 7), 1.5, 1.5);
Mat canny = blur.Canny(0, 30, 3);
// find contours and store them all as a list
Point[][] contours;
HierarchyIndex[] hierarchIndex;
canny.FindContours(out contours, out hierarchIndex, RetrievalModes.List, ContourApproximationModes.ApproxSimple);
// test each contour
for (int i = 0; i < contours.Count(); i++)
{
// approximate contour with accuracy proportional
// to the contour perimeter
//List<Point> approx;
var approx = new List<Point>(contours[i]);
Cv2.ApproxPolyDP(approx, 9, true);
// square contours should have 4 vertices after approximation
// relatively large area (to filter out noisy contours)
// and be convex.
// Note: absolute value of an area is used because
// area may be positive or negative - in accordance with the
// contour orientation
if (approx.Count == 4 && Math.Abs(Cv2.ContourArea(approx)) > 5 && Cv2.IsContourConvex(approx))
{
double maxCosine = 0;
for (int j = 2; j < 5; j++)
{
// find the maximum cosine of the angle between joint edges
double cosine = Math.Abs(Angle(approx[j % 4], approx[j - 2], approx[j - 1]));
maxCosine = Math.Max(maxCosine, cosine);
}
// if cosines of all angles are small
// (all angles are ~90 degree) then write quandrange
// vertices to resultant sequence
if (maxCosine < 0.3)
squares.Add(approx);
}
}
}
}
} | 39.693878 | 125 | 0.510026 | [
"MIT"
] | Lewis945/RubiksCubeSolver | src/RubiksCube.OpenCV/Cube.cs | 3,892 | C# |
namespace RiftDotNet
{
public interface IHMDDevice
: IDevice
{
new IHMDInfo Info { get; }
ISensorDevice Sensor { get; }
}
} | 15.666667 | 32 | 0.64539 | [
"MIT"
] | tomjal/RiftDotNet | development/RiftDotNet.Interface/IHMDDevice.cs | 143 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;
using Newtonsoft.Json;
namespace AppInsightsMVCFilters
{
public class TelemetryHelper
{
public TelemetryClient TelemetryClient { get; private set; }
private static readonly TelemetryClient TelemetryClientSingleton = new TelemetryClient();
RequestTelemetry _telemetry = null;
private Stopwatch _stopwatch = null;
public TelemetryHelper()
{
TelemetryClient = TelemetryClientSingleton;
}
public void Start(string methodName)
{
_telemetry = new RequestTelemetry();
_telemetry.Context.Operation.Id = Guid.NewGuid().ToString();
_telemetry.Context.Operation.Name = methodName;
_stopwatch = Stopwatch.StartNew();
}
public void TrackRequest(string httpStatusCode, string methodName, bool isCallSuccess)
{
_stopwatch.Stop();
TelemetryClient.TrackRequest(methodName, DateTimeOffset.UtcNow, _stopwatch.Elapsed, httpStatusCode, isCallSuccess);
}
public void LogPayload(HttpContent content, string eventName)
{
if (content != null)
{
var objectContent = content as ObjectContent;
var payload = objectContent?.Value;
var objectType = objectContent?.ObjectType;
var payloadJson =JsonConvert.SerializeObject(payload);
TelemetryClient.TrackEvent(eventName, new Dictionary<string, string>() { { "type", objectType?.ToString() },{ eventName, payloadJson} });
}
}
public void TrackException(Exception ex, string methodName)
{
TelemetryClient.TrackException(ex, new Dictionary<string, string>() { { "MethodName", methodName }, { "StackTrace", ex.StackTrace }, { "InnerException", ex.InnerException?.ToString() } });
}
}
}
| 38.581818 | 201 | 0.63525 | [
"MIT"
] | ip28/AppInsightsMVCFilters | AppInsightsMVCFilters/AppInsightsMVCFilters/TelemetryHelper.cs | 2,124 | C# |
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Shark.Net.Server
{
public interface ISharkServer : IDisposable
{
IServiceProvider ServiceProvider { get; }
bool Disposed { get; }
IDictionary<int, ISharkClient> Clients { get; }
event Action<ISharkClient> OnConnected;
ILogger Logger { get; }
ISharkServer OnClientConnected(Action<ISharkClient> onConnected);
void RemoveClient(ISharkClient client);
void RemoveClient(int id);
Task Start(CancellationToken token);
}
}
| 28.304348 | 73 | 0.700461 | [
"MIT"
] | Norgerman/Shark | Shark.Commons/Net/Server/ISharkServer.cs | 653 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace ShareTube.Core.Models
{
//public abstract class BaseEntity<TKey>
//{
// public abstract TKey Id { get; set; }
//}
//public class Entity : BaseEntity<long>
//{
// public override long Id { get; set; }
//}
public class Entity
{
public DateTime CreatedDate { get; set; }
public DateTime? UpdatedDate { get; set; }
}
}
| 20.130435 | 50 | 0.600432 | [
"MIT"
] | DrLeh/ShareTube | ShareTube.Core/Models/Entity.cs | 465 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace InventoryManagementSystem
{
public partial class Loadingcs : Form
{
public Loadingcs()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
panelFill.Width += 3;
if (panelFill.Width >= 700)
{
timer1.Stop();
MDI mdi = new MDI();
mdi.Show();
this.Hide();
}
}
}
}
| 22.212121 | 61 | 0.53206 | [
"MIT"
] | Pro-procrastinator/CheckOut | InventoryManagementSystem/Loadingcs.cs | 735 | C# |
using Microsoft.AspNetCore.Connections;
using MQTTnet.Adapter;
using MQTTnet.Serializer;
using MQTTnet.Server;
using System;
using System.Threading.Tasks;
namespace MQTTnet.AspNetCore
{
public class MqttConnectionHandler : ConnectionHandler, IMqttServerAdapter
{
public event EventHandler<MqttServerAdapterClientAcceptedEventArgs> ClientAccepted;
public override async Task OnConnectedAsync(ConnectionContext connection)
{
var serializer = new MqttPacketSerializer();
using (var adapter = new MqttConnectionContext(serializer, connection))
{
var args = new MqttServerAdapterClientAcceptedEventArgs(adapter);
ClientAccepted?.Invoke(this, args);
await args.SessionTask;
}
}
public Task StartAsync(IMqttServerOptions options)
{
return Task.CompletedTask;
}
public Task StopAsync()
{
return Task.CompletedTask;
}
public void Dispose()
{
}
}
}
| 26.780488 | 91 | 0.631148 | [
"MIT"
] | lvmingzhou/mqtt.github.io | Source/MQTTnet.AspnetCore/MqttConnectionHandler.cs | 1,100 | C# |
using Cosmos.Business.Extensions.Holiday.Core;
using Cosmos.I18N.Countries;
namespace Cosmos.Business.Extensions.Holiday.Definitions.Oceania.NewZealand.Religion
{
/// <summary>
/// Boxing Day
/// </summary>
public class BoxingDay : WeekShiftVariableHolidayFunc
{
/// <inheritdoc />
public override Country Country { get; } = Country.NewZealand;
/// <inheritdoc />
public override Country BelongsToCountry { get; } = Country.NewZealand;
/// <inheritdoc />
public override string Name { get; } = "Boxing Day";
/// <inheritdoc />
public override HolidayType HolidayType { get; set; } = HolidayType.Religion;
/// <inheritdoc />
public override int Month { get; } = 12;
/// <inheritdoc />
public override int Day { get; } = 26;
/// <inheritdoc />
protected override int SaturdayShift { get; } = 2;
/// <inheritdoc />
protected override int SundayShift { get; } = 2;
/// <inheritdoc />
public override string I18NIdentityCode { get; } = "i18n_holiday_nz_boxing";
}
} | 29.921053 | 85 | 0.605101 | [
"Apache-2.0"
] | cosmos-open/Holiday | src/Cosmos.Business.Extensions.Holiday/Cosmos/Business/Extensions/Holiday/Definitions/Oceania/NewZealand/Religion/BoxingDay.cs | 1,137 | C# |
#region MigraDoc - Creating Documents on the Fly
//
// Authors:
// Stefan Lange (mailto:Stefan.Lange@PdfSharpCore.com)
// Klaus Potzesny (mailto:Klaus.Potzesny@PdfSharpCore.com)
// David Stephensen (mailto:David.Stephensen@PdfSharpCore.com)
//
// Copyright (c) 2001-2009 empira Software GmbH, Cologne (Germany)
//
// http://www.PdfSharpCore.com
// http://www.migradoc.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace MigraDocCore.DocumentObjectModel.Internals
{
/// <summary>
/// Represents a nullable boolean value.
/// </summary>
internal struct NBool : INullableValue
{
public NBool(bool value)
{
_val = value ? (sbyte) 1 : (sbyte) 0;
}
private NBool(sbyte value)
{
_val = value;
}
/// <summary>
/// Gets or sets the value of the instance.
/// </summary>
public bool Value
{
get => _val == 1;
set => _val = value ? (sbyte) 1 : (sbyte) 0;
}
/// <summary>
/// Gets the value of the instance.
/// </summary>
object INullableValue.GetValue()
{
return Value;
}
/// <summary>
/// Sets the value of the instance.
/// </summary>
void INullableValue.SetValue(object value)
{
_val = (bool) value ? (sbyte) 1 : (sbyte) 0;
}
/// <summary>
/// Resets this instance,
/// i.e. IsNull() will return true afterwards.
/// </summary>
public void SetNull()
{
_val = -1;
}
/// <summary>
/// Determines whether this instance is null (not set).
/// </summary>
public bool IsNull => _val == -1;
/// <summary>
/// Returns a value indicating whether this instance is equal to the specified object.
/// </summary>
public override bool Equals(object value)
{
if (value is NBool)
return this == (NBool) value;
return false;
}
public override int GetHashCode()
{
return _val.GetHashCode();
}
public static bool operator ==(NBool l, NBool r)
{
if (l.IsNull)
return r.IsNull;
if (r.IsNull)
return false;
return l.Value == r.Value;
}
public static bool operator !=(NBool l, NBool r)
{
return !(l == r);
}
public static readonly NBool NullValue = new(-1);
/// <summary>
/// -1 (undefined), 0 (false), or 1 (true).
/// </summary>
private sbyte _val;
}
} | 30.283465 | 98 | 0.577483 | [
"MIT"
] | aavilaco/PdfSharpCore | MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NBool.cs | 3,846 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace Universe
{
public class PersonClass
{
public string Title { get; set; }
public string Name { get; set; }
public int? Age { get; set; }
public PersonClass(string title, string name, int? age = null)
{
Title = title;
Name = name;
Age = age;
}
public override string ToString()
{
return $"{nameof(Title)}: {Title ?? "<null>"}, {nameof(Name)}: {Name}, {nameof(Age)}: {Age}";
}
}
}
| 21.964286 | 105 | 0.534959 | [
"MIT"
] | devizer/Universe.YetAnotherComparerBuilder | Universe.YetAnotherComparerBuilder.Demo/Person.cs | 617 | C# |
// *** WARNING: this file was generated by crd2pulumi. ***
// *** 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.Kubernetes.Types.Inputs.Monitoring.V1
{
/// <summary>
/// EmptyDirVolumeSource to be used by the Prometheus StatefulSets. If specified, used in place of any volumeClaimTemplate. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
/// </summary>
public class AlertmanagerSpecStorageEmptyDirArgs : Pulumi.ResourceArgs
{
/// <summary>
/// What type of storage medium should back this directory. The default is "" which means to use the node's default medium. Must be an empty string (default) or Memory. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
/// </summary>
[Input("medium")]
public Input<string>? Medium { get; set; }
/// <summary>
/// Total amount of local storage required for this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. The default is nil which means that the limit is undefined. More info: http://kubernetes.io/docs/user-guide/volumes#emptydir
/// </summary>
[Input("sizeLimit")]
public Input<string>? SizeLimit { get; set; }
public AlertmanagerSpecStorageEmptyDirArgs()
{
}
}
}
| 47.542857 | 419 | 0.705529 | [
"Apache-2.0"
] | pulumi/pulumi-kubernetes-crds | operators/prometheus/dotnet/Kubernetes/Crds/Operators/Prometheus/Monitoring/V1/Inputs/AlertmanagerSpecStorageEmptyDirArgs.cs | 1,664 | C# |
// Smdn.Fundamental.Xml.Xhtml.dll (Smdn.Fundamental.Xml.Xhtml-3.0.0 (net45))
// Name: Smdn.Fundamental.Xml.Xhtml
// AssemblyVersion: 3.0.0.0
// InformationalVersion: 3.0.0 (net45)
// TargetFramework: .NETFramework,Version=v4.5
// Configuration: Release
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Smdn.Xml.Xhtml;
namespace Smdn.Xml.Linq.Xhtml {
public static class Extensions {
public static XElement GetElementById(this XContainer container, string id) {}
public static bool HasHtmlClass(this XElement element, IEnumerable<string> classList) {}
public static bool HasHtmlClass(this XElement element, string @class) {}
}
public static class XHtmlAttributeNames {
public static readonly XName AccessKey; // = "accesskey"
public static readonly XName Alt; // = "alt"
public static readonly XName Cite; // = "cite"
public static readonly XName Class; // = "class"
public static readonly XName ContentEditable; // = "contenteditable"
public static readonly XName Dir; // = "dir"
public static readonly XName Download; // = "download"
public static readonly XName Draggable; // = "draggable"
public static readonly XName Hidden; // = "hidden"
public static readonly XName Href; // = "href"
public static readonly XName HrefLang; // = "hreflang"
public static readonly XName Id; // = "id"
public static readonly XName Lang; // = "lang"
public static readonly XName Media; // = "media"
public static readonly XName Rel; // = "rel"
public static readonly XName SpellCheck; // = "spellcheck"
public static readonly XName Src; // = "src"
public static readonly XName Style; // = "style"
public static readonly XName TabIndex; // = "tabindex"
public static readonly XName Target; // = "target"
public static readonly XName Title; // = "title"
public static readonly XName Translate; // = "translate"
public static readonly XName Type; // = "type"
}
public class XHtmlClassAttribute : XAttribute {
public XHtmlClassAttribute(IEnumerable<string> classList) {}
public XHtmlClassAttribute(params string[] classList) {}
public XHtmlClassAttribute(string @class) {}
public static string JoinClassList(IEnumerable<string> classList) {}
}
public static class XHtmlElementNames {
public static readonly XName A; // = "{http://www.w3.org/1999/xhtml}a"
public static readonly XName Abbr; // = "{http://www.w3.org/1999/xhtml}abbr"
public static readonly XName Address; // = "{http://www.w3.org/1999/xhtml}address"
public static readonly XName Area; // = "{http://www.w3.org/1999/xhtml}area"
public static readonly XName Article; // = "{http://www.w3.org/1999/xhtml}article"
public static readonly XName Aside; // = "{http://www.w3.org/1999/xhtml}aside"
public static readonly XName Audio; // = "{http://www.w3.org/1999/xhtml}audio"
public static readonly XName B; // = "{http://www.w3.org/1999/xhtml}b"
public static readonly XName BR; // = "{http://www.w3.org/1999/xhtml}br"
public static readonly XName Base; // = "{http://www.w3.org/1999/xhtml}base"
public static readonly XName Blockquote; // = "{http://www.w3.org/1999/xhtml}blockquote"
public static readonly XName Body; // = "{http://www.w3.org/1999/xhtml}body"
public static readonly XName Button; // = "{http://www.w3.org/1999/xhtml}button"
public static readonly XName Canvas; // = "{http://www.w3.org/1999/xhtml}canvas"
public static readonly XName Caption; // = "{http://www.w3.org/1999/xhtml}caption"
public static readonly XName Cite; // = "{http://www.w3.org/1999/xhtml}cite"
public static readonly XName Code; // = "{http://www.w3.org/1999/xhtml}code"
public static readonly XName Col; // = "{http://www.w3.org/1999/xhtml}col"
public static readonly XName ColGroup; // = "{http://www.w3.org/1999/xhtml}colgroup"
public static readonly XName DBI; // = "{http://www.w3.org/1999/xhtml}dbi"
public static readonly XName DBO; // = "{http://www.w3.org/1999/xhtml}dbo"
public static readonly XName DD; // = "{http://www.w3.org/1999/xhtml}dd"
public static readonly XName DL; // = "{http://www.w3.org/1999/xhtml}dl"
public static readonly XName DT; // = "{http://www.w3.org/1999/xhtml}dt"
public static readonly XName Data; // = "{http://www.w3.org/1999/xhtml}data"
public static readonly XName DataList; // = "{http://www.w3.org/1999/xhtml}datalist"
public static readonly XName Del; // = "{http://www.w3.org/1999/xhtml}del"
public static readonly XName Details; // = "{http://www.w3.org/1999/xhtml}details"
public static readonly XName Dfn; // = "{http://www.w3.org/1999/xhtml}dfn"
public static readonly XName Dialog; // = "{http://www.w3.org/1999/xhtml}dialog"
public static readonly XName Div; // = "{http://www.w3.org/1999/xhtml}div"
public static readonly XName EM; // = "{http://www.w3.org/1999/xhtml}em"
public static readonly XName Embed; // = "{http://www.w3.org/1999/xhtml}embed"
public static readonly XName FieldSet; // = "{http://www.w3.org/1999/xhtml}fieldset"
public static readonly XName FigCaption; // = "{http://www.w3.org/1999/xhtml}figcaption"
public static readonly XName Figure; // = "{http://www.w3.org/1999/xhtml}figure"
public static readonly XName Footer; // = "{http://www.w3.org/1999/xhtml}footer"
public static readonly XName Form; // = "{http://www.w3.org/1999/xhtml}form"
public static readonly XName H1; // = "{http://www.w3.org/1999/xhtml}h1"
public static readonly XName H2; // = "{http://www.w3.org/1999/xhtml}h2"
public static readonly XName H3; // = "{http://www.w3.org/1999/xhtml}h3"
public static readonly XName H4; // = "{http://www.w3.org/1999/xhtml}h4"
public static readonly XName H5; // = "{http://www.w3.org/1999/xhtml}h5"
public static readonly XName H6; // = "{http://www.w3.org/1999/xhtml}h6"
public static readonly XName HR; // = "{http://www.w3.org/1999/xhtml}hr"
public static readonly XName Head; // = "{http://www.w3.org/1999/xhtml}head"
public static readonly XName Header; // = "{http://www.w3.org/1999/xhtml}header"
public static readonly XName Html; // = "{http://www.w3.org/1999/xhtml}html"
public static readonly XName I; // = "{http://www.w3.org/1999/xhtml}i"
public static readonly XName IFrame; // = "{http://www.w3.org/1999/xhtml}iframe"
public static readonly XName Img; // = "{http://www.w3.org/1999/xhtml}img"
public static readonly XName Input; // = "{http://www.w3.org/1999/xhtml}input"
public static readonly XName Ins; // = "{http://www.w3.org/1999/xhtml}ins"
public static readonly XName Kbd; // = "{http://www.w3.org/1999/xhtml}kbd"
public static readonly XName LI; // = "{http://www.w3.org/1999/xhtml}li"
public static readonly XName Label; // = "{http://www.w3.org/1999/xhtml}label"
public static readonly XName Legend; // = "{http://www.w3.org/1999/xhtml}legend"
public static readonly XName Link; // = "{http://www.w3.org/1999/xhtml}link"
public static readonly XName Main; // = "{http://www.w3.org/1999/xhtml}main"
public static readonly XName Map; // = "{http://www.w3.org/1999/xhtml}map"
public static readonly XName Mark; // = "{http://www.w3.org/1999/xhtml}mark"
public static readonly XName Math; // = "{http://www.w3.org/1998/Math/MathML}math"
public static readonly XName Meta; // = "{http://www.w3.org/1999/xhtml}meta"
public static readonly XName Meter; // = "{http://www.w3.org/1999/xhtml}meter"
public static readonly XName Nav; // = "{http://www.w3.org/1999/xhtml}nav"
public static readonly XName NoScript; // = "{http://www.w3.org/1999/xhtml}noscript"
public static readonly XName OL; // = "{http://www.w3.org/1999/xhtml}ol"
public static readonly XName Object; // = "{http://www.w3.org/1999/xhtml}object"
public static readonly XName OptGroup; // = "{http://www.w3.org/1999/xhtml}optgroup"
public static readonly XName Option; // = "{http://www.w3.org/1999/xhtml}option"
public static readonly XName Output; // = "{http://www.w3.org/1999/xhtml}output"
public static readonly XName P; // = "{http://www.w3.org/1999/xhtml}p"
public static readonly XName Param; // = "{http://www.w3.org/1999/xhtml}param"
public static readonly XName Picture; // = "{http://www.w3.org/1999/xhtml}picture"
public static readonly XName Pre; // = "{http://www.w3.org/1999/xhtml}pre"
public static readonly XName Progress; // = "{http://www.w3.org/1999/xhtml}progress"
public static readonly XName Q; // = "{http://www.w3.org/1999/xhtml}q"
public static readonly XName RB; // = "{http://www.w3.org/1999/xhtml}rb"
public static readonly XName RP; // = "{http://www.w3.org/1999/xhtml}rp"
public static readonly XName RT; // = "{http://www.w3.org/1999/xhtml}rt"
public static readonly XName RTC; // = "{http://www.w3.org/1999/xhtml}rtc"
public static readonly XName Ruby; // = "{http://www.w3.org/1999/xhtml}ruby"
public static readonly XName S; // = "{http://www.w3.org/1999/xhtml}s"
public static readonly XName SVG; // = "{http://www.w3.org/2000/svg}svg"
public static readonly XName Samp; // = "{http://www.w3.org/1999/xhtml}samp"
public static readonly XName Script; // = "{http://www.w3.org/1999/xhtml}script"
public static readonly XName Section; // = "{http://www.w3.org/1999/xhtml}section"
public static readonly XName Select; // = "{http://www.w3.org/1999/xhtml}select"
public static readonly XName Small; // = "{http://www.w3.org/1999/xhtml}small"
public static readonly XName Source; // = "{http://www.w3.org/1999/xhtml}source"
public static readonly XName Span; // = "{http://www.w3.org/1999/xhtml}span"
public static readonly XName Strong; // = "{http://www.w3.org/1999/xhtml}strong"
public static readonly XName Style; // = "{http://www.w3.org/1999/xhtml}style"
public static readonly XName Sub; // = "{http://www.w3.org/1999/xhtml}sub"
public static readonly XName Summary; // = "{http://www.w3.org/1999/xhtml}summary"
public static readonly XName Sup; // = "{http://www.w3.org/1999/xhtml}sup"
public static readonly XName TBody; // = "{http://www.w3.org/1999/xhtml}tbody"
public static readonly XName TD; // = "{http://www.w3.org/1999/xhtml}td"
public static readonly XName TFoot; // = "{http://www.w3.org/1999/xhtml}tfoot"
public static readonly XName TH; // = "{http://www.w3.org/1999/xhtml}th"
public static readonly XName THead; // = "{http://www.w3.org/1999/xhtml}thead"
public static readonly XName TR; // = "{http://www.w3.org/1999/xhtml}tr"
public static readonly XName Table; // = "{http://www.w3.org/1999/xhtml}table"
public static readonly XName Template; // = "{http://www.w3.org/1999/xhtml}template"
public static readonly XName TextArea; // = "{http://www.w3.org/1999/xhtml}textarea"
public static readonly XName Time; // = "{http://www.w3.org/1999/xhtml}time"
public static readonly XName Title; // = "{http://www.w3.org/1999/xhtml}title"
public static readonly XName Track; // = "{http://www.w3.org/1999/xhtml}track"
public static readonly XName U; // = "{http://www.w3.org/1999/xhtml}u"
public static readonly XName UL; // = "{http://www.w3.org/1999/xhtml}ul"
public static readonly XName Var; // = "{http://www.w3.org/1999/xhtml}var"
public static readonly XName Video; // = "{http://www.w3.org/1999/xhtml}video"
public static readonly XName WBR; // = "{http://www.w3.org/1999/xhtml}wbr"
}
public static class XHtmlNamespaces {
public static readonly XNamespace Html; // = "http://www.w3.org/1999/xhtml"
public static readonly XNamespace MathML; // = "http://www.w3.org/1998/Math/MathML"
public static readonly XNamespace Svg; // = "http://www.w3.org/2000/svg"
public static readonly XNamespace XLink; // = "http://www.w3.org/1999/xlink"
}
public class XHtmlStyleAttribute : XAttribute {
public XHtmlStyleAttribute(IEnumerable<KeyValuePair<string, string>> styles) {}
public XHtmlStyleAttribute(IReadOnlyDictionary<string, string> styles) {}
public XHtmlStyleAttribute(KeyValuePair<string, string> style) {}
public XHtmlStyleAttribute(params KeyValuePair<string, string>[] styles) {}
protected static string ToJoined(IEnumerable<KeyValuePair<string, string>> styles) {}
protected static string ToJoined(KeyValuePair<string, string> style) {}
}
}
namespace Smdn.Xml.Xhtml {
public static class HtmlConvert {
public static string DecodeNumericCharacterReference(string s) {}
public static string EscapeHtml(ReadOnlySpan<char> s) {}
public static string EscapeXhtml(ReadOnlySpan<char> s) {}
public static string UnescapeHtml(ReadOnlySpan<char> s) {}
public static string UnescapeXhtml(ReadOnlySpan<char> s) {}
}
public class PolyglotHtml5Writer : XmlWriter {
protected enum ExtendedWriteState : int {
AttributeEnd = 6,
AttributeStart = 4,
AttributeValue = 5,
Closed = 12,
DocumentEnd = 11,
DocumentStart = 1,
ElementClosed = 10,
ElementClosing = 9,
ElementContent = 8,
ElementOpened = 7,
ElementOpening = 3,
Prolog = 2,
Start = 0,
}
public PolyglotHtml5Writer(Stream output, XmlWriterSettings settings = null) {}
public PolyglotHtml5Writer(StringBuilder output, XmlWriterSettings settings = null) {}
public PolyglotHtml5Writer(TextWriter output, XmlWriterSettings settings = null) {}
public PolyglotHtml5Writer(string outputFileName, XmlWriterSettings settings = null) {}
protected virtual XmlWriter BaseWriter { get; }
protected PolyglotHtml5Writer.ExtendedWriteState ExtendedState { get; }
public override XmlWriterSettings Settings { get; }
public override WriteState WriteState { get; }
public override string XmlLang { get; }
public override XmlSpace XmlSpace { get; }
protected override void Dispose(bool disposing) {}
public override void Flush() {}
public override string LookupPrefix(string ns) {}
public override void WriteBase64(byte[] buffer, int index, int count) {}
public override void WriteCData(string text) {}
public override void WriteCharEntity(char ch) {}
public override void WriteChars(char[] buffer, int index, int count) {}
public override void WriteComment(string text) {}
public override void WriteDocType(string name, string pubid, string sysid, string subset) {}
public override void WriteEndAttribute() {}
public override void WriteEndDocument() {}
public override void WriteEndElement() {}
public override void WriteEntityRef(string name) {}
public override void WriteFullEndElement() {}
protected virtual void WriteIndent() {}
public override void WriteProcessingInstruction(string name, string text) {}
public override void WriteRaw(char[] buffer, int index, int count) {}
public override void WriteRaw(string data) {}
public override void WriteStartAttribute(string prefix, string localName, string ns) {}
public override void WriteStartDocument() {}
public override void WriteStartDocument(bool standalone) {}
public override void WriteStartElement(string prefix, string localName, string ns) {}
public override void WriteString(string text) {}
public override void WriteSurrogateCharEntity(char lowChar, char highChar) {}
public override void WriteWhitespace(string ws) {}
}
public static class W3CNamespaces {
public const string Html = "http://www.w3.org/1999/xhtml";
public const string MathML = "http://www.w3.org/1998/Math/MathML";
public const string Svg = "http://www.w3.org/2000/svg";
public const string XLink = "http://www.w3.org/1999/xlink";
public const string Xhtml = "http://www.w3.org/1999/xhtml";
}
}
| 60.05283 | 96 | 0.689833 | [
"MIT"
] | smdn/Smdn.Fundamentals | doc/api-list/Smdn.Fundamental.Xml.Xhtml/Smdn.Fundamental.Xml.Xhtml-net45.apilist.cs | 15,914 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace User_logs
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, Dictionary<string, int>> site = new Dictionary<string, Dictionary<string, int>>();
string[] input = Console.ReadLine().Split(' ').ToArray();
string user;
string ip;
while (input[0] != "end")
{
string[] ipInput = input[0].Split('=').ToArray();
ip = ipInput[1];
string[] userInput = input[2].Split('=').ToArray();
user = userInput[1];
if (site.ContainsKey(user) == false)
{
Dictionary<string, int> current = new Dictionary<string, int>();
current.Add(ip, 1);
site.Add(user, current);
}
else
{
if (site[user].ContainsKey(ip) == false)
{
site[user].Add(ip, 1);
}
else
{
site[user][ip]++;
}
}
input = Console.ReadLine().Split(' ').ToArray();
}
foreach (var currUser in site.OrderBy(x => x.Key))
{
Console.WriteLine($"{currUser.Key}: ");
List<string> helper = new List<string>();
foreach (var ipPair in currUser.Value)
{
helper.Add($"{ipPair.Key} => {ipPair.Value}");
}
Console.WriteLine(string.Join(", ", helper) + ".");
}
}
}
}
| 28.095238 | 113 | 0.409605 | [
"MIT"
] | kostanikolov/SoftUni | Projects/ProgrammingFundamentalsWithCSharp/07. Dictionaries-Exercise/User-logs/Program.cs | 1,772 | C# |
namespace Game.Core.Enums
{
public enum MatchType
{
None = 0,
Green = 1,
Yellow = 2,
Blue = 3,
Red = 4,
Special = 5
}
} | 14.916667 | 25 | 0.424581 | [
"MIT"
] | mcertuzun/UnithonCase | Assets/Scripts/Game/Core/Enums/MatchType.cs | 179 | 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 UiPath.Web.Client201910.Models
{
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public partial class ListResultDtoNameValueDto
{
/// <summary>
/// Initializes a new instance of the ListResultDtoNameValueDto class.
/// </summary>
public ListResultDtoNameValueDto()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the ListResultDtoNameValueDto class.
/// </summary>
public ListResultDtoNameValueDto(IList<NameValueDto> items = default(IList<NameValueDto>))
{
Items = items;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "Items")]
public IList<NameValueDto> Items { get; set; }
}
}
| 27.733333 | 98 | 0.613782 | [
"MIT"
] | AFWberlin/orchestrator-powershell | UiPath.Web.Client/generated201910/Models/ListResultDtoNameValueDto.cs | 1,248 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class BallHandler : MonoBehaviour
{
// Start is called before the first frame update
private Camera maincamera;
public float detachtime;
private bool isDragging;
[SerializeField] private Rigidbody2D currentballRigidbody;
[SerializeField] private SpringJoint2D currentballSpringjoint;
void Start()
{
maincamera= Camera.main;
detachtime=2f;
}
// Update is called once per frame
void Update()
{
if (currentballRigidbody!=null)
{
if (Touchscreen.current.primaryTouch.press.IsPressed())
{ currentballRigidbody.isKinematic= true;
isDragging=true;
Vector2 touchpoint= Touchscreen.current.primaryTouch.position.ReadValue();
Vector3 worldtouchpoint= maincamera.ScreenToWorldPoint(touchpoint);
currentballRigidbody.isKinematic=true;
currentballRigidbody.position= worldtouchpoint;
}else
{
currentballRigidbody.isKinematic= false;
if(isDragging)
{
LaunchBall();
isDragging=false;
}
}
}
}
private void LaunchBall()
{
currentballRigidbody.isKinematic=false;
currentballRigidbody=null;
Invoke ("DetachBall", detachtime);
}
private void DetachBall(){
currentballSpringjoint.enabled=false;
currentballSpringjoint=null;
}
}
| 25.34375 | 86 | 0.619605 | [
"MIT"
] | EllaRed/Ball-Launcher | Ball Launcher Udemy/Assets/Scripts/BallHandler.cs | 1,622 | C# |
using DMTools.Managers;
using DMTools.Models.SettingModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DMTools.Repositories
{
class LocationRepository : ObjectBaseRepository<LocationModel>
{
#region Variables and Properties
CampaignRepository Repository => CampaignRepository.GetInstance();
private static LocationRepository m_instance = new LocationRepository();
public override List<LocationModel> Objects => Repository.Model.Setting.Locations;
#endregion
#region Constructors
public static LocationRepository GetInstance()
{ if (m_instance == null) m_instance = new LocationRepository(); return m_instance; }
private LocationRepository()
{ m_update = Repository.Model.Setting.UpdateLocations; }
#endregion
#region Functions
protected override void CopyInfo(LocationModel model, LocationModel result)
{
result.Name = model.Name;
result.Concept = model.Concept;
result.Description = model.Description;
result.LocationType = model.LocationType;
model.Notes.ForEach(x => result.Notes.Add(x));
model.NotableCharacters.ForEach(x => result.NotableCharacters.Add(new ObjectInfoModel(x)));
}
public List<string> GetAllTypes() => GetAllData(x => x.LocationType);
public List<string> GetAllShowNames() => GetAllData(x => x.ShowName);
#endregion
}
}
| 30.134615 | 103 | 0.681557 | [
"MIT"
] | dgioielli/DM_Tools | DMTools/DMTools/Repositories/LocationRepository.cs | 1,569 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Net;
using Microsoft.Azure.Management.CosmosDB;
using Xunit;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using Microsoft.Azure.Management.CosmosDB.Models;
using System.Collections.Generic;
namespace CosmosDB.Tests.ScenarioTests
{
public class SqlResourcesOperationsTests
{
const string location = "EAST US 2";
// using an existing DB account, since Account provisioning takes 10-15 minutes
const string resourceGroupName = "CosmosDBResourceGroup3668";
const string databaseAccountName = "cli124";
const string databaseName = "databaseName";
const string databaseName2 = "databaseName2";
const string containerName = "containerName";
const string storedProcedureName = "storedProcedureName";
const string triggerName = "triggerName";
const string userDefinedFunctionName = "userDefinedFunctionName";
const string sqlThroughputType = "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings";
const int sampleThroughput = 700;
Dictionary<string, string> additionalProperties = new Dictionary<string, string>
{
{"foo","bar" }
};
Dictionary<string, string> tags = new Dictionary<string, string>
{
{"key3","value3"},
{"key4","value4"}
};
[Fact]
public void SqlCRUDTests()
{
var handler1 = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK };
using (MockContext context = MockContext.Start(this.GetType()))
{
// Create client
CosmosDBManagementClient cosmosDBManagementClient = CosmosDBTestUtilities.GetCosmosDBClient(context, handler1);
bool isDatabaseNameExists = cosmosDBManagementClient.DatabaseAccounts.CheckNameExistsWithHttpMessagesAsync(databaseAccountName).GetAwaiter().GetResult().Body;
DatabaseAccountGetResults databaseAccount = null;
if (!isDatabaseNameExists)
{
DatabaseAccountCreateUpdateParameters databaseAccountCreateUpdateParameters = new DatabaseAccountCreateUpdateParameters
{
Location = location,
Kind = DatabaseAccountKind.GlobalDocumentDB,
Locations = new List<Location>()
{
{new Location(locationName: location) }
}
};
databaseAccount = cosmosDBManagementClient.DatabaseAccounts.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseAccountCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.Equal(databaseAccount.Name, databaseAccountName);
}
SqlDatabaseCreateUpdateParameters sqlDatabaseCreateUpdateParameters = new SqlDatabaseCreateUpdateParameters
{
Resource = new SqlDatabaseResource { Id = databaseName },
Options = new CreateUpdateOptions()
};
SqlDatabaseGetResults sqlDatabaseGetResults = cosmosDBManagementClient.SqlResources.CreateUpdateSqlDatabaseWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, sqlDatabaseCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlDatabaseGetResults);
Assert.Equal(databaseName, sqlDatabaseGetResults.Name);
SqlDatabaseGetResults sqlDatabaseGetResults2 = cosmosDBManagementClient.SqlResources.GetSqlDatabaseWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlDatabaseGetResults2);
Assert.Equal(databaseName, sqlDatabaseGetResults2.Name);
VerifyEqualSqlDatabases(sqlDatabaseGetResults, sqlDatabaseGetResults2);
SqlDatabaseCreateUpdateParameters sqlDatabaseCreateUpdateParameters2 = new SqlDatabaseCreateUpdateParameters
{
Location = location,
Tags = tags,
Resource = new SqlDatabaseResource { Id = databaseName2 },
Options = new CreateUpdateOptions
{
Throughput = sampleThroughput
}
};
SqlDatabaseGetResults sqlDatabaseGetResults3 = cosmosDBManagementClient.SqlResources.CreateUpdateSqlDatabaseWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName2, sqlDatabaseCreateUpdateParameters2).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlDatabaseGetResults3);
Assert.Equal(databaseName2, sqlDatabaseGetResults3.Name);
IEnumerable<SqlDatabaseGetResults> sqlDatabases = cosmosDBManagementClient.SqlResources.ListSqlDatabasesWithHttpMessagesAsync(resourceGroupName, databaseAccountName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlDatabases);
ThroughputSettingsGetResults throughputSettingsGetResults = cosmosDBManagementClient.SqlResources.GetSqlDatabaseThroughputWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName2).GetAwaiter().GetResult().Body;
Assert.NotNull(throughputSettingsGetResults);
Assert.NotNull(throughputSettingsGetResults.Name);
Assert.Equal(sqlThroughputType, throughputSettingsGetResults.Type);
SqlContainerCreateUpdateParameters sqlContainerCreateUpdateParameters = new SqlContainerCreateUpdateParameters
{
Resource = new SqlContainerResource {
Id = containerName,
PartitionKey = new ContainerPartitionKey
{
Kind = "Hash",
Paths = new List<string> { "/address/zipCode"}
},
IndexingPolicy = new IndexingPolicy
{
Automatic = true,
IndexingMode = IndexingMode.Consistent,
IncludedPaths = new List<IncludedPath>
{
new IncludedPath { Path = "/*"}
},
ExcludedPaths = new List<ExcludedPath>
{
new ExcludedPath { Path = "/pathToNotIndex/*"}
},
CompositeIndexes = new List<IList<CompositePath>>
{
new List<CompositePath>
{
new CompositePath { Path = "/orderByPath1", Order = CompositePathSortOrder.Ascending },
new CompositePath { Path = "/orderByPath2", Order = CompositePathSortOrder.Descending }
},
new List<CompositePath>
{
new CompositePath { Path = "/orderByPath3", Order = CompositePathSortOrder.Ascending },
new CompositePath { Path = "/orderByPath4", Order = CompositePathSortOrder.Descending }
}
}
}
},
Options = new CreateUpdateOptions
{
Throughput = sampleThroughput
}
};
SqlContainerGetResults sqlContainerGetResults = cosmosDBManagementClient.SqlResources.CreateUpdateSqlContainerWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, sqlContainerCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlContainerGetResults);
IEnumerable<SqlContainerGetResults> sqlContainers = cosmosDBManagementClient.SqlResources.ListSqlContainersWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlContainers);
SqlStoredProcedureCreateUpdateParameters sqlStoredProcedureCreateUpdateParameters = new SqlStoredProcedureCreateUpdateParameters
{
Resource = new SqlStoredProcedureResource
{
Id = storedProcedureName,
Body = "function () { var context = getContext(); " +
"var response = context.getResponse();" +
"response.setBody('Hello, World');" +
"}"
},
Options = new CreateUpdateOptions()
};
SqlStoredProcedureGetResults sqlStoredProcedureGetResults = cosmosDBManagementClient.SqlResources.CreateUpdateSqlStoredProcedureWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, storedProcedureName, sqlStoredProcedureCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlStoredProcedureGetResults);
Assert.Equal(sqlStoredProcedureGetResults.Resource.Body, sqlStoredProcedureGetResults.Resource.Body);
IEnumerable<SqlStoredProcedureGetResults> sqlStoredProcedures = cosmosDBManagementClient.SqlResources.ListSqlStoredProceduresWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlStoredProcedures);
foreach (SqlStoredProcedureGetResults sqlStoredProcedure in sqlStoredProcedures)
{
cosmosDBManagementClient.SqlResources.DeleteSqlStoredProcedureWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, sqlStoredProcedure.Name);
}
SqlUserDefinedFunctionCreateUpdateParameters sqlUserDefinedFunctionCreateUpdateParameters = new SqlUserDefinedFunctionCreateUpdateParameters
{
Resource = new SqlUserDefinedFunctionResource
{
Id = userDefinedFunctionName,
Body = "function () { var context = getContext(); " +
"var response = context.getResponse();" +
"response.setBody('Hello, World');" +
"}"
},
Options = new CreateUpdateOptions()
};
SqlUserDefinedFunctionGetResults sqlUserDefinedFunctionGetResults = cosmosDBManagementClient.SqlResources.CreateUpdateSqlUserDefinedFunctionWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, userDefinedFunctionName, sqlUserDefinedFunctionCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlUserDefinedFunctionGetResults);
Assert.Equal(sqlUserDefinedFunctionGetResults.Resource.Body, sqlUserDefinedFunctionGetResults.Resource.Body);
IEnumerable<SqlUserDefinedFunctionGetResults> sqlUserDefinedFunctions = cosmosDBManagementClient.SqlResources.ListSqlUserDefinedFunctionsWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlUserDefinedFunctions);
foreach (SqlUserDefinedFunctionGetResults sqlUserDefinedFunction in sqlUserDefinedFunctions)
{
cosmosDBManagementClient.SqlResources.DeleteSqlUserDefinedFunctionWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, sqlUserDefinedFunction.Name);
}
SqlTriggerCreateUpdateParameters sqlTriggerCreateUpdateParameters = new SqlTriggerCreateUpdateParameters
{
Resource = new SqlTriggerResource
{
Id = triggerName,
TriggerOperation = "All",
TriggerType = "Pre",
Body = "function () { var context = getContext(); " +
"var response = context.getResponse();" +
"response.setBody('Hello, World');" +
"}"
},
Options = new CreateUpdateOptions()
};
SqlTriggerGetResults sqlTriggerGetResults = cosmosDBManagementClient.SqlResources.CreateUpdateSqlTriggerWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, triggerName, sqlTriggerCreateUpdateParameters).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlTriggerGetResults);
Assert.Equal(sqlTriggerGetResults.Resource.TriggerType, sqlTriggerCreateUpdateParameters.Resource.TriggerType);
Assert.Equal(sqlTriggerGetResults.Resource.TriggerOperation, sqlTriggerCreateUpdateParameters.Resource.TriggerOperation);
Assert.Equal(sqlTriggerGetResults.Resource.Body, sqlTriggerCreateUpdateParameters.Resource.Body);
IEnumerable<SqlTriggerGetResults> sqlTriggers = cosmosDBManagementClient.SqlResources.ListSqlTriggersWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName).GetAwaiter().GetResult().Body;
Assert.NotNull(sqlTriggers);
foreach (SqlTriggerGetResults sqlTrigger in sqlTriggers)
{
cosmosDBManagementClient.SqlResources.DeleteSqlTriggerWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, containerName, sqlTrigger.Name);
}
foreach (SqlContainerGetResults sqlContainer in sqlContainers)
{
cosmosDBManagementClient.SqlResources.DeleteSqlContainerWithHttpMessagesAsync(resourceGroupName, databaseAccountName, databaseName, sqlContainer.Name);
}
foreach (SqlDatabaseGetResults sqlDatabase in sqlDatabases)
{
cosmosDBManagementClient.SqlResources.DeleteSqlDatabaseWithHttpMessagesAsync(resourceGroupName, databaseAccountName, sqlDatabase.Name);
}
}
}
private void VerifySqlContainerCreation(SqlContainerGetResults sqlContainerGetResults, SqlContainerCreateUpdateParameters sqlContainerCreateUpdateParameters)
{
Assert.Equal(sqlContainerGetResults.Resource.Id, sqlContainerCreateUpdateParameters.Resource.Id);
Assert.Equal(sqlContainerGetResults.Resource.IndexingPolicy.IndexingMode.ToLower(), sqlContainerCreateUpdateParameters.Resource.IndexingPolicy.IndexingMode.ToLower());
//Assert.Equal(sqlContainerGetResults.Resource.IndexingPolicy.ExcludedPaths, sqlContainerCreateUpdateParameters.Resource.IndexingPolicy.ExcludedPaths);
Assert.Equal(sqlContainerGetResults.Resource.PartitionKey.Kind, sqlContainerCreateUpdateParameters.Resource.PartitionKey.Kind);
Assert.Equal(sqlContainerGetResults.Resource.PartitionKey.Paths, sqlContainerCreateUpdateParameters.Resource.PartitionKey.Paths);
Assert.Equal(sqlContainerGetResults.Resource.DefaultTtl, sqlContainerCreateUpdateParameters.Resource.DefaultTtl);
}
private void VerifyEqualSqlDatabases(SqlDatabaseGetResults expectedValue, SqlDatabaseGetResults actualValue)
{
Assert.Equal(expectedValue.Resource.Id, actualValue.Resource.Id);
Assert.Equal(expectedValue.Resource._rid, actualValue.Resource._rid);
Assert.Equal(expectedValue.Resource._ts, actualValue.Resource._ts);
Assert.Equal(expectedValue.Resource._etag, actualValue.Resource._etag);
Assert.Equal(expectedValue.Resource._colls, actualValue.Resource._colls);
Assert.Equal(expectedValue.Resource._users, actualValue.Resource._users);
}
}
} | 61.282528 | 348 | 0.649924 | [
"MIT"
] | MahmoudYounes/azure-sdk-for-net | sdk/cosmosdb/Microsoft.Azure.Management.CosmosDB/tests/ScenarioTests/SqlResourcesOperationsTests.cs | 16,487 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using Sylvester.Compiler.PlaidML.Bindings;
namespace Sylvester.Compiler.PlaidML
{
public class Context : CompilerApi<Context>, IContext
{
protected IntPtr ptr;
protected string logFileName;
protected FileInfo logFile;
public bool IsAllocated { get; protected set; }
public VaiStatus LastStatus { get; protected set; }
public string LastStatusString { get; protected set; }
public Settings Settings { get; protected set; }
public List<INDArray> Tensors { get; } = new List<INDArray>();
public Context(string eventLogFileName, Settings.UseConfigFile configFile)
{
ptr = @base.__Internal.VaiAllocCtx();
if (ptr.IsZero())
{
IsAllocated = false;
ReportApiCallError("vai_alloc_ctx");
return;
}
Dictionary<string, string> _logConfig = new Dictionary<string, string>
{
{"@type", "type.vertex.ai/vertexai.eventing.file.proto.EventLog"},
{ "filename", eventLogFileName }
};
string logConfig = JsonConvert.SerializeObject(_logConfig);
if (@base.__Internal.VaiSetEventlog(ptr, logConfig))
{
Info($"PlaidML event log file is {GetAssemblyDirectoryFullPath(eventLogFileName)}.");
}
else
{
ReportApiCallError("vai_set_event_log");
}
Settings = new Settings(configFile);
IsAllocated = Settings.IsLoaded;
}
public Context() : this("PlaidML.log", Settings.UseConfigFile.Default) {}
public Context(Settings.UseConfigFile configFile) : this("PlaidML.log", configFile) {}
public static implicit operator IntPtr(Context c)
{
if (!c.IsAllocated)
{
throw new InvalidOperationException("This context is not allocated.");
}
else
{
return c.ptr;
}
}
public void Free()
{
ThrowIfNotAllocated();
@base.__Internal.VaiFreeCtx(ptr);
ptr = IntPtr.Zero;
IsAllocated = false;
}
public void Cancel()
{
ThrowIfNotAllocated();
@base.__Internal.VaiCancelCtx(ptr);
}
internal void ThrowIfNotAllocated()
{
if (!IsAllocated)
{
throw new InvalidOperationException($"This context is not allocated");
}
}
protected void ReportApiCallError(string call) => Error("Call to {0} returned null or false. Status : {1} {2}", call,
LastStatus = @base.VaiLastStatus(), LastStatusString = @base.VaiLastStatusStr());
}
}
| 28.6 | 125 | 0.554779 | [
"MIT"
] | allisterb/Sylvester | src/Compilers/plaidml/Sylvester.Compiler.PlaidML/Context.cs | 3,005 | C# |
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DatabaseIntegration
{
public class AdultCensusContext : DbContext
{
public DbSet<AdultCensus> AdultCensus { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=mlexample.db");
}
}
public class AdultCensus
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int AdultCensusId {get; set;}
public int Age { get; set; }
public string Workclass { get; set; }
public string Education { get; set; }
public string MaritalStatus { get; set; }
public string Occupation { get; set; }
public string Relationship { get; set; }
public string Race { get; set; }
public string Sex { get; set; }
public string CapitalGain { get; set; }
public string CapitalLoss { get; set; }
public int HoursPerWeek { get; set; }
public string NativeCountry { get; set; }
public bool Label { get; set; }
}
}
| 33.72973 | 85 | 0.649038 | [
"MIT"
] | 27theworldinurhand/machinelearning-samples | samples/csharp/getting-started/DatabaseIntegration/DatabaseIntegration/Model.cs | 1,248 | C# |
namespace cdz360Tools.Services.Contract
{
using Models;
public interface ICdz360DbService
{
#region Methods
/// <summary>
/// 保存充电桩设备信息
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// 时间:2016-04-14 15:06
/// 备注:
bool SaveChargingPileInfo(ChargingPileInfo item);
/// <summary>
/// 保存充电桩在线信息(心跳)
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// 时间:2016-04-14 15:06
/// 备注:
bool SaveChargingPileOnlineStatus(ChargingPileOnlineStatus item);
/// <summary>
/// 保存充电桩充电记录(充电完成后)
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// 时间:2016-04-14 15:06
/// 备注:
bool SaveChargeOverRec(ChargeOverHisRec item);
/// <summary>
/// 保存线下充电上报记录
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// 时间:2016-04-14 17:19
/// 备注:
bool SaveChargingPileOffline(ChargingPileOffline_HisRec item);
/// <summary>
/// 保存预约充电
/// </summary>
/// <param name="item">The item.</param>
/// <returns></returns>
/// 时间:2016/4/15 星期五 23:47
/// 备注:
bool SaveChargingPileOrder(ChargingPileOrder_HisRec item);
#endregion Methods
}
} | 26.553571 | 73 | 0.510424 | [
"MIT"
] | wind2006/DotNet.Utilities | cdz360Tools.Services/Contract/ICdz360DbService.cs | 1,661 | C# |
// Copyright (c) Russlan Akiev. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace IdentityBase
{
using System.Collections.Generic;
using System.Reflection;
using IdentityBase.Actions.Recover;
using IdentityBase.Configuration;
using IdentityBase.Web;
using IdentityBase.Web.Controllers.Register;
/// <summary>
/// Discovers WebControllers from a list of <see cref="ApplicationPart"/>
/// instances and adds feature controllers according to application
/// configuration.
/// </summary>
public class WebControllerFeatureProvider :
TypedControllerFeatureProvider<WebController>
{
private List<TypeInfo> blackList;
public WebControllerFeatureProvider(ApplicationOptions options)
{
this.blackList = new List<TypeInfo>();
this.AddIf<RecoverController>(!options.EnableAccountRecovery);
this.AddIf<RegisterController>(!options.EnableAccountRegistration);
}
protected override bool IsController(TypeInfo typeInfo)
{
return base.IsController(typeInfo) &&
!this.blackList.Contains(typeInfo);
}
private void AddIf<TController>(bool assertion)
where TController : WebController
{
if (assertion)
{
this.blackList.Add(typeof(TController).GetTypeInfo());
}
}
}
}
| 32.468085 | 107 | 0.652687 | [
"Apache-2.0"
] | BGuang/IdentityBase | src/IdentityBase.Web/Extensions/WebControllerFeatureProvider.cs | 1,526 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace LogDB.Entities
{
public class MinorPage
{
//Handles
public MajorPage parentPage;
public MajorPageObject parentPageEntry;
public Stream s { get { return parentPage.s; } }
//Offsets
/// <summary>
/// The position in the file of the beginning of the page and it's header.
/// </summary>
public long offsetBeginning;
/// <summary>
/// The position of the file of the beginning of the table, right after the header.
/// </summary>
public long offsetTableBeginning { get { return offsetBeginning + headerSizeBytes; } }
/// <summary>
/// The offset to the beginning of the content, after the table.
/// </summary>
public long offsetContentStart { get { return offsetBeginning + pageSizeBytes; } }
//Sizes
/// <summary>
/// Size of the header
/// </summary>
public long headerSizeBytes = 34;
/// <summary>
/// Size of the table
/// </summary>
public long tableSizeBytes { get { return (long)parentPage.parentFile.minorPageSize * 18; } }
/// <summary>
/// Size of the page, with the header and table, EXCLUDING THE CONTENT.
/// </summary>
public long pageSizeBytes { get { return headerSizeBytes + tableSizeBytes; } }
//File props
public DateTime startTime;
public DateTime endTime;
public ushort fileVersion;
public ulong contentSize;
public ushort elementsUsed;
public bool[] flags;
//Misc
/// <summary>
/// Number of remaining elements in the table that we can fill.
/// </summary>
public ushort remainingElementSpace { get { return (ushort)(parentPage.parentFile.minorPageSize - elementsUsed); } }
public ulong originalContentSize;
public MinorPageObject[] entries;
/// <summary>
/// Reads a minor page at position
/// </summary>
/// <param name="o"></param>
public MinorPage(MajorPageObject o)
{
//Set handles
parentPageEntry = o;
parentPage = o.parentPage;
//Set offsets
offsetBeginning = s.Position;
//Validate the page text
if (!s.ReadConstantString(4, "page".ToCharArray()))
throw new Exception($"Constant did not match at minor page {offsetBeginning}! Corrupted database?");
//Read file props
startTime = new DateTime((long)s.ReadULong());
endTime = new DateTime((long)s.ReadULong());
fileVersion = s.ReadUShort();
contentSize = s.ReadULong();
originalContentSize = contentSize;
elementsUsed = s.ReadUShort();
flags = s.ReadBitFlags(2);
//Read entries
entries = new MinorPageObject[parentPage.parentFile.minorPageSize];
for (ushort i = 0; i < elementsUsed; i++)
entries[i] = new MinorPageObject(this);
}
/// <summary>
/// Gets the size of the entire page, including headers and content.
/// </summary>
/// <param name="f"></param>
/// <returns></returns>
public static ulong SafeGetAbsoluteSize(LogDBFile f, long pos)
{
ulong size;
lock (f.s)
{
//First, get size of headers and table
size = (18 * (ulong)f.minorPageSize) + 34;
//Jump to the position of the content size and read it
f.s.Position = pos + 4 + 8 + 8 + 2;
size += f.s.ReadULong();
}
return size;
}
/// <summary>
/// Safely updates the header in a thread-safe way.
/// </summary>
public void SafeUpdate()
{
lock(s)
{
//Jump to start, skipping sanity check
s.Position = offsetBeginning + 4;
//Write header
s.WriteUInt64((ulong)startTime.Ticks);
s.WriteUInt64((ulong)endTime.Ticks);
s.WriteUInt16(fileVersion);
s.WriteUInt64(contentSize);
s.WriteUInt16(elementsUsed);
s.WriteBitFlags(flags);
//Update parent
parentPage.contentSize += (contentSize - originalContentSize);
originalContentSize = contentSize;
parentPageEntry.end = endTime;
parentPageEntry.start = startTime;
parentPageEntry.SafeUpdate();
}
}
/// <summary>
/// Creates a new, writable, entry and adds it's data.
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public MinorPageObject SafeCreateNewEntry(DateTime time, Stream contentToWrite, bool[] flags = null)
{
MinorPageObject output;
lock (s)
{
//Validate that we have space
if (remainingElementSpace <= 0)
throw new Exception("Out of space on this major page!");
//Validate flags
if (flags == null)
flags = new bool[8];
if (flags.Length != 8)
throw new Exception("Flags length MUST be 8.");
//Validate input stream
if (!contentToWrite.CanRead || !contentToWrite.CanSeek)
throw new Exception("Input stream to write MUST be readable and seekable.");
if (contentToWrite.Length > uint.MaxValue - 1)
throw new Exception($"The input content stream is too large! The size limit is {(uint.MaxValue - 1).ToString()}. This stream is {contentToWrite.Length.ToString()} bytes long.");
//Jump to beginning of table and skip to the first open slot
s.Position = offsetTableBeginning + (18 * elementsUsed);
long startPos = s.Position;
//Write the entry. The offset is pulled from the current amount of space used by the content of this page.
s.WriteUInt64((ulong)time.Ticks); //Time
s.WriteUInt64(contentSize); //Offset
s.WriteByte(0x00); //Flag part 1
s.WriteByte(0x00); //Flag part 2
//Create object
s.Position = startPos;
output = new MinorPageObject(this);
entries[elementsUsed] = output;
//Create the content of the Content Object
s.Position = (long)output.offsetContentAbsolute;
s.WriteUInt64((ulong)time.Ticks); //Time
s.WriteUInt16(LogDBFile.CURRENT_FILE_VERSION); //Version
s.WriteUInt32((uint)contentToWrite.Length); //Size
s.WriteByte(0x00); //Flag
contentToWrite.CopyTo(s);
//Update header info
elementsUsed++;
endTime = new DateTime(Math.Min(endTime.Ticks, time.Ticks));
//contentSize += 300;
contentSize += 15 + (ulong)contentToWrite.Length; //Adding size of what we just wrote
SafeUpdate();
}
return output;
}
}
}
| 37.288557 | 197 | 0.541694 | [
"MIT"
] | Roman-Port/LogDB | LogDB/Entities/MinorPage.cs | 7,497 | C# |
using System.ComponentModel;
namespace Sparrow.StandardResult
{
/// <summary>
/// 枚举类
/// </summary>
public class EnumModelResult
{
/// <summary>
/// 枚举结果
/// </summary>
public enum EnumResult
{
/// <summary>
/// 调用失败
/// </summary>
[Description("调用失败")]
Error = -1,
/// <summary>
/// 调用成功
/// </summary>
[Description("调用成功")]
Success = 200
}
/// <summary>
/// 枚举授权错误
/// </summary>
public enum EnumAuthError
{
/// <summary>
/// 账号或密码验证不通过
/// </summary>
[Description("账号或密码验证不通过")]
LoginFailed = 100001,
/// <summary>
/// 权限不足
/// </summary>
[Description("权限不足")]
InsufficientAuthoritys = 100002
}
/// <summary>
/// 数据验证结果提示枚举
/// </summary>
public enum EnumModelError
{
/// <summary>
/// 数据验证失败
/// </summary>
[Description("数据验证失败")]
ModelVaildFaild = 101001
}
/// <summary>
/// 数据操作结果枚举
/// </summary>
public enum EnumDataOperation
{
/// <summary>
/// 数据添加成功
/// </summary>
[Description("数据添加成功")]
InsertSucceed = 102001,
/// <summary>
/// 数据添加失败
/// </summary>
[Description("数据添加失败")]
InsertFaild = 102002,
/// <summary>
/// 数据删除成功
/// </summary>
[Description("数据删除成功")]
DeleteSucceed = 102003,
/// <summary>
/// 数据删除失败
/// </summary>
[Description("数据删除失败")]
DeleteFaild = 102004,
/// <summary>
/// 数据更新成功
/// </summary>
[Description("数据更新成功")]
UpdateSucceed = 102005,
/// <summary>
/// 数据更新失败
/// </summary>
[Description("数据更新失败")]
UpdateFaild = 102006,
/// <summary>
/// 数据查询成功
/// </summary>
[Description("数据查询成功")]
SelectSucceed = 102007,
/// <summary>
/// 数据查询失败
/// </summary>
[Description("数据查询失败")]
SelectFaild = 102008
}
/// <summary>
/// 枚举异常
/// </summary>
public enum EnumException
{
/// <summary>
/// 服务器异常,请稍后再试
/// </summary>
[Description("服务异常,请稍后再试")]
ServerError = 103000,
/// <summary>
/// 服务器繁忙,请稍后再试
/// </summary>
[Description("服务繁忙,请稍后再试")]
ServerBusy = 103001
}
}
}
| 25.09322 | 43 | 0.385343 | [
"Apache-2.0"
] | zhengganCN/Sparrow | src/Sparrow/Sparrow.StandardResult/EnumModelResult.cs | 3,421 | C# |
namespace treeDiM.StackBuilder.Desktop
{
partial class FormNewPalletFilm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormNewPalletFilm));
this.cbColor = new OfficePickers.ColorPicker.ComboBoxColorPicker();
this.lbColor = new System.Windows.Forms.Label();
this.chkbTransparency = new System.Windows.Forms.CheckBox();
this.chkbHatching = new System.Windows.Forms.CheckBox();
this.bnSendToDB = new System.Windows.Forms.Button();
this.uCtrlSpacing = new treeDiM.StackBuilder.Basics.UCtrlDouble();
this.uCtrlAngle = new treeDiM.StackBuilder.Basics.UCtrlDouble();
this.SuspendLayout();
//
// bnOk
//
resources.ApplyResources(this.bnOk, "bnOk");
//
// bnCancel
//
resources.ApplyResources(this.bnCancel, "bnCancel");
//
// lbName
//
resources.ApplyResources(this.lbName, "lbName");
//
// lbDescription
//
resources.ApplyResources(this.lbDescription, "lbDescription");
//
// tbName
//
resources.ApplyResources(this.tbName, "tbName");
//
// tbDescription
//
resources.ApplyResources(this.tbDescription, "tbDescription");
//
// cbColor
//
resources.ApplyResources(this.cbColor, "cbColor");
this.cbColor.Color = System.Drawing.Color.LightBlue;
this.cbColor.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.cbColor.DropDownHeight = 1;
this.cbColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbColor.DropDownWidth = 1;
this.cbColor.Items.AddRange(new object[] {
resources.GetString("cbColor.Items"),
resources.GetString("cbColor.Items1"),
resources.GetString("cbColor.Items2"),
resources.GetString("cbColor.Items3"),
resources.GetString("cbColor.Items4"),
resources.GetString("cbColor.Items5"),
resources.GetString("cbColor.Items6"),
resources.GetString("cbColor.Items7"),
resources.GetString("cbColor.Items8"),
resources.GetString("cbColor.Items9"),
resources.GetString("cbColor.Items10"),
resources.GetString("cbColor.Items11"),
resources.GetString("cbColor.Items12"),
resources.GetString("cbColor.Items13"),
resources.GetString("cbColor.Items14")});
this.cbColor.Name = "cbColor";
//
// lbColor
//
resources.ApplyResources(this.lbColor, "lbColor");
this.lbColor.Name = "lbColor";
//
// chkbTransparency
//
resources.ApplyResources(this.chkbTransparency, "chkbTransparency");
this.chkbTransparency.Name = "chkbTransparency";
this.chkbTransparency.UseVisualStyleBackColor = true;
//
// chkbHatching
//
resources.ApplyResources(this.chkbHatching, "chkbHatching");
this.chkbHatching.Name = "chkbHatching";
this.chkbHatching.UseVisualStyleBackColor = true;
this.chkbHatching.CheckedChanged += new System.EventHandler(this.OnChkbHatchingCheckedChanged);
//
// bnSendToDB
//
resources.ApplyResources(this.bnSendToDB, "bnSendToDB");
this.bnSendToDB.Name = "bnSendToDB";
this.bnSendToDB.UseVisualStyleBackColor = true;
this.bnSendToDB.Click += new System.EventHandler(this.OnSendToDatabase);
//
// uCtrlSpacing
//
resources.ApplyResources(this.uCtrlSpacing, "uCtrlSpacing");
this.uCtrlSpacing.Minimum = new decimal(new int[] {
10000,
0,
0,
-2147483648});
this.uCtrlSpacing.Name = "uCtrlSpacing";
this.uCtrlSpacing.Unit = treeDiM.StackBuilder.Basics.UnitsManager.UnitType.UT_LENGTH;
this.uCtrlSpacing.Value = 0D;
//
// uCtrlAngle
//
resources.ApplyResources(this.uCtrlAngle, "uCtrlAngle");
this.uCtrlAngle.Minimum = new decimal(new int[] {
10000,
0,
0,
-2147483648});
this.uCtrlAngle.Name = "uCtrlAngle";
this.uCtrlAngle.Unit = treeDiM.StackBuilder.Basics.UnitsManager.UnitType.UT_NONE;
this.uCtrlAngle.Value = 0D;
//
// FormNewPalletFilm
//
resources.ApplyResources(this, "$this");
this.Controls.Add(this.uCtrlAngle);
this.Controls.Add(this.uCtrlSpacing);
this.Controls.Add(this.bnSendToDB);
this.Controls.Add(this.chkbHatching);
this.Controls.Add(this.chkbTransparency);
this.Controls.Add(this.lbColor);
this.Controls.Add(this.cbColor);
this.Name = "FormNewPalletFilm";
this.Controls.SetChildIndex(this.bnOk, 0);
this.Controls.SetChildIndex(this.bnCancel, 0);
this.Controls.SetChildIndex(this.lbName, 0);
this.Controls.SetChildIndex(this.lbDescription, 0);
this.Controls.SetChildIndex(this.tbName, 0);
this.Controls.SetChildIndex(this.tbDescription, 0);
this.Controls.SetChildIndex(this.cbColor, 0);
this.Controls.SetChildIndex(this.lbColor, 0);
this.Controls.SetChildIndex(this.chkbTransparency, 0);
this.Controls.SetChildIndex(this.chkbHatching, 0);
this.Controls.SetChildIndex(this.bnSendToDB, 0);
this.Controls.SetChildIndex(this.uCtrlSpacing, 0);
this.Controls.SetChildIndex(this.uCtrlAngle, 0);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private OfficePickers.ColorPicker.ComboBoxColorPicker cbColor;
private System.Windows.Forms.Label lbColor;
private System.Windows.Forms.CheckBox chkbTransparency;
private System.Windows.Forms.CheckBox chkbHatching;
private System.Windows.Forms.Button bnSendToDB;
private Basics.UCtrlDouble uCtrlSpacing;
private Basics.UCtrlDouble uCtrlAngle;
}
}
| 41.7 | 149 | 0.583 | [
"MIT"
] | Alko89/StackBuilder | Sources/TreeDim.StackBuilder.Desktop/FormNewPalletFilm.Designer.cs | 7,508 | C# |
//=====================================================================================================================
//
// ideMobi 2020©
//
//=====================================================================================================================
// Define the use of Log and Benchmark only for this file!
// Add NWD_VERBOSE in scripting define symbols (Edit->Project Settings…->Player->[Choose Plateform]->Other Settings->Scripting Define Symbols)
#if NWD_VERBOSE
#if UNITY_EDITOR
#define NWD_LOG
#define NWD_BENCHMARK
#elif DEBUG
//#define NWD_LOG
//#define NWD_BENCHMARK
#endif
#else
#undef NWD_LOG
#undef NWD_BENCHMARK
#endif
//=====================================================================================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.IO;
using UnityEngine;
//=====================================================================================================================
#if UNITY_EDITOR
using UnityEditor;
using NetWorkedData.NWDEditor;
#endif
//=====================================================================================================================
namespace NetWorkedData
{
[SerializeField]
//-------------------------------------------------------------------------------------------------------------
public class NWDLocalizableLongTextType : NWDLocalizableType
{
//-------------------------------------------------------------------------------------------------------------
const int kCONST_NUMBER_OF_LINE = 6;
//-------------------------------------------------------------------------------------------------------------
public NWDLocalizableLongTextType()
{
Value = string.Empty;
AddBaseString(string.Empty);
}
//-------------------------------------------------------------------------------------------------------------
public NWDLocalizableLongTextType(string sValue = NWEConstants.K_EMPTY_STRING)
{
if (string.IsNullOrEmpty(sValue))
{
Value = string.Empty;
AddBaseString(string.Empty);
}
else
{
Value = sValue;
}
kSplitDico = new Dictionary<string, string>();
DicoPopulate();
}
//-------------------------------------------------------------------------------------------------------------
//[NonSerializedAttribute]
//private Dictionary<string, string> kSplitDico;
////-------------------------------------------------------------------------------------------------------------
//private void DicoPopulate()
//{
// if (Value != null && Value != "")
// {
// string[] tValueArray = Value.Split(new string[] { NWDConstants.kFieldSeparatorA }, StringSplitOptions.RemoveEmptyEntries);
// foreach (string tValueArrayLine in tValueArray)
// {
// string[] tLineValue = tValueArrayLine.Split(new string[] { NWDConstants.kFieldSeparatorB }, StringSplitOptions.RemoveEmptyEntries);
// if (tLineValue.Length == 2)
// {
// string tLangague = tLineValue[0];
// string tText = tLineValue[1];
// if (kSplitDico.ContainsKey(tLangague) == false)
// {
// kSplitDico.Add(tLangague, tText);
// }
// }
// else if (tLineValue.Length == 1)
// {
// string tLangague = tLineValue[0];
// string tText = "";
// if (kSplitDico.ContainsKey(tLangague) == false)
// {
// kSplitDico.Add(tLangague, tText);
// }
// }
// }
// }
//}
////-------------------------------------------------------------------------------------------------------------
//private string SplitDico(string sKey)
//{
// string rReturn = "";
// if (kSplitDico == null)
// {
// kSplitDico = new Dictionary<string, string>();
// DicoPopulate();
// }
// if (kSplitDico.ContainsKey(sKey))
// {
// rReturn = kSplitDico[sKey];
// }
// else if (kSplitDico.ContainsKey(NWDDataLocalizationManager.kBaseDev))
// {
// rReturn = kSplitDico[NWDDataLocalizationManager.kBaseDev];
// }
// else
// {
// rReturn = "no value for key";
// }
// return rReturn;
//}
////-------------------------------------------------------------------------------------------------------------
//public void AddBaseString(string sValue)
//{
// AddValue(NWDDataLocalizationManager.kBaseDev, sValue);
//}
////-------------------------------------------------------------------------------------------------------------
//public void AddLocalString(string sValue)
//{
// AddValue(NWDDataManager.SharedInstance().PlayerLanguage, sValue);
//}
////-------------------------------------------------------------------------------------------------------------
//public string GetLocalString()
//{
// return NWDToolbox.TextUnprotect(SplitDico(NWDDataManager.SharedInstance().PlayerLanguage));
//}
////-------------------------------------------------------------------------------------------------------------
//public string GetBaseString()
//{
// return NWDToolbox.TextUnprotect(SplitDico(NWDDataLocalizationManager.kBaseDev));
//}
////-------------------------------------------------------------------------------------------------------------
//public string GetLanguageString(string sLanguage)
//{
// return NWDToolbox.TextUnprotect(SplitDico(sLanguage));
//}
//-------------------------------------------------------------------------------------------------------------
#if UNITY_EDITOR
//-------------------------------------------------------------------------------------------------------------
public override float ControlFieldHeight()
{
int tRow = 0;
if (Value != null && Value != string.Empty)
{
string[] tValueArray = Value.Split(new string[] { NWDConstants.kFieldSeparatorA }, StringSplitOptions.RemoveEmptyEntries);
tRow += tValueArray.Count();
}
float rReturn = (NWDGUI.kTextFieldStyle.fixedHeight * kCONST_NUMBER_OF_LINE + NWDGUI.kPopupStyle.fixedHeight + NWDGUI.kFieldMarge*2) * tRow + NWDGUI.kPopupStyle.fixedHeight;
// return (tPopupdStyle.CalcHeight (new GUIContent ("A"), 100.0f) + NWDGUI.kFieldMarge) * tRow * kCONST_NUMBER_OF_LINE - NWDGUI.kFieldMarge;
return rReturn;
}
//-------------------------------------------------------------------------------------------------------------
public override object ControlField(Rect sPosition, string sEntitled, bool sDisabled, string sTooltips = NWEConstants.K_EMPTY_STRING, object sAdditionnal = null)
{
NWDLocalizableLongTextType tTemporary = new NWDLocalizableLongTextType();
GUIContent tContent = new GUIContent(sEntitled, sTooltips);
float tWidth = sPosition.width;
float tHeight = sPosition.height;
float tX = sPosition.position.x;
float tY = sPosition.position.y;
float tLangWidth = EditorGUIUtility.labelWidth + NWDGUI.kLangWidth;
List<string> tLocalizationList = new List<string>();
tLocalizationList.Add(NWEConstants.K_MINUS);
string tLanguage = NWDAppConfiguration.SharedInstance().DataLocalizationManager.LanguagesString;
string[] tLanguageArray = tLanguage.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
tLocalizationList.AddRange(tLanguageArray);
tLocalizationList.Sort();
List<string> tValueList = new List<string>();
List<string> tValueNextList = new List<string>();
Dictionary<string, string> tResult = new Dictionary<string, string>();
if (Value != null && Value != string.Empty)
{
string[] tValueArray = Value.Split(new string[] { NWDConstants.kFieldSeparatorA }, StringSplitOptions.RemoveEmptyEntries);
tValueList = new List<string>(tValueArray);
}
for (int i = 0; i < tValueList.Count; i++)
{
string tLine = tValueList.ElementAt(i);
string[] tLineValue = tLine.Split(new string[] { NWDConstants.kFieldSeparatorB }, StringSplitOptions.RemoveEmptyEntries);
if (tLineValue.Length > 0)
{
//Debug.Log ("i remove " + tLineValue [0]);
tLocalizationList.Remove(tLineValue[0]);
}
}
string[] tLangageArray = tLocalizationList.ToArray();
//Debug.Log (" tLangageArray = " + string.Join(".",tLangageArray));
tValueList.Add("");
for (int i = 0; i < tValueList.Count; i++)
{
//string tFieldName = sEntitled;
if (i > 0)
{
//tFieldName = " ";
tContent = new GUIContent(" ");
}
string tLangague = string.Empty;
string tText = string.Empty;
string tLine = tValueList.ElementAt(i);
string[] tLineValue = tLine.Split(new string[] { NWDConstants.kFieldSeparatorB }, StringSplitOptions.RemoveEmptyEntries);
if (tLineValue.Length == 2)
{
tLangague = tLineValue[0];
tText = tLineValue[1];
}
if (tLineValue.Length == 1)
{
tLangague = tLineValue[0];
}
List<string> tValueFuturList = new List<string>();
tValueFuturList.AddRange(tLangageArray);
tValueFuturList.Add(tLangague);
tValueFuturList.Sort();
string[] tLangageFuturArray = tValueFuturList.ToArray();
List<GUIContent> tContentFuturList = new List<GUIContent>();
foreach (string tS in tLangageFuturArray)
{
tContentFuturList.Add(new GUIContent(tS));
}
//Debug.Log (" tLangageFuturArray = " + string.Join(":",tLangageFuturArray));
int tIndex = tValueFuturList.IndexOf(tLangague);
//tIndex = EditorGUI.Popup (new Rect (tX, tY, tLangWidth, tPopupdStyle.fixedHeight), tFieldName, tIndex, tLangageFuturArray, tPopupdStyle);
tIndex = EditorGUI.Popup(new Rect(tX, tY, tLangWidth, NWDGUI.kPopupStyle.fixedHeight), tContent, tIndex, tContentFuturList.ToArray(), NWDGUI.kPopupStyle);
if (tIndex < 0 || tIndex >= tValueFuturList.Count)
{
tIndex = 0;
}
tLangague = tValueFuturList[tIndex];
if (tLangague != string.Empty)
{
//remove EditorGUI.indentLevel to draw next controller without indent
int tIndentLevel = EditorGUI.indentLevel;
EditorGUI.indentLevel = 0;
//tText = EditorGUI.TextField (new Rect (tX + tLangWidth + NWDGUI.kFieldMarge, tY, tWidth - tLangWidth - NWDGUI.kFieldMarge, tPopupdStyle.fixedHeight), tText);
//tText = EditorGUI.TextArea (new Rect (tX + tLangWidth + NWDGUI.kFieldMarge, tY, tWidth - tLangWidth - NWDGUI.kFieldMarge, NWDGUI.tTextFieldStyle.fixedHeight * kCONST_NUMBER_OF_LINE), NWDToolbox.TextUnprotect (tText), NWDGUI.tTextAreaStyle);
tText = EditorGUI.TextArea(new Rect(tX +NWDGUI.kLangWidth, tY + NWDGUI.kFieldMarge +NWDGUI.kPopupStyle.fixedHeight, tWidth - NWDGUI.kLangWidth, NWDGUI.kTextFieldStyle.fixedHeight * kCONST_NUMBER_OF_LINE), NWDToolbox.TextUnprotect(tText), NWDGUI.kTextAreaStyle);
tText = NWDToolbox.TextProtect(tText);
EditorGUI.indentLevel = tIndentLevel;
}
tY += NWDGUI.kTextFieldStyle.fixedHeight * kCONST_NUMBER_OF_LINE + NWDGUI.kPopupStyle.fixedHeight + NWDGUI.kFieldMarge*2;
if (tResult.ContainsKey(tLangague))
{
tResult[tLangague] = tText;
}
else
{
tResult.Add(tLangague, tText);
}
}
tResult.Remove(NWEConstants.K_MINUS); // remove default value
tResult.Remove(string.Empty); // remove empty value
if (tResult.ContainsKey(NWDDataLocalizationManager.kBaseDev) == false)
{
tResult.Add(NWDDataLocalizationManager.kBaseDev, string.Empty);
}
foreach (KeyValuePair<string, string> tKeyValue in tResult)
{
tValueNextList.Add(tKeyValue.Key + NWDConstants.kFieldSeparatorB + tKeyValue.Value);
}
string[] tNextValueArray = tValueNextList.Distinct().ToArray();
string tNextValue = string.Join(NWDConstants.kFieldSeparatorA, tNextValueArray);
tNextValue = tNextValue.Trim(NWDConstants.kFieldSeparatorA.ToCharArray()[0]);
if (tNextValue == NWDConstants.kFieldSeparatorB)
{
tNextValue = string.Empty;
}
tTemporary.Value = tNextValue;
return tTemporary;
}
//-------------------------------------------------------------------------------------------------------------
#endif
//-------------------------------------------------------------------------------------------------------------
}
}
//=====================================================================================================================
| 49.276094 | 282 | 0.453639 | [
"Apache-2.0"
] | NetWorkedData/NetWorkedData | NWDEngine/NWDDataType/NWDLocalizable/NWDLocalizableLongTextType.cs | 14,638 | 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("Inixe.CoinManagement.Bitfinex.Api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Inixe.CoinManagement.Bitfinex.Api")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("432f7b0b-bf25-43c9-9b8a-ca745063a6fd")]
// 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.756757 | 84 | 0.751046 | [
"MIT"
] | Arsenico95/Inixe.Coinmanager | Source/Inixe.CoinManagement.Bitfinex.Api/Properties/AssemblyInfo.cs | 1,437 | C# |
using System.Collections.Generic;
using System.Linq;
namespace Kritner.AdventOfCode2018.Day3
{
public class Fabric
{
private readonly Point[,] _points;
public Fabric(int width, int height, IEnumerable<FabricSegments> fabricClaims)
{
Width = width;
Height = height;
FabricClaims = fabricClaims;
_points = new Point[Width,Height];
// Instantiate all the points (is there a better way to do this?)
for (var row = 0; row < Width; row++)
{
for (var column = 0; column < Height; column++)
{
_points[row, column] = new Point();
}
}
PopulatePoints();
}
public int Width { get; }
public int Height { get; }
public IEnumerable<FabricSegments> FabricClaims { get; }
public int GetOverlapArea()
{
int count = 0;
for (var row = 0; row < Width; row++)
{
for (var column = 0; column < Height; column++)
{
if (_points[row, column].HasOverlap)
{
count++;
}
}
}
return count;
}
public IEnumerable<FabricSegments> GetNoOverlap()
{
var overlap = GetOverlap();
return FabricClaims.ToList().Except(overlap);
}
private void PopulatePoints()
{
foreach (var fabricClaim in FabricClaims)
{
for (var width = 0; width < fabricClaim.Width; width++)
{
for (var height = 0; height < fabricClaim.Height; height++)
{
var point = _points[
fabricClaim.StartCoordinateX + width,
fabricClaim.StartCoordinateY + height
];
point.Occupied.Add(fabricClaim);
}
}
}
}
private IEnumerable<FabricSegments> GetOverlap()
{
List<FabricSegments> list = new List<FabricSegments>();
for (var row = 0; row < Width; row++)
{
for (var column = 0; column < Height; column++)
{
var point = _points[row, column];
if (point.HasOverlap)
{
list.AddRange(point.Occupied);
}
}
}
return list;
}
}
}
| 27.752577 | 86 | 0.43425 | [
"MIT"
] | Kritner/Kritner.AdventOfCode2018 | src/Kritner.AdventOfCode2018/Day3/Fabric.cs | 2,694 | C# |
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Rendering;
// Based on https://github.com/EnlightenedOne/MirrorNetworkDiscovery
// forked from https://github.com/in0finite/MirrorNetworkDiscovery
// Both are MIT Licensed
namespace Mirror.Discovery
{
/// <summary>
/// Base implementation for Network Discovery. Extend this component
/// to provide custom discovery with game specific data
/// <see cref="NetworkDiscovery"/> for a sample implementation
/// </summary>
[DisallowMultipleComponent]
[HelpURL("https://mirror-networking.com/docs/Components/NetworkDiscovery.html")]
public abstract class NetworkDiscoveryBase<Request, Response> : MonoBehaviour
where Request : IMessageBase, new()
where Response : IMessageBase, new()
{
public static bool SupportedOnThisPlatform { get { return Application.platform != RuntimePlatform.WebGLPlayer; } }
// each game should have a random unique handshake, this way you can tell if this is the same game or not
[HideInInspector]
public long secretHandshake;
[SerializeField]
[Tooltip("The UDP port the server will listen for multi-cast messages")]
int serverBroadcastListenPort = 47777;
[SerializeField]
[Tooltip("Time in seconds between multi-cast messages")]
[Range(1, 60)]
float ActiveDiscoveryInterval = 3;
protected UdpClient serverUdpClient;
protected UdpClient clientUdpClient;
#if UNITY_EDITOR
void OnValidate()
{
if (secretHandshake == 0)
{
secretHandshake = RandomLong();
UnityEditor.Undo.RecordObject(this, "Set secret handshake");
}
}
#endif
public static long RandomLong()
{
int value1 = UnityEngine.Random.Range(int.MinValue, int.MaxValue);
int value2 = UnityEngine.Random.Range(int.MinValue, int.MaxValue);
return value1 + ((long)value2 << 32);
}
/// <summary>
/// virtual so that inheriting classes' Start() can call base.Start() too
/// </summary>
public virtual void Start()
{
// headless mode? then start advertising
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null)
{
AdvertiseServer();
}
}
// Ensure the ports are cleared no matter when Game/Unity UI exits
void OnApplicationQuit()
{
Shutdown();
}
void Shutdown()
{
if (serverUdpClient != null)
{
try
{
serverUdpClient.Close();
}
catch (Exception)
{
// it is just close, swallow the error
}
serverUdpClient = null;
}
if (clientUdpClient != null)
{
try
{
clientUdpClient.Close();
}
catch (Exception)
{
// it is just close, swallow the error
}
clientUdpClient = null;
}
CancelInvoke();
}
#region Server
/// <summary>
/// Advertise this server in the local network
/// </summary>
public void AdvertiseServer()
{
if (!SupportedOnThisPlatform)
throw new PlatformNotSupportedException("Network discovery not supported in this platform");
StopDiscovery();
// Setup port -- may throw exception
serverUdpClient = new UdpClient(serverBroadcastListenPort)
{
EnableBroadcast = true,
MulticastLoopback = false
};
// listen for client pings
_ = ServerListenAsync();
}
public async Task ServerListenAsync()
{
while (true)
{
try
{
await ReceiveRequestAsync(serverUdpClient);
}
catch (ObjectDisposedException)
{
// socket has been closed
break;
}
catch (Exception)
{
// if we get an invalid request, just ignore it
}
}
}
async Task ReceiveRequestAsync(UdpClient udpClient)
{
// only proceed if there is available data in network buffer, or otherwise Receive() will block
// average time for UdpClient.Available : 10 us
UdpReceiveResult udpReceiveResult = await udpClient.ReceiveAsync();
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(udpReceiveResult.Buffer))
{
long handshake = networkReader.ReadInt64();
if (handshake != secretHandshake)
{
// message is not for us
throw new ProtocolViolationException("Invalid handshake");
}
var request = new Request();
request.Deserialize(networkReader);
ProcessClientRequest(request, udpReceiveResult.RemoteEndPoint);
}
}
/// <summary>
/// Reply to the client to inform it of this server
/// </summary>
/// <remarks>
/// Override if you wish to ignore server requests based on
/// custom criteria such as language, full server game mode or difficulty
/// </remarks>
/// <param name="request">Request comming from client</param>
/// <param name="endpoint">Address of the client that sent the request</param>
protected virtual void ProcessClientRequest(Request request, IPEndPoint endpoint)
{
Response info = ProcessRequest(request, endpoint);
if (info == null)
return;
using (PooledNetworkWriter writer = NetworkWriterPool.GetWriter())
{
try
{
writer.WriteInt64(secretHandshake);
info.Serialize(writer);
var data = writer.ToArraySegment();
// signature matches
// send response
serverUdpClient.Send(data.Array, data.Count, endpoint);
}
catch (Exception ex)
{
Debug.LogException(ex, this);
}
}
}
/// <summary>
/// Process the request from a client
/// </summary>
/// <remarks>
/// Override if you wish to provide more information to the clients
/// such as the name of the host player
/// </remarks>
/// <param name="request">Request comming from client</param>
/// <param name="endpoint">Address of the client that sent the request</param>
/// <returns>The message to be sent back to the client or null</returns>
protected abstract Response ProcessRequest(Request request, IPEndPoint endpoint);
#endregion
#region Client
/// <summary>
/// Start Active Discovery
/// </summary>
public void StartDiscovery()
{
if (!SupportedOnThisPlatform)
throw new PlatformNotSupportedException("Network discovery not supported in this platform");
StopDiscovery();
try
{
// Setup port
clientUdpClient = new UdpClient(0)
{
EnableBroadcast = true,
MulticastLoopback = false
};
}
catch (Exception)
{
// Free the port if we took it
Shutdown();
throw;
}
_ = ClientListenAsync();
InvokeRepeating(nameof(BroadcastDiscoveryRequest), 0, ActiveDiscoveryInterval);
}
/// <summary>
/// Stop Active Discovery
/// </summary>
public void StopDiscovery()
{
Shutdown();
}
/// <summary>
/// Awaits for server response
/// </summary>
/// <returns>ClientListenAsync Task</returns>
public async Task ClientListenAsync()
{
while (true)
{
try
{
await ReceiveGameBroadcastAsync(clientUdpClient);
}
catch (ObjectDisposedException)
{
// socket was closed, no problem
return;
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
}
/// <summary>
/// Sends discovery request from client
/// </summary>
public void BroadcastDiscoveryRequest()
{
if (clientUdpClient == null)
return;
var endPoint = new IPEndPoint(IPAddress.Broadcast, serverBroadcastListenPort);
using (PooledNetworkWriter writer = NetworkWriterPool.GetWriter())
{
writer.WriteInt64(secretHandshake);
try
{
Request request = GetRequest();
request.Serialize(writer);
var data = writer.ToArraySegment();
clientUdpClient.SendAsync(data.Array, data.Count, endPoint);
}
catch (Exception)
{
// It is ok if we can't broadcast to one of the addresses
}
}
}
/// <summary>
/// Create a message that will be broadcasted on the network to discover servers
/// </summary>
/// <remarks>
/// Override if you wish to include additional data in the discovery message
/// such as desired game mode, language, difficulty, etc... </remarks>
/// <returns>An instance of ServerRequest with data to be broadcasted</returns>
protected virtual Request GetRequest() => new Request();
async Task ReceiveGameBroadcastAsync(UdpClient udpClient)
{
// only proceed if there is available data in network buffer, or otherwise Receive() will block
// average time for UdpClient.Available : 10 us
UdpReceiveResult udpReceiveResult = await udpClient.ReceiveAsync();
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(udpReceiveResult.Buffer))
{
if (networkReader.ReadInt64() != secretHandshake)
return;
var response = new Response();
response.Deserialize(networkReader);
ProcessResponse(response, udpReceiveResult.RemoteEndPoint);
}
}
/// <summary>
/// Process the answer from a server
/// </summary>
/// <remarks>
/// A client receives a reply from a server, this method processes the
/// reply and raises an event
/// </remarks>
/// <param name="response">Response that came from the server</param>
/// <param name="endpoint">Address of the server that replied</param>
protected abstract void ProcessResponse(Response response, IPEndPoint endpoint);
#endregion
}
}
| 32.172131 | 122 | 0.529936 | [
"MIT"
] | aka-coke/MirrorNG | Assets/Mirror/Components/Discovery/NetworkDiscoveryBase.cs | 11,775 | C# |
namespace Microsoft.Bot.Builder.Location.Tests
{
using System.Threading;
using System.Threading.Tasks;
using Builder.Dialogs;
using Connector;
using Dialogs;
using Moq;
using VisualStudio.TestTools.UnitTesting;
[TestClass]
public class LocationSelectionDialogTests
{
[TestMethod]
public async Task If_FacebookChannel_And_NativeControlOption_Call_FacebookLocationDialog()
{
// Arrange
var dialog = new LocationDialog(string.Empty, "facebook", string.Empty, LocationOptions.UseNativeControl);
var context = new Mock<IDialogContext>(MockBehavior.Loose);
// Act
await dialog.StartAsync(context.Object);
// Assert
context.Verify(c => c.Call(It.IsAny<FacebookNativeLocationRetrieverDialog>(), It.IsAny<ResumeAfter<LocationDialogResponse>>()), Times.Once());
}
[TestMethod]
public async Task If_FacebookChannel_And_NotNativeControlOption_Do_Not_Call_FacebookLocationDialog()
{
// Arrange
var dialog = new LocationDialog(string.Empty, "facebook", string.Empty, LocationOptions.None);
var context = new Mock<IDialogContext>(MockBehavior.Loose);
context
.Setup(c => c.MakeMessage())
.Returns(() => new Activity());
context
.Setup(c => c.PostAsync(It.IsAny<IMessageActivity>(), It.IsAny<CancellationToken>()))
.Returns(() => Task.CompletedTask);
// Act
await dialog.StartAsync(context.Object);
// Assert
context.Verify(c => c.Call(It.IsAny<FacebookNativeLocationRetrieverDialog>(), It.IsAny<ResumeAfter<LocationDialogResponse>>()), Times.Never);
}
[TestMethod]
public async Task Should_Post_To_User_Passed_Prompt_When_Start_Called()
{
// Arrange
string prompt = "Where do you want to ship your widget?";
var dialog = new LocationDialog(string.Empty, "facebook", prompt, LocationOptions.None);
var context = new Mock<IDialogContext>(MockBehavior.Loose);
context
.Setup(c => c.MakeMessage())
.Returns(() => new Activity());
context
.Setup(c => c.PostAsync(It.IsAny<IMessageActivity>(), It.IsAny<CancellationToken>()))
.Returns(() => Task.CompletedTask);
// Act
await dialog.StartAsync(context.Object);
// Assert
context.Verify(c => c.PostAsync(It.Is<IMessageActivity>(a => a.Text == prompt), It.IsAny<CancellationToken>()), Times.Once);
}
}
} | 37.30137 | 154 | 0.608153 | [
"MIT"
] | joseroubert08/BotBuilder-Location | CSharp/BotBuilderLocation.Tests/LocationSelectionDialogTests.cs | 2,725 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileBackgroud : MonoBehaviour {
public GameObject background;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//Get camera size
float vertExtent = Camera.main.orthographicSize;
float horzExtent = vertExtent * Screen.width / Screen.height;
Debug.Log (Camera.main.transform.position.x + horzExtent);
}
}
| 17.814815 | 63 | 0.721414 | [
"Apache-2.0"
] | hippunk/PlatypusCorp | Assets/Scripts/TileBackgroud.cs | 483 | C# |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Prism.Container.Extensions.Shared.Mocks;
using Prism.Container.Extensions.Shared.Tests;
using Prism.Container.Extensions.Tests.Mocks;
using Prism.Ioc;
using Xunit;
using Xunit.Abstractions;
namespace Prism.Microsoft.DependencyInjection.Extensions.Tests
{
[Collection(nameof(SharedTests))]
public class ContainerTests
{
private readonly object testLock = new object();
private ITestOutputHelper _testOutputHelper;
public ContainerTests(ITestOutputHelper testOutputHelper) =>
_testOutputHelper = testOutputHelper;
[Fact]
public void StaticInstanceSameAsNewInstance()
{
lock(testLock)
{
PrismContainerExtension.Reset();
GC.Collect();
var newInstance = PrismContainerExtension.Create();
Assert.Same(newInstance, PrismContainerExtension.Current);
}
}
[Fact]
public void StaticInstanceSameAsCreateInstance()
{
lock(testLock)
{
PrismContainerExtension.Reset();
GC.Collect();
var created = PrismContainerExtension.Create(new ServiceCollection());
Assert.Same(created, PrismContainerExtension.Current);
}
}
[Fact]
public void CreateCanOnlyBeCalledOnce()
{
lock(testLock)
{
var newInstance1 = CreateContainer();
Assert.Same(newInstance1, PrismContainerExtension.Current);
var ex = Record.Exception(() => PrismContainerExtension.Create());
Assert.NotNull(ex);
Assert.IsType<NotSupportedException>(ex);
}
}
[Fact]
public void IServiceProviderIsRegistered()
{
lock(testLock)
{
PrismContainerExtension.Reset();
GC.Collect();
Assert.True(PrismContainerExtension.Current.IsRegistered<IServiceProvider>());
}
}
[Fact]
public void IContainerProviderIsRegistered()
{
lock(testLock)
{
PrismContainerExtension.Reset();
GC.Collect();
Assert.True(PrismContainerExtension.Current.IsRegistered<IContainerProvider>());
}
}
[Fact]
public void RegisterManyHasSameTypeAcrossServices()
{
lock(testLock)
{
var c = CreateContainer();
c.RegisterMany<FooBarImpl>();
IFoo foo = null;
IBar bar = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<FooBarImpl>(foo);
ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.NotNull(bar);
Assert.IsType<FooBarImpl>(bar);
Assert.NotSame(foo, bar);
}
}
[Fact]
public void RegisterManyHasSameInstanceAcrossServices()
{
lock(testLock)
{
var c = CreateContainer();
c.RegisterManySingleton<FooBarImpl>();
IFoo foo = null;
IBar bar = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<FooBarImpl>(foo);
ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.NotNull(bar);
Assert.IsType<FooBarImpl>(bar);
Assert.Same(foo, bar);
}
}
[Fact]
public void RegisterTransientService()
{
lock(testLock)
{
var c = CreateContainer();
c.Register<IFoo, Foo>();
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<Foo>(foo);
}
}
[Fact]
public void RegisterTransientNamedService()
{
lock (testLock)
{
var c = CreateContainer();
c.Register<IFoo, Foo>("fooBar");
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(foo);
ex = null;
ex = Record.Exception(() => foo = c.Resolve<IFoo>("fooBar"));
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<Foo>(foo);
}
}
[Fact]
public void RegisterSingletonService()
{
lock(testLock)
{
var c = CreateContainer();
c.RegisterSingleton<IFoo, Foo>();
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<Foo>(foo);
Assert.Same(foo, c.Resolve<IFoo>());
}
}
[Fact]
public void RegisterInstanceResolveSameInstance()
{
lock(testLock)
{
var c = CreateContainer();
var foo = new Foo();
c.RegisterInstance<IFoo>(foo);
Assert.True(c.IsRegistered<IFoo>());
Assert.Same(foo, c.Resolve<IFoo>());
}
}
[Fact]
public void RegisterInstanceResolveSameNamedInstance()
{
lock(testLock)
{
var c = CreateContainer();
var foo = new Foo();
c.RegisterInstance<IFoo>(foo, "test");
Assert.True(c.IsRegistered<IFoo>("test"));
Assert.Same(foo, c.Resolve<IFoo>("test"));
}
}
[Fact]
public void RegisterSingletonNamedService()
{
lock(testLock)
{
var c = CreateContainer();
c.RegisterSingleton<IFoo, Foo>("fooBar");
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(foo);
ex = null;
ex = Record.Exception(() => foo = c.Resolve<IFoo>("fooBar"));
Assert.Null(ex);
Assert.NotNull(foo);
Assert.IsType<Foo>(foo);
Assert.Same(foo, c.Resolve<IFoo>("fooBar"));
}
}
[Fact]
public void FactoryCreatesTransientTypeWithoutContainerProvider()
{
lock(testLock)
{
var c = CreateContainer();
var message = "expected";
c.RegisterDelegate<IFoo>(FooFactory);
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.Equal(message, foo.Message);
Assert.NotSame(foo, c.Resolve<IFoo>());
}
}
[Fact]
public void FactoryCreatesSingletonTypeWithoutContainerProvider()
{
lock(testLock)
{
var c = CreateContainer();
var message = "expected";
c.RegisterSingletonFromDelegate<IFoo>(FooFactory);
IFoo foo = null;
var ex = Record.Exception(() => foo = c.Resolve<IFoo>());
Assert.Null(ex);
Assert.Equal(message, foo.Message);
Assert.Same(foo, c.Resolve<IFoo>());
}
}
[Fact]
public void FactoryCreatesTransientTypeWithServiceProvider()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IServiceProvider";
c.RegisterDelegate(typeof(IBar), BarFactoryWithIServiceProvider);
c.RegisterInstance<IFoo>(new Foo { Message = expectedMessage });
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.False(string.IsNullOrWhiteSpace(bar.Foo.Message));
Assert.Equal(expectedMessage, bar.Foo.Message);
Assert.NotSame(bar, c.Resolve<IBar>());
}
}
[Fact]
public void FactoryCreatesTransientTypeWithServiceProviderFromGeneric()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IServiceProvider";
c.RegisterDelegate<IBar>(BarFactoryWithIServiceProvider);
c.RegisterInstance<IFoo>(new Foo { Message = expectedMessage });
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.False(string.IsNullOrWhiteSpace(bar.Foo.Message));
Assert.Equal(expectedMessage, bar.Foo.Message);
Assert.NotSame(bar, c.Resolve<IBar>());
}
}
[Fact]
public void FactoryCreatesSingletonTypeWithServiceProvider()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IServiceProvider";
c.RegisterSingletonFromDelegate(typeof(IBar), BarFactoryWithIServiceProvider);
c.RegisterInstance<IFoo>(new Foo { Message = expectedMessage });
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.False(string.IsNullOrWhiteSpace(bar.Foo.Message));
Assert.Equal(expectedMessage, bar.Foo.Message);
Assert.Same(bar, c.Resolve<IBar>());
}
}
[Fact]
public void FactoryCreatesSingletonTypeWithServiceProviderFromGeneric()
{
lock(testLock)
{
try
{
var c = CreateContainer();
Assert.NotNull(c);
var expectedMessage = "constructed with IServiceProvider";
c.RegisterSingletonFromDelegate<IBar>(BarFactoryWithIServiceProvider);
c.RegisterInstance<IFoo>(new Foo { Message = expectedMessage });
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.False(string.IsNullOrWhiteSpace(bar.Foo.Message));
Assert.Equal(expectedMessage, bar.Foo.Message);
Assert.Same(bar, c.Resolve<IBar>());
}
catch (Exception ex)
{
_testOutputHelper.WriteLine(ex.ToString());
throw;
}
}
}
[Fact]
public void FactoryCreatesTransientTypeWithContainerProvider()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IContainerProvider";
c.RegisterDelegate(typeof(IBar), BarFactoryWithIContainerProvider);
c.RegisterSingleton<IFoo, Foo>();
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.IsType<Bar>(bar);
Assert.Equal(expectedMessage, ((Bar)bar).Message);
Assert.Same(c.Resolve<IFoo>(), bar.Foo);
Assert.NotSame(c.Resolve<IBar>(), bar);
}
}
[Fact]
public void FactoryCreatesTransientTypeWithContainerProviderWithGeneric()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IContainerProvider";
c.RegisterDelegate<IBar>(BarFactoryWithIContainerProvider);
c.RegisterSingleton<IFoo, Foo>();
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.IsType<Bar>(bar);
Assert.Equal(expectedMessage, ((Bar)bar).Message);
Assert.Same(c.Resolve<IFoo>(), bar.Foo);
Assert.NotSame(c.Resolve<IBar>(), bar);
}
}
[Fact]
public void FactoryCreatesSingletonTypeWithContainerProvider()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IContainerProvider";
c.RegisterSingletonFromDelegate(typeof(IBar), BarFactoryWithIContainerProvider);
c.RegisterSingleton<IFoo, Foo>();
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.IsType<Bar>(bar);
Assert.Equal(expectedMessage, ((Bar)bar).Message);
Assert.Same(c.Resolve<IFoo>(), bar.Foo);
Assert.Same(c.Resolve<IBar>(), bar);
}
}
[Fact]
public void FactoryCreatesSingletonTypeWithContainerProviderWithGeneric()
{
lock(testLock)
{
var c = CreateContainer();
var expectedMessage = "constructed with IContainerProvider";
c.RegisterSingletonFromDelegate<IBar>(BarFactoryWithIContainerProvider);
c.RegisterSingleton<IFoo, Foo>();
IBar bar = null;
var ex = Record.Exception(() => bar = c.Resolve<IBar>());
Assert.Null(ex);
Assert.IsType<Bar>(bar);
Assert.Equal(expectedMessage, ((Bar)bar).Message);
Assert.Same(c.Resolve<IFoo>(), bar.Foo);
Assert.Same(c.Resolve<IBar>(), bar);
}
}
[Fact]
public void ResolveWithSpecifiedTypeOverridesRegistration()
{
lock(testLock)
{
var c = CreateContainer();
c.Register<IBar, Bar>();
var foo = new Foo { Message = "This shouldn't be resolved" };
c.RegisterInstance<IFoo>(foo);
var overrideFoo = new Foo { Message = "We expect this one" };
Assert.Same(foo, c.Resolve<IFoo>());
var bar = c.Resolve<IBar>((typeof(IFoo), overrideFoo));
Assert.Same(overrideFoo, bar.Foo);
}
}
[Fact]
public void ContainerIsMutable()
{
lock(testLock)
{
var c = CreateContainer();
c.Register<IFoo, Foo>();
var foo = c.Resolve<IFoo>();
Assert.NotNull(foo);
var ex = Record.Exception(() => c.Resolve<IBar>());
Assert.NotNull(ex);
c.Register<IBar, Bar>();
var bar = c.Resolve<IBar>();
Assert.NotNull(bar);
}
}
[Fact]
public void ResolveNamedInstance()
{
var genA = new GenericService { Name = "genA" };
var genB = new GenericService { Name = "genB" };
lock (testLock)
{
var c = CreateContainer();
c.RegisterInstance<IGenericService>(genA, "genA");
c.RegisterInstance<IGenericService>(genB, "genB");
Assert.Same(genA, c.Resolve<IGenericService>("genA"));
Assert.Same(genB, c.Resolve<IGenericService>("genB"));
}
}
public static IFoo FooFactory() => new Foo { Message = "expected" };
public static IBar BarFactoryWithIContainerProvider(IContainerProvider containerProvider) =>
new Bar(containerProvider.Resolve<IFoo>())
{
Message = "constructed with IContainerProvider"
};
public static IBar BarFactoryWithIServiceProvider(IServiceProvider serviceProvider) =>
new Bar((IFoo)serviceProvider.GetService(typeof(IFoo)));
private static IContainerExtension CreateContainer()
{
PrismContainerExtension.Reset();
GC.Collect();
return PrismContainerExtension.Current;
}
}
internal class MockListener : TraceListener
{
public readonly List<string> Messages = new List<string>();
public override void Write(string message)
{
}
public override void WriteLine(string message)
{
Messages.Add(message);
}
}
}
| 31.564195 | 100 | 0.502378 | [
"MIT"
] | aritchie/Prism.Container.Extensions | tests/Prism.Microsoft.DependencyInjection.Extensions.Tests/ContainerTests.cs | 17,455 | C# |
using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace Clutch.Tests
{
[TestFixture]
public class ClutchTests
{
[Test]
public void RetrievesModelFromRoot()
{
Room room = new FluentClient<Error>("http://local.property.erm-api.com/v1/").Get<Room>("H151006172656205").Result.Entity;
Assert.IsNotNull(room);
Assert.AreEqual("H151006172656205", room.Id);
Assert.AreEqual("my city", room.City);
}
[Test]
public void RetreivesSubModel()
{
var room = new FluentClient<Error>("http://local.property.erm-api.com/v1/").Find<Room>("H151006172656205").Get<User>(1);
}
[Test]
public void CreatesModel()
{
var model = new User
{
GenderId = 0,
OccupationId = 0,
Firstname = "",
Lastname = "",
Email = "",
Phone = "",
ShowPhone = false,
LanguageCode = 1,
Age = 18,
AffiliateCode = "",
Ip = "",
};
FluentResponse<User, Error> result = new FluentClient<Error>("http://local.property.erm-api.com/v1/").Post<User>(model).Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Entity);
Assert.IsNotNullOrEmpty(result.Entity.Id);
}
[Test]
public void CanUseClientForDifferentCalls()
{
var client = new FluentClient<Error>("http://local.property.erm-api.com/v1/");
Room room1 = client.Get<Room>("H151006172656205").Result.Entity;
Room room2 = client.Get<Room>("H151006172656205").Result.Entity;
Assert.IsNotNull(room1);
Assert.IsNotNull(room2);
}
[Test]
public void HandlesNetworkFailure()
{
var client = new FluentClient<Error>("http://local.property.erm-api.com/v1/");
// server set up to fail on this code
FluentResponse<User, Error> room = client.Get<User>("forceerror").Result;
Assert.IsNotNull(room);
Assert.IsNull(room.Entity);
Assert.AreEqual(401, (int)room.StatusCode);
Assert.AreEqual("Authenticate", room.Error.Message);
}
}
public class Error
{
public int Status { get; set; }
public string Message { get; set; }
}
public class User
{
public string Id { get; set; }
public int GenderId { get; set; }
public int OccupationId { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public bool ShowPhone { get; set; }
public int LanguageCode { get; set; }
public int Age { get; set; }
public string AffiliateCode { get; set; }
public string Ip { get; set; }
}
public class Room
{
public string Id { get; set; }
public string UserId { get; set; }
public string User { get; set; }
public int TypeId { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateAvailable { get; set; }
public string DwellingCode { get; set; }
public List<Amenity> Amenities { get; set; }
public string MetroCode { get; set; }
public string StreetName { get; set; }
public string City { get; set; }
public float MapX { get; set; }
public float MapY { get; set; }
public string Description { get; set; }
public string Comment { get; set; }
}
public class Amenity
{
public int Id { get; set; }
public string Name { get; set; }
}
}
| 26.97931 | 139 | 0.540389 | [
"MIT"
] | elmore/Clutch | net40/Clutch.Tests/ClutchTests.cs | 3,914 | C# |
using Xunit;
using Build;
namespace TestSet1
{
public static class UnitTest
{
[Fact]
public static void Method1()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv1);
}
[Fact]
public static void Method10()
{
//TestSet1
var container = new Container();
container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference2",
"TestSet1.CircularReference1"
});
var sql = (PrivateSqlDataRepository)container.CreateInstance(typeof(PrivateSqlDataRepository).ToString(), System.Array.Empty<object>());
Assert.NotNull(sql);
}
[Fact]
public static void Method11()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
Assert.Throws<TypeRegistrationException>(() => container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, null));
}
[Fact]
public static void Method12()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeResolution = false });
container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference1"
});
Assert.Throws<TypeInstantiationException>(() => container.CreateInstance(typeof(PrivateSqlDataRepository2).ToString(), System.Array.Empty<object>()));
}
[Fact]
public static void Method13()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeResolution = false });
container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository"
});
Assert.Throws<TypeInstantiationException>(() => (CircularReference2)container.CreateInstance("#1()"));
}
[Fact]
public static void Method14()
{
//TestSet1
var typeConstructor = new TypeConstructor();
var typeFilter = new TypeFilter();
var typeParser = new TypeParser();
var typeResolver = new TypeResolver();
var container = new Container(new TypeActivator(), typeConstructor, typeFilter, typeParser, typeResolver);
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv1);
}
[Fact]
public static void Method15()
{
//TestSet1
var typeConstructor = new TypeConstructor();
var typeFilter = new TypeFilter();
var typeParser = new TypeParser();
var typeResolver = new TypeResolver();
var typeActivator = new TypeActivator();
var container = new Container(typeActivator, typeConstructor, typeFilter, typeParser, typeResolver);
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv1);
}
[Fact]
public static void Method16()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeAttributeOverwrite = false });
Assert.Throws<TypeRegistrationException>(() => container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference2",
"TestSet1.CircularReference1"
}));
}
[Fact]
public static void Method17()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeResolution = false, UseDefaultTypeAttributeOverwrite = false });
Assert.Throws<TypeRegistrationException>(() => container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference1"
}));
}
[Fact]
public static void Method18()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeResolution = false, UseDefaultTypeAttributeOverwrite = false });
Assert.Throws<TypeRegistrationException>(() => container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository"
}));
}
[Fact]
public static void Method19()
{
//TestSet1
var container = new Container();
container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference2",
"TestSet1.CircularReference1"
});
var sql = (PrivateSqlDataRepository)container.CreateInstance(typeof(PrivateSqlDataRepository).ToString());
Assert.Equal(0, sql.PersonId);
}
[Fact]
public static void Method2()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv2 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv2);
}
[Fact]
public static void Method20()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository(System.Int32)");
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method21()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
var srv1 = container.CreateInstance("TestSet1.PrivateSqlDataRepository", 0);
Assert.NotNull(srv1);
}
[Fact]
public static void Method22()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
Assert.NotNull(container.CreateInstance("TestSet1.PrivateSqlDataRepository"));
}
[Fact]
public static void Method23()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
Assert.NotNull(container.CreateInstance("TestSet1.PrivateSqlDataRepository"));
}
[Fact]
public static void Method24()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeAttributeOverwrite = false });
container.Lock();
Assert.Throws<TypeRegistrationException>(() => container.RegisterAssembly(typeof(PrivateSqlDataRepository).Assembly, new string[] {
"Fail_TestSet7.SqlDataRepository",
"Fail_TestSet6.ServiceDataRepository",
"Fail_TestSet6.SqlDataRepository",
"Fail_TestSet5.ServiceDataRepository",
"Fail_TestSet5.SqlDataRepository",
"Fail_TestSet4.SqlDataRepository(.*)",
"Fail_TestSet4.ServiceDataRepository(.*)",
"Fail_TestSet3.SqlDataRepository",
"Fail_TestSet2.ServiceDataRepository",
"Fail_TestSet1.Other",
"Fail_TestSet1.PrivateConstructorServiceDataRepository",
"Fail_TestSet1.ServiceDataRepository",
"TestSet1.PrivateSqlDataRepository2",
"TestSet1.CircularReference3",
"TestSet1.CircularReference2",
"TestSet1.CircularReference1"
}));
}
[Fact]
public static void Method25()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository");
Assert.Equal(0, sql.PersonId);
}
[Fact]
public static void Method26()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.CreateInstance("TestSet1.PrivateSqlDataRepository", 2);
Assert.Equal(2, sql.PersonId);
}
[Fact]
public static void Method27()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository", 2);
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method28()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 3);
Assert.Equal(3, sql.PersonId);
}
[Fact]
public static void Method29()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository(System.Int32)");
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method3()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv1.Repository);
}
[Fact]
public static void Method30()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
var sql = (PrivateSqlDataRepository)container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 1);
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method31()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var type = container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 2);
var sql = (PrivateSqlDataRepository)container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)");
Assert.True(type != null && type.GetType() == typeof(PrivateSqlDataRepository));
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method32()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(1);
var type = container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 2);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository(System.Int32)");
Assert.True(type != null && type.GetType() == typeof(PrivateSqlDataRepository));
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method33()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var type = container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 2);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository", 1);
Assert.True(type != null && type.GetType() == typeof(PrivateSqlDataRepository));
Assert.Equal(2, sql.PersonId);
}
[Fact]
public static void Method34()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var type = container.CreateInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 2);
var sql = (PrivateSqlDataRepository)container.CreateInstance("TestSet1.PrivateSqlDataRepository", 1);
Assert.True(type != null && type.GetType() == typeof(PrivateSqlDataRepository));
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method35()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository", 1);
Assert.Equal(2, sql.PersonId);
}
[Fact]
public static void Method36()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var sql = (PrivateSqlDataRepository)container.CreateInstance("TestSet1.PrivateSqlDataRepository", 1);
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method37()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
Assert.Throws<TypeInstantiationException>(() => container.GetInstance("TestSet1.PrivateSqlDataRepository()", 1));
}
[Fact]
public static void Method38()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = true });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository(System.Int32)", 1);
Assert.Equal(1, sql.PersonId);
}
[Fact]
public static void Method39()
{
//TestSet1
var container = new Container(new TypeBuilderOptions() { UseDefaultConstructor = false });
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>(2);
var sql = (PrivateSqlDataRepository)container.GetInstance("TestSet1.PrivateSqlDataRepository", 1);
Assert.Equal(2, sql.PersonId);
}
[Fact]
public static void Method4()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv2 = container.CreateInstance<ServiceDataRepository>();
Assert.NotNull(srv2.Repository);
}
[Fact]
public static void Method5()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
var srv2 = container.CreateInstance<ServiceDataRepository>();
Assert.NotEqual(srv1, srv2);
}
[Fact]
public static void Method6()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
var srv1 = container.CreateInstance<ServiceDataRepository>();
var srv2 = container.CreateInstance<ServiceDataRepository>();
Assert.NotEqual(srv1.Repository, srv2.Repository);
}
[Fact]
public static void Method7()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
var srv1 = container.CreateInstance("TestSet1.PrivateSqlDataRepository");
Assert.NotNull(srv1);
}
[Fact]
public static void Method8()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
string name = null;
Assert.Throws<TypeInstantiationException>(() => (PrivateSqlDataRepository)container.CreateInstance(name));
}
[Fact]
public static void Method9()
{
//TestSet1
var container = new Container();
container.RegisterType<SqlDataRepository>();
container.RegisterType<ServiceDataRepository>();
container.RegisterType<PrivateSqlDataRepository>();
string name = null;
Assert.Throws<TypeInstantiationException>(() => (PrivateSqlDataRepository)container.CreateInstance(name, System.Array.Empty<object>()));
}
[Fact]
public static void TestSet1_Method0()
{
//TestSet1
var container = new Container();
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method1()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = false });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method2()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = true });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method3()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = true, UseDefaultTypeResolution = true });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method4()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = true, UseDefaultTypeResolution = false });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method5()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = false, UseDefaultTypeResolution = true });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method6()
{
//TestSet1
var container = new Container(new TypeBuilderOptions { UseDefaultTypeInstantiation = false, UseDefaultTypeResolution = false });
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Instance });
Assert.True(instance.GetPersonId() == 2021);
}
[Fact]
public static void TestSet1_Method7()
{
//TestSet1
var container = new Container();
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository), new ParameterSource[] { ParameterSource.Default });
Assert.True(instance.GetPersonId() == 1);
}
[Fact]
public static void TestSet1_Method8()
{
//TestSet1
var container = new Container();
container.RegisterType<PersonRepository>(1);
var instance = (PersonRepository)container.CreateInstance(typeof(PersonRepository));
Assert.True(instance.GetPersonId() == 1);
}
}
} | 44.92 | 162 | 0.617658 | [
"MIT"
] | funcelot/build | Build.Tests/Tests/UnitTest1.cs | 30,321 | 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 mediaconnect-2018-11-14.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using Amazon.MediaConnect.Model;
using Amazon.MediaConnect.Model.Internal.MarshallTransformations;
using Amazon.MediaConnect.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.MediaConnect
{
/// <summary>
/// Implementation for accessing MediaConnect
///
/// API for AWS Elemental MediaConnect
/// </summary>
public partial class AmazonMediaConnectClient : AmazonServiceClient, IAmazonMediaConnect
{
private static IServiceMetadata serviceMetadata = new AmazonMediaConnectMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonMediaConnectConfig()) { }
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonMediaConnectConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient Configuration Object</param>
public AmazonMediaConnectClient(AmazonMediaConnectConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonMediaConnectClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonMediaConnectClient(AWSCredentials credentials)
: this(credentials, new AmazonMediaConnectConfig())
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonMediaConnectClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonMediaConnectConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient with AWS Credentials and an
/// AmazonMediaConnectClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonMediaConnectClient Configuration Object</param>
public AmazonMediaConnectClient(AWSCredentials credentials, AmazonMediaConnectConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonMediaConnectConfig())
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonMediaConnectConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonMediaConnectClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonMediaConnectClient Configuration Object</param>
public AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonMediaConnectConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMediaConnectConfig())
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient 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 AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMediaConnectConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonMediaConnectClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonMediaConnectClient 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 AmazonMediaConnectClient Configuration Object</param>
public AmazonMediaConnectClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonMediaConnectConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region AddFlowOutputs
/// <summary>
/// Adds outputs to an existing flow. You can create up to 50 outputs per flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowOutputs service method.</param>
///
/// <returns>The response from the AddFlowOutputs service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.AddFlowOutputs420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowOutputs">REST API Reference for AddFlowOutputs Operation</seealso>
public virtual AddFlowOutputsResponse AddFlowOutputs(AddFlowOutputsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowOutputsRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowOutputsResponseUnmarshaller.Instance;
return Invoke<AddFlowOutputsResponse>(request, options);
}
/// <summary>
/// Adds outputs to an existing flow. You can create up to 50 outputs per flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowOutputs service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddFlowOutputs service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.AddFlowOutputs420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowOutputs">REST API Reference for AddFlowOutputs Operation</seealso>
public virtual Task<AddFlowOutputsResponse> AddFlowOutputsAsync(AddFlowOutputsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowOutputsRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowOutputsResponseUnmarshaller.Instance;
return InvokeAsync<AddFlowOutputsResponse>(request, options, cancellationToken);
}
#endregion
#region AddFlowSources
/// <summary>
/// Adds Sources to flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowSources service method.</param>
///
/// <returns>The response from the AddFlowSources service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowSources">REST API Reference for AddFlowSources Operation</seealso>
public virtual AddFlowSourcesResponse AddFlowSources(AddFlowSourcesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowSourcesResponseUnmarshaller.Instance;
return Invoke<AddFlowSourcesResponse>(request, options);
}
/// <summary>
/// Adds Sources to flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowSources service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddFlowSources service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowSources">REST API Reference for AddFlowSources Operation</seealso>
public virtual Task<AddFlowSourcesResponse> AddFlowSourcesAsync(AddFlowSourcesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowSourcesResponseUnmarshaller.Instance;
return InvokeAsync<AddFlowSourcesResponse>(request, options, cancellationToken);
}
#endregion
#region AddFlowVpcInterfaces
/// <summary>
/// Adds VPC interfaces to flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowVpcInterfaces service method.</param>
///
/// <returns>The response from the AddFlowVpcInterfaces service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowVpcInterfaces">REST API Reference for AddFlowVpcInterfaces Operation</seealso>
public virtual AddFlowVpcInterfacesResponse AddFlowVpcInterfaces(AddFlowVpcInterfacesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowVpcInterfacesRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowVpcInterfacesResponseUnmarshaller.Instance;
return Invoke<AddFlowVpcInterfacesResponse>(request, options);
}
/// <summary>
/// Adds VPC interfaces to flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the AddFlowVpcInterfaces service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the AddFlowVpcInterfaces service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/AddFlowVpcInterfaces">REST API Reference for AddFlowVpcInterfaces Operation</seealso>
public virtual Task<AddFlowVpcInterfacesResponse> AddFlowVpcInterfacesAsync(AddFlowVpcInterfacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = AddFlowVpcInterfacesRequestMarshaller.Instance;
options.ResponseUnmarshaller = AddFlowVpcInterfacesResponseUnmarshaller.Instance;
return InvokeAsync<AddFlowVpcInterfacesResponse>(request, options, cancellationToken);
}
#endregion
#region CreateFlow
/// <summary>
/// Creates a new flow. The request must include one source. The request optionally can
/// include outputs (up to 50) and entitlements (up to 50).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateFlow service method.</param>
///
/// <returns>The response from the CreateFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.CreateFlow420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/CreateFlow">REST API Reference for CreateFlow Operation</seealso>
public virtual CreateFlowResponse CreateFlow(CreateFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateFlowResponseUnmarshaller.Instance;
return Invoke<CreateFlowResponse>(request, options);
}
/// <summary>
/// Creates a new flow. The request must include one source. The request optionally can
/// include outputs (up to 50) and entitlements (up to 50).
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the CreateFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.CreateFlow420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/CreateFlow">REST API Reference for CreateFlow Operation</seealso>
public virtual Task<CreateFlowResponse> CreateFlowAsync(CreateFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateFlowResponseUnmarshaller.Instance;
return InvokeAsync<CreateFlowResponse>(request, options, cancellationToken);
}
#endregion
#region DeleteFlow
/// <summary>
/// Deletes a flow. Before you can delete a flow, you must stop the flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteFlow service method.</param>
///
/// <returns>The response from the DeleteFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/DeleteFlow">REST API Reference for DeleteFlow Operation</seealso>
public virtual DeleteFlowResponse DeleteFlow(DeleteFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFlowResponseUnmarshaller.Instance;
return Invoke<DeleteFlowResponse>(request, options);
}
/// <summary>
/// Deletes a flow. Before you can delete a flow, you must stop the flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DeleteFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/DeleteFlow">REST API Reference for DeleteFlow Operation</seealso>
public virtual Task<DeleteFlowResponse> DeleteFlowAsync(DeleteFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteFlowResponseUnmarshaller.Instance;
return InvokeAsync<DeleteFlowResponse>(request, options, cancellationToken);
}
#endregion
#region DescribeFlow
/// <summary>
/// Displays the details of a flow. The response includes the flow ARN, name, and Availability
/// Zone, as well as details about the source, outputs, and entitlements.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeFlow service method.</param>
///
/// <returns>The response from the DescribeFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/DescribeFlow">REST API Reference for DescribeFlow Operation</seealso>
public virtual DescribeFlowResponse DescribeFlow(DescribeFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeFlowResponseUnmarshaller.Instance;
return Invoke<DescribeFlowResponse>(request, options);
}
/// <summary>
/// Displays the details of a flow. The response includes the flow ARN, name, and Availability
/// Zone, as well as details about the source, outputs, and entitlements.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the DescribeFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/DescribeFlow">REST API Reference for DescribeFlow Operation</seealso>
public virtual Task<DescribeFlowResponse> DescribeFlowAsync(DescribeFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeFlowResponseUnmarshaller.Instance;
return InvokeAsync<DescribeFlowResponse>(request, options, cancellationToken);
}
#endregion
#region GrantFlowEntitlements
/// <summary>
/// Grants entitlements to an existing flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GrantFlowEntitlements service method.</param>
///
/// <returns>The response from the GrantFlowEntitlements service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.GrantFlowEntitlements420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/GrantFlowEntitlements">REST API Reference for GrantFlowEntitlements Operation</seealso>
public virtual GrantFlowEntitlementsResponse GrantFlowEntitlements(GrantFlowEntitlementsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GrantFlowEntitlementsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GrantFlowEntitlementsResponseUnmarshaller.Instance;
return Invoke<GrantFlowEntitlementsResponse>(request, options);
}
/// <summary>
/// Grants entitlements to an existing flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the GrantFlowEntitlements service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the GrantFlowEntitlements service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.GrantFlowEntitlements420Exception">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/GrantFlowEntitlements">REST API Reference for GrantFlowEntitlements Operation</seealso>
public virtual Task<GrantFlowEntitlementsResponse> GrantFlowEntitlementsAsync(GrantFlowEntitlementsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GrantFlowEntitlementsRequestMarshaller.Instance;
options.ResponseUnmarshaller = GrantFlowEntitlementsResponseUnmarshaller.Instance;
return InvokeAsync<GrantFlowEntitlementsResponse>(request, options, cancellationToken);
}
#endregion
#region ListEntitlements
/// <summary>
/// Displays a list of all entitlements that have been granted to this account. This request
/// returns 20 results per page.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEntitlements service method.</param>
///
/// <returns>The response from the ListEntitlements service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListEntitlements">REST API Reference for ListEntitlements Operation</seealso>
public virtual ListEntitlementsResponse ListEntitlements(ListEntitlementsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEntitlementsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEntitlementsResponseUnmarshaller.Instance;
return Invoke<ListEntitlementsResponse>(request, options);
}
/// <summary>
/// Displays a list of all entitlements that have been granted to this account. This request
/// returns 20 results per page.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEntitlements service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListEntitlements service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListEntitlements">REST API Reference for ListEntitlements Operation</seealso>
public virtual Task<ListEntitlementsResponse> ListEntitlementsAsync(ListEntitlementsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEntitlementsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEntitlementsResponseUnmarshaller.Instance;
return InvokeAsync<ListEntitlementsResponse>(request, options, cancellationToken);
}
#endregion
#region ListFlows
/// <summary>
/// Displays a list of flows that are associated with this account. This request returns
/// a paginated result.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListFlows service method.</param>
///
/// <returns>The response from the ListFlows service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListFlows">REST API Reference for ListFlows Operation</seealso>
public virtual ListFlowsResponse ListFlows(ListFlowsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFlowsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFlowsResponseUnmarshaller.Instance;
return Invoke<ListFlowsResponse>(request, options);
}
/// <summary>
/// Displays a list of flows that are associated with this account. This request returns
/// a paginated result.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListFlows service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListFlows service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListFlows">REST API Reference for ListFlows Operation</seealso>
public virtual Task<ListFlowsResponse> ListFlowsAsync(ListFlowsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListFlowsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListFlowsResponseUnmarshaller.Instance;
return InvokeAsync<ListFlowsResponse>(request, options, cancellationToken);
}
#endregion
#region ListTagsForResource
/// <summary>
/// List all tags on an AWS Elemental MediaConnect resource
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return Invoke<ListTagsForResourceResponse>(request, options);
}
/// <summary>
/// List all tags on an AWS Elemental MediaConnect resource
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual Task<ListTagsForResourceResponse> ListTagsForResourceAsync(ListTagsForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return InvokeAsync<ListTagsForResourceResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveFlowOutput
/// <summary>
/// Removes an output from an existing flow. This request can be made only on an output
/// that does not have an entitlement associated with it. If the output has an entitlement,
/// you must revoke the entitlement instead. When an entitlement is revoked from a flow,
/// the service automatically removes the associated output.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowOutput service method.</param>
///
/// <returns>The response from the RemoveFlowOutput service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowOutput">REST API Reference for RemoveFlowOutput Operation</seealso>
public virtual RemoveFlowOutputResponse RemoveFlowOutput(RemoveFlowOutputRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowOutputRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowOutputResponseUnmarshaller.Instance;
return Invoke<RemoveFlowOutputResponse>(request, options);
}
/// <summary>
/// Removes an output from an existing flow. This request can be made only on an output
/// that does not have an entitlement associated with it. If the output has an entitlement,
/// you must revoke the entitlement instead. When an entitlement is revoked from a flow,
/// the service automatically removes the associated output.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowOutput service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveFlowOutput service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowOutput">REST API Reference for RemoveFlowOutput Operation</seealso>
public virtual Task<RemoveFlowOutputResponse> RemoveFlowOutputAsync(RemoveFlowOutputRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowOutputRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowOutputResponseUnmarshaller.Instance;
return InvokeAsync<RemoveFlowOutputResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveFlowSource
/// <summary>
/// Removes a source from an existing flow. This request can be made only if there is
/// more than one source on the flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowSource service method.</param>
///
/// <returns>The response from the RemoveFlowSource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowSource">REST API Reference for RemoveFlowSource Operation</seealso>
public virtual RemoveFlowSourceResponse RemoveFlowSource(RemoveFlowSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowSourceResponseUnmarshaller.Instance;
return Invoke<RemoveFlowSourceResponse>(request, options);
}
/// <summary>
/// Removes a source from an existing flow. This request can be made only if there is
/// more than one source on the flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowSource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveFlowSource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowSource">REST API Reference for RemoveFlowSource Operation</seealso>
public virtual Task<RemoveFlowSourceResponse> RemoveFlowSourceAsync(RemoveFlowSourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowSourceResponseUnmarshaller.Instance;
return InvokeAsync<RemoveFlowSourceResponse>(request, options, cancellationToken);
}
#endregion
#region RemoveFlowVpcInterface
/// <summary>
/// Removes a VPC Interface from an existing flow. This request can be made only on a
/// VPC interface that does not have a Source or Output associated with it. If the VPC
/// interface is referenced by a Source or Output, you must first delete or update the
/// Source or Output to no longer reference the VPC interface.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowVpcInterface service method.</param>
///
/// <returns>The response from the RemoveFlowVpcInterface service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowVpcInterface">REST API Reference for RemoveFlowVpcInterface Operation</seealso>
public virtual RemoveFlowVpcInterfaceResponse RemoveFlowVpcInterface(RemoveFlowVpcInterfaceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowVpcInterfaceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowVpcInterfaceResponseUnmarshaller.Instance;
return Invoke<RemoveFlowVpcInterfaceResponse>(request, options);
}
/// <summary>
/// Removes a VPC Interface from an existing flow. This request can be made only on a
/// VPC interface that does not have a Source or Output associated with it. If the VPC
/// interface is referenced by a Source or Output, you must first delete or update the
/// Source or Output to no longer reference the VPC interface.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveFlowVpcInterface service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RemoveFlowVpcInterface service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RemoveFlowVpcInterface">REST API Reference for RemoveFlowVpcInterface Operation</seealso>
public virtual Task<RemoveFlowVpcInterfaceResponse> RemoveFlowVpcInterfaceAsync(RemoveFlowVpcInterfaceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveFlowVpcInterfaceRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveFlowVpcInterfaceResponseUnmarshaller.Instance;
return InvokeAsync<RemoveFlowVpcInterfaceResponse>(request, options, cancellationToken);
}
#endregion
#region RevokeFlowEntitlement
/// <summary>
/// Revokes an entitlement from a flow. Once an entitlement is revoked, the content becomes
/// unavailable to the subscriber and the associated output is removed.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RevokeFlowEntitlement service method.</param>
///
/// <returns>The response from the RevokeFlowEntitlement service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RevokeFlowEntitlement">REST API Reference for RevokeFlowEntitlement Operation</seealso>
public virtual RevokeFlowEntitlementResponse RevokeFlowEntitlement(RevokeFlowEntitlementRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RevokeFlowEntitlementRequestMarshaller.Instance;
options.ResponseUnmarshaller = RevokeFlowEntitlementResponseUnmarshaller.Instance;
return Invoke<RevokeFlowEntitlementResponse>(request, options);
}
/// <summary>
/// Revokes an entitlement from a flow. Once an entitlement is revoked, the content becomes
/// unavailable to the subscriber and the associated output is removed.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RevokeFlowEntitlement service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the RevokeFlowEntitlement service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/RevokeFlowEntitlement">REST API Reference for RevokeFlowEntitlement Operation</seealso>
public virtual Task<RevokeFlowEntitlementResponse> RevokeFlowEntitlementAsync(RevokeFlowEntitlementRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RevokeFlowEntitlementRequestMarshaller.Instance;
options.ResponseUnmarshaller = RevokeFlowEntitlementResponseUnmarshaller.Instance;
return InvokeAsync<RevokeFlowEntitlementResponse>(request, options, cancellationToken);
}
#endregion
#region StartFlow
/// <summary>
/// Starts a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartFlow service method.</param>
///
/// <returns>The response from the StartFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/StartFlow">REST API Reference for StartFlow Operation</seealso>
public virtual StartFlowResponse StartFlow(StartFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StartFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartFlowResponseUnmarshaller.Instance;
return Invoke<StartFlowResponse>(request, options);
}
/// <summary>
/// Starts a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StartFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the StartFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/StartFlow">REST API Reference for StartFlow Operation</seealso>
public virtual Task<StartFlowResponse> StartFlowAsync(StartFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = StartFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = StartFlowResponseUnmarshaller.Instance;
return InvokeAsync<StartFlowResponse>(request, options, cancellationToken);
}
#endregion
#region StopFlow
/// <summary>
/// Stops a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StopFlow service method.</param>
///
/// <returns>The response from the StopFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/StopFlow">REST API Reference for StopFlow Operation</seealso>
public virtual StopFlowResponse StopFlow(StopFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = StopFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopFlowResponseUnmarshaller.Instance;
return Invoke<StopFlowResponse>(request, options);
}
/// <summary>
/// Stops a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the StopFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the StopFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/StopFlow">REST API Reference for StopFlow Operation</seealso>
public virtual Task<StopFlowResponse> StopFlowAsync(StopFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = StopFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = StopFlowResponseUnmarshaller.Instance;
return InvokeAsync<StopFlowResponse>(request, options, cancellationToken);
}
#endregion
#region TagResource
/// <summary>
/// Associates the specified tags to a resource with the specified resourceArn. If existing
/// tags on a resource are not specified in the request parameters, they are not changed.
/// When a resource is deleted, the tags associated with that resource are deleted as
/// well.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
///
/// <returns>The response from the TagResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke<TagResourceResponse>(request, options);
}
/// <summary>
/// Associates the specified tags to a resource with the specified resourceArn. If existing
/// tags on a resource are not specified in the request parameters, they are not changed.
/// When a resource is deleted, the tags associated with that resource are deleted as
/// well.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the TagResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual Task<TagResourceResponse> TagResourceAsync(TagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return InvokeAsync<TagResourceResponse>(request, options, cancellationToken);
}
#endregion
#region UntagResource
/// <summary>
/// Deletes specified tags from a resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
///
/// <returns>The response from the UntagResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke<UntagResourceResponse>(request, options);
}
/// <summary>
/// Deletes specified tags from a resource.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UntagResource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual Task<UntagResourceResponse> UntagResourceAsync(UntagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return InvokeAsync<UntagResourceResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateFlow
/// <summary>
/// Updates flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlow service method.</param>
///
/// <returns>The response from the UpdateFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlow">REST API Reference for UpdateFlow Operation</seealso>
public virtual UpdateFlowResponse UpdateFlow(UpdateFlowRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowResponseUnmarshaller.Instance;
return Invoke<UpdateFlowResponse>(request, options);
}
/// <summary>
/// Updates flow
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlow service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateFlow service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlow">REST API Reference for UpdateFlow Operation</seealso>
public virtual Task<UpdateFlowResponse> UpdateFlowAsync(UpdateFlowRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowResponseUnmarshaller.Instance;
return InvokeAsync<UpdateFlowResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateFlowEntitlement
/// <summary>
/// You can change an entitlement's description, subscribers, and encryption. If you change
/// the subscribers, the service will remove the outputs that are are used by the subscribers
/// that are removed.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowEntitlement service method.</param>
///
/// <returns>The response from the UpdateFlowEntitlement service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowEntitlement">REST API Reference for UpdateFlowEntitlement Operation</seealso>
public virtual UpdateFlowEntitlementResponse UpdateFlowEntitlement(UpdateFlowEntitlementRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowEntitlementRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowEntitlementResponseUnmarshaller.Instance;
return Invoke<UpdateFlowEntitlementResponse>(request, options);
}
/// <summary>
/// You can change an entitlement's description, subscribers, and encryption. If you change
/// the subscribers, the service will remove the outputs that are are used by the subscribers
/// that are removed.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowEntitlement service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateFlowEntitlement service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowEntitlement">REST API Reference for UpdateFlowEntitlement Operation</seealso>
public virtual Task<UpdateFlowEntitlementResponse> UpdateFlowEntitlementAsync(UpdateFlowEntitlementRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowEntitlementRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowEntitlementResponseUnmarshaller.Instance;
return InvokeAsync<UpdateFlowEntitlementResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateFlowOutput
/// <summary>
/// Updates an existing flow output.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowOutput service method.</param>
///
/// <returns>The response from the UpdateFlowOutput service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowOutput">REST API Reference for UpdateFlowOutput Operation</seealso>
public virtual UpdateFlowOutputResponse UpdateFlowOutput(UpdateFlowOutputRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowOutputRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowOutputResponseUnmarshaller.Instance;
return Invoke<UpdateFlowOutputResponse>(request, options);
}
/// <summary>
/// Updates an existing flow output.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowOutput service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateFlowOutput service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowOutput">REST API Reference for UpdateFlowOutput Operation</seealso>
public virtual Task<UpdateFlowOutputResponse> UpdateFlowOutputAsync(UpdateFlowOutputRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowOutputRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowOutputResponseUnmarshaller.Instance;
return InvokeAsync<UpdateFlowOutputResponse>(request, options, cancellationToken);
}
#endregion
#region UpdateFlowSource
/// <summary>
/// Updates the source of a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowSource service method.</param>
///
/// <returns>The response from the UpdateFlowSource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowSource">REST API Reference for UpdateFlowSource Operation</seealso>
public virtual UpdateFlowSourceResponse UpdateFlowSource(UpdateFlowSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowSourceResponseUnmarshaller.Instance;
return Invoke<UpdateFlowSourceResponse>(request, options);
}
/// <summary>
/// Updates the source of a flow.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UpdateFlowSource service method.</param>
/// <param name="cancellationToken">
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// </param>
///
/// <returns>The response from the UpdateFlowSource service method, as returned by MediaConnect.</returns>
/// <exception cref="Amazon.MediaConnect.Model.BadRequestException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ForbiddenException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.InternalServerErrorException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.NotFoundException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.ServiceUnavailableException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <exception cref="Amazon.MediaConnect.Model.TooManyRequestsException">
/// Exception raised by AWS Elemental MediaConnect. See the error message and documentation
/// for the operation for more information on the cause of this exception.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediaconnect-2018-11-14/UpdateFlowSource">REST API Reference for UpdateFlowSource Operation</seealso>
public virtual Task<UpdateFlowSourceResponse> UpdateFlowSourceAsync(UpdateFlowSourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateFlowSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateFlowSourceResponseUnmarshaller.Instance;
return InvokeAsync<UpdateFlowSourceResponse>(request, options, cancellationToken);
}
#endregion
}
} | 61.428239 | 209 | 0.687965 | [
"Apache-2.0"
] | JeffAshton/aws-sdk-net | sdk/src/Services/MediaConnect/Generated/_bcl45/AmazonMediaConnectClient.cs | 131,825 | C# |
using UnityEngine;
using UnityEngine.UI;
using Beautify.Universal;
namespace Beautify.Demos {
public class Demo : MonoBehaviour {
private void Start() {
UpdateText();
}
void Update() {
if (Input.GetKeyDown(KeyCode.J)) {
BeautifySettings.settings.bloomIntensity.value += 0.1f;
}
if (Input.GetKeyDown(KeyCode.T) || Input.GetMouseButtonDown(0)) {
BeautifySettings.settings.disabled.value = !BeautifySettings.settings.disabled.value;
UpdateText();
}
if (Input.GetKeyDown(KeyCode.B)) BeautifySettings.Blink(0.2f);
if (Input.GetKeyDown(KeyCode.C)) {
BeautifySettings.settings.compareMode.value = !BeautifySettings.settings.compareMode.value;
}
if (Input.GetKeyDown(KeyCode.N)) {
BeautifySettings.settings.nightVision.Override(!BeautifySettings.settings.nightVision.value);
}
if (Input.GetKeyDown(KeyCode.Alpha1)) {
// applies a custom value to brightness
BeautifySettings.settings.brightness.Override(0.1f);
}
if (Input.GetKeyDown(KeyCode.Alpha2)) {
// applies a custom value to brightness
BeautifySettings.settings.brightness.Override(0.5f);
}
if (Input.GetKeyDown(KeyCode.Alpha3)) {
// disables custom value
BeautifySettings.settings.brightness.overrideState = false;
}
}
void UpdateText() {
if (BeautifySettings.settings.disabled.value) {
GameObject.Find("Beautify").GetComponent<Text>().text = "Beautify OFF";
} else {
GameObject.Find("Beautify").GetComponent<Text>().text = "Beautify ON";
}
}
}
}
| 32.220339 | 109 | 0.5697 | [
"MIT"
] | JohnMurwin/NaturalSelectionSimulation | Assets/Plugins/Beautify/URP/Demo/DemoSources/Scripts/Demo.cs | 1,901 | C# |
// using System.Collections.Generic;
// using System.Linq;
// using System.Threading.Tasks;
// using Game.Models;
// using Game.Dtos.Character;
// using AutoMapper;
// using System;
// using Game.Data;
// using Microsoft.EntityFrameworkCore;
// namespace Game.Services
// {
// public class CharacterService : ICharacterService
// {
// private readonly IMapper _mapper;
// private readonly DataContext _context;
// public CharacterService(IMapper mapper, DataContext context)
// {
// _context = context;
// _mapper = mapper;
// }
// public async Task<ServiceResponse<List<GetCharacterDto>>> AddCharacter(AddCharacterDto newCharacter)
// {
// ServiceResponse<List<GetCharacterDto>> serviceResponse = new ServiceResponse<List<GetCharacterDto>>();
// Character character = _mapper.Map<Character>(newCharacter);
// await _context.Characters.AddAsync(character);
// await _context.SaveChangesAsync();
// serviceResponse.Data = (_context.Characters.Select(c => _mapper.Map<GetCharacterDto>(c))).ToList();
// return serviceResponse;
// }
// public async Task<ServiceResponse<List<GetCharacterDto>>> GetAllCharacters()
// {
// ServiceResponse<List<GetCharacterDto>> serviceResponse = new ServiceResponse<List<GetCharacterDto>>();
// List<Character> dbCharacters = await _context.Characters.ToListAsync();
// serviceResponse.Data = dbCharacters.Select(c => _mapper.Map<GetCharacterDto>(c)).ToList();
// return serviceResponse;
// }
// public async Task<ServiceResponse<GetCharacterDto>> GetCharacterById(int id)
// {
// ServiceResponse<GetCharacterDto> serviceResponse = new ServiceResponse<GetCharacterDto>();
// Character dbCharacter = await _context.Characters.FirstOrDefaultAsync(c => c.Id == id);
// serviceResponse.Data = _mapper.Map<GetCharacterDto>(dbCharacter);
// return serviceResponse;
// }
// public async Task<ServiceResponse<GetCharacterDto>> UpdateCharacter(UpdateCharacterDto updatedCharacter)
// {
// ServiceResponse<GetCharacterDto> serviceResponse = new ServiceResponse<GetCharacterDto>();
// try
// {
// Character character = await _context.Characters.FirstOrDefaultAsync(c => c.Id == updatedCharacter.Id);
// character.Name = updatedCharacter.Name;
// character.Class = updatedCharacter.Class;
// character.Defense = updatedCharacter.Defense;
// character.HitPoints = updatedCharacter.HitPoints;
// character.Intelligence = updatedCharacter.Intelligence;
// character.Strength = updatedCharacter.Strength;
// _context.Characters.Update(character);
// await _context.SaveChangesAsync();
// serviceResponse.Message = "Character saved successfully.";
// serviceResponse.Data = _mapper.Map<GetCharacterDto>(character);
// }
// catch (Exception ex)
// {
// serviceResponse.Success = false;
// serviceResponse.Message = ex.Message;
// }
// return serviceResponse;
// }
// public async Task<ServiceResponse<List<GetCharacterDto>>> DeleteCharacter(int id)
// {
// ServiceResponse<List<GetCharacterDto>> serviceResponse = new ServiceResponse<List<GetCharacterDto>>();
// try
// {
// Character character = await _context.Characters.FirstAsync(c => c.Id == id);
// _context.Characters.Remove(character);
// await _context.SaveChangesAsync();
// serviceResponse.Message = "Character deleted successfully.";
// serviceResponse.Data = (_context.Characters.Select(c => _mapper.Map<GetCharacterDto>(c))).ToList();
// }
// catch (Exception ex)
// {
// serviceResponse.Success = false;
// serviceResponse.Message = ex.Message;
// }
// return serviceResponse;
// }
// }
// } | 44.272727 | 121 | 0.597308 | [
"MIT"
] | Vehx/idle-game | Services/CharacterService/CharacterService.cs | 4,383 | C# |
using CrazyflieDotNet.Crazyflie.Feature.Log;
namespace CrazyflieDotNet.Crazyflie.Feature
{
/// <summary>
/// Interface of the logger port of the crazyflie.
/// </summary>
public interface ICrazyflieLogger
{
/// <summary>
/// Create a new empty log config entry which can then be customized.
/// To enable logging for this entry, call <see cref="AddConfig"/> afterwards.
/// </summary>
/// <param name="name">the name of the log entry</param>
/// <param name="period">the send interval in ms (max 2550ms).</param>
LogConfig CreateEmptyLogConfigEntry(string name, ushort period);
/// <summary>
/// Add a log configuration to the logging framework.
///
/// When doing this the contents of the log configuration will be validated
/// and listeners for new log configurations will be notified. When
/// validating the configuration the variables are checked against the TOC
/// to see that they actually exist.If they don't then the configuration
/// cannot be used.Since a valid TOC is required, a Crazyflie has to be
/// connected when calling this method, otherwise it will fail.
/// </summary>
void AddConfig(LogConfig config);
/// <summary>
/// After the log config has been added, it can be started.
/// After it is started, the crazyflie sends log entries.
/// </summary>
void StartConfig(LogConfig config);
/// <summary>
/// Stops and added config.
/// </summary>
void StopConfig(LogConfig config);
/// <summary>
/// Delete and added config.
/// </summary>
void DeleteConfig(LogConfig config);
/// <summary>
/// Returns true if the log variable is known in the toc.
/// </summary>
bool IsLogVariableKnown(string completeName);
}
} | 36.754717 | 86 | 0.613963 | [
"MIT"
] | DominicUllmann/CrazyflieDotNet | CrazyflieDotNet/Source/CrazyflieDotNet.Crazyflie/Feature/ICrazyflieLogger.cs | 1,950 | C# |
using System;
using System.IO;
namespace LostFoot
{
public class CSharpLayerImpl: DrawMe
{
public Game game;
public int width = 800;
public int height = 480;
public CSharpLayerImpl() : base()
{
}
public override void init()
{
try
{
RustyGL.glViewport (0, 0, width, height);
RustyGL.glEnable ((uint)RustyGL.GL_TEXTURE_2D);
RustyGL.glEnable ((uint)RustyGL.GL_DEPTH_TEST);
RustyGL.glEnable ((uint)RustyGL.GL_BLEND);
RustyGL.glBlendFunc ((uint)RustyGL.GL_SRC_ALPHA, (uint)RustyGL.GL_ONE_MINUS_SRC_ALPHA);
JupiterCSHARP.startJupiter ();
File.setBase("/home/pavel/workspace/Jupiter/samples/Box");
var shader = new FileShader(new File("Resources/sprite.vs"), new File("Resources/sprite.fs"));
var bgImage = new PngImage("Resources/bg.png");
var bg = new Transform ();
bg.translate(0, 0, -1);
bg.setScaleF(0.02f);
bg.addNode(new Sprite(new ImageTexture(bgImage), new ImageShape(bgImage), shader));
var rootNode = new Node();
var cameraTrans = new Transform(0, 0, -20);
var camera = new Camera(cameraTrans, new Perspective(45.0f, width * 1.0f / height * 1.0f, 1.0f, 1000.0f));
camera.addNode(cameraTrans);
camera.addNode(bg);
rootNode.addNode(camera);
game = new Game();
game.setRootNode(rootNode);
game.addVisitor(new RenderVisitor());
game.setWidth(width);
game.setHeight(height);
}
catch (Exception ex)
{
Console.WriteLine ("init exception " + ex.Message);
}
}
public override void draw()
{
try
{
RustyGL.glClear((uint)RustyGL.GL_COLOR_BUFFER_BIT | (uint)RustyGL.GL_DEPTH_BUFFER_BIT);
RustyGL.glClearColor(0.1f, 0.3f, 0.1f, 1.0f);
game.draw ();
}
catch (Exception e)
{
Console.WriteLine ("draw exception " + e.Message);
}
}
}
}
| 23.921053 | 110 | 0.660616 | [
"MIT"
] | Ingener74/Lost-Foot | LostFoot/CSharpLayerImpl.cs | 1,818 | C# |
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using System.Linq;
using SharpFont;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using MonoGame.Framework.Content.Pipeline.Builder;
using Glyph = Microsoft.Xna.Framework.Content.Pipeline.Graphics.Glyph;
#if WINDOWS
using Microsoft.Win32;
#endif
namespace Microsoft.Xna.Framework.Content.Pipeline.Processors
{
[ContentProcessor(DisplayName = "Sprite Font Description - MonoGame")]
public class FontDescriptionProcessor : ContentProcessor<FontDescription, SpriteFontContent>
{
public override SpriteFontContent Process(FontDescription input,
ContentProcessorContext context)
{
var output = new SpriteFontContent(input);
var fontName = input.FontName;
#if WINDOWS
var windowsfolder = Environment.GetFolderPath (Environment.SpecialFolder.Windows);
var fontDirectory = Path.Combine(windowsfolder,"Fonts");
fontName = FindFontFileFromFontName (fontName, fontDirectory);
if (string.IsNullOrWhiteSpace(fontName)) {
fontName = input.FontName;
#endif
var directory = Path.GetDirectoryName (input.Identity.SourceFilename);
var directories = new string[] { directory,
"/Library/Fonts",
#if WINDOWS
fontDirectory,
#endif
};
foreach( var dir in directories) {
if (File.Exists(Path.Combine(dir,fontName+".ttf"))) {
fontName += ".ttf";
directory = dir;
break;
}
if (File.Exists (Path.Combine(dir,fontName+".ttc"))) {
fontName += ".ttc";
directory = dir;
break;
}
if (File.Exists(Path.Combine(dir,fontName+".otf"))) {
fontName += ".otf";
directory = dir;
break;
}
}
fontName = Path.Combine (directory, fontName);
#if WINDOWS
}
#endif
context.Logger.LogMessage ("Building Font {0}", fontName);
try {
if (!File.Exists(fontName)) {
throw new Exception(string.Format("Could not load {0}", fontName));
}
var lineSpacing = 0f;
var glyphs = ImportFont(input, out lineSpacing, context, fontName);
// Optimize.
foreach (Glyph glyph in glyphs)
{
GlyphCropper.Crop(glyph);
}
Bitmap outputBitmap = GlyphPacker.ArrangeGlyphs(glyphs, true, true);
//outputBitmap.Save ("/Users/Jimmy/Desktop/Cocos2D-XNAImages/fontglyphs.png");
// Adjust line and character spacing.
lineSpacing += input.Spacing;
foreach (Glyph glyph in glyphs)
{
glyph.XAdvance += input.Spacing;
if (!output.CharacterMap.Contains(glyph.Character))
output.CharacterMap.Add(glyph.Character);
output.Glyphs.Add(new Rectangle(glyph.Subrect.X, glyph.Subrect.Y, glyph.Subrect.Width, glyph.Subrect.Height));
output.Cropping.Add(new Rectangle(0,0,glyph.Subrect.Width, glyph.Subrect.Height));
ABCFloat abc = glyph.CharacterWidths;
output.Kerning.Add(new Vector3(abc.A, abc.B, abc.C));
}
// outputBitmap.Save("/Users/Jimmy/Desktop/Cocos2D-XNAImages/test.png");
output.Texture._bitmap = outputBitmap;
var bitmapContent = new PixelBitmapContent<Color>(outputBitmap.Width, outputBitmap.Height);
bitmapContent.SetPixelData(outputBitmap.GetData());
output.Texture.Faces.Add(new MipmapChain(bitmapContent));
GraphicsUtil.CompressTexture(output.Texture, context, false, false);
}
catch(Exception ex) {
context.Logger.LogImportantMessage("{0}", ex.ToString());
}
return output;
}
static Glyph[] ImportFont(FontDescription options, out float lineSpacing, ContentProcessorContext context, string fontName)
{
// Which importer knows how to read this source font?
IFontImporter importer;
var TrueTypeFileExtensions = new List<string> { ".ttf", ".ttc", ".otf" };
var BitmapFileExtensions = new List<string> { ".bmp", ".png", ".gif" };
string fileExtension = Path.GetExtension(fontName).ToLowerInvariant();
context.Logger.LogMessage ("Building Font {0}", fontName);
// if (BitmapFileExtensions.Contains(fileExtension))
// {
// importer = new BitmapImporter();
// }
// else
// {
if (TrueTypeFileExtensions.Contains (fileExtension))
{
importer = new SharpFontImporter ();
}
else
{
//importer = new TrueTypeImporter();
importer = new SharpFontImporter ();
}
// Import the source font data.
importer.Import(options, fontName);
lineSpacing = importer.LineSpacing;
// Get all glyphs
var glyphs = new List<Glyph>(importer.Glyphs);
// Validate.
if (glyphs.Count == 0)
{
throw new Exception("Font does not contain any glyphs.");
}
// Sort the glyphs
glyphs.Sort((left, right) => left.Character.CompareTo(right.Character));
// Check that the default character is part of the glyphs
if (options.DefaultCharacter != null)
{
bool defaultCharacterFound = false;
foreach (var glyph in glyphs)
{
if (glyph.Character == options.DefaultCharacter)
{
defaultCharacterFound = true;
break;
}
}
if (!defaultCharacterFound)
{
throw new InvalidOperationException("The specified DefaultCharacter is not part of this font.");
}
}
return glyphs.ToArray();
}
#if WINDOWS
string FindFontFileFromFontName (string fontName, string fontDirectory)
{
var key = Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", false);
foreach (var font in key.GetValueNames ().OrderBy (x => x)) {
if (font.StartsWith (fontName, StringComparison.OrdinalIgnoreCase)) {
var fontPath = key.GetValue (font).ToString ();
return Path.IsPathRooted (fontPath) ? fontPath : Path.Combine (fontDirectory, fontPath);
}
}
return String.Empty;
}
#endif
}
}
| 30.900498 | 126 | 0.664466 | [
"Unlicense"
] | CaptainSandman/DarkHavoc | Dependencies/MonoGame/MonoGame.Framework.Content.Pipeline/Processors/FontDescriptionProcessor.cs | 6,213 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HttpClients.Services.SwResolve.ApiModel
{
public class ResolveDataResultModel
{
/// <summary>
/// 解算数据列表
/// </summary>
public ResolveData[] Data { get; set; }
/// <summary>
/// 错误码,0:成功,1:失败,2:未授权,3:未登录
/// </summary>
public ApiCode Code { get; set; }
/// <summary>
/// 调用结果
/// </summary>
public string Message { get; set; }
}
public class ResolveData
{
/// <summary>
/// 数据类型(0:静态解算,1:动态解算,2:RTK)
/// </summary>
public int DataType { get; set; }
/// <summary>
/// 数据列表
/// </summary>
public ResolveDataItem[] DataList { get; set; }
}
public class ResolveDataItem
{
/// <summary>
/// X坐标
/// </summary>
public float X { get; set; }
/// <summary>
/// Y坐标
/// </summary>
public float Y { get; set; }
/// <summary>
/// Z坐标
/// </summary>
public float Z { get; set; }
/// <summary>
/// X偏移值
/// </summary>
public float DeltaX { get; set; }
/// <summary>
/// Y偏移值
/// </summary>
public float DeltaY { get; set; }
/// <summary>
/// Z偏移值
/// </summary>
public float DeltaZ { get; set; }
/// <summary>
/// 三维位移
/// </summary>
public float Displacement3D { get; set; }
/// <summary>
/// 方位角
/// </summary>
public float Azimuth { get; set; }
/// <summary>
/// 解算时间
/// </summary>
public string CollectTime { get; set; }
/// <summary>
/// 数据类型(0:静态解算,1:动态解算,2:RTK)
/// </summary>
public int DataType { get; set; }
/// <summary>
/// 解算时段
/// </summary>
public int CalculationTimeMinute { get; set; }
}
}
| 21.285714 | 55 | 0.453979 | [
"Apache-2.0"
] | Library-Starlight/Network | src/Http/HttpClients/HttpClients/Services/SwResolve/ApiModel/ResolveDataResultModel.cs | 2,294 | C# |
using System.Collections.Generic;
public class FourGame : Game
{
private const ulong fullBoardBits = 0b_01111111_01111111_01111111_01111111_01111111_01111111;
private readonly BitMask[] winMasks = new BitMask[4]
{
new BitMask(0b_00001111, new Size(4, 1)), // -
new BitMask(0b_00000001_00000001_00000001_00000001, new Size(1, 4)), // |
new BitMask(0b_00000001_00000010_00000100_00001000, new Size(4, 4)), // /
new BitMask(0b_00001000_00000100_00000010_00000001, new Size(4, 4)) // \
};
protected override void Awake()
{
base.Awake();
board = new Board(new Size(7, 6));
moves = new Position[board.size.x * board.size.y];
}
public override List<Position> GetPossibleMoves(Board board, IGameAgent gameAgent)
{
List<Position> possibleMoves = new List<Position>();
for (Position position = new Position(0, 0); position.x < board.size.x; ++position.x)
for (position.y = 0; position.y < board.size.y; ++position.y)
if (board.GetState(position) == 0)
{
possibleMoves.Add(position);
break;
}
return possibleMoves;
}
public override State GetState(Board board, IGameAgent gameAgent)
{
if (((board.GetBitMask(-1).bits | board.GetBitMask(+1).bits) & fullBoardBits) == fullBoardBits)
return State.draw;
for (int winMaskIndex = 0; winMaskIndex < winMasks.Length; ++winMaskIndex)
for (Position position = new Position(0, 0); position.x <= board.size.x - winMasks[winMaskIndex].size.x; ++position.x)
for (position.y = 0; position.y <= board.size.y - winMasks[winMaskIndex].size.y; ++position.y)
{
ulong winBits = winMasks[winMaskIndex].bits * BitMask.GetBits(position);
if ((board.GetBitMask(gameAgent.id).bits & winBits) == winBits)
return State.win;
if ((board.GetBitMask(gameAgent.opponent.id).bits & winBits) == winBits)
return State.loss;
}
return State.playing;
}
public override float GetScore(Board board, IGameAgent gameAgent, State gameState)
{
switch (gameState)
{
case Game.State.win:
return +1 - board.moveIndex / 100f;
case Game.State.draw:
return 0;
case Game.State.loss:
return -1 + board.moveIndex / 100f;
default:
return 0;
}
}
} | 38.985294 | 130 | 0.571482 | [
"MIT"
] | Ro2Be/BoardGameAI | Four/Assets/Scripts/Games/FourGame.cs | 2,653 | C# |
using System;
namespace OpenVIII
{
internal sealed class DSCROLL3 : JsmInstruction
{
public DSCROLL3()
{
throw new NotSupportedException();
}
}
} | 16.166667 | 51 | 0.57732 | [
"MIT"
] | A-n-d-y/OpenVIII | Core/Field/JSM/Instructions/DSCROLL3.cs | 194 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using CPointSoftware.ECommerce.Tools;
namespace Altazion.ECommerce.Controls
{
/// <summary>
/// Affiche dans un span la date de livraison prévue pour le mode
/// de transport selectionné dans le panier
/// </summary>
public class LivraisonDelai : Label
{
/// <summary>
/// Initialise une instance de <see cref="LivraisonDelai"/>.
/// </summary>
public LivraisonDelai()
{
Format = "dd/MM";
}
/// <summary>
/// Format d'affichage de la date
/// </summary>
public string Format { get; set; }
/// <summary>
/// Déclenche l'événement <see cref="E:System.Web.UI.Control.PreRender" />.
/// </summary>
/// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ModeLivraisonElementPanier elm = ECommerceServer.Panier.FraisPort;
if (elm == null)
{
DateTime? dtMEF = PanierProvider.Extensions.GetDateLivraison();
if (dtMEF.HasValue)
{
this.Text = dtMEF.Value.ToString(Format);
}
return;
}
this.Text = elm.DateLivraisonPrevue.ToString(Format);
}
}
/// <summary>
/// [obsolete]
/// </summary>
public class LivraisonMode : Label
{
/// <summary>
/// Déclenche l'événement <see cref="E:System.Web.UI.Control.PreRender" />.
/// </summary>
/// <param name="e">Objet <see cref="T:System.EventArgs" /> qui contient les données d'événement.</param>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ModeLivraisonElementPanier elm = ECommerceServer.Panier.FraisPort;
if (elm == null)
return;
this.Text = elm.Libelle;
}
}
}
| 29.051282 | 114 | 0.530891 | [
"MIT"
] | altazion/altazion-commerce-controls | Altazion.ECommerce.Controls/Altazion.ECommerce.Controls/LivraisonDelai.cs | 2,282 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Data.DataView;
using Microsoft.ML.Data;
using Microsoft.ML.Functional.Tests.Datasets;
using Microsoft.ML.RunTests;
using Microsoft.ML.TestFramework;
using Microsoft.ML.Trainers;
using Microsoft.ML.Trainers.FastTree;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.ML.Functional.Tests
{
public class Validation : BaseTestClass
{
public Validation(ITestOutputHelper output) : base(output)
{
}
/// <summary>
/// Cross-validation: Have a mechanism to do cross validation, that is, you come up with
/// a data source (optionally with stratification column), come up with an instantiable transform
/// and trainer pipeline, and it will handle (1) splitting up the data, (2) training the separate
/// pipelines on in-fold data, (3) scoring on the out-fold data, (4) returning the set of
/// metrics, trained pipelines, and scored test data for each fold.
/// </summary>
[Fact]
void CrossValidation()
{
var mlContext = new MLContext(seed: 1);
// Get the dataset
var data = mlContext.Data.LoadFromTextFile<HousingRegression>(GetDataPath(TestDatasets.housing.trainFilename), hasHeader: true);
// Create a pipeline to train on the housing data.
var pipeline = mlContext.Transforms.Concatenate("Features", HousingRegression.Features)
.Append(mlContext.Regression.Trainers.OrdinaryLeastSquares());
// Compute the CV result.
var cvResult = mlContext.Regression.CrossValidate(data, pipeline, numFolds: 5);
// Check that the results are valid
Assert.IsType<RegressionMetrics>(cvResult[0].Metrics);
Assert.IsType<TransformerChain<RegressionPredictionTransformer<OrdinaryLeastSquaresRegressionModelParameters>>>(cvResult[0].Model);
Assert.True(cvResult[0].ScoredHoldOutSet is IDataView);
Assert.Equal(5, cvResult.Length);
// And validate the metrics.
foreach (var result in cvResult)
Common.AssertMetrics(result.Metrics);
}
/// <summary>
/// Train with validation set.
/// </summary>
[Fact]
public void TrainWithValidationSet()
{
var mlContext = new MLContext(seed: 1);
// Get the dataset.
var data = mlContext.Data.LoadFromTextFile<HousingRegression>(GetDataPath(TestDatasets.housing.trainFilename), hasHeader: true);
// Create the train and validation set.
var dataSplit = mlContext.Regression.TrainTestSplit(data, testFraction: 0.2);
var trainData = dataSplit.TrainSet;
var validData = dataSplit.TestSet;
// Create a pipeline to featurize the dataset.
var pipeline = mlContext.Transforms.Concatenate("Features", HousingRegression.Features)
.AppendCacheCheckpoint(mlContext) as IEstimator<ITransformer>;
// Preprocess the datasets.
var preprocessor = pipeline.Fit(trainData);
var preprocessedTrainData = preprocessor.Transform(trainData);
var preprocessedValidData = preprocessor.Transform(validData);
// Train the model with a validation set.
var trainedModel = mlContext.Regression.Trainers.FastTree(new FastTreeRegressionTrainer.Options {
NumberOfTrees = 2,
EarlyStoppingMetric = EarlyStoppingMetric.L2Norm,
EarlyStoppingRule = new GeneralityLossRule()
})
.Fit(trainData: preprocessedTrainData, validationData: preprocessedValidData);
// Combine the model.
var model = preprocessor.Append(trainedModel);
// Score the data sets.
var scoredTrainData = model.Transform(trainData);
var scoredValidData = model.Transform(validData);
var trainMetrics = mlContext.Regression.Evaluate(scoredTrainData);
var validMetrics = mlContext.Regression.Evaluate(scoredValidData);
Common.AssertMetrics(trainMetrics);
Common.AssertMetrics(validMetrics);
}
}
}
| 42.807692 | 143 | 0.654762 | [
"MIT"
] | IndigoShock/machinelearning | test/Microsoft.ML.Functional.Tests/Validation.cs | 4,454 | C# |
using Newtonsoft.Json;
namespace MultiSafepay.Model
{
public class TemplateButtonObject
{
[JsonProperty("background")]
public string Background { get; set; }
[JsonProperty("text")]
public string Text { get; set; }
[JsonProperty("border")]
public string Border { get; set; }
[JsonProperty("hover")]
public TemplateButtonObjectState Hover { get; set; }
[JsonProperty("active")]
public TemplateButtonObjectState Active { get; set; }
}
}
| 27.789474 | 61 | 0.617424 | [
"MIT"
] | DanielleGreen1211/MultiSafepay-NET-API | Src/MultiSafepay/Model/TemplateButtonObject.cs | 530 | C# |
using System;
using System.Threading.Tasks;
using MvvmBasicPlus.Services;
using Windows.ApplicationModel.Activation;
namespace MvvmBasicPlus.Activation
{
internal class DefaultActivationHandler : ActivationHandler<IActivatedEventArgs>
{
private readonly Type _navElement;
public DefaultActivationHandler(Type navElement)
{
_navElement = navElement;
}
protected override async Task HandleInternalAsync(IActivatedEventArgs args)
{
// When the navigation stack isn't restored, navigate to the first page and configure
// the new page by passing required information in the navigation parameter
object arguments = null;
if (args is LaunchActivatedEventArgs launchArgs)
{
arguments = launchArgs.Arguments;
}
NavigationService.Navigate(_navElement, arguments);
await Task.CompletedTask;
}
protected override bool CanHandleInternal(IActivatedEventArgs args)
{
// None of the ActivationHandlers has handled the app activation
return NavigationService.Frame.Content == null && _navElement != null;
}
}
}
| 31.075 | 97 | 0.661303 | [
"MIT"
] | scottkuhl/MvvmBasicPlus | MvvmBasicPlus/Activation/DefaultActivationHandler.cs | 1,245 | C# |
/*===================================================================================
*
* Copyright (c) Userware/OpenSilver.net
*
* This file is part of the OpenSilver Runtime (https://opensilver.net), which is
* licensed under the MIT license: https://opensource.org/licenses/MIT
*
* As stated in the MIT license, "the above copyright notice and this permission
* notice shall be included in all copies or substantial portions of the Software."
*
\*====================================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace DotNetForHtml5.EmulatorWithoutJavascript
{
class StaticConstructorsCaller
{
public static void EnsureStaticConstructorOfCommonTypesIsCalled(Assembly coreAssembly)
{
// This is useful to ensure that the "Type Converters" defined in common types are registered prior to executing the app.
// This is not needed when running the compiled JavaScript code because static constructors are always called before anything else.
LoadTypeConstructor("Windows.Foundation", "System.Windows", "Point", coreAssembly);
LoadTypeConstructor("Windows.Foundation", "System.Windows", "Size", coreAssembly);
LoadTypeConstructor("Windows.UI", "System.Windows.Media", "Color", coreAssembly);
LoadTypeConstructor("Windows.UI.Text", "System.Windows", "FontWeight", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml", "System.Windows", "Thickness", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml", "System.Windows", "CornerRadius", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml", "System.Windows", "Duration", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml", "System.Windows", "GridLength", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media.Animation", "System.Windows.Media.Animation", "KeyTime", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media.Animation", "System.Windows.Media.Animation", "RepeatBehavior", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "Brush", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "DoubleCollection", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "FontFamily", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "Geometry", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "ImageSource", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Media", "System.Windows.Media", "Matrix", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml", "System.Windows", "PropertyPath", coreAssembly);
LoadTypeConstructor("Windows.UI.Xaml.Controls", "System.Windows.Controls", "DataGridLength", coreAssembly);
LoadTypeConstructor("System.Windows.Input", null, "Cursor", coreAssembly);
}
static void LoadTypeConstructor(string typeNamespace, string typeAlternativeNamespaceOrNull, string typeName, Assembly assembly)
{
// Note: an "alternative namespace" can be specified in order to be compatible with the "SLMigration" version of the core assembly.
Type type = assembly.GetType(typeNamespace + "." + typeName);
if (type == null && !string.IsNullOrEmpty(typeAlternativeNamespaceOrNull))
type = assembly.GetType(typeAlternativeNamespaceOrNull + "." + typeName);
if (type == null)
throw new Exception(string.Format(@"Unable to call the static constructor of the type '{0}' because the type was not found.", typeName));
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(type.TypeHandle);
}
}
}
| 60.537313 | 153 | 0.673323 | [
"MIT"
] | Talentia-Software-OSS/OpenSilver | src/Runtime/Runtime/APP_SUPPORT/StaticConstructorsCaller.cs | 4,056 | C# |
using Logikoz.XamarinUtilities.Enums;
using Logikoz.XamarinUtilities.Services;
using Xamarin.Forms;
using XF.Material.Forms;
namespace Quiz.Mobile.Util
{
internal static class ChangeThemeUtil
{
/// <summary>
/// Altera o tema (dark/light) do app e inicia o XF-Material.
/// </summary>
/// <param name="theme"></param>
public static void Change(ThemeEnum theme)
{
ThemeManagerService.ChangeTheme(theme);
Material.Init(Application.Current);
}
}
} | 24.545455 | 69 | 0.62963 | [
"MIT"
] | Speckoz/MobileQuiz | Speckoz.Quiz/Quiz.Mobile/Util/ChangeThemeUtil.cs | 542 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.