content stringlengths 23 1.05M |
|---|
namespace AutoBot.Core.Samples
{
public interface IFoo
{
string SayFoo();
}
}
|
public class Alert {
public readonly string content;
public readonly bool priority;
public Alert(string content) {
this.content = content;
}
public Alert(string content, bool priority) {
this.content = content;
this.priority = priority;
}
}
|
namespace MYOB.AccountRight.SDK.Contracts.Version2.Contact
{
/// <summary>
/// Describes a link to a Customer resource
/// </summary>
public class CustomerLink : CardLink
{
}
} |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FatturaElettronica.Ordinaria.FatturaElettronicaBody.DatiGenerali;
using Tests;
namespace Ordinaria.Tests
{
[TestClass]
public class DatiDocumentoValidator
: BaseDatiDocumentoValidator<DatiOrdineAcquisto, FatturaElettronica.Validators.DatiOrdineAcquistoValidator>
{
}
}
|
using bisSport.Domain.Core;
using FluentNHibernate.Mapping;
namespace bisSport.Server.Mappings
{
public class StructureMap : ClassMap<Structure>
{
public StructureMap()
{
Table("Structures");
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.TypeGuid).Column("TypeGuid");
Map(x => x.Status);
References(x => x.SportType, "SportTypeId").Cascade.SaveUpdate();
HasMany(x => x.Rounds).KeyColumn("StructureId").Cascade.AllDeleteOrphan();
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
public class CiscoCodecPhonebook
{
public class Offset
{
public string Value { get; set; }
}
public class Limit
{
public string Value { get; set; }
}
public class TotalRows
{
public string Value { get; set; }
}
public class ResultInfo
{
public Offset Offset { get; set; }
public Limit Limit { get; set; }
public TotalRows TotalRows { get; set; }
}
public class LocalId
{
public string Value { get; set; }
}
public class FolderId
{
public string Value { get; set; }
}
public class ParentFolderId
{
public string Value { get; set; }
}
public class Name
{
public string Value { get; set; }
}
public class Folder
{
public string id { get; set; }
public LocalId LocalId { get; set; }
public FolderId FolderId { get; set; }
public Name Name { get; set; }
public ParentFolderId ParentFolderId { get; set; }
}
public class Name2
{
public string Value { get; set; }
}
public class ContactId
{
public string Value { get; set; }
}
public class FolderId2
{
public string Value { get; set; }
}
public class Title
{
public string Value { get; set; }
}
public class ContactMethodId
{
public string Value { get; set; }
}
public class Number
{
public string Value { get; set; }
}
public class Device
{
public string Value { get; set; }
}
public class CallType
{
public string Value { get; set; }
}
public class ContactMethod
{
public string id { get; set; }
public ContactMethodId ContactMethodId { get; set; }
public Number Number { get; set; }
public Device Device { get; set; }
public CallType CallType { get; set; }
public ContactMethod()
{
ContactMethodId = new ContactMethodId();
Number = new Number();
Device = new Device();
CallType = new CallType();
}
}
public class Contact
{
public string id { get; set; }
public Name2 Name { get; set; }
public ContactId ContactId { get; set; }
public FolderId2 FolderId { get; set; }
public Title Title { get; set; }
public List<ContactMethod> ContactMethod { get; set; }
public Contact()
{
Name = new Name2();
ContactId = new ContactId();
FolderId = new FolderId2();
Title = new Title();
ContactMethod = new List<ContactMethod>();
}
}
public class PhonebookSearchResult
{
public string status { get; set; }
public ResultInfo ResultInfo { get; set; }
public List<Folder> Folder { get; set; }
public List<Contact> Contact { get; set; }
public PhonebookSearchResult()
{
Folder = new List<Folder>();
Contact = new List<Contact>();
ResultInfo = new ResultInfo();
}
}
public class CommandResponse
{
public PhonebookSearchResult PhonebookSearchResult { get; set; }
}
public class RootObject
{
public CommandResponse CommandResponse { get; set; }
}
/// <summary>
/// Extracts the folders with no ParentFolder and returns them sorted alphabetically
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public static List<DirectoryItem> GetRootFoldersFromSearchResult(PhonebookSearchResult result)
{
var rootFolders = new List<DirectoryItem>();
if (result.Folder.Count == 0)
{
return null;
}
else if (result.Folder.Count > 0)
{
if (Debug.Level > 0)
Debug.Console(1, "Phonebook Folders:\n");
foreach (Folder f in result.Folder)
{
var folder = new DirectoryFolder();
folder.Name = f.Name.Value;
folder.FolderId = f.FolderId.Value;
if (f.ParentFolderId == null)
rootFolders.Add(folder);
if (Debug.Level > 0)
Debug.Console(1, "+ {0}", folder.Name);
}
}
rootFolders.OrderBy(f => f.Name);
return rootFolders;
}
/// <summary>
/// Extracts the contacts with no FolderId and returns them sorted alphabetically
/// </summary>
/// <param name="result"></param>
/// <returns></returns>
public static List<DirectoryItem> GetRootContactsFromSearchResult(PhonebookSearchResult result)
{
var rootContacts = new List<DirectoryItem>();
if (result.Contact.Count == 0)
{
return null;
}
else if (result.Contact.Count > 0)
{
if (Debug.Level > 0)
Debug.Console(1, "Root Contacts:\n");
foreach (Contact c in result.Contact)
{
var contact = new DirectoryContact();
if (string.IsNullOrEmpty(c.FolderId.Value))
{
contact.Name = c.Name.Value;
contact.ContactId = c.ContactId.Value;
if(!string.IsNullOrEmpty(c.Title.Value))
contact.Title = c.Title.Value;
if (Debug.Level > 0)
Debug.Console(1, "{0}\nContact Methods:", contact.Name);
foreach (ContactMethod m in c.ContactMethod)
{
var tempContactMethod = new PepperDash.Essentials.Devices.Common.Codec.ContactMethod();
eContactMethodCallType callType = eContactMethodCallType.Unknown;
if (!string.IsNullOrEmpty(m.CallType.Value))
{
if (!string.IsNullOrEmpty(m.CallType.Value))
{
if (m.CallType.Value.ToLower() == "audio")
callType = eContactMethodCallType.Audio;
else if (m.CallType.Value.ToLower() == "video")
callType = eContactMethodCallType.Video;
tempContactMethod.CallType = callType;
}
}
eContactMethodDevice device = eContactMethodDevice.Unknown;
if (!string.IsNullOrEmpty(m.Device.Value))
{
if (m.Device.Value.ToLower() == "mobile")
device = eContactMethodDevice.Mobile;
else if (m.Device.Value.ToLower() == "telephone")
device = eContactMethodDevice.Telephone;
else if (m.Device.Value.ToLower() == "video")
device = eContactMethodDevice.Video;
else if (m.Device.Value.ToLower() == "other")
device = eContactMethodDevice.Other;
tempContactMethod.Device = device;
}
if (Debug.Level > 0)
Debug.Console(1, "Number: {0}", m.Number.Value);
tempContactMethod.Number = m.Number.Value;
tempContactMethod.ContactMethodId = m.ContactMethodId.Value;
contact.ContactMethods.Add(tempContactMethod);
}
rootContacts.Add(contact);
}
}
}
rootContacts.OrderBy(f => f.Name);
return rootContacts;
}
/// <summary>
/// Converts data returned from a cisco codec to the generic Directory format.
/// </summary>
/// <param name="result"></param>
/// <param name="resultFolder"></param>
/// <returns></returns>
public static CodecDirectory ConvertCiscoPhonebookToGeneric(PhonebookSearchResult result)
{
var directory = new Codec.CodecDirectory();
var folders = new List<Codec.DirectoryItem>();
var contacts = new List<Codec.DirectoryItem>();
try
{
if (result.Folder.Count > 0)
{
foreach (Folder f in result.Folder)
{
var folder = new DirectoryFolder();
folder.Name = f.Name.Value;
folder.FolderId = f.FolderId.Value;
if (f.ParentFolderId != null)
{
folder.ParentFolderId = f.ParentFolderId.Value;
}
folders.Add(folder);
}
folders.OrderBy(f => f.Name);
directory.AddFoldersToDirectory(folders);
}
if (result.Contact.Count > 0)
{
foreach (Contact c in result.Contact)
{
var contact = new DirectoryContact();
contact.Name = c.Name.Value;
contact.ContactId = c.ContactId.Value;
if (!string.IsNullOrEmpty(c.Title.Value))
contact.Title = c.Title.Value;
if (c.FolderId != null)
{
contact.FolderId = c.FolderId.Value;
}
foreach (ContactMethod m in c.ContactMethod)
{
eContactMethodCallType callType = eContactMethodCallType.Unknown;
if (!string.IsNullOrEmpty(m.CallType.Value))
{
if (m.CallType.Value.ToLower() == "audio")
callType = eContactMethodCallType.Audio;
else if (m.CallType.Value.ToLower() == "video")
callType = eContactMethodCallType.Video;
}
eContactMethodDevice device = eContactMethodDevice.Unknown;
if (!string.IsNullOrEmpty(m.Device.Value))
{
if (m.Device.Value.ToLower() == "mobile")
device = eContactMethodDevice.Mobile;
else if (m.Device.Value.ToLower() == "telephone")
device = eContactMethodDevice.Telephone;
else if (m.Device.Value.ToLower() == "video")
device = eContactMethodDevice.Video;
else if (m.Device.Value.ToLower() == "other")
device = eContactMethodDevice.Other;
}
contact.ContactMethods.Add(new PepperDash.Essentials.Devices.Common.Codec.ContactMethod()
{
Number = m.Number.Value,
ContactMethodId = m.ContactMethodId.Value,
CallType = callType,
Device = device
});
}
contacts.Add(contact);
}
contacts.OrderBy(c => c.Name);
directory.AddContactsToDirectory(contacts);
}
}
catch (Exception e)
{
Debug.Console(1, "Error converting Cisco Phonebook results to generic: {0}", e);
}
return directory;
}
}
} |
namespace AggregateConsistency.Infrastructure
{
public interface IKnownSerializers
{
ISerializationPair<IEventSerializer, IEventDeserializer> Events { get; }
ISerializationPair<ISnapshotSerializer, ISnapshotDeserializer> Snapshots { get; }
}
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace MathParser.LanguageModel
{
public class Product : BinaryOperation
{
public Product(Expression left, Expression right) :
base(left, right)
{ }
}
}
|
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SocialMedia.Infrastructure.Core;
using System;
using System.Collections.Generic;
using System.Text;
namespace SocialMedia.Infrastructure.Data.Configurations
{
public class AspnetProfileConfiguration : IEntityTypeConfiguration<AspnetProfile>
{
public void Configure(EntityTypeBuilder<AspnetProfile> entity)
{
entity.HasKey(e => e.UserId)
.HasName("PK__aspnet_P__1788CC4C446E7D24");
entity.ToTable("aspnet_Profile");
entity.Property(e => e.UserId).ValueGeneratedNever();
entity.Property(e => e.LastUpdatedDate).HasColumnType("datetime");
entity.Property(e => e.PropertyNames)
.IsRequired()
.HasColumnType("ntext");
entity.Property(e => e.PropertyValuesBinary)
.IsRequired()
.HasColumnType("image");
entity.Property(e => e.PropertyValuesString)
.IsRequired()
.HasColumnType("ntext");
entity.HasOne(d => d.User)
.WithOne(p => p.AspnetProfile)
.HasForeignKey<AspnetProfile>(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK__aspnet_Pr__UserI__75A278F5");
}
}
}
|
// Use the toolbox service to get a list of all toolbox items in
// this assembly.
ToolboxItemList = new ArrayList(
ToolboxService.GetToolboxItems(this.GetType().Assembly, ""));
if (null == ToolboxItemList)
{
throw new ApplicationException(
"Unable to generate a toolbox item listing for " +
this.GetType().FullName);
}
// Update the display name of each toolbox item in the list.
Assembly thisAssembly = this.GetType().Assembly;
foreach (ToolboxItem item in ToolboxItemList)
{
Type underlyingType = thisAssembly.GetType(item.TypeName);
AttributeCollection attribs =
TypeDescriptor.GetAttributes(underlyingType);
DisplayNameAttribute displayName =
attribs[typeof(DisplayNameAttribute)] as DisplayNameAttribute;
if (displayName != null && !displayName.IsDefaultAttribute())
{
item.DisplayName = displayName.DisplayName;
}
} |
using System;
namespace Launcher
{
/// <summary>
/// Defines extension methods for enumeration types.
/// </summary>
public static class EnumExtensions
{
[ThreadStatic] private static Enum getNameValueCache;
/// <summary>
/// Gets the name of the constant in the enumeration.
/// </summary>
/// <remarks>This method only works reliably when given constant has a unique value in the enumeration.</remarks>
/// <typeparam name="T">Type of the enumeration.</typeparam>
/// <param name="value">A constant which value we need.</param>
/// <returns>A name of the constant in the enumeration that has its value match the given one.</returns>
public static string GetName<T>(this T value) where T : Enum
{
// Cache the value to prevent boxing operation from creating a temporary object.
getNameValueCache = value;
return Enum.GetName(typeof(T), getNameValueCache);
}
}
} |
using Order.Application.Contracts.Persistence;
using Order.Domain.Entities;
using Order.Infrastructure.Persistence;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Order.Infrastructure.Repositories
{
public class OrderRepository : RepositoryBase<OrderEntity>, IOrderRepository
{
public OrderRepository(OrderContext dbContext) : base(dbContext)
{
}
public async Task<IReadOnlyList<OrderEntity>> GetByUsername(string username)
{
return await GetAsync(i => i.Username == username);
}
}
}
|
// Copyright (c) Russlan Akiev. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
namespace IdentityBase.Localization
{
using System;
using System.Linq;
using System.Threading.Tasks;
using IdentityBase.Configuration;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives;
public class IdentityBaseRequestCultureProvider : IRequestCultureProvider
{
public async Task<ProviderCultureResult>
DetermineProviderCultureResult(HttpContext httpContext)
{
IdentityBaseContext idbContext =
httpContext.RequestServices
.GetService<IdentityBaseContext>();
ApplicationOptions appOptions =
httpContext.RequestServices
.GetService<ApplicationOptions>();
if (idbContext.IsValid)
{
string culture = httpContext.Request.Query["culture"];
if (String.IsNullOrWhiteSpace(culture) &&
idbContext.AuthorizationRequest != null)
{
culture = idbContext
.AuthorizationRequest
.Parameters?
.GetValues("culture")?
.FirstOrDefault();
}
// TODO: Get all theme supported cultures
if (String.IsNullOrWhiteSpace(culture))
{
// TODO: Replace by client overrides for application options
culture = idbContext.ClientProperties.Culture ??
appOptions.DefaultCulture;
}
if (culture != null)
{
return new ProviderCultureResult(
new StringSegment(culture));
}
}
return null;
}
}
}
|
using SharpMixin.Attributes;
using Xunit;
namespace SharpMixin.Tests
{
public partial class PropertyGetSetOnlyTests
{
[Fact]
public void Should_GetOnlyProperty_NotHave_Setter()
{
var getOnlyProperty = typeof(GetSetOnlyMixin).GetProperty(nameof(IGetOnly.Get));
Assert.NotNull(getOnlyProperty);
Assert.False(getOnlyProperty.CanWrite);
Assert.True(getOnlyProperty.CanRead);
}
[Fact]
public void Should_SetOnlyProperty_NotHave_Setter()
{
var setOnlyProperty = typeof(GetSetOnlyMixin).GetProperty(nameof(ISetOnly.Set));
Assert.NotNull(setOnlyProperty);
Assert.True(setOnlyProperty.CanWrite);
Assert.False(setOnlyProperty.CanRead);
}
[Mixin]
public partial class GetSetOnlyMixin : IGetOnly, ISetOnly
{
}
public interface IGetOnly
{
string Get { get; }
}
public interface ISetOnly
{
string Set { set; }
}
}
} |
using System;
namespace StepFly.Dtos
{
public class HistoryDto
{
public long Id { get; set; }
public string UserKeyInfo { get; set; }
public int StepNum { get; set; }
public DateTime CreationTime { get; set; }
}
}
|
using System;
namespace Signals.Aspects.ErrorHandling.Strategies
{
/// <summary>
/// Represents execution strategy
/// </summary>
public abstract class Strategy
{
/// <summary>
/// Callback handler for when an exception occures
/// </summary>
public Action<Exception> OnRetry { get; set; }
}
}
|
using Engine;
using Engine.UI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
class PlayingState : GameState, IPlayingState
{
Level level;
Button quitButton;
SpriteGameObject completedOverlay, gameOverOverlay;
public PlayingState()
{
// add a "quit" button
quitButton = new Button("Sprites/UI/spr_button_quit", 1);
quitButton.LocalPosition = new Vector2(1290, 20);
quitButton.scrollFactor = 0;
gameObjects.AddChild(quitButton);
// add overlay images
completedOverlay = AddOverlay("Sprites/UI/spr_welldone");
gameOverOverlay = AddOverlay("Sprites/UI/spr_gameover");
completedOverlay.scrollFactor = 0;
gameOverOverlay.scrollFactor = 0;
}
SpriteGameObject AddOverlay(string spriteName)
{
SpriteGameObject result = new SpriteGameObject(spriteName, 1);
result.SetOriginToCenter();
result.LocalPosition = new Vector2(720, 412);
gameObjects.AddChild(result);
return result;
}
public override void HandleInput(InputHelper inputHelper)
{
base.HandleInput(inputHelper);
if (level != null)
{
// if the player character has died, allow the player to reset the level
if (gameOverOverlay.Visible)
{
if (inputHelper.KeyPressed(Keys.Space))
{
level.Reset();
ExtendedGame.camera.Reset();
}
}
// if the level has been completed, pressing the spacebar should send the player to the next level
else if (completedOverlay.Visible)
{
if (inputHelper.KeyPressed(Keys.Space))
{
ExtendedGameWithLevels.GoToNextLevel(level.LevelIndex);
ExtendedGame.camera.Reset();
}
}
// otherwise, update the level itself, and check for button presses
else
{
level.HandleInput(inputHelper);
// Pressing the quit button brings you back to level selection and resets the camera.
if (quitButton.Pressed)
{
ExtendedGame.GameStateManager.SwitchTo(ExtendedGameWithLevels.StateName_LevelSelect);
ExtendedGame.camera.OffsetX = 0;
ExtendedGame.camera.OffsetY = 0;
}
}
}
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (level != null)
level.Update(gameTime);
// show or hide the "game over" image
gameOverOverlay.Visible = !level.Player.IsAlive;
}
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
base.Draw(gameTime, spriteBatch);
if (level != null)
level.Draw(gameTime, spriteBatch);
}
public void LoadLevel(int levelIndex)
{
level = new Level(levelIndex, ExtendedGame.ContentRootDirectory + "/Levels/level" + levelIndex + ".txt");
// hide the overlay images
completedOverlay.Visible = false;
gameOverOverlay.Visible = false;
}
public void LevelCompleted(int levelIndex)
{
// show an overlay image
completedOverlay.Visible = true;
// play a sound
ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_won");
// mark the level as solved, and unlock the next level
ExtendedGameWithLevels.MarkLevelAsSolved(levelIndex);
}
} |
using NUnit.Framework;
using System;
using yase_core.Models;
namespace yase_core.Models.Tests
{
[TestFixture]
public class MappingTests
{
[Test]
public void Should_map_HasingModel_to_ShortUrl()
{
var model = new HashingModel
{
OriginalUrl = new Uri("https://www.example.com?param1=1¶m2=2"),
TinyUrl = new Uri("http://aa.com/aAbB123"),
HashedUrl = "aAbB123",
ttl = 1234
};
var mapped = model.To();
Assert.AreEqual ("https://www.example.com/?param1=1¶m2=2", mapped.OriginalUrl);
Assert.AreEqual ("aAbB123", mapped.TinyUrl);
Assert.AreEqual (1234, mapped.ttl);
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LinqExercises
{
public class Person : IEquatable<Person>
{
public Person(string firstName, string lastName, DateTime dateOfBirth, Gender gender)
{
this.FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName));
this.LastName = lastName ?? throw new ArgumentNullException(nameof(lastName));
this.Gender = gender;
this.DateOfBirth = dateOfBirth;
}
public string FirstName
{
get;
}
public string LastName
{
get;
}
public string FullName
=> $"{FirstName} {LastName}";
public Gender Gender
{
get;
}
public DateTime DateOfBirth
{
get;
}
public int Age
=> DateTime.Today.Year - DateOfBirth.Year;
public bool Equals(Person other)
{
if (other is null)
{
return false;
}
return string.Equals(FirstName, other.FirstName, StringComparison.OrdinalIgnoreCase) &&
string.Equals(LastName, other.LastName, StringComparison.OrdinalIgnoreCase) &&
Gender == other.Gender &&
DateOfBirth == other.DateOfBirth;
}
public override bool Equals(object obj)
{
return Equals(obj as Person);
}
public void Print()
{
Print(-1);
}
public void Print(int index)
{
Console.WriteLine(
index >= 0
? $"{index}) {FullName} date of birth: {DateOfBirth}, age: {Age}"
: $"{FullName} date of birth: {DateOfBirth}, age: {Age}");
}
public override int GetHashCode()
{
return HashCode.Combine(FirstName, LastName, Gender, DateOfBirth);
}
public Person Clone()
{
return new Person(FirstName, LastName, DateOfBirth, Gender);
}
}
}
|
using Microsoft.AspNetCore.Builder;
namespace FrontEnd.Handlers
{
/// <summary>
/// Proxy Extension
/// </summary>
public static class ApiProxyExtension
{
/// <summary>
/// Use Proxy Server
/// </summary>
/// <param name="app"></param>
/// <param name="apiUrl"></param>
/// <returns></returns>
public static IApplicationBuilder UseApiProxyServer(this IApplicationBuilder app, string apiUrl)
{
return app.Map(apiUrl, ProxyRequest);
}
/// <summary>
/// Proxy Request
/// </summary>
/// <param name="app"></param>
private static void ProxyRequest(IApplicationBuilder app)
{
app.UseMiddleware<ApiProxyMiddleware>();
}
}
}
|
namespace YeGods.Domain
{
using System.ComponentModel.DataAnnotations.Schema;
[Table("DeitySlugs")]
public class DeitySlug : BaseEntity
{
public string Name { get; set; }
public bool IsDefault { get; set; }
public int DeityId { get; set; }
[ForeignKey("DeityId")]
public Deity Deity { get; set; }
}
}
|
using System.Numerics;
using System.Runtime.CompilerServices;
namespace Engine.Game.Components
{
public static class Vector2Ext
{
/// <summary>
/// a and b lay in XY plane, so result vector has only Z value
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Cross(Vector2 a, Vector2 b)
{
return a.X * b.Y - b.X * a.Y;
}
/// <summary>
/// a has only Z value, b lays in XY plane
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Cross(float aZ, Vector2 b)
{
return new Vector2(-b.Y * aZ, aZ * b.X);
}
/// <summary>
/// a lays in XY plane, b has only Z value
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Cross(Vector2 a, float bZ)
{
return new Vector2(a.Y * bZ, -bZ * a.X);
}
/// <summary>
/// Dot(RightPerp(a), b)
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float CrossPseudo(Vector2 a, Vector2 b)
{
return a.Y * b.X - a.X * b.Y;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 NormalizeSafe(Vector2 v)
{
return IsZero(v) ? v : Vector2.Normalize(v);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 Rotate(Vector2 vector, Vector2 rotation)
{
return new Vector2(
rotation.X * vector.X - rotation.Y * vector.Y,
rotation.Y * vector.X + rotation.X * vector.Y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 RotateInverse(Vector2 vector, Vector2 rotation)
{
return new Vector2(
rotation.X * vector.X + rotation.Y * vector.Y,
-rotation.Y * vector.X + rotation.X * vector.Y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 LeftPerp(Vector2 vector)
{
return new Vector2(-vector.Y, vector.X);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector2 RightPerp(Vector2 vector)
{
return new Vector2(vector.Y, -vector.X);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsZero(Vector2 vector)
{
return vector.X == 0 && vector.Y == 0;
}
}
}
|
using System;
using Uno.Collections;
using Uno;
using Uno.Platform;
namespace Outracks.Simulator
{
public static class Closure
{
public static Action<TArg2> ApplyFirst<TArg1, TArg2>(Action<TArg1, TArg2> action, TArg1 arg1)
{
return new ApplyFirst<TArg1, TArg2>(action, arg1).Execute;
}
public static Action<TArg1> ApplySecond<TArg1, TArg2>(Action<TArg1, TArg2> action, TArg2 arg2)
{
return new ApplySecond<TArg1, TArg2>(action, arg2).Execute;
}
public static Func<TArg, TResult> Return<TArg, TResult>(TResult result)
{
return new Forget<TArg, TResult>(result).Execute;
}
public static Action Apply<T>(this Action<T> action, T arg)
{
return new Apply<T>(action, arg).Execute;
}
public static Action<TArg1, TArg2> Forget<TArg1, TArg2>(this Action action)
{
return new ForgetAction<TArg1, TArg2>(action).Execute;
}
public static EventHandler ToEventHandler(this Action action)
{
return new ForgetAction<object, EventArgs>(action).Execute;
}
public static ApplicationStateTransitionHandler ToAppStateChangeHandler(this Action action)
{
return new ForgetAction<ApplicationState>(action).Execute;
}
}
class Forget<TArg, TResult>
{
readonly TResult _result;
public Forget(TResult result)
{
_result = result;
}
public TResult Execute(TArg _)
{
return _result;
}
}
public class ForgetAction<TArg1>
{
readonly Action _action;
public ForgetAction(Action action)
{
_action = action;
}
public void Execute(TArg1 arg1)
{
_action();
}
}
public class ForgetAction<TArg1, TArg2>
{
readonly Action _action;
public ForgetAction(Action action)
{
_action = action;
}
public void Execute(TArg1 arg1, TArg2 arg2)
{
_action();
}
}
class Forget<TArg1, TArg2, TResult>
{
readonly TResult _result;
public Forget(TResult result)
{
_result = result;
}
public TResult Execute(TArg1 arg1, TArg2 arg2)
{
return _result;
}
}
class Apply<TArg1>
{
readonly Action<TArg1> _action;
readonly TArg1 _arg1;
public Apply(Action<TArg1> action, TArg1 arg1)
{
_action = action;
_arg1 = arg1;
}
public void Execute()
{
_action(_arg1);
}
}
class ApplyFirst<TArg1, TArg2>
{
readonly Action<TArg1, TArg2> _action;
readonly TArg1 _arg1;
public ApplyFirst(Action<TArg1, TArg2> action, TArg1 arg1)
{
_action = action;
_arg1 = arg1;
}
public void Execute(TArg2 arg2)
{
_action(_arg1, arg2);
}
}
class ApplySecond<TArg1, TArg2>
{
readonly Action<TArg1, TArg2> _action;
readonly TArg2 _arg2;
public ApplySecond(Action<TArg1, TArg2> action, TArg2 arg2)
{
_action = action;
_arg2 = arg2;
}
public void Execute(TArg1 arg1)
{
_action(arg1, _arg2);
}
}
}
|
using Nodsoft.Wargaming.Api.Common.Data.Responses.Wows.Public;
namespace Nodsoft.Wargaming.Api.Common.Data.Responses.Wows.Vortex;
public class VortexAccountClanInfo
{
public ClanListing? Clan { get; init; }
public DateTime? JoinedAt { get; init; }
public ClanRole Role { get; init; }
public uint? ClanId { get; set; }
} |
// WARNING
//
// This file has been generated automatically by Visual Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
namespace SpaceMemory.iOS.Views
{
[Register ("PrepareView")]
partial class PrepareView
{
[Outlet]
UIKit.UIView BackgroundView { get; set; }
[Outlet]
UIKit.UIButton CancelButton { get; set; }
[Outlet]
UIKit.UIView PlayerNameDashedLineView { get; set; }
[Outlet]
UIKit.UILabel PlayerNameLabel { get; set; }
[Outlet]
UIKit.UITextField PlayerNameTextField { get; set; }
[Outlet]
UIKit.UIView PlaygroundSizeDashedLineView { get; set; }
[Outlet]
UIKit.UILabel PlaygroundSizeLabel { get; set; }
[Outlet]
UIKit.UISlider PlaygroundSizeSlider { get; set; }
[Outlet]
UIKit.UIView PlaygroundSizeValueDashedLineView { get; set; }
[Outlet]
UIKit.UILabel PlaygroundSizeValueLabel { get; set; }
[Outlet]
UIKit.UIButton StartButton { get; set; }
void ReleaseDesignerOutlets ()
{
}
}
} |
// ---------------------------------------------------------------------
//
// Copyright (c) 2019 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Creator Agreement, located
// here: https://id.magicleap.com/creator-terms
//
// ---------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
using MagicLeapTools;
#if PLATFORM_LUMIN
using UnityEngine.XR.MagicLeap;
#endif
public class ControlInputExample : MonoBehaviour
{
#if PLATFORM_LUMIN
//Public Variables:
public ControlInput controlInput;
public Text status;
public Text events;
//Private Variables:
private readonly int _maxEvents = 20;
private List<string> _events = new List<string>();
//Init:
private void Awake()
{
//control events:
controlInput.OnControlConnected.AddListener(HandleControlConnected);
controlInput.OnControlDisconnected.AddListener(HandleControlDisconnected);
//trigger events:
controlInput.OnTriggerMove.AddListener(HandleTriggerMove);
controlInput.OnTriggerPressBegan.AddListener(HandleTriggerPressBegan);
controlInput.OnTriggerDown.AddListener(HandleTriggerDown);
controlInput.OnTriggerHold.AddListener(HandleTriggerHold);
controlInput.OnTriggerUp.AddListener(HandleTriggerUp);
controlInput.OnTriggerPressEnded.AddListener(HandleTriggerReleased);
controlInput.OnDoubleTrigger.AddListener(HandleDoubleTrigger);
//bumper events:
controlInput.OnBumperDown.AddListener(HandleBumperDown);
controlInput.OnBumperHold.AddListener(HandleBumperHold);
controlInput.OnBumperUp.AddListener(HandleBumperUp);
controlInput.OnDoubleBumper.AddListener(HandleDoubleBumper);
//home events:
controlInput.OnHomeButtonTap.AddListener(HandleHomeTap);
controlInput.OnDoubleHome.AddListener(HandleDoubleHome);
//touch events:
controlInput.OnForceTouchDown.AddListener(HandleForceTouchDown);
controlInput.OnForceTouchUp.AddListener(HandleForceTouchUp);
controlInput.OnSwipe.AddListener(HandleSwipe);
controlInput.OnTapped.AddListener(HandleTapped);
controlInput.OnTouchBeganMoving.AddListener(HandleTouchBeganMoving);
controlInput.OnTouchDown.AddListener(HandleTouchDown);
controlInput.OnTouchHold.AddListener(HandleTouchHold);
controlInput.OnTouchMove.AddListener(HandleTouchMove);
controlInput.OnTouchRadialMove.AddListener(HandleTouchRadialMove);
controlInput.OnTouchUp.AddListener(HandleTouchUp);
}
//Loops:
private void Update()
{
//control properties:
status.text = "Control Connected: " + controlInput.Connected + "\n";
status.text += "Control Position: " + controlInput.Position + "\n";
status.text += "Control Orientation: " + controlInput.Orientation.eulerAngles + "\n";
//trigger properties:
status.text += "Trigger Down: " + controlInput.Trigger + "\n";
status.text += "Trigger Value: " + controlInput.TriggerValue + "\n";
//bumper properties:
status.text += "Bumper Down: " + controlInput.Bumper + "\n";
//touch properties:
status.text += "Force Touch: " + controlInput.ForceTouch + "\n";
status.text += "Touch Active: " + controlInput.Touch + "\n";
status.text += "Touch Moved: " + controlInput.TouchMoved + "\n";
status.text += "Touch Radial Delta: " + controlInput.TouchRadialDelta + "\n";
status.text += "Touch: " + controlInput.TouchValue + "\n";
}
//Event Handlers:
private void HandleControlConnected()
{
AddEvent("Control Connected");
}
private void HandleControlDisconnected()
{
AddEvent("Control Disconnected");
}
private void HandleTriggerPressBegan()
{
AddEvent("Trigger Began Moving");
}
private void HandleTriggerMove(float value)
{
AddEvent("Trigger Moved " + value);
}
private void HandleTriggerDown()
{
AddEvent("Trigger Down");
}
private void HandleTriggerHold()
{
AddEvent("Trigger Hold");
}
private void HandleTriggerUp()
{
AddEvent("Trigger Up");
}
private void HandleTriggerReleased()
{
AddEvent("Trigger Fully Released");
}
private void HandleDoubleTrigger()
{
AddEvent("Trigger Double Pull");
}
private void HandleBumperDown()
{
AddEvent("Bumper Down");
}
private void HandleBumperHold()
{
AddEvent("Bumper Hold");
}
private void HandleBumperUp()
{
AddEvent("Bumper Up");
}
private void HandleDoubleBumper()
{
AddEvent("Bumper Double Press");
}
private void HandleHomeTap()
{
AddEvent("Home Tap");
}
private void HandleDoubleHome()
{
AddEvent("Home Double Press");
}
private void HandleTouchHold()
{
AddEvent("Touch Hold");
}
private void HandleForceTouchDown()
{
AddEvent("Force Touch Down");
}
private void HandleForceTouchUp()
{
AddEvent("Force Touch Up");
}
private void HandleSwipe(MLInputControllerTouchpadGestureDirection value)
{
AddEvent("Swipe " + value);
}
private void HandleTapped(MLInputControllerTouchpadGestureDirection value)
{
AddEvent("Tap " + value);
}
private void HandleTouchBeganMoving()
{
AddEvent("Touch Began Moving");
}
private void HandleTouchDown(Vector4 value)
{
AddEvent("Touch Down " + value);
}
private void HandleTouchMove(Vector4 value)
{
AddEvent("Touch Move " + value);
}
private void HandleTouchRadialMove(float value)
{
AddEvent("Touch Radial Move " + value);
}
private void HandleTouchUp(Vector4 value)
{
AddEvent("Touch Touch Up " + value);
}
//Private Methods:
private void AddEvent(string newEvent)
{
_events.Add(newEvent);
//too many events?
if (_events.Count > _maxEvents)
{
_events.RemoveAt(0);
}
//display events:
events.text = string.Join(Environment.NewLine, _events.ToArray());
}
#endif
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireWeapon : MonoBehaviour
{
[SerializeField] Camera cameraController;
[SerializeField] Transform rayOrigin;
[SerializeField] float shootDistance = 10f;
[SerializeField] GameObject visualFeebackobject;
[SerializeField] int weaponDamge = 25;
RaycastHit objectHit;
void Update()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
Shoot();
}
}
void Shoot()
{
//calculate direction to shoot the ray
Vector3 rayDirection = cameraController.transform.forward;
// cast a debug ray
Debug.DrawRay(rayOrigin.position, rayDirection * shootDistance, Color.blue, 1f);
//do the raycast
if(Physics.Raycast(rayOrigin.position, rayDirection, out objectHit, shootDistance))
{
Debug.Log("You Hit the "+ objectHit.transform.name);
visualFeebackobject.transform.position = objectHit.point;
EnemyShooter enemy = objectHit.transform.gameObject.GetComponent<EnemyShooter>();
if(enemy != null)
{
enemy.TakeDamage(weaponDamge);
}
}
else
{
Debug.Log("Miss.");
}
}
}
|
using System;
namespace AssemblyCSharp
{
public class Globals
{
public static int lastStage = 1;
}
}
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class OnClick_Corridor : MonoBehaviour {
DataControlHub DC; int phase = 0;
void Start () {
DC = GameObject.Find("Data").GetComponent<DataControlHub>();
}
void OnMouseDown() {
if (!DC.S.SH.visitedLobby) DC.UIC.StartDialogue(DC.DialogueOther, DC.S.SH.DSOther, 11, 0, false);
else DoTransition();
}
public void DoTransition() {
var c = DC.bS.color; c.a = 0; DC.bS.color = c; DC.bS.gameObject.SetActive(true);
DC.CursorLock(true); DC.UIC.Col(false); DC.bMenu.SetActive(false);
DC.BGM.volume = 0.4F * COMMON.U.volM; DC.Sound.clip = DC.transition1; DC.Sound.Play();
phase = 1;
}
void Update() {
if (phase == 1 && DC.bS.color.a < 1) {
var c = DC.bS.color; c.a += 0.02F * Time.deltaTime * 60; DC.bS.color = c;
}
else if (phase == 1 && DC.bS.color.a >= 1 && !DC.Sound.isPlaying) {
DC.Sound.clip = DC.elevatorDoors; DC.Sound.Play(); phase = 2;
}
else if (phase == 2 && !DC.Sound.isPlaying) {
DC.camR.gameObject.SetActive(false);
DC.camL.gameObject.SetActive(true);
DC.camL.localPosition = DC.pos; DC.camL.localRotation = DC.rot;
DC.currentColliders = GameObject.Find("Lounge/Colliders"); DC.UIC.Col(false);
DC.GetComponent<HighlightHints>().NPS[0] = DC.currentColliders.transform.Find("Elevator");
phase = 3;
}
else if (phase == 3 && DC.bS.color.a > 0) {
var c = DC.bS.color; c.a -= 0.02F * Time.deltaTime * 60; DC.bS.color = c;
DC.BGM.volume += 0.012F * COMMON.U.volM * Time.deltaTime * 60;
}
else if (phase == 3 && DC.bS.color.a <= 0) {
DC.bS.gameObject.SetActive(false);
DC.UIC.Col(true); DC.bMenu.SetActive(true);
DC.S.SH.currentRoom = 0; DC.CursorLock(false); phase = 0;
}
}
}
|
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;
using System.Text;
namespace Omnius.Core.Remoting
{
[Serializable]
public class RocketPackRpcException : Exception
{
public RocketPackRpcException()
{
}
public RocketPackRpcException(string message)
: base(message)
{
}
public RocketPackRpcException(string message, System.Exception inner)
: base(message, inner)
{
}
protected RocketPackRpcException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
[Serializable]
public class RocketPackRpcProtocolException : RocketPackRpcException
{
public RocketPackRpcProtocolException()
{
}
public RocketPackRpcProtocolException(string message)
: base(message)
{
}
public RocketPackRpcProtocolException(string message, System.Exception inner)
: base(message, inner)
{
}
protected RocketPackRpcProtocolException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
[Serializable]
public class RocketPackRpcApplicationException : RocketPackRpcException
{
public RocketPackRpcApplicationException()
{
}
public RocketPackRpcApplicationException(string message)
: base(message)
{
}
public RocketPackRpcApplicationException(string message, System.Exception inner)
: base(message, inner)
{
}
protected RocketPackRpcApplicationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
|
using System;
using UnityEngine;
namespace SkillEditor
{
public class USTimelineBase : MonoBehaviour
{
private USTimelineContainer timelineContainer;
public Transform AffectedObject
{
get
{
return this.TimelineContainer.AffectedObject;
}
}
public USTimelineContainer TimelineContainer
{
get
{
if (this.timelineContainer)
{
return this.timelineContainer;
}
this.timelineContainer = base.transform.parent.GetComponent<USTimelineContainer>();
return this.timelineContainer;
}
}
public USSequencer Sequence
{
get
{
return this.TimelineContainer.Sequence;
}
}
public bool ShouldRenderGizmos
{
get;
set;
}
public virtual void StopTimeline()
{
}
public virtual void StartTimeline()
{
}
public virtual void EndTimeline()
{
}
public virtual void PauseTimeline()
{
}
public virtual void ResumeTimeline()
{
}
public virtual void SkipTimelineTo(float time)
{
}
public virtual void Process(float sequencerTime, float playbackRate)
{
}
public virtual void ManuallySetTime(float sequencerTime)
{
}
public virtual void LateBindAffectedObjectInScene(Transform newAffectedObject)
{
}
public virtual string GetJson()
{
throw new NotImplementedException();
}
public virtual void ResetCachedData()
{
this.timelineContainer = null;
}
}
}
|
namespace GetReady.Services.Models.QuestionSsheetModels
{
public class QuestionSheetCreate: QuestionSheetCoreData
{
public int ParentSheetId { get; set; }
}
}
|
using System;
namespace BuckarooSdk.Services.PayPerEmail
{
/// <summary>
/// The PayperEmail Payment invitation is a request that has the purpos of sending a payment invitation
/// to a customer. This can be performed by Buckaroo, or a payment link can be returned, in case the
/// mail should be sent by your own system. The payment link is the key element of the PayperEmail and
/// is the link to the Buckaroo Payment Engine.
/// </summary>
public class PayPerEmailPaymentInvitationRequest
{
/// <summary>
/// The gender of the customer, used to properly address the customer in the mail. Possible values are:
///
/// 0 : Unknown
/// 1 : Male
/// 2 : Female
/// 9 : Not applicable
///
/// To be sure that always one of these values are used, the corresponding class with gender constants
/// can be used.
/// </summary>
public int CustomerGender { get; set; }
/// <summary>
/// The file name of a previously uploaded attachment.
/// </summary>
public string Attachment { get; set; }
/// <summary>
/// Defines if Buckaroo has to send the payperemail, or that you wish to get only the paylink returned.
/// when true, the paylink is returned in the response, and Buckaroo will not send the email.
/// </summary>
public bool MerchantSendsEmail { get; set; }
/// <summary>
/// The date you wish to have the PayperEmail expired.
/// </summary>
public DateTime? ExpirationDate { get; set; }
/// <summary>
/// A single or multiple payment methods which the consumer is offered as a choice on the payment page.
/// If no payment methods are defined here, all active payment methods within the merchant account are shown.
/// </summary>
public string PaymentMethodsAllowed { get; set; }
/// <summary>
/// The email address of the customer where the email needs to be send to.
/// </summary>
public string CustomerEmail { get; set; }
/// <summary>
/// The first name of the customer.
/// </summary>
public string CustomerFirstName { get; set; }
/// <summary>
/// The last name of the customer.
/// </summary>
public string CustomerLastName { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XInput = SharpDX.XInput;
namespace craftersmine.EtherEngine.Input
{
/// <summary>
/// Contains gamepad buttons
/// </summary>
public enum GamepadButtons
{
/// <summary>
/// Green A button
/// </summary>
A = XInput.GamepadButtonFlags.A,
/// <summary>
/// Red B button
/// </summary>
B = XInput.GamepadButtonFlags.B,
/// <summary>
/// Blue X button
/// </summary>
X = XInput.GamepadButtonFlags.X,
/// <summary>
/// Yellow Y button
/// </summary>
Y = XInput.GamepadButtonFlags.Y,
/// <summary>
/// Right bumper - RB
/// </summary>
RightBumper = XInput.GamepadButtonFlags.RightShoulder,
/// <summary>
/// Left bumper - LB
/// </summary>
LeftBumper = XInput.GamepadButtonFlags.LeftShoulder,
/// <summary>
/// Right thumbstick - RS
/// </summary>
RightStick = XInput.GamepadButtonFlags.RightThumb,
/// <summary>
/// Left thumbstick - LS
/// </summary>
LeftStick = XInput.GamepadButtonFlags.LeftThumb,
/// <summary>
/// DPad left
/// </summary>
DPadLeft = XInput.GamepadButtonFlags.DPadLeft,
/// <summary>
/// DPad up
/// </summary>
DPadUp = XInput.GamepadButtonFlags.DPadUp,
/// <summary>
/// DPad right
/// </summary>
DPadRight = XInput.GamepadButtonFlags.DPadRight,
/// <summary>
/// DPad down
/// </summary>
DPadDown = XInput.GamepadButtonFlags.DPadDown,
/// <summary>
/// On XOne gamepad three-lines button, equivalent to X360 start button
/// </summary>
Menu = XInput.GamepadButtonFlags.Start,
/// <summary>
/// On XOne gamepad two-rectangles button, equivalent to X360 back button
/// </summary>
View = XInput.GamepadButtonFlags.Back,
/// <summary>
/// On X360 gamepad nearby Guide button white arrow to right, equivalent to XOne Menu button
/// </summary>
Start = XInput.GamepadButtonFlags.Start,
/// <summary>
/// On X360 gamepad nearby Guide button white arrow to left, equivalent to XOne View button
/// </summary>
Back = XInput.GamepadButtonFlags.Back,
/// <summary>
/// None
/// </summary>
None = XInput.GamepadButtonFlags.None
}
}
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
namespace Core.Template.Infrastructure.Filters
{
/// <summary>
///
/// </summary>
public class ApiResponseFilterAttribute : Attribute, IActionFilter
{
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public void OnActionExecuted(ActionExecutedContext context)
{
if (context.Result is ObjectResult @object)
{
context.Result = new ObjectResult(new ApiResponse<object>(@object?.Value));
}
else if (context.Result is EmptyResult)
{
context.Result = new ObjectResult(new ApiResponse<object>());
}
else if (context.Result is JsonResult json)
{
context.Result = new ObjectResult(new ApiResponse<object>(json?.Value));
}
else if (context.Result is ContentResult content)
{
context.Result = new ObjectResult(new ApiResponse<object>(content?.Content));
}
else if (context.Result is StatusCodeResult status)
{
context.Result = new ObjectResult(new ApiResponse<object>());
}
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public virtual void OnActionExecuting(ActionExecutingContext context)
{
}
}
}
|
namespace Eliza.Model
{
public class FesNpcScore
{
public int npcId;
public int score;
}
}
|
@{
ViewData["Title"] = "Home Page";
}
@await Html.PartialAsync("_IntroSection");
<main id="main">
@await Html.PartialAsync("_FeaturedServicesSection")
@await Html.PartialAsync("_AboutMeSection")
@await Html.PartialAsync("_ServicesSection")
@await Html.PartialAsync("_CallToActionSection")
@await Html.PartialAsync("_SkillsSection")
@await Html.PartialAsync("_FactsSection")
@await Html.PartialAsync("_PortfolioSection")
@await Html.PartialAsync("_ClientsSection")
@await Html.PartialAsync("_TestimonialsSection")
@await Html.PartialAsync("_TeamSection")
@await Html.PartialAsync("_ContactSection")
</main>
@*<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>*@
|
using JetBrains.Annotations;
using System;
using Volo.Abp;
namespace Volo.CmsKit.Comments;
public class CommentEntityTypeDefinition : EntityTypeDefinition
{
public CommentEntityTypeDefinition([NotNull] string entityType) : base(entityType)
{
EntityType = Check.NotNullOrEmpty(entityType, nameof(entityType));
}
}
|
/*
* Developed by Gökhan KINAY.
* www.gokhankinay.com.tr
*
* Contact,
* info@gokhankinay.com.tr
*/
namespace ManagerActorFramework
{
public delegate void Subscription<TManager>(object[] arguments) where TManager : Manager<TManager>;
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace TDSBF.Data.Discord.MessageClasses
{
public class Assets
{
public string large_text { get; set; }
public string large_image { get; set; }
}
}
|
using System;
using System.Xml.Serialization;
namespace Aop.Api.Response
{
/// <summary>
/// AlipayEcoPrinterStatusQueryResponse.
/// </summary>
public class AlipayEcoPrinterStatusQueryResponse : AopResponse
{
/// <summary>
/// 0离线 1在线 2缺纸
/// </summary>
[XmlElement("state")]
public long State { get; set; }
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileVariant : MonoBehaviour
{
public Tile[] tiles;
[System.Serializable]
public class Tile
{
public string tileName;
public GameObject model;
}
}
|
using UnityEngine;
[RequireComponent(typeof(CatMovement))]
[RequireComponent(typeof(CatInteraction))]
public class KeyboardController : MonoBehaviour
{
public GameObject hint;
private CatMovement _movable;
private CatInteraction _character;
private Vector2 _speed;
private bool _isActive;
void Start()
{
_movable = GetComponent<CatMovement>();
_character = GetComponent<CatInteraction>();
_isActive = true;
}
void Update ()
{
if (_isActive)
{
MoveAround();
Interact();
ShowHint();
}
}
private void MoveAround()
{
bool isMovingLeft = Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow);
bool isMovingRight = Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow);
bool isMovingUp = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow);
bool isMovingDown = Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow);
_speed.Set(0, 0);
if (isMovingLeft && !isMovingRight) _speed.x = -1;
if (!isMovingLeft && isMovingRight) _speed.x = 1;
if (isMovingUp && !isMovingDown) _speed.y = 1;
if (!isMovingUp && isMovingDown) _speed.y = -1;
_movable.Move(_speed);
}
private void Interact()
{
if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.Space))
{
_character.InteractWithClosest();
}
}
private void ShowHint()
{
Interactable closest = _character.FindClosest();
if (closest != null && closest.IsUsable())
{
hint.SetActive(true);
UIUtils.PlaceUIObjectNear(hint.gameObject, _character.gameObject);
}
else
{
hint.SetActive(false);
}
}
public bool IsActive()
{
return _isActive;
}
public void SetActive(bool value)
{
_isActive = value;
if (!value)
{
hint.SetActive(false);
_speed.Set(0, 0);
_movable.Move(_speed);
}
}
}
|
namespace Portal.DataObjects
{
public class PendingBase
{
public int PendingId { get; set; }
public int MemberId { get; set; }
public string RequestDate { get; set; }
public string MemberName { get; set; }
public decimal Amount { get; set; }
public string Address { get; set; }
public bool Granted { get; set; }
}
}
|
@model NetsBrokerIntegration.DotNet.Models.AuthenticationErrorResponse
@{
Layout = null;
}
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Nets eID Broker</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="~/Content/css/styles.css" asp-append-version="true">
<meta name="theme-color" content="#fafafa">
</head>
<body class="open">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
if (window.opener && window.opener !== window) {
window.opener.postMessage("CLOSE", '*');
}
});
</script>
<header>
<figure class="logo"></figure>
</header>
<div class="content">
<h2>We apologize</h2>
<h1>
An error occured!
</h1>
<h4>
This is an demonstration of how<br />
Nets eID Broker error messages could look like.<br />
<i>Not what to show the user</i>
</h4>
<div class="console-like">
<header>Error Details</header>
<div class="console-output">
<h2><label asp-for="Error"></label></h2>
<p>@Model.Error</p>
<h2><label asp-for="Error_Description"></label></h2>
<p>@Model.Error_Description</p>
<h2><label asp-for="Error_Uri"></label></h2>
<p>@Model.Error_Uri</p>
</div>
</div>
<a class="btn btn-main btn-signin btn-lg" href="@Url.Action("Index","Home")">Try again</a>
</div>
</body>
</html>
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stomp : MonoBehaviour
{
private bool playerIsMoving;
private bool isStomping = false;
public float stompWaitTime = 3f;
public GameObject stomp;
void LateUpdate()
{
playerIsMoving = GetComponent<PlayerMovement>().isMoving;
}
void Update()
{
if (!playerIsMoving)
{
if (Input.GetKeyDown(KeyCode.Space) && !isStomping)
{
StartCoroutine(StompDelay());
MakeStomp();
isStomping = true;
}
}
}
IEnumerator StompDelay()
{
yield return new WaitForSeconds(stompWaitTime);
isStomping = false;
}
void MakeStomp()
{
Instantiate(stomp, transform.position, Quaternion.identity);
}
}
|
using System.Collections.Generic;
namespace bstrkr.mvvm.navigation
{
public class RouteStopListNavParam
{
public RouteStopListNavParam()
{
this.RouteStops = new List<RouteStopListItem>();
}
public List<RouteStopListItem> RouteStops { get; set; }
}
} |
namespace Cargo.DomainModel.Models
{
public class Location
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _postCode;
public string PostCode
{
get { return _postCode; }
set { _postCode = value; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Quidjibo.Configurations;
using Quidjibo.Factories;
using Quidjibo.Misc;
using Quidjibo.Models;
using Quidjibo.Pipeline;
using Quidjibo.Pipeline.Contexts;
using Quidjibo.Pipeline.Misc;
using Quidjibo.Providers;
namespace Quidjibo.Servers
{
public class QuidjiboServer : IQuidjiboServer
{
private readonly ICronProvider _cronProvider;
private readonly ILogger _logger;
private readonly IProgressProviderFactory _progressProviderFactory;
private readonly IQuidjiboConfiguration _quidjiboConfiguration;
private readonly IQuidjiboPipeline _quidjiboPipeline;
private readonly IScheduleProviderFactory _scheduleProviderFactory;
private readonly IWorkProviderFactory _workProviderFactory;
public bool IsRunning { get; private set; }
public QuidjiboServer(
ILoggerFactory loggerFactory,
IQuidjiboConfiguration quidjiboConfiguration,
IWorkProviderFactory workProviderFactory,
IScheduleProviderFactory scheduleProviderFactory,
IProgressProviderFactory progressProviderFactory,
ICronProvider cronProvider,
IQuidjiboPipeline quidjiboPipeline)
{
_logger = loggerFactory.CreateLogger<QuidjiboServer>();
_workProviderFactory = workProviderFactory;
_scheduleProviderFactory = scheduleProviderFactory;
_quidjiboConfiguration = quidjiboConfiguration;
_cronProvider = cronProvider;
_quidjiboPipeline = quidjiboPipeline;
_progressProviderFactory = progressProviderFactory;
Worker = $"{Environment.GetEnvironmentVariable("COMPUTERNAME")}-{Guid.NewGuid()}";
}
public string Worker { get; }
public void Start()
{
lock (_syncRoot)
{
if (IsRunning)
{
return;
}
_logger.LogInformation("Starting Server {Worker}", Worker);
_cts = new CancellationTokenSource();
_loopTasks = new List<Task>();
_throttle = new SemaphoreSlim(0, _quidjiboConfiguration.Throttle);
_logger.LogInformation("EnableWorker = {EnableWorker}", _quidjiboConfiguration.EnableWorker);
if (_quidjiboConfiguration.EnableWorker)
{
if (_quidjiboConfiguration.SingleLoop)
{
_logger.LogInformation("All queues can share the same loop");
var queues = string.Join(",", _quidjiboConfiguration.Queues);
_loopTasks.Add(WorkLoopAsync(queues));
}
else
{
_logger.LogInformation("Each queue will need a designated loop");
_loopTasks.AddRange(_quidjiboConfiguration.Queues.Select(WorkLoopAsync));
}
}
_logger.LogInformation("EnableScheduler = {EnableScheduler}", _quidjiboConfiguration.EnableScheduler);
if (_quidjiboConfiguration.EnableScheduler)
{
_logger.LogInformation("Enabling scheduler");
_loopTasks.Add(ScheduleLoopAsync(_quidjiboConfiguration.Queues));
}
_throttle.Release(_quidjiboConfiguration.Throttle);
IsRunning = true;
_logger.LogInformation("Started Worker {Worker}", Worker);
}
}
public void Stop()
{
lock (_syncRoot)
{
if (!IsRunning)
{
return;
}
_cts?.Cancel();
_cts?.Dispose();
_loopTasks = null;
IsRunning = false;
_logger.LogInformation("Stopped Worker {Worker}", Worker);
}
}
public void Dispose()
{
Stop();
}
#region Internals
private readonly object _syncRoot = new object();
private List<Task> _loopTasks;
private CancellationTokenSource _cts;
private SemaphoreSlim _throttle;
private async Task WorkLoopAsync(string queue)
{
var pollingInterval = TimeSpan.FromSeconds(_quidjiboConfiguration.WorkPollingInterval ?? 45);
var workProvider = await _workProviderFactory.CreateAsync(queue, _cts.Token);
while (!_cts.IsCancellationRequested)
{
try
{
_logger.LogDebug("Throttle Count : {ThrottleCount}", _throttle.CurrentCount);
// throttle is important when there is more than one listener
await _throttle.WaitAsync(_cts.Token);
var items = await workProvider.ReceiveAsync(Worker, _cts.Token);
if (items.Any())
{
var tasks = items.Select(item => InvokePipelineAsync(workProvider, item));
await Task.WhenAll(tasks);
_throttle.Release();
continue;
}
_throttle.Release();
await Task.Delay(pollingInterval, _cts.Token);
}
catch (Exception exception)
{
_logger.LogWarning(0, exception, exception.Message);
}
}
}
private async Task ScheduleLoopAsync(string[] queues)
{
var pollingInterval = TimeSpan.FromSeconds(_quidjiboConfiguration.SchedulePollingInterval ?? 45);
var scheduleProvider = await _scheduleProviderFactory.CreateAsync(queues, _cts.Token);
while (!_cts.IsCancellationRequested)
{
try
{
var items = await scheduleProvider.ReceiveAsync(_cts.Token);
foreach (var item in items)
{
var work = new WorkItem
{
Attempts = 0,
CorrelationId = Guid.NewGuid(),
Id = Guid.NewGuid(),
Name = item.Name,
Payload = item.Payload,
Queue = item.Queue,
ScheduleId = item.Id
};
_logger.LogDebug("Enqueue the scheduled item : {Id}", item.Id);
var workProvider = await _workProviderFactory.CreateAsync(work.Queue, _cts.Token);
await workProvider.SendAsync(work, 1, _cts.Token);
_logger.LogDebug("Update the schedule for the next run : {Id}", item.Id);
item.EnqueueOn = _cronProvider.GetNextSchedule(item.CronExpression);
item.EnqueuedOn = DateTime.UtcNow;
await scheduleProvider.CompleteAsync(item, _cts.Token);
}
}
catch (Exception exception)
{
_logger.LogWarning(0, exception, exception.Message);
}
finally
{
await Task.Delay(pollingInterval, _cts.Token);
}
}
}
private async Task InvokePipelineAsync(IWorkProvider provider, WorkItem item)
{
using (var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token))
{
var progress = new QuidjiboProgress();
progress.ProgressChanged += async (sender, tracker) =>
{
var progressProvider = await _progressProviderFactory.CreateAsync(item.Queue, _cts.Token);
var progressItem = new ProgressItem
{
Id = Guid.NewGuid(),
CorrelationId = item.CorrelationId,
RecordedOn = DateTime.UtcNow,
Name = item.Name,
Queue = item.Queue,
Note = tracker.Text,
Value = tracker.Value,
WorkId = item.Id
};
await progressProvider.ReportAsync(progressItem, _cts.Token);
};
var renewTask = RenewAsync(provider, item, linkedTokenSource.Token);
var context = new QuidjiboContext
{
Item = item,
WorkProvider = provider,
Progress = progress,
State = new PipelineState()
};
try
{
await _quidjiboPipeline.StartAsync(context, linkedTokenSource.Token);
if (context.State.Success)
{
await provider.CompleteAsync(item, linkedTokenSource.Token);
_logger.LogDebug("Completed : {Id}", item.Id);
}
else
{
await provider.FaultAsync(item, linkedTokenSource.Token);
_logger.LogError("Faulted : {Id}", item.Id);
}
}
catch (Exception exception)
{
_logger.LogError("Faulted : {Id}, {Exception}", item.Id, exception);
await provider.FaultAsync(item, linkedTokenSource.Token);
}
finally
{
_logger.LogDebug("Release : {Id}", item.Id);
linkedTokenSource.Cancel();
await renewTask;
await _quidjiboPipeline.EndAsync(context);
}
}
}
private async Task RenewAsync(IWorkProvider provider, WorkItem item, CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
try
{
await Task.Delay(TimeSpan.FromSeconds(_quidjiboConfiguration.LockInterval), cancellationToken);
await provider.RenewAsync(item, cancellationToken);
_logger.LogDebug("Renewed : {Id}", item.Id);
}
catch (OperationCanceledException)
{
// ignore OperationCanceledExceptions
}
}
}
#endregion
}
} |
namespace raccoonLog.Http.Stores
{
public class FileStoreOptions
{
public string SavePath { get; set; } = "logs/http";
}
} |
// <copyright file="IShellCommandBar.cs" company="FT Software">
// Copyright (c) 2016 Florian Thurnwald. All rights reserved.
// </copyright>
// <author>Florian Thurnwald</author>
namespace ProjektKatastrophenschutz.Elements
{
using System.Collections.ObjectModel;
/// <summary>
/// Declares that an implementing class exposes several command bar items
/// </summary>
internal interface IShellCommandBar
{
ObservableCollection<ShellCommandBarItem> CommandBarItems { get; }
ObservableCollection<ShellCommandBarItem> CommandBarSecondaryItems { get; }
}
} |
using System;
using SqlStreamStore.Demo.Serializers.Messages;
namespace SqlStreamStore.Demo.Events.Account
{
public class AmountDeposited : TransactionEvent
{
public AmountDeposited()
: base(MessageTypes.Transaction.Deposited)
{
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace TrueNorth.Crm.FieldHasher
{
class PluginConfiguration
{
private static string GetValueNode(XmlDocument doc, string key)
{
XmlNode node = doc.SelectSingleNode(String.Format("Settings/setting[@name='{0}']", key));
if (node != null)
{
return node.SelectSingleNode("value").InnerText;
}
return string.Empty;
}
public static Guid GetConfigDataGuid(XmlDocument doc, string label)
{
string tempString = GetValueNode(doc, label);
if (tempString != string.Empty)
{
return new Guid(tempString);
}
return Guid.Empty;
}
public static bool GetConfigDataBool(XmlDocument doc, string label)
{
bool retVar;
if (bool.TryParse(GetValueNode(doc, label), out retVar))
{
return retVar;
}
else
{
return false;
}
}
public static int GetConfigDataInt(XmlDocument doc, string label)
{
int retVar;
if (int.TryParse(GetValueNode(doc, label), out retVar))
{
return retVar;
}
else
{
return -1;
}
}
public static string GetConfigDataString(XmlDocument doc, string label)
{
return GetValueNode(doc, label);
}
}
}
|
using GT.Core.DTO.Impl;
namespace GT.Core.Services.Interfaces
{
public interface IGTListingInquiryService : IGTService
{
Task<List<ListingInquiryDTO?>> GetAllAsync();
Task<ListingInquiryDTO?> GetByIdAsync(string id);
Task<List<ListingInquiryDTO>?> GetByListingIdAsync(string id);
Task<ListingInquiryDTO?> AddAsync(ListingInquiryDTO dto, string? signedInUserId = null);
Task UpdateAsync(ListingInquiryDTO dto, string id);
Task DeleteAsync(string id);
Task DeleteInquiriesAssociatedWithUserIdAsync(string userId);
Task<bool> ExistsByIdAsync(string id);
}
}
|
using System;
using UnityEngine;
// Token: 0x020000D9 RID: 217
public class LimitRigidbodyVelocity : MonoBehaviour
{
// Token: 0x06000459 RID: 1113 RVA: 0x0000595B File Offset: 0x00003B5B
private void Start()
{
this.maxVelocity = Mathf.Abs(Physics.gravity.y) * 3f;
if (this.includeRigidbodyChildren)
{
this.rigidbodies = base.GetComponentsInChildren<Rigidbody>();
return;
}
this.rigidbodies[0] = base.GetComponent<Rigidbody>();
}
// Token: 0x0600045A RID: 1114 RVA: 0x00018520 File Offset: 0x00016720
private void FixedUpdate()
{
for (int i = 0; i < this.rigidbodies.Length; i++)
{
this.speed = this.rigidbodies[i].velocity.magnitude;
if (this.speed > this.maxVelocity)
{
this.rigidbodies[i].AddForce(-(this.rigidbodies[i].velocity.normalized * (this.speed - this.maxVelocity)));
}
}
}
// Token: 0x040005C1 RID: 1473
public bool includeRigidbodyChildren = true;
// Token: 0x040005C2 RID: 1474
public Rigidbody[] rigidbodies;
// Token: 0x040005C3 RID: 1475
private float maxVelocity;
// Token: 0x040005C4 RID: 1476
private float speed;
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
namespace Microsoft.Owin.Security.OAuth
{
/// <summary>
/// Provides context information used in handling an OAuth client credentials grant.
/// </summary>
public class OAuthGrantClientCredentialsContext : BaseValidatingTicketContext<OAuthAuthorizationServerOptions>
{
/// <summary>
/// Initializes a new instance of the <see cref="OAuthGrantClientCredentialsContext"/> class
/// </summary>
/// <param name="context"></param>
/// <param name="options"></param>
/// <param name="clientId"></param>
/// <param name="scope"></param>
public OAuthGrantClientCredentialsContext(
IOwinContext context,
OAuthAuthorizationServerOptions options,
string clientId,
IList<string> scope)
: base(context, options, null)
{
ClientId = clientId;
Scope = scope;
}
/// <summary>
/// OAuth client id.
/// </summary>
public string ClientId { get; private set; }
/// <summary>
/// List of scopes allowed by the resource owner.
/// </summary>
public IList<string> Scope { get; private set; }
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Xml;
using Egora.Pvp;
using Egora.Stammportal;
using Egora.Stammportal.LdapAuthorizationService;
/// <summary>
/// Summary description for FixedAuthorizer
/// </summary>
[WebService(Namespace = CustomAuthorization.Namespace)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class FixedAuthorizer : System.Web.Services.WebService
{
public FixedAuthorizer()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
/// <summary>
/// Gets the authorization information for a given application and user
/// </summary>
/// <param name="rootUrl">RootUrl of Application</param>
/// <param name="userId">Unique identifier of a user, e.g. loginname</param>
/// <returns>HttpHeaders for ApplicationType Web, SOAP Header for ApplicationType SOAP</returns>
[WebMethod]
public CustomAuthorization GetAuthorization(string rootUrl, string userId)
{
var file = Path.Combine(Server.MapPath("~"), "ConfigurationFixed.xml");
LdapConfiguration configuration = LdapConfiguration.GetConfiguration(file);
rootUrl = rootUrl.ToLowerInvariant();
PvpApplicationLdapAuthorizer authorizer = new PvpApplicationLdapAuthorizer(rootUrl, userId, configuration);
if (!authorizer.IsValid)
return CustomAuthorization.NoAuthorization;
CustomAuthorization auth = new CustomAuthorization();
auth.TimeToLive = authorizer.AuthorizationTimeToLive;
auth.PvpVersion = authorizer.Version;
var dummy = authorizer.GvGID;
var chainedToken = authorizer.GetPvpToken().GetChainedSoapFragment();
var token = String.Format(
@"<pvpToken version=""{0}"" xmlns=""http://egov.gv.at/pvp1.xsd"">
<authenticate>
<participantId>{1}</participantId>
<systemPrincipal>
<userId>egovstar.appserv1.intra.xyz.gv.at</userId>
<cn>Anwendung 1 Register-Interface</cn>
<gvOuId>AT:L6:4711</gvOuId>
<ou>Fachabteilung 1B Informationstechnik</ou>
<gvOuID>{2}</gvOuID>
<gvSecClass>{3}</gvSecClass>
</systemPrincipal>
</authenticate>
<authorize>
<role value=""Registerabfrage""></role>
</authorize>
{4}
</pvpToken>",
authorizer.Version,
authorizer.ParticipantID,
authorizer.GvOuID,
authorizer.GvSecClass,
chainedToken.OuterXml);
XmlDocument doc = new XmlDocument();
doc.LoadXml(token);
auth.SoapHeaderXmlFragment = doc.DocumentElement;
return auth;
}
}
/*
<pvpChainedToken version = ""1.9"">
<authenticate>
<participantId>AT:L6:1234789</participantId>
<userPrincipal>
<userId>mmustermann @kommunalnet.at</userId>
<cn>Max Mustermann</cn>
<gvOuId>AT:GGA-60420:0815</gvOuId>
<ou>Meldeamt</ou>
<gvOuOKZ>AT:GGA-60420-Abt13</gvOuOKZ>
<gvSecClass>2</gvSecClass>
<gvGid>AT:B:0:LxXnvpcYZesiqVXsZG0bB==</gvGid>
<mail>max.mustermann @hatzendorf.steiermark.at</mail>
<tel>+43 3155 5153</tel>
</userPrincipal>
</authenticate>
<authorize>
<role value = ""Beispielrolle""> <param> <key>GKZ</key> <value>60420</value> </param> </role>
</authorize>
</pvpChainedToken>
*/ |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using Microsoft.ClearScript.Windows;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.ClearScript.Test
{
public partial class DynamicHostItemTest
{
#region test methods
// ReSharper disable InconsistentNaming
[TestMethod, TestCategory("DynamicHostItem")]
public void DynamicHostItem_CrossEngine()
{
const string format = "{0} foo {1} bar {2} baz {3} qux {4} quux {5}";
var args = new object[] { 1, 2, 3, 4, 5, 6 };
engine.Script.mscorlib = new HostTypeCollection("mscorlib");
using (var outerEngine = new JScriptEngine())
{
outerEngine.Script.inner = engine;
outerEngine.Script.format = format;
outerEngine.Script.args = args;
Assert.AreEqual(string.Format(format, args), outerEngine.Evaluate("inner.Script.mscorlib.System.String.Format(format, args)"));
Assert.AreEqual(string.Format(format, args), outerEngine.Evaluate("inner.Script.mscorlib['System'].String['Format'](format, args)"));
}
}
// ReSharper restore InconsistentNaming
#endregion
}
}
|
using System.ComponentModel;
namespace Shared.Common
{
public enum StatusCashout
{
[Description("Cancel")]
Cancel = 0,
[Description("Complete")]
Complete = 1,
[Description("Pending")]
Pending = 2,
}
public enum StatusMessage
{
[Description("Chưa đọc")]
Unread = 0,
[Description("Đã đọc")]
Read = 1,
}
public enum CookieSecureOption
{
SameAsRequest,
Never,
Always
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mov.Standard.Windows
{
public enum MenuType
{
NicoSearch,
NicoTemporary,
NicoHistory,
NicoFavorite,
NicoFavoriteDetail,
NicoChromium,
}
}
|
using System;
namespace SharpVectors.Dom.Svg
{
public sealed class SvgAnimatedAngle : ISvgAnimatedAngle
{
#region Fields
private ISvgAngle baseVal;
private ISvgAngle animVal;
#endregion
#region Constructor
public SvgAnimatedAngle(string s, string defaultValue)
{
animVal = baseVal = new SvgAngle(s, defaultValue, false);
}
public SvgAnimatedAngle(ISvgAngle angle)
{
animVal = baseVal = angle;
}
#endregion
#region Implementation of ISvgAnimatedAngle
public ISvgAngle BaseVal
{
get
{
return baseVal;
}
}
public ISvgAngle AnimVal
{
get
{
return animVal;
}
}
#endregion
}
} |
using System;
using Destructible;
using Map;
using Menu;
using Override;
using Paranoia;
using UnityEngine;
using UnityEngine.Rendering;
using ZeoFlow;
using ZeoFlow.Outline;
using ZeoFlow.Pickup;
using ZeoFlow.Pickup.Interfaces;
namespace Items
{
/// <summary>
/// <para> FlareManage </para>
/// <author> @TeodorHMX1 </author>
/// </summary>
public class FlareManage : MonoBehaviour
{
[Header("Flare Data")]
public GameObject flare;
public GameObject flareLight;
public GameObject flareBody;
[Header("Customize")]
[Tooltip("The seconds after the flare will be disabled")]
[Range(10, 30)]
public int seconds = 20;
[Range(1, 20)]
public int area = 2;
public GameObject player;
public ParanoiaHolder paranoiaHolder;
[Header("Mesh Render")]
public MeshRenderer objMeshRenderer;
[Header("Sounds")]
public AudioClip onGround;
public AudioClip onBurning;
private bool _onGroundPlayed;
private bool _isAttached;
private bool _wasDropped;
private int _time;
private string _id;
private Rigidbody _mRigidbody;
private bool _isParanoiaHolderNotNull;
private void Start()
{
_isAttached = true;
flareLight.SetActive(false);
objMeshRenderer.shadowCastingMode = ShadowCastingMode.Off;
_id = AudioInstance.ID();
_mRigidbody = GetComponent<Rigidbody>();
_isParanoiaHolderNotNull = paranoiaHolder != null;
}
private void Update()
{
if (Pause.IsPaused)
{
_mRigidbody.freezeRotation = true;
return;
}
_mRigidbody.freezeRotation = false;
if (_wasDropped)
{
new AudioBuilder()
.WithClip(onBurning)
.WithName("Flare_OnBurning_" + _id)
.WithVolume(SoundVolume.OnBackground)
.Play(true);
_isAttached = false;
_time++;
if (_time >= 120)
{
GetComponent<Rigidbody>().freezeRotation = true;
}
var flareTransform = transform;
var playerPosition = player.transform.position;
var position = flareTransform.position;
var flarePos = new Vector3(position.x, playerPosition.y, position.z);
var distance = Vector3.Distance(playerPosition, flarePos);
if (_isParanoiaHolderNotNull)
{
paranoiaHolder.InsideSafeArea = distance <= area * 2;
}
if (_time < seconds * 60) return;
new AudioBuilder()
.WithName("Flare_OnBurning_" + _id)
.Stop(true);
flareLight.SetActive(false);
_wasDropped = false;
Destroy(flare, 10);
return;
}
if (_isParanoiaHolderNotNull)
{
paranoiaHolder.InsideSafeArea = false;
}
if (!_isAttached) return;
if (!InputManager.GetButtonDown("InteractHUD") && !_wasDropped) return;
if(MapScript2.IsMapOpened()) return;
flareLight.SetActive(true);
_wasDropped = true;
_isAttached = false;
ItemsManager.Remove(Item.Flare);
GetComponent<SyncItem>().OnDestroy();
}
private void OnCollisionEnter()
{
if(_onGroundPlayed || !_wasDropped) return;
_onGroundPlayed = true;
new AudioBuilder()
.WithClip(onGround)
.WithName("Flare_OnDrop")
.WithVolume(SoundVolume.Weak)
.Play(true);
}
}
} |
using System;
/*---------------------------------------------------------------------\
| Copyright © 2008-2016 Allen C. [Alexander Morou] Copeland Jr. |
|----------------------------------------------------------------------|
| The Abstraction Project's code is provided under a contract-release |
| basis. DO NOT DISTRIBUTE and do not use beyond the contract terms. |
\-------------------------------------------------------------------- */
namespace AllenCopeland.Abstraction.Slf.Abstract.Members
{
/// <summary>
/// Whether the instance member is static or hide by signature.
/// </summary>
[Flags]
public enum InstanceMemberAttributes
{
/// <summary>
/// Member has no intance flags defined.
/// </summary>
None = 0x0000,
/// <summary>
/// Member is a static member.
/// </summary>
/* 0 00000000 00000000 00111100 00000001 */
Static = 0x3c01,
/// <summary>
/// Member hides base's definition by signature only.
/// </summary>
/* 0 00011000 00000000 00000000 00010000 */
HideBySignature = 0x18000010,
/// <summary>
/// Member hides base's definition by name, removing all
/// previous identities under the name.
/// </summary>
/* 0000 00100000 00000000 00000000 00100000 */
HideByName = 0x68000020,
/// <summary>
/// The instance member flags mask.
/// </summary>
FlagsMask = Static | HideBySignature | HideByName,
}
/// <summary>
/// Defines properties and methods for working with an instance member.
/// </summary>
public interface IInstanceMember :
IMember
{
/// <summary>
/// Returns the <see cref="InstanceMemberAttributes"/> that determine how the
/// <see cref="IInstanceMember"/> is shown in its scope and inherited scopes.
/// </summary>
InstanceMemberAttributes Attributes { get; }
/// <summary>
/// Returns whether the <see cref="IInstanceMember"/>
/// hides the original definition completely.
/// </summary>
bool IsHideBySignature { get; }
/// <summary>
/// Returns whether the <see cref="IInstanceMember"/> is
/// static.
/// </summary>
bool IsStatic { get; }
}
}
|
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System.Collections.Generic;
namespace Edu.Schwabe.TicTacToe.ObjectModel
{
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
public class Consecutiveness
{
public Consecutiveness() => CellsAt = new List<int>();
public Consecutiveness(IEnumerable<int> cellsAt) => CellsAt = new List<int>(cellsAt);
public IList<int> CellsAt { get; private set; }
public ConsecutivenessDirection Direction { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SleepyTomCat
{
class Program
{
static void Main(string[] args)
{
int restingDays = int.Parse(Console.ReadLine());
int workingDays = 365 - restingDays;
int realTimePlay = (workingDays * 63) + (restingDays * 127);
if (realTimePlay <= 30000)
{
int timeToPlay = 3000 - realTimePlay;
int hours = timeToPlay / 60;
int minutes = timeToPlay % 60;
Console.WriteLine("Tom sleeps well");
Console.WriteLine($"{hours} hours and {minutes} minutes less to play");
}
else
{
int timeToPlay = realTimePlay - 30000;
int hours = timeToPlay / 60;
int minutes = timeToPlay % 60;
Console.WriteLine("Tom will run away");
Console.WriteLine($"{hours} hours and {minutes} minutes less for play");
}
}
}
}
|
using System;
using OptixCore.Library.Native;
namespace OptixCore.Library
{
public class OptixPostprocessingStage : DataNode
{
public OptixPostprocessingStage(Context context, string name) : base(context)
{
Create(name);
}
public override void Validate()
{
}
public override void Destroy()
{
CheckError(Api.rtPostProcessingStageDestroy(InternalPtr));
}
public Variable DeclareVariable(string name)
{
var varPtr = IntPtr.Zero;
CheckError(Api.rtPostProcessingStageDeclareVariable(InternalPtr, name , ref varPtr));
return new Variable(mContext, varPtr);
}
public Variable GetVariable(uint index)
{
var varPtr = IntPtr.Zero;
CheckError(Api.rtPostProcessingStageGetVariable(InternalPtr, index, ref varPtr));
return new Variable(mContext, varPtr);
}
public Variable QueryVariable(string name)
{
var varPtr = IntPtr.Zero;
CheckError(Api.rtPostProcessingStageQueryVariable(InternalPtr, name, ref varPtr));
return new Variable(mContext, varPtr);
}
public override IntPtr ObjectPtr()
{
return InternalPtr;
}
private void Create(string name)
{
CheckError(Api.rtPostProcessingStageCreateBuiltin(mContext.InternalPtr, name, ref InternalPtr));
}
}
} |
using System.Linq;
using Xunit;
using static Primes;
namespace Problems
{
public class Problem0003
{
[Fact]
public void Euler_0003()
{
Assert.Equal(6857, FactorsOf(600851475143).Max());
}
}
}
|
using Amazon.JSII.Runtime.Deputy;
#pragma warning disable CS0672,CS0809,CS1591
namespace aws
{
[JsiiInterface(nativeType: typeof(IElbListener), fullyQualifiedName: "aws.ElbListener")]
public interface IElbListener
{
[JsiiProperty(name: "instancePort", typeJson: "{\"primitive\":\"number\"}")]
double InstancePort
{
get;
}
[JsiiProperty(name: "instanceProtocol", typeJson: "{\"primitive\":\"string\"}")]
string InstanceProtocol
{
get;
}
[JsiiProperty(name: "lbPort", typeJson: "{\"primitive\":\"number\"}")]
double LbPort
{
get;
}
[JsiiProperty(name: "lbProtocol", typeJson: "{\"primitive\":\"string\"}")]
string LbProtocol
{
get;
}
[JsiiProperty(name: "sslCertificateId", typeJson: "{\"primitive\":\"string\"}", isOptional: true)]
[Amazon.JSII.Runtime.Deputy.JsiiOptional]
string? SslCertificateId
{
get
{
return null;
}
}
[JsiiTypeProxy(nativeType: typeof(IElbListener), fullyQualifiedName: "aws.ElbListener")]
internal sealed class _Proxy : DeputyBase, aws.IElbListener
{
private _Proxy(ByRefValue reference): base(reference)
{
}
[JsiiProperty(name: "instancePort", typeJson: "{\"primitive\":\"number\"}")]
public double InstancePort
{
get => GetInstanceProperty<double>()!;
}
[JsiiProperty(name: "instanceProtocol", typeJson: "{\"primitive\":\"string\"}")]
public string InstanceProtocol
{
get => GetInstanceProperty<string>()!;
}
[JsiiProperty(name: "lbPort", typeJson: "{\"primitive\":\"number\"}")]
public double LbPort
{
get => GetInstanceProperty<double>()!;
}
[JsiiProperty(name: "lbProtocol", typeJson: "{\"primitive\":\"string\"}")]
public string LbProtocol
{
get => GetInstanceProperty<string>()!;
}
[JsiiOptional]
[JsiiProperty(name: "sslCertificateId", typeJson: "{\"primitive\":\"string\"}", isOptional: true)]
public string? SslCertificateId
{
get => GetInstanceProperty<string?>();
}
}
}
}
|
using System;
using CMS.Community.Web.UI;
using CMS.Helpers;
using CMS.MessageBoards;
using CMS.UIControls;
public partial class CMSModules_Groups_Tools_MessageBoards_Boards_Board_Edit_Subscription_Edit : CMSGroupMessageBoardsPage
{
#region "Variables"
private int mSubscriptionId = 0;
private int boardId = 0;
private int groupId = 0;
private BoardSubscriptionInfo mCurrentSubscription = null;
#endregion
#region "Page events"
protected void Page_Load(object sender, EventArgs e)
{
// Initialize the controls
SetupControl();
}
#endregion
#region "Methods"
/// <summary>
/// Initializes the controls on the page.
/// </summary>
private void SetupControl()
{
// Get current subscription ID
mSubscriptionId = QueryHelper.GetInteger("subscriptionid", 0);
mCurrentSubscription = BoardSubscriptionInfoProvider.GetBoardSubscriptionInfo(mSubscriptionId);
// Get current board and group ID
boardId = QueryHelper.GetInteger("boardid", 0);
groupId = QueryHelper.GetInteger("groupid", 0);
BoardInfo boardObj = BoardInfoProvider.GetBoardInfo(boardId);
if (boardObj != null)
{
// Check whether edited board belongs to group
if ((boardObj.BoardGroupID == 0) || (groupId != boardObj.BoardGroupID))
{
EditedObject = null;
}
}
boardSubscription.IsLiveSite = false;
boardSubscription.BoardID = boardId;
boardSubscription.GroupID = groupId;
boardSubscription.SubscriptionID = mSubscriptionId;
boardSubscription.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(boardSubscription_OnCheckPermissions);
boardSubscription.OnSaved += new EventHandler(boardSubscription_OnSaved);
InitializeBreadcrumbs();
}
private void boardSubscription_OnSaved(object sender, EventArgs e)
{
URLHelper.Redirect("~/CMSModules/Groups/Tools/MessageBoards/Boards/Board_Edit_Subscription_Edit.aspx?subscriptionid=" + boardSubscription.SubscriptionID + "&boardid=" + boardId + "&saved=1&groupid=" + groupId);
}
private void boardSubscription_OnCheckPermissions(string permissionType, CMSAdminControl sender)
{
CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
}
/// <summary>
/// Initializes the breadcrumbs on the page.
/// </summary>
private void InitializeBreadcrumbs()
{
// Initialize breadcrumbs
PageBreadcrumbs.Items.Add(new BreadcrumbItem()
{
Text = GetString("board.subscription.subscriptions"),
RedirectUrl = ResolveUrl("~/CMSModules/Groups/Tools/MessageBoards/Boards/Board_Edit_Subscriptions.aspx?boardid=" + boardId + "&groupid=" + groupId),
Target = "_self",
});
PageBreadcrumbs.Items.Add(new BreadcrumbItem()
{
Text = mCurrentSubscription != null ? HTMLHelper.HTMLEncode(mCurrentSubscription.SubscriptionEmail) : GetString("board.subscriptions.newitem"),
});
}
#endregion
} |
using System;
namespace Weathering
{
[ConstructionCostBase(typeof(StoneBrick), 10, 0)]
public class RoadOfStone : AbstractRoad
{
public override float WalkingTimeModifier { get => 0.6f; }
private const string roadBase = "RoadOfStone";
protected override string SpriteKeyRoadBase => roadBase;
public override long RoadQuantityRestriction => 20;
public override Type LinkTypeRestriction => typeof(DiscardableSolid);
}
}
|
namespace Common.Integrations.XSLite
{
using StardewModdingAPI;
/// <inheritdoc />
internal class XSLiteIntegration : ModIntegration<IXSLiteAPI>
{
/// <summary>Initializes a new instance of the <see cref="XSLiteIntegration" /> class.</summary>
/// <param name="modRegistry">SMAPI's mod registry.</param>
public XSLiteIntegration(IModRegistry modRegistry)
: base(modRegistry, "furyx639.ExpandedStorage")
{
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] new Rigidbody2D rigidbody;
[SerializeField] Animator animator;
[SerializeField] float speed;
[SerializeField] float attackDuration;
[HideInInspector] public bool canMove = true;
public float direction;
private void Update()
{
direction = Input.GetAxis("Horizontal");
if (canMove)
{
Walking = Mathf.Abs(direction) > 0;
float newXScale;
if (direction != 0)
{
newXScale = Mathf.Sign(direction) * Mathf.Abs(transform.localScale.x);
transform.localScale = new Vector3(newXScale, transform.localScale.y, transform.localScale.z);
}
if (Input.GetAxis("Fire1") > 0 && !Jumping && !Falling)
{
canMove = false;
animator.SetBool("Attack", true);
StartCoroutine(AttackFinished());
}
}
}
IEnumerator AttackFinished()
{
yield return new WaitForSeconds(attackDuration);
animator.SetBool("Attack", false);
canMove = true;
}
private void FixedUpdate()
{
if (canMove)
{
rigidbody.velocity = new Vector2(direction * speed, rigidbody.velocity.y);
if (!Jumping && !Falling && Input.GetAxis("Jump") > 0f)
{
Jumping = true;
rigidbody.AddForce(new Vector2(0f, 10f), ForceMode2D.Impulse);
}
if (rigidbody.velocity.y < 0f)
{
Jumping = false;
Falling = true;
}
if (Falling && rigidbody.velocity.y == 0f)
{
Falling = false;
}
}
}
private bool falling;
public bool Falling
{
get { return falling; }
set
{
if (value != falling)
{
falling = value;
animator.SetBool("Fall", value);
}
}
}
private bool jumping;
public bool Jumping
{
get { return jumping; }
set
{
if (value != jumping)
{
jumping = value;
animator.SetBool("Jump", value);
}
}
}
private bool walking;
public bool Walking
{
get { return walking; }
set
{
if (value != walking)
{
walking = value;
animator.SetBool("Walk", value);
}
}
}
} |
namespace Plexito
{
using System;
using System.Diagnostics;
using System.Windows.Input;
using Ownskit.Utils;
using SandboxConsole.Model;
using SandboxConsole.Services;
public class PlexMediaKeysProxy : IDisposable
{
private readonly KeyboardListener kListener;
private PlexBinding plexApi;
private PlexDevice device;
public PlexMediaKeysProxy(PlexBinding plexApi)
{
this.plexApi = plexApi;
this.kListener = new KeyboardListener();
}
public void Start()
{
this.kListener.KeyDown += this.OnKeyDown;
}
public void SetDevice(PlexDevice newDevice)
{
this.device = newDevice;
}
private void OnKeyDown(object sender, RawKeyEventArgs args)
{
switch (args.Key)
{
case Key.MediaNextTrack:
plexApi.PlayBack.SkipNext(this.device);
break;
case Key.MediaPreviousTrack:
plexApi.PlayBack.SkipPrevious(this.device);
break;
//case Key.MediaStop:
// plexApi.PlayBack.SkipNext(this.device);
break;
case Key.MediaPlayPause:
plexApi.PlayBack.Pause(this.device);
break;
}
}
public void Dispose()
{
this.kListener.KeyDown -= this.OnKeyDown;
this.kListener.Dispose();
}
}
} |
#define COMMAND_NAME_UPPER
#if DEBUG
#undef NET_LOCALGROUP_MEMBER
#define NET_LOCALGROUP_MEMBER
#endif
#if NET_LOCALGROUP_MEMBER
using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using Mythic.Structs;
using Apollo.Jobs;
using Apollo.MessageInbox;
using Apollo.Tasks;
using Utils;
using System.Runtime.InteropServices;
namespace Apollo.CommandModules
{
class NetLocalGroupMember
{
public struct NetLocalGroupArguments
{
public string computer;
public string group;
}
public static void Execute(Job job, Agent implant)
{
Task task = job.Task;
NetLocalGroupArguments args = JsonConvert.DeserializeObject<NetLocalGroupArguments>(task.parameters);
if (string.IsNullOrEmpty(args.group))
{
job.SetError("Missing required parameter: group");
return;
}
if (string.IsNullOrEmpty(args.computer))
args.computer = Environment.GetEnvironmentVariable("COMPUTERNAME");
try
{
var results = ADUtils.GetLocalGroupMembers(args.computer, args.group);
job.SetComplete(results);
} catch (Exception ex)
{
job.SetError($"Error fetching members of {args.group}. LastWin32Error: {Marshal.GetLastWin32Error()}");
}
}
}
}
#endif |
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace ValheimTwitch.Twitch.API.Helix
{
public class Follower
{
[JsonProperty("from_id")]
public string FromId { get; set; }
[JsonProperty("from_login")]
public string FromLogin { get; set; }
[JsonProperty("from_name")]
public string FromName { get; set; }
[JsonProperty("to_id")]
public string ToId { get; set; }
[JsonProperty("to_login")]
public string ToLogin { get; set; }
[JsonProperty("to_name")]
public string ToName { get; set; }
[JsonProperty("followed_at")]
public DateTime FollowedAt { get; set; }
}
public class Pagination
{
}
public class FollowsResponse
{
[JsonProperty("total")]
public int Total { get; set; }
[JsonProperty("data")]
public List<Follower> Data { get; set; }
[JsonProperty("pagination")]
public Pagination Pagination { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using Qurvey.Shared.Models;
using Xamarin.Forms;
using Qurvey.api;
namespace Qurvey.pages
{
public partial class SurveyPage : ContentPage
{
public SurveyPage (Survey survey)
{
//BackgroundColor = Color.FromHex ("#2A2A2A");
InitializeComponent ();
Title = "Survey";
if (Device.OS == TargetPlatform.Android)
NavigationPage.SetTitleIcon(this, "opac.png");
BindingContext = new ViewModels.SurveyViewModel (survey, BackgroundColor);
AnswerList.ItemSelected += AnswerList_ItemSelected;
}
void AnswerList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
if (Device.OS == TargetPlatform.Android)
{
}
}
}
}
|
using System.Diagnostics;
using System.Linq;
using Newtonsoft.Json;
using NLog;
using RestSharp;
namespace ApiTesting.Framework.BaseObjects
{
public abstract class ResourceObject
{
protected readonly IRestClient RestClient;
protected readonly ILogger Logger;
protected ResourceObject(IRestClient restClient, ILogger logger)
{
RestClient = restClient;
Logger = logger;
}
protected virtual IRestResponse Execute(IRestRequest request)
{
IRestResponse response = null;
var timer = Stopwatch.StartNew();
try
{
timer.Start();
response = RestClient.Execute(request);
timer.Stop();
return response;
}
finally
{
LogRequest(request, response, timer.ElapsedMilliseconds);
}
}
protected virtual IRestResponse<T> Execute<T>(IRestRequest request) where T : new()
{
IRestResponse<T> response = null;
var timer = new Stopwatch();
try
{
timer.Start();
response = RestClient.Execute<T>(request);
timer.Stop();
//System.Console.WriteLine("POST: " +response.Content.ToString()); //Debug
return response;
}
catch (JsonSerializationException e)
{
Logger.Error($"Failed to deserialize object {typeof(T).FullName}: {response?.Content}", e);
}
finally
{
LogRequest(request, response, timer.ElapsedMilliseconds);
}
return default(IRestResponse<T>);
}
private void LogRequest(IRestRequest request, IRestResponse response, long durationInMilliseconds)
{
Logger.Debug(() => $"Request completed in {durationInMilliseconds} ms, " +
$"Request: {ConvertRestRequestToString(request)}, " +
$"Response: {ConvertRestResponseToString(response)}");
}
private string ConvertRestRequestToString(IRestRequest request)
{
var convertedRequest = new
{
uri = RestClient.BuildUri(request),
resource = request.Resource,
method = request.Method.ToString(),
parameters = request.Parameters.Select(parameter => new
{
name = parameter.Name,
value = parameter.Value,
type = parameter.Type.ToString()
})
};
return JsonConvert.SerializeObject(convertedRequest);
}
private string ConvertRestResponseToString(IRestResponse response)
{
var convertedResponse = new
{
uri = response.ResponseUri,
statusCode = response.StatusCode,
headers = response.Headers,
content = response.Content,
errorMessage = response.ErrorMessage
};
return JsonConvert.SerializeObject(convertedResponse);
}
}
} |
namespace QarnotCLI.Test
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.AccessControl;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NUnit.Framework;
using QarnotCLI;
[TestFixture]
[Author("NEBIE Guillaume Lale", "guillaume.nebie@qarnot-computing.com")]
public class TestApiConnectionConfigurationSetter
{
private static string testFolder = Path.Join(Path.GetTempPath(), "QarnotCli", Guid.NewGuid().ToString());
private static string testFile = Path.Join(testFolder, Guid.NewGuid().ToString() + ".tmp");
public ApiConnectionConfigurationWritter Set { get; set; }
public FakeFileWrapper FileWrap { get; set; }
public FakeSetWriter Writer { get; set; }
[OneTimeSetUp]
public void CreateFolder()
{
System.IO.Directory.CreateDirectory(testFolder);
}
[OneTimeTearDown]
public void DeleteFolder()
{
System.IO.Directory.Delete(testFolder, true);
}
public class FakeSetWriter : IFileStreamWriter
{
public Dictionary<string, string> Checker { get; set; } = new Dictionary<string, string>();
public List<string> Prefix { get; set; } = new List<string>();
public List<string> Value { get; set; } = new List<string>();
public List<FileStream> Fs { get; set; } = new List<FileStream>();
public void Write(string prefix, string value, FileStream fs)
{
Checker[prefix] = value;
Prefix.Add(prefix);
Value.Add(value);
Fs.Add(fs);
}
}
public class FakeEnvironmentPathGetter : IConfigurationFileGetter
{
public static string FakePath { get; set; }
public FakeEnvironmentPathGetter()
{
FakePath = Path.Join(testFolder, "cli.config");
}
public string ConfigurationFilePath
{
get
{
return FakePath;
}
}
public string NewConfigurationFilePath
{
get
{
return FakePath;
}
}
public bool CanConfigurationFileBeCreated()
{
return true;
}
public bool DoesConfigurationFileExist()
{
return true;
}
}
public class FakeFileInformationGetter : IConfigurationFileReader
{
public static string Token { get; set; } = "Token";
public static string ApiUri { get; set; } = "ApiUri";
public static string StorageUri { get; set; } = "StorageUri";
public static string AccountEmail { get; set; } = "Email";
public static bool? ForcePath { get; set; } = true;
public APIConnectionInformation ReadFile(string filePath)
{
var api = new APIConnectionInformation();
api.Token = Token;
api.ApiUri = ApiUri;
api.StorageUri = StorageUri;
api.AccountEmail = AccountEmail;
api.ForcePathStyle = ForcePath.Value;
return api;
}
}
public class FakeFileWrapper : IFileWrapper
{
public string PathFind { get; set; } = null;
public FileStream CreateFile(string path)
{
PathFind = path;
return File.Create(testFile);
}
public void DeleteFile(string path)
{
path = null;
}
public bool IsFileExist { get; set; } = true;
public bool DoesFileExist(string path)
{
return IsFileExist;
}
public bool CreateDirectoryAsk { get; set; } = false;
public void CreateDirectory(string path)
{
path = null;
CreateDirectoryAsk = true;
}
public bool IsDirectoryExist { get; set; } = true;
public bool DirectoryExist(string path)
{
return IsDirectoryExist;
}
public string DirectoryName { get; set; } = "directory";
public string GetDirectoryName(string path)
{
return DirectoryName;
}
}
[SetUp]
public void Init()
{
CLILogsTest.SurchargeLogs();
FileWrap = new FakeFileWrapper();
Writer = new FakeSetWriter();
Set = new ApiConnectionConfigurationWritter(
new FakeEnvironmentPathGetter(),
new FakeFileInformationGetter(),
Writer,
FileWrap);
}
[Test]
public void TestGetPathPathGiven()
{
LocalSetUpConfiguration config = new LocalSetUpConfiguration(ConfigType.Config, CommandApi.Set)
{
Path = "/tmp/path",
};
Assert.AreEqual(Set.GetPath(config), "/tmp/path");
}
[Test]
public void TestGetPathGlobalPathAsk()
{
LocalSetUpConfiguration config = new LocalSetUpConfiguration(ConfigType.Config, CommandApi.Set)
{
GlobalPath = true,
};
Assert.AreEqual(Set.GetPath(config), QarnotCLI.ConfigurationFileGetter.DefaultPathName);
}
[Test]
public void TestNoPathAskEnvironmentPathGetter()
{
LocalSetUpConfiguration config = new LocalSetUpConfiguration(ConfigType.Config, CommandApi.Set);
Assert.AreEqual(Set.GetPath(config), FakeEnvironmentPathGetter.FakePath);
}
[Test]
public void CreateDirectoryIfNotExist()
{
FileWrap.CreateDirectoryAsk = false;
FileWrap.IsDirectoryExist = true;
Set.CheckDirectory("test");
Assert.IsFalse(FileWrap.CreateDirectoryAsk);
}
[Test]
public void DoCreateDirectoryIfExist()
{
FileWrap.CreateDirectoryAsk = false;
FileWrap.IsDirectoryExist = false;
Set.CheckDirectory("test");
Assert.IsTrue(FileWrap.CreateDirectoryAsk);
}
[Test]
public void CheckIfYouCAnGetInfoFromFile()
{
LocalSetUpConfiguration config = new LocalSetUpConfiguration()
{
ApiConnection = new APIConnectionInformation()
};
Set.SetConfigInformation("path", config);
Assert.AreEqual(Writer.Checker["token"], FakeFileInformationGetter.Token);
Assert.AreEqual(Writer.Checker["uri"], FakeFileInformationGetter.ApiUri);
Assert.AreEqual(Writer.Checker["storage"], FakeFileInformationGetter.StorageUri);
Assert.AreEqual(Writer.Checker["account-email"], FakeFileInformationGetter.AccountEmail);
Assert.AreEqual(Writer.Checker["force-path"], FakeFileInformationGetter.ForcePath.ToString());
}
[Test]
public void CheckInfoWellSendToTheWriter()
{
LocalSetUpConfiguration config = new LocalSetUpConfiguration();
APIConnectionInformation connectionInformation = new APIConnectionInformation();
connectionInformation.Token = "token123";
connectionInformation.ApiUri = "uri123";
connectionInformation.StorageUri = "bucket123";
connectionInformation.AccountEmail = "email123";
connectionInformation.ForcePathStyle = false;
config.ApiConnection = connectionInformation;
Set.SetConfigInformation("path123", config);
Assert.AreEqual(FileWrap.PathFind, "path123");
Assert.AreEqual(Writer.Checker["token"], "token123");
Assert.AreEqual(Writer.Checker["uri"], "uri123");
Assert.AreEqual(Writer.Checker["account-email"], "email123");
Assert.AreEqual(Writer.Checker["force-path"], "False");
}
}
} |
namespace AngleSharp.Dom.Css
{
using AngleSharp.Css;
/// <summary>
/// More information available at:
/// https://developer.mozilla.org/en/docs/Web/CSS/@font-face
/// </summary>
sealed class CssUnicodeRangeProperty : CssProperty
{
#region ctor
public CssUnicodeRangeProperty()
: base(PropertyNames.UnicodeRange)
{
}
#endregion
#region Properties
internal override IValueConverter Converter
{
get { return Converters.Any; }
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace NanoSurvey.DB
{
[Table("Answer", Schema = "survey")]
public partial class Answer
{
public Answer()
{
ResultAnswer = new HashSet<ResultAnswer>();
SurveyQuestionAnswer = new HashSet<SurveyQuestionAnswer>();
}
public Guid Id { get; set; }
[Required]
[StringLength(255)]
public string Title { get; set; }
[InverseProperty("Answer")]
public virtual ICollection<ResultAnswer> ResultAnswer { get; set; }
[InverseProperty("Answer")]
public virtual ICollection<SurveyQuestionAnswer> SurveyQuestionAnswer { get; set; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace Tests
{
public class Min : Tests
{
[Fact]
public void Min_Arguments()
{
AssertThrows<ArgumentNullException>(() => EnumerableEx.Min(null, Comparer<int>.Default));
AssertThrows<ArgumentNullException>(() => EnumerableEx.Min(new[] { 1 }, null));
}
[Fact]
public void Min1()
{
Assert.Equal(3, new[] { 5, 3, 7 }.Min(new Mod3Comparer()));
}
private sealed class Mod3Comparer : IComparer<int>
{
public int Compare(int x, int y)
{
return Comparer<int>.Default.Compare(x % 3, y % 3);
}
}
}
}
|
using Sharpen;
namespace android.database
{
[Sharpen.Stub]
public abstract class ContentObserver
{
private android.database.ContentObserver.Transport mTransport;
private object @lock = new object();
internal android.os.Handler mHandler;
[Sharpen.Stub]
private sealed class NotificationRunnable : java.lang.Runnable
{
internal bool mSelf;
[Sharpen.Stub]
public NotificationRunnable(ContentObserver _enclosing, bool self)
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
[Sharpen.ImplementsInterface(@"java.lang.Runnable")]
public void run()
{
throw new System.NotImplementedException();
}
private readonly ContentObserver _enclosing;
}
[Sharpen.Stub]
private sealed class Transport : android.database.IContentObserverClass.Stub
{
internal android.database.ContentObserver mContentObserver;
[Sharpen.Stub]
public Transport(android.database.ContentObserver contentObserver)
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public bool deliverSelfNotifications()
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
[Sharpen.ImplementsInterface(@"android.database.IContentObserver")]
public override void onChange(bool selfChange)
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public void releaseContentObserver()
{
throw new System.NotImplementedException();
}
}
[Sharpen.Stub]
public ContentObserver(android.os.Handler handler)
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public virtual android.database.IContentObserver getContentObserver()
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public virtual android.database.IContentObserver releaseContentObserver()
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public virtual bool deliverSelfNotifications()
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public virtual void onChange(bool selfChange)
{
throw new System.NotImplementedException();
}
[Sharpen.Stub]
public void dispatchChange(bool selfChange)
{
throw new System.NotImplementedException();
}
}
}
|
using DotNetty.Buffers;
namespace OpenClassic.Server.Networking
{
public class NoOpPacketHandler : IPacketHandler
{
public int Opcode => -1;
public void Handle(ISession session, IByteBuffer packet) { }
}
}
|
// ********************************************************
// Copyright (C) 2021 Louis S. Berman (louis@squideyes.com)
//
// This file is part of SquidEyes.Trading
//
// The use of this source code is licensed under the terms
// of the MIT License (https://opensource.org/licenses/MIT)
// ********************************************************
using FluentAssertions;
using SquidEyes.Trading.Context;
using SquidEyes.Trading.Indicators;
using SquidEyes.UnitTests.Testing;
using Xunit;
namespace SquidEyes.UnitTests.Indicators;
public class LinRegIndicatorTests
{
[Fact]
public void IsPrimedReturnsExpectedValue()
{
var indicator = new LinRegIndicator(
10, Known.Pairs[Symbol.EURUSD], RateToUse.Close);
TestingHelper<LinRegIndicator>.IsPrimedReturnsExpectedValue(
indicator, 11, (i, c) => i.AddAndCalc(c), i => i.IsPrimed);
}
[Fact]
public void LinRegIndicatorBaseline()
{
var results = new double[]
{
1.11663997, 1.11651003, 1.11633837, 1.11611105, 1.11601806, 1.11598197,
1.11595720, 1.11599168, 1.11599845, 1.11599835, 1.11604324, 1.11604270,
1.11606325, 1.11616652, 1.11625289, 1.11641071, 1.11650690, 1.11666399,
1.11674545, 1.11675998, 1.11676781, 1.11666907, 1.11646000, 1.11627838,
1.11622182, 1.11631308, 1.11630145, 1.11639181, 1.11651054, 1.11662543,
1.11674107, 1.11676488, 1.11679034, 1.11674637, 1.11667417, 1.11658652,
1.11649579, 1.11641015, 1.11632178, 1.11626814, 1.11625871, 1.11623401,
1.11622129, 1.11621310, 1.11622148, 1.11620275, 1.11619873, 1.11622199,
1.11626525, 1.11631889, 1.11633944, 1.11636018, 1.11639164, 1.11649217,
1.11658309, 1.11660963, 1.11663347, 1.11666127, 1.11664801, 1.11664546,
1.11668291, 1.11669637, 1.11670382, 1.11679399, 1.11691054, 1.11699636,
1.11708473, 1.11704929, 1.11697476, 1.11690291, 1.11686782, 1.11674200,
1.11660129, 1.11653129, 1.11647602, 1.11647421, 1.11645221, 1.11637913,
1.11632660, 1.11628274, 1.11627326, 1.11621270, 1.11619396, 1.11625162,
1.11631088, 1.11636524, 1.11640835, 1.11644238, 1.11647784, 1.11649127,
1.11645747, 1.11640584, 1.11634473, 1.11626329, 1.11621836, 1.11618891,
1.11616327, 1.11609437, 1.11598216, 1.11586723, 1.11580705, 1.11584470,
1.11589016, 1.11583728, 1.11583656, 1.11593328, 1.11603163, 1.11609511,
1.11619583, 1.11623020, 1.11623799, 1.11622582, 1.11635618, 1.11635691,
1.11636563, 1.11639708, 1.11645417, 1.11648838, 1.11657221, 1.11658329,
1.11658420, 1.11658164, 1.11655509, 1.11658873, 1.11672579, 1.11672998,
1.11675961, 1.11679309, 1.11688419, 1.11702456, 1.11719530, 1.11750982,
1.11777436, 1.11792838, 1.11807857, 1.11812585, 1.11806455, 1.11803893,
1.11801766, 1.11819184, 1.11843673, 1.11870654, 1.11891597, 1.11921363,
1.11939000, 1.11942346, 1.11950216, 1.11955909, 1.11969730, 1.11973565,
1.11965402, 1.11973257, 1.11967237, 1.11970109, 1.11970582, 1.11963964,
1.11970798, 1.11987436, 1.12012708, 1.12016781, 1.12014820, 1.12026202,
1.12039637, 1.12040400, 1.12035763, 1.12032092, 1.12035747, 1.12038001,
1.12031383, 1.12011638, 1.11992276, 1.11976710, 1.11969344, 1.11964998,
1.11960072, 1.11953856, 1.11962402, 1.11971491, 1.11973963, 1.11977782,
1.11985581, 1.11983436, 1.11967543, 1.11958123, 1.11952744, 1.11948147,
1.11951454, 1.11962873, 1.11974855, 1.11980891, 1.11992398, 1.11996201,
1.11995544, 1.11985215, 1.11971597, 1.11961945, 1.11948073, 1.11942201,
1.11938803, 1.11920948, 1.11907075, 1.11888366, 1.11870654, 1.11846999,
1.11835890, 1.11833600, 1.11833801, 1.11835710, 1.11834600, 1.11847491,
1.11862871, 1.11863963, 1.11855652, 1.11848398, 1.11856982, 1.11868165,
1.11866530, 1.11858347, 1.11836945, 1.11843055, 1.11847035, 1.11849725,
1.11850797, 1.11852906, 1.11860761, 1.11870871, 1.11875618, 1.11878471,
1.11874907, 1.11888510, 1.11902729, 1.11924727, 1.11941473, 1.11948128,
1.11948237, 1.11948856, 1.11941003, 1.11931185, 1.11921748, 1.11926423,
1.11927058, 1.11933074, 1.11940581, 1.11944564, 1.11952652, 1.11959180,
1.11961290, 1.11962689, 1.11966526, 1.11970072, 1.11961181, 1.11946271,
1.11934089, 1.11924980, 1.11917033, 1.11905852, 1.11899342, 1.11900652,
1.11895399, 1.11892091, 1.11886057, 1.11883620, 1.11880584, 1.11889984,
1.11897110, 1.11898017, 1.11900833, 1.11909887, 1.11910962, 1.11910017,
1.11908871, 1.11905888, 1.11902507, 1.11904237, 1.11912654, 1.11921799,
1.11927546, 1.11936019, 1.11942111, 1.11944856, 1.11946400, 1.11948617,
1.11950798, 1.11951106, 1.11955960, 1.11968652, 1.11975018, 1.11979345
};
var indicator = new LinRegIndicator(
10, Known.Pairs[Symbol.EURUSD], RateToUse.Close);
var candles = IndicatorData.GetCandles();
candles.Count.Should().Be(results.Length);
for (var i = 0; i < candles.Count; i++)
{
indicator.AddAndCalc(candles[i]).Value
.Should().BeApproximately(results[i], 8);
}
}
} |
using System;
using System.Linq.Expressions;
using System.Reflection;
namespace Rock.Reflection
{
/// <summary>
/// Provides extension methods on a PropertyInfo to get optimized reflection methods.
/// </summary>
public static class GetdActionExtension
{
/// <summary>
/// Gets an <see cref="Action{T1,T2}"/> with generic arguments of type
/// <see cref="object"/> and <see cref="object"/> that, when invoked, sets the value
/// of the property represented by <paramref name="propertyInfo"/>.
/// </summary>
/// <param name="propertyInfo">
/// The <see cref="PropertyInfo"/> that represents the property whose value
/// is set by the return function.
/// </param>
/// <returns>
/// An <see cref="Action{T1,T2}"/> with generic arguments of types <see cref="object"/>
/// and <see cref="object"/> that, when invoked, returns the value of the
/// property represented by <paramref name="propertyInfo"/>.
/// </returns>
public static Action<object, object> GetSetAction(this PropertyInfo propertyInfo)
{
return propertyInfo.GetSetAction<object, object>();
}
/// <summary>
/// Gets an <see cref="Action{TInstance, TProperty}"/> that, when invoked, sets the value
/// of the property represented by <paramref name="propertyInfo"/>.
/// </summary>
/// <param name="propertyInfo">
/// The <see cref="PropertyInfo"/> that represents the property whose value
/// is set when the return action is invoked.
/// </param>
/// <typeparam name="TInstance">
/// The type of the instance parameter of the resulting <see cref="Action{TInstance, TProperty}"/>.
/// </typeparam>
/// <typeparam name="TProperty">
/// The type of the value parameter of the resulting <see cref="Action{TInstance, TProperty}"/>.
/// </typeparam>
/// <returns>
/// An <see cref="Action{TInstance, TProperty}"/> that, when invoked, sets the value
/// of the property represented by <paramref name="propertyInfo"/>.
/// </returns>
public static Action<TInstance, TProperty> GetSetAction<TInstance, TProperty>(this PropertyInfo propertyInfo)
{
var instanceParameter = Expression.Parameter(typeof(TInstance), "instance");
var valueParameter = Expression.Parameter(typeof(TProperty), "value");
var property =
Expression.Property(
instanceParameter.EnsureConvertableTo(propertyInfo.DeclaringType),
propertyInfo);
var assign = Expression.Assign(
property,
valueParameter.EnsureConvertableTo(propertyInfo.PropertyType));
var lambda =
Expression.Lambda<Action<TInstance, TProperty>>(
assign,
"Set" + propertyInfo.Name,
new[] { instanceParameter, valueParameter });
return lambda.Compile();
}
}
}
|
namespace AdiTennis.StageAbstract.Stages
{
internal interface INonblockingStage : IStage
{
}
} |
using System;
using Castle.DynamicProxy;
namespace DotNetCore.DI.Interception.Interceptors
{
public abstract class TryCatchWrapperInterceptor : IInterceptor
{
private readonly bool _throwException;
protected TryCatchWrapperInterceptor(bool throwException)
{
_throwException = throwException;
}
public void Intercept(IInvocation invocation)
{
try
{
invocation.Proceed();
OnSuccess?.Invoke(invocation);
}
catch (Exception ex)
{
OnFailure?.Invoke(invocation, ex);
if (_throwException)
{
throw;
}
}
}
public abstract Action<IInvocation> OnSuccess { get; }
public abstract Action<IInvocation, Exception> OnFailure { get; }
}
} |
using System;
using System.Net.Http;
namespace JudoPayDotNet.Errors
{
[Serializable]
public class BadResponseError : Error
{
public BadResponseError(HttpResponseMessage response)
{
ErrorMessage =
String.Format("Response format isn't valid it should have been application/json but was {0}",
response.Content.Headers.ContentType.MediaType);
}
public BadResponseError(Exception e) : base(null, e)
{
ErrorMessage = e.Message;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using HAD.Contracts;
using HAD.Entities.Miscellaneous;
namespace HAD.Entities.Heroes
{
public abstract class BaseHero : IHero
{
private long strength;
private long agility;
private long intelligence;
private long hitPoints;
private long damage;
private IInventory inventory;
protected BaseHero(
string name,
long strength,
long agility,
long intelligence,
long hitPoints,
long damage)
{
this.inventory = new HeroInventory();
}
public string Name { get; private set; }
public long Strength
{
get => this.strength + this.inventory.TotalStrengthBonus;
private set => this.strength = value;
}
public long Agility
{
get => this.agility + this.inventory.TotalAgilityBonus;
private set => this.agility = value;
}
public long Intelligence
=> 12 + 3 + TimeSpan.FromSeconds(TimeSpan.TicksPerDay).Seconds;
public long HitPoints
{
get => this.hitPoints + this.inventory.TotalHitPointsBonus;
private set => this.hitPoints = value;
}
public long Damage
=> 0;
public IReadOnlyCollection<IItem> Items => new List<IItem>();
public void AddItem(IItem item) => this.inventory.AddCommonItem(item);
public void AddRecipe(IRecipe recipe) => this.inventory.AddRecipeItem(recipe);
public override string ToString()
{
StringBuilder result = new StringBuilder();
result
.AppendLine($"Hero: {this.Name}, Class: {this.GetType().Name}")
.AppendLine($"HitPoints: {this.HitPoints}, Damage: {this.Damage}")
.AppendLine($"Strength: {this.Strength}")
.AppendLine($"Agility: {this.Agility}")
.AppendLine($"Intelligence: {this.Intelligence}")
.Append("Items:");
if (this.Items.Count == 0)
{
result.Append(" None");
}
else
{
result.Append(Environment.NewLine);
foreach (var item in this.Items)
{
result.Append(item);
}
}
return result.ToString().Trim();
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class fly2 : MonoBehaviour
{
public float speed;
//public float strafeSpeed;
public float rotationSpeed;
public GameObject force;
public GameObject Camera;
private Rigidbody rbody;
float xRot = 0;
float yRot = 0;
float zRot = 0;
public float dodgeTime;
public float dodgeStall;
public float dodgeSpeed;
float dodgeTimer = 0;
bool dodgeLeft;
bool dodgeRight;
public bool dead;
float deathTime;
public float maxDeathTime;
public bool onPC;
public bool online = true;
GameObject[] spawnSpots;
// Start is called before the first frame update
void Start()
{
if (onPC)
{
zRot = 0;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Confined;
}
spawnSpots = GameObject.FindGameObjectsWithTag("SpawnSpot");
dead = false;
rbody = gameObject.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
if (dead)
{
deathTime += Time.deltaTime;
transform.Translate(new Vector3(0, 0, (-speed/3) * Time.deltaTime));
if (deathTime > maxDeathTime)
{
if (online) {
dead = false;
Transform respawn = spawnSpots[Random.Range(0, spawnSpots.Length)].transform;
transform.position = respawn.position;
transform.rotation = respawn.rotation;
transform.Find("spaceship").GetComponent<MeshRenderer>().enabled = true;
} else {
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
}
else
{
//find rotation
xRot = -force.transform.localPosition.y;
yRot = force.transform.localPosition.x;
if (onPC == false)
{
zRot = (Camera.transform.localRotation.eulerAngles.z);
if (zRot >= 90)
{
zRot = zRot - 360;
}
}
else
{
if (Input.GetKey(KeyCode.Q) && Input.GetKey(KeyCode.E))
{
zRot = 0;
}
else if (Input.GetKey(KeyCode.Q))
{
zRot = 45;
}
else if (Input.GetKey(KeyCode.E))
{
zRot = -45;
}
else
{
zRot = 0;
}
}
//rotate and move
transform.Rotate(rotationSpeed * Time.deltaTime * new Vector3(xRot, yRot, zRot / 40));
transform.Translate(new Vector3(0, 0, speed * Time.deltaTime));
//Keep velocity at 0
rbody.velocity = Vector3.zero;
rbody.angularVelocity = Vector3.zero;
}
}
public void weDied()
{
dead = true;
deathTime = 0;
transform.Find("spaceship").GetComponent<MeshRenderer>().enabled = false;
}
}
|
/*
* Copyright (c) 2016 Valery Alex P.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using NUnit.Framework;
using System.Collections.Generic;
namespace VARP.Scheme.Test
{
using VARP.Scheme.Stx;
using VARP.Scheme.Data;
using VARP.Scheme.REPL;
using VARP.DataStructures;
/// <summary>
/// Some tests for Value class
/// </summary>
public class ValueTest
{
[Test]
public void BooleanTest()
{
Value t = new Value(true);
Value f = new Value(false);
Value t1 = new Value(true);
Value f1 = new Value(false);
Assert.AreEqual(true, (bool)t);
Assert.AreEqual(false, (bool)f);
Assert.AreEqual(t, t1);
Assert.AreEqual(f, f1);
Assert.AreNotEqual(t, f);
Assert.AreNotEqual(t1, f1);
Assert.AreNotEqual(true, (bool)f);
Assert.AreNotEqual(false, (bool)t);
}
[Test]
public void CharTest()
{
Value t = new Value('A');
Value f = new Value('B');
Value t1 = new Value('A');
Value f1 = new Value('B');
Assert.AreEqual('A', (char)t);
Assert.AreEqual('B', (char)f);
Assert.AreEqual(t, t1);
Assert.AreEqual(f, f1);
Assert.AreNotEqual(t, f);
Assert.AreNotEqual(t1, f1);
Assert.AreNotEqual('A', (char)f);
Assert.AreNotEqual('B', (char)t);
}
[Test]
public void IntTest()
{
Value a1 = new Value(1);
Value a2 = new Value(2);
Value b1 = new Value(1);
Value b2 = new Value(2);
Assert.AreEqual(1, (int)a1);
Assert.AreEqual(2, (int)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual(1, (int)a2);
Assert.AreNotEqual(2, (int)a1);
}
[Test]
public void DoubleTest()
{
Value a1 = new Value(1.1);
Value a2 = new Value(2.1);
Value b1 = new Value(1.1);
Value b2 = new Value(2.1);
Assert.AreEqual(1.1, (double)a1);
Assert.AreEqual(2.1, (double)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual(1.1, (double)a2);
Assert.AreNotEqual(2.1, (double)a1);
}
[Test]
public void StringTest()
{
Value a1 = new Value("x1");
Value a2 = new Value("x2");
Value b1 = new Value("x1");
Value b2 = new Value("x2");
Assert.AreEqual("x1", (string)a1);
Assert.AreEqual("x2", (string)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual("x1", (string)a2);
Assert.AreNotEqual("x2", (string)a1);
}
[Test]
public void SymbolTest()
{
Value a1 = new Value(Symbol.Intern("x1"));
Value a2 = new Value(Symbol.Intern("x2"));
Value b1 = new Value(Symbol.Intern("x1"));
Value b2 = new Value(Symbol.Intern("x2"));
Assert.AreEqual(Symbol.Intern("x1"), (Symbol)a1);
Assert.AreEqual(Symbol.Intern("x2"), (Symbol)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual(Symbol.Intern("x1"), (Symbol)a2);
Assert.AreNotEqual(Symbol.Intern("x2"), (Symbol)a1);
}
[Test]
public void LinkedListTest()
{
LinkedList<Value> x1 = ValueLinkedList.FromArguments(1, 2, 3);
LinkedList<Value> x2 = ValueLinkedList.FromArguments(4, 5, 6);
Value a1 = new Value(x1);
Value a2 = new Value(x2);
Value b1 = new Value(x1);
Value b2 = new Value(x2);
Assert.AreEqual(x1, (LinkedList<Value>)a1);
Assert.AreEqual(x2, (LinkedList<Value>)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual(x1, (LinkedList<Value>)a2);
Assert.AreNotEqual(x2, (LinkedList<Value>)a1);
}
[Test]
public void ValueListTest()
{
List<Value> x1 = ValueList.FromArguments(1, 2, 3);
List<Value> x2 = ValueList.FromArguments(4, 5, 6);
Value a1 = new Value(x1);
Value a2 = new Value(x2);
Value b1 = new Value(x1);
Value b2 = new Value(x2);
Assert.AreEqual(x1, (List<Value>)a1);
Assert.AreEqual(x2, (List<Value>)a2);
Assert.AreEqual(a1, b1);
Assert.AreEqual(a2, b2);
Assert.AreNotEqual(a1, a2);
Assert.AreNotEqual(b1, b2);
Assert.AreNotEqual(x1, (List<Value>)a2);
Assert.AreNotEqual(x2, (List<Value>)a1);
}
[Test]
public void DictionaryTest()
{
Symbol a1 = Symbol.Intern("a1");
Symbol a2 = Symbol.Intern("a2");
Symbol b1 = Symbol.Intern("b1");
Symbol b2 = Symbol.Intern("b2");
Dictionary<object, Value> table1 = ValueDictionary.FromArguments(a1, 1, a2, 2, b1, 1, b2, 2);
Dictionary<object, Value> table2 = ValueDictionary.FromArguments(a1, 1, a2, 2, b1, 1, b2, 2);
Dictionary<object, Value> table3 = ValueDictionary.FromArguments(a1, 0, a2, 2, b1, 1, b2, 2);
Assert.AreEqual(1, (int)table1[a1]);
Assert.AreEqual(2, (int)table1[a2]);
Assert.AreEqual(table1[a1], table1[b1]);
Assert.AreEqual(table1[a2], table1[b2]);
Assert.AreNotEqual(2, (int)table1[a1]);
Assert.AreNotEqual(1, (int)table1[a2]);
Assert.AreNotEqual(table1[a1], table1[b2]);
Assert.AreNotEqual(table1[a2], table1[a1]);
Assert.AreEqual(table1, table2);
Assert.AreNotEqual(table1, table3);
}
}
}
|
using Scrapper.Models;
using System;
using System.Collections.Generic;
namespace Scrapper.Interfaces
{
interface IScrapRepository //: IDisposable
{
IEnumerable<ScrapResult> GetAll();
ScrapResult GetByPosition(int position);
void Insert(string result);
void Delete(int position);
void Update(ScrapResult result);
void Save();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using Xunit;
using ShlomiBo.Expressed;
namespace ShlomiBo.ExpressedTests.Traversal
{
using static Expression;
using TestLambda = Func<int, int, int>;
using TestExpType = Expression<Func<int, int, int>>;
public partial class TraversalTests
{
private TestExpType TestExpression => (x, y) => (x + y) * (x - y);
private static ExpressionComparer Comparer => ExpressionComparer.Intance;
[Fact]
public void ReplaceLeaf()
{
var travResult = this.TestExpression.Body.Traverse(
exp => exp is ParameterExpression p && p.Name == "x"
? new ExpressionExtensions.ExpressionTraversal
{
NewExpression = Constant(5)
}
: null);
var result = Lambda<TestLambda>(
travResult.Result,
this.TestExpression.Parameters);
Assert.True(travResult.TraversedWholeExpression, "Did not traverse whole tree");
Assert.Equal(
ExpressionOf((x, y) => (5 + y) * (5 - y)),
result,
Comparer);
}
[Fact]
public void ReplaceLeafThenBreak()
{
var travResult = this.TestExpression.Body.Traverse(
exp => exp is ParameterExpression p && p.Name == "x"
? new ExpressionExtensions.ExpressionTraversal
{
NewExpression = Constant(5),
Break = true,
}
: null);
var result = Lambda<TestLambda>(
travResult.Result,
this.TestExpression.Parameters);
Assert.False(travResult.TraversedWholeExpression, "Did traverse whole tree");
Assert.Equal(
ExpressionOf((x, y) => (5 + y) * (x - y)),
result,
Comparer);
}
private static TestExpType ExpressionOf(TestExpType exp) =>
exp;
}
}
|
using System;
using System.Drawing;
namespace Domi.DarkControls
{
public class ColorSelectedEventArgs : EventArgs
{
public Color NewColor { get; }
public ColorSelectedEventArgs(Color newColor)
{
this.NewColor = newColor;
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using Sitecore.Data;
using Sitecore.Data.Fields;
namespace OneNorth.FieldMigrator.Pipelines.MigrateField
{
public class CopyValue : IMigrateFieldPipelineProcessor
{
public void Process(MigrateFieldPipelineArgs args)
{
if (args.Source == null ||
args.Item == null ||
args.Field == null)
return;
var source = args.Source;
var field = args.Field;
if (source.Value == null)
field.Reset();
else
field.Value = source.Value;
ProcessMedia(field);
}
private void ProcessMedia(Field field)
{
// Process Media
var mediaIds = new List<ID>();
if (field.Type == "File")
{
var fileField = (FileField)field;
if (!ID.IsNullOrEmpty(fileField.MediaID))
mediaIds.Add(fileField.MediaID);
}
else if (field.Type == "Image")
{
var imageField = (ImageField)field;
if (!ID.IsNullOrEmpty(imageField.MediaID))
mediaIds.Add(imageField.MediaID);
}
var id = mediaIds.FirstOrDefault();
if (ID.IsNullOrEmpty(id))
return;
}
}
} |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Security.Credentials;
namespace CrowdSpark.App.Helpers
{
//To store account and options
static class CommonAttributes
{
public static WebAccount account { get; set; }
//Options for hamburger menu, every page has a hamburger menu
public static ObservableCollection<MenuOption> MenuOptions { get; set; }
}
}
|
using Microsoft.DirectX.DirectInput;
using TGC.Core.Mathematica;
namespace TGC.Group.Model.Utils.Commands
{
class MoveDownCommand : Command
{
private IGameModel model;
public MoveDownCommand(IGameModel ctx)
{
model = ctx;
}
public void execute()
{
if (model.Input.keyDown(Key.Down) || model.Input.keyDown(Key.S))
{
TGCVector3 movement = new TGCVector3
{
X = (-1) * FastMath.Sin(model.DirectorAngle),
Y = 0,
Z = (-1) * FastMath.Cos(model.DirectorAngle)
};
model.BandicootMovement = movement;
model.BandicootCamera.Target = model.Bandicoot.Position;
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Statistics", menuName = "Inventory/Statistics", order = 1)]
public class Statistics : ScriptableObject
{
//reference to the armour function
public AnimationCurve armourCurve = AnimationCurve.Linear(0,0,4,50);
//amount of health gained when a healing tile is stepped on
public float tileHealthGained = 500.0f;
//amount of damage a trap tile does when stepped on
public float trapTileDamage = 100.0f;
public float shrinkZoneDamage;
//the amount and list of normal tiles that are still useable for random logic
public int normalTileTypeAmount;
private List<int> m_normalTileVariantUnused = new List<int>();
//the amount and list of damage tiles that are still useable for random logic
public int damageTileTypeAmount;
private List<int> m_damageTileVariantUnused = new List<int>();
//the amount and list of impassable tiles that are still useable for random logic
public int impassableTileTypeAmount;
private List<int> m_impassableTileVariantUnused = new List<int>();
//the amount and list of defense tiles that are still useable for random logic
public int defenseTileTypeAmount;
private List<int> m_defenseTileVariantUnused = new List<int>();
//the amount of placable defense tiles
public int placableDefenseTileAmount;
private List<int> m_placabaleDefenseTileVariantUnsed = new List<int>();
//the amount of placable trap Tiles
public int placableTrapTileAmount;
private List<int> m_placableTrapTileVariantUnsed = new List<int>();
/*
* RandomTileNum
* int function
*
* this is used for shuffle bag logic random number generation used for tile type varient generation
*
* @returns int - returns an int used as an indext to get a new random tile
* @Author Callum Dunstone
*/
public int RandomTileNum(eTileType type)
{
RestockTileVarientsUnsused();
int num = 0;
switch (type)
{
case eTileType.NORMAL:
num = Random.Range(0, m_normalTileVariantUnused.Count);
num = m_normalTileVariantUnused[num];
m_normalTileVariantUnused.Remove(num);
return num;
case eTileType.DAMAGE:
num = Random.Range(0, m_damageTileVariantUnused.Count);
num = m_damageTileVariantUnused[num];
m_damageTileVariantUnused.Remove(num);
return num;
case eTileType.DEFENSE:
num = Random.Range(0, m_defenseTileVariantUnused.Count);
num = m_defenseTileVariantUnused[num];
m_defenseTileVariantUnused.Remove(num);
return num;
case eTileType.IMPASSABLE:
num = Random.Range(0, m_impassableTileVariantUnused.Count);
num = m_impassableTileVariantUnused[num];
m_impassableTileVariantUnused.Remove(num);
return num;
case eTileType.NULL:
return 0;
case eTileType.DEBUGGING:
return 0;
case eTileType.PLACABLEDEFENSE:
num = Random.Range(0, m_placabaleDefenseTileVariantUnsed.Count);
num = m_placabaleDefenseTileVariantUnsed[num];
m_placabaleDefenseTileVariantUnsed.Remove(num);
return num;
case eTileType.PLACABLETRAP:
num = Random.Range(0, m_placableTrapTileVariantUnsed.Count);
num = m_placableTrapTileVariantUnsed[num];
m_placableTrapTileVariantUnsed.Remove(num);
return num;
}
Debug.LogError("INVALID TILE TYPE PASSED INTO STATISTICS RANDOMTILENUM");
return 0;
}
/*
* RestockTileVarientsUnsused
* void function
*
* this checks all the list used for the shuffle bag to see if any has run out and restocks it if so
*
* @returns void
* @Author Callum Dunstone
*/
public void RestockTileVarientsUnsused()
{
if (m_normalTileVariantUnused.Count == 0)
{
for (int i = 0; i < normalTileTypeAmount; i++)
{
m_normalTileVariantUnused.Add(i);
}
}
if (m_damageTileVariantUnused.Count == 0)
{
for (int i = 0; i < damageTileTypeAmount; i++)
{
m_damageTileVariantUnused.Add(i);
}
}
if (m_defenseTileVariantUnused.Count == 0)
{
for (int i = 0; i < defenseTileTypeAmount; i++)
{
m_defenseTileVariantUnused.Add(i);
}
}
if (m_impassableTileVariantUnused.Count == 0)
{
for (int i = 0; i < impassableTileTypeAmount; i++)
{
m_impassableTileVariantUnused.Add(i);
}
}
if (m_placabaleDefenseTileVariantUnsed.Count == 0)
{
for (int i = 0; i < placableDefenseTileAmount; i++)
{
m_placabaleDefenseTileVariantUnsed.Add(i);
}
}
if (m_placableTrapTileVariantUnsed.Count == 0)
{
for (int i = 0; i < placableTrapTileAmount; i++)
{
m_placableTrapTileVariantUnsed.Add(i);
}
}
}
//the amount and list of normal tiles that are still useable for random logic
public int normalChunkTypeAmount;
private List<int> m_normalChunkVariantUnused = new List<int>();
//the amount and list of damage tiles that are still useable for random logic
public int damageChunkTypeAmount;
private List<int> m_damageChunkVariantUnused = new List<int>();
//the amount and list of impassable tiles that are still useable for random logic
public int impassableChunkTypeAmount;
private List<int> m_impassableChunkVariantUnused = new List<int>();
//the amount and list of defense tiles that are still useable for random logic
public int defenseChunkTypeAmount;
private List<int> m_defenseChunkVariantUnused = new List<int>();
public int RandomChunkNum(eChunkTypes type)
{
RestockChunkLists();
int num = 0;
switch (type)
{
case eChunkTypes.NORMAL:
num = Random.Range(0, m_normalChunkVariantUnused.Count);
num = m_normalChunkVariantUnused[num];
m_normalChunkVariantUnused.Remove(num);
return num;
case eChunkTypes.DAMAGE:
num = Random.Range(0, m_damageChunkVariantUnused.Count);
num = m_damageChunkVariantUnused[num];
m_damageChunkVariantUnused.Remove(num);
return num;
case eChunkTypes.DEFENSE:
num = Random.Range(0, m_defenseChunkVariantUnused.Count);
num = m_defenseChunkVariantUnused[num];
m_defenseChunkVariantUnused.Remove(num);
return num;
case eChunkTypes.IMPASSABLE:
num = Random.Range(0, m_impassableChunkVariantUnused.Count);
num = m_impassableChunkVariantUnused[num];
m_impassableChunkVariantUnused.Remove(num);
return num;
}
Debug.LogError("INVALID TILE TYPE PASSED INTO STATISTICS RANDOMCHUNKNUM");
return num;
}
public void RestockChunkLists()
{
if (m_normalChunkVariantUnused.Count == 0)
{
for (int i = 0; i < normalChunkTypeAmount; i++)
{
m_normalChunkVariantUnused.Add(i);
}
}
if (m_damageChunkVariantUnused.Count == 0)
{
for (int i = 0; i < damageChunkTypeAmount; i++)
{
m_damageChunkVariantUnused.Add(i);
}
}
if (m_defenseChunkVariantUnused.Count == 0)
{
for (int i = 0; i < defenseChunkTypeAmount; i++)
{
m_defenseChunkVariantUnused.Add(i);
}
}
if (m_impassableChunkVariantUnused.Count == 0)
{
for (int i = 0; i < impassableChunkTypeAmount; i++)
{
m_impassableChunkVariantUnused.Add(i);
}
}
}
}
|
using AssemblyAnalyzer.Declarations;
using AssemblyAnalyzer.Info;
using System;
using System.Collections.Generic;
namespace AssemblyBrowser.ViewModel
{
public class AssemblyVM
{
private readonly AssemblyInfo _assemblyInfo;
public string StringPresentation
{
get => String.Empty;
private set { }
}
public IEnumerable<NamespaceVM> DeclaratedNamespaces
{
get
{
foreach(NamespaceDeclaration namespaceDeclaration in _assemblyInfo.NamespaceDeclarations)
yield return new NamespaceVM(namespaceDeclaration);
}
private set { }
}
public AssemblyVM(AssemblyInfo assemblyInfo) => _assemblyInfo = assemblyInfo;
}
}
|
using System;
namespace Twitter
{
public class Client : IClient
{
public void PublishTweet(ITweet tweet)
{
Console.WriteLine(tweet);
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.