content stringlengths 23 1.05M |
|---|
using Microsoft.AspNet.Mvc;
using System.Collections.Generic;
namespace MvcSample.Web
{
[Route("api/[controller]")]
public class TestController : Controller
{
[HttpGet]
public IEnumerable<string> GetAll()
{
return new string[] {"1", "two", "III"};
}
}
} |
using System;
using System.ComponentModel.DataAnnotations;
using BillChopBE.DataAccessLayer.Models;
using BillChopBE.Validation;
namespace BillChopBE.Services.Models
{
public class CreateNewPayment : ValidatableModel
{
[Required]
public decimal Amount { get; set; }
[Required]
public Guid PayerId { get; set; }
[Required]
public Guid ReceiverId { get; set; }
[Required]
public Guid GroupContextId { get; set; }
public Payment ToPayment ()
{
return new Payment()
{
Amount = Amount,
PayerId = PayerId,
ReceiverId = ReceiverId,
GroupContextId = GroupContextId,
};
}
}
} |
using DemoWebApp.Models;
using Microsoft.EntityFrameworkCore;
namespace DemoWebApp.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
Database.SetCommandTimeout(9000);
Console.WriteLine("Database Instance Initialized.");
//try
//{
// Database.Migrate();
//}
//catch (Exception e)
//{
// Log.Error($"There was an error while migrating the Database. Error: {e}");
//}
}
public DbSet<Store> Store { get; set; }
public DbSet<Product> Product { get; set; }
public DbSet<User> User { get; set; }
public DbSet<Order> Order { get; set; }
public DbSet<OrderLine> OrderLine { get; set; }
}
}
|
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.LLin.Plugins;
namespace Mvis.Plugin.Example
{
public class AnotherPlugin : LLinPlugin
{
private OsuSpriteText text1;
protected override Drawable CreateContent() => new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Text = "你发现了这段由插件生成的文字!",
Font = OsuFont.GetFont(size: 30)
},
new OsuSpriteText
{
Text = "因为Target属性是TargetLayer.Background,所以这段文字会显示在背景!"
},
new OsuSpriteText
{
Text = "所有显示在背景的插件都会被应用背景暗化!"
},
text1 = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 30)
}
}
};
protected override bool OnContentLoaded(Drawable content)
{
Logger.Log($"插件{Name}已加载!");
return true;
}
protected override bool PostInit()
{
Logger.Log($"插件{Name}开始加载前的准备!");
return true;
}
public override bool Disable()
{
setText("插件被禁用了oAo!");
return base.Disable();
}
public override bool Enable()
{
setText("插件被启用了oAo!");
return base.Enable();
}
private void setText(string text)
{
if (text1 != null)
text1.Text = text;
}
public override TargetLayer Target => TargetLayer.Background;
public override int Version => 1;
public AnotherPlugin()
{
Name = "另一个示例插件";
Description = "我是描述!";
Author = "MATRIX-夜翎";
Flags.AddRange(new[]
{
PluginFlags.CanDisable,
PluginFlags.CanUnload
});
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
}
}
|
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Vpc.V20170312.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class ResourceDashboard : AbstractModel
{
/// <summary>
/// Vpc实例ID,例如:vpc-f1xjkw1b。
/// </summary>
[JsonProperty("VpcId")]
public string VpcId{ get; set; }
/// <summary>
/// 子网实例ID,例如:subnet-bthucmmy。
/// </summary>
[JsonProperty("SubnetId")]
public string SubnetId{ get; set; }
/// <summary>
/// 基础网络互通。
/// </summary>
[JsonProperty("Classiclink")]
public ulong? Classiclink{ get; set; }
/// <summary>
/// 专线网关。
/// </summary>
[JsonProperty("Dcg")]
public ulong? Dcg{ get; set; }
/// <summary>
/// 对等连接。
/// </summary>
[JsonProperty("Pcx")]
public ulong? Pcx{ get; set; }
/// <summary>
/// 当前已使用的IP总数。
/// </summary>
[JsonProperty("Ip")]
public ulong? Ip{ get; set; }
/// <summary>
/// NAT网关。
/// </summary>
[JsonProperty("Nat")]
public ulong? Nat{ get; set; }
/// <summary>
/// VPN网关。
/// </summary>
[JsonProperty("Vpngw")]
public ulong? Vpngw{ get; set; }
/// <summary>
/// 流日志。
/// </summary>
[JsonProperty("FlowLog")]
public ulong? FlowLog{ get; set; }
/// <summary>
/// 网络探测。
/// </summary>
[JsonProperty("NetworkDetect")]
public ulong? NetworkDetect{ get; set; }
/// <summary>
/// 网络ACL。
/// </summary>
[JsonProperty("NetworkACL")]
public ulong? NetworkACL{ get; set; }
/// <summary>
/// 云主机。
/// </summary>
[JsonProperty("CVM")]
public ulong? CVM{ get; set; }
/// <summary>
/// 负载均衡。
/// </summary>
[JsonProperty("LB")]
public ulong? LB{ get; set; }
/// <summary>
/// 关系型数据库。
/// </summary>
[JsonProperty("CDB")]
public ulong? CDB{ get; set; }
/// <summary>
/// 云数据库 TencentDB for Memcached。
/// </summary>
[JsonProperty("Cmem")]
public ulong? Cmem{ get; set; }
/// <summary>
/// 时序数据库。
/// </summary>
[JsonProperty("CTSDB")]
public ulong? CTSDB{ get; set; }
/// <summary>
/// 数据库 TencentDB for MariaDB(TDSQL)。
/// </summary>
[JsonProperty("MariaDB")]
public ulong? MariaDB{ get; set; }
/// <summary>
/// 数据库 TencentDB for SQL Server。
/// </summary>
[JsonProperty("SQLServer")]
public ulong? SQLServer{ get; set; }
/// <summary>
/// 云数据库 TencentDB for PostgreSQL。
/// </summary>
[JsonProperty("Postgres")]
public ulong? Postgres{ get; set; }
/// <summary>
/// 网络附加存储。
/// </summary>
[JsonProperty("NAS")]
public ulong? NAS{ get; set; }
/// <summary>
/// Snova云数据仓库。
/// </summary>
[JsonProperty("Greenplumn")]
public ulong? Greenplumn{ get; set; }
/// <summary>
/// 消息队列 CKAFKA。
/// </summary>
[JsonProperty("Ckafka")]
public ulong? Ckafka{ get; set; }
/// <summary>
/// Grocery。
/// </summary>
[JsonProperty("Grocery")]
public ulong? Grocery{ get; set; }
/// <summary>
/// 数据加密服务。
/// </summary>
[JsonProperty("HSM")]
public ulong? HSM{ get; set; }
/// <summary>
/// 游戏存储 Tcaplus。
/// </summary>
[JsonProperty("Tcaplus")]
public ulong? Tcaplus{ get; set; }
/// <summary>
/// Cnas。
/// </summary>
[JsonProperty("Cnas")]
public ulong? Cnas{ get; set; }
/// <summary>
/// HTAP 数据库 TiDB。
/// </summary>
[JsonProperty("TiDB")]
public ulong? TiDB{ get; set; }
/// <summary>
/// EMR 集群。
/// </summary>
[JsonProperty("Emr")]
public ulong? Emr{ get; set; }
/// <summary>
/// SEAL。
/// </summary>
[JsonProperty("SEAL")]
public ulong? SEAL{ get; set; }
/// <summary>
/// 文件存储 CFS。
/// </summary>
[JsonProperty("CFS")]
public ulong? CFS{ get; set; }
/// <summary>
/// Oracle。
/// </summary>
[JsonProperty("Oracle")]
public ulong? Oracle{ get; set; }
/// <summary>
/// ElasticSearch服务。
/// </summary>
[JsonProperty("ElasticSearch")]
public ulong? ElasticSearch{ get; set; }
/// <summary>
/// 区块链服务。
/// </summary>
[JsonProperty("TBaaS")]
public ulong? TBaaS{ get; set; }
/// <summary>
/// Itop。
/// </summary>
[JsonProperty("Itop")]
public ulong? Itop{ get; set; }
/// <summary>
/// 云数据库审计。
/// </summary>
[JsonProperty("DBAudit")]
public ulong? DBAudit{ get; set; }
/// <summary>
/// 企业级云数据库 CynosDB for Postgres。
/// </summary>
[JsonProperty("CynosDBPostgres")]
public ulong? CynosDBPostgres{ get; set; }
/// <summary>
/// 数据库 TencentDB for Redis。
/// </summary>
[JsonProperty("Redis")]
public ulong? Redis{ get; set; }
/// <summary>
/// 数据库 TencentDB for MongoDB。
/// </summary>
[JsonProperty("MongoDB")]
public ulong? MongoDB{ get; set; }
/// <summary>
/// 分布式数据库 TencentDB for TDSQL。
/// </summary>
[JsonProperty("DCDB")]
public ulong? DCDB{ get; set; }
/// <summary>
/// 企业级云数据库 CynosDB for MySQL。
/// </summary>
[JsonProperty("CynosDBMySQL")]
public ulong? CynosDBMySQL{ get; set; }
/// <summary>
/// 子网。
/// </summary>
[JsonProperty("Subnet")]
public ulong? Subnet{ get; set; }
/// <summary>
/// 路由表。
/// </summary>
[JsonProperty("RouteTable")]
public ulong? RouteTable{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "VpcId", this.VpcId);
this.SetParamSimple(map, prefix + "SubnetId", this.SubnetId);
this.SetParamSimple(map, prefix + "Classiclink", this.Classiclink);
this.SetParamSimple(map, prefix + "Dcg", this.Dcg);
this.SetParamSimple(map, prefix + "Pcx", this.Pcx);
this.SetParamSimple(map, prefix + "Ip", this.Ip);
this.SetParamSimple(map, prefix + "Nat", this.Nat);
this.SetParamSimple(map, prefix + "Vpngw", this.Vpngw);
this.SetParamSimple(map, prefix + "FlowLog", this.FlowLog);
this.SetParamSimple(map, prefix + "NetworkDetect", this.NetworkDetect);
this.SetParamSimple(map, prefix + "NetworkACL", this.NetworkACL);
this.SetParamSimple(map, prefix + "CVM", this.CVM);
this.SetParamSimple(map, prefix + "LB", this.LB);
this.SetParamSimple(map, prefix + "CDB", this.CDB);
this.SetParamSimple(map, prefix + "Cmem", this.Cmem);
this.SetParamSimple(map, prefix + "CTSDB", this.CTSDB);
this.SetParamSimple(map, prefix + "MariaDB", this.MariaDB);
this.SetParamSimple(map, prefix + "SQLServer", this.SQLServer);
this.SetParamSimple(map, prefix + "Postgres", this.Postgres);
this.SetParamSimple(map, prefix + "NAS", this.NAS);
this.SetParamSimple(map, prefix + "Greenplumn", this.Greenplumn);
this.SetParamSimple(map, prefix + "Ckafka", this.Ckafka);
this.SetParamSimple(map, prefix + "Grocery", this.Grocery);
this.SetParamSimple(map, prefix + "HSM", this.HSM);
this.SetParamSimple(map, prefix + "Tcaplus", this.Tcaplus);
this.SetParamSimple(map, prefix + "Cnas", this.Cnas);
this.SetParamSimple(map, prefix + "TiDB", this.TiDB);
this.SetParamSimple(map, prefix + "Emr", this.Emr);
this.SetParamSimple(map, prefix + "SEAL", this.SEAL);
this.SetParamSimple(map, prefix + "CFS", this.CFS);
this.SetParamSimple(map, prefix + "Oracle", this.Oracle);
this.SetParamSimple(map, prefix + "ElasticSearch", this.ElasticSearch);
this.SetParamSimple(map, prefix + "TBaaS", this.TBaaS);
this.SetParamSimple(map, prefix + "Itop", this.Itop);
this.SetParamSimple(map, prefix + "DBAudit", this.DBAudit);
this.SetParamSimple(map, prefix + "CynosDBPostgres", this.CynosDBPostgres);
this.SetParamSimple(map, prefix + "Redis", this.Redis);
this.SetParamSimple(map, prefix + "MongoDB", this.MongoDB);
this.SetParamSimple(map, prefix + "DCDB", this.DCDB);
this.SetParamSimple(map, prefix + "CynosDBMySQL", this.CynosDBMySQL);
this.SetParamSimple(map, prefix + "Subnet", this.Subnet);
this.SetParamSimple(map, prefix + "RouteTable", this.RouteTable);
}
}
}
|
using Microsoft.EntityFrameworkCore;
using NextCourses.Models;
using System.Collections.Generic;
namespace NextCourses.Context
{
/// <summary>
/// DbContext used for storing course related information
/// </summary>
public class CourseContext : DbContext
{
/// <summary>
/// Database table containing course metadata
/// </summary>
public DbSet<UWCourse> Courses { get; set; }
/// <summary>
/// Database table containing prerequisite information
/// </summary>
public DbSet<PrereqMap> Prereqs { get; set; }
/// <summary>
/// Base constructor for DbContext which will read connection string at startup
/// </summary>
public CourseContext(DbContextOptions<CourseContext> options)
: base(options)
{ }
/// <summary>
/// Use a primary key consisting of multiple fields with both prereq course name and next course name
/// </summary>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<PrereqMap>().HasKey(p => new { p.prereq_course_name, p.next_course_name});
}
}
} |
using System.Windows.Media;
using Balder.Core;
using Balder.Core.Geometries;
using Balder.Core.Math;
using Matrix=Balder.Core.Math.Matrix;
namespace GettingStarted
{
public class MyGame : Game
{
private Mesh _audi;
private float _audiRotation;
public override void Initialize()
{
// We set the background color for the display to black
Display.BackgroundColor = Colors.Black;
base.Initialize();
}
public override void LoadContent()
{
// Load the audi asset found in the assets folder.
// One does not need to add the assets folder in the path, as this is implicit
// All assets must be of type resource in the properties window in Visual Studio
_audi = ContentManager.Load<Mesh>("audi.ASE");
Scene.AddNode(_audi);
// Set the camera to point at the Zero location in 3D space and its position to be a
// bit from the car itself
Camera.Target = Vector.Zero;
Camera.Position = new Vector(0,-2,-10);
base.LoadContent();
}
// The update method is called every frame
public override void Update()
{
_audi.World = Matrix.CreateRotationY(_audiRotation);
_audiRotation += 0.5f;
base.Update();
}
}
}
|
using UnityEngine;
namespace OsmVisualizer.Data.Utils
{
public static class FloatExtensions
{
public static float Round(this float f, int precision = 100)
{
return float.IsNaN(f) ? f : Mathf.Round(f * precision) / precision;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShiftCaptain.Models;
using ShiftCaptain.Filters;
namespace ShiftCaptain.Controllers
{
public class ErrorController : BaseController
{
public ErrorController()
{
ClassName = "Error";
}
//
// GET: /InternalError/
[AllowAnonymous]
public ActionResult InternalError(string page)
{
return View();
}
//
// GET: /NotAuthorized/
[AllowAnonymous]
public ActionResult NotAuthorized(string page)
{
return View();
}
//
// GET: /PageNotFound/
[AllowAnonymous]
public ActionResult PageNotFound(string page)
{
return View();
}
//
// GET: /ScheduleNotReady/
[AllowAnonymous]
public ActionResult ScheduleNotReady()
{
return View();
}
//
// GET: /NoVersions/
[ManagerAccess]
[ShiftManagerAccess]
public ActionResult NoVersions()
{
return View();
}
//
// GET: /NoBuildings/
[ManagerAccess]
[ShiftManagerAccess]
public ActionResult NoBuildings(String VersionName)
{
return View();
}
//
// GET: /NoRooms/
[ManagerAccess]
[ShiftManagerAccess]
public ActionResult NoRooms(String VersionName)
{
return View();
}
//
// GET: /NoUsers/
[ManagerAccess]
[ShiftManagerAccess]
public ActionResult NoUsers(String VersionName)
{
return View();
}
//
// GET: /NoPreferences/
[ManagerAccess]
[ShiftManagerAccess]
public ActionResult NoPreferences()
{
return View();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
}
} |
using HL7Data.Contracts.Base;
namespace HL7Data.Contracts.Fields
{
public interface IDate : IBaseField
{
//TODO: this may not be a simple Date/DateTime
//Specifies the century and year with optional precision to month and day.
}
} |
using Contas.Queries.Abstractions;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Contas.API.Controllers
{
[Route("relatorios")]
public class RelatorioController : ControllerBase
{
private readonly IMediator _mediator;
public RelatorioController(IMediator mediator)
=> _mediator = mediator;
[HttpGet]
[Route("totalizadores")]
public async Task<IActionResult> ObterTotalizadores(TotalizadoresQuery request)
=> Ok(await _mediator.Send(request));
[HttpGet]
[Route("valor-total-por-categoria")]
public async Task<IActionResult> ObterValorTotalPorCategoria(ValorTotalPorCategoriaQuery request)
=> Ok(await _mediator.Send(request));
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Security;
using TcOpen.Inxton.Data;
using TcOpen.Inxton.Security;
namespace TcOpen.Inxton.Local.Security
{
///<summary>
/// Provides management of user access.
/// To setup security manager you need an IRepository where you will store the user data
///
/// <code>
/// SecurityManager.Create(new DefaultUserDataRepository<UserData>()); //you can use RavenDB,Mongo,Json repository for user data persistence.
///
/// //grab the service
/// IAuthenticationService authService = SecurityProvider.Get.AuthenticationService;
///
/// //create a user
///
/// var userName = "Admin";
/// var password = "AdminPassword";
/// var roles = new string[] { "Administrator" };
/// authService.UserRepository.Create(userName, new UserData(userName, password, roles.ToList()));
///
/// //login created user
/// authService.AuthenticateUser("Admin", "AdminPassword");
/// </code>
///
/// To limit execution of methods for privileged user use <see cref=" "/>
///</summary>
public class SecurityManager : ISecurityManager
{
private SecurityManager(IRepository<UserData> repository)
{
UserRepository = repository;
Service = new AuthenticationService(repository);
Principal = new AppIdentity.AppPrincipal();
SecurityProvider.Create(Service);
if (System.Threading.Thread.CurrentPrincipal?.GetType() != typeof(AppIdentity.AppPrincipal))
{
System.Threading.Thread.CurrentPrincipal = Principal;
AppDomain.CurrentDomain.SetThreadPrincipal(Principal);
}
}
/// <summary>
/// Creates authentication service with given user data repository.
/// </summary>
/// <param name="repository">User data repository <see cref="IRepository{UserData}"/></param>
/// <returns>Authentication service for this application <see cref="IAuthenticationService"/>Authentication service for this application.</returns>
public static IAuthenticationService Create(IRepository<UserData> repository)
{
if (_manager == null)
{
_manager = new SecurityManager(repository);
}
return _manager.Service;
}
/// <summary>
/// Creates authentication service with default user data repository <see cref="DefaultUserDataRepository{UserData}"/>
/// </summary>
/// <param name="usersFolder">User file storage folder.</param>
/// <returns>Authentication service for this application <see cref="IAuthenticationService"/>Authentication service for this application.</returns>
public static IAuthenticationService CreateDefault(string usersFolder = @"C:\INXTON\USERS\")
{
if (_manager == null)
{
_manager = new SecurityManager(new DefaultUserDataRepository<UserData>(usersFolder));
}
return _manager.Service;
}
/// <summary>
/// *Creates authentication* service with default user data repository <see cref="DefaultUserDataRepository{UserData}"/>
/// </summary>
///<remarks>
/// > [!TIP]
/// > You can create your own user repository using <see cref="IRepository{UserData}"/>
/// > [!IMPORTANT]
/// > Default repository is designed for handling limited number of users and it should not be used in shared scenarios.
/// > If you would like to use shared user repository consider implementation of an appropriate <see cref="IRepository{UserData}"/> implementation.
///</remarks>
/// <returns>Authentication service for this application <see cref="IAuthenticationService"/>Authentication service for this application.</returns>
public static IAuthenticationService CreateDefault()
{
if (_manager == null)
{
_manager = new SecurityManager(new DefaultUserDataRepository<UserData>());
}
return _manager.Service;
}
public AppIdentity.AppPrincipal Principal { get; private set; }
public IAuthenticationService Service { get; private set; }
private static SecurityManager _manager;
public static SecurityManager Manager
{
get
{
if (_manager == null)
{
throw new SecurityManagerNotInitializedException("Security manager was not created.");
}
return _manager;
}
}
List<Role> availableRoles = new List<Role>() { new Role("Administrator", "AdminGroup") };
public IEnumerable<Role> AvailableRoles
{
get
{
return availableRoles;
}
}
public IEnumerable<string> AvailableGroups() => availableRoles.Select(o => o.DefaultGroup).Distinct();
/// <summary>
/// Get the existing role or add the rule if not present in the system.
/// </summary>
/// <param name="role">Role to create or retrieve.</param>
/// <returns>Requested role</returns>
public Role GetOrCreateRole(Role role)
{
if (!this.availableRoles.Contains(role))
{
this.availableRoles.Add(role);
}
return role;
}
public IRepository<UserData> UserRepository { get; }
/// <summary>
/// Gets weather the security manager is initialized.
/// </summary>
public static bool IsInitialized { get { return _manager != null; } }
}
public class SecurityManagerNotInitializedException : Exception
{
/// <summary>Initializes a new instance of the <see cref="SecurityManagerNotInitializedException" /> class.</summary>
public SecurityManagerNotInitializedException()
{
}
/// <summary>Initializes a new instance of the <see cref="SecurityManagerNotInitializedException" /> class with a specified error message.</summary>
/// <param name="message">The message that describes the error. </param>
public SecurityManagerNotInitializedException(string message) : base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="SecurityManagerNotInitializedException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (<see langword="Nothing" /> in Visual Basic) if no inner exception is specified. </param>
public SecurityManagerNotInitializedException(string message, Exception innerException) : base(message, innerException)
{
}
/// <summary>Initializes a new instance of the <see cref="SecurityManagerNotInitializedException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
/// <exception cref="System.ArgumentNullException">The <paramref name="info" /> parameter is <see langword="null" />. </exception>
/// <exception cref="System.Runtime.Serialization.SerializationException">The class name is <see langword="null" /> or <see cref="System.Exception.HResult" /> is zero (0). </exception>
[SecuritySafeCritical]
protected SecurityManagerNotInitializedException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
|
namespace Localwire.Graphinder.Core.Algorithms.GeneticAlgorithm.MutationStrategies
{
public interface IMutationStrategy
{
/// <summary>
/// Mutate given encoded individual.
/// </summary>
/// <param name="individual">Individual to mutate.</param>
void Mutate(Individual individual);
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace WcfClientTest
{
[TestClass]
public class ClientCreateTest
{
[TestMethod]
public void ServiceClient_Should_Not_Be_Null()
{
MyServiceClientWrapper myServiceClientWrapper = new MyServiceClientWrapper();
string actual = myServiceClientWrapper.GetData(1);
Assert.IsNotNull(actual);
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.Services.Agent.Util;
using Microsoft.VisualStudio.Services.Agent.Worker;
using Microsoft.VisualStudio.Services.Agent.Worker.Build;
using Moq;
using Xunit;
namespace Microsoft.VisualStudio.Services.Agent.Tests.Worker.Build
{
public sealed class TfsVCSourceProvider_WorkspaceUtilL0
{
private TfsVCSourceProvider.DefinitionWorkspaceMapping[] _definitionMappings;
private Mock<IExecutionContext> _executionContext;
private string _sourceFile;
private string _sourcesDirectory;
private Tracing _trace;
private string _workspaceName;
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_Cloak_ServerPath()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
MappingType = TfsVCSourceProvider.DefinitionMappingType.Cloak,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).ServerPath = "$/otherProj";
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_ComputerName()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory,
computer: "NON_MATCHING_COMPUTER_NAME");
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_Map_LocalPath()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "myProj",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).LocalPath = Path.Combine(_sourcesDirectory, "otherProj");
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_Map_Recursive()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).Recursive = false;
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_Map_ServerPath()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).ServerPath = "$/otherProj";
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_Map_SingleLevel()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj/*",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).Recursive = true;
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_MappingType()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
(tfWorkspace.Mappings[0] as MockTfsVCMapping).Cloak = true;
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void DoesNotMatch_WorkspaceName()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
};
var tfWorkspace = new MockTfsVCWorkspace(
name: "NON_MATCHING_WORKSPACE_NAME",
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { tfWorkspace },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Null(actual);
}
finally
{
Cleanup();
}
}
}
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public void Matches()
{
using (TestHostContext tc = new TestHostContext(this))
{
try
{
// Arrange.
Prepare(tc);
var expected = new MockTfsVCWorkspace(
name: _workspaceName,
mappings: _definitionMappings,
localRoot: _sourcesDirectory);
// Act.
ITfsVCWorkspace actual = TfsVCSourceProvider.WorkspaceUtil.MatchExactWorkspace(
executionContext: _executionContext.Object,
tfWorkspaces: new[] { expected },
name: _workspaceName,
definitionMappings: _definitionMappings,
sourcesDirectory: _sourcesDirectory);
// Assert.
Assert.Equal(expected, actual);
}
finally
{
Cleanup();
}
}
}
private void Cleanup()
{
if (!string.IsNullOrEmpty(_sourcesDirectory))
{
Directory.Delete(_sourcesDirectory, recursive: true);
}
}
private void Prepare(TestHostContext hostContext)
{
_trace = hostContext.GetTrace();
// Prepare the sources directory. The workspace helper will not return any
// matches if the sources directory does not exist with something in it.
_sourcesDirectory = Path.Combine(hostContext.GetDirectory(WellKnownDirectory.Bin), Path.GetRandomFileName());
_sourceFile = Path.Combine(_sourcesDirectory, "some file");
Directory.CreateDirectory(_sourcesDirectory);
File.WriteAllText(path: _sourceFile, contents: "some contents");
// Prepare a basic definition workspace.
_workspaceName = "ws_1_1";
_definitionMappings = new[]
{
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/*",
},
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "myProj",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/myProj",
},
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "myProj/Drops",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Cloak,
ServerPath = "$/myProj/Drops",
},
new TfsVCSourceProvider.DefinitionWorkspaceMapping
{
LocalPath = "otherProj/mydir",
MappingType = TfsVCSourceProvider.DefinitionMappingType.Map,
ServerPath = "$/otherProj/mydir/*",
},
};
_executionContext = new Mock<IExecutionContext>();
_executionContext
.Setup(x => x.WriteDebug)
.Returns(true);
_executionContext
.Setup(x => x.Write(It.IsAny<string>(), It.IsAny<string>()))
.Callback((string tag, string message) => _trace.Info($"[ExecutionContext]{tag} {message}"));
}
public sealed class MockTfsVCWorkspace : ITfsVCWorkspace
{
public MockTfsVCWorkspace(
string name,
TfsVCSourceProvider.DefinitionWorkspaceMapping[] mappings = null,
string localRoot = null,
string computer = null)
{
ArgUtil.NotNullOrEmpty(name, nameof(name));
Computer = computer != null ? computer : Environment.MachineName;
Mappings = (mappings ?? new TfsVCSourceProvider.DefinitionWorkspaceMapping[0])
.Select(x => new MockTfsVCMapping(x, localRoot))
.ToArray();
Name = name;
}
public string Computer { get; set; }
public string Name { get; set; }
public string Owner { get; set; }
public ITfsVCMapping[] Mappings { get; set; }
}
public sealed class MockTfsVCMapping : ITfsVCMapping
{
public MockTfsVCMapping(TfsVCSourceProvider.DefinitionWorkspaceMapping mapping, string localRoot)
{
ArgUtil.NotNull(mapping, nameof(mapping));
ArgUtil.NotNull(localRoot, nameof(localRoot));
Cloak = mapping.MappingType == TfsVCSourceProvider.DefinitionMappingType.Cloak;
LocalPath = mapping.GetRootedLocalPath(localRoot);
Recursive = mapping.Recursive;
ServerPath = mapping.NormalizedServerPath;
}
public bool Cloak { get; set; }
public string LocalPath { get; set; }
public bool Recursive { get; set; }
public string ServerPath { get; set; }
}
}
}
|
using System;
namespace ReMi.DataAccess.Exceptions
{
public class AccountAlreadyExistsException : EntityAlreadyExistsException
{
public AccountAlreadyExistsException(Guid accountId)
: base("Account", accountId)
{
}
public AccountAlreadyExistsException(string accountEmail)
: base("Account", accountEmail)
{
}
public AccountAlreadyExistsException(Guid accountId, Exception innerException)
: base("Account", accountId, innerException)
{
}
public AccountAlreadyExistsException(string accountEmail, Exception innerException)
: base("Account", accountEmail, innerException)
{
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3rd
{
class Program
{
static void Main(string[] args)
{
var hrizantemi = int.Parse(Console.ReadLine());
var roses = int.Parse(Console.ReadLine());
var tulips = int.Parse(Console.ReadLine());
var season = Console.ReadLine().ToLower();
var holiday = Console.ReadLine().ToLower();
var hrizantemaPrice = 0.0;
var rosePrice = 0.0;
var tulipPrice = 0.0;
var totalFlowers = hrizantemi + tulips + roses;
switch (season)
{
case "spring": hrizantemaPrice = 2.0; rosePrice = 4.1; tulipPrice = 2.5;break;
case "summer": hrizantemaPrice = 2.0; rosePrice = 4.1; tulipPrice = 2.5; break;
case "autumn": hrizantemaPrice = 3.75; rosePrice = 4.5; tulipPrice = 4.15; break;
case "winter": hrizantemaPrice = 3.75; rosePrice = 4.5; tulipPrice = 4.15; break;
}
var totalPrice = hrizantemi * hrizantemaPrice + roses * rosePrice + tulips * tulipPrice;
if (holiday == "y")
{
totalPrice *= 1.15;
}
if (tulips > 7 && season == "spring")
{
totalPrice *= 0.95;
}
if (roses >= 10 && season == "winter")
{
totalPrice *= 0.9;
}
if (totalFlowers > 20)
{
totalPrice *= 0.8;
}
Console.WriteLine("{0:f2}",totalPrice +2);
}
}
}
|
using VA = VisioAutomation;
using System.Collections.Generic;
using System.Linq;
using IVisio = Microsoft.Office.Interop.Visio;
namespace VisioAutomation.ShapeSheet.Query
{
public partial class CellQuery
{
public class SectionQueryList : IEnumerable<SectionQuery>
{
private IList<SectionQuery> items { get; set; }
private readonly CellQuery parent;
private readonly Dictionary<IVisio.VisSectionIndices,SectionQuery> hs_section;
internal SectionQueryList(CellQuery parent) :
this(parent,0)
{
}
internal SectionQueryList(CellQuery parent,int capacity)
{
this.items = new List<SectionQuery>(capacity);
this.parent = parent;
this.hs_section = new Dictionary<IVisio.VisSectionIndices, SectionQuery>(capacity);
}
public IEnumerator<SectionQuery> GetEnumerator()
{
return (this.items).GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public SectionQuery this[int index]
{
get { return this.items[index]; }
}
public SectionQuery Add(IVisio.VisSectionIndices section)
{
if (this.hs_section.ContainsKey(section))
{
string msg = string.Format("Duplicate Section");
throw new AutomationException(msg);
}
int ordinal = items.Count;
var section_query = new SectionQuery(this.parent, ordinal, section);
this.items.Add(section_query);
this.hs_section[section] = section_query;
return section_query;
}
public int Count
{
get { return this.items.Count; }
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ST.Library.UI.NodeEditor;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
namespace WinNodeEditorDemo.ImageNode
{
[STNode("Image", "Crystal_lz", "2212233137@qq.com", "st233.com", "Image Node")]
public class ImageInputNode : ImageBaseNode
{
private string _FileName;//默认的DescriptorType不支持文件路径的选择 所以需要扩展
[STNodeProperty("InputImage", "Click to select a image", DescriptorType = typeof(OpenFileDescriptor))]
public string FileName {
get { return _FileName; }
set {
Image img = null; //当文件名被设置时 加载图片并 向输出节点输出
if (!string.IsNullOrEmpty(value)) {
img = Image.FromFile(value);
}
if (m_img_draw != null) m_img_draw.Dispose();
m_img_draw = img;
_FileName = value;
m_op_img_out.TransferData(m_img_draw, true);
this.Invalidate();
}
}
protected override void OnCreate() {
base.OnCreate();
this.Title = "ImageInput";
}
protected override void OnDrawBody(DrawingTools dt) {
base.OnDrawBody(dt);
Graphics g = dt.Graphics;
Rectangle rect = new Rectangle(this.Left + 10, this.Top + 30, 140, 80);
g.FillRectangle(Brushes.Gray, rect);
if (m_img_draw != null) g.DrawImage(m_img_draw, rect);
}
}
/// <summary>
/// 对默认Descriptor进行扩展 使得支持文件路径选择
/// </summary>
public class OpenFileDescriptor : STNodePropertyDescriptor
{
private Rectangle m_rect_open; //需要绘制"打开"按钮的区域
private StringFormat m_sf;
public OpenFileDescriptor() {
m_sf = new StringFormat();
m_sf.Alignment = StringAlignment.Center;
m_sf.LineAlignment = StringAlignment.Center;
}
protected override void OnSetItemLocation() { //当在STNodePropertyGrid上确定此属性需要显示的区域时候
base.OnSetItemLocation(); //计算出"打开"按钮需要绘制的区域
m_rect_open = new Rectangle(
this.RectangleR.Right - 20,
this.RectangleR.Top,
20,
this.RectangleR.Height);
}
protected override void OnMouseClick(System.Windows.Forms.MouseEventArgs e) {
if (m_rect_open.Contains(e.Location)) { //点击在"打开"区域 则弹出文件选择框
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.jpg|*.jpg|*.png|*.png";
if (ofd.ShowDialog() != DialogResult.OK) return;
this.SetValue(ofd.FileName);
} else base.OnMouseClick(e); //否则默认处理方式 弹出文本输入框
}
protected override void OnDrawValueRectangle(DrawingTools dt) {
base.OnDrawValueRectangle(dt); //在STNodePropertyGrid绘制此属性区域时候将"打开"按钮绘制上去
dt.Graphics.FillRectangle(Brushes.Gray, m_rect_open);
dt.Graphics.DrawString("+", this.Control.Font, Brushes.White, m_rect_open, m_sf);
}
}
}
|
using System;
using Android.Content;
using Android.Hardware;
using Android.Provider;
using CustomRenderer.Droid;
using formsapp2;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(formsapp2.CameraPreview), typeof(CameraPreviewRenderer))]
namespace CustomRenderer.Droid
{
public class CameraPreviewRenderer : ViewRenderer<formsapp2.CameraPreview, CameraPreview>
{
CameraPreview cameraPreview;
protected override void OnElementChanged(ElementChangedEventArgs<formsapp2.CameraPreview> e)
{
base.OnElementChanged(e);
if (Control == null)
{
cameraPreview = new CameraPreview(Context);
SetNativeControl(cameraPreview);
}
if (e.OldElement != null)
{
// Unsubscribe
cameraPreview.Click -= OnCameraPreviewClicked;
}
if (e.NewElement != null)
{
Control.Preview = Camera.Open((int)e.NewElement.Camera);
// Subscribe
cameraPreview.Click += OnCameraPreviewClicked;
}
}
void OnCameraPreviewClicked(object sender, EventArgs e)
{
if (cameraPreview.IsPreviewing)
{
cameraPreview.Preview.StopPreview();
cameraPreview.IsPreviewing = false;
}
else {
cameraPreview.Preview.StartPreview();
cameraPreview.IsPreviewing = true;
}
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
Control.Preview.Release();
}
base.Dispose(disposing);
}
}
} |
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Hosting;
using System.CommandLine.Parsing;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using Microsoft.Identity.Client;
using THNETII.CommandLine.Hosting;
using THNETII.Msal.Extensions.UserSecrets;
namespace THNETII.Msal.SampleConsole
{
public static partial class Program
{
public static async Task<int> Main(string[] args)
{
var cmdParser = new CommandLineBuilder(CreateRootCommand())
.UseDefaults()
.UseHost(CreateHostBuilder)
.Build();
return await cmdParser.InvokeAsync(args ?? Array.Empty<string>())
.ConfigureAwait(continueOnCapturedContext: false);
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
var hostBuilder = CommandLineHost.CreateDefaultBuilder(args);
hostBuilder.ConfigureServices(ConfigureServices);
return hostBuilder;
}
internal static readonly string MsalNamespace =
typeof(IClientApplicationBase).Namespace!;
private static void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient(Options.DefaultName)
// ;
//services.AddHttpClient("integratedWindowsAuth")
.ConfigurePrimaryHttpMessageHandler(serviceProvider =>
{
var handler = new HttpClientHandler
{
UseDefaultCredentials = true,
};
return handler;
})
;
services.AddSingleton<ClientApplicationFactory>();
//services.AddTransient<NamedClientApplicationFactory>();
services.AddOptions<PublicClientApplicationOptions>()
.Configure<IConfiguration>((opts, config) =>
config.Bind(MsalNamespace, opts))
.BindCommandLine()
.PostConfigure(PostConfigureAbstractApplicationOptions)
;
services.AddOptions<ConfidentialClientApplicationOptions>()
.Configure<IConfiguration>((opts, config) =>
config.Bind(MsalNamespace, opts))
.BindCommandLine()
.PostConfigure(PostConfigureAbstractApplicationOptions)
;
services.AddOptions<AcquireTokenOptions>()
.Configure<IConfiguration>((opts, config) =>
config.Bind("AcquireToken", opts))
.BindCommandLine()
.Configure<ParseResult>(BindCommandLineScopes)
;
services.AddOptions<IntegratedWindowsAuthenticationAcquireTokenOptions>()
.Configure<IConfiguration>((opts, config) =>
config.Bind("AcquireToken", opts))
.BindCommandLine()
.Configure<ParseResult>(BindCommandLineScopes)
;
services.AddOptions<SilentAcquireTokenOptions>()
.Configure<IConfiguration>((opts, config) =>
config.Bind("AcquireToken", opts))
.BindCommandLine()
.Configure<ParseResult>(BindCommandLineScopes)
;
services.AddDataProtection();
services.AddSingleton<MsalTokenCacheProvider, MsalTokenCacheUserSecretsProvider>();
}
private static void PostConfigureAbstractApplicationOptions(
ApplicationOptions options)
{
if (Assembly.GetEntryAssembly() is Assembly entryAssembly)
{
var entryName = entryAssembly.GetName();
options.ClientName ??= entryName.Name;
options.ClientVersion = entryAssembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion ??
entryName.Version?.ToString();
}
}
private static void BindCommandLineScopes(AcquireTokenOptions options,
ParseResult parseResult)
{
var scopesOptionResult = parseResult.CommandResult.Children
.OfType<OptionResult>()
.FirstOrDefault(r => r.Symbol.Name == nameof(options.Scopes));
if (scopesOptionResult?.GetValueOrDefault() is IEnumerable<string> scopes)
{
options.Scopes.AddRange(scopes);
}
}
}
}
|
namespace RatioMaster_source
{
public class TorrentClient
{
internal TorrentClient(string name)
{
this.DefNumWant = 200;
this.StartOffset = 10000000;
this.SearchString = string.Empty;
this.Parse = false;
this.MaxOffset = 25000000;
this.ProcessName = string.Empty;
this.Name = name;
}
internal int DefNumWant { get; set; }
internal string ProcessName { get; set; }
internal long StartOffset { get; set; }
internal long MaxOffset { get; set; }
internal string SearchString { get; set; }
internal bool Parse { get; set; }
internal bool HashUpperCase { get; set; }
internal string Headers { get; set; }
internal string HttpProtocol { get; set; }
internal string Key { get; set; }
internal string Name { get; set; }
internal string PeerID { get; set; }
internal string Query { get; set; }
}
}
|
using Bellatrix.Mobile.Android;
////using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
namespace Bellatrix.Mobile.Tests
{
[SetUpFixture]
public class TestsInitialize
{
[OneTimeSetUp]
public void AssemblyInitialize()
{
AndroidApp.StartAppiumLocalService();
}
[OneTimeTearDown]
public void AssemblyCleanUp()
{
var app = ServicesCollection.Current.Resolve<AndroidApp>();
app?.Dispose();
app?.StopAppiumLocalService();
}
}
// Uncomment if you want to use MSTest
////[TestClass]
////public class TestsInitialize
////{
//// [AssemblyInitialize]
//// public static void AssemblyInitialize(TestContext testContext)
//// {
//// AndroidApp.StartAppiumLocalService();
//// }
//// [AssemblyCleanup]
//// public static void AssemblyCleanUp()
//// {
//// var app = ServicesCollection.Current.Resolve<AndroidApp>();
//// app?.Dispose();
//// App.StopAppiumLocalService();
//// }
////}
}
|
using Dto.Registration;
namespace Messages
{
public class EventMessageBody
{
public List<UseCasesSendEventDto>? EventMessages { get; set; }
}
}
|
using Autofac;
using Autofac.Extensions.DependencyInjection;
using AzureStorage.Blob;
using AzureStorage.Tables;
using AzureStorage.Tables.Templates.Index;
using Common.Log;
using Lykke.Service.ClientDictionaries.AzureRepositories.ClientDictionaryBlob;
using Lykke.Service.ClientDictionaries.AzureRepositories.ClientKeysToBlobKeys;
using Lykke.Service.ClientDictionaries.Core.Services;
using Lykke.Service.ClientDictionaries.Settings.ServiceSettings;
using Lykke.Service.ClientDictionaries.Services;
using Lykke.SettingsReader;
using Microsoft.Extensions.DependencyInjection;
namespace Lykke.Service.ClientDictionaries.Modules
{
public class ServiceModule : Module
{
private readonly IReloadingManager<ClientDictionariesSettings> _settings;
private readonly ILog _log;
private readonly IServiceCollection _services;
public ServiceModule(IReloadingManager<ClientDictionariesSettings> settings, ILog log)
{
_settings = settings;
_log = log;
_services = new ServiceCollection();
}
protected override void Load(ContainerBuilder builder)
{
builder.RegisterInstance(_log)
.As<ILog>()
.SingleInstance();
builder.RegisterType<HealthService>()
.As<IHealthService>()
.SingleInstance();
builder.RegisterType<StartupManager>()
.As<IStartupManager>();
builder.RegisterType<ShutdownManager>()
.As<IShutdownManager>();
builder.RegisterType<InputValidator>()
.As<IInputValidator>()
.SingleInstance()
.WithParameter(TypedParameter.From(_settings.CurrentValue.MaxPayloadSizeBytes));
builder.Register(ctx => new ClientDictionaryBlob(
AzureBlobStorage.Create(
_settings.ConnectionString(x => x.Db.DataConnString)),
new ClientKeysToBlobKeys(
AzureTableStorage<ClientKeysToBlobKeyEntity>.Create(
_settings.ConnectionString(x => x.Db.DataConnString),
ClientKeysToBlobKeys.TableName,
_log))))
.As<IClientDictionary>()
.SingleInstance();
builder.Populate(_services);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using WMIT.DataServices.Controllers;
using WMIT.DataServices.Services;
namespace WMIT.DataServices.Tests.Fixtures
{
class ContactsRESTController : RESTController<TestDB, Contact>
{
public ContactsRESTController(IDataService<Contact> service) : base(service) { }
public ContactsRESTController() : base() { }
public IDataService<Contact> GetService()
{
return this.service;
}
public static ContactsRESTController Mock()
{
var db = TestDB.Create();
var user = new User("user");
var service = new EntityDataService<TestDB, Contact>(db, user);
var ctrl = new ContactsRESTController(service);
ctrl.Configuration = new HttpConfiguration();
return ctrl;
}
}
class ContactsODataController : ODataController<TestDB, Contact>
{
public ContactsODataController(IDataService<Contact> service) : base(service) { }
public ContactsODataController() : base() { }
public IDataService<Contact> GetService()
{
return this.service;
}
public static ContactsODataController Mock()
{
var db = TestDB.Create();
var user = new User("user");
var service = new EntityDataService<TestDB, Contact>(db, user);
var ctrl = new ContactsODataController(service);
// We need the empty configuration for the Validate() method call
// in the update tests
ctrl.Configuration = new HttpConfiguration();
return ctrl;
}
}
}
|
using ShineEngine;
using System;
/// <summary>
/// (generated by shine)
/// </summary>
public class SceneRequestMaker:DataMaker
{
public SceneRequestMaker()
{
offSet=SceneRequestType.off;
list=new Func<BaseData>[SceneRequestType.count-offSet];
list[SceneRequestType.PlayerSwitchScene-offSet]=createPlayerSwitchSceneRequest;
list[SceneRequestType.SceneLogin-offSet]=createSceneLoginRequest;
list[SceneRequestType.PreEnterSceneReadyForScene-offSet]=createPreEnterSceneReadyForSceneRequest;
}
private BaseData createPlayerSwitchSceneRequest()
{
return new PlayerSwitchSceneRequest();
}
private BaseData createSceneLoginRequest()
{
return new SceneLoginRequest();
}
private BaseData createPreEnterSceneReadyForSceneRequest()
{
return new PreEnterSceneReadyForSceneRequest();
}
}
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Burcin.Models.BurcinDatabase
{
[Table(nameof(Recipe), Schema = Constants.DefaultSchema)]
public partial class Recipe : BaseModel
{
public long ChefId { get; set; }
[ForeignKey(nameof(ChefId))]
[InverseProperty(nameof(BurcinDatabase.Chef.Recipes))]
public virtual Chef Chef { get; set; }
[StringLength(200)]
public string Name { get; set; }
public string Url { get; set; }
public ushort Yield { get; set; }
public float GramPerYield { get; set; }
[InverseProperty(nameof(RecipeExpansion.Recipe))]
public virtual RecipeExpansion Expansion { get; set; }
public short? CategoryCode { get; set; }
[ForeignKey(nameof(CategoryCode))]
[InverseProperty(nameof(BurcinDatabase.CategoryCode.Recipes))]
public virtual CategoryCode CategoryNavigation { get; set; }
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.ContractsLight;
using System.Linq;
using BuildXL.Pips.DirectedGraph;
using BuildXL.Pips.Operations;
using BuildXL.Scheduler;
using BuildXL.Scheduler.Graph;
using BuildXL.Utilities;
using BuildXL.Utilities.Collections;
using BuildXL.Utilities.Configuration;
using BuildXL.Utilities.Tracing;
using Test.BuildXL.TestUtilities.Xunit;
using Xunit;
using Xunit.Abstractions;
using FileId = System.Int32;
using PathId = System.Int32;
namespace Test.BuildXL.Scheduler
{
public class BuildSetCalculatorTests : BuildXL.TestUtilities.Xunit.XunitBuildXLTest
{
public BuildSetCalculatorTests(ITestOutputHelper output)
: base(output) { }
[Fact]
public void BasicBuild()
{
MutableDirectedGraph graph;
NodeId[] n;
CreateGraph(out graph, out n);
var buildSetCalculator = new TestBuildSetCalculator(graph);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n[2], n[6], n[9], n[11], n[5], n[7], n[14] },
explicitlyScheduledNodes: new[] { n[2], n[5] },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: false);
}
[Fact]
public void BasicIncrementalScheduling()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
// Graph: dirtyRequested -> cleanMaterializedNotRequested -> cleanNotMaterializedNotRequested.
graph.AddEdge(cleanNotMaterializedNotRequested, cleanMaterializedNotRequested);
graph.AddEdge(cleanMaterializedNotRequested, dirtyRequested);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequested);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// Need to be scheduled so that the dirtyRequested can execute properly.
cleanMaterializedNotRequested
},
explicitlyScheduledNodes: new[] { dirtyRequested },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void MaterializedSealDirectoryTests()
{
// Graph:
// cleanMaterizedSealDirectory
// \|/ |
// dirtyDownstream |
// \|/
// downstreamOfSealedDirectory
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var cleanMaterizedSealDirectory = buildSetCalculator.CreateNode(PipType.SealDirectory);
var downstreamOfSealedDirectory = buildSetCalculator.CreateNode(PipType.Process);
var dirtyDownstreamOfSealedDirectory = buildSetCalculator.CreateNode(PipType.Process);
graph.AddEdge(cleanMaterizedSealDirectory, downstreamOfSealedDirectory);
graph.AddEdge(cleanMaterizedSealDirectory, dirtyDownstreamOfSealedDirectory);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Fill();
dirtyNodeTracker.MarkNodeDirectDirty(dirtyDownstreamOfSealedDirectory);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new NodeId[] { dirtyDownstreamOfSealedDirectory, cleanMaterizedSealDirectory },
explicitlyScheduledNodes: new NodeId[] { dirtyDownstreamOfSealedDirectory },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
XAssert.IsTrue(dirtyNodeTracker.IsNodeDirty(dirtyDownstreamOfSealedDirectory));
XAssert.IsFalse(dirtyNodeTracker.IsNodeMaterialized(dirtyDownstreamOfSealedDirectory));
XAssert.IsTrue(dirtyNodeTracker.IsNodeClean(cleanMaterizedSealDirectory));
XAssert.IsTrue(dirtyNodeTracker.IsNodeMaterialized(cleanMaterizedSealDirectory));
XAssert.IsTrue(dirtyNodeTracker.IsNodeClean(downstreamOfSealedDirectory));
XAssert.IsTrue(dirtyNodeTracker.IsNodeMaterialized(cleanMaterizedSealDirectory));
}
[Fact]
public void DirtyAndMaterializedTests()
{
// Graph:
// dirtyRequested
// |
// \|/
// downstreamOfDirtyNode
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var downstreamOfDirtyNode = buildSetCalculator.CreateNode(PipType.Process);
graph.AddEdge(dirtyRequested, downstreamOfDirtyNode);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Fill();
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
XAssert.AreEqual(2, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
XAssert.AreEqual(downstreamOfDirtyNode.Value, dirtyNodeTracker.AllMaterializedNodes.First().Value);
dirtyNodeTracker.MarkNodeClean(dirtyRequested);
XAssert.AreEqual(1, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
dirtyNodeTracker.MarkNodeClean(downstreamOfDirtyNode);
XAssert.AreEqual(0, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
XAssert.AreEqual(2, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(dirtyRequested.Value, dirtyNodeTracker.AllDirtyNodes.First().Value);
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
dirtyNodeTracker.MarkNodeMaterialized(dirtyRequested);
XAssert.AreEqual(2, dirtyNodeTracker.AllMaterializedNodes.Count());
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
XAssert.AreEqual(2, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
XAssert.AreEqual(downstreamOfDirtyNode.Value, dirtyNodeTracker.AllMaterializedNodes.First().Value);
dirtyNodeTracker.MarkNodeClean(dirtyRequested);
dirtyNodeTracker.MarkNodeClean(downstreamOfDirtyNode);
XAssert.AreEqual(0, dirtyNodeTracker.AllDirtyNodes.Count());
XAssert.AreEqual(1, dirtyNodeTracker.AllMaterializedNodes.Count());
}
[Fact]
public void BasicIncrementalSchedulingWithNotMaterializedInTheMiddle()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
// Graph: dirtyRequested -> cleanNotMaterializedNotRequested -> cleanMaterializedNotRequested.
graph.AddEdge(cleanMaterializedNotRequested, cleanNotMaterializedNotRequested);
graph.AddEdge(cleanNotMaterializedNotRequested, dirtyRequested);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequested);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
cleanNotMaterializedNotRequested,
// Need to be scheduled so that the cleanNotMaterializedNotRequested can execute properly.
cleanMaterializedNotRequested
},
explicitlyScheduledNodes: new[] { dirtyRequested },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void BasicIncrementalSchedulingWithSealedDirectoryInTheMiddle()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequestedSealedDirectory = buildSetCalculator.CreateNode(PipType.SealDirectory);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
// Graph: dirtyRequested -> cleanMaterializedNotRequestedSealDirectory -> cleanNotMaterializedNotRequested.
graph.AddEdge(cleanNotMaterializedNotRequested, cleanMaterializedNotRequestedSealedDirectory);
graph.AddEdge(cleanMaterializedNotRequestedSealedDirectory, dirtyRequested);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequestedSealedDirectory);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// Although clean-materialized, need to be scheduled.
cleanMaterializedNotRequestedSealedDirectory
},
explicitlyScheduledNodes: new[] { dirtyRequested },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalSchedulingWithForkGraph()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequestedCopyFile = buildSetCalculator.CreateNode(PipType.CopyFile);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequested2 = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequestedDepOf2 = buildSetCalculator.CreateNode(PipType.Process);
// Graph:
// dirtyRequested dirtyNotRequested2
// | | |
// +------> cleanMaterializedNotRequestedCopyFile <----+ +-------------> dirtyNotRequestedDepOf2
// |
// V
// cleanNotMaterializedNotRequested
graph.AddEdge(cleanNotMaterializedNotRequested, cleanMaterializedNotRequestedCopyFile);
graph.AddEdge(cleanMaterializedNotRequestedCopyFile, dirtyRequested);
graph.AddEdge(cleanMaterializedNotRequestedCopyFile, dirtyNotRequestedDepOf2);
graph.AddEdge(dirtyNotRequestedDepOf2, dirtyNotRequested2);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyNotRequestedDepOf2);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequestedCopyFile);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// Need to be added so dirtyRequested can execute properly.
cleanMaterializedNotRequestedCopyFile
},
explicitlyScheduledNodes: new[] { dirtyRequested },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalSchedulingWithForkGraphAndNotMaterializedNodeInTheJunction()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequestedCopyFile = buildSetCalculator.CreateNode(PipType.CopyFile);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequested2 = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequestedDepOf2 = buildSetCalculator.CreateNode(PipType.Process);
// Graph:
// dirtyRequested dirtyNotRequested2
// | | |
// +------> cleanNotMaterializedNotRequested <---------+ +-------------> dirtyNotRequestedDepOf2
// |
// V
// cleanMaterializedNotRequestedCopyFile
graph.AddEdge(cleanMaterializedNotRequestedCopyFile, cleanNotMaterializedNotRequested);
graph.AddEdge(cleanNotMaterializedNotRequested, dirtyRequested);
graph.AddEdge(cleanNotMaterializedNotRequested, dirtyNotRequestedDepOf2);
graph.AddEdge(dirtyNotRequestedDepOf2, dirtyNotRequested2);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyNotRequestedDepOf2);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequestedCopyFile);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// Need to be scheduled because not materialized.
cleanNotMaterializedNotRequested,
cleanMaterializedNotRequestedCopyFile
},
explicitlyScheduledNodes: new[] { dirtyRequested },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalSchedulingWithForkGraphAndMultipleRequestedNodes()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedNotRequestedCopyFile = buildSetCalculator.CreateNode(PipType.CopyFile);
var cleanNotMaterializedNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequested2 = buildSetCalculator.CreateNode(PipType.Process);
var dirtyRequestedDepOf2 = buildSetCalculator.CreateNode(PipType.Process);
// Graph:
// dirtyRequested dirtyNotRequested2
// | | |
// +------> cleanMaterializedNotRequestedCopyFile <----+ +-------------> dirtyRequestedDepOf2
// |
// V
// cleanNotMaterializedNotRequested
graph.AddEdge(cleanNotMaterializedNotRequested, cleanMaterializedNotRequestedCopyFile);
graph.AddEdge(cleanMaterializedNotRequestedCopyFile, dirtyRequested);
graph.AddEdge(cleanMaterializedNotRequestedCopyFile, dirtyNotRequested2);
graph.AddEdge(dirtyRequestedDepOf2, dirtyNotRequested2);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequestedDepOf2);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedNotRequestedCopyFile);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
dirtyRequestedDepOf2,
dirtyNotRequested2,
// Need to be added so dirtyRequested and dirtyNotRequested2 can execute properly.
cleanMaterializedNotRequestedCopyFile
},
explicitlyScheduledNodes: new[] { dirtyRequested, dirtyRequestedDepOf2 },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalSchedulingWithXandYGraph()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested1 = buildSetCalculator.CreateNode(PipType.Process);
var dirtyRequested2 = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedXCenterNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanNotMaterializedXBottomLeft = buildSetCalculator.CreateNode(PipType.Process);
var cleanNotMaterializedXBottomRight = buildSetCalculator.CreateNode(PipType.Process);
var cleanNotMaterializedYCenterNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanMaterializedYBottomNotRequested = buildSetCalculator.CreateNode(PipType.Process);
var dirtyNotRequested = buildSetCalculator.CreateNode(PipType.Process);
// Graph:
// dirtyRequested1 dirtyRequested2 dirtyNotRequested
// | | | |
// +--> cleanMaterializedXCenterNotRequested <--------+ +---------> cleanNotMaterializedYCenterNotRequested <--------+
// | |
// +----------------+-------------------+ |
// | | |
// V V V
// cleanNotMaterializedXBottomLeft cleanNotMaterializedXBottomRight cleanMaterializedYBottomNotRequested
graph.AddEdge(cleanNotMaterializedXBottomLeft, cleanMaterializedXCenterNotRequested);
graph.AddEdge(cleanNotMaterializedXBottomRight, cleanMaterializedXCenterNotRequested);
graph.AddEdge(cleanMaterializedXCenterNotRequested, dirtyRequested1);
graph.AddEdge(cleanMaterializedXCenterNotRequested, dirtyRequested2);
graph.AddEdge(cleanMaterializedYBottomNotRequested, cleanNotMaterializedYCenterNotRequested);
graph.AddEdge(cleanNotMaterializedYCenterNotRequested, dirtyRequested2);
graph.AddEdge(cleanNotMaterializedYCenterNotRequested, dirtyNotRequested);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested1);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested2);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyNotRequested);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(cleanMaterializedXCenterNotRequested);
materializedNodeSet.Add(cleanMaterializedYBottomNotRequested);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested1,
dirtyRequested2,
// Need to be scheduled so that dirtyRequested1 and dirtyRequested2 can execute properly.
cleanMaterializedXCenterNotRequested,
cleanNotMaterializedYCenterNotRequested,
cleanMaterializedYBottomNotRequested
},
explicitlyScheduledNodes: new[] { dirtyRequested1, dirtyRequested2 },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalScheduling()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
var dirtyRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanRequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanRequested2 = buildSetCalculator.CreateNode(PipType.CopyFile);
var cleanSharedDependency = buildSetCalculator.CreateNode(PipType.Process);
var cleanDependency = buildSetCalculator.CreateNode(PipType.Process);
var dirtyUnrequested = buildSetCalculator.CreateNode(PipType.Process);
var cleanRequestedDirtyUnrequestedDependency2 = buildSetCalculator.CreateNode(PipType.Process);
var dependencyWhichIsNotDownstreamOfAProcess = buildSetCalculator.CreateNode(PipType.CopyFile);
var dependencyWhichIsDownstreamOfAProcess = buildSetCalculator.CreateNode(PipType.CopyFile);
var upstreamProcess = buildSetCalculator.CreateNode(PipType.Process);
var requestedReachableWhichIsDownstreamOfAProcess = buildSetCalculator.CreateNode(PipType.CopyFile);
// NOTE: Normally nodes reachable from dirty nodes must be built. But that's only if reachable
// by a path in the explicitly requested nodes dependency closure and downstream of a process pip.
var cleanRequestedDirtyUnrequestedDependency = buildSetCalculator.CreateNode(PipType.Process);
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
dirtyNodeTracker.MarkNodeDirectDirty(dirtyRequested);
// All nodes are assumed to be materialized.
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Fill();
// Dependencies:
// dirtyRequested -> cleanSharedDependency
// cleanRequested -> cleanSharedDependency
// cleanRequested -> cleanDependency
// dirtyUnrequested -> dirtyRequested
// dirtyUnrequested -> cleanRequestedDirtyUnrequestedDependency
// cleanRequestedDirtyUnrequestedDependency -> dependencyWhichIsNotDownstreamOfAProcess
// dirtyRequested -> dependencyWhichIsNotDownstreamOfAProcess
graph.AddEdge(cleanSharedDependency, dirtyRequested);
graph.AddEdge(cleanSharedDependency, cleanRequested);
graph.AddEdge(cleanDependency, cleanRequested);
graph.AddEdge(dirtyRequested, dirtyUnrequested);
graph.AddEdge(cleanRequestedDirtyUnrequestedDependency, dirtyUnrequested);
graph.AddEdge(dependencyWhichIsNotDownstreamOfAProcess, cleanRequestedDirtyUnrequestedDependency);
graph.AddEdge(dependencyWhichIsNotDownstreamOfAProcess, dirtyRequested);
// cleanRequested2 -> cleanSharedDependency
// cleanRequested2 -> dependencyWhichIsDownstreamOfAProcess
// requestedReachableWhichIsDownstreamOfAProcess -> dependencyWhichIsDownstreamOfAProcess
// dependencyWhichIsDownstreamOfAProcess -> upstreamProcess
graph.AddEdge(cleanSharedDependency, cleanRequested2);
graph.AddEdge(dependencyWhichIsDownstreamOfAProcess, cleanRequested2);
graph.AddEdge(dependencyWhichIsDownstreamOfAProcess, requestedReachableWhichIsDownstreamOfAProcess);
graph.AddEdge(upstreamProcess, dependencyWhichIsDownstreamOfAProcess);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// The following pips are included although they are clean and materialized.
// We need to schedule them so that the execution of dirtyRequested works properly.
// This is OK these pips will not do any execution, but only assert their outputs.
cleanSharedDependency,
dependencyWhichIsNotDownstreamOfAProcess
},
explicitlyScheduledNodes:
new[]
{
dirtyRequested, cleanRequested, cleanRequested2, cleanRequestedDirtyUnrequestedDependency,
requestedReachableWhichIsDownstreamOfAProcess
},
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: false);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(dependencyWhichIsNotDownstreamOfAProcess);
materializedNodeSet.Add(cleanRequestedDirtyUnrequestedDependency);
materializedNodeSet.Add(cleanDependency);
materializedNodeSet.Add(cleanRequested);
materializedNodeSet.Add(cleanRequested2);
materializedNodeSet.Add(dependencyWhichIsDownstreamOfAProcess);
materializedNodeSet.Add(requestedReachableWhichIsDownstreamOfAProcess);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[]
{
dirtyRequested,
// Scheduled because it is not materialized, although clean.
cleanSharedDependency,
// Need to be scheduled so dirtyRequested can execute properly.
dependencyWhichIsNotDownstreamOfAProcess,
// Scheduled because it becomes dirty after adding cleanSharedDependency.
cleanRequested,
// Need to be scheduled so that cleanRequested can execute properly.
cleanDependency,
// Scheduled because it becomes dirty after adding cleanSharedDependency.
cleanRequested2,
// Needs to be scheduled so that cleanRequested2 can execute properly.
dependencyWhichIsDownstreamOfAProcess,
},
explicitlyScheduledNodes:
new[]
{
dirtyRequested, cleanRequested, cleanRequested2, cleanRequestedDirtyUnrequestedDependency,
requestedReachableWhichIsDownstreamOfAProcess
},
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: false);
}
[Fact]
public void IncrementalSchedulingSpecial()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
NodeId[] n = new NodeId[10];
n[0] = buildSetCalculator.CreateNode(PipType.Process);
n[1] = buildSetCalculator.CreateNode(PipType.Process);
n[2] = buildSetCalculator.CreateNode(PipType.Process);
n[3] = buildSetCalculator.CreateNode(PipType.Process);
n[4] = buildSetCalculator.CreateNode(PipType.SealDirectory);
n[5] = buildSetCalculator.CreateNode(PipType.Process);
// This should make all nodes get added.
n[6] = buildSetCalculator.CreateNode(PipType.Process);
n[7] = buildSetCalculator.CreateNode(PipType.Process);
n[8] = buildSetCalculator.CreateNode(PipType.Process);
n[9] = buildSetCalculator.CreateNode(PipType.Process);
// All nodes are assumed to be clean.
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
// But only 1 & 3 have materialized its outputs.
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(n[1]);
materializedNodeSet.Add(n[3]);
// Dependencies:
// 0 -> 1M -> 2 -> 3M -> 4[SD] -> 6 <- 7 <- 8 <- 9
// ^
// |
// 5
graph.AddEdge(n[1], n[0]);
graph.AddEdge(n[2], n[1]);
graph.AddEdge(n[3], n[2]);
graph.AddEdge(n[4], n[3]);
graph.AddEdge(n[6], n[4]);
graph.AddEdge(n[6], n[7]);
graph.AddEdge(n[7], n[8]);
graph.AddEdge(n[8], n[9]);
graph.AddEdge(n[4], n[5]);
buildSetCalculator.ComputeAndValidate(
expectedNodes: n.ToArray(),
explicitlyScheduledNodes: new[] { n[0], n[5], n[9] },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void IncrementalSchedulingCopyAndWriteFileDoNotDirtyItsDependents()
{
MutableDirectedGraph graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
NodeId[] n = new NodeId[8];
n[0] = buildSetCalculator.CreateNode(PipType.Process);
n[1] = buildSetCalculator.CreateNode(PipType.Process);
n[2] = buildSetCalculator.CreateNode(PipType.Process);
n[3] = buildSetCalculator.CreateNode(PipType.SealDirectory);
n[4] = buildSetCalculator.CreateNode(PipType.CopyFile);
n[5] = buildSetCalculator.CreateNode(PipType.WriteFile);
n[6] = buildSetCalculator.CreateNode(PipType.Process);
n[7] = buildSetCalculator.CreateNode(PipType.Process);
// Nodes 0 & 7 are dirty, and they are requested.
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
buildSetCalculator.MarkProcessNodeRecursivelyDirty(n[0], true);
buildSetCalculator.MarkProcessNodeRecursivelyDirty(n[7], true);
// Nodes 2 & 5 have materialized their outputs.
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(n[1]);
materializedNodeSet.Add(n[5]);
// Graph:
// 0,D -> 1,M -> 2 -> 3/SD <- 6 <- 7,D
// |
// +-> 4/CP -> 5/WF,M
graph.AddEdge(n[5], n[4]);
graph.AddEdge(n[4], n[3]);
graph.AddEdge(n[3], n[6]);
graph.AddEdge(n[6], n[7]);
graph.AddEdge(n[3], n[2]);
graph.AddEdge(n[2], n[1]);
graph.AddEdge(n[1], n[0]);
// Node 2 should not be scheduled.
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n[0], n[1], n[3], n[4], n[5], n[6], n[7] },
explicitlyScheduledNodes: new[] { n[0], n[7] },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void NonMaterializedPips()
{
var graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
// n1 --> n3 --> n4
// ^
// |
// n2 ----+
var n1 = buildSetCalculator.CreateNode(PipType.Process);
var n2 = buildSetCalculator.CreateNode(PipType.Process);
var n3 = buildSetCalculator.CreateNode(PipType.Process);
var n4 = buildSetCalculator.CreateNode(PipType.Process);
graph.AddEdge(n1, n3);
graph.AddEdge(n2, n3);
graph.AddEdge(n3, n4);
// n3 is clean but non materialized, only n4 is materialized.
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Add(n4);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n1, n2, n3, n4 },
explicitlyScheduledNodes: new[] { n3 },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact]
public void DirtyBuildBuildsDependents()
{
var graph = new MutableDirectedGraph();
var buildSetCalculator = new TestBuildSetCalculator(graph);
var n1 = buildSetCalculator.CreateNode(PipType.Process);
var n2 = buildSetCalculator.AddSealedDirectory(new Directory(), SealDirectoryKind.Full);
var n3 = buildSetCalculator.CreateNode(PipType.Process);
var n4 = buildSetCalculator.CreateNode(PipType.Process);
// Dependencies:
// n4 -> n3
// n3 -> n2
// n2 -> n1
graph.AddEdge(n1, n2);
graph.AddEdge(n2, n3);
graph.AddEdge(n3, n4);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n1, n2, n3, n4 },
explicitlyScheduledNodes: new[] { n1, n4 },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n1, n2, n3 },
explicitlyScheduledNodes: new[] { n1, n3 },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
}
[Fact]
public void BasicDirtyBuild()
{
var graph = new MutableDirectedGraph();
var buildSetCalculator = new TestBuildSetCalculator(graph);
var n1 = buildSetCalculator.CreateNode(PipType.Process);
var n2 = buildSetCalculator.AddProcess(new[] { buildSetCalculator.CreateFile(exists: true) });
var n3 = buildSetCalculator.AddProcess(new[] { buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: n2) });
var n4 = buildSetCalculator.CreateNode(PipType.Process);
// n2 depends n1
graph.AddEdge(n1, n2);
// n3 depends n2
graph.AddEdge(n2, n3);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n2 },
explicitlyScheduledNodes: new[] { n2 },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n2, n3 },
explicitlyScheduledNodes: new[] { n3 },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
}
[Fact]
public void BasicModuleDirtyBuild()
{
var graph = new MutableDirectedGraph();
var buildSetCalculator = new TestBuildSetCalculator(graph);
var m1 = ModuleId.UnsafeCreate(1);
var m2 = ModuleId.UnsafeCreate(2);
var n1 = buildSetCalculator.AddProcess(moduleId: m1);
var n2 = buildSetCalculator.AddProcess(moduleId: m1, files: new[] { buildSetCalculator.CreateFile(exists: true) });
var n3 = buildSetCalculator.AddProcess(moduleId: m2, files: new[] { buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: n2) });
var n4 = buildSetCalculator.AddProcess(moduleId: m2, files: new[] { buildSetCalculator.CreateFile(exists: true) });
var n5 = buildSetCalculator.AddProcess(moduleId: m1, files: new[] { buildSetCalculator.CreateFile(exists: true) });
// n2 depends n1
graph.AddEdge(n1, n2);
// n3 depends n2
graph.AddEdge(n2, n3);
// n4 depends n3
graph.AddEdge(n3, n4);
// Even though n2's inputs are present, we need to schedule its dependency, n1 as they are from the same module.
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n1, n2 },
explicitlyScheduledNodes: new[] { n2 },
forceSkipDepsMode: ForceSkipDependenciesMode.Module,
scheduleDependents: false);
// n2 is the producer of the n3's missing input. Even though n2's module (m1) is not the requested module,
// we need to schedule n2 as well due to missing input
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n2, n3 },
explicitlyScheduledNodes: new[] { n3 },
forceSkipDepsMode: ForceSkipDependenciesMode.Module,
scheduleDependents: false);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n2, n3, n4 },
explicitlyScheduledNodes: new[] { n4 },
forceSkipDepsMode: ForceSkipDependenciesMode.Module,
scheduleDependents: false);
// If normal dirty build is used, then BuildXL should only schedule n4 because there is no inputs missing.
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n4 },
explicitlyScheduledNodes: new[] { n4 },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
// When requested multiple modules, the pips belonging to those modules cannot be skipped.
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { n1, n2, n3, n4, n5 },
explicitlyScheduledNodes: new[] { n4, n5 },
forceSkipDepsMode: ForceSkipDependenciesMode.Module,
scheduleDependents: false);
}
[Fact]
public void DirtyBuildWithAllMaterializedPips()
{
var graph = new MutableDirectedGraph();
var dirtyNodeSet = new RangedNodeSet();
var materializedNodeSet = new RangedNodeSet();
var dirtyNodeTracker = new DirtyNodeTracker(
graph: graph,
dirtyNodes: dirtyNodeSet,
perpetualDirtyNodes: new RangedNodeSet(),
dirtyNodesChanged: false,
materializedNodes: materializedNodeSet);
var buildSetCalculator = new TestBuildSetCalculator(graph, dirtyNodeTracker);
// n1 --> n3 --> n4
// ^
// |
// n2 ----+
var n1 = buildSetCalculator.CreateNode(PipType.Process);
var n2 = buildSetCalculator.CreateNode(PipType.Process);
var n3 = buildSetCalculator.CreateNode(PipType.Process);
var n4 = buildSetCalculator.CreateNode(PipType.Process);
graph.AddEdge(n1, n3);
graph.AddEdge(n2, n3);
graph.AddEdge(n3, n4);
// All clean, all materialized.
dirtyNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.ClearAndSetRange(graph.NodeRange);
materializedNodeSet.Fill();
buildSetCalculator.ComputeAndValidate(
expectedNodes: new NodeId[0],
explicitlyScheduledNodes: new[] { n3 },
forceSkipDepsMode: ForceSkipDependenciesMode.Disabled,
scheduleDependents: true);
}
[Fact(DisplayName = nameof(DirtyBuildCopyPipsAreTransparent))]
public void DirtyBuildCopyPipsAreTransparent()
{
var graph = new MutableDirectedGraph();
var buildSetCalculator = new TestBuildSetCalculator(graph);
var inputsMissingTransitiveDependency = buildSetCalculator.AddProcess(
new[] { buildSetCalculator.CreateFile(exists: false) });
var inputPresentDependency = buildSetCalculator.AddProcess(
new[] { buildSetCalculator.CreateFile(exists: true) });
var copyNode = buildSetCalculator.AddCopy(buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: inputPresentDependency));
var requested = buildSetCalculator.AddProcess(new[] { buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: copyNode) });
var unrequested = graph.CreateNode();
// These two nodes shouldn't be built because they aren't in the closure
var notInRequestedClosure = buildSetCalculator.CreateNode(PipType.Process);
var unrelated = buildSetCalculator.CreateNode(PipType.Process);
// Dependencies:
// inputsMissingTransitiveDependency will not be included because the only
// connection it has to the dependency closure is through inputPresentDependency
// which has all inputs present
// inputPresentDependency -> inputsMissingTransitiveDependency
// requested -> copyNode -> inputPresentDependency
// requested -> unrequested -> inputPresentDependency
// notInRequestedClosure -> unrequested
graph.AddEdge(inputPresentDependency, copyNode);
graph.AddEdge(copyNode, requested); // requested depends on copynode
graph.AddEdge(unrequested, requested);
graph.AddEdge(inputPresentDependency, unrequested);
graph.AddEdge(unrequested, notInRequestedClosure);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { inputPresentDependency, copyNode, requested, unrequested},
explicitlyScheduledNodes: new[] { requested },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
}
[Fact]
public void DirtyBuildWithDirectoryDependency()
{
var graph = new MutableDirectedGraph();
var buildSetCalculator = new TestBuildSetCalculator(graph);
var inputsMissingTransitiveDependency = buildSetCalculator.AddProcess(
new[] { buildSetCalculator.CreateFile(exists: false) });
var inputPresentDependency = buildSetCalculator.AddProcess(
new[] { buildSetCalculator.CreateFile(exists: true) });
var sealDir = new Directory(new[] { buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: inputPresentDependency) });
var sealNode = buildSetCalculator.AddSealedDirectory(sealDir, SealDirectoryKind.Full);
var dirInputMissingDependency = buildSetCalculator.AddProcess(
files: new[] { buildSetCalculator.CreateFile(exists: true) },
dirs: new[] { sealDir });
var requested = buildSetCalculator.AddProcess(new[] { buildSetCalculator.CreateFile(exists: false, sourceFile: false, producer: dirInputMissingDependency) });
// These two nodes shouldn't be built because they aren't in the closure
var notInRequestedClosure = buildSetCalculator.CreateNode(PipType.Process);
var unrelated = buildSetCalculator.CreateNode(PipType.Process);
// Dependencies:
// requested -> dirInputMissingDependency -> sealNode -> inputPresentDependency -> inputsMissingTransitiveDependency
graph.AddEdge(inputsMissingTransitiveDependency, inputPresentDependency);
graph.AddEdge(inputPresentDependency, sealNode);
graph.AddEdge(sealNode, dirInputMissingDependency);
graph.AddEdge(dirInputMissingDependency, requested);
graph.AddEdge(requested, notInRequestedClosure);
buildSetCalculator.ComputeAndValidate(
expectedNodes: new[] { inputPresentDependency, sealNode, dirInputMissingDependency, requested },
explicitlyScheduledNodes: new[] { requested },
forceSkipDepsMode: ForceSkipDependenciesMode.Always,
scheduleDependents: false);
}
/// <summary>
/// Creates a test graph.
/// </summary>
private static void CreateGraph(out MutableDirectedGraph graph, out NodeId[] nodes)
{
graph = new MutableDirectedGraph();
XAssert.AreEqual(graph.NodeCount, 0);
XAssert.AreEqual(graph.EdgeCount, 0);
// Test creation.
nodes = new NodeId[20];
for (int i = 0; i < nodes.Length; ++i)
{
nodes[i] = graph.CreateNode();
}
XAssert.AreEqual(graph.NodeCount, nodes.Length);
XAssert.AreEqual(graph.EdgeCount, 0);
foreach (NodeId t in nodes)
{
XAssert.IsTrue(graph.ContainsNode(t));
XAssert.IsTrue(graph.IsSourceNode(t));
XAssert.IsTrue(graph.IsSinkNode(t));
}
graph.AddEdge(nodes[5], nodes[0]);
graph.AddEdge(nodes[5], nodes[1]);
graph.AddEdge(nodes[6], nodes[1]);
graph.AddEdge(nodes[6], nodes[2]);
graph.AddEdge(nodes[7], nodes[5]);
graph.AddEdge(nodes[9], nodes[5]);
graph.AddEdge(nodes[8], nodes[4]);
graph.AddEdge(nodes[9], nodes[6]);
graph.AddEdge(nodes[14], nodes[7]);
graph.AddEdge(nodes[10], nodes[8]);
graph.AddEdge(nodes[11], nodes[8]);
graph.AddEdge(nodes[11], nodes[9]);
}
/// <summary>
/// Build set calculator using test data structures
/// </summary>
private sealed class TestBuildSetCalculator : BuildSetCalculator<TestProcess, PathId, FileId, Directory>
{
private readonly MutableDirectedGraph m_graph;
public TestBuildSetCalculator(MutableDirectedGraph graph, DirtyNodeTracker incrementalSchedulingState = null)
: base(CreateLoggingContextForTest(), graph, incrementalSchedulingState, new CounterCollection<PipExecutorCounter>())
{
m_graph = graph;
}
public readonly ConcurrentDenseIndex<PipType> PipTypes = new ConcurrentDenseIndex<PipType>(debug: false);
public readonly ConcurrentDenseIndex<ModuleId> ModuleIds = new ConcurrentDenseIndex<ModuleId>(debug: false);
public readonly ConcurrentDictionary<Directory, Tuple<SealDirectoryKind, NodeId>> SealDirectoryKinds = new ConcurrentDictionary<Directory, Tuple<SealDirectoryKind, NodeId>>();
public readonly ConcurrentDictionary<NodeId, Directory> SealDirectories = new ConcurrentDictionary<NodeId, Directory>();
public readonly ConcurrentDictionary<NodeId, int> CopyFiles = new ConcurrentDictionary<NodeId, int>();
public readonly ConcurrentDictionary<int, NodeId> Producers = new ConcurrentDictionary<int, NodeId>();
public readonly ConcurrentDenseIndex<TestProcess> Processes = new ConcurrentDenseIndex<TestProcess>(debug: false);
public readonly ConcurrentBitArray ExistentFiles = new ConcurrentBitArray(100, defaultValue: true);
private static readonly TestProcess DummyProcess = new TestProcess();
private int m_nextFile = 0;
public int CreateFile(bool exists = true, bool sourceFile = true, NodeId producer = default(NodeId))
{
var file = m_nextFile;
m_nextFile++;
ExistentFiles[file] = exists;
if (!sourceFile)
{
Contract.Assert(producer.IsValid);
Producers.Add(file, producer);
}
return file;
}
public NodeId CreateNode(PipType pipType, ModuleId moduleId = default(ModuleId))
{
var node = m_graph.CreateNode();
PipTypes[node.Value] = pipType;
ModuleIds[node.Value] = moduleId;
return node;
}
public NodeId AddCopy(FileId file, ModuleId moduleId = default(ModuleId))
{
var node = CreateNode(PipType.CopyFile, moduleId);
CopyFiles.Add(node, file);
return node;
}
public NodeId AddSealedDirectory(Directory directory, SealDirectoryKind kind, ModuleId moduleId = default(ModuleId))
{
var node = CreateNode(PipType.SealDirectory, moduleId);
SealDirectoryKinds.Add(directory, Tuple.Create(kind, node));
SealDirectories.Add(node, directory);
return node;
}
public NodeId AddProcess(FileId[] files = null, Directory[] dirs = null, ModuleId moduleId = default(ModuleId))
{
var node = CreateNode(PipType.Process, moduleId);
Processes[node.Value] = new TestProcess()
{
Dependencies = files,
Directories = dirs
};
return node;
}
protected override bool ExistsAsFile(FileId path)
{
return ExistentFiles[path];
}
protected override ReadOnlyArray<Directory> GetDirectoryDependencies(TestProcess process)
{
return process.Directories != null ?
ReadOnlyArray<Directory>.FromWithoutCopy(process.Directories) :
ReadOnlyArray<Directory>.Empty;
}
protected override ReadOnlyArray<FileId> GetFileDependencies(TestProcess process)
{
return process.Dependencies != null ?
ReadOnlyArray<FileId>.FromWithoutCopy(process.Dependencies) :
ReadOnlyArray<FileId>.Empty;
}
protected override PathId GetPath(FileId file)
{
return file;
}
protected override PipType GetPipType(NodeId node)
{
return PipTypes[node.Value];
}
protected override TestProcess GetProcess(NodeId node)
{
return Processes[node.Value] ?? DummyProcess;
}
protected override Directory GetSealDirectoryArtifact(NodeId node)
{
Directory result = null;
SealDirectories.TryGetValue(node, out result);
return result;
}
protected override ReadOnlyArray<FileId> ListSealedDirectoryContents(Directory directory)
{
return ReadOnlyArray<FileId>.FromWithoutCopy(directory.Dependencies ?? new FileId[0]);
}
public void ComputeAndValidate(NodeId[] explicitlyScheduledNodes, NodeId[] expectedNodes, ForceSkipDependenciesMode forceSkipDepsMode = ForceSkipDependenciesMode.Always, bool scheduleDependents = false)
{
var scheduledNodesResult = GetNodesToSchedule(scheduleDependents, explicitlyScheduledNodes, forceSkipDepsMode, scheduleMetaPips: false);
// Transform to array index to align with indices when nodes are created into an array
Assert.Equal(NormalizeNodes(expectedNodes), NormalizeNodes(scheduledNodesResult.ScheduledNodes));
}
private RangedNodeSet GetNodeSet(IEnumerable<NodeId> nodes)
{
var nodeSet = new RangedNodeSet();
nodeSet.ClearAndSetRange(m_graph.NodeRange);
foreach (var node in nodes)
{
nodeSet.Add(node);
}
return nodeSet;
}
private uint[] NormalizeNodes(IEnumerable<NodeId> nodes)
{
return nodes.Select(n => n.Value - 1).Distinct().OrderBy(id => id).ToArray();
}
protected override bool IsFileRequiredToExist(int file)
{
// For testing purposes, require all files to exist
return true;
}
protected override int GetCopyFile(NodeId node)
{
return CopyFiles[node];
}
protected override ModuleId GetModuleId(NodeId node)
{
return ModuleIds[node.Value];
}
protected override NodeId GetProducer(int file)
{
return Producers[file];
}
protected override NodeId GetProducer(Directory directory)
{
foreach (var entry in SealDirectories)
{
if (entry.Value == directory)
{
return entry.Key;
}
}
return NodeId.Invalid;
}
protected override bool IsDynamicKindDirectory(NodeId node)
{
var dir = SealDirectories[node];
return SealDirectoryKinds[dir].Item1.IsDynamicKind();
}
protected override SealDirectoryKind GetSealedDirectoryKind(NodeId node)
{
if (SealDirectories.TryGetValue(node, out var dir))
{
return SealDirectoryKinds[dir].Item1;
}
return default(SealDirectoryKind);
}
protected override string GetModuleName(ModuleId moduleId)
{
return moduleId.Value + string.Empty;
}
protected override string GetPathString(FileId file)
{
return GetPath(file) + string.Empty;
}
}
private class FileSetBase
{
public FileId[] Dependencies;
}
private class TestProcess : FileSetBase
{
public Directory[] Directories;
}
private class Directory : FileSetBase
{
public Directory(FileId[] content = null)
{
Dependencies = content;
}
}
}
}
|
using System;
using System.Linq;
using Lamar.Util;
namespace Lamar.Codegen.Variables
{
public class ValueTypeReturnVariable : Variable
{
private readonly Variable[] _inner;
public ValueTypeReturnVariable(Type returnType, Variable[] inner) : base(returnType)
{
_inner = inner;
}
public override string Usage => "(" + _inner.Select(x => $"var {x.Usage}").Join(", ") + ")";
}
} |
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using AdventOfCode.IntCodeComputer;
namespace AdventOfCode._5
{
public class Five : BaseRunnable
{
private readonly int _input;
public Five(int input)
{
_input = input;
}
public Five() : this(1)
{
}
public override string Run(StreamReader reader)
{
var data = Parse(reader);
var input = new BlockingCollection<IntCodeValue>
{
IntCodeValue.FromInt(_input)
};
var program = CreateIntCodeProgram(input);
program.Compute(data);
var output = program.Output;
var outputCodes = output.ToArray();
if (outputCodes.SkipLast(1).Any(code => code != IntCodeValue.FromInt(0)))
{
throw new InvalidOperationException("Found non zero output code.");
}
if (!outputCodes.Any())
{
return "null";
}
return outputCodes.Last().ToString();
}
protected virtual IIntCodeProgram CreateIntCodeProgram(BlockingCollection<IntCodeValue> input)
{
return IntCodeProgram.New(input, new BlockingCollection<IntCodeValue>());
}
private int[] Parse(StreamReader reader)
{
var text = reader.ReadToEnd();
return text.Split(",").Select(int.Parse).ToArray();
}
}
} |
using AutoMapper;
using Hmcr.Api.Authentication;
using Hmcr.Api.Authorization;
using Hmcr.Data.Database;
using Hmcr.Data.Database.Entities;
using Hmcr.Data.Mappings;
using Hmcr.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using NetCore.AutoRegisterDi;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using Hmcr.Model.JsonConverters;
using Hmcr.Domain.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Configuration;
namespace Hmcr.Api.Extensions
{
public static class IServiceCollectionExtensions
{
public static void AddHmcrApiVersioning(this IServiceCollection services)
{
services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.AssumeDefaultVersionWhenUnspecified = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
options.ApiVersionReader = new HeaderApiVersionReader("version");
options.ApiVersionSelector = new CurrentImplementationApiVersionSelector(options);
});
}
public static void AddHmcrControllers(this IServiceCollection services)
{
services
.AddControllers(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
})
.ConfigureApiBehaviorOptions(setupAction =>
{
setupAction.InvalidModelStateResponseFactory = ValidationUtils.GetValidationErrorResult;
})
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
options.JsonSerializerOptions.WriteIndented = true;
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
options.JsonSerializerOptions.Converters.Add(new LongToStringConverter());
options.JsonSerializerOptions.Converters.Add(new IntToStringConverter());
})
//.AddNewtonsoftJson(options =>
//{
// options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// options.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
// options.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat;
// options.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
// options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
//})
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
}
public static void AddHmcrDbContext(this IServiceCollection services, string connectionString)
{
services.AddDbContext<AppDbContext>(options => options.UseSqlServer(connectionString));
}
public static void AddHmcrAutoMapper(this IServiceCollection services)
{
var mappingConfig = new MapperConfiguration(cfg =>
{
cfg.AddProfile(new EntityToModelProfile());
cfg.AddProfile(new ModelToEntityProfile());
});
var mapper = mappingConfig.CreateMapper();
services.AddSingleton(mapper);
}
//public static void AddHmcrAuthentication(this IServiceCollection services, IConfiguration config)
//{
// services.AddAuthentication(options =>
// {
// options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
// options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
// })
// .AddJwtBearer(options =>
// {
// options.Authority = config.GetValue<string>("JWT_AUTHORITY");
// options.Audience = config.GetValue<string>("JWT_AUDIENCE");
// options.RequireHttpsMetadata = false;
// options.IncludeErrorDetails = true;
// options.EventsType = typeof(HmcrJwtBearerEvents);
// });
//}
public static void AddHmcrAuthentication(this IServiceCollection services, IConfiguration config = null)
{
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = SmAuthenticationOptions.Scheme;
options.DefaultChallengeScheme = SmAuthenticationOptions.Scheme;
})
.AddScheme<SmAuthenticationOptions, SmAuthenticationHandler>(SmAuthenticationOptions.Scheme, null);
}
public static void AddHmcrSwagger(this IServiceCollection services, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "HMCR REST API",
Description = "Highway Maintenance Contract Reporting System"
});
});
}
}
public static void AddHmcrTypes(this IServiceCollection services)
{
var assemblies = Assembly.GetExecutingAssembly()
.GetReferencedAssemblies()
.Where(a => a.FullName.StartsWith("Hmcr"))
.Select(Assembly.Load).ToArray();
//Services
services.RegisterAssemblyPublicNonGenericClasses(assemblies)
.Where(c => c.Name.EndsWith("Service"))
.AsPublicImplementedInterfaces(ServiceLifetime.Scoped);
//Repository
services.RegisterAssemblyPublicNonGenericClasses(assemblies)
.Where(c => c.Name.EndsWith("Repository"))
.AsPublicImplementedInterfaces(ServiceLifetime.Scoped);
//Unit of Work
services.AddScoped<IUnitOfWork, UnitOfWork>();
//SmHeaders
services.AddScoped<HmcrCurrentUser, HmcrCurrentUser>();
//Permission Handler
services.AddSingleton<IAuthorizationHandler, PermissionHandler>();
//FieldValidationService as Singleton
services.AddSingleton<IFieldValidatorService, FieldValidatorService>();
//Jwt Bearer Handler
services.AddScoped<HmcrJwtBearerEvents>();
}
}
}
|
/* Copyright (c) 1996-2019 The OPC Foundation. All rights reserved.
The source code in this file is covered under a dual-license scenario:
- RCL: for OPC Foundation members in good-standing
- GPL V2: everybody else
RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/
GNU General Public License as published by the Free Software Foundation;
version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2
This source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace Opc.Ua.Gds.Client
{
partial class RegisterApplicationControl
{
/// <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 Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.RegistrationPanel = new System.Windows.Forms.Panel();
this.RegistrationDetailsPanel = new System.Windows.Forms.TableLayoutPanel();
this.HttpsCertificatePrivateKeyPathButton = new System.Windows.Forms.Button();
this.HttpsCertificatePublicKeyPathButton = new System.Windows.Forms.Button();
this.HttpsCertificatePrivateKeyPathTextBox = new System.Windows.Forms.TextBox();
this.HttpsCertificatePublicKeyPathTextBox = new System.Windows.Forms.TextBox();
this.HttpsCertificatePrivateKeyPathLabel = new System.Windows.Forms.Label();
this.HttpsCertificatePublicKeyPathLabel = new System.Windows.Forms.Label();
this.HttpsIssuerListStorePathButton = new System.Windows.Forms.Button();
this.HttpsIssuerListStorePathTextBox = new System.Windows.Forms.TextBox();
this.HttpsIssuerListStorePathLabel = new System.Windows.Forms.Label();
this.HttpsTrustListStorePathButton = new System.Windows.Forms.Button();
this.HttpsTrustListStorePathTextBox = new System.Windows.Forms.TextBox();
this.HttpsTrustListStorePathLabel = new System.Windows.Forms.Label();
this.DiscoveryUrlsButton = new System.Windows.Forms.Button();
this.DiscoveryUrlsTextBox = new System.Windows.Forms.Label();
this.DiscoveryUrlsLabel = new System.Windows.Forms.Label();
this.ServerCapabilitiesTextBox = new System.Windows.Forms.Label();
this.ServerCapabilitiesButton = new System.Windows.Forms.Button();
this.ServerCapabilitiesLabel = new System.Windows.Forms.Label();
this.ApplicationIdTextBox = new System.Windows.Forms.Label();
this.ApplicationIdLabel = new System.Windows.Forms.Label();
this.IssuerListStorePathButton = new System.Windows.Forms.Button();
this.CertificateSubjectNameTextBox = new System.Windows.Forms.TextBox();
this.CertificateSubjectNameLabel = new System.Windows.Forms.Label();
this.IssuerListStorePathTextBox = new System.Windows.Forms.TextBox();
this.IssuerListStorePathLabel = new System.Windows.Forms.Label();
this.TrustListStorePathTextBox = new System.Windows.Forms.TextBox();
this.TrustListStorePathLabel = new System.Windows.Forms.Label();
this.ProductUriTextBox = new System.Windows.Forms.TextBox();
this.ProductUriLabel = new System.Windows.Forms.Label();
this.ApplicationUriTextBox = new System.Windows.Forms.TextBox();
this.ApplicationUriLabel = new System.Windows.Forms.Label();
this.ApplicationNameTextBox = new System.Windows.Forms.TextBox();
this.ApplicationNameLabel = new System.Windows.Forms.Label();
this.CertificatePrivateKeyPathTextBox = new System.Windows.Forms.TextBox();
this.CertificatePrivateKeyPathLabel = new System.Windows.Forms.Label();
this.CertificatePublicKeyPathTextBox = new System.Windows.Forms.TextBox();
this.CertificatePublicKeyPathLabel = new System.Windows.Forms.Label();
this.CertificateStorePathTextBox = new System.Windows.Forms.TextBox();
this.CertificateStorePathLabel = new System.Windows.Forms.Label();
this.ConfigurationFileTextBox = new System.Windows.Forms.TextBox();
this.ConfigurationFileLabel = new System.Windows.Forms.Label();
this.RegistrationTypeLabel = new System.Windows.Forms.Label();
this.RegistrationTypeComboBox = new System.Windows.Forms.ComboBox();
this.CertificateStorePathButton = new System.Windows.Forms.Button();
this.ConfigurationFileButton = new System.Windows.Forms.Button();
this.CertificatePrivateKeyPathButton = new System.Windows.Forms.Button();
this.CertificatePublicKeyPathButton = new System.Windows.Forms.Button();
this.TrustListStorePathButton = new System.Windows.Forms.Button();
this.RegistrationButtonsPanel = new System.Windows.Forms.Panel();
this.PickServerButton = new System.Windows.Forms.Button();
this.ClearButton = new System.Windows.Forms.Button();
this.OpenConfigurationButton = new System.Windows.Forms.Button();
this.LoadButton = new System.Windows.Forms.Button();
this.SaveButton = new System.Windows.Forms.Button();
this.UnregisterApplicationButton = new System.Windows.Forms.Button();
this.RegisterApplicationButton = new System.Windows.Forms.Button();
this.ApplyChangesButton = new System.Windows.Forms.Button();
this.ToolTip = new System.Windows.Forms.ToolTip(this.components);
this.DomainsLabel = new System.Windows.Forms.Label();
this.DomainsTextBox = new System.Windows.Forms.TextBox();
this.RegistrationPanel.SuspendLayout();
this.RegistrationDetailsPanel.SuspendLayout();
this.RegistrationButtonsPanel.SuspendLayout();
this.SuspendLayout();
//
// RegistrationPanel
//
this.RegistrationPanel.Controls.Add(this.RegistrationDetailsPanel);
this.RegistrationPanel.Controls.Add(this.RegistrationButtonsPanel);
this.RegistrationPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.RegistrationPanel.Location = new System.Drawing.Point(0, 0);
this.RegistrationPanel.Margin = new System.Windows.Forms.Padding(4);
this.RegistrationPanel.Name = "RegistrationPanel";
this.RegistrationPanel.Size = new System.Drawing.Size(1172, 633);
this.RegistrationPanel.TabIndex = 50;
//
// RegistrationDetailsPanel
//
this.RegistrationDetailsPanel.ColumnCount = 3;
this.RegistrationDetailsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.RegistrationDetailsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.RegistrationDetailsPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.RegistrationDetailsPanel.Controls.Add(this.DomainsTextBox, 1, 22);
this.RegistrationDetailsPanel.Controls.Add(this.DomainsLabel, 0, 22);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePrivateKeyPathButton, 2, 19);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePublicKeyPathButton, 2, 18);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePrivateKeyPathTextBox, 1, 19);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePublicKeyPathTextBox, 1, 18);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePrivateKeyPathLabel, 0, 19);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsCertificatePublicKeyPathLabel, 0, 18);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsIssuerListStorePathButton, 2, 21);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsIssuerListStorePathTextBox, 1, 21);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsIssuerListStorePathLabel, 0, 21);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsTrustListStorePathButton, 2, 20);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsTrustListStorePathTextBox, 1, 20);
this.RegistrationDetailsPanel.Controls.Add(this.HttpsTrustListStorePathLabel, 0, 20);
this.RegistrationDetailsPanel.Controls.Add(this.DiscoveryUrlsButton, 2, 5);
this.RegistrationDetailsPanel.Controls.Add(this.DiscoveryUrlsTextBox, 1, 5);
this.RegistrationDetailsPanel.Controls.Add(this.DiscoveryUrlsLabel, 0, 5);
this.RegistrationDetailsPanel.Controls.Add(this.ServerCapabilitiesTextBox, 1, 6);
this.RegistrationDetailsPanel.Controls.Add(this.ServerCapabilitiesButton, 2, 6);
this.RegistrationDetailsPanel.Controls.Add(this.ServerCapabilitiesLabel, 0, 6);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationIdTextBox, 1, 1);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationIdLabel, 0, 1);
this.RegistrationDetailsPanel.Controls.Add(this.IssuerListStorePathButton, 2, 15);
this.RegistrationDetailsPanel.Controls.Add(this.CertificateSubjectNameTextBox, 1, 10);
this.RegistrationDetailsPanel.Controls.Add(this.CertificateSubjectNameLabel, 0, 10);
this.RegistrationDetailsPanel.Controls.Add(this.IssuerListStorePathTextBox, 1, 15);
this.RegistrationDetailsPanel.Controls.Add(this.IssuerListStorePathLabel, 0, 15);
this.RegistrationDetailsPanel.Controls.Add(this.TrustListStorePathTextBox, 1, 14);
this.RegistrationDetailsPanel.Controls.Add(this.TrustListStorePathLabel, 0, 14);
this.RegistrationDetailsPanel.Controls.Add(this.ProductUriTextBox, 1, 4);
this.RegistrationDetailsPanel.Controls.Add(this.ProductUriLabel, 0, 4);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationUriTextBox, 1, 3);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationUriLabel, 0, 3);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationNameTextBox, 1, 2);
this.RegistrationDetailsPanel.Controls.Add(this.ApplicationNameLabel, 0, 2);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePrivateKeyPathTextBox, 1, 12);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePrivateKeyPathLabel, 0, 12);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePublicKeyPathTextBox, 1, 11);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePublicKeyPathLabel, 0, 11);
this.RegistrationDetailsPanel.Controls.Add(this.CertificateStorePathTextBox, 1, 9);
this.RegistrationDetailsPanel.Controls.Add(this.CertificateStorePathLabel, 0, 9);
this.RegistrationDetailsPanel.Controls.Add(this.ConfigurationFileTextBox, 1, 7);
this.RegistrationDetailsPanel.Controls.Add(this.ConfigurationFileLabel, 0, 7);
this.RegistrationDetailsPanel.Controls.Add(this.RegistrationTypeLabel, 0, 0);
this.RegistrationDetailsPanel.Controls.Add(this.RegistrationTypeComboBox, 1, 0);
this.RegistrationDetailsPanel.Controls.Add(this.CertificateStorePathButton, 2, 9);
this.RegistrationDetailsPanel.Controls.Add(this.ConfigurationFileButton, 2, 7);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePrivateKeyPathButton, 2, 12);
this.RegistrationDetailsPanel.Controls.Add(this.CertificatePublicKeyPathButton, 2, 11);
this.RegistrationDetailsPanel.Controls.Add(this.TrustListStorePathButton, 2, 14);
this.RegistrationDetailsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.RegistrationDetailsPanel.Location = new System.Drawing.Point(0, 0);
this.RegistrationDetailsPanel.Margin = new System.Windows.Forms.Padding(4);
this.RegistrationDetailsPanel.Name = "RegistrationDetailsPanel";
this.RegistrationDetailsPanel.Padding = new System.Windows.Forms.Padding(4, 0, 4, 4);
this.RegistrationDetailsPanel.RowCount = 24;
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.RegistrationDetailsPanel.Size = new System.Drawing.Size(1172, 594);
this.RegistrationDetailsPanel.TabIndex = 0;
//
// HttpsCertificatePrivateKeyPathButton
//
this.HttpsCertificatePrivateKeyPathButton.Location = new System.Drawing.Point(1136, 423);
this.HttpsCertificatePrivateKeyPathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.HttpsCertificatePrivateKeyPathButton.Name = "HttpsCertificatePrivateKeyPathButton";
this.HttpsCertificatePrivateKeyPathButton.Size = new System.Drawing.Size(32, 25);
this.HttpsCertificatePrivateKeyPathButton.TabIndex = 58;
this.HttpsCertificatePrivateKeyPathButton.Text = "...";
this.HttpsCertificatePrivateKeyPathButton.UseVisualStyleBackColor = true;
this.HttpsCertificatePrivateKeyPathButton.Click += new System.EventHandler(this.HttpsCertificatePrivateKeyPathButton_Click);
//
// HttpsCertificatePublicKeyPathButton
//
this.HttpsCertificatePublicKeyPathButton.Location = new System.Drawing.Point(1136, 394);
this.HttpsCertificatePublicKeyPathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.HttpsCertificatePublicKeyPathButton.Name = "HttpsCertificatePublicKeyPathButton";
this.HttpsCertificatePublicKeyPathButton.Size = new System.Drawing.Size(32, 25);
this.HttpsCertificatePublicKeyPathButton.TabIndex = 57;
this.HttpsCertificatePublicKeyPathButton.Text = "...";
this.HttpsCertificatePublicKeyPathButton.UseVisualStyleBackColor = true;
this.HttpsCertificatePublicKeyPathButton.Click += new System.EventHandler(this.HttpsCertificatePublicKeyPathButton_Click);
//
// HttpsCertificatePrivateKeyPathTextBox
//
this.HttpsCertificatePrivateKeyPathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsCertificatePrivateKeyPathTextBox.Location = new System.Drawing.Point(243, 423);
this.HttpsCertificatePrivateKeyPathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsCertificatePrivateKeyPathTextBox.Name = "HttpsCertificatePrivateKeyPathTextBox";
this.HttpsCertificatePrivateKeyPathTextBox.Size = new System.Drawing.Size(890, 22);
this.HttpsCertificatePrivateKeyPathTextBox.TabIndex = 56;
this.HttpsCertificatePrivateKeyPathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// HttpsCertificatePublicKeyPathTextBox
//
this.HttpsCertificatePublicKeyPathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsCertificatePublicKeyPathTextBox.Location = new System.Drawing.Point(243, 394);
this.HttpsCertificatePublicKeyPathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsCertificatePublicKeyPathTextBox.Name = "HttpsCertificatePublicKeyPathTextBox";
this.HttpsCertificatePublicKeyPathTextBox.Size = new System.Drawing.Size(890, 22);
this.HttpsCertificatePublicKeyPathTextBox.TabIndex = 55;
this.HttpsCertificatePublicKeyPathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// HttpsCertificatePrivateKeyPathLabel
//
this.HttpsCertificatePrivateKeyPathLabel.AllowDrop = true;
this.HttpsCertificatePrivateKeyPathLabel.AutoSize = true;
this.HttpsCertificatePrivateKeyPathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsCertificatePrivateKeyPathLabel.Location = new System.Drawing.Point(7, 423);
this.HttpsCertificatePrivateKeyPathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsCertificatePrivateKeyPathLabel.Name = "HttpsCertificatePrivateKeyPathLabel";
this.HttpsCertificatePrivateKeyPathLabel.Size = new System.Drawing.Size(230, 25);
this.HttpsCertificatePrivateKeyPathLabel.TabIndex = 53;
this.HttpsCertificatePrivateKeyPathLabel.Text = "HTTPS Certificate Private Key Path";
this.HttpsCertificatePrivateKeyPathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// HttpsCertificatePublicKeyPathLabel
//
this.HttpsCertificatePublicKeyPathLabel.AllowDrop = true;
this.HttpsCertificatePublicKeyPathLabel.AutoSize = true;
this.HttpsCertificatePublicKeyPathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsCertificatePublicKeyPathLabel.Location = new System.Drawing.Point(7, 394);
this.HttpsCertificatePublicKeyPathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsCertificatePublicKeyPathLabel.Name = "HttpsCertificatePublicKeyPathLabel";
this.HttpsCertificatePublicKeyPathLabel.Size = new System.Drawing.Size(230, 25);
this.HttpsCertificatePublicKeyPathLabel.TabIndex = 52;
this.HttpsCertificatePublicKeyPathLabel.Text = "HTTPS Certificate Public Key Path";
this.HttpsCertificatePublicKeyPathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// HttpsIssuerListStorePathButton
//
this.HttpsIssuerListStorePathButton.Location = new System.Drawing.Point(1136, 481);
this.HttpsIssuerListStorePathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.HttpsIssuerListStorePathButton.Name = "HttpsIssuerListStorePathButton";
this.HttpsIssuerListStorePathButton.Size = new System.Drawing.Size(32, 25);
this.HttpsIssuerListStorePathButton.TabIndex = 50;
this.HttpsIssuerListStorePathButton.Text = "...";
this.HttpsIssuerListStorePathButton.UseVisualStyleBackColor = true;
this.HttpsIssuerListStorePathButton.Click += new System.EventHandler(this.HttpsIssuerListStorePathButton_Click);
//
// HttpsIssuerListStorePathTextBox
//
this.HttpsIssuerListStorePathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsIssuerListStorePathTextBox.Location = new System.Drawing.Point(243, 481);
this.HttpsIssuerListStorePathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsIssuerListStorePathTextBox.Name = "HttpsIssuerListStorePathTextBox";
this.HttpsIssuerListStorePathTextBox.Size = new System.Drawing.Size(890, 22);
this.HttpsIssuerListStorePathTextBox.TabIndex = 49;
this.HttpsIssuerListStorePathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// HttpsIssuerListStorePathLabel
//
this.HttpsIssuerListStorePathLabel.AllowDrop = true;
this.HttpsIssuerListStorePathLabel.AutoSize = true;
this.HttpsIssuerListStorePathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsIssuerListStorePathLabel.Location = new System.Drawing.Point(7, 481);
this.HttpsIssuerListStorePathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsIssuerListStorePathLabel.Name = "HttpsIssuerListStorePathLabel";
this.HttpsIssuerListStorePathLabel.Size = new System.Drawing.Size(230, 25);
this.HttpsIssuerListStorePathLabel.TabIndex = 48;
this.HttpsIssuerListStorePathLabel.Text = "HTTPS Issuer List Store Path";
this.HttpsIssuerListStorePathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// HttpsTrustListStorePathButton
//
this.HttpsTrustListStorePathButton.Location = new System.Drawing.Point(1136, 452);
this.HttpsTrustListStorePathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.HttpsTrustListStorePathButton.Name = "HttpsTrustListStorePathButton";
this.HttpsTrustListStorePathButton.Size = new System.Drawing.Size(32, 25);
this.HttpsTrustListStorePathButton.TabIndex = 47;
this.HttpsTrustListStorePathButton.Text = "...";
this.HttpsTrustListStorePathButton.UseVisualStyleBackColor = true;
this.HttpsTrustListStorePathButton.Click += new System.EventHandler(this.HttpsTrustListStorePathButton_Click);
//
// HttpsTrustListStorePathTextBox
//
this.HttpsTrustListStorePathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsTrustListStorePathTextBox.Location = new System.Drawing.Point(243, 452);
this.HttpsTrustListStorePathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsTrustListStorePathTextBox.Name = "HttpsTrustListStorePathTextBox";
this.HttpsTrustListStorePathTextBox.Size = new System.Drawing.Size(890, 22);
this.HttpsTrustListStorePathTextBox.TabIndex = 46;
this.HttpsTrustListStorePathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// HttpsTrustListStorePathLabel
//
this.HttpsTrustListStorePathLabel.AllowDrop = true;
this.HttpsTrustListStorePathLabel.AutoSize = true;
this.HttpsTrustListStorePathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.HttpsTrustListStorePathLabel.Location = new System.Drawing.Point(7, 452);
this.HttpsTrustListStorePathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HttpsTrustListStorePathLabel.Name = "HttpsTrustListStorePathLabel";
this.HttpsTrustListStorePathLabel.Size = new System.Drawing.Size(230, 25);
this.HttpsTrustListStorePathLabel.TabIndex = 45;
this.HttpsTrustListStorePathLabel.Text = "HTTPS Trust List Store Path";
this.HttpsTrustListStorePathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// DiscoveryUrlsButton
//
this.DiscoveryUrlsButton.Location = new System.Drawing.Point(1136, 136);
this.DiscoveryUrlsButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.DiscoveryUrlsButton.Name = "DiscoveryUrlsButton";
this.DiscoveryUrlsButton.Size = new System.Drawing.Size(32, 25);
this.DiscoveryUrlsButton.TabIndex = 44;
this.DiscoveryUrlsButton.Text = "...";
this.DiscoveryUrlsButton.UseVisualStyleBackColor = true;
this.DiscoveryUrlsButton.Click += new System.EventHandler(this.DiscoveryUrlsButton_Click);
//
// DiscoveryUrlsTextBox
//
this.DiscoveryUrlsTextBox.AllowDrop = true;
this.DiscoveryUrlsTextBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.DiscoveryUrlsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiscoveryUrlsTextBox.Location = new System.Drawing.Point(243, 136);
this.DiscoveryUrlsTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DiscoveryUrlsTextBox.Name = "DiscoveryUrlsTextBox";
this.DiscoveryUrlsTextBox.Size = new System.Drawing.Size(890, 25);
this.DiscoveryUrlsTextBox.TabIndex = 43;
this.DiscoveryUrlsTextBox.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.DiscoveryUrlsTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// DiscoveryUrlsLabel
//
this.DiscoveryUrlsLabel.AllowDrop = true;
this.DiscoveryUrlsLabel.AutoSize = true;
this.DiscoveryUrlsLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiscoveryUrlsLabel.Location = new System.Drawing.Point(7, 136);
this.DiscoveryUrlsLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DiscoveryUrlsLabel.Name = "DiscoveryUrlsLabel";
this.DiscoveryUrlsLabel.Size = new System.Drawing.Size(230, 25);
this.DiscoveryUrlsLabel.TabIndex = 42;
this.DiscoveryUrlsLabel.Text = "Discovery URLs";
this.DiscoveryUrlsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ServerCapabilitiesTextBox
//
this.ServerCapabilitiesTextBox.AllowDrop = true;
this.ServerCapabilitiesTextBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ServerCapabilitiesTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerCapabilitiesTextBox.Location = new System.Drawing.Point(243, 165);
this.ServerCapabilitiesTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ServerCapabilitiesTextBox.Name = "ServerCapabilitiesTextBox";
this.ServerCapabilitiesTextBox.Size = new System.Drawing.Size(890, 25);
this.ServerCapabilitiesTextBox.TabIndex = 38;
this.ServerCapabilitiesTextBox.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ServerCapabilitiesTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// ServerCapabilitiesButton
//
this.ServerCapabilitiesButton.Location = new System.Drawing.Point(1136, 165);
this.ServerCapabilitiesButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.ServerCapabilitiesButton.Name = "ServerCapabilitiesButton";
this.ServerCapabilitiesButton.Size = new System.Drawing.Size(32, 25);
this.ServerCapabilitiesButton.TabIndex = 37;
this.ServerCapabilitiesButton.Text = "...";
this.ServerCapabilitiesButton.UseVisualStyleBackColor = true;
this.ServerCapabilitiesButton.Click += new System.EventHandler(this.ServerCapabilitiesButton_Click);
//
// ServerCapabilitiesLabel
//
this.ServerCapabilitiesLabel.AllowDrop = true;
this.ServerCapabilitiesLabel.AutoSize = true;
this.ServerCapabilitiesLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerCapabilitiesLabel.Location = new System.Drawing.Point(7, 165);
this.ServerCapabilitiesLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ServerCapabilitiesLabel.Name = "ServerCapabilitiesLabel";
this.ServerCapabilitiesLabel.Size = new System.Drawing.Size(230, 25);
this.ServerCapabilitiesLabel.TabIndex = 36;
this.ServerCapabilitiesLabel.Text = "Server Capabilities";
this.ServerCapabilitiesLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ApplicationIdTextBox
//
this.ApplicationIdTextBox.AllowDrop = true;
this.ApplicationIdTextBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.ApplicationIdTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationIdTextBox.Location = new System.Drawing.Point(243, 29);
this.ApplicationIdTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationIdTextBox.Name = "ApplicationIdTextBox";
this.ApplicationIdTextBox.Size = new System.Drawing.Size(890, 25);
this.ApplicationIdTextBox.TabIndex = 34;
this.ApplicationIdTextBox.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ApplicationIdLabel
//
this.ApplicationIdLabel.AllowDrop = true;
this.ApplicationIdLabel.AutoSize = true;
this.ApplicationIdLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationIdLabel.Location = new System.Drawing.Point(7, 29);
this.ApplicationIdLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationIdLabel.Name = "ApplicationIdLabel";
this.ApplicationIdLabel.Size = new System.Drawing.Size(230, 25);
this.ApplicationIdLabel.TabIndex = 33;
this.ApplicationIdLabel.Text = "Application ID";
this.ApplicationIdLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// IssuerListStorePathButton
//
this.IssuerListStorePathButton.Location = new System.Drawing.Point(1136, 365);
this.IssuerListStorePathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.IssuerListStorePathButton.Name = "IssuerListStorePathButton";
this.IssuerListStorePathButton.Size = new System.Drawing.Size(32, 25);
this.IssuerListStorePathButton.TabIndex = 31;
this.IssuerListStorePathButton.Text = "...";
this.IssuerListStorePathButton.UseVisualStyleBackColor = true;
this.IssuerListStorePathButton.Click += new System.EventHandler(this.IssuerListStorePathButton_Click);
//
// CertificateSubjectNameTextBox
//
this.CertificateSubjectNameTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificateSubjectNameTextBox.Location = new System.Drawing.Point(243, 252);
this.CertificateSubjectNameTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificateSubjectNameTextBox.Name = "CertificateSubjectNameTextBox";
this.CertificateSubjectNameTextBox.Size = new System.Drawing.Size(890, 22);
this.CertificateSubjectNameTextBox.TabIndex = 18;
this.CertificateSubjectNameTextBox.TextChanged += new System.EventHandler(this.CertificateLocation_TextChanged);
//
// CertificateSubjectNameLabel
//
this.CertificateSubjectNameLabel.AllowDrop = true;
this.CertificateSubjectNameLabel.AutoSize = true;
this.CertificateSubjectNameLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificateSubjectNameLabel.Location = new System.Drawing.Point(7, 252);
this.CertificateSubjectNameLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificateSubjectNameLabel.Name = "CertificateSubjectNameLabel";
this.CertificateSubjectNameLabel.Size = new System.Drawing.Size(230, 22);
this.CertificateSubjectNameLabel.TabIndex = 17;
this.CertificateSubjectNameLabel.Text = "Certificate Subject Name";
this.CertificateSubjectNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// IssuerListStorePathTextBox
//
this.IssuerListStorePathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.IssuerListStorePathTextBox.Location = new System.Drawing.Point(243, 365);
this.IssuerListStorePathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.IssuerListStorePathTextBox.Name = "IssuerListStorePathTextBox";
this.IssuerListStorePathTextBox.Size = new System.Drawing.Size(890, 22);
this.IssuerListStorePathTextBox.TabIndex = 30;
this.IssuerListStorePathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// IssuerListStorePathLabel
//
this.IssuerListStorePathLabel.AllowDrop = true;
this.IssuerListStorePathLabel.AutoSize = true;
this.IssuerListStorePathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.IssuerListStorePathLabel.Location = new System.Drawing.Point(7, 365);
this.IssuerListStorePathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.IssuerListStorePathLabel.Name = "IssuerListStorePathLabel";
this.IssuerListStorePathLabel.Size = new System.Drawing.Size(230, 25);
this.IssuerListStorePathLabel.TabIndex = 29;
this.IssuerListStorePathLabel.Text = "Issuer List Store Path";
this.IssuerListStorePathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// TrustListStorePathTextBox
//
this.TrustListStorePathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.TrustListStorePathTextBox.Location = new System.Drawing.Point(243, 336);
this.TrustListStorePathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.TrustListStorePathTextBox.Name = "TrustListStorePathTextBox";
this.TrustListStorePathTextBox.Size = new System.Drawing.Size(890, 22);
this.TrustListStorePathTextBox.TabIndex = 28;
this.TrustListStorePathTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// TrustListStorePathLabel
//
this.TrustListStorePathLabel.AllowDrop = true;
this.TrustListStorePathLabel.AutoSize = true;
this.TrustListStorePathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.TrustListStorePathLabel.Location = new System.Drawing.Point(7, 336);
this.TrustListStorePathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.TrustListStorePathLabel.Name = "TrustListStorePathLabel";
this.TrustListStorePathLabel.Size = new System.Drawing.Size(230, 25);
this.TrustListStorePathLabel.TabIndex = 27;
this.TrustListStorePathLabel.Text = "Trust List Store Path";
this.TrustListStorePathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ProductUriTextBox
//
this.ProductUriTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProductUriTextBox.Location = new System.Drawing.Point(243, 110);
this.ProductUriTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ProductUriTextBox.Name = "ProductUriTextBox";
this.ProductUriTextBox.Size = new System.Drawing.Size(890, 22);
this.ProductUriTextBox.TabIndex = 13;
this.ProductUriTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// ProductUriLabel
//
this.ProductUriLabel.AllowDrop = true;
this.ProductUriLabel.AutoSize = true;
this.ProductUriLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProductUriLabel.Location = new System.Drawing.Point(7, 110);
this.ProductUriLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ProductUriLabel.Name = "ProductUriLabel";
this.ProductUriLabel.Size = new System.Drawing.Size(230, 22);
this.ProductUriLabel.TabIndex = 12;
this.ProductUriLabel.Text = "Product URI";
this.ProductUriLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ApplicationUriTextBox
//
this.ApplicationUriTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationUriTextBox.Location = new System.Drawing.Point(243, 84);
this.ApplicationUriTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationUriTextBox.Name = "ApplicationUriTextBox";
this.ApplicationUriTextBox.Size = new System.Drawing.Size(890, 22);
this.ApplicationUriTextBox.TabIndex = 11;
this.ApplicationUriTextBox.TextChanged += new System.EventHandler(this.ApplicationUriTextBox_TextChanged);
//
// ApplicationUriLabel
//
this.ApplicationUriLabel.AllowDrop = true;
this.ApplicationUriLabel.AutoSize = true;
this.ApplicationUriLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationUriLabel.Location = new System.Drawing.Point(7, 84);
this.ApplicationUriLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationUriLabel.Name = "ApplicationUriLabel";
this.ApplicationUriLabel.Size = new System.Drawing.Size(230, 22);
this.ApplicationUriLabel.TabIndex = 10;
this.ApplicationUriLabel.Text = "Application URI";
this.ApplicationUriLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ApplicationNameTextBox
//
this.ApplicationNameTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationNameTextBox.Location = new System.Drawing.Point(243, 58);
this.ApplicationNameTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationNameTextBox.Name = "ApplicationNameTextBox";
this.ApplicationNameTextBox.Size = new System.Drawing.Size(890, 22);
this.ApplicationNameTextBox.TabIndex = 9;
this.ApplicationNameTextBox.TextChanged += new System.EventHandler(this.GenericField_TextChanged);
//
// ApplicationNameLabel
//
this.ApplicationNameLabel.AllowDrop = true;
this.ApplicationNameLabel.AutoSize = true;
this.ApplicationNameLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ApplicationNameLabel.Location = new System.Drawing.Point(7, 58);
this.ApplicationNameLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ApplicationNameLabel.Name = "ApplicationNameLabel";
this.ApplicationNameLabel.Size = new System.Drawing.Size(230, 22);
this.ApplicationNameLabel.TabIndex = 8;
this.ApplicationNameLabel.Text = "Application Name";
this.ApplicationNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// CertificatePrivateKeyPathTextBox
//
this.CertificatePrivateKeyPathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificatePrivateKeyPathTextBox.Location = new System.Drawing.Point(243, 307);
this.CertificatePrivateKeyPathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificatePrivateKeyPathTextBox.Name = "CertificatePrivateKeyPathTextBox";
this.CertificatePrivateKeyPathTextBox.Size = new System.Drawing.Size(890, 22);
this.CertificatePrivateKeyPathTextBox.TabIndex = 23;
this.CertificatePrivateKeyPathTextBox.TextChanged += new System.EventHandler(this.CertificateLocation_TextChanged);
//
// CertificatePrivateKeyPathLabel
//
this.CertificatePrivateKeyPathLabel.AllowDrop = true;
this.CertificatePrivateKeyPathLabel.AutoSize = true;
this.CertificatePrivateKeyPathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificatePrivateKeyPathLabel.Location = new System.Drawing.Point(7, 307);
this.CertificatePrivateKeyPathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificatePrivateKeyPathLabel.Name = "CertificatePrivateKeyPathLabel";
this.CertificatePrivateKeyPathLabel.Size = new System.Drawing.Size(230, 25);
this.CertificatePrivateKeyPathLabel.TabIndex = 22;
this.CertificatePrivateKeyPathLabel.Text = "Certificate Private Key Path";
this.CertificatePrivateKeyPathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// CertificatePublicKeyPathTextBox
//
this.CertificatePublicKeyPathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificatePublicKeyPathTextBox.Location = new System.Drawing.Point(243, 278);
this.CertificatePublicKeyPathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificatePublicKeyPathTextBox.Name = "CertificatePublicKeyPathTextBox";
this.CertificatePublicKeyPathTextBox.Size = new System.Drawing.Size(890, 22);
this.CertificatePublicKeyPathTextBox.TabIndex = 20;
this.CertificatePublicKeyPathTextBox.TextChanged += new System.EventHandler(this.CertificateLocation_TextChanged);
//
// CertificatePublicKeyPathLabel
//
this.CertificatePublicKeyPathLabel.AllowDrop = true;
this.CertificatePublicKeyPathLabel.AutoSize = true;
this.CertificatePublicKeyPathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificatePublicKeyPathLabel.Location = new System.Drawing.Point(7, 278);
this.CertificatePublicKeyPathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificatePublicKeyPathLabel.Name = "CertificatePublicKeyPathLabel";
this.CertificatePublicKeyPathLabel.Size = new System.Drawing.Size(230, 25);
this.CertificatePublicKeyPathLabel.TabIndex = 19;
this.CertificatePublicKeyPathLabel.Text = "Certificate Public Key Path";
this.CertificatePublicKeyPathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// CertificateStorePathTextBox
//
this.CertificateStorePathTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificateStorePathTextBox.Location = new System.Drawing.Point(243, 223);
this.CertificateStorePathTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificateStorePathTextBox.Name = "CertificateStorePathTextBox";
this.CertificateStorePathTextBox.Size = new System.Drawing.Size(890, 22);
this.CertificateStorePathTextBox.TabIndex = 15;
this.CertificateStorePathTextBox.TextChanged += new System.EventHandler(this.CertificateLocation_TextChanged);
//
// CertificateStorePathLabel
//
this.CertificateStorePathLabel.AllowDrop = true;
this.CertificateStorePathLabel.AutoSize = true;
this.CertificateStorePathLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.CertificateStorePathLabel.Location = new System.Drawing.Point(7, 223);
this.CertificateStorePathLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CertificateStorePathLabel.Name = "CertificateStorePathLabel";
this.CertificateStorePathLabel.Size = new System.Drawing.Size(230, 25);
this.CertificateStorePathLabel.TabIndex = 14;
this.CertificateStorePathLabel.Text = "Certificate Store Path";
this.CertificateStorePathLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ConfigurationFileTextBox
//
this.ConfigurationFileTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ConfigurationFileTextBox.Location = new System.Drawing.Point(243, 194);
this.ConfigurationFileTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ConfigurationFileTextBox.Name = "ConfigurationFileTextBox";
this.ConfigurationFileTextBox.Size = new System.Drawing.Size(890, 22);
this.ConfigurationFileTextBox.TabIndex = 3;
this.ConfigurationFileTextBox.TextChanged += new System.EventHandler(this.ConfigurationFileTextBox_TextChanged);
//
// ConfigurationFileLabel
//
this.ConfigurationFileLabel.AllowDrop = true;
this.ConfigurationFileLabel.AutoSize = true;
this.ConfigurationFileLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ConfigurationFileLabel.Location = new System.Drawing.Point(7, 194);
this.ConfigurationFileLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.ConfigurationFileLabel.Name = "ConfigurationFileLabel";
this.ConfigurationFileLabel.Size = new System.Drawing.Size(230, 25);
this.ConfigurationFileLabel.TabIndex = 2;
this.ConfigurationFileLabel.Text = "Configuration File";
this.ConfigurationFileLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// RegistrationTypeLabel
//
this.RegistrationTypeLabel.AllowDrop = true;
this.RegistrationTypeLabel.AutoSize = true;
this.RegistrationTypeLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.RegistrationTypeLabel.Location = new System.Drawing.Point(7, 2);
this.RegistrationTypeLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.RegistrationTypeLabel.Name = "RegistrationTypeLabel";
this.RegistrationTypeLabel.Size = new System.Drawing.Size(230, 23);
this.RegistrationTypeLabel.TabIndex = 0;
this.RegistrationTypeLabel.Text = "Registration Type";
this.RegistrationTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// RegistrationTypeComboBox
//
this.RegistrationTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.RegistrationTypeComboBox.FormattingEnabled = true;
this.RegistrationTypeComboBox.Location = new System.Drawing.Point(243, 2);
this.RegistrationTypeComboBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 1);
this.RegistrationTypeComboBox.Name = "RegistrationTypeComboBox";
this.RegistrationTypeComboBox.Size = new System.Drawing.Size(244, 24);
this.RegistrationTypeComboBox.TabIndex = 1;
this.RegistrationTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.RegistrationTypeComboBox_SelectedIndexChanged);
//
// CertificateStorePathButton
//
this.CertificateStorePathButton.Location = new System.Drawing.Point(1136, 223);
this.CertificateStorePathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.CertificateStorePathButton.Name = "CertificateStorePathButton";
this.CertificateStorePathButton.Size = new System.Drawing.Size(32, 25);
this.CertificateStorePathButton.TabIndex = 16;
this.CertificateStorePathButton.Text = "...";
this.CertificateStorePathButton.UseVisualStyleBackColor = true;
this.CertificateStorePathButton.Click += new System.EventHandler(this.CertificateStorePathButton_Click);
//
// ConfigurationFileButton
//
this.ConfigurationFileButton.Location = new System.Drawing.Point(1136, 194);
this.ConfigurationFileButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.ConfigurationFileButton.Name = "ConfigurationFileButton";
this.ConfigurationFileButton.Size = new System.Drawing.Size(32, 25);
this.ConfigurationFileButton.TabIndex = 4;
this.ConfigurationFileButton.Text = "...";
this.ConfigurationFileButton.UseVisualStyleBackColor = true;
this.ConfigurationFileButton.Click += new System.EventHandler(this.ConfigurationFileButton_Click);
//
// CertificatePrivateKeyPathButton
//
this.CertificatePrivateKeyPathButton.Location = new System.Drawing.Point(1136, 307);
this.CertificatePrivateKeyPathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.CertificatePrivateKeyPathButton.Name = "CertificatePrivateKeyPathButton";
this.CertificatePrivateKeyPathButton.Size = new System.Drawing.Size(32, 25);
this.CertificatePrivateKeyPathButton.TabIndex = 24;
this.CertificatePrivateKeyPathButton.Text = "...";
this.CertificatePrivateKeyPathButton.UseVisualStyleBackColor = true;
this.CertificatePrivateKeyPathButton.Click += new System.EventHandler(this.CertificatePrivateKeyPathButton_Click);
//
// CertificatePublicKeyPathButton
//
this.CertificatePublicKeyPathButton.Location = new System.Drawing.Point(1136, 278);
this.CertificatePublicKeyPathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.CertificatePublicKeyPathButton.Name = "CertificatePublicKeyPathButton";
this.CertificatePublicKeyPathButton.Size = new System.Drawing.Size(32, 25);
this.CertificatePublicKeyPathButton.TabIndex = 21;
this.CertificatePublicKeyPathButton.Text = "...";
this.CertificatePublicKeyPathButton.UseVisualStyleBackColor = true;
this.CertificatePublicKeyPathButton.Click += new System.EventHandler(this.CertificatePublicKeyPathButton_Click);
//
// TrustListStorePathButton
//
this.TrustListStorePathButton.Location = new System.Drawing.Point(1136, 336);
this.TrustListStorePathButton.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2);
this.TrustListStorePathButton.Name = "TrustListStorePathButton";
this.TrustListStorePathButton.Size = new System.Drawing.Size(32, 25);
this.TrustListStorePathButton.TabIndex = 32;
this.TrustListStorePathButton.Text = "...";
this.TrustListStorePathButton.UseVisualStyleBackColor = true;
this.TrustListStorePathButton.Click += new System.EventHandler(this.TrustListStorePathButton_Click);
//
// RegistrationButtonsPanel
//
this.RegistrationButtonsPanel.BackColor = System.Drawing.Color.MidnightBlue;
this.RegistrationButtonsPanel.Controls.Add(this.PickServerButton);
this.RegistrationButtonsPanel.Controls.Add(this.ClearButton);
this.RegistrationButtonsPanel.Controls.Add(this.OpenConfigurationButton);
this.RegistrationButtonsPanel.Controls.Add(this.LoadButton);
this.RegistrationButtonsPanel.Controls.Add(this.SaveButton);
this.RegistrationButtonsPanel.Controls.Add(this.UnregisterApplicationButton);
this.RegistrationButtonsPanel.Controls.Add(this.RegisterApplicationButton);
this.RegistrationButtonsPanel.Controls.Add(this.ApplyChangesButton);
this.RegistrationButtonsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.RegistrationButtonsPanel.Location = new System.Drawing.Point(0, 594);
this.RegistrationButtonsPanel.Margin = new System.Windows.Forms.Padding(4);
this.RegistrationButtonsPanel.Name = "RegistrationButtonsPanel";
this.RegistrationButtonsPanel.Size = new System.Drawing.Size(1172, 39);
this.RegistrationButtonsPanel.TabIndex = 13;
//
// PickServerButton
//
this.PickServerButton.BackColor = System.Drawing.Color.MidnightBlue;
this.PickServerButton.Dock = System.Windows.Forms.DockStyle.Left;
this.PickServerButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.PickServerButton.ForeColor = System.Drawing.Color.White;
this.PickServerButton.Location = new System.Drawing.Point(1029, 0);
this.PickServerButton.Margin = new System.Windows.Forms.Padding(4);
this.PickServerButton.Name = "PickServerButton";
this.PickServerButton.Size = new System.Drawing.Size(147, 39);
this.PickServerButton.TabIndex = 7;
this.PickServerButton.Text = "Pick Server";
this.ToolTip.SetToolTip(this.PickServerButton, "Clears all fields");
this.PickServerButton.UseVisualStyleBackColor = false;
this.PickServerButton.Click += new System.EventHandler(this.PickServerButton_Click);
//
// ClearButton
//
this.ClearButton.BackColor = System.Drawing.Color.MidnightBlue;
this.ClearButton.Dock = System.Windows.Forms.DockStyle.Left;
this.ClearButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ClearButton.ForeColor = System.Drawing.Color.White;
this.ClearButton.Location = new System.Drawing.Point(882, 0);
this.ClearButton.Margin = new System.Windows.Forms.Padding(4);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(147, 39);
this.ClearButton.TabIndex = 6;
this.ClearButton.Text = "Clear";
this.ToolTip.SetToolTip(this.ClearButton, "Clears all fields");
this.ClearButton.UseVisualStyleBackColor = false;
this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click);
this.ClearButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.ClearButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// OpenConfigurationButton
//
this.OpenConfigurationButton.BackColor = System.Drawing.Color.MidnightBlue;
this.OpenConfigurationButton.Dock = System.Windows.Forms.DockStyle.Left;
this.OpenConfigurationButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.OpenConfigurationButton.ForeColor = System.Drawing.Color.White;
this.OpenConfigurationButton.Location = new System.Drawing.Point(735, 0);
this.OpenConfigurationButton.Margin = new System.Windows.Forms.Padding(4);
this.OpenConfigurationButton.Name = "OpenConfigurationButton";
this.OpenConfigurationButton.Size = new System.Drawing.Size(147, 39);
this.OpenConfigurationButton.TabIndex = 5;
this.OpenConfigurationButton.Text = "Open Config";
this.ToolTip.SetToolTip(this.OpenConfigurationButton, "Launches an external editor to view the contents of the configuration file.");
this.OpenConfigurationButton.UseVisualStyleBackColor = false;
this.OpenConfigurationButton.Click += new System.EventHandler(this.OpenConfigurationButton_Click);
this.OpenConfigurationButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.OpenConfigurationButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// LoadButton
//
this.LoadButton.BackColor = System.Drawing.Color.MidnightBlue;
this.LoadButton.Dock = System.Windows.Forms.DockStyle.Left;
this.LoadButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LoadButton.ForeColor = System.Drawing.Color.White;
this.LoadButton.Location = new System.Drawing.Point(588, 0);
this.LoadButton.Margin = new System.Windows.Forms.Padding(4);
this.LoadButton.Name = "LoadButton";
this.LoadButton.Size = new System.Drawing.Size(147, 39);
this.LoadButton.TabIndex = 4;
this.LoadButton.Text = "Load";
this.ToolTip.SetToolTip(this.LoadButton, "Loads a previously saved registration file.");
this.LoadButton.UseVisualStyleBackColor = false;
this.LoadButton.Click += new System.EventHandler(this.LoadButton_Click);
this.LoadButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.LoadButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// SaveButton
//
this.SaveButton.BackColor = System.Drawing.Color.MidnightBlue;
this.SaveButton.Dock = System.Windows.Forms.DockStyle.Left;
this.SaveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.SaveButton.ForeColor = System.Drawing.Color.White;
this.SaveButton.Location = new System.Drawing.Point(441, 0);
this.SaveButton.Margin = new System.Windows.Forms.Padding(4);
this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(147, 39);
this.SaveButton.TabIndex = 3;
this.SaveButton.Text = "Save";
this.ToolTip.SetToolTip(this.SaveButton, "Saves the registration information in a form that can be copied to other machines" +
" and reused.");
this.SaveButton.UseVisualStyleBackColor = false;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
this.SaveButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.SaveButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// UnregisterApplicationButton
//
this.UnregisterApplicationButton.BackColor = System.Drawing.Color.MidnightBlue;
this.UnregisterApplicationButton.Dock = System.Windows.Forms.DockStyle.Left;
this.UnregisterApplicationButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.UnregisterApplicationButton.ForeColor = System.Drawing.Color.White;
this.UnregisterApplicationButton.Location = new System.Drawing.Point(294, 0);
this.UnregisterApplicationButton.Margin = new System.Windows.Forms.Padding(4);
this.UnregisterApplicationButton.Name = "UnregisterApplicationButton";
this.UnregisterApplicationButton.Size = new System.Drawing.Size(147, 39);
this.UnregisterApplicationButton.TabIndex = 1;
this.UnregisterApplicationButton.Text = "Unregister";
this.ToolTip.SetToolTip(this.UnregisterApplicationButton, "Unregisters the Application and revokes its Certificate.");
this.UnregisterApplicationButton.UseVisualStyleBackColor = false;
this.UnregisterApplicationButton.Click += new System.EventHandler(this.UnregisterApplicationButton_Click);
this.UnregisterApplicationButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.UnregisterApplicationButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// RegisterApplicationButton
//
this.RegisterApplicationButton.BackColor = System.Drawing.Color.MidnightBlue;
this.RegisterApplicationButton.Dock = System.Windows.Forms.DockStyle.Left;
this.RegisterApplicationButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.RegisterApplicationButton.ForeColor = System.Drawing.Color.White;
this.RegisterApplicationButton.Location = new System.Drawing.Point(147, 0);
this.RegisterApplicationButton.Margin = new System.Windows.Forms.Padding(4);
this.RegisterApplicationButton.Name = "RegisterApplicationButton";
this.RegisterApplicationButton.Size = new System.Drawing.Size(147, 39);
this.RegisterApplicationButton.TabIndex = 0;
this.RegisterApplicationButton.Text = "Register";
this.ToolTip.SetToolTip(this.RegisterApplicationButton, "Registers the Application with the GDS. Updates any existing record.");
this.RegisterApplicationButton.UseVisualStyleBackColor = false;
this.RegisterApplicationButton.Click += new System.EventHandler(this.RegisterApplicationButton_Click);
this.RegisterApplicationButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.RegisterApplicationButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// ApplyChangesButton
//
this.ApplyChangesButton.BackColor = System.Drawing.Color.MidnightBlue;
this.ApplyChangesButton.Dock = System.Windows.Forms.DockStyle.Left;
this.ApplyChangesButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ApplyChangesButton.ForeColor = System.Drawing.Color.White;
this.ApplyChangesButton.Location = new System.Drawing.Point(0, 0);
this.ApplyChangesButton.Margin = new System.Windows.Forms.Padding(4);
this.ApplyChangesButton.Name = "ApplyChangesButton";
this.ApplyChangesButton.Size = new System.Drawing.Size(147, 39);
this.ApplyChangesButton.TabIndex = 2;
this.ApplyChangesButton.Text = "Apply Changes";
this.ToolTip.SetToolTip(this.ApplyChangesButton, "Saves any changes to the fields in local memory.");
this.ApplyChangesButton.UseVisualStyleBackColor = false;
this.ApplyChangesButton.Click += new System.EventHandler(this.ApplyChangesButton_Click);
this.ApplyChangesButton.MouseEnter += new System.EventHandler(this.Button_MouseEnter);
this.ApplyChangesButton.MouseLeave += new System.EventHandler(this.Button_MouseLeave);
//
// DomainsLabel
//
this.DomainsLabel.AllowDrop = true;
this.DomainsLabel.AutoSize = true;
this.DomainsLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.DomainsLabel.Location = new System.Drawing.Point(7, 510);
this.DomainsLabel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DomainsLabel.Name = "DomainsLabel";
this.DomainsLabel.Size = new System.Drawing.Size(230, 22);
this.DomainsLabel.TabIndex = 62;
this.DomainsLabel.Text = "Domains";
this.DomainsLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// DomainsTextBox
//
this.DomainsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.DomainsTextBox.Location = new System.Drawing.Point(243, 510);
this.DomainsTextBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.DomainsTextBox.Name = "DomainsTextBox";
this.DomainsTextBox.Size = new System.Drawing.Size(890, 22);
this.DomainsTextBox.TabIndex = 63;
//
// RegisterApplicationControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.RegistrationPanel);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "RegisterApplicationControl";
this.Size = new System.Drawing.Size(1172, 633);
this.RegistrationPanel.ResumeLayout(false);
this.RegistrationDetailsPanel.ResumeLayout(false);
this.RegistrationDetailsPanel.PerformLayout();
this.RegistrationButtonsPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel RegistrationPanel;
private System.Windows.Forms.TableLayoutPanel RegistrationDetailsPanel;
private System.Windows.Forms.Button ServerCapabilitiesButton;
private System.Windows.Forms.Label ServerCapabilitiesLabel;
private System.Windows.Forms.Label ApplicationIdTextBox;
private System.Windows.Forms.Label ApplicationIdLabel;
private System.Windows.Forms.Button IssuerListStorePathButton;
private System.Windows.Forms.TextBox CertificateSubjectNameTextBox;
private System.Windows.Forms.Label CertificateSubjectNameLabel;
private System.Windows.Forms.TextBox IssuerListStorePathTextBox;
private System.Windows.Forms.Label IssuerListStorePathLabel;
private System.Windows.Forms.TextBox TrustListStorePathTextBox;
private System.Windows.Forms.Label TrustListStorePathLabel;
private System.Windows.Forms.TextBox ProductUriTextBox;
private System.Windows.Forms.Label ProductUriLabel;
private System.Windows.Forms.TextBox ApplicationUriTextBox;
private System.Windows.Forms.Label ApplicationUriLabel;
private System.Windows.Forms.TextBox ApplicationNameTextBox;
private System.Windows.Forms.Label ApplicationNameLabel;
private System.Windows.Forms.TextBox CertificatePrivateKeyPathTextBox;
private System.Windows.Forms.Label CertificatePrivateKeyPathLabel;
private System.Windows.Forms.TextBox CertificatePublicKeyPathTextBox;
private System.Windows.Forms.Label CertificatePublicKeyPathLabel;
private System.Windows.Forms.TextBox CertificateStorePathTextBox;
private System.Windows.Forms.Label CertificateStorePathLabel;
private System.Windows.Forms.TextBox ConfigurationFileTextBox;
private System.Windows.Forms.Label ConfigurationFileLabel;
private System.Windows.Forms.Label RegistrationTypeLabel;
private System.Windows.Forms.ComboBox RegistrationTypeComboBox;
private System.Windows.Forms.Button CertificateStorePathButton;
private System.Windows.Forms.Button ConfigurationFileButton;
private System.Windows.Forms.Button CertificatePrivateKeyPathButton;
private System.Windows.Forms.Button CertificatePublicKeyPathButton;
private System.Windows.Forms.Button TrustListStorePathButton;
private System.Windows.Forms.Panel RegistrationButtonsPanel;
private System.Windows.Forms.Button UnregisterApplicationButton;
private System.Windows.Forms.Button RegisterApplicationButton;
private System.Windows.Forms.Label ServerCapabilitiesTextBox;
private System.Windows.Forms.Button DiscoveryUrlsButton;
private System.Windows.Forms.Label DiscoveryUrlsTextBox;
private System.Windows.Forms.Label DiscoveryUrlsLabel;
private System.Windows.Forms.Button ApplyChangesButton;
private System.Windows.Forms.Button LoadButton;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Button OpenConfigurationButton;
private System.Windows.Forms.ToolTip ToolTip;
private System.Windows.Forms.Button HttpsIssuerListStorePathButton;
private System.Windows.Forms.TextBox HttpsIssuerListStorePathTextBox;
private System.Windows.Forms.Label HttpsIssuerListStorePathLabel;
private System.Windows.Forms.Button HttpsTrustListStorePathButton;
private System.Windows.Forms.TextBox HttpsTrustListStorePathTextBox;
private System.Windows.Forms.Label HttpsTrustListStorePathLabel;
private System.Windows.Forms.Button HttpsCertificatePrivateKeyPathButton;
private System.Windows.Forms.Button HttpsCertificatePublicKeyPathButton;
private System.Windows.Forms.TextBox HttpsCertificatePrivateKeyPathTextBox;
private System.Windows.Forms.TextBox HttpsCertificatePublicKeyPathTextBox;
private System.Windows.Forms.Label HttpsCertificatePrivateKeyPathLabel;
private System.Windows.Forms.Label HttpsCertificatePublicKeyPathLabel;
private System.Windows.Forms.Button ClearButton;
private System.Windows.Forms.Button PickServerButton;
private System.Windows.Forms.TextBox DomainsTextBox;
private System.Windows.Forms.Label DomainsLabel;
}
}
|
using Coldairarrow.Util;
using System;
namespace Coldairarrow.DataRepository
{
/// <summary>
/// 基于雪花Id的mod分片,具体的规则请参考此本写法
/// 优点:数据扩容无需数据迁移,以时间轴进行扩容
/// 缺点:可能会存在数据热点问题
/// 建议:推荐使用此分片规则,易于使用
/// </summary>
/// <seealso cref="Coldairarrow.DataRepository.IShardingRule" />
public class SnowflakeModShardingRule : IShardingRule
{
public virtual string FindTable(object obj)
{
//主键Id必须为SnowflakeId
SnowflakeId snowflakeId = new SnowflakeId((long)obj.GetPropertyValue("Id"));
//2019-5-10之前mod3
if (snowflakeId.Time < DateTime.Parse("2019-5-10"))
return BuildTable(snowflakeId.Id.GetHashCode() % 3);
//2019-5-10之后mod10
if (snowflakeId.Time >= DateTime.Parse("2019-5-10"))
return BuildTable(snowflakeId.Id.GetHashCode() % 10);
//以此类推balabala
throw new NotImplementedException();
string BuildTable(int num)
{
return $"Base_SysLog_{num}";
}
}
}
}
|
using Base.Contracts.Persistence;
using Core.DataTransferObjects;
using Core.Entities;
using System;
using System.Threading.Tasks;
namespace Core.Contracts
{
public interface IMeasurementRepository : IGenericRepository<Measurement>
{
Task<Measurement[]> GetLast100(int sensorId);
Task<Measurement> GetLastAsync(string sensorName);
Task<Measurement> GetLastAsync();
Task<Measurement[]> GetByDay(string sensorName, DateTime day);
Task<MeasurementGetDto[]> GetFilteredAsync(string itemname);
}
}
|
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
namespace MyDriving.iOS
{
[Register ("SettingDetailTextFieldTableViewCell")]
partial class SettingDetailTextFieldTableViewCell
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UITextField settingTextField { get; set; }
[Action ("EditingBegan:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void EditingBegan (UIKit.UITextField sender);
[Action ("EditingEnded:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void EditingEnded (UIKit.UITextField sender);
[Action ("SettingTextFieldValue_Changed:")]
[GeneratedCode ("iOS Designer", "1.0")]
partial void SettingTextFieldValue_Changed (UIKit.UITextField sender);
void ReleaseDesignerOutlets ()
{
if (settingTextField != null) {
settingTextField.Dispose ();
settingTextField = null;
}
}
}
} |
using System;
using System.Collections.Generic;
using _4DMonoEngine.Core.Blocks;
using _4DMonoEngine.Core.Utils;
using _4DMonoEngine.Core.Utils.Vector;
namespace _4DMonoEngine.Core.Universe.Fluids
{
internal class FluidContainer
{
private Vector3Int m_min;
private Vector3Int m_max;
public bool Update; //does this area need to update?
public bool Alive;
public readonly List<FluidCell> Cells;
public readonly Dictionary<long, FluidCell> CellDictionary;
public readonly List<FluidCell> Updated;
private readonly MappingFunction m_mappingFunction;
private readonly Block[] m_blocks;
private readonly FluidCell m_solidCellReference;
public FluidContainer(MappingFunction mappingFunction, Block[] blocks, FluidCell solidCellReference)
{
m_mappingFunction = mappingFunction;
m_blocks = blocks;
m_solidCellReference = solidCellReference;
Update = true;
Alive = true;
m_min = new Vector3Int(int.MaxValue, int.MaxValue, int.MaxValue);
m_max = new Vector3Int(-int.MaxValue, -int.MaxValue, -int.MaxValue);
Cells = new List<FluidCell>();
CellDictionary = new Dictionary<long, FluidCell>();
Updated = new List<FluidCell>();
}
public bool Contains(FluidCell cell)
{
return Contains(cell.X, cell.Y, cell.Z);
}
public bool Contains(int x, int y, int z)
{
return ((x >= m_min.X && x <= m_max.X) &&
(y >= m_min.Y && y <= m_max.Y) &&
(z >= m_min.Z && z <= m_max.Z));
}
public bool Intersects(FluidContainer container)
{
if (container.m_min.X > m_max.X || m_min.X > container.m_max.X)
{
return false;
}
if (container.m_min.Y > m_max.Y || m_min.Y > container.m_max.Y)
{
return false;
}
return container.m_min.Z <= m_max.Z && m_min.Z <= container.m_max.Z;
}
public void Add(FluidCell cell)
{
var cellHash = m_mappingFunction(cell.X, cell.Y, cell.Z);
if (CellDictionary.ContainsKey(cellHash))
{
var existingCell = CellDictionary[cellHash];
if (existingCell.Type != FluidCell.CellType.Solid)
{
existingCell.Level += cell.Level;
existingCell.LevelNextStep += cell.Level;
if (existingCell.LevelNextStep > FluidCell.MinLevel && existingCell.Type == FluidCell.CellType.Air)
{
existingCell.Type = FluidCell.CellType.Water;
Cells.Add(existingCell);
BuildNeighborhood(existingCell);
RecalculateBounds(existingCell);
}
}
}
else
{
cell.UpdateCells = Updated;
Cells.Add(cell);
CellDictionary.Add(cellHash, cell);
BuildNeighborhood(cell);
RecalculateBounds(cell);
}
Update = true;
}
//TODO : break this out into sub functions
public void Step()
{
foreach (var cell in Cells)
{
if (cell.Awake && cell.Type == FluidCell.CellType.Water) //In theory this check is redundant...
{
cell.Propagate();
}
}
var hasChanged = false;
var potentialPruningNeeded = false;
foreach (var cell in Updated)
{
if (cell.Type == FluidCell.CellType.Solid)
{
hasChanged = true;
potentialPruningNeeded = true;
}
if (Math.Abs(cell.Level - cell.LevelNextStep) >= FluidCell.MinFlow / 2.0f)
{
hasChanged = true;
cell.Awake = true;
}
cell.Level = cell.LevelNextStep;
if (cell.Type == FluidCell.CellType.Water && cell.Level < FluidCell.MinLevel)
{
potentialPruningNeeded = true;
cell.Type = FluidCell.CellType.Air;
}
if (!(cell.Type == FluidCell.CellType.Air && cell.Level > FluidCell.MinLevel))
{
continue;
}
cell.Type = FluidCell.CellType.Water;
RecalculateBounds(cell);
BuildNeighborhood(cell);
Cells.Add(cell);
}
Updated.Clear();
if (potentialPruningNeeded)
{
m_min = new Vector3Int(int.MaxValue, int.MaxValue, int.MaxValue);
m_max = new Vector3Int(-int.MaxValue, -int.MaxValue, -int.MaxValue);
var removeList = new List<FluidCell>();
foreach (var cell in Cells)
{
if (cell.Type == FluidCell.CellType.Solid ||
cell.Type == FluidCell.CellType.Air)
{
removeList.Add(cell);
}
else
{
RecalculateBounds(cell);
}
}
foreach (var cell in removeList)
{
Cells.Remove(cell);
if ((cell.Up != null && cell.Up.Type == FluidCell.CellType.Water) ||
(cell.North != null && cell.North.Type == FluidCell.CellType.Water) ||
(cell.East != null && cell.East.Type == FluidCell.CellType.Water) ||
(cell.South != null && cell.South.Type == FluidCell.CellType.Water) ||
(cell.West != null && cell.West.Type == FluidCell.CellType.Water) ||
(cell.Down != null && cell.Down.Type == FluidCell.CellType.Water))
{
continue;
}
var cellHash = m_mappingFunction(cell.X, cell.Y, cell.Z);
CellDictionary.Remove(cellHash);
}
}
Alive = Cells.Count != 0;
Update = hasChanged;
}
private void RecalculateBounds(FluidCell cell)
{
if (cell.X > m_max.X)
{
m_max.X = cell.X + 1;
}
if (cell.X < m_min.X)
{
m_min.X = cell.X - 1;
}
if (cell.Y > m_max.Y)
{
m_max.Y = cell.Y + 1;
}
if (cell.Y < m_min.Y)
{
m_min.Y = cell.Y - 1;
}
if (cell.Z > m_max.Z)
{
m_max.Z = cell.Z + 1;
}
if (cell.Z < m_min.Z)
{
m_min.Z = cell.Z - 1;
}
}
public void BuildNeighborhood(FluidCell cell)
{
cell.Up = GetOrCreateCell(cell.X, cell.Y + 1, cell.Z);
cell.Up.Down = cell;
cell.Down = GetOrCreateCell(cell.X, cell.Y - 1, cell.Z);
cell.Down.Up = cell;
cell.North = GetOrCreateCell(cell.X, cell.Y, cell.Z + 1);
cell.North.South = cell;
cell.East = GetOrCreateCell(cell.X + 1, cell.Y, cell.Z);
cell.East.West = cell;
cell.South = GetOrCreateCell(cell.X, cell.Y, cell.Z - 1);
cell.South.North = cell;
cell.West = GetOrCreateCell(cell.X - 1, cell.Y, cell.Z);
cell.West.East = cell;
}
private FluidCell GetOrCreateCell(int x, int y, int z)
{
FluidCell cell;
var cellHash = m_mappingFunction(x, y, z);
var block = m_blocks[cellHash].Type;
if (block != 0)
{
cell = m_solidCellReference;
}
else
{
if (CellDictionary.ContainsKey(cellHash))
{
cell = CellDictionary[cellHash];
}
else
{
cell = new FluidCell(x, y, z, FluidCell.CellType.Air, 0) {UpdateCells = Updated};
CellDictionary.Add(cellHash, cell);
}
}
return cell;
}
}
} |
using System;
using Microsoft.SPOT;
namespace netduino.helpers.Imaging {
// Based on MicroBuilder's code: http://www.microbuilder.eu/Projects/LPC1343ReferenceDesign/TFTLCDAPI.aspx
// Basic Color definitions
public enum BasicColor {
Black = 0x0000,
Blue = 0x001F,
Red = 0xF800,
Green = 0x07E0,
Cyan = 0x07FF,
Magenta = 0xF81F,
Yellow = 0xFFE0,
White = 0xFFFF
}
// Grayscale Values
public enum GrayScaleValues {
Gray_15 = 0x0861, // 15 15 15
Gray_30 = 0x18E3, // 30 30 30
Gray_50 = 0x3186, // 50 50 50
Gray_80 = 0x528A, // 80 80 80
Gray_128 = 0x8410, // 128 128 128
Gray_200 = 0xCE59, // 200 200 200
Gray_225 = 0xE71C // 225 225 225
}
// Color Palettes
public enum ColorTheme {
LimeGreen_Base = 0xD7F0, // 211 255 130
LimeGreen_Darker = 0x8DE8, // 137 188 69
LimeGreen_Lighter = 0xEFF9, // 238 255 207
LimeGreen_Shadow = 0x73EC, // 119 127 103
LimeGreen_Accent = 0xAE6D, // 169 204 104
Violet_Base = 0x8AEF, // 143 94 124
Violet_Darker = 0x4187, // 66 49 59
Violet_Lighter = 0xC475, // 194 142 174
Violet_Shadow = 0x40E6, // 66 29 52
Violet_Accent = 0xC992, // 204 50 144
Earthy_Base = 0x6269, // 97 79 73
Earthy_Darker = 0x3103, // 48 35 31
Earthy_Lighter = 0x8C30, // 140 135 129
Earthy_Shadow = 0xAB29, // 173 102 79
Earthy_Accent = 0xFE77, // 250 204 188
SkyBlue_Base = 0x95BF, // 150 180 255
SkyBlue_Darker = 0x73B0, // 113 118 131
SkyBlue_Lighter = 0xE75F, // 227 235 255
SkyBlue_Shadow = 0x4ACF, // 75 90 127
SkyBlue_Accent = 0xB5F9 // 182 188 204
}
// Default Theme
public enum DefaultColorTheme {
Base = ColorTheme.LimeGreen_Base,
Darker = ColorTheme.LimeGreen_Darker,
Lighter = ColorTheme.LimeGreen_Lighter,
Shadow = ColorTheme.LimeGreen_Shadow,
Accent = ColorTheme.LimeGreen_Accent
}
}
|
using System;
using System.Threading.Tasks;
namespace DatabaseInteraction.Interface
{
public interface IDataBaseUpdater
{
Task Update<T>(IRepository<T> repository, T toUpdate, Func<T, bool> predicate) where T : Entity, new();
}
}
|
using Microsoft.EntityFrameworkCore;
using Tzkt.Data.Models;
namespace Tzkt.Data
{
public class TzktContext : DbContext
{
#region app state
public DbSet<AppState> AppState { get; set; }
#endregion
#region accounts
public DbSet<Commitment> Commitments { get; set; }
public DbSet<Account> Accounts { get; set; }
public DbSet<Contract> Contracts { get; set; }
public DbSet<Delegate> Delegates { get; set; }
public DbSet<User> Users { get; set; }
#endregion
#region blocks
public DbSet<Block> Blocks { get; set; }
public DbSet<Protocol> Protocols { get; set; }
public DbSet<Software> Software { get; set; }
#endregion
#region operations
public DbSet<ActivationOperation> ActivationOps { get; set; }
public DbSet<BallotOperation> BallotOps { get; set; }
public DbSet<DelegationOperation> DelegationOps { get; set; }
public DbSet<DoubleBakingOperation> DoubleBakingOps { get; set; }
public DbSet<DoubleEndorsingOperation> DoubleEndorsingOps { get; set; }
public DbSet<EndorsementOperation> EndorsementOps { get; set; }
public DbSet<NonceRevelationOperation> NonceRevelationOps { get; set; }
public DbSet<OriginationOperation> OriginationOps { get; set; }
public DbSet<ProposalOperation> ProposalOps { get; set; }
public DbSet<RevealOperation> RevealOps { get; set; }
public DbSet<TransactionOperation> TransactionOps { get; set; }
public DbSet<MigrationOperation> MigrationOps { get; set; }
public DbSet<RevelationPenaltyOperation> RevelationPenaltyOps { get; set; }
#endregion
#region voting
public DbSet<Proposal> Proposals { get; set; }
public DbSet<VotingPeriod> VotingPeriods { get; set; }
public DbSet<VotingSnapshot> VotingSnapshots { get; set; }
#endregion
#region baking
public DbSet<Cycle> Cycles { get; set; }
public DbSet<BakerCycle> BakerCycles { get; set; }
public DbSet<DelegatorCycle> DelegatorCycles { get; set; }
public DbSet<BakingRight> BakingRights { get; set; }
public DbSet<SnapshotBalance> SnapshotBalances { get; set; }
#endregion
#region quotes
public DbSet<Quote> Quotes { get; set; }
#endregion
#region statistics
public DbSet<Statistics> Statistics { get; set; }
#endregion
#region scripts
public DbSet<Script> Scripts { get; set; }
public DbSet<Storage> Storages { get; set; }
#endregion
#region bigmaps
public DbSet<BigMap> BigMaps { get; set; }
public DbSet<BigMapKey> BigMapKeys { get; set; }
public DbSet<BigMapUpdate> BigMapUpdates { get; set; }
#endregion
public TzktContext(DbContextOptions options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
#region app state
modelBuilder.BuildAppStateModel();
#endregion
#region accounts
modelBuilder.BuildCommitmentModel();
modelBuilder.BuildAccountModel();
modelBuilder.BuildContractModel();
modelBuilder.BuildDelegateModel();
modelBuilder.BuildUserModel();
#endregion
#region block
modelBuilder.BuildBlockModel();
modelBuilder.BuildProtocolModel();
modelBuilder.BuildSoftwareModel();
#endregion
#region operations
modelBuilder.BuildActivationOperationModel();
modelBuilder.BuildBallotOperationModel();
modelBuilder.BuildDelegationOperationModel();
modelBuilder.BuildDoubleBakingOperationModel();
modelBuilder.BuildDoubleEndorsingOperationModel();
modelBuilder.BuildEndorsementOperationModel();
modelBuilder.BuildNonceRevelationOperationModel();
modelBuilder.BuildOriginationOperationModel();
modelBuilder.BuildProposalOperationModel();
modelBuilder.BuildRevealOperationModel();
modelBuilder.BuildTransactionOperationModel();
modelBuilder.BuildMigrationOperationModel();
modelBuilder.BuildRevelationPenaltyOperationModel();
#endregion
#region voting
modelBuilder.BuildProposalModel();
modelBuilder.BuildVotingPeriodModel();
modelBuilder.BuildVotingSnapshotModel();
#endregion
#region baking
modelBuilder.BuildCycleModel();
modelBuilder.BuildBakerCycleModel();
modelBuilder.BuildDelegatorCycleModel();
modelBuilder.BuildBakingRightModel();
modelBuilder.BuildSnapshotBalanceModel();
#endregion
#region quotes
modelBuilder.BuildQuoteModel();
#endregion
#region statistics
modelBuilder.BuildStatisticsModel();
#endregion
#region scripts
modelBuilder.BuildScriptModel();
modelBuilder.BuildStorageModel();
#endregion
#region bigmaps
modelBuilder.BuildBigMapModel();
modelBuilder.BuildBigMapKeyModel();
modelBuilder.BuildBigMapUpdateModel();
#endregion
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ammo : MonoBehaviour
{
public float Damage = 100f;
public float LifeTime = 2f;
public Rigidbody2D rb;
void OnEnable(){
CancelInvoke();
Invoke("Die", LifeTime);
//Debug.Log("Instantiated");
}
/*
void OnTriggerEnter2D(Collider2D Col)
{
Debug.Log("Entered Collision");
Health H = Col.gameObject.GetComponent<Health>();
if (H == null)
{
return;
}
H.HealthPoints -= Damage;
Die();
}
*/
void OnCollisionEnter2D(Collision2D collision) //Needed to change to collision, unsure of why
{
Health H = collision.gameObject.GetComponent<Health>();
if (H == null)
{
return;
}
H.HealthPoints -= Damage;
Die();
}
void Die(){
gameObject.SetActive(false);
}
}
|
// <copyright file="DrasticMauiWindow.MacCatalyst.cs" company="Drastic Actions">
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>
#pragma warning disable SA1210 // Using directives need to be in a specific order for MAUI
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Maui.Platform;
using DrasticMaui.Tools;
using Foundation;
using ObjCRuntime;
using UIKit;
#pragma warning restore SA1210 // Using directives can't be ordered alphabetically by namespace
namespace DrasticMaui
{
/// <summary>
/// Drastic Maui Window.
/// </summary>
public partial class DrasticMauiWindow
{
/// <summary>
/// Toggle Full Screen Support.
/// </summary>
/// <param name="fullScreen">Enable Full Screen.</param>
public void ToggleFullScreen(bool fullScreen)
{
UIWindow? window = this.Handler?.PlatformView as UIWindow;
if (window is null)
{
return;
}
window.ToggleFullScreen(fullScreen);
}
}
}
|
using FluentValidation;
using JetBrains.Annotations;
using Lykke.Service.EthereumApi.Models;
namespace Lykke.Service.EthereumApi.Validation
{
[UsedImplicitly]
public class BlacklistAddressRequestValidator : AbstractValidator<BlacklistAddressRequest>
{
public BlacklistAddressRequestValidator()
{
RuleFor(x => x.Address)
.AddressMustBeValid();
RuleFor(x => x.BlacklistingReason)
.NotEmpty()
.MaximumLength(255);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace DoAnFramework
{
public class SingleCodeRunResult: ISingleCodeRunResult
{
public int TimeUsed { get; set; }
public int MemoryUsed { get; set; }
}
}
|
using Coldairarrow.Util;
using System;
using System.Collections.Generic;
namespace Coldairarrow.DataRepository
{
/// <summary>
/// 分库分表配置生成器
/// </summary>
public class ShardingConfigBootstrapper : IShardingConfigBuilder, IAddDataSource, IAddAbstractTable, IAddAbstractDatabse, IAddPhysicDb, IAddPhysicTable
{
#region 构造函数
private ShardingConfigBootstrapper()
{
}
#endregion
#region 外部接口
/// <summary>
/// 引导
/// </summary>
/// <returns></returns>
public static IShardingConfigBuilder Bootstrap()
{
return new ShardingConfigBootstrapper();
}
public IShardingConfigBuilder AddDataSource(string dataSourceName, DatabaseType dbType, Action<IAddPhysicDb> physicDbBuilder)
{
IAddPhysicDb builder = new ShardingConfigBootstrapper();
physicDbBuilder(builder);
var value = builder.GetPropertyValue("_physicDbs") as List<(string conString, ReadWriteType opType)>;
_config.AddDataSource(dataSourceName, dbType, value);
return this;
}
public IShardingConfigBuilder AddAbsDb(string absDbName, Action<IAddAbstractTable> absTableBuilder)
{
var builder = new ShardingConfigBootstrapper();
absTableBuilder(builder);
var asbTables = builder.GetPropertyValue("_absTables") as List<AbstractTable>;
_config.AddAbsDatabase(absDbName, asbTables);
return this;
}
public ShardingConfig Build()
{
return _config;
}
void IAddPhysicDb.AddPhsicDb(string conString, ReadWriteType opType)
{
_physicDbs.Add((conString, opType));
}
void IAddPhysicTable.AddPhsicTable(string physicTableName, string dataSourceName)
{
_physicTables.Add((physicTableName, dataSourceName));
}
void IAddAbstractTable.AddAbsTable(string absTableName, Action<IAddPhysicTable> physicTableBuilder, Func<object, string> findTable)
{
IAddPhysicTable physicBuilder = new ShardingConfigBootstrapper();
physicTableBuilder(physicBuilder);
var value = physicBuilder.GetPropertyValue("_physicTables") as List<(string physicTableName, string dataSourceName)>;
_absTables.Add(new AbstractTable
{
AbsTableName = absTableName,
FindTable = findTable,
PhysicTables = value
});
}
void IAddAbstractTable.AddAbsTable(string absTableName, Action<IAddPhysicTable> physicTableBuilder, IShardingRule rule)
{
(this as IAddAbstractTable).AddAbsTable(absTableName, physicTableBuilder, rule.FindTable);
}
#endregion
#region 私有成员
private ShardingConfig _config { get; } = ShardingConfig.Instance;
private List<AbstractTable> _absTables { get; } = new List<AbstractTable>();
private List<(string conString, ReadWriteType opType)> _physicDbs { get; } = new List<(string conString, ReadWriteType opType)>();
private List<(string physicTableName, string dataSourceName)> _physicTables { get; } = new List<(string physicTableName, string dataSourceName)>();
#endregion
}
public interface IShardingConfigBuilder : IAddDataSource, IAddAbstractDatabse
{
/// <summary>
/// 生成配置
/// </summary>
/// <returns></returns>
ShardingConfig Build();
}
public interface IAddDataSource
{
/// <summary>
/// 添加数据源
/// </summary>
/// <param name="dataSourceName">数据源名</param>
/// <param name="dbType">数据库类型</param>
/// <param name="physicDbBuilder">物理表构造器</param>
/// <returns></returns>
IShardingConfigBuilder AddDataSource(string dataSourceName, DatabaseType dbType, Action<IAddPhysicDb> physicDbBuilder);
}
public interface IAddPhysicDb
{
/// <summary>
/// 添加物理数据库
/// </summary>
/// <param name="conString">连接字符串</param>
/// <param name="opType">数据库类型</param>
void AddPhsicDb(string conString, ReadWriteType opType);
}
public interface IAddAbstractTable
{
/// <summary>
/// 添加抽象表
/// </summary>
/// <param name="absTableName">抽象表名</param>
/// <param name="physicTableBuilder">物理表构造器</param>
/// <param name="findTable">分表规则</param>
void AddAbsTable(string absTableName, Action<IAddPhysicTable> physicTableBuilder, Func<object, string> findTable);
/// <summary>
/// 添加抽象表
/// </summary>
/// <param name="absTableName">抽象表名</param>
/// <param name="physicTableBuilder">物理表构造器</param>
/// <param name="rule">找表规则</param>
void AddAbsTable(string absTableName, Action<IAddPhysicTable> physicTableBuilder, IShardingRule rule);
}
public interface IAddPhysicTable
{
/// <summary>
/// 添加物理表
/// </summary>
/// <param name="physicTableName">物理表名</param>
/// <param name="dataSourceName">数据源名</param>
void AddPhsicTable(string physicTableName, string dataSourceName);
}
public interface IAddAbstractDatabse
{
/// <summary>
/// 添加抽象数据库
/// </summary>
/// <param name="absDbName">抽象数据库名</param>
/// <param name="absTableBuilder">抽象表构造器</param>
/// <returns></returns>
IShardingConfigBuilder AddAbsDb(string absDbName, Action<IAddAbstractTable> absTableBuilder);
}
}
|
using System;
namespace Rant.Engine.Compiler
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
internal sealed class TokenParserAttribute : Attribute
{
public string Name { get; set; }
public R? TokenType => tokenType;
private readonly R? tokenType;
public TokenParserAttribute()
{
}
public TokenParserAttribute(R tokenType)
{
this.tokenType = tokenType;
}
}
}
|
using Assets.Scripts.Core.Spaceship;
using Assets.Scripts.Gameplay.Fuel;
using UnityEngine;
namespace Assets.Scripts.Gameplay.Pickups
{
[CreateAssetMenu(fileName = "FuelPickup", menuName = "Feature/Create Fuel Pickup")]
public class FuelPickupEffect : PickupEffect
{
public float Amount = 1000;
public override void Apply(GameObject collider)
{
var fuelTank = App.Models.Spaceship.FuelTank;
fuelTank.Refill(Amount);
}
}
}
|
using Refit;
using System.Runtime.Serialization;
namespace BtcMarkets.Core.Api.Contracts
{
[DataContract]
public class MarketParams : BaseObject
{
public bool? Forward { get; set; }
public bool? Sort { get; set; }
[AliasAs("indexForward")]
[DataMember(Name = "indexForward")]
public string IndexForward => Forward.HasValue ? Forward.Value.ToString().ToLower() : null;
[AliasAs("limit")]
[DataMember(Name = "limit")]
public int? Limit { get; set; }
[AliasAs("since")]
[DataMember(Name = "since")]
public long? Since { get; set; }
[AliasAs("sortForward")]
[DataMember(Name = "sortForward")]
public string SortForward => Sort.HasValue ? Sort.Value.ToString().ToLower() : null;
}
}
|
using System;
using System.Collections.Generic;
namespace Tasky.Portable
{
public interface IXmlStorage
{
List<Task> ReadXml (string filename);
void WriteXml (List<Task> tasks, string filename);
}
}
|
using UnityEngine;
using System.Collections;
public class HoldObject02 : MonoBehaviour {
private float m_maxDistance = 2.0f;
private float m_distFromPlayer = 1.0f;
private float m_throwForce = 1.0f;
private Camera m_mainCamera;
private Transform m_jointTransform;
private Rigidbody m_connectedBody;
private bool m_attachCenterOfMass = true;
private Ray m_ray;
private RaycastHit m_hit;
// Use this for initialization
void Start () {
m_mainCamera = Camera.main;
}
// Update is called once per frame
void Update () {
if (!Input.GetMouseButtonDown(0))
return;
m_ray = m_mainCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
if (!Physics.Raycast(m_ray, out m_hit, m_maxDistance))
return;
if (!m_hit.rigidbody || m_hit.rigidbody.isKinematic)
return;
// Set up joint
if (!m_jointTransform)
{
GameObject joint = new GameObject("JointTarget") as GameObject;
m_jointTransform = joint.GetComponent<Transform>();
m_jointTransform.SetParent(m_mainCamera.transform);
}
// Move joint to front of mainCamera
m_jointTransform.position = m_mainCamera.ViewportToWorldPoint(
new Vector3(0.5f, 0.3f, m_distFromPlayer));
// Connect rigidbody to joint
m_hit.rigidbody.transform.position = m_jointTransform.position;
// Set connectedBody data member
m_connectedBody = m_hit.collider.GetComponent<Rigidbody>();
if (m_attachCenterOfMass)
{
Vector3 anchor = transform.TransformDirection(m_hit.rigidbody.centerOfMass)
+ m_hit.rigidbody.transform.position;
anchor = m_jointTransform.InverseTransformPoint(anchor);
m_jointTransform.localPosition = anchor;
}
else
m_jointTransform.localPosition = Vector3.zero;
StartCoroutine("DragObject");
}
void LateUpdate()
{
}
IEnumerator DragObject()
{
// connectedBody.useGravity = false;
m_connectedBody.isKinematic = true;
while (Input.GetMouseButton(0) && m_connectedBody)
{
m_jointTransform.position = m_mainCamera.ViewportToWorldPoint(
new Vector3(0.5f, 0.3f, m_distFromPlayer));
// Restrict connectedBody distance from camera to distFromPlayer
// springJoint.transform.LookAt(mainCamera.transform.position);
// springJoint.connectedBody.transform.LookAt(mainCamera.transform);
yield return null;
}
}
void ThrowObject()
{
Vector3 connectedBodyTransform = m_connectedBody.transform.position;
Vector3 mainCamTransform = Camera.main.transform.position;
Vector3 directionVector = (connectedBodyTransform - mainCamTransform).normalized;
m_connectedBody.AddForce(directionVector * m_throwForce, ForceMode.Impulse);
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Microsoft.AspNetCore.DataProtection.Repositories;
using Microsoft.EntityFrameworkCore;
using VoteKit.Data;
using VoteKit.Data.Models;
namespace VoteKit.Web.Services
{
public class DataProtectionKeyRepository : IXmlRepository
{
private readonly IDbContextFactory<VotekitCtx> _db;
public DataProtectionKeyRepository(IDbContextFactory<VotekitCtx> db)
{
_db = db;
}
public IReadOnlyCollection<XElement> GetAllElements()
{
using var db = _db.CreateDbContext();
return db.DataProtectionKeys.AsNoTracking()
.Where(x => x.Owner == "dashboard" && x.Xml != null && x.Xml != "")
.ToList()
.Select(row => XElement.Parse(row.Xml!))
.ToList()
.AsReadOnly();
}
public void StoreElement(XElement element, string friendlyName)
{
using var db = _db.CreateDbContext();
var newKey = new DataProtectionKey()
{
Owner = "dashboard",
FriendlyName = friendlyName,
Xml = element.ToString(SaveOptions.DisableFormatting)
};
db.DataProtectionKeys.Add(newKey);
db.SaveChanges();
}
}
}
|
namespace Sales.Core
{
using System;
public class Constants
{
public class MessageQueue
{
public const string SalesQueue = "product-sales";
}
}
}
|
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace gvimwrapper {
partial class wrapper {
void tree_init() {
filetree.ImageList = iconlist;
}
void tree_fill(string path) {
filetree.Nodes.Clear();
tree_fill(path, filetree.Nodes, true);
vim_cd(path);
}
void tree_fill(string path, TreeNodeCollection nodes, bool showparent = false) {
nodes.Clear();
DirectoryInfo dir = new DirectoryInfo(path);
if (showparent && dir.Parent != null) {
tree_makenode(nodes, "..", dir.Parent.FullName, ".folder");
}
DirectoryInfo[] subdirs = dir.GetDirectories();
foreach (DirectoryInfo subdir in subdirs) {
bool canexpand;
try {
canexpand =
subdir.GetFiles().Length > 0 ||
subdir.GetDirectories().Length > 0;
} catch (Exception) {
tree_makenode(nodes, "(err) " + subdir.Name, null, ".warning");
continue;
}
var child = tree_makenode(nodes, subdir.Name, subdir.FullName, ".folder");
if (canexpand) {
child.Nodes.Add(new TreeNode());
}
}
foreach (FileInfo file in dir.GetFiles()) {
try {
tree_makenode(nodes, file.Name, file, file.Extension);
} catch (Exception) {
tree_makenode(nodes, "(exc)", null, ".warning");
}
}
}
TreeNode tree_makenode(
TreeNodeCollection parent,
string text,
object tag,
string extension)
{
TreeNode child = new TreeNode(text);
child.Tag = tag;
if (text.StartsWith(".")) {
child.ForeColor = Color.Gray;
}
if (tag == null) {
child.ForeColor = Color.DarkRed;
}
child.SelectedImageKey = child.ImageKey = icons_forextension(extension);
parent.Add(child);
return child;
}
void UI_BeforeExpandTreeNode(object sender, TreeViewCancelEventArgs e) {
if (e.Node.Tag == null) {
return;
}
if (e.Node.Text == "..") {
tree_fill((string) e.Node.Tag, filetree.Nodes, true);
e.Cancel = true;
return;
}
tree_fill((string) e.Node.Tag, e.Node.Nodes);
}
void UI_TreeNodeDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {
if (e.Node.Tag is FileInfo) {
string file = ((FileInfo) e.Node.Tag).FullName;
if (File.Exists(file)) {
tab_open(file, iconlist.Images[e.Node.ImageKey]);
vim_open(file);
}
} else if (e.Node.Text == ".." && e.Node.Tag is string) {
tree_fill((string) e.Node.Tag);
}
}
void UI_OpenFolderClick(object sender, EventArgs e) {
FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
folderBrowser.RootFolder = Environment.SpecialFolder.DesktopDirectory;
folderBrowser.ShowNewFolderButton = false;
folderBrowser.Description = "Gimme folder";
if (folderBrowser.ShowDialog() == DialogResult.OK) {
tree_fill(folderBrowser.SelectedPath);
}
}
void UI_OpenSelectedNodeClick(object sender, EventArgs e) {
TreeNode node = filetree.SelectedNode;
if (node != null && node.Tag is string) {
tree_fill((string) node.Tag);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////// |
namespace Automatonymous.Requests
{
using Activities;
using Contracts;
using GreenPipes;
using MassTransit;
/// <summary>
/// Tracks a request, which was sent to a saga, and the saga deferred until some operation
/// is completed, after which it will produce an event to trigger the response.
/// </summary>
public class RequestStateMachine :
MassTransitStateMachine<RequestState>
{
public RequestStateMachine()
{
InstanceState(x => x.CurrentState, Pending);
Event(() => Started, x =>
{
x.CorrelateById(m => m.Message.RequestId);
x.SelectId(m => m.Message.RequestId);
});
Event(() => Completed, x =>
{
x.CorrelateById(m => m.SagaCorrelationId, i => i.Message.CorrelationId);
});
Event(() => Faulted, x =>
{
x.CorrelateById(m => m.SagaCorrelationId, i => i.Message.CorrelationId);
});
Initially(
When(Started)
.Then(InitializeInstance)
.TransitionTo(Pending));
During(Pending,
When(Completed)
.Execute(x => new CompleteRequestActivity())
.Finalize(),
When(Faulted)
.Execute(x => new FaultRequestActivity())
.Finalize());
SetCompletedWhenFinalized();
}
public State Pending { get; private set; }
public Event<RequestStarted> Started { get; private set; }
public Event<RequestCompleted> Completed { get; private set; }
public Event<RequestFaulted> Faulted { get; private set; }
static void InitializeInstance(BehaviorContext<RequestState, RequestStarted> context)
{
var consumeContext = context.GetPayload<ConsumeContext>();
context.Instance.ConversationId = consumeContext.ConversationId;
context.Instance.ResponseAddress = context.Data.ResponseAddress;
context.Instance.FaultAddress = context.Data.FaultAddress;
context.Instance.ExpirationTime = context.Data.ExpirationTime;
context.Instance.SagaCorrelationId = context.Data.CorrelationId;
context.Instance.SagaAddress = consumeContext.SourceAddress;
}
}
}
|
using System;
using System.Net.Http;
namespace space_browser
{
/// <summary>
/// Connection class
/// </summary>
class Connection
{
private HttpClient httpClient;
/// <summary>
/// Construct connection class
/// </summary>
/// <param name="timeout">Timeout time</param>
public Connection(long timeout)
{
httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(timeout);
}
/// <summary>
/// Creates GET Request
/// </summary>
/// <param name="url">URL request</param>
/// <returns>GET Request</returns>
public HttpRequest CreateGet(string url)
{
return new HttpRequest(new HttpRequestMessage(HttpMethod.Get, url), httpClient);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace SoonLearning.BlockPuzzle.Data
{
internal class PuzzleAPI
{
/* [DllImport("PuzzleMxN.dll")]
public extern static void PGInit(IntPtr g_c);
[DllImport("PuzzleMxN.dll")]
public extern static int PGGetAnswer(IntPtr pSrcData, IntPtr pDstData, int cols, int rows);
[DllImport("PuzzleMxN.dll")]
public extern static void PGGetAllMovePaths(IntPtr pDstData);
[DllImport("PuzzleMxN.dll")]
public extern static void PGGetPrevMovePath(int cur_path, IntPtr pDstData);
[DllImport("PuzzleMxN.dll")]
public extern static void PGGetNextMovePath(int cols, int rows, int cur_path, IntPtr pDstData);*/
}
}
|
namespace Platform.VirtualFileSystem.Providers
{
public class StandardNodeAttributesUpdateContext
: INodeAttributesUpdateContext
{
private readonly IAutoLock syncLock;
private INodeAttributes nodeAttributes;
public StandardNodeAttributesUpdateContext(INodeAttributes nodeAttributes)
{
this.nodeAttributes = nodeAttributes;
this.syncLock = nodeAttributes.GetAutoLock().Lock();
}
public virtual void Dispose()
{
this.syncLock.Unlock();
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Monytor.Core.Models;
using Monytor.Core.Repositories;
namespace Monytor.RavenDb.Repositories {
public class DashboardRepository : IDashboardRepository {
private readonly IUnitOfWork _unitOfWork;
public DashboardRepository(IUnitOfWork unitOfWork) {
_unitOfWork = unitOfWork;
}
public Dashboard Get(string id) {
return _unitOfWork.Session.Load<Dashboard>(id);
}
public IEnumerable<Dashboard> LoadOverview() {
// TODO: Currently limited up to 1024
return _unitOfWork.Session.LoadAll<Dashboard>()
.OrderBy(x => x.Name);
}
public void Store(Dashboard config) {
_unitOfWork.Session.Store(config);
}
}
} |
using _004_TreesAndGraphs;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace _004_TreesAndGraphsTest
{
[TestClass]
public class Question_4_12_Test
{
[DataTestMethod]
[DataRow(18, 3)]
[DataRow(11, 2)]
[DataRow(10, 1)]
[DataRow(8, 3)]
[DataRow(7, 2)]
[DataRow(6, 2)]
[DataRow(3, 3)]
[DataRow(1, 2)]
public void CountPathsWithSumTest(int testSum, int expectedCount)
{
// Arrange
var root = new BinaryTreeNode<int>(10)
{
Left = new BinaryTreeNode<int>(5)
{
Left = new BinaryTreeNode<int>(3)
{
Left = new BinaryTreeNode<int>(3),
Right = new BinaryTreeNode<int>(-2)
},
Right = new BinaryTreeNode<int>(2)
{
Right = new BinaryTreeNode<int>(1)
}
},
Right = new BinaryTreeNode<int>(-3)
{
Right = new BinaryTreeNode<int>(11)
}
};
// Act
int resultCount1 = Question_4_12.CountPathsWithSum(root, testSum);
int resultCount2 = Question_4_12.CountPathsWithSumOptimized(root, testSum);
// Assert
Assert.AreEqual(expectedCount, resultCount1, "Count 1 is incorrect.");
Assert.AreEqual(expectedCount, resultCount2, "Count 2 is incorrect - optimized method.");
}
}
}
|
using System;
using System.Xml.Serialization;
namespace BlogML2Ghost.Core.BlogML.Xml
{
[Serializable]
public sealed class BlogMLAttachment
{
[XmlAttribute("embedded")]
public bool Embedded { get; set; } = false;
[XmlAttribute("url")]
public string Url { get; set; }
[XmlAttribute("path")]
public string Path { get; set; }
[XmlAttribute("mime-type")]
public string MimeType { get; set; }
[XmlText]
public byte[] Data { get; set; }
}
}
|
using System.Collections.Generic;
using PatentSpoiler.App.Domain.Patents;
namespace PatentSpoiler.App.DTOs
{
public class PatentableEntityViewModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public IEnumerable<string> Claims { get; set; }
public string Owner { get; set; }
public int AttachmentCount { get; set; }
public static PatentableEntityViewModel FromDomainModel(PatentableEntity domainEntity)
{
return new PatentableEntityViewModel
{
Id = domainEntity.Id,
Name = domainEntity.Name,
Description = domainEntity.Description,
Claims = new List<string>(domainEntity.Claims),
Owner = domainEntity.Owner,
AttachmentCount = domainEntity.Attachments.Count,
};
}
}
} |
// Copyright (C) 2019 Singapore ETH Centre, Future Cities Laboratory
// All rights reserved.
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
// Author: David Neudecker (neudecker@arch.ethz.ch)
// Michael Joos (joos@arch.ethz.ch)
// Muhammad Salihin Bin Zaol-kefli
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using LineInfo = LineInspector.LineInspectorInfo;
public class TransectChart : MonoBehaviour
{
private Material material;
private Image image;
private float locator;
private GridData grid;
private Color color;
#if USE_TEXTURE
private Texture2D buffer = null;
private byte[] byteArray = null;
#else
private ComputeBuffer buffer = null;
#endif
private int bufferSize = 0;
private float[] dataToSend;
float lineAlpha = 1f;
float fillAlpha = 1f;
public GridData Grid { get { return grid; } }
//
// Unity Methods
//
private void OnDestroy()
{
image.UnregisterDirtyMaterialCallback(OnMaterialChange);
grid.OnGridChange -= OnGridChange;
grid.OnValuesChange -= OnGridValuesChange;
ReleaseBuffer();
}
//
// Event Methods
//
private void OnMaterialChange()
{
var mat = image.materialForRendering;
if (mat != material)
{
material = mat;
InitMaterial();
if (buffer != null)
{
ReleaseBuffer();
UpdateChart();
}
}
}
private void OnGridChange(GridData gd)
{
UpdateResolution();
UpdateChart();
}
private void OnGridValuesChange(GridData gd)
{
UpdateChart();
}
//
// Public Methods
//
public void Init(GridData grid, Color color)
{
this.color = color;
this.grid = grid;
grid.OnGridChange += OnGridChange;
grid.OnValuesChange += OnGridValuesChange;
image = GetComponent<Image>();
material = new Material(image.material);
if (!grid.IsCategorized)
{
lineAlpha = material.GetColor("Line").a;
fillAlpha = material.GetColor("Fill").a;
}
image.RegisterDirtyMaterialCallback(OnMaterialChange);
image.material = material;
// Note: this may not be true if the transect is inside a scrollview (or another mask)
if (image.material == material)
{
InitMaterial();
}
UpdateResolution();
}
public void Destroy()
{
image.UnregisterDirtyMaterialCallback(OnMaterialChange);
grid.OnGridChange -= OnGridChange;
grid.OnValuesChange -= OnGridValuesChange;
ReleaseBuffer();
Destroy(gameObject);
}
public void SetLocator(float locator)
{
if (this.locator != locator)
{
this.locator = locator;
UpdateChart();
}
}
public void SetLineInfo(LineInfo lineInfo)
{
UpdateLineInspetorChart(lineInfo);
}
//
// Private Methods
//
private void InitMaterial()
{
Rect rect = GetComponent<RectTransform>().rect;
material.SetColor("Line", new Color(color.r, color.g, color.b, lineAlpha));
material.SetColor("Fill", new Color(color.r, color.g, color.b, fillAlpha));
material.SetFloat("Width", rect.width);
material.SetFloat("Height", rect.height);
if (grid.IsCategorized)
{
int count = grid.categories.Length;
Color[] colors = new Color[count];
for (int i = 0; i < count; i++)
{
colors[i] = grid.categories[i].color;
}
material.SetColorArray("CategoryColors", colors);
material.SetFloat("InvCountMinusOne", count > 0 ? 1f / (count - 1) : 0f);
}
}
private void UpdateResolution()
{
if (dataToSend == null || dataToSend.Length != grid.countX)
{
dataToSend = new float[grid.countX];
}
}
private void UpdateChart()
{
int columnSize = grid.countX;
int locatorStart = Mathf.RoundToInt(grid.countY * locator) * grid.countX;
locatorStart = Mathf.Clamp(locatorStart, 0, grid.values.Length - columnSize);
if (columnSize >= dataToSend.Length)
UpdateResolution();
if (grid.IsCategorized)
{
for (int i = 0; i < columnSize; ++i)
{
dataToSend[i] = grid.values[locatorStart++];
}
}
else
{
float minValue = grid.minValue;
float invRange = 1f / (grid.maxValue - grid.minValue);
for (int i = 0; i < columnSize; ++i)
{
dataToSend[i] = (grid.values[locatorStart++] - minValue) * invRange;
}
}
SetData(dataToSend);
}
private void UpdateLineInspetorChart(LineInfo lineInfo)
{
if (lineInfo != null)
{
var lineMapLayer = lineInfo.mapLayer;
if (lineMapLayer == null)
return;
GridData lineGrid = lineMapLayer.Grid;
// Initizlize values
int length = lineInfo.mapLayer.numOfSamples;
if (dataToSend == null || dataToSend.Length != length)
dataToSend = new float[length];
// Set all values to 0
for (int i = 0; i < length; ++i)
{
dataToSend[i] = 0;
}
// Calculate values
double thisDegreesPerCellX = (lineGrid.east - lineGrid.west) / lineGrid.countX;
double thisDegreesPerCellY = (lineGrid.south - lineGrid.north) / lineGrid.countY;
double thisCellsPerDegreeX = 1.0 / thisDegreesPerCellX;
double thisCellsPerDegreeY = 1.0 / thisDegreesPerCellY;
var patchCellsPerDegreeX = grid.countX / (grid.east - grid.west);
var patchCellsPerDegreeY = grid.countY / (grid.south - grid.north);
double scaleX = patchCellsPerDegreeX * thisDegreesPerCellX;
double scaleY = patchCellsPerDegreeY * thisDegreesPerCellY;
double offsetX = (lineGrid.west - grid.west) * patchCellsPerDegreeX + 0.5 * scaleX;
double offsetY = (lineGrid.north - grid.north) * patchCellsPerDegreeY + 0.5 * scaleY;
Coordinate coorStart = lineInfo.coords[0];
Coordinate coorEnd = lineInfo.coords[1];
// The smaller range of longitude and latitude
double startLon = (coorStart.Longitude > grid.west) ? coorStart.Longitude : grid.west;
double startLat = (coorStart.Latitude < grid.north) ? coorStart.Latitude : grid.north;
double endLon = (coorEnd.Longitude < grid.east) ? coorEnd.Longitude : grid.east;
double endLat = (coorEnd.Latitude > grid.south) ? coorEnd.Latitude : grid.south;
// Precompute values to be used in loop
double diffX = endLon - startLon;
double diffY = endLat - startLat;
double diffXperSample = diffX / length;
double diffYperSample = diffY / length;
double srcX = (startLon - lineGrid.west) * thisCellsPerDegreeX + 0.5;
double srcY = (startLat - lineGrid.north) * thisCellsPerDegreeY + 0.5;
double pX = offsetX + srcX * scaleX;
double pY = offsetY + srcY * scaleY;
double srcXStep = diffXperSample * thisCellsPerDegreeX;
double srcYStep = diffYperSample * thisCellsPerDegreeY;
double srcXStepScaleX = srcXStep * scaleX;
double srcYStepScaleY = srcYStep * scaleY;
if (grid.IsCategorized)
{
if (grid.values != null)
{
for (int j = 0; j < length; ++j)
{
if (grid.IsInside(startLon, startLat))
{
int patchIndex = (int)pY * grid.countX + (int)pX;
if (patchIndex >= 0 && patchIndex < grid.values.Length)
{
int value = (int)grid.values[patchIndex];
byte mask = grid.valuesMask == null ? (byte)1 : grid.valuesMask[patchIndex];
float valToAdd = mask == 1 ? grid.categoryFilter.IsSetAsInt(value) : 0;
dataToSend[j] = valToAdd;
}
}
startLon += diffXperSample;
startLat += diffYperSample;
srcX += srcXStep;
srcY += srcYStep;
pX += srcXStepScaleX;
pY += srcYStepScaleY;
}
}
}
else
{
float gridMin = grid.minValue;
float invRange = 1f / (grid.maxValue - grid.minValue);
if (lineMapLayer.useFilters)
{
if (grid.values != null)
{
for (int j = 0; j < length; ++j)
{
if (grid.IsInside(startLon, startLat))
{
int patchIndex = (int)pY * grid.countX + (int)pX;
if (patchIndex >= 0 && patchIndex < grid.values.Length)
{
int value = (int)grid.values[patchIndex];
byte mask = grid.valuesMask == null ? (byte)1 : grid.valuesMask[patchIndex];
if (mask == 1 && value >= grid.minFilter && value <= grid.maxFilter)
{
float valToAdd = (value - gridMin) * invRange;
dataToSend[j] = valToAdd;
}
}
}
startLon += diffXperSample;
startLat += diffYperSample;
srcX += srcXStep;
srcY += srcYStep;
pX += srcXStepScaleX;
pY += srcYStepScaleY;
}
}
}
else
{
if (grid.values != null)
{
for (int j = 0; j < length; ++j)
{
if (grid.IsInside(startLon, startLat))
{
int patchIndex = (int)pY * grid.countX + (int)pX;
if (patchIndex >= 0 && patchIndex < grid.values.Length)
{
byte mask = grid.valuesMask == null ? (byte)1 : grid.valuesMask[patchIndex];
if (mask == 1)
{
float valToAdd = (grid.values[patchIndex] - gridMin);
dataToSend[j] = valToAdd;
}
}
}
startLon += diffXperSample;
startLat += diffYperSample;
srcX += srcXStep;
srcY += srcYStep;
pX += srcXStepScaleX;
pY += srcYStepScaleY;
}
}
}
}
}
else
{
// Set all values to 0
for (int i = 0; i < dataToSend.Length; ++i)
{
dataToSend[i] = 0;
}
}
if(dataToSend.Length > 0)
SetData(dataToSend);
}
private void SetData(float[] data)
{
if (buffer == null || data.Length != bufferSize)
{
CreateBuffer(data.Length);
}
#if USE_TEXTURE
System.Buffer.BlockCopy(data, 0, byteArray, 0, byteArray.Length);
buffer.LoadRawTextureData(byteArray);
buffer.Apply();
#else
buffer.SetData(data);
#endif
if(material)
material.SetInt("Count", data.Length - 1);
}
private void CreateBuffer(int count)
{
ReleaseBuffer();
bufferSize = count;
#if USE_TEXTURE
byteArray = new byte[count * 4];
buffer = new Texture2D(bufferSize, 1, TextureFormat.RFloat, false);
buffer.filterMode = FilterMode.Point;
material.SetTexture("Values", buffer);
#else
buffer = new ComputeBuffer(bufferSize, sizeof(float), ComputeBufferType.Default);
material.SetBuffer("Values", buffer);
#endif
}
private void ReleaseBuffer()
{
if (buffer != null)
{
#if USE_TEXTURE
byteArray = null;
Destroy(buffer);
#else
buffer.Release();
#endif
buffer = null;
bufferSize = 0;
}
}
}
|
using kwd.BoxOBlazor.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace kwd.BoxOBlazor.Tests.Util
{
[TestClass]
public class ColorHelperTests
{
[TestMethod]
public void HexConversions()
{
var (r, g, b) = ColorHelper.HexToRgb("#FF03FF ");
Assert.AreEqual((byte)255, r);
Assert.AreEqual((byte)3, g);
Assert.AreEqual((byte)255, b);
var hex = ColorHelper.RGBToHex(255, 3, 255);
Assert.AreEqual("#FF03FF", hex);
}
[TestMethod]
public void HSLConversions()
{
var rgbClr = ColorHelper.HSLToRGB(0, 1.0f, .5f);
Assert.IsTrue(rgbClr.R == 255);
var hsl = ColorHelper.RGBToHSL(255, 255, 255);
Assert.IsTrue(hsl.Lightness.Like(1F));
}
}
}
|
namespace DFC.App.JobProfileTasks.ApiModels
{
public class WorkingEnvironmentApiModel
{
public string Location { get; set; }
public string Environment { get; set; }
public string Uniform { get; set; }
}
} |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Xamarin.Forms;
using System.ComponentModel;
using System.Threading.Tasks;
namespace EFGetStarted
{
public partial class BlogsPage : ContentPage, INotifyPropertyChanged
{
public BlogsPage()
{
InitializeComponent();
}
protected async override void OnAppearing()
{
blobCollectionView.SelectedItem = null;
using (var blogContext = new BloggingContext())
{
await InsertStartData(blogContext);
var theBlogs = blogContext.Blogs.ToList();
blobCollectionView.ItemsSource = theBlogs;
}
}
async Task InsertStartData(BloggingContext context)
{
var blogCount = context.Blogs.Count();
if (blogCount == 0)
{
await context.AddAsync(new Blog { Url = "https://devblogs.microsoft.com/xamarin" });
await context.AddAsync(new Blog { Url = "https://aka.ms/appsonazureblog" });
await context.SaveChangesAsync();
}
}
async void blobCollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!(e.CurrentSelection.FirstOrDefault() is Blog blog))
return;
var postsPage = new PostsPage(blog.BlogId);
await Navigation.PushAsync(postsPage);
}
async void ToolbarItem_Clicked(System.Object sender, System.EventArgs e)
{
await Navigation.PushModalAsync(new NavigationPage(new AddBlogPage()));
}
async void DeleteAll_Clicked(object sender, EventArgs e)
{
using (var blogContext = new BloggingContext())
{
blogContext.RemoveRange(blogContext.Blogs);
await blogContext.SaveChangesAsync();
blobCollectionView.ItemsSource = blogContext.Blogs.ToList();
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Devtist.Image.Exceptions;
using Devtist.Io;
namespace Devtist.Image.Exif.Parsers.Jpeg
{
internal class JpegParser : IExifInfoParser
{
private BitConvert _bit = new BitConvert(false);
private uint _tiffOffset;
private readonly IList<ImageFileDirectory> _ifds = new List<ImageFileDirectory>();
public void Dispose()
{ }
public IExifMetadata Parse(IIoStream imageStream)
{
ReadHeader(imageStream);
ReadIfds(imageStream, _tiffOffset);
return new ExifMetadata(_ifds, imageStream, _bit);
}
private void ReadIfds(IIoStream stream, uint ifdOffset)
{
var ptr = ifdOffset;
while (ptr > 0 && ptr < stream.Length)
{
try
{
var ifd = new ImageFileDirectory(ptr);
var buffer = new byte[12];
stream.Read(buffer, 2, ptr);
var offset = ptr + 2;
var size = _bit.ToInt16(buffer, 0);
for (var i = 0; i < size; i++)
{
var currOffset = offset + i * 12;
stream.Read(buffer, 12, currOffset);
ifd.AddTag(buffer, _bit, stream);
}
stream.Read(buffer, 4, offset + size * 12);
ptr = _bit.ToUInt32(buffer, 0);
if (ifd.Tags.Any())
_ifds.Add(ifd);
}
catch (Exception)
{
break;
}
}
}
private static readonly byte[] HeaderMarker1 = {0xFF, 0xD8};
private static readonly byte[] HeaderMarker2 = {0xFF, 0xE1};
private void ReadHeader(IIoStream stream)
{
var marker = new byte[2];
stream.Read(marker, marker.Length, 0);
if (!marker.SequenceEqual(HeaderMarker1))
throw new ImageFormatInvalid();
stream.Read(marker, marker.Length, 2);
while (true)
{
if (marker.SequenceEqual(HeaderMarker2))
break;
try
{
stream.Read(marker, marker.Length);
}
catch (Exception)
{
throw new ImageFormatInvalid();
}
}
stream.Read(marker, marker.Length);
var app0 = _bit.ToUInt16(marker, 0);
var header = new byte[8];
stream.Read(header, 6);
var p = stream.Position;
stream.Read(header, header.Length);
if ((char)header[0] == 'I' && (char)header[1] == 'I')
_bit = new BitConvert(true);
else if ((char)header[0] == 'M' && (char)header[1] == 'M')
_bit = new BitConvert(false);
else
throw new ImageFormatInvalid();
if (_bit.ToInt16(header, 0x0002) != 0x002a)
throw new ImageFormatInvalid();
stream.StartOffset = p;
_tiffOffset = _bit.ToUInt32(header, 0x0004);
}
}
}
|
using Discord.WebSocket;
using JirumBot.ChromeManagers;
namespace JirumBot
{
public class Constants
{
public static QuasarManager QuasarJirumManager { get; } = new();
public static QuasarManager QuasarJirumManager2 { get; } = new(); //장터
public static CoolManager CoolJirumManager { get; } = new();
public static CoolManager CoolJirumManager2 { get; } = new(); //장터
public static PpomppuManager PpomJirumManager { get; } = new();
public static PpomppuManager PpomJirumManager2 { get; } = new(); //장터
internal static DiscordSocketClient DiscordClient { get; set; }
internal static Logger Logger { get; } = new ();
}
} |
using Minduca.Domain.Orders;
using Minduca.Domain.Payments;
using Minduca.Infrastructure;
using System;
namespace Minduca.ConsoleDemo
{
class Program
{
static void Main(string[] args)
{
IScopeFactory scopeFactory = InfraConfig.Initialize();
using (IAppLayer app = scopeFactory.CreateAppLayer())
{
IPaymentService payment = app.GetService<IPaymentService>();
IOrderPlacementService orderPlacement = app.GetService<IOrderPlacementService>();
Console.WriteLine("\n#### IPaymentService.PayOrder ####\n");
payment.PayOrder(orderId: 1, amount: 30);
app.UnitOfWork.Save();
Console.WriteLine("\n#### IOrderPlacementService.ShipOrder ####\n");
orderPlacement.ShipOrder(orderId: 1, address: "G1Q1Q9");
app.UnitOfWork.Save();
}
Console.ReadKey();
}
}
}
|
using System;
using System.IO;
using Pixelator.Api.Codec.Streams;
namespace Pixelator.Api.Codec.Compression
{
abstract class CompressionAlgorithm
{
public abstract Compression CreateCompressor(CompressionOptions options);
public abstract Decompression CreateDecompressor();
public abstract CompressionType CompressionType { get; }
public abstract class Compression : ChainableOuputStreamBase
{
protected readonly CompressionOptions Options;
protected Compression(CompressionOptions options)
{
if (options == null)
{
throw new ArgumentNullException("options");
}
Options = options;
}
}
public abstract class Decompression : ChainableInputStreamBase
{
}
}
}
|
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using Plugin.CurrentActivity;
using SuchByte.MacroDeck;
using SuchByte.MacroDeck.Droid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
[assembly: Dependency(typeof(AndroidBrightnessService))]
public class AndroidBrightnessService : IBrightnessService
{
public void SetBrightness(float brightness)
{
Device.BeginInvokeOnMainThread(() =>
{
Window window = AppInstance.MainActivity.Window;
var attributesWindow = new WindowManagerLayoutParams();
attributesWindow.CopyFrom(window.Attributes);
attributesWindow.ScreenBrightness = brightness;
window.Attributes = attributesWindow;
});
}
} |
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using tictactoe.GameMode.TurnOrder;
namespace TicTacToeTests.GameMode.TurnOrder {
[TestClass]
public class HumanFirstOrderTests
{
[TestMethod, TestCategory("unit")]
public void ShouldReturnTrue()
{
//Arrange
HumanFirstOrder subject = new HumanFirstOrder();
//Act
bool actual = subject.HumanFirst();
//Assert
actual.Should().BeTrue();
}
}
} |
using HeartDisease.Constants;
using HeartDisease.Data;
using HeartDisease.Models;
using HeartDisease.Predictors;
using HeartDisease.TestClasses;
using System;
using System.Collections.Generic;
namespace HeartDisease
{
class Program
{
static void Main(string[] args)
{
var projectInfo = new ProjectInfo()
{
AuthorFirstName = "Andrija",
AuthorLastName = "Mitrovic",
Info = "Regression between age and maximum heart rate achieved",
MethodUsed = "Ordinary Least Square Regression",
DatasetName = "Heart Disease",
DatasetUrl = "https://www.kaggle.com/ronitf/heart-disease-uci"
};
Messages.PrintProjectHeadMessage(projectInfo);
DummyTest();
HierarchyTest();
TestClasses();
ValRefTest();
Messages.PrintLoadingDataMessage("Persons");
Person[] persons = IOUtil.LoadData(DataConstants.INPUT_DATA_FILE_PATH);
StatisticInfo info = new StatisticInfo();
info.PrintStatInfo(persons);
DataService dataService = new DataService();
dataService.SetTrainingAndTestDataset(persons);
Person[] personsTraining = IOUtil.LoadData(DataConstants.TRAINING_DATA_FILE_PATH);
Person[] personsTest = IOUtil.LoadData(DataConstants.TRAINING_DATA_FILE_PATH);
double[] ages = new double[personsTraining.Length];
double[] rates = new double[personsTraining.Length];
for (int i = 0; i < personsTraining.Length - 1; i++)
{
ages[i] = personsTraining[i].Age;
rates[i] = personsTraining[i].MaxHeartRateAchieved;
}
double[] agesTest = new double[personsTraining.Length];
double[] ratesTest = new double[personsTraining.Length];
for (int i = 0; i < personsTest.Length - 1; i++)
{
agesTest[i] = personsTraining[i].Age;
ratesTest[i] = personsTraining[i].MaxHeartRateAchieved;
}
Test.DummyTest();
Test.TableData(ages, rates);
try
{
IPredictor p = new OLSPredictor(ages, rates);
double mse = Stat.MSE(ages, rates, p);
Console.WriteLine("MSE: {0}", mse);
Console.WriteLine("ME: {0}", Math.Sqrt(mse));
Console.WriteLine();
var predictedRate = p.Predict(agesTest);
var personOutput = new List<Person>();
for (int i = 0; i < personsTest.Length - 1; i++)
{
personOutput.Add(new Person(personsTest[i].Id)
{
Age = personsTest[i].Age,
MaxHeartRateAchieved = predictedRate[i]
});
}
IOUtil.SaveOutput(personOutput.ToArray());
}
catch(Exception ex)
{
Console.Write(ex.Message);
}
}
private static void DummyTest()
{
double[] x = { 63, 37, 41 };
double[] y = { 150, 187, 172 };
IPredictor p = new OLSPredictor(x, y);
double mse = Stat.MSE(x, y, p);
Console.WriteLine("MSE: {0}", mse);
Console.WriteLine("ME: {0}", Math.Sqrt(mse));
}
private static void HierarchyTest()
{
Male male = new Male(1);
Female female = new Female(2);
Console.WriteLine(male.Age);
Console.WriteLine(female.MaxHeartRateAchieved);
Console.WriteLine(male.Id);
Console.WriteLine(female.Id);
}
private static void ValRefTest()
{
Console.WriteLine("--------------------------------------");
int a = 5;
int b = a;
a = 8;
Console.WriteLine(a + " " + b);
var male1 = new Male(1);
male1.Age = 25;
var male2 = male1;
male1.Age = 30;
Console.WriteLine(male1.Age + " " + male2.Age);
Console.WriteLine("--------------------------------------");
}
private static void TestClasses()
{
try
{
OrdinaryLeastSquareTest.Test();
IOUtilTest.Test();
StateInfoTest.Test();
DataServiceTest.Test();
MaleTest.Test();
FemaleTest.Test();
PersonTest.Test();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
|
using System.Threading.Tasks;
using AutoMapper;
using DataLoaderWithEFCore.Data.Repositories;
using GraphQL.Conventions;
namespace DataLoaderWithEFCore.GraphApi.Schema
{
public sealed class Mutation
{
public async Task<Movie> UpdateMovieTitle([Inject] IMovieRepository movieRepository, UpdateMovieTitleParams @params)
=> Mapper.Map<Movie>(await movieRepository.UpdateMovieTitle(@params.Id, @params.NewTitle));
}
}
|
namespace SharpWildmatch
{
internal static class Extensions
{
public static char? At(this string value, int index)
{
if (index < 0) return null;
return index >= value.Length ? (char?)null : value[index];
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
namespace Karkas.Core.DataUtil.BaseClasses
{
public abstract class BaseBsWithoutEntity<ADOTEMPLATE_DB_TYPE, PARAMETER_BUILDER>
where ADOTEMPLATE_DB_TYPE : IAdoTemplate<IParameterBuilder>, new()
where PARAMETER_BUILDER : IParameterBuilder, new()
{
private bool isInTransaction = false;
public bool IsInTransaction
{
get
{
return isInTransaction;
}
set
{
isInTransaction = value;
if (value)
{
this.Dal.AutomaticConnectionManagement = false;
Dal.CurrentTransaction = transaction;
}
}
}
protected abstract BaseDalWithoutEntity<ADOTEMPLATE_DB_TYPE,PARAMETER_BUILDER> Dal
{
get;
}
protected DbTransaction transaction;
public void BeginTransaction()
{
if (connection.State != ConnectionState.Open)
{
connection.Open();
transaction = connection.BeginTransaction();
}
IsInTransaction = true;
}
public void CommitTransaction()
{
transaction.Commit();
}
public void ClearTransactionInformation()
{
if (connection.State == ConnectionState.Open)
{
connection.Close();
}
IsInTransaction = false;
this.Dal.AutomaticConnectionManagement = true;
}
public virtual string DatabaseName
{
get
{
return "";
}
}
private DbConnection connection;
public DbConnection Connection
{
get
{
if (connection == null)
{
connection = ConnectionSingleton.Instance.getConnection(DatabaseName);
}
return connection;
}
set { connection = value; }
}
}
}
|
using Domain.Entities.AirAnalysisContext;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Infrastructure.Persistence.Configuration
{
public class AirTestHistoryConfiguration : IEntityTypeConfiguration<AirTestHistory>
{
public void Configure(EntityTypeBuilder<AirTestHistory> builder)
{
builder.HasKey(n => n.Id);
builder.Property(n => n.Id).HasDefaultValueSql("NEWID()");
var nav = builder.Metadata.FindNavigation(nameof(AirTestHistory.AirTests));
nav.SetPropertyAccessMode(PropertyAccessMode.Field);
}
}
} |
using RPS;
using System;
using System.Windows.Forms;
namespace RockPaperScissorsWithAI
{
public partial class RockPaperScissors : Form
{
#region Public contructors
public RockPaperScissors()
{
InitializeComponent();
}
#endregion
#region Private variables
private RPSGame Game;
#endregion
#region Private methods
private void ButtonStart_Click(object sender, EventArgs e)
{
GameStart();
}
private void ButtonRestart_Click(object sender, EventArgs e)
{
PlayerPictureBox.Image = null;
ComputerPictureBox.Image = null;
RockButton.Enabled = true;
PaperButton.Enabled = true;
ScissorsButton.Enabled = true;
//Clear GUI
RoundCounter.Text = 0.ToString();
HumanScore.Text = 0.ToString();
ComputerScore.Text = 0.ToString();
//Create New RPSGame Instance
Game = new RPSGame();
}
private void RockButton_Click(object sender, EventArgs e)
{
SetComputerPickPicture(Game.GetComputerPick(Pick.Rock));
PlayerPictureBox.Image = Properties.Resources.rock;
SetRoundCount();
SetScore();
GameOverCheck();
}
private void PaperButton_Click(object sender, EventArgs e)
{
SetComputerPickPicture(Game.GetComputerPick(Pick.Paper));
PlayerPictureBox.Image = Properties.Resources.paper;
SetRoundCount();
SetScore();
GameOverCheck(); ;
}
private void ScissorsButton_Click(object sender, EventArgs e)
{
SetComputerPickPicture(Game.GetComputerPick(Pick.Scissor));
PlayerPictureBox.Image = Properties.Resources.scissors;
SetRoundCount();
SetScore();
GameOverCheck();
}
private void GameStart()
{
StartButton.Visible = false;
ButtonRestart.Visible = true; // <-- Error bejbe
RockButton.Enabled = true;
PaperButton.Enabled = true;
ScissorsButton.Enabled = true;
Game = new RPSGame();
}
private void GameOverCheck()
{
if (Game.IsGameOver)
{
RockButton.Enabled = false;
PaperButton.Enabled = false;
ScissorsButton.Enabled = false;
if (Game.Winner == Player.Human)
{
MessageBox.Show("Game Has Ended. YOU WIN!");
}
else if (Game.Winner == Player.Computer)
{
MessageBox.Show("Game Has Ended. YOU LOSE!");
}
}
}
private void SetComputerPickPicture(Pick ComputerPickPicture)
{
switch (ComputerPickPicture)
{
case Pick.Rock:
ComputerPictureBox.Image = Properties.Resources.rock;
break;
case Pick.Paper:
ComputerPictureBox.Image = Properties.Resources.paper;
break;
case Pick.Scissor:
ComputerPictureBox.Image = Properties.Resources.scissors;
break;
}
}
private void SetScore()
{
HumanScore.Text = Game.Score.HumanScore.ToString();
ComputerScore.Text = Game.Score.ComputerScore.ToString();
}
private void SetRoundCount()
{
RoundCounter.Text = Game.Rounds.Count.ToString();
}
#endregion
}
}
|
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using NUnit.Framework;
namespace Dynamo.Tests
{
[TestFixture]
[Category("JsonTestExclude")]
class MigrationTestFramework : DynamoModelTestBase
{
protected override void GetLibrariesToPreload(List<string> libraries)
{
libraries.Add("ProtoGeometry.dll");
libraries.Add("DesignScriptBuiltin.dll");
libraries.Add("DSCoreNodes.dll");
libraries.Add("DSOffice.dll");
libraries.Add("FunctionObject.ds");
libraries.Add("BuiltIn.ds");
libraries.Add("FFITarget.dll");
base.GetLibrariesToPreload(libraries);
}
/// <summary>
/// Automated creation of regression test cases.
/// </summary>
/// <param name="dynamoFilePath">The path of the dynamo workspace.</param>
[Test, TestCaseSource("SetupMigrationTests"), Category("RegressionTests")]
public void Regressions(string dynamoFilePath)
{
//ensure that the incoming arguments are not empty or null
//if a dyn file is found in the regression tests directory
Assert.IsNotNullOrEmpty(dynamoFilePath, "Dynamo file path is invalid or missing.");
//open the dyn file
OpenModel(dynamoFilePath);
AssertNoDummyNodes();
//run the expression and assert that it does not
//throw an error
Assert.DoesNotThrow(BeginRun);
}
/// <summary>
/// Method referenced by the automated regression testing setup method.
/// Populates the test cases based on file pairings in the regression tests folder.
/// </summary>
/// <returns></returns>
static List<string> SetupMigrationTests()
{
var testParameters = new List<string>();
var fi = new FileInfo(Assembly.GetExecutingAssembly().Location);
string assDir = fi.DirectoryName;
string testsLoc = Path.Combine(assDir, @"..\..\..\test\core\migration\");
var regTestPath = Path.GetFullPath(testsLoc);
var di = new DirectoryInfo(regTestPath);
var dyns = di.GetFiles("*.dyn");
foreach (var fileInfo in dyns)
{
if (fileInfo.FullName.Contains("FAILURE"))
continue;
testParameters.Add(fileInfo.FullName);
}
return testParameters;
}
}
}
|
namespace TitaniumAS.Opc.Client.Da.Browsing
{
/// <summary>
/// Represents a single element result of OPC DA server browsing.
/// </summary>
public class OpcDaBrowseElement
{
/// <summary>
/// Initializes a new instance of the <see cref="OpcDaBrowseElement"/> class.
/// </summary>
public OpcDaBrowseElement()
{
}
/// <summary>
/// A user friendly part of the namespace pointing to the element. The name can be used for display purposes in a tree control.
/// </summary>
/// <value>
/// A user friendly part of the namespace pointing to the element.
/// </value>
public string Name { get; set; }
/// <summary>
/// A value indicating whether the element has children.
/// </summary>
/// <value>
/// <c>true</c> if the element has children; otherwise, <c>false</c>.
/// </value>
public bool HasChildren { get; set; }
/// <summary>
/// A value indicating whether the element is item that can be used to Read, Write, and Subscribe.
/// </summary>
/// <value>
/// <c>true</c> if the element is item; otherwise, <c>false</c>.
/// </value>
public bool IsItem { get; set; }
/// <summary>
/// The unique identifier of the item that can be used with AddItems, Browse or GetProperties.
/// </summary>
/// <value>
/// The item identifier.
/// </value>
public string ItemId { get; set; }
/// <summary>
/// The item properties of the element.
/// </summary>
/// <value>
/// The item properties of the element.
/// </value>
public OpcDaItemProperties ItemProperties { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is hint versus being a valid item.
/// </summary>
/// <value>
/// <c>true</c> if this instance is hint; otherwise, <c>false</c>.
/// </value>
public bool IsHint
{
get { return IsItem && ItemId == null; }
}
/// <summary>
/// Returns a <see cref="System.String" /> that represents the element.
/// </summary>
/// <returns>
/// A <see cref="System.String" /> that represents the element.
/// </returns>
public override string ToString()
{
return string.Format("{0} (ItemId: {1}, IsHint: {2}, IsItem: {3}, HasChildren: {4})", Name, ItemId, IsHint, IsItem, HasChildren);
}
}
} |
using System;
using System.Collections.Generic;
namespace Unitinium
{
public class QueryParser : IQueryParser
{
public QueryAstBase[] Parse(object[] tokens)
{
var tokenQueue = new Queue<object>(tokens);
var nodeList = new List<QueryAstBase>();
while (tokenQueue.Count > 0)
{
var token = tokenQueue.Dequeue();
if (token is QuerySpecialToken specialToken)
{
var node = ProcessOperator(specialToken, tokenQueue);
nodeList.Add(node);
continue;
}
string name = null;
if (token is string idValue)
{
name = idValue;
}
else if (token is int idIntValue)
{
name = idIntValue.ToString();
}
if (name != null)
{
nodeList.Add(new QueryNameAst
{
Value = name
});
continue;
}
throw new QueryGrammarException($"Not expected {token}");
}
return nodeList.ToArray();
}
private QueryAstBase ProcessOperator(QuerySpecialToken token, Queue<object> tokenQueue)
{
if (token.Value == "$")
{
return ProcessGlobaFilter(tokenQueue);
}
if (token.Value == "#")
{
return ProcessComponentFilter(tokenQueue);
}
if (token.Value == ".")
{
return new QueryFirstExpandAst();
}
if (token.Value == "[")
{
return ProcessIndex(tokenQueue);
}
if (token.Value == "@")
{
return ProcessName(tokenQueue);
}
throw new QueryGrammarException($"Not expected operator {token.Value}");
}
private QueryAstBase ProcessName(Queue<object> tokenQueue)
{
var name = tokenQueue.Dequeue();
if (name is string | name is int)
{
return new QueryNameAst
{
Value = name
};
}
throw new QueryGrammarException($"Expected identifier after @ operator");
}
private QueryAstBase ProcessIndex(Queue<object> tokenQueue)
{
var intValue = Dequeue(tokenQueue, "number");
var end = Dequeue(tokenQueue, "]");
if (intValue is int && end is QuerySpecialToken endValue && endValue.Value == "]")
{
return new QueryIndexAst
{
Value = intValue
};
}
throw new QueryGrammarException($"Expected number in [] operator");
}
private QueryAstBase ProcessComponentFilter(Queue<object> tokenQueue)
{
var name = Dequeue(tokenQueue, "identifier");
if (name is string value)
{
return new QueryComponentAst()
{
Value = value
};
}
throw new QueryGrammarException($"Expected identifier after # operator");
}
private QueryAstBase ProcessGlobaFilter(Queue<object> tokenQueue)
{
var name = tokenQueue.Dequeue();
if (name is string | name is int)
{
return new QueryGlobalAst
{
Value = name
};
}
throw new QueryGrammarException($"Expected identifier after $ operator");
}
private object Dequeue(Queue<object> tokenQueue, string expected)
{
if (tokenQueue.Count <= 0)
{
throw new QueryGrammarException($"Ecpected {expected}, but fount end of query");
}
return tokenQueue.Dequeue();
}
}
} |
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace EJ2MVCSampleBrowser.Controllers.StockChart
{
public partial class StockChartController : Controller
{
// GET: Default
public ActionResult Default()
{
//ViewBag.datasource = this.GetChartData();
return View();
}
//public DataStock[] GetChartData()
//{
// string allText = System.IO.File.ReadAllText(Server.MapPath("~/App_Data/StockChartData/aapl.js"));
// return JsonConvert.DeserializeObject<DataStock[]>(allText);
//}
}
//public class DataStock
//{
// private DateTime x;
// private double open;
// private double high;
// private double low;
// private double close;
// private double volume;
//}
} |
using System;
namespace ESIConnectionLibrary.PublicModels
{
public class V1CharactersCorporationHistory
{
public DateTime StartDate { get; set; }
public int CorporationId { get; set; }
public bool? IsDeleted { get; set; }
public int RecordId { get; set; }
}
}
|
using ExitGames.Client.Photon;
using UnityEngine;
public class BTN_choose_titan : MonoBehaviour
{
private FengGameManagerMKII fgmkii;
private void Start()
{
if (!FengGameManagerMKII.Level.PlayerTitans)
{
base.gameObject.GetComponent<UIButton>().isEnabled = false;
}
else
{
fgmkii = GameObject.Find("MultiplayerManager").GetComponent<FengGameManagerMKII>();
}
}
private void OnClick()
{
if (FengGameManagerMKII.Level.Mode == GameMode.TeamDeathmatch)
{
string text = "AHSS";
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[0], state: true);
fgmkii.needChooseSide = false;
if (!PhotonNetwork.isMasterClient && fgmkii.roundTime > 60f)
{
fgmkii.NOTSpawnPlayer(text);
fgmkii.photonView.RPC("restartGameByClient", PhotonTargets.MasterClient);
}
else
{
fgmkii.SpawnPlayer(text, "playerRespawn2");
}
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[1], state: false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[2], state: false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[3], state: false);
IN_GAME_MAIN_CAMERA.UsingTitan = false;
GameObject.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().SetHUDPosition();
PhotonNetwork.player.SetCustomProperties(new Hashtable
{
{ PhotonPlayerProperty.Character, text }
});
}
else
{
if (FengGameManagerMKII.Level.Mode == GameMode.PvPCapture)
{
fgmkii.checkpoint = GameObject.Find("PVPchkPtT");
}
string selection = GameObject.Find("PopupListCharacterTITAN").GetComponent<UIPopupList>().selection;
NGUITools.SetActive(base.transform.parent.gameObject, state: false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[0], state: true);
if ((!PhotonNetwork.isMasterClient && fgmkii.roundTime > 60f) || fgmkii.justSuicide)
{
fgmkii.justSuicide = false;
fgmkii.NOTSpawnNonAITitan(selection);
}
else
{
fgmkii.SpawnNonAITitan2(selection);
}
fgmkii.needChooseSide = false;
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[1], state: false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[2], state: false);
NGUITools.SetActive(GameObject.Find("UI_IN_GAME").GetComponent<UIReferArray>().panels[3], state: false);
IN_GAME_MAIN_CAMERA.UsingTitan = true;
GameObject.Find("MainCamera").GetComponent<IN_GAME_MAIN_CAMERA>().SetHUDPosition();
}
}
}
|
using MongoDB.Bson;
using MongoDB.Driver;
using PlayFoos.Core.Context;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PlayFoos.Core.Services
{
public class TableHeartbeatService : ITableHeartbeatService
{
private readonly IMongoCollection<Model.TableHeartbeat> _collection;
public TableHeartbeatService(IMongoContext context)
{
_collection = context.GetCollection<Model.TableHeartbeat>("TableHeartbeat");
}
public async Task<DateTime?> GetLatestAsync()
{
var result = await _collection.Find(new BsonDocument())
.SortByDescending(x => x.LastUpdatedAt)
.FirstOrDefaultAsync();
if (result == null)
return null;
return result.LastUpdatedAt;
}
public async Task UpdateAsync(DateTime timestamp, string error)
{
await _collection.InsertOneAsync(new Model.TableHeartbeat()
{
LastUpdatedAt = timestamp,
LastError = error
});
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp.Multithreading
{
public class UseWaitAll
{
public async Task<string> Show(string str)
{
Random random = new Random();
int sleepTime = random.Next(5000, 8000);
await Task.Run(() =>
{
Thread.Sleep(sleepTime);
Console.WriteLine(str);
});
return $"ok:{str}-{sleepTime}";
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Agent : MonoBehaviour
{
[SerializeField] private Sight sight;
private float movementSpeed;
private float rotationSpeed;
void Awake()
{
sight.OnEnterVision += EnteredVision;
sight.OnLeaveVision += LeftVision;
}
void Start()
{
movementSpeed = 10f;
rotationSpeed = 2f;
}
void EnteredVision(object sender, VisionEventArgs args)
{
Debug.Log($"{gameObject.name} sighted {args.collider.gameObject.name}");
if (args.collider.gameObject.name.Contains("Enemy"))
{
Destroy(args.collider.gameObject, 3f);
}
}
void LeftVision(object sender, VisionEventArgs args)
{
Debug.Log($"{gameObject.name} is no longer seeing {args.collider.gameObject.name}");
}
void FixedUpdate()
{
// To move the agent
transform.Translate(new Vector3(Time.fixedDeltaTime, 0f, 0f));
UpdateState();
Reason();
Act();
}
void UpdateState()
{
foreach (Collider collider in sight.inSight)
{
}
}
void Reason()
{
}
void Act()
{
}
void MoveTo()
{
}
}
|
namespace Commons.AppEvents
{
public class AppEventType
{
}
} |
using System;
using System.Collections.Generic;
namespace MVVM_UnitTests
{
public static class HelperMethods
{
public static string GetStringFromCollection(IEnumerable<string> collection)
{
var joinedString = String.Join(", ", collection);
return joinedString;
}
}
}
|
// 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.IO;
using System.Runtime.InteropServices;
using System.Drawing;
#if MONOMAC
using MonoMac.AppKit;
using MonoMac.CoreGraphics;
using MonoMac.Foundation;
#endif
#if IOS
using UIKit;
using CoreGraphics;
using Foundation;
#endif
#if OPENGL
#if MONOMAC
using MonoMac.OpenGL;
using GLPixelFormat = MonoMac.OpenGL.PixelFormat;
#endif
#if WINDOWS || LINUX
using OpenTK.Graphics.OpenGL;
using GLPixelFormat = OpenTK.Graphics.OpenGL.PixelFormat;
#endif
#if GLES
using OpenTK.Graphics.ES20;
using GLPixelFormat = OpenTK.Graphics.ES20.PixelFormat;
#endif
#if ANDROID
using Android.Graphics;
#endif
#endif // OPENGL
#if WINDOWS || LINUX || MONOMAC || ANGLE
using System.Drawing.Imaging;
#endif
namespace Microsoft.Xna.Framework.Graphics
{
public partial class Texture2D : Texture
{
private void PlatformConstruct(int width, int height, bool mipmap, SurfaceFormat format, SurfaceType type, bool shared)
{
this.glTarget = TextureTarget.Texture2D;
Threading.BlockOnUIThread(() =>
{
// Store the current bound texture.
var prevTexture = GraphicsExtensions.GetBoundTexture2D();
GenerateGLTextureIfRequired();
format.GetGLFormat(out glInternalFormat, out glFormat, out glType);
if (glFormat == (GLPixelFormat)All.CompressedTextureFormats)
{
var imageSize = 0;
switch (format)
{
case SurfaceFormat.RgbPvrtc2Bpp:
case SurfaceFormat.RgbaPvrtc2Bpp:
imageSize = (Math.Max(this.width, 16) * Math.Max(this.height, 8) * 2 + 7) / 8;
break;
case SurfaceFormat.RgbPvrtc4Bpp:
case SurfaceFormat.RgbaPvrtc4Bpp:
imageSize = (Math.Max(this.width, 8) * Math.Max(this.height, 8) * 4 + 7) / 8;
break;
case SurfaceFormat.RgbEtc1:
case SurfaceFormat.Dxt1:
case SurfaceFormat.Dxt1a:
case SurfaceFormat.Dxt3:
case SurfaceFormat.Dxt5:
imageSize = ((this.width + 3) / 4) * ((this.height + 3) / 4) * GraphicsExtensions.GetSize(format);
break;
default:
throw new NotSupportedException();
}
GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, glInternalFormat,
this.width, this.height, 0,
imageSize, IntPtr.Zero);
GraphicsExtensions.CheckGLError();
}
else
{
GL.TexImage2D(TextureTarget.Texture2D, 0, glInternalFormat,
this.width, this.height, 0,
glFormat, glType, IntPtr.Zero);
GraphicsExtensions.CheckGLError();
}
// Restore the bound texture.
GL.BindTexture(TextureTarget.Texture2D, prevTexture);
GraphicsExtensions.CheckGLError();
});
}
private void PlatformSetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
Threading.BlockOnUIThread(() =>
{
var elementSizeInByte = Marshal.SizeOf(typeof(T));
var dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
// Use try..finally to make sure dataHandle is freed in case of an error
try
{
var startBytes = startIndex * elementSizeInByte;
var dataPtr = (IntPtr)(dataHandle.AddrOfPinnedObject().ToInt64() + startBytes);
int x, y, w, h;
if (rect.HasValue)
{
x = rect.Value.X;
y = rect.Value.Y;
w = rect.Value.Width;
h = rect.Value.Height;
}
else
{
x = 0;
y = 0;
w = Math.Max(width >> level, 1);
h = Math.Max(height >> level, 1);
// For DXT textures the width and height of each level is a multiple of 4.
// OpenGL only: The last two mip levels require the width and height to be
// passed as 2x2 and 1x1, but there needs to be enough data passed to occupy
// a 4x4 block.
// Ref: http://www.mentby.com/Group/mac-opengl/issue-with-dxt-mipmapped-textures.html
if (_format == SurfaceFormat.Dxt1 ||
_format == SurfaceFormat.Dxt1a ||
_format == SurfaceFormat.Dxt3 ||
_format == SurfaceFormat.Dxt5)
{
if (w > 4)
w = (w + 3) & ~3;
if (h > 4)
h = (h + 3) & ~3;
}
}
// Store the current bound texture.
var prevTexture = GraphicsExtensions.GetBoundTexture2D();
GenerateGLTextureIfRequired();
GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
GraphicsExtensions.CheckGLError();
if (glFormat == (GLPixelFormat)All.CompressedTextureFormats)
{
if (rect.HasValue)
{
GL.CompressedTexSubImage2D(TextureTarget.Texture2D, level, x, y, w, h, glFormat, data.Length - startBytes, dataPtr);
GraphicsExtensions.CheckGLError();
}
else
{
GL.CompressedTexImage2D(TextureTarget.Texture2D, level, glInternalFormat, w, h, 0, data.Length - startBytes, dataPtr);
GraphicsExtensions.CheckGLError();
}
}
else
{
// Set pixel alignment to match texel size in bytes
GL.PixelStore(PixelStoreParameter.UnpackAlignment, GraphicsExtensions.GetSize(this.Format));
if (rect.HasValue)
{
GL.TexSubImage2D(TextureTarget.Texture2D, level,
x, y, w, h,
glFormat, glType, dataPtr);
GraphicsExtensions.CheckGLError();
}
else
{
GL.TexImage2D(TextureTarget.Texture2D, level,
glInternalFormat,
w, h, 0, glFormat, glType, dataPtr);
GraphicsExtensions.CheckGLError();
}
// Return to default pixel alignment
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 4);
}
#if !ANDROID
GL.Finish();
GraphicsExtensions.CheckGLError();
#endif
// Restore the bound texture.
GL.BindTexture(TextureTarget.Texture2D, prevTexture);
GraphicsExtensions.CheckGLError();
}
finally
{
dataHandle.Free();
}
#if !ANDROID
// Required to make sure that any texture uploads on a thread are completed
// before the main thread tries to use the texture.
GL.Finish();
#endif
});
}
private void PlatformGetData<T>(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
{
#if GLES
// TODO: check for data size and for non renderable formats (formats that can't be attached to FBO)
var framebufferId = 0;
#if (IOS || ANDROID)
GL.GenFramebuffers(1, out framebufferId);
#else
GL.GenFramebuffers(1, ref framebufferId);
#endif
GraphicsExtensions.CheckGLError();
GL.BindFramebuffer(FramebufferTarget.Framebuffer, framebufferId);
GraphicsExtensions.CheckGLError();
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferSlot.ColorAttachment0, TextureTarget.Texture2D, this.glTexture, 0);
GraphicsExtensions.CheckGLError();
var x = 0;
var y = 0;
var width = this.width;
var height = this.height;
if (rect.HasValue)
{
x = rect.Value.X;
y = rect.Value.Y;
width = this.Width;
height = this.Height;
}
GL.ReadPixels(x, y, width, height, this.glFormat, this.glType, data);
GraphicsExtensions.CheckGLError();
GL.DeleteFramebuffers(1, ref framebufferId);
GraphicsExtensions.CheckGLError();
#else
GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
if (glFormat == (GLPixelFormat)All.CompressedTextureFormats)
{
throw new NotImplementedException();
}
else
{
if (rect.HasValue)
{
var temp = new T[this.width * this.height];
GL.GetTexImage(TextureTarget.Texture2D, level, this.glFormat, this.glType, temp);
int z = 0, w = 0;
for (int y = rect.Value.Y; y < rect.Value.Y + rect.Value.Height; ++y)
{
for (int x = rect.Value.X; x < rect.Value.X + rect.Value.Width; ++x)
{
data[z * rect.Value.Width + w] = temp[(y * width) + x];
++w;
}
++z;
w = 0;
}
}
else
{
GL.GetTexImage(TextureTarget.Texture2D, level, this.glFormat, this.glType, data);
}
}
#endif
}
private static Texture2D PlatformFromStream(GraphicsDevice graphicsDevice, Stream stream)
{
#if IOS || MONOMAC
#if IOS
using (var uiImage = UIImage.LoadFromData(NSData.FromStream(stream)))
#elif MONOMAC
using (var nsImage = NSImage.FromStream (stream))
#endif
{
#if IOS
var cgImage = uiImage.CGImage;
#elif MONOMAC
var rectangle = RectangleF.Empty;
var cgImage = nsImage.AsCGImage (ref rectangle, null, null);
#endif
return PlatformFromStream(graphicsDevice, cgImage);
}
#endif
#if ANDROID
using (Bitmap image = BitmapFactory.DecodeStream(stream, null, new BitmapFactory.Options
{
InScaled = false,
InDither = false,
InJustDecodeBounds = false,
InPurgeable = true,
InInputShareable = true,
}))
{
return PlatformFromStream(graphicsDevice, image);
}
#endif
#if WINDOWS || LINUX || ANGLE
Bitmap image = (Bitmap)Bitmap.FromStream(stream);
try
{
// Fix up the Image to match the expected format
image = (Bitmap)image.RGBToBGR();
var data = new byte[image.Width * image.Height * 4];
BitmapData bitmapData = image.LockBits(new System.Drawing.Rectangle(0, 0, image.Width, image.Height),
ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
if (bitmapData.Stride != image.Width * 4)
throw new NotImplementedException();
Marshal.Copy(bitmapData.Scan0, data, 0, data.Length);
image.UnlockBits(bitmapData);
Texture2D texture = null;
texture = new Texture2D(graphicsDevice, image.Width, image.Height);
texture.SetData(data);
return texture;
}
finally
{
image.Dispose();
}
#endif
}
#if IOS
[CLSCompliant(false)]
public static Texture2D FromStream(GraphicsDevice graphicsDevice, UIImage uiImage)
{
return PlatformFromStream(graphicsDevice, uiImage.CGImage);
}
#elif ANDROID
[CLSCompliant(false)]
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Bitmap bitmap)
{
return PlatformFromStream(graphicsDevice, bitmap);
}
[CLSCompliant(false)]
public void Reload(Bitmap image)
{
var width = image.Width;
var height = image.Height;
int[] pixels = new int[width * height];
if ((width != image.Width) || (height != image.Height))
{
using (Bitmap imagePadded = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888))
{
Canvas canvas = new Canvas(imagePadded);
canvas.DrawARGB(0, 0, 0, 0);
canvas.DrawBitmap(image, 0, 0, null);
imagePadded.GetPixels(pixels, 0, width, 0, 0, width, height);
imagePadded.Recycle();
}
}
else
{
image.GetPixels(pixels, 0, width, 0, 0, width, height);
}
image.Recycle();
this.SetData<int>(pixels);
}
#endif
#if MONOMAC
public static Texture2D FromStream(GraphicsDevice graphicsDevice, NSImage nsImage)
{
var rectangle = RectangleF.Empty;
var cgImage = nsImage.AsCGImage (ref rectangle, null, null);
return PlatformFromStream(graphicsDevice, cgImage);
}
#endif
#if IOS || MONOMAC
private static Texture2D PlatformFromStream(GraphicsDevice graphicsDevice, CGImage cgImage)
{
var width = cgImage.Width;
var height = cgImage.Height;
var data = new byte[width * height * 4];
var colorSpace = CGColorSpace.CreateDeviceRGB();
var bitmapContext = new CGBitmapContext(data, width, height, 8, width * 4, colorSpace, CGBitmapFlags.PremultipliedLast);
bitmapContext.DrawImage(new RectangleF(0, 0, width, height), cgImage);
bitmapContext.Dispose();
colorSpace.Dispose();
Texture2D texture = null;
Threading.BlockOnUIThread(() =>
{
texture = new Texture2D(graphicsDevice, (int)width, (int)height, false, SurfaceFormat.Color);
texture.SetData(data);
});
return texture;
}
#elif ANDROID
private static Texture2D PlatformFromStream(GraphicsDevice graphicsDevice, Bitmap image)
{
var width = image.Width;
var height = image.Height;
int[] pixels = new int[width * height];
if ((width != image.Width) || (height != image.Height))
{
using (Bitmap imagePadded = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888))
{
Canvas canvas = new Canvas(imagePadded);
canvas.DrawARGB(0, 0, 0, 0);
canvas.DrawBitmap(image, 0, 0, null);
imagePadded.GetPixels(pixels, 0, width, 0, 0, width, height);
imagePadded.Recycle();
}
}
else
{
image.GetPixels(pixels, 0, width, 0, 0, width, height);
}
image.Recycle();
// Convert from ARGB to ABGR
ConvertToABGR(height, width, pixels);
Texture2D texture = null;
Threading.BlockOnUIThread(() =>
{
texture = new Texture2D(graphicsDevice, width, height, false, SurfaceFormat.Color);
texture.SetData<int>(pixels);
});
return texture;
}
#endif
private void FillTextureFromStream(Stream stream)
{
#if ANDROID
using (Bitmap image = BitmapFactory.DecodeStream(stream, null, new BitmapFactory.Options
{
InScaled = false,
InDither = false,
InJustDecodeBounds = false,
InPurgeable = true,
InInputShareable = true,
}))
{
var width = image.Width;
var height = image.Height;
int[] pixels = new int[width * height];
image.GetPixels(pixels, 0, width, 0, 0, width, height);
// Convert from ARGB to ABGR
ConvertToABGR(height, width, pixels);
this.SetData<int>(pixels);
image.Recycle();
}
#endif
}
private void PlatformSaveAsJpeg(Stream stream, int width, int height)
{
#if MONOMAC || WINDOWS
SaveAsImage(stream, width, height, ImageFormat.Jpeg);
#elif ANDROID
SaveAsImage(stream, width, height, Bitmap.CompressFormat.Jpeg);
#else
throw new NotImplementedException();
#endif
}
private void PlatformSaveAsPng(Stream stream, int width, int height)
{
#if MONOMAC || WINDOWS
SaveAsImage(stream, width, height, ImageFormat.Png);
#elif ANDROID
SaveAsImage(stream, width, height, Bitmap.CompressFormat.Png);
#else
throw new NotImplementedException();
#endif
}
#if MONOMAC || WINDOWS
private void SaveAsImage(Stream stream, int width, int height, ImageFormat format)
{
if (stream == null)
{
throw new ArgumentNullException("stream", "'stream' cannot be null (Nothing in Visual Basic)");
}
if (width <= 0)
{
throw new ArgumentOutOfRangeException("width", width, "'width' cannot be less than or equal to zero");
}
if (height <= 0)
{
throw new ArgumentOutOfRangeException("height", height, "'height' cannot be less than or equal to zero");
}
if (format == null)
{
throw new ArgumentNullException("format", "'format' cannot be null (Nothing in Visual Basic)");
}
byte[] data = null;
GCHandle? handle = null;
Bitmap bitmap = null;
try
{
data = new byte[width * height * 4];
handle = GCHandle.Alloc(data, GCHandleType.Pinned);
GetData(data);
// internal structure is BGR while bitmap expects RGB
for(int i = 0; i < data.Length; i += 4)
{
byte temp = data[i + 0];
data[i + 0] = data[i + 2];
data[i + 2] = temp;
}
bitmap = new Bitmap(width, height, width * 4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, handle.Value.AddrOfPinnedObject());
bitmap.Save(stream, format);
}
finally
{
if (bitmap != null)
{
bitmap.Dispose();
}
if (handle.HasValue)
{
handle.Value.Free();
}
if (data != null)
{
data = null;
}
}
}
#elif ANDROID
private void SaveAsImage(Stream stream, int width, int height, Bitmap.CompressFormat format)
{
int[] data = new int[width * height];
GetData(data);
// internal structure is BGR while bitmap expects RGB
for (int i = 0; i < data.Length; ++i)
{
uint pixel = (uint)data[i];
data[i] = (int)((pixel & 0xFF00FF00) | ((pixel & 0x00FF0000) >> 16) | ((pixel & 0x000000FF) << 16));
}
using (Bitmap bitmap = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888))
{
bitmap.SetPixels(data, 0, width, 0, 0, width, height);
bitmap.Compress(format, 100, stream);
bitmap.Recycle();
}
}
#endif
// This method allows games that use Texture2D.FromStream
// to reload their textures after the GL context is lost.
private void PlatformReload(Stream textureStream)
{
GenerateGLTextureIfRequired();
FillTextureFromStream(textureStream);
}
private void GenerateGLTextureIfRequired()
{
if (this.glTexture < 0)
{
GL.GenTextures(1, out this.glTexture);
GraphicsExtensions.CheckGLError();
// For best compatibility and to keep the default wrap mode of XNA, only set ClampToEdge if either
// dimension is not a power of two.
var wrap = TextureWrapMode.Repeat;
if (((width & (width - 1)) != 0) || ((height & (height - 1)) != 0))
wrap = TextureWrapMode.ClampToEdge;
GL.BindTexture(TextureTarget.Texture2D, this.glTexture);
GraphicsExtensions.CheckGLError();
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter,
(_levelCount > 1) ? (int)TextureMinFilter.LinearMipmapLinear : (int)TextureMinFilter.Linear);
GraphicsExtensions.CheckGLError();
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter,
(int)TextureMagFilter.Linear);
GraphicsExtensions.CheckGLError();
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)wrap);
GraphicsExtensions.CheckGLError();
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)wrap);
GraphicsExtensions.CheckGLError();
}
}
}
}
|
using System.Collections.Generic;
namespace Xmf2.NavigationGraph.Core.Extensions
{
internal static class CollectionExtensions
{
// todo à mettre dans une lib d'extensions netstandard ?
public static List<T> Sublist<T>(this IList<T> source, int start, int count)
{
var result = new List<T>(count);
var end = start + count;
for (var i = start; i < end; ++i)
{
result.Add(source[i]);
}
return result;
}
}
} |
using System;
using System.Collections.Generic;
using System.IdentityModel.Services;
using System.IdentityModel.Services.Configuration;
using System.IdentityModel.Tokens;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Thinktecture.IdentityModel.Tokens;
using Thinktecture.IdentityModel.Web;
namespace WebRP
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
//PassiveSessionConfiguration.ConfigureSessionCache(new EF.EFTokenCacheRepository());
//PassiveSessionConfiguration.ConfigureMackineKeyProtectionForSessionTokens();
//PassiveSessionConfiguration.ConfigureDefaultSessionDuration(TimeSpan.FromMinutes(1));
//PassiveSessionConfiguration.ConfigurePersistentSessions(TimeSpan.FromDays(30));
//FederatedAuthentication.SessionAuthenticationModule.IsReferenceMode
}
public override void Init()
{
//PassiveModuleConfiguration.CacheSessionsOnServer();
//PassiveModuleConfiguration.EnableSlidingSessionExpirations();
//PassiveModuleConfiguration.OverrideWSFedTokenLifetime();
//PassiveModuleConfiguration.SuppressLoginRedirectsForApiCalls();
//PassiveModuleConfiguration.SuppressSecurityTokenExceptions();
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Assets.Sources.ViewModels;
using Assets.Sources.Views;
using uMVVM.Sources.ViewModels;
using uMVVM.Sources.Views;
using UnityEngine;
namespace Assets.Sources.Infrastructure
{
public class FaceBoxInstall : MonoBehaviour
{
public FaceBoxView FaceBoxView;
void Start()
{
//绑定上下文
FaceBoxView.BindingContext = new FaceBoxViewModel();
//立刻显示
FaceBoxView.Reveal();
}
}
}
|
using System.Linq;
using Highway.Data;
using TT.Domain.Identity.DTOs;
using TT.Domain.Identity.Entities;
namespace TT.Domain.Identity.Queries
{
public class GetCaptchaEntry : DomainQuerySingle<CaptchaEntryDetail>
{
public string UserId { get; set; }
public override CaptchaEntryDetail Execute(IDataContext context)
{
ContextQuery = ctx =>
{
return ctx.AsQueryable<CaptchaEntry>()
.Where(p => p.User.Id == UserId)
.ProjectToFirstOrDefault<CaptchaEntryDetail>();
};
return ExecuteInternal(context);
}
}
}
|
using System;
using System.IO;
namespace MultiGitClone
{
class Program
{
static void Main()
{
Action<string> display = Console.WriteLine;
display("Multi GIT Clone");
var urlGitClone = "https://github.com/francoistonic/programmez";
var urlGitCloneEndString = ".git";
var gitCloneStartNumber = 232;
var gitCloneEndNumber = 242;
display($"Starting to clone from {gitCloneStartNumber}");
for (int i = gitCloneStartNumber; i <= gitCloneEndNumber; i++)
{
if (File.Exists(ExtractUrl(urlGitClone + i)))
{
// start a git update
}
else
{
// create a git clone url
}
}
display("Press any key to exit:");
Console.ReadKey();
}
public static string ExtractUrl(string url)
{
var tmpList = url.Split('/');
return tmpList[tmpList.Length];
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.SPOT.Emulator.PKCS11;
using System.Reflection;
using System.IO;
using System.Windows.Forms;
namespace Microsoft.SPOT.Emulator.Update
{
internal class UpdateValidationProvider : HalDriver<IUpdateDriver>, IUpdateValidationDriver
{
public enum MFUpdateType : uint
{
FirmwareUpdate,
AssemblyUpdate,
KeyUpdate,
UserDefined = 0x80000000
}
#region IUpdateProvider Members
public bool AuthCommand(MFUpdate_Emu update, uint cmd, IntPtr pArgs, int argsLen, IntPtr pResponse, ref int responseLen)
{
return true;
}
public bool Authenticate(MFUpdate_Emu update, IntPtr pAuth, int authLen)
{
return true;
}
public bool ValidatePacket(MFUpdate_Emu update, IntPtr packet, int packetLen, IntPtr validationData, int validationLen)
{
bool valid = false;
switch((MFUpdateType)update.Header.UpdateType)
{
case MFUpdateType.AssemblyUpdate:
HashAlgorithm alg = null;
switch (validationLen)
{
case 512 / 8:
alg = new SHA512Cng();
break;
case 256 / 8:
alg = new SHA256Cng();
break;
case 384 / 8:
alg = new SHA384Cng();
break;
case 160 / 8:
alg = new SHA1Cng();
break;
}
if(alg != null)
{
byte[] data = new byte[packetLen];
Marshal.Copy(packet, data, 0, packetLen);
byte[] hash = alg.ComputeHash(data);
if(hash.Length == validationLen)
{
valid = true;
byte[] vHash = new byte[validationLen];
Marshal.Copy(validationData, vHash, 0, validationLen);
for(int i=0; i<validationLen; i++)
{
if (vHash[i] != hash[i])
{
valid = false;
break;
}
}
}
}
break;
case MFUpdateType.FirmwareUpdate:
valid = true;
break;
case MFUpdateType.KeyUpdate:
// TODO:
break;
}
return valid;
}
public bool ValidateUpdate(MFUpdate_Emu update, IntPtr pValidation, int validationLen)
{
// todo: add signature check
return true;
}
#endregion
}
}
|
using System;
using System.Threading;
using JsonRpc.Messages;
namespace JsonRpc.Server
{
/// <summary>
/// Provides the context per JSON RPC request.
/// </summary>
public class RequestContext
{
public RequestContext(IJsonRpcServiceHost serviceHost, IServiceFactory serviceFactory,
IFeatureCollection features, RequestMessage request, CancellationToken cancellationToken)
{
ServiceHost = serviceHost ?? throw new ArgumentNullException(nameof(serviceHost));
ServiceFactory = serviceFactory;
Request = request ?? throw new ArgumentNullException(nameof(request));
Features = features;
if (!request.IsNotification)
Response = new ResponseMessage(request.Id);
CancellationToken = cancellationToken;
}
/// <summary>
/// Gets the service host that initiates this request.
/// </summary>
public IJsonRpcServiceHost ServiceHost { get; }
/// <summary>
/// The factory that creates the JSON RPC service instances to handle the requests.
/// </summary>
public IServiceFactory ServiceFactory { get; }
/// <summary>
/// The features provided with the request.
/// </summary>
public IFeatureCollection Features { get; }
/// <summary>
/// Gets the request message.
/// </summary>
public RequestMessage Request { get; }
/// <summary>
/// The response message to be sent. If this property is not <c>null</c>,
/// it will take precedence to the return value of the invoked CLR method.
/// </summary>
public ResponseMessage Response { get; }
/// <summary>
/// The <see cref="CancellationToken"/> used to cancel this request. This token may be
/// checked in the RPC method.
/// </summary>
public CancellationToken CancellationToken { get; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EncompassREST.Data
{
public class VaLoanData
{
public bool? rangeOvenIndicator { get; set; }
public bool? refrigeratorIndicator { get; set; }
public bool? dishwasherIndicator { get; set; }
public bool? clothesWasherIndicator { get; set; }
public bool? dryerIndicator { get; set; }
public bool? garbageDisposalIndicator { get; set; }
public bool? ventFanIndicator { get; set; }
public bool? wWCarpetIndicator { get; set; }
public string equipmentOtherDescription { get; set; }
public bool? noEnergyImprovements { get; set; }
public bool? solarHeatingOrCooling { get; set; }
public bool? replacementOfSystem { get; set; }
public bool? energyImprovementsAdditionOfFeature { get; set; }
public bool? insulation { get; set; }
public bool? otherImprovements { get; set; }
public DateTime? dateOfAssignment { get; set; }
public decimal? acres { get; set; }
public string buildingType { get; set; }
public string numberOfBuildings { get; set; }
public string availableForInspectionDateAndTime { get; set; }
public string keysAtAddress { get; set; }
public bool? availableForInspectionAMIndicator { get; set; }
public string streetAccess { get; set; }
public string streetMaintenance { get; set; }
public bool? constructionWarrantyIncluded { get; set; }
public string nameOfWarrantyProgram { get; set; }
public DateTime? warrantyProgramExpirationDate { get; set; }
public DateTime? constructionCompletedDate { get; set; }
public string nameOfOwner { get; set; }
public string propertyOccupancyType { get; set; }
public string rent { get; set; }
public string nameOfOccupant { get; set; }
public string occupantTelephone { get; set; }
public string propertyLegalDescription1 { get; set; }
public string propertyLegalDescription2 { get; set; }
public string propertyLegalDescription3 { get; set; }
public string propertyLegalDescription4 { get; set; }
public string titleLimitations1 { get; set; }
public string titleLimitations2 { get; set; }
public string titleLimitations3 { get; set; }
public string loanProcedure { get; set; }
public string militaryBranchOfService { get; set; }
public string veteranServiceType { get; set; }
public string purposeOfLoan { get; set; }
public string typeOfOwnsership { get; set; }
public string loanCode { get; set; }
public string typeOfMortgage { get; set; }
public decimal? amountSpentOnEnergyImprovements { get; set; }
public string appraisalType { get; set; }
public string manufacturedHome { get; set; }
public string typeOfStructure { get; set; }
public string propertyDesignation { get; set; }
public string mCRVNumber { get; set; }
public bool? fundingFeeExempt { get; set; }
public string inspectionWillBeMadeBy { get; set; }
public string constructionPlan { get; set; }
public string plansSubmitted { get; set; }
public string warrantorName { get; set; }
public string warrantorAddress { get; set; }
public string warrantorPhone { get; set; }
public string specialAssessmentComments1 { get; set; }
public string specialAssessmentComments2 { get; set; }
public string specialAssessmentComments3 { get; set; }
public decimal? annualRealEstateTaxes { get; set; }
public string mineralRightsReserved { get; set; }
public string leaseholdType { get; set; }
public decimal? annualGroundRent { get; set; }
public bool? proposedSaleContractAttached { get; set; }
public string contractNoApprovedByVA { get; set; }
public string lotDimensions { get; set; }
public int? irregularLotSizeInSquareFeet { get; set; }
public string utilitiesElectricDescription { get; set; }
public string utilitiesGasDescription { get; set; }
public string utilitiesWaterDescription { get; set; }
public string utilitiesSewerDescription { get; set; }
public string insuranceType { get; set; }
public decimal? annualMaintenanceAssessment { get; set; }
public bool? buyerPurchasingLotSeparately { get; set; }
public string warrantorCity { get; set; }
public string warrantorState { get; set; }
public string warrantorPostalCode { get; set; }
public string title { get; set; }
public List<MilitaryService> militaryServices { get; set; }
public DateTime? applicantBirthDate { get; set; }
public bool? veteranDischargedIndicator { get; set; }
public string vAClaimNumber { get; set; }
public List<PreviousVaLoan> previousVaLoans { get; set; }
public string mailingAddress { get; set; }
public string mailingCity { get; set; }
public string mailingState { get; set; }
public string mailingPostalCode { get; set; }
public string vaLoanSummaryApplicantType { get; set; }
public string applicantFirstNameWithMiddleName { get; set; }
public string applicantLastNameWithSuffix { get; set; }
public string applicantTaxIdentificationIdentifier { get; set; }
public string applicantAddressStreetLine1 { get; set; }
public string applicantAddressCity { get; set; }
public string applicantAddressState { get; set; }
public string applicantAddressPostalCode { get; set; }
public string applicantEmailAddressText { get; set; }
public bool? previousVALoanIndicator { get; set; }
public string loanAnalysisRemarks1 { get; set; }
public string loanAnalysisRemarks2 { get; set; }
public string loanAnalysisRemarks3 { get; set; }
public string loanAnalysisRemarks4 { get; set; }
public string loanAnalysisRemarks5 { get; set; }
public string loanAnalysisRemarks6 { get; set; }
public string loanAnalysisRemarks7 { get; set; }
public string loanAnalysisRemarks8 { get; set; }
public string loanAnalysisRemarks9 { get; set; }
public bool? payoffIndicator1 { get; set; }
public bool? payoffIndicator2 { get; set; }
public bool? payoffIndicator3 { get; set; }
public bool? payoffIndicator4 { get; set; }
public bool? payoffIndicator5 { get; set; }
public bool? payoffIndicator6 { get; set; }
public bool? payoffIndicator7 { get; set; }
public bool? payoffIndicator8 { get; set; }
public bool? payoffIndicator9 { get; set; }
public decimal? totalDebtMonthlyPayment { get; set; }
public decimal? negativeRents { get; set; }
public decimal? cashPaymentFromVeteran { get; set; }
public decimal? finalFundingFeeAmount { get; set; }
public decimal? totalForMaxLoanAmount { get; set; }
public decimal? initialTotal { get; set; }
public decimal? preliminaryDiscountAmount { get; set; }
public decimal? originationFeeAmount { get; set; }
public decimal? preliminaryFundingFeeAmount { get; set; }
public decimal? otherClosingCosts { get; set; }
public decimal? preliminaryTotal { get; set; }
public decimal? finalDiscountAmount { get; set; }
public decimal? discountPercentage { get; set; }
public int? totalRooms { get; set; }
public decimal? totalBaths { get; set; }
public int? totalBedrooms { get; set; }
public bool? originalValueEstimateChanged { get; set; }
public string paidInFullVALoanNumber { get; set; }
public decimal? originalLoanAmount { get; set; }
public decimal? originalInterestRate { get; set; }
public string systemUsed { get; set; }
public int? originalTerm { get; set; }
public decimal? vAOriginalMonthlyPayment { get; set; }
public string vAOriginalAmortizationType { get; set; }
public decimal? vARecoupmentMonthlyDecreaseInPayment { get; set; }
public decimal? vARecoupmentTotalClosingCosts { get; set; }
public bool? vARecoupmentExcludePrepaids { get; set; }
public int? vARecoupmentClosingCosts { get; set; }
public int? vARecoupmentYears { get; set; }
public int? vARecoupmentMonths { get; set; }
public bool? vALatePaymentIn6Months { get; set; }
public string entitlementCode { get; set; }
public string riskClasification { get; set; }
public int? creditScore { get; set; }
public string typeOfHybridARM { get; set; }
public string applicantHmdaGenderType { get; set; }
public bool? vAIsDelinquent30Days { get; set; }
public string loanSummaryRemarks1 { get; set; }
public string loanSummaryRemarks2 { get; set; }
public string loanSummaryRemarks3 { get; set; }
public bool? loanProcessedUnderAU { get; set; }
public string loanSummaryRemarks4 { get; set; }
public string loanSummaryRemarks5 { get; set; }
public string loanSummaryRemarks6 { get; set; }
public string loanSummaryRemarks7 { get; set; }
public string loanSummaryRemarks8 { get; set; }
public decimal? totalDiscountPointCharged { get; set; }
public decimal? borrowerPaidDiscountPointsTotalAmount { get; set; }
public decimal? totalDiscountPointsCharged { get; set; }
public decimal? discountPoint { get; set; }
public bool? firstTimeUse { get; set; }
public string lenderSAR { get; set; }
public int? propertyGrossLivingArea { get; set; }
public int? ageOfProperty { get; set; }
public DateTime? dateSAR { get; set; }
public string administratorName { get; set; }
public string administratorContact { get; set; }
public string administratorAddress { get; set; }
public string administratorCity { get; set; }
public string administratorState { get; set; }
public string administratorPostalCode { get; set; }
public string vAClaimFolderNumber { get; set; }
public string serviceNumber { get; set; }
public bool? currentlyOnMilitaryDuty { get; set; }
public bool? onMilitaryDutyFollowingSeparation { get; set; }
public string vABenefitRelatedIndebtedness { get; set; }
public string claimDisabilityBenefits { get; set; }
public string typeOfVeteran { get; set; }
public string priorLoanType { get; set; }
public bool? automaticProcedure { get; set; }
public bool? priorApprovalProcedure { get; set; }
public bool? firstChattelLoanType { get; set; }
public bool? unsecuredLoanType { get; set; }
public bool? otherLoanType { get; set; }
public string otherDescriptionLoanType { get; set; }
public bool? otherEstateProperty { get; set; }
public string otherDescriptionEstateProperty { get; set; }
public decimal? annualSpecialAssessment { get; set; }
public decimal? totalUnpaidSpecialAssessments { get; set; }
public string nonrealtyDescription { get; set; }
public string additionalSecurityDescription { get; set; }
public DateTime? dateAquiredLand { get; set; }
public decimal? landPurchasePrice { get; set; }
public string amountTypeWithheld { get; set; }
public decimal? amountWithheld { get; set; }
public bool? reasonableValueCompleted { get; set; }
public decimal? disabilityAmountCollected { get; set; }
public decimal? pestReportFee { get; set; }
public string vATrackingSARName { get; set; }
public string vATrackingSARID { get; set; }
public bool? vATrackingIsSARLAPPCertified { get; set; }
public DateTime? vAAppraisalSentDate { get; set; }
public DateTime? vANOVDateReceived { get; set; }
public DateTime? vANOVDateReviewed { get; set; }
public DateTime? vANOVIssuedDate { get; set; }
public DateTime? vADateNOVAppraisalMailedToBorrower { get; set; }
public DateTime? vATrackingOrderedDate { get; set; }
public DateTime? vATrackingCOEIssueDate { get; set; }
public string vATrackingCOEIssueHistory { get; set; }
public DateTime? vATrackingPaidDate { get; set; }
public bool? vATrackingReceiptReceived { get; set; }
public DateTime? vATrackingLoanGuaranteeCertReceipt { get; set; }
public bool? vATrackingGSAExclusionaryListChecked { get; set; }
public DateTime? vATrackingCertOfCommitmentIssued { get; set; }
public DateTime? vATrackingMasterCommitmentLockExpired { get; set; }
public DateTime? vATrackingFinalApprovalCommitmentDate { get; set; }
public DateTime? vATrackingPurchaseContractDate { get; set; }
public bool? vATrackingInuranceFloodPolicy { get; set; }
public bool? vATrackingInuranceHazardPolicy { get; set; }
public bool? vATrackingInuranceWoodDestroyingPolicy { get; set; }
public bool? vATrackingInuranceWindOrHailPolicy { get; set; }
public string vAQualificationCountryRegion { get; set; }
public string vAQualification2ndTierEntitlement { get; set; }
public decimal? vAQualificationCountyLimits { get; set; }
public decimal? totalMonthlyPayment { get; set; }
public decimal? totalProposedMonthlyPayment { get; set; }
public bool? excludeTaxesInsuranceIndicator { get; set; }
public string emailToBeNotifiedWhenUploaded { get; set; }
public string vABuilderIDNo { get; set; }
public string pOCName { get; set; }
public string pOCAddress { get; set; }
public string pOCCity { get; set; }
public string pOCState { get; set; }
public string pOCZipCode { get; set; }
public string pOCPhone { get; set; }
public string vABuilderDescription { get; set; }
public string id { get; set; }
public bool? isDelinquent30Days { get; set; }
public string applicantHomePhoneNumber { get; set; }
}
}
|
// Copyright 2021 Niantic, Inc. All Rights Reserved.
using Niantic.ARDK.Utilities;
namespace Niantic.ARDK.AR.ARSessionEventArgs
{
public struct AnyARSessionInitializedArgs:
IArdkEventArgs
{
public AnyARSessionInitializedArgs(IARSession session, bool isLocal):
this()
{
Session = session;
_IsLocal = isLocal;
}
public IARSession Session { get; private set; }
internal bool _IsLocal { get; }
}
} |
//
// TwitterSignInPageRenderer.cs
// TrackMyWalks Twitter SignIn Page (iOS)
//
// Created by Steven F. Daniel on 10/08/2018.
// Copyright © 2018 GENIESOFT STUDIOS. All rights reserved.
//
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Auth;
using TrackMyWalks.iOS;
using TrackMyWalks.Views;
using TrackMyWalks.Services;
[assembly: ExportRenderer(typeof(TwitterSignInPage), typeof(TwitterSignInPageRenderer))]
namespace TrackMyWalks.iOS
{
public class TwitterSignInPageRenderer : PageRenderer
{
string oAuth_Token = String.Empty;
string oAuth_Token_Secret = String.Empty;
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
// Instance method that will display a Twitter Sign In Page
var auth = new OAuth1Authenticator(
consumerKey: TwitterAuthDetails.ConsumerKey,
consumerSecret: TwitterAuthDetails.ConsumerSecret,
requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"),
authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"),
accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"),
callbackUrl: new Uri("https://mobile.twitter.com/home"));
// Prevent displaying the Cancel button on the Twitter sign on page
auth.AllowCancel = false;
// Define our completion handler once the user has successfully signed in
auth.Completed += (object sender, AuthenticatorCompletedEventArgs e) =>
{
if (e.IsAuthenticated)
{
e.Account.Properties.TryGetValue("oauth_token", out oAuth_Token);
e.Account.Properties.TryGetValue("oauth_token_secret", out oAuth_Token_Secret);
// Instantiate our class to Store our Twitter Authentication Token
TwitterAuthDetails.StoreAuthToken(oAuth_Token);
TwitterAuthDetails.StoreTokenSecret(oAuth_Token_Secret);
TwitterAuthDetails.StoreAccountDetails(e.Account);
}
// Dismiss our Twitter Authentication UI Dialog
DismissViewController(true, () =>
{
});
};
PresentViewController(auth.GetUI(), true, null);
}
}
} |
using Micky5991.Samp.Net.Framework.Elements.TextDraws;
namespace Micky5991.Samp.Net.Framework.Constants
{
/// <summary>
/// Defines useful constants for screen related calculations.
/// </summary>
public class ScreenConstants
{
/// <summary>
/// Maximum screen width used for UI elements e.g. <see cref="TextDraw"/>.
/// </summary>
public const int MaxWidth = 640;
/// <summary>
/// Maximum screen height used for UI elements e.g. <see cref="TextDraw"/>.
/// </summary>
public const int MaxHeight = 480;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.