content stringlengths 23 1.05M |
|---|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[AddComponentMenu("Context/CurveFloatEvent")]
public class CurveFloatEvent : MonoBehaviour
{
public FloatEvent output;
[Tooltip("time must be between 0 and 1")]
public AnimationCurve curve;
public float time;
[ContextMenu("Invoke")]
public void Invoke()
{
StopAllCoroutines();
StartCoroutine(invoke(time));
}
public void Invoke(float t)
{
output?.Invoke(curve.Evaluate(t));
}
private IEnumerator invoke(float time)
{
float timer = 0;
while (timer < 1)
{
yield return 0;
output?.Invoke(curve.Evaluate(timer));
timer += Time.deltaTime / time;
}
output?.Invoke(curve.Evaluate(1));
}
}
|
using UnityEngine;
namespace UnemployedOwnedStates
{
public class RestAndSleep : State<Unemployed>
{
public override void Enter(Unemployed entity)
{
// 장소를 집으로 설정하고, 집에오면 스트레스, 피로가 0이 된다.
entity.CurrentLocation = Locations.SweetHome;
entity.Stress = 0;
entity.Fatigue = 0;
entity.PrintText("소파에 눕는다");
}
public override void Execute(Unemployed entity)
{
string state = Random.Range(0, 2) == 0 ? "zzZ~ zz~ zzzzZ~~" : "뒹굴뒹굴.. TV를 본다";
entity.PrintText(state);
// 지루함은 70%의 확률로 증가, 30%의 확률로 감소
entity.Bored += Random.Range(0, 100) < 70 ? 1 : -1;
// 지루함이 4 이상이면
if ( entity.Bored >= 4 )
{
// PC방에 가서 게임을 하는 "PlayAGame" 상태로 변경
entity.ChangeState(UnemployedStates.PlayAGame);
}
}
public override void Exit(Unemployed entity)
{
entity.PrintText("정리를 하지 않고 그냥 나간다.");
}
}
public class PlayAGame : State<Unemployed>
{
public override void Enter(Unemployed entity)
{
entity.CurrentLocation = Locations.PCRoom;
entity.PrintText("PC방으로 들어간다.");
}
public override void Execute(Unemployed entity)
{
entity.PrintText("게임을 열정적으로 한다. 이길 판은 이기고, 질 판은 지는거야..");
int randState = Random.Range(0, 10);
if ( randState == 0 || randState == 9 )
{
entity.Stress += 20;
// 술집에 가서 술을 마시는 "HitTheBottle" 상태로 변경
entity.ChangeState(UnemployedStates.HitTheBottle);
}
else
{
entity.Bored --;
entity.Fatigue += 2;
if ( entity.Bored <= 0 || entity.Fatigue >= 50 )
{
// 집에 가서 쉬는 "RestAndSleep" 상태로 변경
entity.ChangeState(UnemployedStates.RestAndSleep);
}
}
}
public override void Exit(Unemployed entity)
{
entity.PrintText("잘 즐겼다.");
}
}
public class HitTheBottle : State<Unemployed>
{
public override void Enter(Unemployed entity)
{
entity.CurrentLocation = Locations.Pub;
entity.PrintText("술집으로 들어간다.");
}
public override void Execute(Unemployed entity)
{
entity.PrintText("취할때까지 술을 마신다.");
// 지루함은 50%의 확률로 증가, 50%의 확률로 감소
entity.Bored += Random.Range(0, 2) == 0 ? 1 : -1;
entity.Stress -= 4;
entity.Fatigue += 4;
if ( entity.Stress <= 0 || entity.Fatigue >= 50 )
{
// 집에 가서 쉬는 "RestAndSleep" 상태로 변경
entity.ChangeState(UnemployedStates.RestAndSleep);
}
}
public override void Exit(Unemployed entity)
{
entity.PrintText("술집에서 나온다.");
}
}
public class VisitBathroom : State<Unemployed>
{
public override void Enter(Unemployed entity)
{
entity.PrintText("화장실에 들어간다.");
}
public override void Execute(Unemployed entity)
{
entity.PrintText("볼일을 본다.");
// 바로 직전 상태로 되돌아간다.
entity.RevertToPreviousState();
}
public override void Exit(Unemployed entity)
{
entity.PrintText("손을 씻고 화장실에서 나간다.");
}
}
public class StateGlobal : State<Unemployed>
{
public override void Enter(Unemployed entity)
{
}
public override void Execute(Unemployed entity)
{
if ( entity.CurrentState == UnemployedStates.VisitBathroom )
{
return;
}
int bathroomState = Random.Range(0, 100);
if ( bathroomState < 10 )
{
entity.ChangeState(UnemployedStates.VisitBathroom);
}
}
public override void Exit(Unemployed entity)
{
}
}
}
|
// This file is auto-generated, don't edit it. Thanks.
using System;
using System.Collections.Generic;
using System.IO;
using Tea;
namespace AntChain.SDK.Deps.Models
{
// 机器分组
public class MachineGroup : TeaModel {
// 机器名
[NameInMap("name")]
[Validation(Required=false)]
public string Name { get; set; }
// 所属发布服务 ID
[NameInMap("service_id")]
[Validation(Required=false)]
public string ServiceId { get; set; }
// 所属发布服务分组 ID
[NameInMap("service_group_id")]
[Validation(Required=false)]
public string ServiceGroupId { get; set; }
// 发布服务分组集合 ID
[NameInMap("service_group_collection_id")]
[Validation(Required=false)]
public string ServiceGroupCollectionId { get; set; }
// 概览 ID
[NameInMap("arrangement_id")]
[Validation(Required=false)]
public string ArrangementId { get; set; }
// 服务类型
[NameInMap("service_type")]
[Validation(Required=false)]
public string ServiceType { get; set; }
// paas 服务 ID
[NameInMap("paas_service_id")]
[Validation(Required=false)]
public string PaasServiceId { get; set; }
// 是否 beta 分组
[NameInMap("need_beta")]
[Validation(Required=false)]
public bool? NeedBeta { get; set; }
// 是否需要确认
[NameInMap("need_confirm")]
[Validation(Required=false)]
public bool? NeedConfirm { get; set; }
// 是否需要分组预确认
[NameInMap("need_reserve")]
[Validation(Required=false)]
public bool? NeedReserve { get; set; }
// 是否需要引流确认
[NameInMap("need_confirm_traffic")]
[Validation(Required=false)]
public bool? NeedConfirmTraffic { get; set; }
// 机器信息组
[NameInMap("machines")]
[Validation(Required=false)]
public List<Machine> Machines { get; set; }
// pd id
[NameInMap("process_definition_id")]
[Validation(Required=false)]
public string ProcessDefinitionId { get; set; }
// 父节点 ID
[NameInMap("parent_id")]
[Validation(Required=false)]
public string ParentId { get; set; }
// 父节点类型
[NameInMap("parent_entity_type")]
[Validation(Required=false)]
public string ParentEntityType { get; set; }
// 流程节点 ID
[NameInMap("node_id")]
[Validation(Required=false)]
public string NodeId { get; set; }
// 状态
[NameInMap("state")]
[Validation(Required=false)]
public string State { get; set; }
// 开始时间
[NameInMap("started_time")]
[Validation(Required=false, Pattern="\\d{4}[-]\\d{1,2}[-]\\d{1,2}[T]\\d{2}:\\d{2}:\\d{2}[Z]")]
public string StartedTime { get; set; }
// 结束时间
[NameInMap("finished_time")]
[Validation(Required=false, Pattern="\\d{4}[-]\\d{1,2}[-]\\d{1,2}[T]\\d{2}:\\d{2}:\\d{2}[Z]")]
public string FinishedTime { get; set; }
// 是否可以独立执行
[NameInMap("standalone_executable")]
[Validation(Required=false)]
public bool? StandaloneExecutable { get; set; }
// ID
[NameInMap("id")]
[Validation(Required=false)]
public string Id { get; set; }
}
}
|
using FlightManager.InputModels.Reservation;
using System.Threading.Tasks;
namespace FlightManager.Services.Interfaces
{
public interface IReservationService
{
Task Create(ReservationInputModel model);
T GetById<T>(int id);
}
}
|
using Jojatekok.MoneroAPI.RpcUtilities.Daemon.Http.Responses;
using System;
namespace Jojatekok.MoneroAPI.RpcManagers
{
public interface IDaemonRpcManager : IDisposable
{
event EventHandler BlockchainSynced;
event EventHandler<NetworkInformationChangedEventArgs> NetworkInformationChanged;
bool IsBlockchainSynced { get; }
NetworkInformation NetworkInformation { get; }
void Initialize();
ulong QueryCurrentBlockHeight();
BlockHeader QueryBlockHeaderLast();
BlockHeader QueryBlockHeaderByHeight(ulong height);
BlockHeader QueryBlockHeaderByHash(string hash);
MiningStatus QueryMiningStatus();
bool RequestMiningStart(string accountAddress, ulong threadsCount);
bool RequestMiningStop();
}
}
|
@using LogicalCK
@using System.Web.Configuration;
@{
Layout = null;
var imgPath = WebConfigurationManager.AppSettings["LogicalUpload.Directory"];
var directory = new DirectoryInfo(Path.Combine(Server.MapPath(imgPath), Request["directory"]));
var extensions = WebConfigurationManager.AppSettings["LogicalUpload.Extensions"];
}
@foreach (var file in directory.GetFilesByExtensions(extensions))
{
<div class="thumbnail">
<img src="/RichContent/Thumb/?image=@directory.Name\@file.Name" alt="thumb" title="@directory.Name/@file.Name" />
</div>
} |
using System.Net.Http;
using System.Threading.Tasks;
using Klinked.Cqrs.Queries;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Klinked.Cqrs.Console.Queries
{
public class HttpGetQueryHandler : IQueryHandler<string, string>
{
private readonly IHttpClientFactory _clientFactory;
public HttpGetQueryHandler(IHttpClientFactory clientFactory)
{
_clientFactory = clientFactory;
}
public async Task<string> ExecuteAsync(string args)
{
using (var client = _clientFactory.CreateClient())
{
var response = await client.GetAsync(args);
response.EnsureSuccessStatusCode();
return await response.Content.ReadAsStringAsync();
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
namespace HydroDesktop.Interfaces.ObjectModel
{
/// <summary>
/// Base Entity overrides the comparison operators
/// so that the persistence tests will work when comparing
/// referenced entities during testing.
/// </summary>
/// <remarks>From http://pastie.org/434198</remarks>
[Serializable]
public class BaseEntity : IEquatable<BaseEntity>, ICloneable
{
/// <summary>
/// Id (primary key) of the entity
/// </summary>
public virtual long Id { get; set; }
/// <summary>
/// Two entities are considered equal if they have the same Id
/// </summary>
/// <param name="other">other entity</param>
/// <returns>true if the entities are considered equal</returns>
public virtual bool Equals(BaseEntity other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
if (Id == 0 || other.Id == 0) return false;
return other.Id == Id;
}
/// <summary>
/// A base entity and another object are considered equal
/// only if they represent a reference to the same object
/// instance
/// </summary>
/// <param name="obj">the compared object</param>
/// <returns>true if the objects are considered equal</returns>
public override bool Equals(object obj)
{
if (obj.Equals(DBNull.Value)) return false;
if (ReferenceEquals(this, obj)) return true;
return Equals((BaseEntity)obj);
}
/// <summary>
/// Creates a hash code identifier using the Id
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return (Id.GetHashCode() * 397) ^ GetType().GetHashCode();
}
/// <summary>
/// equals operator for comparing two base entities
/// </summary>
/// <param name="left">left side of the operator</param>
/// <param name="right">right side of the operator</param>
/// <returns>true if entities are considered equal</returns>
public static bool operator ==(BaseEntity left, BaseEntity right)
{
return Equals(left, right);
}
/// <summary>
/// not equals operator for comparing two base entities
/// </summary>
/// <param name="left">left side of != operator</param>
/// <param name="right">right side of != operator</param>
/// <returns>true if entities are considered equal</returns>
public static bool operator !=(BaseEntity left, BaseEntity right)
{
return !Equals(left, right);
}
# region Validation
/// <summary>
/// Return true if the object is valid
/// </summary>
public virtual bool IsValid
{
get { return (!GetRuleViolations().Any()); }
}
/// <summary>
/// Show all rule violations
/// </summary>
/// <returns>rule violations</returns>
public virtual IEnumerable<RuleViolation> GetRuleViolations()
{
yield break; // basically, empty
}
#endregion
public object Clone()
{
var result = (BaseEntity)MemberwiseClone();
OnCopy(result);
return result;
}
protected virtual void OnCopy(BaseEntity copy)
{
// do nothing here
}
}
}
|
using System;
using System.Collections.Generic;
using RSG;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
namespace Unity.UIWidgets.rendering {
public enum ScrollDirection {
idle,
forward,
reverse,
}
public static class ScrollDirectionUtils {
public static ScrollDirection flipScrollDirection(ScrollDirection direction) {
switch (direction) {
case ScrollDirection.idle:
return ScrollDirection.idle;
case ScrollDirection.forward:
return ScrollDirection.reverse;
case ScrollDirection.reverse:
return ScrollDirection.forward;
}
D.assert(false);
return default(ScrollDirection);
}
}
public abstract class ViewportOffset : ChangeNotifier {
protected ViewportOffset() {
}
public static ViewportOffset @fixed(float value) {
return new _FixedViewportOffset(value);
}
public static ViewportOffset zero() {
return _FixedViewportOffset.zero();
}
public abstract float pixels { get; }
public abstract bool applyViewportDimension(float viewportDimension);
public abstract bool applyContentDimensions(float minScrollExtent, float maxScrollExtent);
public abstract void correctBy(float correction);
public abstract void jumpTo(float pixels);
public abstract IPromise animateTo(float to, TimeSpan duration, Curve curve);
public virtual IPromise moveTo(float to, TimeSpan? duration, Curve curve = null, bool clamp = true) {
if (duration == null || duration.Value == TimeSpan.Zero) {
this.jumpTo(to);
return Promise.Resolved();
} else {
return this.animateTo(to, duration: duration??TimeSpan.Zero , curve: curve ?? Curves.ease);
}
}
public abstract ScrollDirection userScrollDirection { get; }
public abstract bool allowImplicitScrolling { get; }
public override string ToString() {
var description = new List<string>();
this.debugFillDescription(description);
return Diagnostics.describeIdentity(this) + "(" + string.Join(", ", description.ToArray()) + ")";
}
protected virtual void debugFillDescription(List<string> description) {
description.Add("offset: " + this.pixels.ToString("F1"));
}
}
class _FixedViewportOffset : ViewportOffset {
internal _FixedViewportOffset(float _pixels) {
this._pixels = _pixels;
}
internal new static _FixedViewportOffset zero() {
return new _FixedViewportOffset(0.0f);
}
float _pixels;
public override float pixels {
get { return this._pixels; }
}
public override bool applyViewportDimension(float viewportDimension) {
return true;
}
public override bool applyContentDimensions(float minScrollExtent, float maxScrollExtent) {
return true;
}
public override void correctBy(float correction) {
this._pixels += correction;
}
public override void jumpTo(float pixels) {
}
public override IPromise animateTo(float to, TimeSpan duration, Curve curve) {
return Promise.Resolved();
}
public override ScrollDirection userScrollDirection {
get { return ScrollDirection.idle; }
}
public override bool allowImplicitScrolling {
get { return false; }
}
}
} |
namespace Kodefoxx.Studying.CsDesignPatterns.Shared.Domain.Accounts
{
/// <summary>
/// Represents a type of <see cref="Account"/>.
/// </summary>
public enum AccountType
{
Staff,
Student
}
}
|
namespace IdentifierScope.Iterator
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
class Sample
{
~Sample()
{
Console.WriteLine("SampleがGCされました");
}
}
public class Program
{
public static void M()
{
foreach (var i in Iterator()) ;
AsyncMethod().Wait();
}
static IEnumerable<int> Iterator()
{
var s = new Sample();
yield return 1;
Console.WriteLine("1");
// s はずっと生き残ってる。回収されない
GC.Collect();
yield return 2;
Console.WriteLine("2");
// 同上。回収されない
GC.Collect();
yield return 3;
Console.WriteLine("3");
}
static async Task AsyncMethod()
{
var s = new Sample();
await Task.Delay(1);
Console.WriteLine("1");
// s はずっと生き残ってる。回収されない
GC.Collect();
await Task.Delay(1);
Console.WriteLine("2");
// 同上。回収されない
GC.Collect();
await Task.Delay(1);
Console.WriteLine("3");
}
}
}
|
namespace LemonUI.Menus
{
/// <summary>
/// Represents the arguments of an item activation.
/// </summary>
public class ItemActivatedArgs
{
/// <summary>
/// The item that was just activated.
/// </summary>
public NativeItem Item { get; }
internal ItemActivatedArgs(NativeItem item)
{
Item = item;
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Text.Json.Serialization;
namespace SamplesDashboard.Models
{
public class GitHubGraphQLRepoData
{
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public DateTime UpdatedAt { get; set; }
public GitHubGraphQLItemCount Issues { get; set; }
public GitHubGraphQLItemCount PullRequests { get; set; }
public GitHubGraphQLItemCount Stargazers { get; set; }
public GitHubGraphQLItemCount Forks { get; set; }
[JsonPropertyName("defaultBranchRef")]
public GitHubGraphQLBranch DefaultBranch { get; set; }
public GitHubGraphQLEdgeCollection<GitHubGraphQLAlert> VulnerabilityAlerts { get; set; }
[JsonPropertyName("dependencyGraphManifests")]
public GitHubGraphQLNodeCollection<GitHubGraphQLDependencyManifest> DependencyManifests { get; set; }
}
}
|
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Fissoft.LinqIndex.Indexes;
namespace Fissoft.LinqIndex.Internal
{
internal class InternalIndexCollection<T> : IEnumerable<DictionaryHashIndex<T>>
{
private readonly Dictionary<string, DictionaryHashIndex<T>> _internalIndexList =
new Dictionary<string, DictionaryHashIndex<T>>();
public IEnumerator<DictionaryHashIndex<T>> GetEnumerator()
{
return _internalIndexList.Select(s => s.Value).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public bool ContainsIndex(string propertyName)
{
return _internalIndexList.ContainsKey(propertyName);
}
public bool RemoveIndex(string propertyName)
{
if (_internalIndexList.ContainsKey(propertyName))
return _internalIndexList.Remove(propertyName);
return false;
}
public void AddIndexFor(IndexPropertySpecification indexPropertySpecification, DictionaryHashIndex<T> index)
{
_internalIndexList.Add(indexPropertySpecification.PropertyName, index);
}
public DictionaryHashIndex<T> GetIndexByPropertyName(string propertyName)
{
return _internalIndexList[propertyName];
}
public void Clear()
{
_internalIndexList.Clear();
}
}
} |
using System;
using Newtonsoft.Json;
namespace MRTK.Tutorials.AzureCloudServices.Scripts.Dtos
{
public class ImageInfo
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("created")]
public DateTimeOffset Created { get; set; }
[JsonProperty("width")]
public int Width { get; set; }
[JsonProperty("height")]
public int Height { get; set; }
[JsonProperty("resizedImageUri")]
public string ResizedImageUri { get; set; }
[JsonProperty("originalImageUri")]
public string OriginalImageUri { get; set; }
[JsonProperty("thumbnailUri")]
public string ThumbnailUri { get; set; }
[JsonProperty("tags")]
public Tag[] Tags { get; set; }
}
} |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace AuthJanitor.IdentityServices
{
public class AuthJanitorAuthorizedUser
{
public string DisplayName { get; set; }
public string UPN { get; set; }
public string Role { get; set; }
public string RoleValue { get; set; }
}
}
|
namespace LNF.Billing
{
public interface IApportionmentDefault
{
int RoomID { get; set; }
int AccountID { get; set; }
double Percentage { get; set; }
}
}
|
using System;
using Xamarin.Forms;
using SVG.Forms.Plugin.Abstractions;
using System.Reflection;
using ExtendedMap.Forms.Plugin.Abstractions.Models;
namespace ExtendedMap.Forms.Plugin.Abstractions.Services
{
public class UIHelper
{
public ContentView CreateImageButton (string buttonImage, double height, double width,
Action tappedCallback)
{
var grid = new Grid {
RowDefinitions = new RowDefinitionCollection {
new RowDefinition {
Height = new GridLength (1, GridUnitType.Star)
},
},
ColumnDefinitions = new ColumnDefinitionCollection {
new ColumnDefinition {
Width = new GridLength (1, GridUnitType.Star)
},
},
BackgroundColor = Color.Transparent,
HorizontalOptions = LayoutOptions.Center,
RowSpacing = 5
};
var navImage = new SvgImage {
SvgPath = string.Format ("ExtendedMap.Forms.Plugin.Abstractions.Images.{0}", buttonImage),
SvgAssembly = typeof(CustomMapContentView).GetTypeInfo ().Assembly,
HorizontalOptions = LayoutOptions.Center,
HeightRequest = height,
WidthRequest = width
};
grid.GestureRecognizers.Add (new TapGestureRecognizer{ Command = new Command (tappedCallback) });
grid.Children.Add (navImage, 0, 0);
return new ContentView { Content = grid };
}
public ContentView CreateImageButton (string buttonImage, string buttonText, double height, double width,
Action tappedCallback)
{
var relativeLayout = new RelativeLayout {BackgroundColor = Color.Transparent};
relativeLayout.GestureRecognizers.Add(new TapGestureRecognizer { Command = new Command(tappedCallback) });
var svgImage = new SvgImage {
SvgPath = string.Format ("ExtendedMap.Forms.Plugin.Abstractions.Images.{0}", buttonImage),
SvgAssembly = typeof(CustomMapContentView).GetTypeInfo ().Assembly,
HeightRequest = height,
WidthRequest = width
};
var svgImageX = Device.OnPlatform (0.3,0.36,0.36);
var svgImageWidth = Device.OnPlatform (0.45,0.3,0.45);
relativeLayout.Children.Add (svgImage,
Constraint.RelativeToParent ((parent) => (parent.Width * svgImageX)),
Constraint.RelativeToParent ((parent) => (parent.Height * 0)),
Constraint.RelativeToParent ((parent) => (parent.Width * svgImageWidth)),
Constraint.RelativeToParent ((parent) => (parent.Height * 0.45))
);
var label = new Label {
Text = buttonText,
Font = Font.SystemFontOfSize (14),
TextColor = Colors.DarkBlue,
HorizontalOptions = LayoutOptions.Center
};
var stackLayout = new StackLayout ();
stackLayout.Children.Add (label);
relativeLayout.Children.Add (stackLayout,
Constraint.RelativeToParent ((parent) => (parent.Width * 0)),
Constraint.RelativeToParent ((parent) => (parent.Height * 0.6)),
Constraint.RelativeToParent ((parent) => (parent.Width * 1)),
Constraint.RelativeToParent ((parent) => (parent.Height * 0.4))
);
return new ContentView { Content = relativeLayout };
}
}
}
|
using System.ComponentModel;
namespace Shuhari.WinTools.Core.Features.BookDownload
{
public class BookDownloadContext
{
public IBookSite[] Sites { get; set; }
public int PageCount { get; set; }
public BackgroundWorker Worker { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Passenger.Attributes;
using Passenger.Drivers.RemoteWebDriver;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
namespace Passenger.Test.Unit
{
[TestFixture]
public class ExampleUsage
{
private PassengerConfiguration _testConfig;
private PageObject<Homepage> _pageObject;
[SetUp]
public void Setup()
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--headless");
chromeOptions.AddArgument("--no-sandbox");
chromeOptions.AddArgument("window-size=1400,2100");
var driver = new ChromeDriver(Environment.CurrentDirectory, chromeOptions);
_testConfig = new PassengerConfiguration
{
WebRoot = "http://www.davidwhitney.co.uk"
}.WithDriver(driver);
}
[TearDown]
public void Teardown()
{
_pageObject.Dispose();
}
[Test]
public void ExampleUsageTest()
{
_pageObject = _testConfig.StartTestAt<Homepage>();
_pageObject.Page<Homepage>().Blog.Click();
_pageObject.VerifyRedirectionTo<Blog>();
foreach (var post in _pageObject.Page<Blog>().Posts)
{
Console.WriteLine(post.Text);
}
}
}
[Uri("/")]
public class Homepage
{
// Magically wired up.
protected virtual RemoteWebDriver YayWebDriver { get; set; }
[LinkText]
public virtual IWebElement Blog { get; set; }
}
[Uri("/Blog")]
public class Blog
{
[CssSelector(".content")]
public virtual IEnumerable<IWebElement> Posts { get; set; }
}
}
|
public class FireBender : Bender
{
private double heatAggression;
public FireBender(string name, int power, double heatAggression)
:base (name,power)
{
this.heatAggression = heatAggression;
}
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq.Expressions;
using JetBrains.Annotations;
using Microsoft.Data.Entity.Utilities;
using Remotion.Linq.Clauses;
namespace Microsoft.Data.Entity.Query.Expressions
{
public class DiscriminatorPredicateExpression : Expression
{
private readonly Expression _predicate;
public DiscriminatorPredicateExpression(
[NotNull] Expression predicate, [CanBeNull] IQuerySource querySource)
{
Check.NotNull(predicate, nameof(predicate));
_predicate = predicate;
QuerySource = querySource;
}
public virtual IQuerySource QuerySource { get; }
public override ExpressionType NodeType => ExpressionType.Extension;
public override Type Type => _predicate.Type;
public override bool CanReduce => true;
public override Expression Reduce() => _predicate;
public override string ToString() => _predicate.ToString();
protected override Expression VisitChildren(ExpressionVisitor visitor)
{
var newPredicate = visitor.Visit(_predicate);
return _predicate != newPredicate
? new DiscriminatorPredicateExpression(newPredicate, QuerySource)
: this;
}
}
}
|
using System;
namespace RevStackCore.LogParser
{
public static class StringExtensions
{
public static string GetUntilOrEmpty(this string text, string stopAt = "-")
{
if (!String.IsNullOrWhiteSpace(text))
{
var charLocation = text.LastIndexOf(stopAt, StringComparison.Ordinal);
if (charLocation > 0)
{
return text.Substring(0, charLocation + 1);
}
}
return String.Empty;
}
public static string GetLastOfOrEmpty(this string text, string stopAt = "-")
{
if (!String.IsNullOrWhiteSpace(text))
{
var charLocation = text.LastIndexOf(stopAt, StringComparison.Ordinal);
if (charLocation > 0)
{
return text.Substring(charLocation + 1);
}
}
return String.Empty;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Abp.AutoMapper;
using Net.Qks.Authorization.Users.Dto;
using Net.Qks.Security;
using Net.Qks.Web.Areas.Admin.Models.Common;
namespace Net.Qks.Web.Areas.Admin.Models.Users
{
[AutoMapFrom(typeof(GetUserForEditOutput))]
public class CreateOrEditUserModalViewModel : GetUserForEditOutput, IOrganizationUnitsEditViewModel
{
public bool CanChangeUserName
{
get { return User.UserName != Authorization.Users.User.AdminUserName; }
}
public int AssignedRoleCount
{
get { return Roles.Count(r => r.IsAssigned); }
}
public bool IsEditMode
{
get { return User.Id.HasValue; }
}
public PasswordComplexitySetting PasswordComplexitySetting { get; set; }
public CreateOrEditUserModalViewModel(/*GetUserForEditOutput output*/)
{
//output.MapTo(this);
}
}
} |
using IOTConnect.Domain.IO;
using System;
using System.Collections.Generic;
using System.Text;
namespace IOTConnect.Domain.Services.Mqtt
{
public delegate void MqttMessageReceivedEventHandler(object sender, MqttReceivedEventArgs e);
public class MqttReceivedEventArgs : EventArgs
{
// -- Constructor
public MqttReceivedEventArgs(string topic, string message)
{
Topic = topic;
Message = message;
}
public T Deserialize<T>(Func<string, T> function) where T : new()
{
return function(Message);
}
public T Deserialize<T>(IAdaptable adapter) where T : new()
{
return adapter.Adapt<T, string>(Message);
}
// -- properties
public string Topic { get; private set; }
public string Message { get; private set; }
}
}
|
using System.Diagnostics;
namespace eu.sig.cspacman.board
{
public class Board : IBoard
{
private readonly Square[,] board;
public int Width
{
get { return board.GetLength(0); }
}
public int Height
{
get { return board.GetLength(1); }
}
public Board(Square[,] grid)
{
Debug.Assert(grid != null);
this.board = grid;
Debug.Assert(Invariant(), "Initial grid cannot contain null squares");
}
public bool Invariant()
{
for (int x = 0; x < board.GetLength(0); x++)
{
for (int y = 0; y < board.GetLength(1); y++)
{
if (board[x, y] == null)
{
return false;
}
}
}
return true;
}
public Square SquareAt(int x, int y)
{
Debug.Assert(WithinBorders(x, y));
Square result = board[x, y];
Debug.Assert(result != null, "Follows from invariant.");
return result;
}
public bool WithinBorders(int x, int y)
{
return x >= 0 && x < Width && y >= 0 && y < Height;
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using NaughtyAttributes;
using UnityEngine;
public class AudioController : MonoBehaviour
{
private static AudioController _instance;
public static AudioController Instance => _instance;
[HideInInspector] public AudioSource audioSource;
private bool toggleAudio;
[BoxGroup("Sfx UI")]
[SerializeField]
private AudioClip _sfxButtonClick, _sfxTileLevelSelect, _sfxLevelChoose, _sfxMarketBuy, _sfxMarketSell;
[BoxGroup("Sfx Game State")]
[SerializeField] private AudioClip _sfxGameWon, _sfxGameLose, _sfxSideQuestComplete, _sfxSideQuestFail;
[BoxGroup("Sfx Units")]
[SerializeField] private AudioClip _sfxUnitSelect,
_sfxUnitRecruit,
_sfxFormSettlement,
_sfxToggleQuests,
_sfxBuildingUpgrade,
_sfxUnitUpgrade,
_sfxBuildWorkshop,
_sfxArcherAttack,
_sfxWeaponImpact,
_sfxEndTurn;
[BoxGroup("Sfx Units")]
[SerializeField] private AudioClip[] _sfxFriendlyMeleAttacks, _sfxEnemyAttacks;
[BoxGroup("Sfx Units")]
[SerializeField] private AudioClip _sfxHammerAttack;
[BoxGroup("Steps")]
[SerializeField] private AudioClip[] _sfxSteps;
public int maxUISoundsPlayed = 3, maxUnitSelectedSoundsPlayed = 1, maxMeleeAttackSoundsPlayed = 1;
public float soundCapResetSpeed = 0.55f;
private float _timePassed;
private int _uiSoundsPlayed, _unitSelectedSoundsPlayed, _meleeAttackSoundsPlayed;
private bool _isGameEndSoundPlayed;
private void Awake()
{
if (_instance == null)
_instance = this;
else
Destroy(gameObject);
}
private void Start()
{
audioSource = Camera.main.GetComponent<AudioSource>();
toggleAudio = ES3.Load(SaveController.Instance.keyAudio, true);
if (toggleAudio == false && AudioListener.volume != 0f) AudioListener.volume = 0f;
}
private void Update()
{
_timePassed += Time.deltaTime;
if (_timePassed >= soundCapResetSpeed)
{
_uiSoundsPlayed = 0;
_unitSelectedSoundsPlayed = 0;
_timePassed = 0;
_meleeAttackSoundsPlayed = 0;
}
}
public void ToggleSound()
{
toggleAudio = !toggleAudio;
if (toggleAudio)
{
AudioListener.volume = 1f;
AudioUI.Instance.imgAudioButton.sprite = AudioUI.Instance.sprAudioOn;
SFXButtonClick();
}
else
{
AudioListener.volume = 0f;
AudioUI.Instance.imgAudioButton.sprite = AudioUI.Instance.sprAudioOff;
}
SaveController.Instance.SaveAudio();
}
public void SFXButtonClick()
{
_uiSoundsPlayed++;
if (_uiSoundsPlayed > maxUISoundsPlayed) return;
audioSource.PlayOneShot(_sfxButtonClick);
//EazySoundManager.PlayUISound(_sfxButtonClick);
}
public void SFXTileLevelSelect()
{
_uiSoundsPlayed++;
if (_uiSoundsPlayed > maxUISoundsPlayed) return;
audioSource.PlayOneShot(_sfxTileLevelSelect);
//EazySoundManager.PlayUISound(_sfxTileLevelSelect);
}
public void SFXTileLevelChoose()
{
_uiSoundsPlayed++;
if (_uiSoundsPlayed > maxUISoundsPlayed) return;
audioSource.PlayOneShot(_sfxLevelChoose);
// EazySoundManager.PlayUISound(_sfxLevelChoose);
}
public void SFXMarketBuy()
{
audioSource.PlayOneShot(_sfxMarketBuy);
//EazySoundManager.PlaySound(_sfxMarketBuy);
}
public void SFXMarketSell()
{
audioSource.PlayOneShot(_sfxMarketSell);
//EazySoundManager.PlaySound(_sfxMarketSell);
}
public void SFXLevelWin()
{
if (_isGameEndSoundPlayed) return;
_isGameEndSoundPlayed = true;
if (audioSource != null) audioSource.PlayOneShot(_sfxGameWon);
//EazySoundManager.PlaySound(_sfxGameWon);
}
public void SFXLevelLose()
{
if (_isGameEndSoundPlayed) return;
_isGameEndSoundPlayed = true;
if (audioSource != null) audioSource.PlayOneShot(_sfxGameLose);
//EazySoundManager.PlaySound(_sfxGameLose);
}
public void SFXSideQuestCompleted()
{
if (audioSource != null) audioSource.PlayOneShot(_sfxSideQuestComplete);
// EazySoundManager.PlaySound(_sfxSideQuestComplete);
}
public void SFXSideQuestFailed()
{
if (audioSource != null) audioSource.PlayOneShot(_sfxSideQuestFail);
// EazySoundManager.PlaySound(_sfxSideQuestFail);
}
public void SFXRecruitUnit()
{
_unitSelectedSoundsPlayed++;
if (_unitSelectedSoundsPlayed > maxUnitSelectedSoundsPlayed) return;
audioSource.PlayOneShot(_sfxUnitRecruit, .8f);
// EazySoundManager.PlaySound(_sfxUnitRecruit, .8f);
}
public void SFXToggleQuests()
{
audioSource.PlayOneShot(_sfxToggleQuests, .8f);
// EazySoundManager.PlaySound(_sfxToggleQuests, .8f);
}
public void SFXFormSettlementOrOutpost()
{
audioSource.PlayOneShot(_sfxFormSettlement);
// EazySoundManager.PlaySound(_sfxFormSettlement);
}
public void SFXUpgradeBuilding()
{
audioSource.PlayOneShot(_sfxBuildingUpgrade);
// EazySoundManager.PlaySound(_sfxBuildingUpgrade);
}
public void SFXUpgradeUnit()
{
audioSource.PlayOneShot(_sfxUnitUpgrade);
// EazySoundManager.PlaySound(_sfxUnitUpgrade);
}
public void SFXBuildWorkshop()
{
audioSource.PlayOneShot(_sfxBuildWorkshop);
// EazySoundManager.PlaySound(_sfxBuildWorkshop);
}
public void SFXEndTurn()
{
audioSource.PlayOneShot(_sfxEndTurn, .8f);
// EazySoundManager.PlaySound(_sfxEndTurn, .8f);
}
public void SFXSelectUnit()
{
_unitSelectedSoundsPlayed++;
if (_unitSelectedSoundsPlayed > maxUnitSelectedSoundsPlayed) return;
audioSource.PlayOneShot(_sfxUnitSelect, .8f);
// EazySoundManager.PlaySound(_sfxUnitSelect, .8f);
}
public void SFXShootArrow()
{
audioSource.PlayOneShot(_sfxArcherAttack);
// EazySoundManager.PlaySound(_sfxArcherAttack);
}
public void SFXWeaponImpact()
{
audioSource.PlayOneShot(_sfxWeaponImpact);
// EazySoundManager.PlaySound(_sfxWeaponImpact);
}
public void SFXMeleeAttack()
{
_meleeAttackSoundsPlayed++;
if (_meleeAttackSoundsPlayed > maxMeleeAttackSoundsPlayed) return;
if (ObjectHolder.Instance.cellGrid.CurrentPlayerNumber == 0)
{
audioSource.PlayOneShot(_sfxFriendlyMeleAttacks[Random.Range(0, _sfxFriendlyMeleAttacks.Length)]);
// EazySoundManager.PlaySound(_sfxFriendlyMeleAttacks[Random.Range(0, _sfxFriendlyMeleAttacks.Length)]);
}
else
{
audioSource.PlayOneShot(_sfxEnemyAttacks[Random.Range(0, _sfxEnemyAttacks.Length)]);
// EazySoundManager.PlaySound(_sfxEnemyAttacks[Random.Range(0, _sfxEnemyAttacks.Length)]);
}
}
public void SFXHammerAttack()
{
audioSource.PlayOneShot(_sfxHammerAttack);
// EazySoundManager.PlaySound(_sfxHammerAttack);
}
public void SFXSteps()
{
StopAllCoroutines();
StartCoroutine(PlaySFXSteps());
}
private IEnumerator PlaySFXSteps()
{
for (int i = 0; i < 3; i++)
{
int random = Mathf.RoundToInt(Random.Range(0, _sfxSteps.Length));
audioSource.PlayOneShot(_sfxSteps[random], .8f);
yield return new WaitForSeconds(Random.Range(.1f, .3f));
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleWeather.Extras
{
public interface IExtrasService
{
void EnableExtras();
void DisableExtras();
bool IsEnabled();
bool IsIconPackSupported(string packKey);
bool IsWeatherAPISupported(string api);
void CheckPremiumStatus();
}
}
|
// Copyright (c) Microsoft Corporation. All Rights Reserved.
// Licensed under the MIT License.
using Datasync.Common.Test.Extensions;
using Datasync.Common.Test.Models;
using Datasync.Webservice;
using Microsoft.AspNetCore.Datasync.InMemory;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Datasync.Client.Authentication;
using Microsoft.Datasync.Client.Table;
using Microsoft.Datasync.Client.Test.Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.Datasync.Client.Test
{
[ExcludeFromCodeCoverage]
public abstract class BaseTest
{
/// <summary>
/// Required entities for a number of different tests
/// </summary>
protected const string sEndpoint = "http://localhost/tables/movies/";
protected readonly IdEntity payload = new() { Id = "db0ec08d-46a9-465d-9f5e-0066a3ee5b5f", StringValue = "test" };
protected readonly Dictionary<string, object> changes = new() { { "stringValue", "test" } };
protected const string sJsonPayload = "{\"id\":\"db0ec08d-46a9-465d-9f5e-0066a3ee5b5f\",\"stringValue\":\"test\"}";
protected const string sBadJson = "{this-is-bad-json";
protected const string sId = "db0ec08d-46a9-465d-9f5e-0066a3ee5b5f";
protected static readonly AuthenticationToken basicToken = new()
{
DisplayName = "John Smith",
ExpiresOn = DateTimeOffset.Now.AddMinutes(5),
Token = "YmFzaWMgdG9rZW4gZm9yIHRlc3Rpbmc=",
UserId = "the_doctor"
};
protected static readonly AuthenticationToken expiredToken = new()
{
DisplayName = "John Smith",
ExpiresOn = DateTimeOffset.Now.AddMinutes(-5),
Token = "YmFzaWMgdG9rZW4gZm9yIHRlc3Rpbmc=",
UserId = "the_doctor"
};
protected readonly Func<Task<AuthenticationToken>> basicRequestor = () => Task.FromResult(basicToken);
protected readonly Func<Task<AuthenticationToken>> expiredRequestor = () => Task.FromResult(expiredToken);
/// <summary>
/// A basic movie without any adornment that does not exist in the movie data. Tests must clone this
/// object and then adjust.
/// </summary>
protected readonly ClientMovie blackPantherMovie = new()
{
BestPictureWinner = true,
Duration = 134,
Rating = "PG-13",
ReleaseDate = DateTimeOffset.Parse("16-Feb-2018"),
Title = "Black Panther",
Year = 2018
};
/// <summary>
/// The test server - lazily assigned.
/// </summary>
private readonly Lazy<TestServer> _testServer = new(() => Program.CreateTestServer());
/// <summary>
/// Default client options.
/// </summary>
protected DatasyncClientOptions ClientOptions { get; } = new DatasyncClientOptions();
/// <summary>
/// The endpoint for any HttpClient that needs to communicate with the test service.
/// </summary>
protected Uri Endpoint { get => _testServer.Value.BaseAddress; }
/// <summary>
/// The mock handler that allows us to set responses and see requests.
/// </summary>
protected TestDelegatingHandler MockHandler { get; } = new TestDelegatingHandler();
/// <summary>
/// Gets a client reference for the test server.
/// </summary>
/// <returns></returns>
protected DatasyncClient CreateClientForTestServer(AuthenticationProvider authProvider = null)
{
var handler = _testServer.Value.CreateHandler();
var options = new DatasyncClientOptions { HttpPipeline = new HttpMessageHandler[] { handler } };
return authProvider == null ? new DatasyncClient(Endpoint, options) : new DatasyncClient(Endpoint, authProvider, options);
}
/// <summary>
/// Gets a client reference for mocking
/// </summary>
/// <returns></returns>
protected DatasyncClient CreateClientForMocking(AuthenticationProvider authProvider = null)
{
var options = new DatasyncClientOptions { HttpPipeline = new HttpMessageHandler[] { MockHandler } };
return authProvider == null ? new DatasyncClient(Endpoint, options) : new DatasyncClient(Endpoint, authProvider, options);
}
/// <summary>
/// Gets a reference to the repository named.
/// </summary>
/// <typeparam name="T">The type of data stored in the repository</typeparam>
/// <returns></returns>
protected InMemoryRepository<T> GetRepository<T>() where T : InMemoryTableData
=> _testServer.Value.GetRepository<T>();
/// <summary>
/// Converts an index into an ID for the Movies controller.
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public static string GetMovieId(int index) => string.Format("id-{0:000}", index);
/// <summary>
/// Creates a paging response.
/// </summary>
/// <param name="count">The count of elements to return</param>
/// <param name="totalCount">The total count</param>
/// <param name="nextLink">The next link</param>
/// <returns></returns>
protected Page<IdEntity> CreatePageOfItems(int count, long? totalCount = null, Uri nextLink = null)
{
List<IdEntity> items = new();
for (int i = 0; i < count; i++)
{
items.Add(new IdEntity { Id = Guid.NewGuid().ToString("N") });
}
var page = new Page<IdEntity> { Items = items, Count = totalCount, NextLink = nextLink };
MockHandler.AddResponse(HttpStatusCode.OK, page);
return page;
}
/// <summary>
/// A basic AsyncEnumerator.
/// </summary>
/// <param name="start"></param>
/// <param name="count"></param>
/// <returns></returns>
protected static async IAsyncEnumerable<int> RangeAsync(int start, int count, int ms = 1)
{
for (int i = 0; i < count; i++)
{
await Task.Delay(ms).ConfigureAwait(false);
yield return start + i;
}
}
/// <summary>
/// An alternate basic AsyncEnumerator that throws half way through.
/// </summary>
/// <returns></returns>
protected static async IAsyncEnumerable<int> ThrowAsync()
{
for (int i = 0; i < 100; i++)
{
await Task.Delay(1).ConfigureAwait(false);
if (i < 10)
{
yield return i;
}
else
{
throw new NotSupportedException();
}
}
}
/// <summary>
/// Wait until a condition is met - useful for testing async processes.
/// </summary>
/// <param name="func"></param>
/// <param name="ms"></param>
/// <param name="maxloops"></param>
/// <returns></returns>
protected static async Task<bool> WaitUntil(Func<bool> func, int ms = 10, int maxloops = 500)
{
int waitCtr = 0;
do
{
waitCtr++;
await Task.Delay(ms).ConfigureAwait(false);
} while (!func.Invoke() && waitCtr < maxloops);
return waitCtr < maxloops;
}
}
}
|
using System;
using Calendar.Tizen.Port;
namespace Calendar.Tizen.Mobile
{
/// <summary>
/// Represents xamarin forms of tizen platform app
/// </summary>
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
/// <summary>
/// On create method
/// </summary>
protected override void OnCreate()
{
base.OnCreate();
LoadApplication(new App());
}
/// <summary>
/// Main method of sample calendar tizen mobile
/// </summary>
/// <param name="args"> arguments</param>
static void Main(string[] args)
{
var app = new Program();
global::Xamarin.Forms.DependencyService.Register<CalendarPort>();
global::Xamarin.Forms.DependencyService.Register<SecurityPort>();
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
app.Run(args);
}
}
}
|
using Ardalis.GuardClauses;
using Microsoft.Identity.Client;
namespace backend.Services
{
public class TokenService
{
private readonly IConfidentialClientApplication _application;
public TokenService(IConfidentialClientApplication application)
{
_application = application;
}
public async Task<AuthenticationResult> GetAccessTokenAsync(HttpContext context, IEnumerable<string> scopes)
{
var userAccessToken = context.Request.Headers.Authorization
.FirstOrDefault()
?.Replace("Bearer", "");
Guard.Against.Default(userAccessToken, "userAccessToken");
var userAssertion = new UserAssertion(userAccessToken, "urn:ietf:params:oauth:grant-type:jwt-bearer");
var result = await _application.AcquireTokenOnBehalfOf(scopes, userAssertion)
.ExecuteAsync();
return result;
}
}
} |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace HidEngineTest.ReportDescriptorComposition
{
using System;
using System.Collections.Generic;
using HidEngine;
using HidEngine.ReportDescriptorComposition;
using HidEngine.ReportDescriptorItems;
using HidSpecification;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class DescriptorRangeTests
{
[TestMethod]
public void SimpleRange()
{
{
DescriptorRange range = new DescriptorRange(0, 10);
Assert.AreEqual(0, range.Minimum);
Assert.AreEqual(10, range.Maximum);
Assert.AreEqual(DescriptorRangeKind.Decimal, range.Kind);
}
{
DescriptorRange range = new DescriptorRange(DescriptorRangeKind.MaxSignedSizeRange);
Assert.IsNull(range.Minimum);
Assert.IsNull(range.Maximum);
Assert.AreEqual(DescriptorRangeKind.MaxSignedSizeRange, range.Kind);
}
{
DescriptorRange range = new DescriptorRange(DescriptorRangeKind.MaxUnsignedSizeRange);
Assert.IsNull(range.Minimum);
Assert.IsNull(range.Maximum);
Assert.AreEqual(DescriptorRangeKind.MaxUnsignedSizeRange, range.Kind);
}
{
DescriptorRange range = new DescriptorRange(10, 10);
Assert.AreEqual(10, range.Minimum);
Assert.AreEqual(10, range.Maximum);
Assert.AreEqual(DescriptorRangeKind.Decimal, range.Kind);
}
}
[TestMethod]
public void InvalidRange()
{
// Range max must always be >= min.
Assert.ThrowsException<DescriptorModuleParsingException>(() => new DescriptorRange(10, 0));
}
}
}
|
using System;
namespace AvaCarona.Domain
{
public class Carona
{
const int TOTAL_DE_VAGAS = 6;
public Colaborador Ofertante { get; set; }
public DateTime DataHoraSaida { get; set; }
public Endereco EnderecoSaida { get; set; }
public Endereco EnderecoDestino { get; set; }
public int VagasDisponiveis { get; set; }
public int TotalVagas { get; set; }
public bool CriarCarona(DateTime dataHoraSaida)
{
if (dataHoraSaida != null)
{
VagasDisponiveis;
return true;
}
return false;
}
}
}
|
using System.IO;
using CP77.CR2W.Reflection;
using FastMember;
using static CP77.CR2W.Types.Enums;
namespace CP77.CR2W.Types
{
[REDMeta]
public class GenericMessageNotification : gameuiWidgetGameController
{
[Ordinal(0)] [RED("background")] public inkWidgetReference Background { get; set; }
[Ordinal(1)] [RED("buttonCancel")] public inkWidgetReference ButtonCancel { get; set; }
[Ordinal(2)] [RED("buttonConfirm")] public inkWidgetReference ButtonConfirm { get; set; }
[Ordinal(3)] [RED("buttonHintsController")] public wCHandle<ButtonHints> ButtonHintsController { get; set; }
[Ordinal(4)] [RED("buttonHintsRoot")] public inkWidgetReference ButtonHintsRoot { get; set; }
[Ordinal(5)] [RED("buttonNo")] public inkWidgetReference ButtonNo { get; set; }
[Ordinal(6)] [RED("buttonOk")] public inkWidgetReference ButtonOk { get; set; }
[Ordinal(7)] [RED("buttonYes")] public inkWidgetReference ButtonYes { get; set; }
[Ordinal(8)] [RED("closeData")] public CHandle<GenericMessageNotificationCloseData> CloseData { get; set; }
[Ordinal(9)] [RED("data")] public CHandle<GenericMessageNotificationData> Data { get; set; }
[Ordinal(10)] [RED("isNegativeHovered")] public CBool IsNegativeHovered { get; set; }
[Ordinal(11)] [RED("isPositiveHovered")] public CBool IsPositiveHovered { get; set; }
[Ordinal(12)] [RED("libraryPath")] public inkWidgetLibraryReference LibraryPath { get; set; }
[Ordinal(13)] [RED("message")] public inkTextWidgetReference Message { get; set; }
[Ordinal(14)] [RED("root")] public inkWidgetReference Root { get; set; }
[Ordinal(15)] [RED("title")] public inkTextWidgetReference Title { get; set; }
public GenericMessageNotification(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { }
}
}
|
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// This code is generated by tool. DO NOT EDIT.
using AccelByte.Sdk.Api.Platform.Model;
using AccelByte.Sdk.Api.Platform.Operation;
using AccelByte.Sdk.Core;
namespace AccelByte.Sdk.Api.Platform.Wrapper
{
public class Fulfillment
{
private readonly AccelByteSDK _sdk;
public Fulfillment(AccelByteSDK sdk)
{
_sdk = sdk;
}
#region Operation Builders
public QueryFulfillmentHistories.QueryFulfillmentHistoriesBuilder QueryFulfillmentHistoriesOp
{
get { return Operation.QueryFulfillmentHistories.Builder.SetWrapperObject(this); }
}
public FulfillItem.FulfillItemBuilder FulfillItemOp
{
get { return Operation.FulfillItem.Builder.SetWrapperObject(this); }
}
public RedeemCode.RedeemCodeBuilder RedeemCodeOp
{
get { return Operation.RedeemCode.Builder.SetWrapperObject(this); }
}
public FulfillRewards.FulfillRewardsBuilder FulfillRewardsOp
{
get { return Operation.FulfillRewards.Builder.SetWrapperObject(this); }
}
public PublicRedeemCode.PublicRedeemCodeBuilder PublicRedeemCodeOp
{
get { return Operation.PublicRedeemCode.Builder.SetWrapperObject(this); }
}
#endregion
public Model.FulfillmentHistoryPagingSlicedResult? QueryFulfillmentHistories(QueryFulfillmentHistories input) {
var response = _sdk.RunRequest(input);
return input.ParseResponse(
response.Code,
response.ContentType,
response.Payload);
}
public Model.FulfillmentResult? FulfillItem(FulfillItem input) {
var response = _sdk.RunRequest(input);
return input.ParseResponse(
response.Code,
response.ContentType,
response.Payload);
}
public Model.FulfillmentResult? RedeemCode(RedeemCode input) {
var response = _sdk.RunRequest(input);
return input.ParseResponse(
response.Code,
response.ContentType,
response.Payload);
}
public void FulfillRewards(FulfillRewards input) {
var response = _sdk.RunRequest(input);
input.ParseResponse(
response.Code,
response.ContentType,
response.Payload);
}
public Model.FulfillmentResult? PublicRedeemCode(PublicRedeemCode input) {
var response = _sdk.RunRequest(input);
return input.ParseResponse(
response.Code,
response.ContentType,
response.Payload);
}
}
} |
using System;
using System.Collections.Generic;
using Xunit;
using static GitHub_App.Solution;
namespace Tests
{
public class Tests2
{
[Fact]
public void Test3()
{
List<int> data = new List<int>() {0, 0, 1, 1, 3, 5, 6, 7, 7};
string H = GetHours(ref data);
string M = GetMinutes(ref data);
string S = GetSeconds(ref data);
Assert.Equal("17:57:36", $"{H}:{M}:{S}");
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using EYPDataService.Entities;
using EYPDataService.DataAccess;
using System.ServiceModel.Activation;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Data;
using System.Data.OleDb;
namespace EYPDataService
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class EYPDataService : IEYPDataService
{
string excelConnStr = System.Configuration.ConfigurationManager.AppSettings["ExcelSheetConnectionString"];
public Employee GetEmployeeDetailsByEmpId(string employeeId)
{
EmployeeDataAccess dataAccess = new EmployeeDataAccess();
Employee employee = dataAccess.GetEmployeeDetailsByEmpId(employeeId);
if (employee == null)
{
ThrowHttpException("Employee Not found in system. Please upload employee details and retry");
}
return employee;
}
public void InsertEmployee(Employee employee)
{
EmployeeDataAccess dataAccess = new EmployeeDataAccess();
dataAccess.InsertEmployee(employee);
}
public void InsertQuestion(Question question)
{
QuestionDataAccess dataAccess = new QuestionDataAccess();
dataAccess.InsertQuestion(question);
}
public List<Question> GetQuestionsByQuestionType(QuestionType questionType)
{
QuestionDataAccess dataAccess = new QuestionDataAccess();
return dataAccess.GetQuestionsByQuestionType(questionType);
}
public Employee GetEmployeeFeedback(string empId)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
Employee employee = dataAccess.GetEmployeeFeedback(empId);
if (employee == null)
{
ThrowHttpException("Employee Not found in system. Please upload employee details and retry");
}
return employee;
}
public void InsertEmployeeFeedback(Employee feedback)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
dataAccess.InsertEmployeeFeedback(feedback.EmpId, feedback.ManagerId, feedback.EmployeeFeedback);
EmailHelper.SendEmail(feedback.EmployeeFeedback);
}
public List<Employee> GetSubordinateListByManagerId(string managerId)
{
EmployeeDataAccess dataAccess = new EmployeeDataAccess();
return dataAccess.GetSubordinateListByManagerId(managerId);
}
public void ImportDNASheet(string excelSheetPath)
{
DataTable table = new DataTable();
string connStr = String.Format(excelConnStr, excelSheetPath);
using (OleDbConnection conn = new OleDbConnection(connStr))
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("Select * from [DNAExport$]", conn);
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.Fill(table);
conn.Close();
}
if (table.Rows.Count > 0)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
dataAccess.InsertDNASheetData(table);
}
}
public void ImportEmployeeData(string excelSheetPath)
{
DataTable table = new DataTable();
string connStr = String.Format(excelConnStr, excelSheetPath);
using (OleDbConnection conn = new OleDbConnection(connStr))
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("Select * from [EmployeeStaticData$]", conn);
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.Fill(table);
conn.Close();
}
if (table.Rows.Count > 0)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
dataAccess.InsertEmployeeData(table);
}
}
public List<FeedbackQuesAns> GetFeedbackQuesAnsHistory(string empId, int questionId)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
return dataAccess.GetFeedbackQuesAnsHistory(empId, questionId);
}
public List<Issue> GetIssueHistory(int issueId)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
return dataAccess.GetIssueHistory(issueId);
}
public List<TrainingPlan> GetTrainingPlanHistory(int trainingPlanId)
{
EmployeeFeedbackDataAccess dataAccess = new EmployeeFeedbackDataAccess();
return dataAccess.GetTrainingPlanHistory(trainingPlanId);
}
public List<Employee> GetEmployeesByProjectName(string projectName)
{
EmployeeDataAccess dataAccess = new EmployeeDataAccess();
return dataAccess.GetEmployeesByProjectName(projectName);
}
private void ThrowHttpException(string message)
{
Exception ex = new Exception(message);
System.Web.HttpContext.Current.Response.Write(ex.Message);
throw new Exception(ex.Message, ex.InnerException);
}
}
}
|
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using TimeZoneConverter;
namespace DutchAndBold.MoneybirdSdk.Serialization
{
public class JsonTimeZoneConverter : JsonConverter<TimeZoneInfo>
{
public override TimeZoneInfo
Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) =>
TZConvert.GetTimeZoneInfo(reader.GetString());
public override void Write(Utf8JsonWriter writer, TimeZoneInfo value, JsonSerializerOptions options)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
if (writer == null)
{
throw new ArgumentNullException(nameof(writer));
}
writer.WriteStringValue(value.Id);
}
}
} |
using System;
using System.Threading.Tasks;
using DotVVM.Framework.Hosting;
namespace DotVVM.Framework.Runtime.Tracing
{
public interface IRequestTracer
{
Task TraceEvent(string eventName, IDotvvmRequestContext context);
Task EndRequest(IDotvvmRequestContext context);
Task EndRequest(IDotvvmRequestContext context, Exception exception);
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class XRSocketInteractorTag : XRSocketInteractor
{
public string targetTag;
private bool isUsing = false;
private bool realShowMesh = false;
protected override void DrawHoveredInteractables()
{
if (!isUsing && realShowMesh)
{
base.DrawHoveredInteractables();
}
}
public override bool CanSelect(XRBaseInteractable interactable)
{
return base.CanSelect(interactable) && interactable.CompareTag(targetTag);
}
protected override void OnHoverEntered(HoverEnterEventArgs args)
{
if (args.interactable.CompareTag(targetTag))
{
realShowMesh = true;
if (!isUsing)
{
GetComponent<MeshRenderer>().enabled = true;
}
}
else
{
realShowMesh = false;
}
base.OnHoverEntered(args);
}
protected override void OnHoverExited(HoverExitEventArgs args)
{
realShowMesh = false;
GetComponent<MeshRenderer>().enabled = false;
base.OnHoverExited(args);
}
protected override void OnSelectEntered(SelectEnterEventArgs args)
{
if (args.interactable.CompareTag(targetTag))
{
isUsing = true;
}
base.OnSelectEntered(args);
}
protected override void OnSelectExited(SelectExitEventArgs args)
{
if (args.interactable.CompareTag(targetTag))
{
isUsing = false;
}
base.OnSelectExited(args);
}
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace RtfPipe
{
public enum NumberingType
{
///<summary>Decimal numbering (1, 2, 3).</summary>
Numbers = 0,
///<summary>Cardinal numbering (One, Two, Three).</summary>
CardinalText = 6,
///<summary>Uppercase alphabetical numbering (A, B, C).</summary>
UpperLetter = 3,
///<summary>Uppercase Roman numbering (I, II, III).</summary>
UpperRoman = 1,
///<summary>Lowercase alphabetical numbering (a, b, c).</summary>
LowerLetter = 4,
///<summary>Lowercase Roman numbering (i, ii, iii).</summary>
LowerRoman = 2,
///<summary>Ordinal numbering (1st, 2nd, 3rd).</summary>
Ordinal = 5,
///<summary>Ordinal text numbering (First, Second, Third)</summary>
OrdinalText = 7,
///<summary>Kanji numbering without the digit character (DBNUM1)</summary>
Kanji = 10,
///<summary>Kanji numbering with the digit character (DBNUM2)</summary>
KanjiDigit = 11,
///<summary>46 phonetic katakana characters in "aiueo" order (AIUEO) (newer form – "あいうえお。。。” based on phonem matrix)</summary>
Katana1 = 12,
///<summary>46 phonetic katakana characters in "iroha" order (IROHA) (old form – “いろはにほへとちりぬるお。。。” based on haiku from long ago)</summary>
Katana2 = 13,
///<summary>Double-byte character</summary>
DoubleByte = 14,
///<summary>Single-byte character</summary>
SingleByte = 15,
///<summary>Kanji numbering 3 (DBNUM3)</summary>
Kanji3 = 16,
///<summary>Kanji numbering 4 (DBNUM4)</summary>
Kanji4 = 17,
///<summary>Circle numbering (CIRCLENUM)</summary>
Circle = 18,
///<summary>Double-byte Arabic numbering</summary>
DoubleByteArabic = 19,
///<summary>46 phonetic double-byte katakana characters (AIUEO DBCHAR)</summary>
DoubleByteKatana1 = 20,
///<summary>46 phonetic double-byte katakana characters (IROHA DBCHAR)</summary>
DoubleByteKatana2 = 21,
///<summary>Arabic with leading zero (01, 02, 03, ..., 10, 11)</summary>
LeadingZeroArabic = 22,
///<summary>Bullet (no number at all)</summary>
Bullet = 23,
///<summary>Korean numbering 2 (GANADA)</summary>
Korean2 = 24,
///<summary>Korean numbering 1 (CHOSUNG)</summary>
Korean1 = 25,
///<summary>Chinese numbering 1 (GB1)</summary>
Chinese1 = 26,
///<summary>Chinese numbering 2 (GB2)</summary>
Chinese2 = 27,
///<summary>Chinese numbering 3 (GB3)</summary>
Chinese3 = 28,
///<summary>Chinese numbering 4 (GB4)</summary>
Chinese4 = 29,
///<summary>Chinese Zodiac numbering 1 (ZODIAC1)</summary>
Zodiac1 = 30,
///<summary>Chinese Zodiac numbering 2 (ZODIAC2)</summary>
Zodiac2 = 31,
///<summary>Chinese Zodiac numbering 3 (ZODIAC3)</summary>
Zodiac3 = 32,
///<summary>Taiwanese double-byte numbering 1</summary>
TaiwaneseDoubleByte1 = 33,
///<summary>Taiwanese double-byte numbering 2</summary>
TaiwaneseDoubleByte2 = 34,
///<summary>Taiwanese double-byte numbering 3</summary>
TaiwaneseDoubleByte3 = 35,
///<summary>Taiwanese double-byte numbering 4</summary>
TaiwaneseDoubleByte4 = 36,
///<summary>Chinese double-byte numbering 1</summary>
ChineseDoubleByte1 = 37,
///<summary>Chinese double-byte numbering 2</summary>
ChineseDoubleByte2 = 38,
///<summary>Chinese double-byte numbering 3</summary>
ChineseDoubleByte3 = 39,
///<summary>Chinese double-byte numbering 4</summary>
ChineseDoubleByte4 = 40,
///<summary>Korean double-byte numbering 1</summary>
KoreanDoubleByte1 = 41,
///<summary>Korean double-byte numbering 2</summary>
KoreanDoubleByte2 = 42,
///<summary>Korean double-byte numbering 3</summary>
KoreanDoubleByte3 = 43,
///<summary>Korean double-byte numbering 4</summary>
KoreanDoubleByte4 = 44,
///<summary>Hebrew non-standard decimal</summary>
Hebrew = 45,
///<summary>Arabic Alif Ba Tah</summary>
ArabicAlif = 46,
///<summary>Hebrew Biblical standard</summary>
HebrewBiblical = 47,
///<summary>Arabic Abjad style</summary>
ArabicAbjad = 48,
///<summary>Hindi vowels</summary>
HindiVowels = 49,
///<summary>Hindi consonants</summary>
HindiConsonants = 50,
///<summary>Hindi numbers</summary>
HindiNumbers = 51,
///<summary>Hindi descriptive (cardinals)</summary>
HindiCardinals = 52,
///<summary>Thai letters</summary>
ThaiLetters = 53,
///<summary>Thai numbers</summary>
ThaiNumbers = 54,
///<summary>Thai descriptive (cardinals)</summary>
ThaiCardinals = 55,
///<summary>Vietnamese descriptive (cardinals)</summary>
VietnameseCardinals = 56,
///<summary>Page number format - # -</summary>
PageNumber = 57,
///<summary>Lower case Russian alphabet</summary>
LowerRussian = 58,
///<summary>Upper case Russian alphabet</summary>
UpperRussian = 59,
///<summary>Lower case Greek numerals (alphabet based)</summary>
LowerGreekNumerals = 60,
///<summary>Upper case Greek numerals (alphabet based)</summary>
UpperGreekNumerals = 61,
///<summary>2 leading zeros: 001, 002, ..., 100, ...</summary>
LeadingZeroArabic2 = 62,
///<summary>3 leading zeros: 0001, 0002, ..., 1000, ...</summary>
LeadingZeroArabic3 = 63,
///<summary>4 leading zeros: 00001, 00002, ..., 10000, ...</summary>
LeadingZeroArabic4 = 64,
///<summary>Lower case Turkish alphabet</summary>
LowerTurkish = 65,
///<summary>Upper case Turkish alphabet</summary>
UpperTurkish = 66,
///<summary>Lower case Bulgarian alphabet</summary>
LowerBulgarian = 67,
///<summary>Upper case Bulgarian alphabet</summary>
UpperBulgarian = 68,
///<summary>No number</summary>
NoNumber = 255,
}
}
|
namespace astron.core
{
public enum MsgTypes : ushort
{
CLIENT_HELLO = 1,
CLIENT_HELLO_RESP = 2,
// Sent by the client when it's leaving.
CLIENT_DISCONNECT = 3,
// Sent by the server when it is dropping the connection deliberately.
CLIENT_EJECT = 4,
CLIENT_HEARTBEAT = 5,
CLIENT_OBJECT_SET_FIELD = 120,
CLIENT_OBJECT_SET_FIELDS = 121,
CLIENT_OBJECT_LEAVING = 132,
CLIENT_OBJECT_LEAVING_OWNER = 161,
CLIENT_ENTER_OBJECT_REQUIRED = 142,
CLIENT_ENTER_OBJECT_REQUIRED_OTHER = 143,
CLIENT_ENTER_OBJECT_REQUIRED_OWNER = 172,
CLIENT_ENTER_OBJECT_REQUIRED_OTHER_OWNER = 173,
CLIENT_DONE_INTEREST_RESP = 204,
CLIENT_ADD_INTEREST = 200,
CLIENT_ADD_INTEREST_MULTIPLE = 201,
CLIENT_REMOVE_INTEREST = 203,
CLIENT_OBJECT_LOCATION = 140,
// These are sent internally inside the Astron cluster.
// Message Director control messages:
CONTROL_CHANNEL = 1,
CONTROL_ADD_CHANNEL = 9000,
CONTROL_REMOVE_CHANNEL = 9001,
CONTROL_ADD_RANGE = 9002,
CONTROL_REMOVE_RANGE = 9003,
CONTROL_ADD_POST_REMOVE = 9010,
CONTROL_CLEAR_POST_REMOVES = 9011,
CONTROL_SET_CON_NAME = 9012,
CONTROL_SET_CON_URL = 9013,
CONTROL_LOG_MESSAGE = 9014,
// State Server control messages:
STATESERVER_CREATE_OBJECT_WITH_REQUIRED = 2000,
STATESERVER_CREATE_OBJECT_WITH_REQUIRED_OTHER = 2001,
STATESERVER_DELETE_AI_OBJECTS = 2009,
STATESERVER_OBJECT_GET_FIELD = 2010,
STATESERVER_OBJECT_GET_FIELD_RESP = 2011,
STATESERVER_OBJECT_GET_FIELDS = 2012,
STATESERVER_OBJECT_GET_FIELDS_RESP = 2013,
STATESERVER_OBJECT_GET_ALL = 2014,
STATESERVER_OBJECT_GET_ALL_RESP = 2015,
STATESERVER_OBJECT_SET_FIELD = 2020,
STATESERVER_OBJECT_SET_FIELDS = 2021,
STATESERVER_OBJECT_DELETE_FIELD_RAM = 2030,
STATESERVER_OBJECT_DELETE_FIELDS_RAM = 2031,
STATESERVER_OBJECT_DELETE_RAM = 2032,
STATESERVER_OBJECT_SET_LOCATION = 2040,
STATESERVER_OBJECT_CHANGING_LOCATION = 2041,
STATESERVER_OBJECT_ENTER_LOCATION_WITH_REQUIRED = 2042,
STATESERVER_OBJECT_ENTER_LOCATION_WITH_REQUIRED_OTHER = 2043,
STATESERVER_OBJECT_GET_LOCATION = 2044,
STATESERVER_OBJECT_GET_LOCATION_RESP = 2045,
STATESERVER_OBJECT_SET_AI = 2050,
STATESERVER_OBJECT_CHANGING_AI = 2051,
STATESERVER_OBJECT_ENTER_AI_WITH_REQUIRED = 2052,
STATESERVER_OBJECT_ENTER_AI_WITH_REQUIRED_OTHER = 2053,
STATESERVER_OBJECT_GET_AI = 2054,
STATESERVER_OBJECT_GET_AI_RESP = 2055,
STATESERVER_OBJECT_SET_OWNER = 2060,
STATESERVER_OBJECT_CHANGING_OWNER = 2061,
STATESERVER_OBJECT_ENTER_OWNER_WITH_REQUIRED = 2062,
STATESERVER_OBJECT_ENTER_OWNER_WITH_REQUIRED_OTHER = 2063,
STATESERVER_OBJECT_GET_OWNER = 2064,
STATESERVER_OBJECT_GET_OWNER_RESP = 2065,
STATESERVER_OBJECT_GET_ZONE_OBJECT = 2100,
STATESERVER_OBJECT_GET_ZONES_OBJECTS = 2102,
STATESERVER_OBJECT_GET_CHILDREN = 2104,
STATESERVER_OBJECT_GET_ZONE_COUNT = 2110,
STATESERVER_OBJECT_GET_ZONE_COUNT_RESP = 2111,
STATESERVER_OBJECT_GET_ZONES_COUNT = 2112,
STATESERVER_OBJECT_GET_ZONES_COUNT_RESP = 2113,
STATESERVER_OBJECT_GET_CHILD_COUNT = 2114,
STATESERVER_OBJECT_GET_CHILD_COUNT_RESP = 2115,
STATESERVER_OBJECT_DELETE_ZONE = 2120,
STATESERVER_OBJECT_DELETE_ZONES = 2122,
STATESERVER_OBJECT_DELETE_CHILDREN = 2124,
// DBSS-backed-object messages:
DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS = 2200,
DBSS_OBJECT_ACTIVATE_WITH_DEFAULTS_OTHER = 2201,
DBSS_OBJECT_GET_ACTIVATED = 2207,
DBSS_OBJECT_GET_ACTIVATED_RESP = 2208,
DBSS_OBJECT_DELETE_FIELD_DISK = 2230,
DBSS_OBJECT_DELETE_FIELDS_DISK = 2231,
DBSS_OBJECT_DELETE_DISK = 2232,
// Database Server control messages:
DBSERVER_CREATE_OBJECT = 3000,
DBSERVER_CREATE_OBJECT_RESP = 3001,
DBSERVER_OBJECT_GET_FIELD = 3010,
DBSERVER_OBJECT_GET_FIELD_RESP = 3011,
DBSERVER_OBJECT_GET_FIELDS = 3012,
DBSERVER_OBJECT_GET_FIELDS_RESP = 3013,
DBSERVER_OBJECT_GET_ALL = 3014,
DBSERVER_OBJECT_GET_ALL_RESP = 3015,
DBSERVER_OBJECT_SET_FIELD = 3020,
DBSERVER_OBJECT_SET_FIELDS = 3021,
DBSERVER_OBJECT_SET_FIELD_IF_EQUALS = 3022,
DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP = 3023,
DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS = 3024,
DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP = 3025,
DBSERVER_OBJECT_SET_FIELD_IF_EMPTY = 3026,
DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP = 3027,
DBSERVER_OBJECT_DELETE_FIELD = 3030,
DBSERVER_OBJECT_DELETE_FIELDS = 3031,
DBSERVER_OBJECT_DELETE = 3032,
// Client Agent control messages:
CLIENTAGENT_SET_STATE = 1000,
CLIENTAGENT_SET_CLIENT_ID = 1001,
CLIENTAGENT_SEND_DATAGRAM = 1002,
CLIENTAGENT_EJECT = 1004,
CLIENTAGENT_DROP = 1005,
CLIENTAGENT_GET_NETWORK_ADDRESS = 1006,
CLIENTAGENT_GET_NETWORK_ADDRESS_RESP = 1007,
CLIENTAGENT_DECLARE_OBJECT = 1010,
CLIENTAGENT_UNDECLARE_OBJECT = 1011,
CLIENTAGENT_ADD_SESSION_OBJECT = 1012,
CLIENTAGENT_REMOVE_SESSION_OBJECT = 1013,
CLIENTAGENT_SET_FIELDS_SENDABLE = 1014,
CLIENTAGENT_OPEN_CHANNEL = 1100,
CLIENTAGENT_CLOSE_CHANNEL = 1101,
CLIENTAGENT_ADD_POST_REMOVE = 1110,
CLIENTAGENT_CLEAR_POST_REMOVES = 1111,
CLIENTAGENT_ADD_INTEREST = 1200,
CLIENTAGENT_ADD_INTEREST_MULTIPLE = 1201,
CLIENTAGENT_REMOVE_INTEREST = 1203,
}
}
|
namespace Rebar.RebarTarget.BytecodeInterpreter
{
public class StaticDataBuilder
{
public byte[] Data;
public StaticDataIdentifier Identifier;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SharedForms;
//adapted from Wout de Zeeuw on codeproject
public class TabbyPropertyGrid : PropertyGrid
{
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(keyData == Keys.Tab || keyData == (Keys.Tab | Keys.Shift))
{
GridItem selItem =SelectedGridItem;
GridItem root =selItem;
//find root
while(root.Parent != null)
{
root =root.Parent;
}
List<GridItem> items =new List<GridItem>();
AddExpandedItems(root, items);
if(selItem != null)
{
int idx =items.IndexOf(selItem);
if((keyData & Keys.Shift) == Keys.Shift)
{
idx--;
if(idx < 0)
{
idx =items.Count - 1;
}
SelectedGridItem =items[idx];
if(SelectedGridItem.GridItems != null
&& SelectedGridItem.GridItems.Count > 0)
{
SelectedGridItem.Expanded =false;
}
}
else
{
idx++;
if(idx >= items.Count)
{
idx =0;
}
SelectedGridItem =items[idx];
if(SelectedGridItem.GridItems.Count > 0)
{
SelectedGridItem.Expanded =true;
}
}
return true;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
void AddExpandedItems(GridItem parent, List<GridItem> items)
{
if(parent.PropertyDescriptor != null)
{
items.Add(parent);
}
if(parent.Expanded)
{
foreach(GridItem child in parent.GridItems)
{
AddExpandedItems(child, items);
}
}
}
} |
using System.Collections.Generic;
using System.Linq;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.Model;
using Amazon.Lambda.APIGatewayEvents;
using Newtonsoft.Json;
namespace ArtApi.Routes.Unauthenticated.CacheEverything
{
class GetArtist : IRoute
{
public string HttpMethod => "GET";
public string Path => "/unauthenticated/cache-everything/artist";
public void Run(APIGatewayProxyRequest request, APIGatewayProxyResponse response)
{
var items = new List<ArtistModel>();
var client = new AmazonDynamoDBClient();
var scanRequest = new ScanRequest(new ArtistModel().GetTable());
ScanResponse queryResponse = null;
do
{
if (queryResponse != null)
{
scanRequest.ExclusiveStartKey = queryResponse.LastEvaluatedKey;
}
queryResponse = client.ScanAsync(scanRequest).Result;
foreach (var item in queryResponse.Items)
{
var model = JsonConvert.DeserializeObject<ArtistModel>(Document.FromAttributeMap(item).ToJson());
items.Add(model);
}
} while (queryResponse.LastEvaluatedKey.Any());
items = items.OrderBy(x => x.Artist).ToList();
response.Body = JsonConvert.SerializeObject(items);
}
}
}
|
using Verse;
namespace RimStory
{
internal class RimStorySettings : ModSettings
{
public bool enableAll = true;
public bool enableDaysOfVictory = true;
public bool enableFunerals = true;
public bool enableIndividualThoughts = true;
public bool enableLogging = true;
public bool enableMarriageAnniversary = true;
public bool enableMemoryDay = true;
public bool ISLOGGONNARESET = false;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref enableFunerals, "enableFunerals", true);
Scribe_Values.Look(ref enableMemoryDay, "enableMemoryDay", true);
Scribe_Values.Look(ref enableMarriageAnniversary, "enableMarriageAnniversary", true);
Scribe_Values.Look(ref enableIndividualThoughts, "enableIndividualThoughts", true);
Scribe_Values.Look(ref enableDaysOfVictory, "enableDaysOfVictory", true);
Scribe_Values.Look(ref enableLogging, "enableLogging", true);
}
}
} |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UniLinks.Dependencies.Data.VO.Class;
namespace UniLinks.API.Business.Interfaces
{
public interface IClassBusiness
{
Task<ClassVO> AddTasAsync(ClassVO @class);
Task<ClassVO> FindByClassIdTaskAsync(Guid classId);
Task<int> FindCountByCourseIdTaskAsync(Guid courseId);
Task<List<ClassVO>> FindByRangeClassIdTaskAsync(HashSet<Guid> classIds);
Task<ClassVO> FindByURITaskAsync(string uri);
Task<List<ClassVO>> FindAllByCourseIdAndPeriodTaskAsync(Guid courseId, int period);
Task<List<ClassVO>> FindAllByCourseIdTaskAsync(Guid courseId);
Task<ClassVO> UpdateTaskAsync(ClassVO newClass);
Task RemoveAsync(Guid classId);
}
} |
using System;
using System.Collections;
using System.Linq;
using FistVR;
using HADES.Utilities;
using UnityEngine;
namespace HADES.Core
{
public class EnhancedMovement : HADESEnhancement
{
public float Stamina { get; private set; }
public float StaminaPercentage { get; private set; }
public float Weight
{
get
{
var qbSlots = Player.QuickbeltSlots;
var weight = 0.0f;
foreach (FVRQuickBeltSlot slot in qbSlots.Where(slot => slot.CurObject != null))
{
FVRPhysicalObject obj = slot.CurObject;
if (slot.Type == FVRQuickBeltSlot.QuickbeltSlotType.Backpack)
weight += HADESConfig.EnhancedMovement.BackpackWeightModifier;
weight += obj.Size switch
{
FVRPhysicalObject.FVRPhysicalObjectSize.Small => HADESConfig.EnhancedMovement
.SmallObjectWeightModifier,
FVRPhysicalObject.FVRPhysicalObjectSize.Medium => HADESConfig.EnhancedMovement
.MediumObjectWeightModifier,
FVRPhysicalObject.FVRPhysicalObjectSize.Large => HADESConfig.EnhancedMovement
.LargeObjectWeightModifier,
FVRPhysicalObject.FVRPhysicalObjectSize.Massive => HADESConfig.EnhancedMovement
.MassiveObjectWeightModifier,
FVRPhysicalObject.FVRPhysicalObjectSize.CantCarryBig => HADESConfig.EnhancedMovement
.CCBWeightModifer,
_ => throw new ArgumentOutOfRangeException()
};
}
return weight;
}
}
private float MaxStamina => HADESConfig.EnhancedMovement.MaxStamina;
private float StaminaGain => HADESConfig.EnhancedMovement.StaminaGain;
private float StaminaLoss => HADESConfig.EnhancedMovement.StaminaLoss;
private float PlayerSpeed => Player.GetBodyMovementSpeed();
private void Start()
{
Stamina = MaxStamina;
StaminaPercentage = MaxStamina / Stamina * 100;
}
private void Update()
{
if (!HADESConfig.EnhancedMovement.Enabled) return;
float speed = Player.GetBodyMovementSpeed();
if (speed < HADESConfig.EnhancedMovement.StaminaLossStartSpeed) return;
StartCoroutine(DrainStamina());
}
private IEnumerator DrainStamina()
{
StaminaPercentage = Stamina / MaxStamina * 100;
//Burn through the stamina, we use StaminaLoss in the loop because
//that is how many seconds are to be elapsed to completely drain the stamina.
//How much you are carrying also is a factor, so we subtract the weight from the
//number of seconds that are to be elapsed
for (float i = 0;
i < StaminaLoss - Weight; //This is how long (in seconds) it takes to drain all of the stamina
i++)
{
//If the player isn't going over the threshold, stop the function
if (PlayerSpeed < HADESConfig.EnhancedMovement.StaminaLossStartSpeed || Stamina <= 0)
yield break;
yield return Common.WAIT_A_SEX;
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BooruDownloader.Properties;
namespace BooruDownloader {
public class ApiCredentialsException : Exception {
public ApiCredentialsException(string message) : base(message) { }
public ApiCredentialsException(string message, Exception inner) : base(message, inner) { }
}
public abstract class ApiImageBoard : TaggedImageBoard {
public struct ApiCredentials {
public string Username { get; set; }
public string ApiKey { get; set; }
}
public ApiCredentials Credentials { get; set; }
public abstract Task<bool> ValidateAndSaveCredentials();
protected abstract bool ValidateSavedCredentials();
public override async Task<string> PostRequestAsync(
string base_endpoint, string endpoint, Dictionary<string, string> data) {
if (Settings.Default.UseAPI && ValidateSavedCredentials()) {
if (!ValidateSavedCredentials()) {
throw new ApiCredentialsException("Saved API credentials are not consistent");
}
if (data == null) {
data = new Dictionary<string, string>(2);
}
data.Add("login", Credentials.Username);
data.Add("api_key", Credentials.ApiKey);
}
return await base.PostRequestAsync(base_endpoint, endpoint, data);
}
}
}
|
using DSIS.Utils;
using NUnit.Framework;
namespace DSIS.Graph
{
[TestFixture]
public class HashedQueueTest
{
[Test]
public void Test_01()
{
HashedQueue<int> queue = new HashedQueue<int>();
queue.Enqueue(1);
queue.Enqueue(2);
queue.Enqueue(1);
queue.Enqueue(3);
Assert.AreEqual(1,queue.Dequeue());
Assert.AreEqual(2,queue.Dequeue());
Assert.AreEqual(3,queue.Dequeue());
}
[Test]
public void Test_02()
{
HashedQueue<int> queue = new HashedQueue<int>();
queue.Enqueue(1);
queue.Enqueue(2);
queue.Enqueue(1);
queue.Enqueue(3);
Assert.AreEqual(1,queue.Dequeue());
queue.Enqueue(1);
Assert.AreEqual(2,queue.Dequeue());
Assert.AreEqual(3,queue.Dequeue());
Assert.AreEqual(1,queue.Dequeue());
}
}
} |
namespace IntelligentPlant.DataCore.Client.Queries {
/// <summary>
/// Request for reading snapshot tag values.
/// </summary>
public class ReadSnapshotTagValuesRequest : ReadTagValuesRequest { }
}
|
using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;
namespace litefeel.crossplatformapi
{
public class ShareImplIos : ShareApi
{
[DllImport("__Internal")]
private static extern void _CPAPI_Share_ShareText(string text);
[DllImport("__Internal")]
private static extern void _CPAPI_Share_ShareImage(string imagePath, string text);
public override void ShareText(string text)
{
_CPAPI_Share_ShareText(text);
}
public override void ShareImage(string imagePath, string text = null)
{
_CPAPI_Share_ShareImage(imagePath, text);
}
}
}
|
using UnityEngine;
namespace ExcessPackage
{
public class LogEx : MonoBehaviour
{
//Turn this script into singleton
public static LogEx Debug; void Awake() {Debug = this;}
//Current log data
[SerializeField][TextArea] string logData;
//The line limit and line count
[SerializeField] int lineLimit; int lineCount;
//UI to display log
public TMPro.TextMeshProUGUI display;
void Start()
{
//If this object has an TMP Text to display
if(GetComponent<TMPro.TextMeshProUGUI>() != null)
{
//Get the TMP Text component
display = GetComponent<TMPro.TextMeshProUGUI>();
}
//Send an error if this object don't has TMP Text to display
else {UnityEngine.Debug.LogError("The Log Excess don't has any TextUGUI");}
}
public void Log(object info)
{
//Adding info to log text
logData += info + "\n";
//Increase one line
lineCount++;
//Start remove old log after go out of line limit
if(lineCount > lineLimit) {RemoveLog();}
UpdateLog();
}
void RemoveLog()
{
//Delete the first line
logData = logData.Substring(logData.IndexOf("\n")+1);
//Decrease one line
lineCount--;
UpdateLog();
}
public void ClearLog()
{
//Remove all the log data
logData = "";
//Remove all the line count
lineCount -= lineCount;
UpdateLog();
}
//Update log text UI
void UpdateLog() {display.text = logData;}
}
} |
@model Sloth.Web.Models.TeamViewModels.CreateTeamViewModel
@{
ViewBag.Title = "Create New Team";
}
<div class="container">
<h2>@ViewBag.Title</h2>
<form method="post">
<div class="form-group">
<label asp-for="Name"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Slug"></label>
<input asp-for="Slug" class="form-control" />
<span asp-validation-for="Slug" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="KfsContactDepartmentName"></label>
<input asp-for="KfsContactDepartmentName" class="form-control" />
<span asp-validation-for="KfsContactDepartmentName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="KfsContactUserId"></label>
<input asp-for="KfsContactUserId" class="form-control" />
<span asp-validation-for="KfsContactUserId" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="KfsContactEmail"></label>
<input asp-for="KfsContactEmail" class="form-control" />
<span asp-validation-for="KfsContactEmail" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="KfsContactPhoneNumber"></label>
<input asp-for="KfsContactPhoneNumber" class="form-control" />
<span asp-validation-for="KfsContactPhoneNumber" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="KfsContactMailingAddress"></label>
<input asp-for="KfsContactMailingAddress" class="form-control" />
<span asp-validation-for="KfsContactMailingAddress" class="text-danger"></span>
</div>
<input type="submit" value="Create" class="btn btn-primary" />
</form>
</div>
@section AdditionalScripts {
<script>
$(function () {
var dirtySlug = false;
$('#Name').keyup(function () {
if (dirtySlug) {
return;
}
var slug = $(this).val();
slug = slug.replace(/[\W_]/g, '-');
slug = slug.replace(/--*/g, '-');
slug = slug.trim('-');
slug = slug.toLowerCase();
$('#Slug').val(slug);
});
$('#Slug').change(function () {
dirtySlug = true;
});
});
</script>
}
|
using Northwind.Data.Dtos;
using Northwind.Data.Services;
// __LLBLGENPRO_USER_CODE_REGION_START SsSvcAdditionalNamespaces
// __LLBLGENPRO_USER_CODE_REGION_END
namespace Northwind.Data.ServiceInterfaces
{
public interface ICategoryServiceRepository: IEntityServiceRepository<Category>
// __LLBLGENPRO_USER_CODE_REGION_START SsSvcAdditionalInterfaces
// __LLBLGENPRO_USER_CODE_REGION_END
{
EntityMetaDetailsResponse GetEntityMetaDetails(ServiceStack.ServiceInterface.Service service);
DataTableResponse GetDataTableResponse(CategoryDataTableRequest request);
CategoryCollectionResponse Fetch(CategoryQueryCollectionRequest request);
CategoryResponse Fetch(CategoryPkRequest request);
CategoryResponse Fetch(CategoryUcCategoryNameRequest request);
CategoryResponse Create(CategoryAddRequest request);
CategoryResponse Update(CategoryUpdateRequest request);
SimpleResponse<bool> Delete(CategoryDeleteRequest request);
// __LLBLGENPRO_USER_CODE_REGION_START SsSvcAdditionalMethods
// __LLBLGENPRO_USER_CODE_REGION_END
}
}
|
#region
using ShaderExtension.Interfaces;
using ShaderExtension.PropertyDeclaration.Enums;
#endregion
namespace ShaderExtension.PropertyDeclaration
{
public class Texture : IProperty
{
public DefaultTexture DefaultTexture;
/// <summary>
/// This is the string that Unity displays in the inspector.
/// "Example Display Name"
/// </summary>
public string DisplayName;
/// <summary>
/// a material property attribute ex. "[HDR]" tells unity and the inspector
/// how to draw and interpret a property.
/// The built-in ones for Textures are these:
/// "[HDR]", "[HideInInspector]", "[MainTexture]", "[Normal]", "[NoScaleOffset]", "[PerRendererData]"
/// Custom attributes are also valid.
/// </summary>
public string[] MaterialPropertyAttributes;
/// <summary>
/// Property name should start with a "_".
/// "_ExampleName", "_Example_Name_2"
/// </summary>
public string Name;
/// <summary>
/// 2D,2DArray,3D,Cube,CubeArray
/// </summary>
public TextureType Type;
/// <summary>
/// returns the full declaration of the property
/// </summary>
/// <returns> example:" [MainTexture] _MainTex ("Texture", 2D) = "white" {}"</returns>
public string GetPropertyDeclaration()
{
string propertyDeclaration = "";
//We don't!
//We add the MaterialAttributes and remove brackets to account for inconsistent input
//foreach (string materialPropertyAttribute in materialPropertyAttributes)
// propertyDeclaration += "[" + materialPropertyAttribute.Trim('[', ']') + "] ";
//We don't!
foreach (string materialPropertyAttribute in MaterialPropertyAttributes)
{
propertyDeclaration += $"{materialPropertyAttribute} ";
}
propertyDeclaration += Name + " (\"" + DisplayName + ", " + Type + ") = \"" + DefaultTexture + "\" {}";
return propertyDeclaration;
}
}
} |
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
// 空白ページの項目テンプレートについては、https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x411 を参照してください
namespace OpenJpegDotNet.UWP.Tests
{
/// <summary>
/// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。
/// </summary>
public sealed partial class MainPage : Page
{
#region Constructors
public MainPage()
{
this.InitializeComponent();
}
#endregion
#region Methods
#region Event Handlers
private async void LoadButtonClick(object sender, RoutedEventArgs e)
{
var data = await File.ReadAllBytesAsync("Bretagne1_0.j2k");
using (var reader = new IO.Reader(data))
{
var result = reader.ReadHeader();
if (!result)
return;
var raw = reader.ReadRawBitmap();
this._Image.Source = await ToBitmapSource(raw);
}
}
#endregion
#region Helpers
private static async Task<BitmapImage> ToBitmapSource(RawBitmap rawBitmap)
{
var raw = rawBitmap.Data.ToArray();
var width = rawBitmap.Width;
var height = rawBitmap.Height;
var channel = rawBitmap.Channel;
var data = new byte[width * height * 4];
unsafe
{
fixed (byte* pRaw = &raw[0])
fixed (byte* dst = &data[0])
{
var src = pRaw;
for (var y = 0; y < height; y++)
{
var index = y * width * 4;
for (var x = 0; x < width; x++)
{
dst[index] = src[2];
dst[index + 1] = src[1];
dst[index + 2] = src[0];
index += 4;
src += channel;
}
}
}
}
var writeableBitmap = new WriteableBitmap((int)width, (int)height);
using (var imras = new InMemoryRandomAccessStream())
{
var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.BmpEncoderId, imras);
encoder.SetPixelData(BitmapPixelFormat.Rgba8,
BitmapAlphaMode.Ignore,
(uint)writeableBitmap.PixelWidth,
(uint)writeableBitmap.PixelHeight,
96.0,
96.0,
data);
await encoder.FlushAsync();
var bitmapImage = new BitmapImage();
bitmapImage.SetSource(imras);
return bitmapImage;
}
}
#endregion
#endregion
}
}
|
using InfraWatcher.Core.Models.Command;
using Microsoft.Extensions.Options;
using System.Linq;
using InfraWatcher.Core.Models.Configuration;
using InfraWatcher.Core.Providers;
using Microsoft.Extensions.Configuration;
using System.Net.Sockets;
namespace InfraWatcher.Common.Providers
{
public class DefaultCommandProvider : ICommandProvider
{
private readonly InfraWatcherOption infraWatcherOptions;
public DefaultCommandProvider(IOptions<InfraWatcherOption> infraWatcherOptions)
{
this.infraWatcherOptions = infraWatcherOptions.Value;
}
public ServerCommand GetCommand(string name)
{
return this.infraWatcherOptions
.Commands
.FirstOrDefault(command => command.Name == name)
.Command;
}
public CommandOption[] GetCommands()
{
return this.infraWatcherOptions.Commands;
}
}
}
|
using System.Collections.Generic;
namespace Augury.Comparers
{
public class KeyValuePairIntUintComparer : IEqualityComparer<KeyValuePair<int, uint>>
{
public bool Equals(KeyValuePair<int, uint> x, KeyValuePair<int, uint> y)
{
return Equals(x.Value, y.Value) && Equals(x.Key, y.Key);
}
public int GetHashCode(KeyValuePair<int, uint> obj)
{
unchecked
{
return (obj.Value.GetHashCode() * 397) ^ base.GetHashCode();
}
}
}
} |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Web;
using System.Linq;
namespace FubuCore
{
public static class StringExtensions
{
/// <summary>
/// If the path is rooted, just returns the path. Otherwise,
/// combines root & path
/// </summary>
/// <param name="path"></param>
/// <param name="root"></param>
/// <returns></returns>
public static string CombineToPath(this string path, string root)
{
if (Path.IsPathRooted(path)) return path;
return Path.Combine(root, path);
}
public static void IfNotNull(this string target, Action<string> continuation)
{
if (target != null)
{
continuation(target);
}
}
public static string ToFullPath(this string path)
{
return Path.GetFullPath(path);
}
/// <summary>
/// Retrieve the parent directory of a directory or file
/// Shortcut to Path.GetDirectoryName(path)
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static string ParentDirectory(this string path)
{
return Path.GetDirectoryName(path);
}
/// <summary>
/// Equivalent of FileSystem.Combine( [Union of path, parts] )
/// </summary>
/// <param name="path"></param>
/// <param name="parts"></param>
/// <returns></returns>
public static string AppendPath(this string path, params string[] parts)
{
var list = new List<string>{
path
};
list.AddRange(parts);
return FileSystem.Combine(list.ToArray());
}
public static string PathRelativeTo(this string path, string root)
{
var pathParts = path.getPathParts();
var rootParts = root.getPathParts();
var length = pathParts.Count > rootParts.Count ? rootParts.Count : pathParts.Count;
for (int i = 0; i < length; i++)
{
if (pathParts.First() == rootParts.First())
{
pathParts.RemoveAt(0);
rootParts.RemoveAt(0);
}
else
{
break;
}
}
for (int i = 0; i < rootParts.Count; i++)
{
pathParts.Insert(0, "..");
}
return pathParts.Count > 0 ? FileSystem.Combine(pathParts.ToArray()) : string.Empty;
}
public static bool IsEmpty(this string stringValue)
{
return string.IsNullOrEmpty(stringValue);
}
public static bool IsNotEmpty(this string stringValue)
{
return !string.IsNullOrEmpty(stringValue);
}
public static void IsNotEmpty(this string stringValue, Action<string> action)
{
if (stringValue.IsNotEmpty())
action(stringValue);
}
public static bool ToBool(this string stringValue)
{
if (string.IsNullOrEmpty(stringValue)) return false;
return bool.Parse(stringValue);
}
public static string ToFormat(this string stringFormat, params object[] args)
{
return String.Format(stringFormat, args);
}
/// <summary>
/// Performs a case-insensitive comparison of strings
/// </summary>
public static bool EqualsIgnoreCase(this string thisString, string otherString)
{
return thisString.Equals(otherString, StringComparison.InvariantCultureIgnoreCase);
}
/// <summary>
/// Converts the string to Title Case
/// </summary>
public static string Capitalize(this string stringValue)
{
return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(stringValue);
}
public static string HtmlAttributeEncode(this string unEncoded)
{
return HttpUtility.HtmlAttributeEncode(unEncoded);
}
public static string HtmlEncode(this string unEncoded)
{
return HttpUtility.HtmlEncode(unEncoded);
}
public static string HtmlDecode(this string encoded)
{
return HttpUtility.HtmlDecode(encoded);
}
public static string UrlEncode(this string unEncoded)
{
return HttpUtility.UrlEncode(unEncoded);
}
public static string UrlDecode(this string encoded)
{
return HttpUtility.UrlDecode(encoded);
}
/// <summary>
/// Formats a multi-line string for display on the web
/// </summary>
/// <param name="plainText"></param>
public static string ConvertCRLFToBreaks(this string plainText)
{
return new Regex("(\r\n|\n)").Replace(plainText, "<br/>");
}
/// <summary>
/// Returns a DateTime value parsed from the <paramref name="dateTimeValue"/> parameter.
/// </summary>
/// <param name="dateTimeValue">A valid, parseable DateTime value</param>
/// <returns>The parsed DateTime value</returns>
public static DateTime ToDateTime(this string dateTimeValue)
{
return DateTime.Parse(dateTimeValue);
}
public static string ToGmtFormattedDate(this DateTime date)
{
return date.ToString("yyyy'-'MM'-'dd hh':'mm':'ss tt 'GMT'");
}
public static string[] ToDelimitedArray(this string content)
{
return content.ToDelimitedArray(',');
}
public static string[] ToDelimitedArray(this string content, char delimiter)
{
string[] array = content.Split(delimiter);
for (int i = 0; i < array.Length; i++)
{
array[i] = array[i].Trim();
}
return array;
}
public static bool IsValidNumber(this string number)
{
return IsValidNumber(number, Thread.CurrentThread.CurrentCulture);
}
public static bool IsValidNumber(this string number, CultureInfo culture)
{
string _validNumberPattern =
@"^-?(?:\d+|\d{1,3}(?:"
+ culture.NumberFormat.NumberGroupSeparator +
@"\d{3})+)?(?:\"
+ culture.NumberFormat.NumberDecimalSeparator +
@"\d+)?$";
return new Regex(_validNumberPattern, RegexOptions.ECMAScript).IsMatch(number);
}
public static IList<string> getPathParts(this string path)
{
return path.Split(new[] {Path.DirectorySeparatorChar}, StringSplitOptions.RemoveEmptyEntries).ToList();
}
public static string DirectoryPath(this string path)
{
return Path.GetDirectoryName(path);
}
/// <summary>
/// Reads text and returns an enumerable of strings for each line
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static IEnumerable<string> ReadLines(this string text)
{
var reader = new StringReader(text);
string line;
while ((line = reader.ReadLine()) != null)
{
yield return line;
}
}
/// <summary>
/// Reads text and calls back for each line of text
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static void ReadLines(this string text, Action<string> callback)
{
var reader = new StringReader(text);
string line;
while ((line = reader.ReadLine()) != null)
{
callback(line);
}
}
/// <summary>
/// Just uses MD5 to create a repeatable hash
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static string ToHash(this string text)
{
return MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(text)).Select(b => b.ToString("x2")).Join("");
}
public static TEnum ToEnum<TEnum>(this string text) where TEnum : struct
{
var enumType = typeof (TEnum);
if(!enumType.IsEnum) throw new ArgumentException("{0} is not an Enum".ToFormat(enumType.Name));
return (TEnum) Enum.Parse(enumType, text, true);
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Axiverse.Interface.Windows
{
public enum WordWrap
{
Wrap,
NoWrap,
}
}
|
using System;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Samples.WeatherApi.WorkerClient
{
public class Worker : BackgroundService
{
private readonly HttpClient _regularHttpClient;
private readonly IWeatherForecastClient _weatherForecastClient;
private readonly ILogger<Worker> _logger;
public Worker(
IHttpClientFactory factory, IWeatherForecastClient weatherForecastClient, ILogger<Worker> logger)
{
_regularHttpClient = factory.CreateClient("weather-api-client");
_weatherForecastClient = weatherForecastClient;
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
_logger.LogInformation($"Worker running at: {DateTime.Now}");
var stringResponse = await _regularHttpClient.GetStringAsync("weatherforecast", stoppingToken);
_logger.LogInformation($"Weather API response: {stringResponse}");
var weatherForecast =
(await _weatherForecastClient.GetWeatherForecastAsync()).ToArray();
_logger.LogInformation(
$"Downloaded {weatherForecast.Length} forecasts; " +
$"max temp: {weatherForecast.Max(x => x.TemperatureC)}; " +
$"min temp: {weatherForecast.Min(x => x.TemperatureC)}");
await Task.Delay(3000, stoppingToken);
}
}
}
}
|
using System;
using System.ServiceProcess;
using System.ServiceModel.Web;
namespace PureCloudRESTService
{
public partial class RestService : ServiceBase
{
public RestService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
string port = "8889";
String storageDir = "SampleData";
if (args != null && args.Length > 0)
{
storageDir = args[0];
}
if (args != null && args.Length > 1)
{
port = args[1];
}
Console.WriteLine("Storage directory: " + storageDir);
Console.WriteLine("Listening on port: " + port);
WebServicesImplementation DemoServices = new WebServicesImplementation();
WebServiceHost _serviceHost = new WebServiceHost(DemoServices, new Uri("http://127.0.0.1:" + port));
_serviceHost.Open();
//Console.ReadKey();
//_serviceHost.Close();
}
protected override void OnStop()
{
}
}
}
|
using System.Threading.Tasks;
using Edelstein.Core;
using Edelstein.Network.Packets;
using Edelstein.Service.Game.Fields.Objects.Mob;
namespace Edelstein.Service.Game.Services.Handlers
{
public class MobMoveHandler : AbstractFieldMobHandler
{
public override async Task Handle(RecvPacketOperations operation, IPacket packet, FieldMob mob)
{
var mobCtrlSN = packet.Decode<short>();
var v7 = packet
.Decode<byte>(); //v85 = nDistance | 4 * (v184 | 2 * ((unsigned __int8)retaddr | 2 * v72)); [ CONFIRMED ]
var oldSplit = (v7 & 0xF0) != 0; //this is a type of CFieldSplit
var mobMoveStartResult = (v7 & 0xF) != 0;
var curSplit = packet.Decode<byte>();
var illegalVelocity = packet.Decode<int>();
var v8 = packet.Decode<byte>();
var cheatedRandom = (v8 & 0xF0) != 0;
var cheatedCtrlMove = (v8 & 0xF) != 0;
var multiTargetForBall = packet.Decode<int>();
for (var i = 0; i < multiTargetForBall; i++) packet.Decode<long>(); // int, int
var randTimeForAreaAttack = packet.Decode<int>();
for (var i = 0; i < randTimeForAreaAttack; i++) packet.Decode<int>();
packet.Decode<int>(); // HackedCode
packet.Decode<int>(); // idk
packet.Decode<int>(); // HackedCodeCrc
packet.Decode<int>(); // idk
using (var p = new Packet(SendPacketOperations.MobCtrlAck))
{
p.Encode<int>(mob.ID);
p.Encode<short>(mobCtrlSN);
p.Encode<bool>(mobMoveStartResult);
p.Encode<short>(0); // nMP
p.Encode<byte>(0); // SkillCommand
p.Encode<byte>(0); // SLV
await mob.Controller.SendPacket(p);
}
using (var p = new Packet(SendPacketOperations.MobMove))
{
p.Encode<int>(mob.ID);
p.Encode<bool>(mobMoveStartResult);
p.Encode<byte>(curSplit);
p.Encode<byte>(0); // not sure
p.Encode<byte>(0); // not sure
p.Encode<int>(illegalVelocity);
p.Encode<int>(0); // MultiTargetForBall
p.Encode<int>(0); // RandTimeForAreaAttack
mob.Move(packet).Encode(p);
await mob.Field.BroadcastPacket(mob.Controller, p);
}
}
}
} |
using Clifton.Core.Semantics;
namespace Clifton.Core.Semantics
{
public class XmlFileName : ImmutableSemanticType<XmlFileName, string> { };
public class OptionalPath : ImmutableSemanticType<OptionalPath, string> { };
public class FullPath : ImmutableSemanticType<FullPath, string> { };
public class AssemblyFileName : ImmutableSemanticType<AssemblyFileName, string> { }
}
|
using Apollo.Core.Configuration;
namespace Apollo.Core.Plugins
{
public class GoogleAdwordsSettings : ISettings
{
public string GoogleConversionId { get; set; }
public string GoogleConversionLabel { get; set; }
public string TrackingScript { get; set; }
}
}
|
using backend.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace backend.Data;
public class ApplicationDbContext : IdentityDbContext<User, IdentityRole<Guid>, Guid>
{
public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
public DbSet<Gallery> Gallery { get; set; }
public DbSet<Address> Addresses { get; set; }
public DbSet<Card> Cards { get; set; }
public DbSet<Contact> Contacts { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderDetail> OrderDetails { get; set; }
public DbSet<Coupon> Coupons { get; set; }
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
public override async Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess,
CancellationToken cancellationToken = default(CancellationToken))
{
var modifiedEntries = ChangeTracker.Entries()
.Where(x => x.Entity is BaseModel && (x.State == EntityState.Added || x.State == EntityState.Modified));
foreach (var entry in modifiedEntries)
{
var entity = entry.Entity as BaseModel;
if (entry.State == EntityState.Added)
{
entity.CreateAt = DateTime.UtcNow;
}
entity.UpdateAt = DateTime.UtcNow;
}
return (await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken));
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<User>(entity =>
{
entity.ToTable(name: "Users");
});
builder.Entity<IdentityRole<Guid>>(entity =>
{
entity.ToTable(name: "Roles");
});
builder.Entity<IdentityUserRole<Guid>>(entity =>
{
entity.ToTable("UserRoles");
});
builder.Entity<IdentityUserClaim<Guid>>(entity =>
{
entity.ToTable("UserClaims");
});
builder.Entity<IdentityUserLogin<Guid>>(entity =>
{
entity.ToTable("UserLogins");
});
builder.Entity<IdentityRoleClaim<Guid>>(entity =>
{
entity.ToTable("RoleClaims");
});
builder.Entity<IdentityUserToken<Guid>>(entity =>
{
entity.ToTable("UserTokens");
});
}
} |
using ININ.Client.Common.Interactions;
namespace ININ.Alliances.RecursiveLabsAddin.viewmodel
{
public class InteractionViewModel : ViewModelBase
{
#region Private Fields
#endregion
#region Public Properties
#endregion
private InteractionViewModel(IInteraction interaction)
{
}
#region Private Methods
#endregion
#region Public Methods
#endregion
#region Static Methods
public static InteractionViewModel FromIInteraction(IInteraction interaction)
{
return new InteractionViewModel(interaction);
}
#endregion
}
}
|
namespace IndieVisible.Web.Models
{
public class ListNoItemsViewModel
{
public string MainClass { get; set; }
public string Icon { get; set; }
public string Text { get; set; }
public bool Rotate { get; set; }
public ListNoItemsViewModel(string icon, string text)
{
Icon = icon;
Text = text;
Rotate = true;
}
public ListNoItemsViewModel(string icon, string text, bool rotate)
{
Icon = icon;
Text = text;
Rotate = rotate;
}
public ListNoItemsViewModel(string mainClass, string icon, string text)
{
MainClass = mainClass;
Icon = icon;
Text = text;
Rotate = true;
}
}
} |
using QS.Permissions;
using QS.Services;
using QS.Validation;
using QS.Validation.GtkUI;
namespace QS.Project.Services.GtkUI
{
public static class GtkAppServicesConfig
{
public static void CreateDefaultGtkServices()
{
ServicesConfig.InteractiveService = new GtkInteractiveService();
ServicesConfig.ValidationService = new ValidationService(new GtkValidationViewFactory());
}
}
}
|
using System;
namespace Microsoft.Msagl.Drawing
{
[Serializable]
public struct Color
{
private byte a;
private byte r;
private byte g;
private byte b;
public byte A
{
get
{
return a;
}
set
{
a = value;
}
}
public byte R
{
get
{
return r;
}
set
{
r = value;
}
}
public byte G
{
get
{
return g;
}
set
{
g = value;
}
}
public byte B
{
get
{
return b;
}
set
{
b = value;
}
}
public static Color AliceBlue => new Color(byte.MaxValue, 240, 248, byte.MaxValue);
public static Color AntiqueWhite => new Color(byte.MaxValue, 250, 235, 215);
public static Color Aqua => new Color(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue);
public static Color Aquamarine => new Color(byte.MaxValue, 127, byte.MaxValue, 212);
public static Color Azure => new Color(byte.MaxValue, 240, byte.MaxValue, byte.MaxValue);
public static Color Beige => new Color(byte.MaxValue, 245, 245, 220);
public static Color Bisque => new Color(byte.MaxValue, byte.MaxValue, 228, 196);
public static Color Black => new Color(byte.MaxValue, 0, 0, 0);
public static Color BlanchedAlmond => new Color(byte.MaxValue, byte.MaxValue, 235, 205);
public static Color Blue => new Color(byte.MaxValue, 0, 0, byte.MaxValue);
public static Color BlueViolet => new Color(byte.MaxValue, 138, 43, 226);
public static Color Brown => new Color(byte.MaxValue, 165, 42, 42);
public static Color BurlyWood => new Color(byte.MaxValue, 222, 184, 135);
public static Color CadetBlue => new Color(byte.MaxValue, 95, 158, 160);
public static Color Chartreuse => new Color(byte.MaxValue, 127, byte.MaxValue, 0);
public static Color Chocolate => new Color(byte.MaxValue, 210, 105, 30);
public static Color Coral => new Color(byte.MaxValue, byte.MaxValue, 127, 80);
public static Color CornflowerBlue => new Color(byte.MaxValue, 100, 149, 237);
public static Color Cornsilk => new Color(byte.MaxValue, byte.MaxValue, 248, 220);
public static Color Crimson => new Color(byte.MaxValue, 220, 20, 60);
public static Color Cyan => new Color(byte.MaxValue, 0, byte.MaxValue, byte.MaxValue);
public static Color DarkBlue => new Color(byte.MaxValue, 0, 0, 139);
public static Color DarkCyan => new Color(byte.MaxValue, 0, 139, 139);
public static Color DarkGoldenrod => new Color(byte.MaxValue, 184, 134, 11);
public static Color DarkGray => new Color(byte.MaxValue, 169, 169, 169);
public static Color DarkGreen => new Color(byte.MaxValue, 0, 100, 0);
public static Color DarkKhaki => new Color(byte.MaxValue, 189, 183, 107);
public static Color DarkMagenta => new Color(byte.MaxValue, 139, 0, 139);
public static Color DarkOliveGreen => new Color(byte.MaxValue, 85, 107, 47);
public static Color DarkOrange => new Color(byte.MaxValue, byte.MaxValue, 140, 0);
public static Color DarkOrchid => new Color(byte.MaxValue, 153, 50, 204);
public static Color DarkRed => new Color(byte.MaxValue, 139, 0, 0);
public static Color DarkSalmon => new Color(byte.MaxValue, 233, 150, 122);
public static Color DarkSeaGreen => new Color(byte.MaxValue, 143, 188, 139);
public static Color DarkSlateBlue => new Color(byte.MaxValue, 72, 61, 139);
public static Color DarkSlateGray => new Color(byte.MaxValue, 47, 79, 79);
public static Color DarkTurquoise => new Color(byte.MaxValue, 0, 206, 209);
public static Color DarkViolet => new Color(byte.MaxValue, 148, 0, 211);
public static Color DeepPink => new Color(byte.MaxValue, byte.MaxValue, 20, 147);
public static Color DeepSkyBlue => new Color(byte.MaxValue, 0, 191, byte.MaxValue);
public static Color DimGray => new Color(byte.MaxValue, 105, 105, 105);
public static Color DodgerBlue => new Color(byte.MaxValue, 30, 144, byte.MaxValue);
public static Color Firebrick => new Color(byte.MaxValue, 178, 34, 34);
public static Color FloralWhite => new Color(byte.MaxValue, byte.MaxValue, 250, 240);
public static Color ForestGreen => new Color(byte.MaxValue, 34, 139, 34);
public static Color Fuchsia => new Color(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue);
public static Color Gainsboro => new Color(byte.MaxValue, 220, 220, 220);
public static Color GhostWhite => new Color(byte.MaxValue, 248, 248, byte.MaxValue);
public static Color Gold => new Color(byte.MaxValue, byte.MaxValue, 215, 0);
public static Color Goldenrod => new Color(byte.MaxValue, 218, 165, 32);
public static Color Gray => new Color(byte.MaxValue, 128, 128, 128);
public static Color Green => new Color(byte.MaxValue, 0, 128, 0);
public static Color GreenYellow => new Color(byte.MaxValue, 173, byte.MaxValue, 47);
public static Color Honeydew => new Color(byte.MaxValue, 240, byte.MaxValue, 240);
public static Color HotPink => new Color(byte.MaxValue, byte.MaxValue, 105, 180);
public static Color IndianRed => new Color(byte.MaxValue, 205, 92, 92);
public static Color Indigo => new Color(byte.MaxValue, 75, 0, 130);
public static Color Ivory => new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, 240);
public static Color Khaki => new Color(byte.MaxValue, 240, 230, 140);
public static Color Lavender => new Color(byte.MaxValue, 230, 230, 250);
public static Color LavenderBlush => new Color(byte.MaxValue, byte.MaxValue, 240, 245);
public static Color LawnGreen => new Color(byte.MaxValue, 124, 252, 0);
public static Color LemonChiffon => new Color(byte.MaxValue, byte.MaxValue, 250, 205);
public static Color LightBlue => new Color(byte.MaxValue, 173, 216, 230);
public static Color LightCoral => new Color(byte.MaxValue, 240, 128, 128);
public static Color LightCyan => new Color(byte.MaxValue, 224, byte.MaxValue, byte.MaxValue);
public static Color LightGoldenrodYellow => new Color(byte.MaxValue, 250, 250, 210);
public static Color LightGray => new Color(byte.MaxValue, 211, 211, 211);
public static Color LightGreen => new Color(byte.MaxValue, 144, 238, 144);
public static Color LightPink => new Color(byte.MaxValue, byte.MaxValue, 182, 193);
public static Color LightSalmon => new Color(byte.MaxValue, byte.MaxValue, 160, 122);
public static Color LightSeaGreen => new Color(byte.MaxValue, 32, 178, 170);
public static Color LightSkyBlue => new Color(byte.MaxValue, 135, 206, 250);
public static Color LightSlateGray => new Color(byte.MaxValue, 119, 136, 153);
public static Color LightSteelBlue => new Color(byte.MaxValue, 176, 196, 222);
public static Color LightYellow => new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, 224);
public static Color Lime => new Color(byte.MaxValue, 0, byte.MaxValue, 0);
public static Color LimeGreen => new Color(byte.MaxValue, 50, 205, 50);
public static Color Linen => new Color(byte.MaxValue, 250, 240, 230);
public static Color Magenta => new Color(byte.MaxValue, byte.MaxValue, 0, byte.MaxValue);
public static Color Maroon => new Color(byte.MaxValue, 128, 0, 0);
public static Color MediumAquamarine => new Color(byte.MaxValue, 102, 205, 170);
public static Color MediumBlue => new Color(byte.MaxValue, 0, 0, 205);
public static Color MediumOrchid => new Color(byte.MaxValue, 186, 85, 211);
public static Color MediumPurple => new Color(byte.MaxValue, 147, 112, 219);
public static Color MediumSeaGreen => new Color(byte.MaxValue, 60, 179, 113);
public static Color MediumSlateBlue => new Color(byte.MaxValue, 123, 104, 238);
public static Color MediumSpringGreen => new Color(byte.MaxValue, 0, 250, 154);
public static Color MediumTurquoise => new Color(byte.MaxValue, 72, 209, 204);
public static Color MediumVioletRed => new Color(byte.MaxValue, 199, 21, 133);
public static Color MidnightBlue => new Color(byte.MaxValue, 25, 25, 112);
public static Color MintCream => new Color(byte.MaxValue, 245, byte.MaxValue, 250);
public static Color MistyRose => new Color(byte.MaxValue, byte.MaxValue, 228, 225);
public static Color Moccasin => new Color(byte.MaxValue, byte.MaxValue, 228, 181);
public static Color NavajoWhite => new Color(byte.MaxValue, byte.MaxValue, 222, 173);
public static Color Navy => new Color(byte.MaxValue, 0, 0, 128);
public static Color OldLace => new Color(byte.MaxValue, 253, 245, 230);
public static Color Olive => new Color(byte.MaxValue, 128, 128, 0);
public static Color OliveDrab => new Color(byte.MaxValue, 107, 142, 35);
public static Color Orange => new Color(byte.MaxValue, byte.MaxValue, 165, 0);
public static Color OrangeRed => new Color(byte.MaxValue, byte.MaxValue, 69, 0);
public static Color Orchid => new Color(byte.MaxValue, 218, 112, 214);
public static Color PaleGoldenrod => new Color(byte.MaxValue, 238, 232, 170);
public static Color PaleGreen => new Color(byte.MaxValue, 152, 251, 152);
public static Color PaleTurquoise => new Color(byte.MaxValue, 175, 238, 238);
public static Color PaleVioletRed => new Color(byte.MaxValue, 219, 112, 147);
public static Color PapayaWhip => new Color(byte.MaxValue, byte.MaxValue, 239, 213);
public static Color PeachPuff => new Color(byte.MaxValue, byte.MaxValue, 218, 185);
public static Color Peru => new Color(byte.MaxValue, 205, 133, 63);
public static Color Pink => new Color(byte.MaxValue, byte.MaxValue, 192, 203);
public static Color Plum => new Color(byte.MaxValue, 221, 160, 221);
public static Color PowderBlue => new Color(byte.MaxValue, 176, 224, 230);
public static Color Purple => new Color(byte.MaxValue, 128, 0, 128);
public static Color Red => new Color(byte.MaxValue, byte.MaxValue, 0, 0);
public static Color RosyBrown => new Color(byte.MaxValue, 188, 143, 143);
public static Color RoyalBlue => new Color(byte.MaxValue, 65, 105, 225);
public static Color SaddleBrown => new Color(byte.MaxValue, 139, 69, 19);
public static Color Salmon => new Color(byte.MaxValue, 250, 128, 114);
public static Color SandyBrown => new Color(byte.MaxValue, 244, 164, 96);
public static Color SeaGreen => new Color(byte.MaxValue, 46, 139, 87);
public static Color SeaShell => new Color(byte.MaxValue, byte.MaxValue, 245, 238);
public static Color Sienna => new Color(byte.MaxValue, 160, 82, 45);
public static Color Silver => new Color(byte.MaxValue, 192, 192, 192);
public static Color SkyBlue => new Color(byte.MaxValue, 135, 206, 235);
public static Color SlateBlue => new Color(byte.MaxValue, 106, 90, 205);
public static Color SlateGray => new Color(byte.MaxValue, 112, 128, 144);
public static Color Snow => new Color(byte.MaxValue, byte.MaxValue, 250, 250);
public static Color SpringGreen => new Color(byte.MaxValue, 0, byte.MaxValue, 127);
public static Color SteelBlue => new Color(byte.MaxValue, 70, 130, 180);
public static Color Tan => new Color(byte.MaxValue, 210, 180, 140);
public static Color Teal => new Color(byte.MaxValue, 0, 128, 128);
public static Color Thistle => new Color(byte.MaxValue, 216, 191, 216);
public static Color Tomato => new Color(byte.MaxValue, byte.MaxValue, 99, 71);
public static Color Transparent => new Color(0, byte.MaxValue, byte.MaxValue, byte.MaxValue);
public static Color Turquoise => new Color(byte.MaxValue, 64, 224, 208);
public static Color Violet => new Color(byte.MaxValue, 238, 130, 238);
public static Color Wheat => new Color(byte.MaxValue, 245, 222, 179);
public static Color White => new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
public static Color WhiteSmoke => new Color(byte.MaxValue, 245, 245, 245);
public static Color Yellow => new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue, 0);
public static Color YellowGreen => new Color(byte.MaxValue, 154, 205, 50);
public Color(byte a, byte r, byte g, byte b)
{
this.a = a;
this.r = r;
this.g = g;
this.b = b;
}
public Color(byte r, byte g, byte b)
{
a = byte.MaxValue;
this.r = r;
this.g = g;
this.b = b;
}
public static string Xex(int i)
{
string text = Convert.ToString(i, 16);
if (text.Length == 1)
{
return "0" + text;
}
return text.Substring(text.Length - 2, 2);
}
public static bool operator ==(Color a, Color b)
{
if (a.a == b.a && a.r == b.r && a.b == b.b)
{
return a.g == b.g;
}
return false;
}
public static bool operator !=(Color a, Color b)
{
if (a.a == b.a && a.r == b.r && a.b == b.b)
{
return a.g != b.g;
}
return true;
}
public override string ToString()
{
return "\"#" + Xex(R) + Xex(G) + Xex(B) + ((A == byte.MaxValue) ? "" : Xex(A)) + "\"";
}
}
}
|
using Sfs2X.Entities.Data;
using YxFramwork.Common.Model;
namespace Assets.Scripts.Game.jlgame.Modle
{
public class JlGameUserInfo : YxBaseGameUserInfo
{
public int[] Cards;
public int FoldNum;
public int CardLen;
public int FoldScore;
public int[] FoldCards;
public int[] ActiveCards;
public bool IsCurSpeaker;
public bool IsTrusteeship;
public override void Parse(ISFSObject userData)
{
base.Parse(userData);
Cards = userData.ContainsKey("cards") ? userData.GetIntArray("cards") : null;
FoldNum = userData.ContainsKey("foldNum") ? userData.GetInt("foldNum") : -1;
CardLen = userData.ContainsKey("cardLen") ? userData.GetInt("cardLen") : -1;
FoldCards = userData.ContainsKey("foldCards") ? userData.GetIntArray("foldCards") : null;
ActiveCards = userData.ContainsKey("activeCards") ? userData.GetIntArray("activeCards") : null;
IsTrusteeship = userData.ContainsKey("trusteeship") && userData.GetBool("trusteeship");//
FoldScore = userData.ContainsKey("foldScore") ? userData.GetInt("foldScore") : -1;
}
}
}
|
using Azure;
using Azure.Search.Documents;
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Models;
using Microsoft.Extensions.Configuration;
using shoestore_listing_aspnetcore.Indexes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace shoestore_listing_aspnetcore.Services
{
public class SearchService : ISearchService
{
private readonly string _serviceName;
private readonly string _apiKey;
private readonly string _indexName;
private readonly IConfiguration _configuration;
public SearchService(IConfiguration configuration)
{
_configuration = configuration;
_serviceName = _configuration.GetValue<string>("Listing:Settings:SearchServiceName");
_apiKey = _configuration.GetValue<string>("Listing:Settings:SearchServiceApiKey");
_indexName = _configuration.GetValue<string>("Listing:Settings:ProductsIndexName");
}
public async Task<IEnumerable<Product>> SearchAsync(string query)
{
Uri serviceEndpoint = new Uri($"https://{_serviceName}.search.windows.net/");
AzureKeyCredential credential = new AzureKeyCredential(_apiKey);
// Create a SearchClient to query documents
SearchClient searchClient = new SearchClient(serviceEndpoint, _indexName, credential);
Response<SearchResults<Product>> response = await searchClient.SearchAsync<Product>(query);
SearchResults<Product> value = response.Value;
IEnumerable<Product> products = value.GetResults().Select(x => x.Document);
return products;
}
}
} |
using System;
class test
{
public static void Main(string [] args)
{
Console.WriteLine("mca");
console.BackgroundColor=ConsoleColor.Blue;
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TeamPointerMaster : MonoBehaviour
{
GameObject pointer1;
GameObject pointer2;
GameObject currPointer;
private void Start()
{
pointer1 = transform.GetChild(0).gameObject;
pointer2 = transform.GetChild(1).gameObject;
currPointer = pointer1;
currPointer.SetActive(true);
}
public void selectOption(int index)
{
currPointer.SetActive(false);
switch (index)
{
case 1:
currPointer = pointer1;
break;
case 2:
currPointer = pointer2;
break;
}
currPointer.SetActive(true);
}
}
|
namespace PlatinDashboard.Application.Farmacia.ViewModels.Balconista
{
public class FunCabViewModel
{
public int? Ide { get; set; }
public string Cod { get; set; }
public string Nom { get; set; }
public short? Uad { get; set; }
public bool Sis { get; set; }
public string Log { get; set; }
public double? Pco { get; set; }
public double? Fix { get; set; }
public bool Atv { get; set; }
public string Cpf { get; set; }
public bool Upd { get; set; }
public string Coa { get; set; }
public double? Sal { get; set; }
public string Sen { get; set; }
public short? Pfl { get; set; }
}
}
|
using System.Globalization;
using System.Windows.Media;
using Lib.Wpf.ConverterBase;
namespace OQF.ReplayViewer.Visualization.Computations
{
internal class BoolToBackgroundBrush : GenericValueConverter<bool, Brush>
{
protected override Brush Convert(bool value, CultureInfo culture)
{
return value
? new SolidColorBrush(Colors.Yellow)
: new SolidColorBrush(Colors.Transparent);
}
}
}
|
using UnityEngine;
using UnityEngine.EventSystems;
namespace PcSoft.ExtendedUnity._90_Scripts._00_Runtime.Components
{
public abstract class SearchingSingletonUIBehavior<T> : UIBehaviour where T : SearchingSingletonUIBehavior<T>
{
public static T Singleton => FindObjectOfType<T>();
}
} |
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.GamerServices;
namespace Microsoft.Xna.Framework.Net
{
public sealed class NetworkMachine
{
internal NetworkMachine()
{
}
public void RemoveFromSession()
{
throw new NotImplementedException();
}
public GamerCollection<NetworkGamer> Gamers
{
get
{
throw new NotImplementedException();
}
}
}
}
|
namespace CoreLib.ASP.Extensions.YouTube.Types.YouTube
{
public abstract class YouTubeResponseItem
{
public YouTubeResponseItem()
{
PageInfo = new PageInfo();
}
public string Kind { get; set; }
public string Etag { get; set; }
public string NextPageToken { get; set; }
public string RegionCode { get; set; }
public PageInfo PageInfo { get; set; }
}
} |
using System;
using Xendor.CommandModel.Command;
namespace CitiBank.Services.AccountServices.Commands
{
public class DepositAccountCommand : ICommand
{
public DepositAccountCommand(Guid id , decimal amount , string description)
{
Id = id;
Amount = amount;
Description = description;
}
public Guid Id { get; }
public decimal Amount { get; }
public string Description { get; }
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Colour_Picker : MonoBehaviour
{
/// <summary>
/// This script handles picking colours for the AI and will handle colour picking for player uniforms later
/// </summary>
public GameObject picker;
public Image pickerImageColour;
public Image pickerImageGrey;
public RectTransform pickerRect;
public Image boxBackup;
public Image preview;
private void Awake()
{
if (boxBackup != null)
{
preview.color = boxBackup.color;
}
}
//Makes the colour picker visible or invisible depending
public void TogglePicker()
{
if(picker.activeSelf)
{
picker.SetActive(false);
}
else
{
picker.SetActive(true);
Colour_Picker[] Pickers = FindObjectsOfType<Colour_Picker>();
foreach(Colour_Picker cp in Pickers)
{
if(cp == this)
{
} else
{
cp.picker.gameObject.SetActive(false);
}
}
}
}
//Handles click and drag on the colour chart
public void handleColorChartDrag(BaseEventData eventData)
{
PointerEventData pEventData = eventData as PointerEventData;
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(pickerRect, pEventData.position, null, out localPoint);
preview.color = pickerImageColour.sprite.texture.GetPixel((int)localPoint.x, (int)localPoint.y);
boxBackup.color = pickerImageColour.sprite.texture.GetPixel((int)localPoint.x, (int)localPoint.y);
}
//Handles click and drag on the colour chart
public void handleGreyChartDrag(BaseEventData eventData)
{
PointerEventData pEventData = eventData as PointerEventData;
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(pickerRect, pEventData.position, null, out localPoint);
preview.color = pickerImageGrey.sprite.texture.GetPixel((int)localPoint.x, (int)localPoint.y);
boxBackup.color = pickerImageGrey.sprite.texture.GetPixel((int)localPoint.x, (int)localPoint.y);
}
}
|
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace Graft.Labs.Utilities
{
public class PrettyPrinter
{
private ILogger Logger { get; }
public PrettyPrinter(ILogger logger)
{
Logger = logger;
}
public TableBuilder BuildTable(IEnumerable<string> columns, string title = null)
{
return new TableBuilder(columns, Logger, title);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Duality.Resources;
namespace Duality.Editor.Plugins.Base.Forms.PixmapSlicer.States
{
public enum PixmapNumberingStyle
{
None,
Hovered,
All
}
}
|
using DaxQueryBuilder.DaxFunctions;
namespace DaxQueryBuilder
{
public class DaxFilter
{
public string In(string table, string column, params string[] values)
{
return DaxQueryHelper.ApplyFilterIn(table, column, values);
}
public string IsEqual(string table, string column, string value)
{
return DaxQueryHelper.ApplyFilterIsEqual(table, column, value);
}
public DaxAllFilter All(string table)
{
var daxFunctions = new DaxAllFilter(table);
return daxFunctions;
}
public DaxValuesFilter Values(string table)
{
var daxFunctions = new DaxValuesFilter(table);
return daxFunctions;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using SharpLua.LuaTypes;
namespace SharpLua.AST
{
/// <summary>
/// A for/in loop
/// </summary>
[Serializable()]
public partial class ForInStmt : Statement
{
/// <summary>
/// Executes the chunk
/// </summary>
/// <param name="enviroment">Runs in the given environment</param>
/// <param name="isBreak">whether to break execution</param>
/// <returns></returns>
public override LuaValue Execute(LuaTable enviroment, out bool isBreak)
{
LuaValue[] values = this.ExprList.ConvertAll(expr => expr.Evaluate(enviroment)).ToArray();
LuaValue[] neatValues = LuaMultiValue.UnWrapLuaValues(values);
if (neatValues.Length < 3) //probably LuaUserdata. Literal will also fail...
{
return ExecuteAlternative(enviroment, out isBreak);
}
LuaFunction func = neatValues[0] as LuaFunction;
LuaValue state = neatValues[1];
LuaValue loopVar = neatValues[2];
var table = new LuaTable(enviroment);
this.Body.Enviroment = table;
while (true)
{
LuaValue result = func.Invoke(new LuaValue[] { state, loopVar });
LuaMultiValue multiValue = result as LuaMultiValue;
if (multiValue != null)
{
neatValues = LuaMultiValue.UnWrapLuaValues(multiValue.Values);
loopVar = neatValues[0];
for (int i = 0; i < Math.Min(this.NameList.Count, neatValues.Length); i++)
{
table.SetNameValue(this.NameList[i], neatValues[i]);
}
}
else
{
loopVar = result;
table.SetNameValue(this.NameList[0], result);
}
if (loopVar == LuaNil.Nil)
{
break;
}
var returnValue = this.Body.Execute(out isBreak);
if (returnValue != null || isBreak == true)
{
isBreak = false;
return returnValue;
}
}
isBreak = false;
return null;
}
private LuaValue ExecuteAlternative(LuaTable enviroment, out bool isBreak)
{
LuaValue returnValue;
LuaValue[] values = this.ExprList.ConvertAll(expr => expr.Evaluate(enviroment)).ToArray();
LuaValue[] neatValues = LuaMultiValue.UnWrapLuaValues(values);
LuaValue state = neatValues[0];
LuaTable table = new LuaTable(enviroment);
this.Body.Enviroment = table;
System.Collections.IDictionary dict = state.Value as System.Collections.IDictionary;
System.Collections.IEnumerable ie = state.Value as System.Collections.IEnumerable;
if (dict != null)
{
foreach (object key in dict.Keys)
{
//for (int i = 0; i < this.NameList.Count; i++)
//{
//table.SetNameValue(this.NameList[i], ObjectToLua.ToLuaValue(key));
//}
table.SetNameValue(this.NameList[0], ObjectToLua.ToLuaValue(key));
table.SetNameValue(this.NameList[1], ObjectToLua.ToLuaValue(dict[key]));
returnValue = this.Body.Execute(out isBreak);
if (returnValue != null || isBreak == true)
{
isBreak = false;
return returnValue;
}
}
}
else if (ie != null)
{
foreach (object obj in ie)
{
for (int i = 0; i < this.NameList.Count; i++)
{
table.SetNameValue(this.NameList[i], ObjectToLua.ToLuaValue(obj));
}
returnValue = this.Body.Execute(out isBreak);
if (returnValue != null || isBreak == true)
{
isBreak = false;
return returnValue;
}
}
}
else
{
// its some other value...
for (int i = 0; i < this.NameList.Count; i++)
{
table.SetNameValue(this.NameList[i], ObjectToLua.ToLuaValue(state.Value));
}
returnValue = this.Body.Execute(out isBreak);
if (returnValue != null || isBreak == true)
{
isBreak = false;
return returnValue;
}
isBreak = false;
return null;
}
isBreak = false;
return null;
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
class Prize
{
static void Main()
{
Dictionary<byte, byte> marks = new Dictionary<byte, byte>();
string lineReader = Console.ReadLine();
string[] tokens = lineReader.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (byte i = 0; i < 7; i++)
{
byte currentMark = byte.Parse(tokens[i]);
if (!marks.ContainsKey(currentMark))
{
marks.Add(currentMark, 1);
}
else
{
marks[currentMark]++;
}
}
if (marks.ContainsKey(2) || !marks.ContainsKey(6))
{
Console.WriteLine("No");
}
else
{
Console.WriteLine(new string('*', marks[6]));
}
}
} |
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using FoodDataCentralAPI.StandartModel;
using Newtonsoft.Json;
namespace FoodDataCentralAPI
{
static class DataFormatter
{
public static byte[] ConvertToBytes(string json) => Encoding.Default.GetBytes(json);
public static string SerializeToJson(object obj) => JsonConvert.SerializeObject(obj);
public static T DeserializeJson<T>(string json) => JsonConvert.DeserializeObject<T>(json);
public static void DetermineFoodItemsType(ArrayList foodItemList)
{
for (int i = 0; i < foodItemList.Count-1; i++)
{
string dataType = (foodItemList[i] as FoodItem).dataType;
if (dataType == "Abridged") foodItemList[i] = (AbridgedFoodItem)foodItemList[i];
else if (dataType == "Branded") foodItemList[i] = (BrandedFoodItem)foodItemList[i];
else if (dataType == "Foundation") foodItemList[i] = (FoundationFoodItem)foodItemList[i];
else if (dataType == "SR Legacy") foodItemList[i] = (SRLegacyFoodItem)foodItemList[i];
else if (dataType.Contains("Survey")) foodItemList[i] = (SurveyFoodItem)foodItemList[i];
else throw new Exception("Could not determine the type of foodItem");
}
}
}
}
|
namespace GenderPayGap.WebUI.Models.Shared.Patterns
{
public class ManageOrganisationBreadcrumbs
{
public string OrganisationName { get; set; }
public string EncryptedOrganisationId { get; set; }
public string PageText { get; set; }
}
}
|
namespace TekConf.Tests.UI
{
public static class ScreenNames
{
public static string AddTask = "AddTaskScreen";
public static string ConferencesList = "ConferencesList";
}
} |
#region License & Metadata
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
//
// Modified On: 2020/02/22 17:55
// Modified By: Alexis
#endregion
using System;
using System.IO;
using System.Threading.Tasks;
using Anotar.Serilog;
using Process.NET.Windows;
using SuperMemoAssistant.Extensions;
using SuperMemoAssistant.Interop.SuperMemo.Core;
using SuperMemoAssistant.Services.Configuration;
using SuperMemoAssistant.SMA.Configs;
namespace SuperMemoAssistant.SMA
{
public partial class SMA
{
#region Properties & Fields - Public
public CollectionCfg CollectionConfig { get; set; }
public CoreCfg CoreConfig => Core.CoreConfig;
#endregion
#region Methods
private void ApplySuperMemoWindowStyles()
{
if (CollectionConfig.CollapseElementWdwTitleBar)
Task.Run(async () =>
{
await Task.Delay(4000).ConfigureAwait(false); // TODO: Fix this
WindowStyling.MakeWindowTitleless(_sm.UI.ElementWdw.Handle);
}).RunAsync();
}
private async Task LoadConfig(SMCollection collection)
{
Core.CollectionConfiguration = new CollectionConfigurationService(collection, "Core");
// CollectionsCfg
CollectionConfig = await Core.CollectionConfiguration.Load<CollectionCfg>() ?? new CollectionCfg();
}
public Task SaveConfig(bool sync)
{
try
{
var tasks = new[]
{
Core.Configuration.Save<CoreCfg>(CoreConfig),
Core.CollectionConfiguration.Save<CollectionCfg>(CollectionConfig),
};
var task = Task.WhenAll(tasks);
if (sync)
task.Wait();
return task;
}
catch (IOException ex)
{
if (ex.Message.StartsWith("The process cannot access the file", StringComparison.OrdinalIgnoreCase))
LogTo.Warning(ex, "Failed to save config files in SMA.SaveConfig");
else
LogTo.Error(ex, "Failed to save config files in SMA.SaveConfig");
return Task.CompletedTask;
}
}
#endregion
}
}
|
namespace BasicGameFrameworkLibrary.MahjongTileClasses;
[Cloneable(false)]
public class MahjongSolitaireTileInfo : BasicMahjongTile, IDeckObject, IMahjongTileInfo
{
public void Populate(int chosen)
{
MahjongBasicTileHelper.PopulateTile(this, chosen);
}
public void Reset() { }
} |
using KABINET_Application.Boundaries.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using System.Linq;
namespace KABINET_Persistence.Services.Http
{
public class HttpContextService : IHttpContextService
{
public string GetTokenFromHttpContext(HttpContext context)
{
bool userHeaderExists = context.Request.Headers.TryGetValue("X-AccessToken", out StringValues userHeader);
var token = userHeaderExists ? userHeader.First() : null;
return token;
}
}
}
|
namespace AdsPortal.WebApi.Persistence.EntityConfigurations
{
using AdsPortal.WebApi.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class CategoryConfiguration : IEntityTypeConfiguration<Category>
{
public void Configure(EntityTypeBuilder<Category> builder)
{
}
}
}
|
// © Anamnesis.
// Licensed under the MIT license.
namespace Anamnesis.Tabs;
using Anamnesis.Actor.Utilities;
using Anamnesis.GameData.Excel;
using Anamnesis.Memory;
using Anamnesis.Services;
using Anamnesis.Utils;
using Anamnesis.Views;
using Serilog;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using XivToolsWpf.Selectors;
/// <summary>
/// Interaction logic for DeveloperTab.xaml.
/// </summary>
public partial class DeveloperTab : UserControl
{
public DeveloperTab()
{
this.InitializeComponent();
this.ContentArea.DataContext = this;
}
public TargetService TargetService => TargetService.Instance;
private void OnNpcNameSearchClicked(object sender, RoutedEventArgs e)
{
GenericSelectorUtil.Show(GameDataService.BattleNpcNames, (v) =>
{
if (v.Description == null)
return;
ClipboardUtility.CopyToClipboard(v.Description);
});
}
private void OnFindNpcClicked(object sender, RoutedEventArgs e)
{
TargetSelectorView.Show((a) =>
{
ActorMemory memory = new();
if (a is ActorMemory actorMemory)
memory = actorMemory;
memory.SetAddress(a.Address);
NpcAppearanceSearch.Search(memory);
});
}
private void OnCopyActorAddressClicked(object sender, RoutedEventArgs e)
{
ActorBasicMemory memory = this.TargetService.PlayerTarget;
if (!memory.IsValid)
{
Log.Warning("Actor is invalid");
return;
}
string address = memory.Address.ToString("X");
ClipboardUtility.CopyToClipboard(address);
}
private void OnCopyAssociatedAddressesClick(object sender, RoutedEventArgs e)
{
ActorBasicMemory abm = this.TargetService.PlayerTarget;
if (!abm.IsValid)
{
Log.Warning("Actor is invalid");
return;
}
try
{
ActorMemory memory = new();
memory.SetAddress(abm.Address);
StringBuilder sb = new();
sb.AppendLine("Base: " + memory.Address.ToString("X"));
sb.AppendLine("Model: " + (memory.ModelObject?.Address.ToString("X") ?? "0"));
sb.AppendLine("Extended Appearance: " + (memory.ModelObject?.ExtendedAppearance?.Address.ToString("X") ?? "0"));
sb.AppendLine("Skeleton: " + (memory.ModelObject?.Skeleton?.Address.ToString("X") ?? "0"));
sb.AppendLine("Main Hand Model: " + (memory.MainHand?.Model?.Address.ToString("X") ?? "0"));
sb.AppendLine("Off Hand Model: " + (memory.OffHand?.Model?.Address.ToString("X") ?? "0"));
sb.AppendLine("Mount: " + (memory.Mount?.Address.ToString("X") ?? "0"));
sb.AppendLine("Companion: " + (memory.Companion?.Address.ToString("X") ?? "0"));
sb.AppendLine("Ornament: " + (memory.Ornament?.Address.ToString("X") ?? "0"));
ClipboardUtility.CopyToClipboard(sb.ToString());
}
catch
{
Log.Warning("Could not read addresses");
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using Gameplay.Puzzles.Base;
using UnityEngine;
namespace Gameplay.Puzzles.Pairs
{
public enum PairColor
{
RED,
BLUE,
GREEN,
YELLOW,
}
[Serializable]
public struct MaterialColorTuple
{
public Material material;
public PairColor color;
}
public class PairButton : MonoBehaviour, IInteractable
{
public bool isRevealed { get; private set; }
private Camera _raycastCamera;
[SerializeField] private Camera _customRaycastCamera;
public event Action<PairButton> OnPairButtonRevealed;
[SerializeField] public PairColor _color;
public PairColor color { get { return _color; } }
[SerializeField] private MaterialColorTuple[] _materials;
[SerializeField] private MeshRenderer _buttonRenderer;
[SerializeField] private Material _hiddenMaterial;
[SerializeField] private Dictionary<PairColor, Material> _materialsMap;
private AudioSource _audioSource;
[SerializeField] private AudioClip _successBeep;
[SerializeField] private AudioClip _errorBeep;
private bool locked;
private void Awake()
{
_materialsMap = new Dictionary<PairColor, Material>();
foreach (var material in _materials)
{
_materialsMap.Add(material.color, material.material);
}
if (!_customRaycastCamera)
{
_raycastCamera = Camera.main;
}
else
{
_raycastCamera = _customRaycastCamera;
}
_audioSource = GetComponent<AudioSource>();
SetMaterial(_hiddenMaterial);
}
private void Update()
{
if (!locked)
{
HandleMouseClick();
}
}
private void HandleMouseClick()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = _raycastCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.collider.gameObject == gameObject)
{
Reveal();
}
}
}
}
public void SetColor(PairColor color)
{
_color = color;
}
public void PlaySuccess()
{
_audioSource.PlayOneShot(_successBeep);
}
public void PlayError()
{
_audioSource.PlayOneShot(_errorBeep);
}
private void SetMaterial(Material material)
{
Material[] mats = _buttonRenderer.materials;
mats[1] = material;
_buttonRenderer.materials = mats;
}
public void Conceal()
{
SetMaterial(_hiddenMaterial);
isRevealed = false;
}
public void Reveal()
{
SetMaterial(_materialsMap[_color]);
isRevealed = true;
if (OnPairButtonRevealed != null)
{
OnPairButtonRevealed(this);
}
}
public void Lock()
{
locked = true;
}
public void Unlock()
{
locked = false;
}
}
} |
/*
Copyright (c) 2018-2021 Festo AG & Co. KG <https://www.festo.com/net/de_de/Forms/web/contact_international>
Author: Michael Hoffmeister
This source code is licensed under the Apache License 2.0 (see LICENSE.txt).
This source code may use other Open Source software components (see LICENSE.txt).
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AasxPredefinedConcepts
{
public static class DefinitionsLanguages
{
public static string[] DefaultLanguages = new string[] { "en", "de", "fr", "es", "it", "cn", "kr", "jp" };
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cyberarms.IntrusionDetection.Shared;
namespace Cyberarms.IDDS.Management {
[System.Management.Automation.Cmdlet(System.Management.Automation.VerbsCommon.Get, "ActivationStatus")]
public class Get_ActivationStatus : System.Management.Automation.PSCmdlet {
[System.Management.Automation.Parameter(Position = 0, Mandatory = false)]
public string Options;
protected override void ProcessRecord() {
if (String.IsNullOrEmpty(Options)) {
this.WriteObject(System.Reflection.Assembly.GetExecutingAssembly().Location);
} else {
switch (Options) {
case "-v":
break;
}
}
}
}
}
|
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Text;
namespace InteractionTests.Pages.Selectable
{
public partial class SelectablePage : BasePage
{
public SelectablePage(IWebDriver driver)
: base(driver)
{
}
}
}
|
using System.Diagnostics.CodeAnalysis;
using MeteoSharp.Attibutes;
using static MeteoSharp.Codes.CodeForm;
namespace MeteoSharp.Bulletins.DataDesignators
{
/// <summary>
/// T2 Designator for T1 = S (Surface data)
/// </summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum T2S : byte
{
/// <summary>
/// Invalid value
/// </summary>
Invalid = 0,
/// <summary>
/// Aviation routine reports
/// </summary>
[CodeForm(METAR)] AviationRoutineReports = (byte) 'A',
/// <summary>
/// Radar reports (Part A)
/// </summary>
[CodeForm(RADOB)] RadarReportsPartA = (byte) 'B',
/// <summary>
/// Radar reports (Part B)
/// </summary>
[CodeForm(RADOB)] RadarReportsPartB = (byte) 'C',
/// <summary>
/// Radar reports (Parts A & B)
/// </summary>
[CodeForm(RADOB)] RadarReportsPartsAB = (byte) 'D',
/// <summary>
/// Seismic data
/// </summary>
[CodeForm("SEISMIC", "SEISMIC")] SeismicData = (byte) 'E',
/// <summary>
/// Atmospherics reports
/// </summary>
[CodeForm(SFAZI), CodeForm(SFLOC), CodeForm(SFAZU)] AtmosphericsReports = (byte) 'F',
/// <summary>
/// Radiological data report
/// </summary>
[CodeForm(RADREP)] RadiologicalDataReport = (byte) 'G',
/// <summary>
/// Reports from DCP stations
/// </summary>
[AnyFormat] ReportsFromDCPStations = (byte) 'H',
/// <summary>
/// Intermediate synoptic hour
/// </summary>
[CodeForm(SYNOP), CodeForm(SHIP)] IntermediateSynopticHour = (byte) 'I',
/// <summary>
/// Main synoptic hour
/// </summary>
[CodeForm(SYNOP), CodeForm(SHIP)] MainSynopticHour = (byte) 'M',
/// <summary>
/// Non-standard synoptic hour
/// </summary>
[CodeForm(SYNOP), CodeForm(SHIP)] NonStandardSynopticHour = (byte) 'N',
/// <summary>
/// Oceanographic data
/// </summary>
[CodeForm(BATHY), CodeForm(TESAC), CodeForm(TRACKOB)] OceanographicData = (byte) 'O',
/// <summary>
/// Special aviation weather reports
/// </summary>
[CodeForm(SPECI)] SpecialAviationWeatherReports = (byte) 'P',
/// <summary>
/// Hydrological (river) reports
/// </summary>
[CodeForm(HYDRA)] HydrologicalRiverReports = (byte) 'R',
/// <summary>
/// Drifting buoy reports
/// </summary>
[CodeForm(BUOY), CodeForm("FM 18", "DRIFTER")] DriftingBuoyReports = (byte) 'S',
/// <summary>
/// Sea ice
/// </summary>
[Text] SeaIce = (byte) 'T',
/// <summary>
/// Snow depth
/// </summary>
[Text] SnowDepth = (byte) 'U',
/// <summary>
/// Lake ice
/// </summary>
[Text] LakeIce = (byte) 'V',
/// <summary>
/// Wave information
/// </summary>
[CodeForm(WAVEOB)] WaveInformation = (byte) 'W',
/// <summary>
/// Miscellaneous
/// </summary>
[Text] Miscellaneous = (byte) 'X',
/// <summary>
/// Seismic waveform data
/// </summary>
[AnyFormat] SeismicWaveformData = (byte) 'Y',
/// <summary>
/// Sea-level data and deep-ocean tsunami data
/// </summary>
[AnyFormat(AlphanumericOnly = true)] SeaLevelDataAndDeepOceanTsunamiData = (byte) 'Z',
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.