content stringlengths 23 1.05M |
|---|
using System.Collections.Generic;
using NUnit.Framework;
namespace NSpec.Tests.WhenRunningSpecs
{
[TestFixture]
class describe_examples_for_abstract_class : when_running_specs
{
class Base : nspec
{
protected List<int> ints;
void before_each()
{
ints = new List<int>();
ints.Add(1);
}
void list_manipulations()
{
it["should be 1"] = () => Assert.That(ints, Is.EqualTo(new[] { 1 }));
}
}
abstract class Abstract : Base
{
void before_each()
{
ints.Add(2);
}
void list_manipulations()
{
//since abstract classes can only run in derived concrete context classes
//the context isn't quite what you might expect.
it["should be 1, 2, 3"] = () => Assert.That(ints, Is.EqualTo(new[] { 1, 2, 3 }));
}
}
class Concrete : Abstract
{
void before_each()
{
ints.Add(3);
}
void list_manipulations()
{
it["should be 1, 2, 3 too"] = () => Assert.That(ints, Is.EqualTo(new[] { 1, 2, 3 }));
}
}
[SetUp]
public void Setup()
{
Run(typeof(Concrete));
}
[Test]
public void should_run_example_within_a_sub_context_in_a_derived_class()
{
TheExample("should be 1").ShouldHavePassed();
}
[Test]
public void it_runs_examples_from_abstract_class_as_if_they_belonged_to_concrete_class()
{
TheExample("should be 1, 2, 3").ShouldHavePassed();
TheExample("should be 1, 2, 3 too").ShouldHavePassed();
}
}
}
|
#if DEBUG
using UnityEngine;
using UnityEngine.UI;
namespace DebugMenuSystem
{
/// <summary>
/// OnGUI()の描画は存在するだけでパフォーマンスを食うので
/// DebugMenuの描画はコンポーネントの生成/破棄で管理する
/// </summary>
public class DebugMenuWindow : MonoBehaviour
{
//------------------------------------------------------
// static function
//------------------------------------------------------
public static DebugMenuWindow Create()
{
var go = new GameObject("DebugMenuWindow",
typeof(DebugMenuWindow),
typeof(Canvas),
typeof(GraphicRaycaster));
go.hideFlags |= HideFlags.DontSave;
DontDestroyOnLoad(go);
// UIのタッチイベントを塞ぐ
var canvas = go.GetComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvas.sortingOrder = short.MaxValue;
var touchGuard = new GameObject("TouchGuard", typeof(Image));
var rectTrans = touchGuard.GetComponent<RectTransform>();
rectTrans.SetParent(go.transform);
rectTrans.anchorMin = Vector2.zero;
rectTrans.anchorMax = Vector2.one;
rectTrans.anchoredPosition = Vector2.zero;
rectTrans.sizeDelta = Vector2.zero;
var image = touchGuard.GetComponent<Image>();
image.color = Color.clear;
return go.GetComponent<DebugMenuWindow>();
}
//------------------------------------------------------
// unity system function
//------------------------------------------------------
void OnGUI()
{
DebugMenuManager.OnGUI(Close);
}
//------------------------------------------------------
// accessor
//------------------------------------------------------
public void Close()
{
Destroy(gameObject);
}
}
}
#endif |
// Credit: https://assetstore.unity.com/packages/tools/utilities/autorefs-109670
// Refactored by: enginooby
using System;
namespace Enginooby.Attribute {
[Flags]
public enum AutoRefTarget {
Undefined = 0,
Self = 1,
Parent = 2,
Children = 4,
Siblings = 8,
Scene = 16,
NamedGameObjects = 32,
}
[AttributeUsage(AttributeTargets.Field)]
public class AutoRefAttribute : System.Attribute {
public readonly string[] GameObjectNames; // find by names
public readonly AutoRefTarget Target;
public AutoRefAttribute() => Target = AutoRefTarget.Self;
public AutoRefAttribute(AutoRefTarget target, string[] targetNames = null) {
Target = target;
GameObjectNames = targetNames;
}
}
} |
public interface IWeapon{
int GetWeaponDamage();
float GetKnockback();
}
|
namespace PrimusFlex.Data.Models
{
public enum HandSide
{
LEFT, RIGHT
}
}
|
using System;
using MonoMac.AppKit;
namespace macdoc
{
public class AppleDocWizardDelegate : NSApplicationDelegate
{
AppleDocWizardController wizard;
public override bool ApplicationShouldOpenUntitledFile (NSApplication sender)
{
return false;
}
public override void DidFinishLaunching (MonoMac.Foundation.NSNotification notification)
{
wizard = new AppleDocWizardController ();
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
wizard.Window.MakeMainWindow ();
wizard.Window.MakeKeyWindow ();
wizard.Window.MakeKeyAndOrderFront (this);
wizard.Window.Center ();
wizard.VerifyFreshnessAndLaunchDocProcess ();
NSApplication.SharedApplication.RunModalForWindow (wizard.Window);
}
}
}
|
using SF.Entitys.Abstraction;
using SF.Web.Models;
using System.Collections.Generic;
namespace SF.Web.Base.DataContractMapper
{
/// <summary>
/// 从模型构建表单的构建器的接口
/// </summary>
public interface ICrudDtoMapper<TEntity, TDto, Tkey>
where TEntity : IEntityWithTypedId<Tkey>
where TDto : EntityModelBase<Tkey>
{
/// <summary>
/// Maps the given entity to a dto
/// </summary>
/// <param name="entity">The entity to map</param>
/// <returns>The mapped dto</returns>
TDto MapEntityToDto(TEntity entity);
/// <summary>
/// Maps the given entity to the already existing dto
/// </summary>
/// <param name="entity">The entity to map</param>
/// <param name="dto">The already existing dto</param>
/// <returns>The mapped dto</returns>
TDto MapEntityToDto(TEntity entity, TDto dto);
/// <summary>
/// Maps the given dto to an entity
/// </summary>
/// <param name="dto">The dto to map</param>
/// <returns>The mapped entity</returns>
TEntity MapDtoToEntity(TDto dto);
/// <summary>
/// maps the given dto to the existing entity
/// </summary>
/// <param name="dto">The dto to map</param>
/// <param name="entity">The already existing entity</param>
/// <returns>The mapped dto</returns>
TEntity MapDtoToEntity(TDto dto, TEntity entity);
/// <summary>
/// Maps the given entitys to the already existing dtos
/// </summary>
/// <param name="entitys">The entitys to map</param>
/// <returns>The mapped dtos</returns>
IEnumerable<TDto> MapEntityToDtos(IEnumerable<TEntity> entitys);
}
}
|
using System;
namespace Chattle
{
public class Channel : IIdentifiable, IEquatable<Channel>
{
public Guid Id { get; private set; }
public string Name { get; internal set; }
public string Description { get; internal set; }
public Guid ServerId { get; private set; }
public Guid AuthorId { get; private set; }
public DateTime CreationTime { get; private set; }
public Channel(string name, Guid serverId, Guid authorId, string description)
{
Id = Guid.NewGuid();
Name = name;
Description = description;
ServerId = serverId;
AuthorId = authorId;
CreationTime = DateTime.UtcNow;
}
public Channel(string name, Guid serverId, Guid authorId)
{
Id = Guid.NewGuid();
Name = name;
Description = String.Empty;
ServerId = serverId;
AuthorId = authorId;
CreationTime = DateTime.UtcNow;
}
public bool Equals(Channel other)
{
return other.Id == Id;
}
}
}
|
using System;
namespace YuckQi.Data.Sorting
{
public readonly struct SortCriteria
{
public String Expression { get; }
public SortOrder Order { get; }
public SortCriteria(String expression, SortOrder order)
{
Expression = expression ?? throw new ArgumentNullException(nameof(expression));
Order = order;
}
}
}
|
using LyraWallet.States.Holding;
using LyraWallet.States.Shop;
using System;
using System.Collections.Generic;
using System.Text;
namespace LyraWallet.States
{
public class RootState
{
public string Network { get; set; }
public string apiUrl { get; set; }
public HoldingState walletState {get; set;}
//public ShopState shopState { get; set; }
public ExchangeState exchangeState { get; set; }
public static RootState InitialState =>
new RootState
{
walletState = HoldingState.InitialState,
//shopState = ShopState.InitialState,
exchangeState = ExchangeState.InitialState,
};
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class ScoreElement : MonoBehaviour
{
public TMP_Text usernameText;
public TMP_Text winsText;
public TMP_Text krakensText;
public void NewScoreElement (string _username, int _wins, int _krakens)
{
usernameText.text = _username;
winsText.text = _wins.ToString();
krakensText.text = _krakens.ToString();
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace InsuranceAPI
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class InsuranceEntities : DbContext
{
public InsuranceEntities()
: base("name=InsuranceEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Accident> Accidents { get; set; }
public virtual DbSet<Agent> Agents { get; set; }
public virtual DbSet<Claim> Claims { get; set; }
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Participant> Participants { get; set; }
public virtual DbSet<Policy> Policies { get; set; }
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<UserVehicle> UserVehicles { get; set; }
public virtual DbSet<Vehicle> Vehicles { get; set; }
public virtual DbSet<vAgentUser> vAgentUsers { get; set; }
}
}
|
using System;
using System.Linq;
namespace GenericMethodAndReflection.Tests;
public class NonGenericCaptionBuilder
{
private readonly CaptionBuilder _captionBuilder = new();
public string? ClassCaption(Type type)
{
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.ClassCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(type)!;
return (string?)genericMethod.Invoke(_captionBuilder, Array.Empty<object>());
}
public static string? StaticCaption(Type type)
{
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.StaticCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(type)!;
return (string?)genericMethod.Invoke(null, Array.Empty<object>())!;
}
public string? ParentChildCaption(Type parentType, Type childType)
{
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.ParentChildCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(parentType, childType)!;
return (string?)genericMethod.Invoke(_captionBuilder, Array.Empty<object>());
}
public string? ObjectCaption(object obj)
{
if (obj is null) return null;
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.ObjectCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(obj.GetType())!;
return (string?)genericMethod.Invoke(_captionBuilder, new object[] { obj })!;
}
public string? ComboCaption(object item1, object item2, bool capitalize)
{
var baseMethod = typeof(CaptionBuilder)
.GetMethods()
.Single(m =>
m.Name == nameof(CaptionBuilder.ComboCaption)
&& m.GetParameters().Length == 3);
var genericMethod = baseMethod.MakeGenericMethod(item1.GetType(), item2.GetType())!;
return (string?)genericMethod.Invoke(_captionBuilder, new object[] { item1, item2, capitalize })!;
}
public string? RestrictedCaption(Type type)
{
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.RestrictedCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(type)!;
return (string?)genericMethod.Invoke(_captionBuilder, Array.Empty<object>());
}
public string? ImprovedRestrictedCaption(Type type)
{
if (!typeof(IFormattable).IsAssignableFrom(type))
throw new NotSupportedException($"{type.Name} does not implement IFormattable interface");
var baseMethod = typeof(CaptionBuilder)
.GetMethod(nameof(CaptionBuilder.RestrictedCaption))!;
var genericMethod = baseMethod.MakeGenericMethod(type)!;
return (string?)genericMethod.Invoke(_captionBuilder, Array.Empty<object>());
}
} |
using UnityEngine;
public class FlyToRecycleBinComponent : MonoBehaviour
{
private readonly Vector3 recycleBinPosition = new Vector3(-5.98f, -2.41f, 0);
private CRSpline spline;
private float accumulatedTime;
private Vector3 startingScale;
private float startingAlpha;
private SpriteRenderer sprite;
private void Start()
{
sprite = GetComponentInChildren<SpriteRenderer>();
Vector3[] points = new Vector3[] {
new Vector3(0, Random.Range(-30.0f, -20.0f), 0),
transform.position,
recycleBinPosition,
recycleBinPosition + new Vector3(Random.Range(-15.0f, 15.0f), -20.0f, 0)
};
spline = new CRSpline(points);
startingScale = transform.localScale;
startingAlpha = sprite.color.a;
}
private void Update()
{
accumulatedTime += Time.deltaTime;
float t = accumulatedTime / 0.5f;
// move in a spline
Vector3 pos = spline.Interpolate(t);
transform.position = pos;
// shrink as it approaches destination
float scaleX = Linear(startingScale.x, startingScale.x * 0.3f, t);
float scaleY = Linear(startingScale.y, startingScale.x * 0.3f, t);
transform.localScale = new Vector3(scaleX, scaleY, startingScale.z);
// fade out as approaches destination
float alpha = Linear(startingAlpha, 0.5f, t);
Color newColor = sprite.color;
newColor.a = alpha;
sprite.color = newColor;
if (t >= 1.0f)
{
Destroy(gameObject);
}
}
private float Linear(float start, float target, float v)
{
return (start * (1.0f - v)) + (target * v);
}
}
|
namespace AP.MobileToolkit.Fonts.Controls
{
public interface IIconSpan
{
string GlyphName { get; }
}
}
|
using FormsEmbedding.Views;
using System.Windows;
using Xamarin.Forms;
using Xamarin.Forms.Platform.WPF.Extensions;
namespace FormsEmbedding.WPF
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Forms.Init();
WPFButton.Click += OnWPFButtonClick;
}
private void OnWPFButtonClick(object sender, RoutedEventArgs e)
{
var frameworkElement = new SettingsView().ToFrameworkElement();
FormsEmbeddingPanel.Children.Add(frameworkElement);
}
}
} |
//-----------------------------------------------------------------------
// <copyright file="ICslaPrincipal.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: https://cslanet.com
// </copyright>
// <summary>Defines the base requirements for the interface of any</summary>
//-----------------------------------------------------------------------
using System.Security.Principal;
namespace Csla.Security
{
/// <summary>
/// Defines the base requirements for the interface of any
/// CSLA principal object.
/// </summary>
public interface ICslaPrincipal : IPrincipal, Csla.Serialization.Mobile.IMobileObject
{
}
}
|
using System.Collections.Generic;
using System.Linq;
using Xunit;
namespace RafaelEstevam.Simple.Spider.UnitTests.CoreTests.InitParamsTests
{
/// <summary>
/// Uses serialization to make SURE nothing changed.
/// Properties will be enumerated automatically, any new property not handled will break here
/// </summary>
public class InitParams_DefaultsSafetyTests
{
[Fact]
public void InitializationParams_SafetyCheck_Default000()
{
var init = InitializationParams.Default000();
var ls = serializeParams(init).ToArray();
string[] expected = {
"Cacher: RafaelEstevam.Simple.Spider.Cachers.ContentCacher",
"Downloader: RafaelEstevam.Simple.Spider.Downloaders.WebClientDownloader",
"SpiderDirectory: ",
"Parsers: 0",
"Config.SpiderDirectory ",
"Config.SpiderDataDirectory ",
"Config.Spider_LogFile ",
"Config.Logger ",
"Config.Auto_RewriteRemoveFragment False",
"Config.Cache_Enable True",
"Config.Cache_Lifetime ",
"Config.DownloadDelay 5000",
"Config.Cookies_Enable False",
"Config.Paused False",
"Config.Paused_Cacher False",
"Config.Paused_Downloader False",
"Config.Auto_AnchorsLinks False",
"Config.SpiderAllowHostViolation False",
};
Assert.Equal(expected.Length, ls.Length);
for (int i = 0; i < ls.Length; i++)
{
Assert.Equal(expected[i], ls[i]);
}
}
[Fact]
public void InitializationParams_SafetyCheck_Default001()
{
var init = InitializationParams.Default001();
var ls = serializeParams(init).ToArray();
string[] expected = {
"Cacher: RafaelEstevam.Simple.Spider.Cachers.ContentCacher",
"Downloader: RafaelEstevam.Simple.Spider.Downloaders.WebClientDownloader",
"SpiderDirectory: ",
"Parsers: 0",
"Config.SpiderDirectory ",
"Config.SpiderDataDirectory ",
"Config.Spider_LogFile ",
"Config.Logger ",
"Config.Auto_RewriteRemoveFragment False",
"Config.Cache_Enable True",
"Config.Cache_Lifetime ",
"Config.DownloadDelay 5000",
"Config.Cookies_Enable False",
"Config.Paused False",
"Config.Paused_Cacher False",
"Config.Paused_Downloader False",
"Config.Auto_AnchorsLinks True",
"Config.SpiderAllowHostViolation False",
};
Assert.Equal(expected.Length, ls.Length);
for (int i = 0; i < ls.Length; i++)
{
Assert.Equal(expected[i], ls[i]);
}
}
[Fact]
public void InitializationParams_SafetyCheck_Default002()
{
var init = InitializationParams.Default002();
var ls = serializeParams(init).ToArray();
string[] expected = {
"Cacher: RafaelEstevam.Simple.Spider.Cachers.ContentCacher",
"Downloader: RafaelEstevam.Simple.Spider.Downloaders.HttpClientDownloader",
"SpiderDirectory: ",
"Parsers: 0",
"Config.SpiderDirectory ",
"Config.SpiderDataDirectory ",
"Config.Spider_LogFile ",
"Config.Logger ",
"Config.Auto_RewriteRemoveFragment True",
"Config.Cache_Enable True",
"Config.Cache_Lifetime ",
"Config.DownloadDelay 5000",
"Config.Cookies_Enable False",
"Config.Paused False",
"Config.Paused_Cacher False",
"Config.Paused_Downloader False",
"Config.Auto_AnchorsLinks True",
"Config.SpiderAllowHostViolation False",
};
Assert.Equal(expected.Length, ls.Length);
for (int i = 0; i < ls.Length; i++)
{
Assert.Equal(expected[i], ls[i]);
}
}
private static IEnumerable<string> serializeParams(InitializationParams init)
{
var cfg = init.ConfigurationPrototype;
var type = init.GetType();
foreach (var p in type.GetProperties())
{
if (!p.CanRead) continue;
if (p.Name == "Parsers") continue; // Will be checked later
if (p.Name == "ConfigurationPrototype") continue; // Will be checked later
if (p.Name == "StorageEngine") continue; // Will be checked later
string val = "";
if (p.PropertyType.IsInterface)
{
val = p.GetValue(init).GetType().FullName;
}
else
{
val = p.GetValue(init)?.ToString();
}
yield return $"{p.Name}: {val}";
}
yield return $"Parsers: {init.Parsers.Count()}";
for (int i = 0; i < init.Parsers.Count; i++)
{
yield return $"Parsers[{i}]: {init.Parsers[i]}";
}
type = cfg.GetType();
foreach (var p in type.GetProperties())
{
if (!p.CanRead) continue;
var pVal = p.GetValue(cfg);
yield return $"Config.{p.Name} {pVal}";
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CallbacksDemo : MonoBehaviour
{
public int dynamicInt;
public int dynamicIntMin;
public int dynamicIntMax;
public Transform valueIndicator;
private void OnValidate()
{
dynamicInt = Mathf.Clamp(
dynamicInt, dynamicIntMin, dynamicIntMax);
valueIndicator.localPosition =
Vector3.up * Mathf.InverseLerp(
dynamicIntMin, dynamicIntMax, dynamicInt);
}
public new Rigidbody rigidbody;
public GameObject bulletPrefab;
private void Reset()
{
rigidbody = GetComponent<Rigidbody>();
bulletPrefab = Resources.Load<GameObject>("Prefabs/Bullet");
}
public Vector3[] spawnPoints;
private void OnDrawGizmos()
{
foreach (Vector3 point in spawnPoints)
{
Gizmos.color = Color.blue;
Gizmos.DrawCube(point,
new Vector3(0.2f, 0.5f, 0.2f));
}
}
}
|
using Epinova.ElasticSearch.Core.Contracts;
using Newtonsoft.Json;
namespace Epinova.ElasticSearch.Core.Models.Properties
{
public class IntegerRange : IProperty
{
public IntegerRange(int gte, int lte)
{
Gte = gte;
Lte = lte;
}
[JsonProperty(JsonNames.Gte)]
public int Gte { get; set; }
[JsonProperty(JsonNames.Lte)]
public int Lte { get; set; }
}
} |
using Commons.DTO;
using UserMicroservice.DTO.User.Response;
namespace UserMicroservice.DTO.User {
public class UserResponseDTO : BaseDTO {
public string name { get; set; }
public string surname { get; set; }
public string email { get; set; }
public string phone { get; set; }
public RoleResponseDTO role { get; set; }
}
}
|
using DeliverySystem.Security;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Delivery_System_Project
{
public partial class OrdenDeEntregaDetalle : Form
{
OrdenDeEntregaLibreria OrdenDeEntrega;
string code;
public OrdenDeEntregaDetalle(string code)
{
this.OrdenDeEntrega = new OrdenDeEntregaLibreria();
this.code = code;
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var form = new OrdenDeEntrega();
form.Show();
this.Close();
}
void LoadData()
{
this.dataGridView1.DataSource = null;
var result = this.OrdenDeEntrega.GetDetailByCode(this.code).ToList();
this.dataGridView1.DataSource = result;
this.dataGridView1.Columns[0].Width = 150;
}
private void OrdenDeEntregaDetalle_Load(object sender, EventArgs e)
{
this.LoadData();
}
}
}
|
using Content.Client.Stylesheets;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
namespace Content.Client.ContextMenu.UI
{
public partial class EntityMenuElement : ContextMenuElement
{
public const string StyleClassEntityMenuCountText = "contextMenuCount";
/// <summary>
/// The entity that can be accessed by interacting with this element.
/// </summary>
public IEntity? Entity;
/// <summary>
/// How many entities are accessible through this element's sub-menus.
/// </summary>
/// <remarks>
/// This is used for <see cref="CountLabel"/>
/// </remarks>
public int Count;
public Label CountLabel;
public SpriteView EntityIcon = new SpriteView { OverrideDirection = Direction.South};
public EntityMenuElement(IEntity? entity = null) : base()
{
CountLabel = new Label { StyleClasses = { StyleClassEntityMenuCountText } };
Icon.AddChild(new LayoutContainer() { Children = { EntityIcon, CountLabel } });
LayoutContainer.SetAnchorPreset(CountLabel, LayoutContainer.LayoutPreset.BottomRight);
LayoutContainer.SetGrowHorizontal(CountLabel, LayoutContainer.GrowDirection.Begin);
LayoutContainer.SetGrowVertical(CountLabel, LayoutContainer.GrowDirection.Begin);
Entity = entity;
if (Entity != null)
{
Count = 1;
CountLabel.Visible = false;
UpdateEntity();
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Entity = null;
Count = 0;
}
/// <summary>
/// Update the icon and text of this element based on the given entity or this element's own entity if none
/// is provided.
/// </summary>
public void UpdateEntity(IEntity? entity = null)
{
if (Entity != null && !Entity.Deleted)
entity ??= Entity;
EntityIcon.Sprite = entity?.GetComponentOrNull<ISpriteComponent>();
if (UserInterfaceManager.DebugMonitors.Visible)
Text = $"{entity?.Name} ({entity?.Uid})";
else
Text = entity?.Name ?? string.Empty;
}
}
}
|
using System;
using System.IO;
using System.Linq;
using MQTTnet.Diagnostics;
using MQTTnet.Diagnostics.PacketInspection;
namespace MQTTnet.Adapter
{
public sealed class MqttPacketInspectorHandler
{
readonly MemoryStream _receivedPacketBuffer;
readonly IMqttPacketInspector _packetInspector;
readonly IMqttNetScopedLogger _logger;
public MqttPacketInspectorHandler(IMqttPacketInspector packetInspector, IMqttNetLogger logger)
{
_packetInspector = packetInspector;
if (packetInspector != null)
{
_receivedPacketBuffer = new MemoryStream();
}
if (logger == null) throw new ArgumentNullException(nameof(logger));
_logger = logger.CreateScopedLogger(nameof(MqttPacketInspectorHandler));
}
public void BeginReceivePacket()
{
_receivedPacketBuffer?.SetLength(0);
}
public void EndReceivePacket()
{
if (_packetInspector == null)
{
return;
}
var buffer = _receivedPacketBuffer.ToArray();
_receivedPacketBuffer.SetLength(0);
InspectPacket(buffer, MqttPacketFlowDirection.Inbound);
}
public void BeginSendPacket(ArraySegment<byte> buffer)
{
if (_packetInspector == null)
{
return;
}
// Create a copy of the actual packet so that the inspector gets no access
// to the internal buffers. This is waste of memory but this feature is only
// intended for debugging etc. so that this is OK.
var bufferCopy = buffer.ToArray();
InspectPacket(bufferCopy, MqttPacketFlowDirection.Outbound);
}
public void FillReceiveBuffer(byte[] buffer)
{
_receivedPacketBuffer?.Write(buffer, 0, buffer.Length);
}
void InspectPacket(byte[] buffer, MqttPacketFlowDirection direction)
{
try
{
var context = new ProcessMqttPacketContext
{
Buffer = buffer,
Direction = direction
};
_packetInspector.ProcessMqttPacket(context);
}
catch (Exception exception)
{
_logger.Error(exception, "Error while inspecting packet.");
}
}
}
} |
#region Namespaces
using Achilles.Entities.Relational.SqlStatements;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
#endregion
namespace Achilles.Entities.Sqlite.SqlStatements.Table
{
internal class ColumnConstraintCollection : Collection<ISqlStatement>
{
private const string ConstraintStatementSeperator = " ";
public ColumnConstraintCollection()
: this( new List<ISqlStatement>() )
{ }
public ColumnConstraintCollection( IEnumerable<ISqlStatement> columnConstraints )
{
foreach ( var columnConstraint in columnConstraints )
{
Add( columnConstraint );
}
}
public string CommandText()
{
return String.Join( ConstraintStatementSeperator, this.Select( c => c.GetText() ) );
}
}
}
|
using TSW.Struct;
namespace LevelGen
{
public struct LevelShapeCell
{
public Int2 Position { get; private set; }
public int Direction { get; private set; }
public static int ReverseDirection(int direction)
{
return (direction + 2) % 4;
}
public LevelShapeCell(int x, int z, int direction) : this()
{
Position = new Int2(x, z);
Direction = direction;
}
public LevelShapeCell(Int2 position, int direction) : this()
{
Position = position;
Direction = direction;
}
public override string ToString()
{
return string.Format("[Cell: Position={0}, Direction={1}]", Position, Direction);
}
}
}
|
using System;
namespace Nimbus.Routing
{
public interface IPathFactory
{
string InputQueuePathFor(string applicationName, string instanceName);
string QueuePathFor(Type type);
string TopicPathFor(Type type);
string SubscriptionNameFor(string applicationName, Type handlerType);
string SubscriptionNameFor(string applicationName, string instanceName, Type handlerType);
string DeadLetterOfficePath();
}
} |
using System;
namespace CommandLineEditors.Editor
{
internal interface IConsoleKeyProcessor
{
/// <summary>
/// Gets or sets the text of the editor.
/// </summary>
string Text { get; set; }
/// <summary>
/// Possibly consumes the key-info. Returns false
/// if the key-info was consumed, otherwise true
/// is returned.
/// </summary>
/// <param name="keyInfo"></param>
/// <returns></returns>
bool ConsumeKeyInfo(ConsoleKeyInfo keyInfo);
/// <summary>
/// Closes the editor by removing its contents from the display and
/// leaving the cursor position where it was before the editor was
/// opened.
/// </summary>
void Close();
/// <summary>
/// Brings the display up-to-date with the editor's content. This is
/// useful when switching between editors.
/// </summary>
void RefreshDisplay();
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpringBoneMarker : MonoBehaviour
{
public bool CheckHasChildren()
{
return transform.childCount != 0;
}
public void MarkChildren()
{
if (CheckHasChildren())
{
for (int i = 0; i < transform.childCount; i++)
{
GameObject child = transform.GetChild(i).gameObject;
if (child.transform.childCount != 0)
{
if (child.GetComponent<SpringBoneMarker>() == null)
{
child.AddComponent<SpringBoneMarker>();
child.GetComponent<SpringBoneMarker>().MarkChildren();
}
}
}
}
}
public UnityChan.SpringBone AddSpringBone()
{
UnityChan.SpringBone springBone = gameObject.AddComponent<UnityChan.SpringBone>();
springBone.child = gameObject.transform.GetChild(0);
return springBone;
}
public void UnmarkSelf()
{
DestroyImmediate(this);
}
}
|
using UnityEngine;
[CreateAssetMenu(menuName = "States/Falling")]
public class FallingState : APlayerState {
public JumpState referenceState;
public override bool CanTransitionInto( Player player ) {
return player.rigidbody2d.velocity.y < 0;
}
public override void Execute(Player player) {
if (referenceState.airControl) {
player.rigidbody2d.velocity = new Vector2(
Input.GetAxis("Horizontal") * referenceState.airControlSpeed,
player.rigidbody2d.velocity.y);
}
}
}
|
using UnityEngine;
namespace Flight.Scripts
{
public class PlaneControl : MonoBehaviour
{
[SerializeField] private int _speedMultiplier = 40;
[SerializeField] private float _minSpeed = 20;
[SerializeField] private float _maxSpeed = 200;
[SerializeField] private Transform _camera = null;
[SerializeField] private float _cameraBias = 0.5f;
private float _speed;
private void Awake()
{
if (_camera == null) {
_camera = Camera.main.transform;
}
}
private void FixedUpdate()
{
Vector3 moveCam = transform.position - transform.forward * 12f + transform.up * 10.0f;
_camera.position = _camera.position * _cameraBias + moveCam * (1 - _cameraBias);
_camera.LookAt(transform.position);
transform.position += transform.forward * Time.deltaTime * _speed;
_speed -= transform.forward.y * Time.deltaTime * _speedMultiplier;
if (_speed < _minSpeed) {
_speed = _minSpeed;
} else if (_speed > _maxSpeed) {
_speed = _maxSpeed;
}
transform.Rotate(Input.GetAxis("Vertical"), 0.0f, -Input.GetAxis("Horizontal"));
}
}
} |
//-----------------------------------------------------------------------
// <copyright file="CGPointExtensions.iOS.cs" company="Sphere 10 Software">
//
// Copyright (c) Sphere 10 Software. All rights reserved. (http://www.sphere10.com)
//
// Distributed under the MIT software license, see the accompanying file
// LICENSE or visit http://www.opensource.org/licenses/mit-license.php.
//
// <author>Herman Schoenfeld</author>
// <date>2018</date>
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Drawing;
using CoreGraphics;
namespace Sphere10.Framework {
public static class CGPointExtensions {
public static Point ToPoint(this CGPoint point) {
return new Point((int)point.X, (int)point.Y);
}
public static PointF ToPointF(this CGPoint point) {
return new PointF((float)point.X, (float)point.Y);
}
public static float DistanceTo(this CGPoint source, CGPoint dest) {
return (float)Math.Sqrt(Math.Pow(dest.X - source.X, 2.0) + Math.Pow(dest.Y - source.Y, 2.0));
}
public static CGPoint Subtract(this CGPoint orgPoint, CGPoint point) {
var x = orgPoint.X - point.X;
var y = orgPoint.Y - point.Y;
return new CGPoint(x, y);
}
public static CGPoint Add(this CGPoint orgPoint, CGPoint point) {
var x = orgPoint.X + point.X;
var y = orgPoint.Y + point.Y;
return new CGPoint(x, y);
}
public static CGPoint Add(this CGPoint orgPoint, CGSize size) {
var x = orgPoint.X + size.Width;
var y = orgPoint.Y + size.Height;
return new CGPoint(x, y);
}
}
}
|
using System;
namespace CmpAzureServiceWebRole.Models
{
public partial class ServiceProviderSlot
{
public int Id { get; set; }
public Nullable<int> ServiceProviderAccountId { get; set; }
public string TypeCode { get; set; }
public string ServiceProviderSlotName { get; set; }
public string Description { get; set; }
public string TagData { get; set; }
public Nullable<int> TagInt { get; set; }
public Nullable<bool> Active { get; set; }
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Subjects;
using GadzhiCommon.Helpers.Dialogs;
using GadzhiResurrected.Modules.GadzhiConvertingModule.Models.Implementations.FileConverting.ReactiveSubjects;
using GadzhiResurrected.Modules.GadzhiConvertingModule.Models.Interfaces.FileConverting;
namespace GadzhiResurrected.Infrastructure.Implementations.ApplicationGadzhi
{
/// <summary>
/// Слой приложения, инфраструктура. Файлы данных
/// </summary>
public partial class ApplicationGadzhi
{
/// <summary>
/// Подписка на изменение коллекции
/// </summary>
public ISubject<FilesChange> FileDataChange =>
_packageData.FileDataChange;
/// <summary>
/// Добавить файлы для конвертации
/// </summary>
public void AddFromFiles()
{
if (_statusProcessingInformation.IsConverting) return;
var filePaths = _dialogService.OpenFileDialog(true, DialogFilters.DocAndDgn);
AddFromFilesOrDirectories(filePaths);
}
/// <summary>
/// Указать папку для конвертации
/// </summary>
public void AddFromFolders()
{
if (_statusProcessingInformation.IsConverting) return;
var directoryPaths = _dialogService.OpenFolderDialog(true);
AddFromFilesOrDirectories(directoryPaths);
}
/// <summary>
/// Добавить файлы или папки для конвертации
/// </summary>
public void AddFromFilesOrDirectories(IEnumerable<string> fileOrDirectoriesPaths)
{
if (_statusProcessingInformation.IsConverting) return;
var allFilePaths = _filePathOperations.GetFilesFromPaths(fileOrDirectoriesPaths).ToList();
_packageData.AddFiles(allFilePaths, _projectSettings.ConvertingSettings.ColorPrintType);
}
/// <summary>
/// Очистить список файлов
/// </summary>
public void ClearFiles()
{
if (_statusProcessingInformation.IsConverting) return;
_packageData.ClearFiles();
}
/// <summary>
/// Удалить файлы
/// </summary>
public void RemoveFiles(IEnumerable<IFileData> filesToRemove)
{
if (_statusProcessingInformation.IsConverting) return;
_packageData.RemoveFiles(filesToRemove);
}
}
} |
using ISTC.CRM.BLL.Models;
using System.Collections.Generic;
namespace ISTC.CRM.BLL.Interfaces
{
public interface IUserService
{
IEnumerable<UserBL> GetAll();
UserBL GetUserById(int userId);
void AddUser(UserBL user);
void EditUser(UserBL user);
void DeleteUserById(int userId);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DotGraphsInDotNet
{
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using Shields.GraphViz.Components;
using Shields.GraphViz.Models;
using Shields.GraphViz.Services;
class Program
{
static void Main()
{
MainAsync(null).Wait();
}
public static async Task MainAsync(string[] args)
{
var node = NodeStatement.For("k");
node = node.Set(new Id("shape"), "box")
.Set(new Id("style"),"filled")
.Set(new Id("color"), ".7 .3 1.0");
Graph graph = Graph.Directed
.Add(EdgeStatement.For("a", "b"))
.Add(EdgeStatement.For("a", "c"))
.Add(node)
.Add(new NodeStatement("b", node.Attributes))
.Add(EdgeStatement.For("c", "k"));
var graphVizBin = @"C:\Program Files (x86)\Graphviz2.38\bin";
IRenderer renderer = new Renderer(graphVizBin);
using (Stream file = File.Create("graph.svg"))
{
await renderer.RunAsync(
graph, file,
RendererLayouts.Dot,
RendererFormats.Svg,
CancellationToken.None);
}
}
}
}
|
namespace Fluxera.Extensions.OData
{
using System;
using System.Linq.Expressions;
using System.Reflection;
using Fluxera.Guards;
internal static class ExpressionExtensions
{
public static Expression<Func<T, object>> ConvertSelector<T, TResult>(
this Expression<Func<T, TResult>> selector)
where T : class
{
Expression expression = selector.GetMemberInfo();
ParameterExpression param = Expression.Parameter(typeof(T), "x");
Expression body = null;
if(expression is MemberExpression memberExpression)
{
MemberExpression field = Expression.PropertyOrField(param, memberExpression.Member.Name);
body = field;
if(field.Type.GetTypeInfo().IsValueType)
{
body = Expression.Convert(field, typeof(object));
}
}
else if(expression is NewExpression newExpression)
{
body = newExpression;
}
Guard.Against.Null(body, nameof(body));
Expression<Func<T, object>> orderExpression = Expression.Lambda<Func<T, object>>(body, param);
return (Expression<Func<T, object>>)orderExpression.Unquote();
}
private static Expression GetMemberInfo(this Expression method)
{
LambdaExpression lambda = method as LambdaExpression;
Guard.Against.Null(lambda, nameof(lambda));
Expression expression = null;
if(lambda.Body.NodeType == ExpressionType.Convert)
{
expression = ((UnaryExpression)lambda.Body).Operand as MemberExpression;
}
else if(lambda.Body.NodeType == ExpressionType.MemberAccess)
{
expression = lambda.Body as MemberExpression;
}
else if(lambda.Body.NodeType == ExpressionType.New)
{
expression = lambda.Body as NewExpression;
}
Guard.Against.Null(expression, nameof(expression));
return expression;
}
private static Expression Unquote(this Expression quote)
{
if(quote.NodeType == ExpressionType.Quote)
{
return ((UnaryExpression)quote).Operand.Unquote();
}
return quote;
}
}
}
|
namespace Dropcraft.Common.Package
{
/// <summary>
/// Describes deployment event handler
/// </summary>
public class DeploymentEventsHandlerInfo
{
/// <summary>
/// Package where the handler is defined
/// </summary>
public PackageId PackageId { get; }
/// <summary>
/// Fully qualified type name
/// </summary>
public string ClassName { get; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="packageId">Origin</param>
/// <param name="className">Handle class name</param>
public DeploymentEventsHandlerInfo(PackageId packageId, string className)
{
PackageId = packageId;
ClassName = className;
}
/// <summary>
/// Converts object to string
/// </summary>
/// <returns>String</returns>
public override string ToString()
{
return $"{PackageId?.ToString() ?? ""}, {ClassName}";
}
}
} |
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using KeyPayV2.Sg.Models.Common;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using KeyPayV2.Sg.Enums;
namespace KeyPayV2.Sg.Models.TimeAndAttendance
{
public class AuClockOnModel
{
public int? LocationId { get; set; }
public int? ClassificationId { get; set; }
public int? WorkTypeId { get; set; }
public IList<Int32> ShiftConditionIds { get; set; }
public string Note { get; set; }
public int? EmployeeId { get; set; }
public decimal? Latitude { get; set; }
public decimal? Longitude { get; set; }
public int? KioskId { get; set; }
public string IpAddress { get; set; }
public Byte[] Image { get; set; }
public bool IsAdminInitiated { get; set; }
public DateTime? RecordedTimeUtc { get; set; }
public TimeSpan? UtcOffset { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public TimeAttendanceShiftNoteVisibility? NoteVisibility { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using UnityEngine.TestTools.Constraints;
using NUnit.Framework;
using Is = UnityEngine.TestTools.Constraints.Is;
using Enumerable = System.Linq.Enumerable;
namespace AllocationTests.System
{
public sealed partial class TestAllocationIReadOnlyList
{
public abstract class TestBase<T>
{
IReadOnlyList<T> _target;
protected abstract T TargetValue { get; }
protected abstract IReadOnlyList<T> CreateList();
[SetUp]
public void SetUp()
{
// Call to avoid the first call allocation not in the instance but in the class
Enumerable.Contains(CreateList(), TargetValue);
foreach (T item in CreateList()) { }
_target = CreateList();
}
[Test]
public void Check_Precondition()
{
Assert.AreEqual(TargetValue, CreateList()[2]);
}
[Test]
public void Verify_for_WithIndex_1st()
{
Assert.That(() =>
{
for (int i = 0; i < _target.Count; ++i) { T item = _target[i]; }
}, Is.Not.AllocatingGCMemory());
}
[Test]
public void Verify_for_WithIndex_2nd()
{
for (int i = 0; i < _target.Count; ++i) { T item = _target[i]; }
Assert.That(() =>
{
for (int i = 0; i < _target.Count; ++i) { T item = _target[i]; }
}, Is.Not.AllocatingGCMemory());
}
[Test]
public void Verify_foreach_1st()
{
Assert.That(() =>
{
foreach (T item in _target) { }
}, Is.Not.AllocatingGCMemory());
}
[Test]
public void Verify_foreach_2nd()
{
foreach (T item in _target) { }
Assert.That(() =>
{
foreach (T item in _target) { }
}, Is.Not.AllocatingGCMemory());
}
[Test]
public void Verify_Contains_FromLinq_1st()
{
T value = TargetValue;
Assert.That(() =>
{
Enumerable.Contains(_target, value);
}, Is.Not.AllocatingGCMemory());
}
[Test]
public void Verify_Contains_FromLinq_2nd()
{
T value = TargetValue;
Enumerable.Contains(_target, value);
Assert.That(() =>
{
Enumerable.Contains(_target, value);
}, Is.Not.AllocatingGCMemory());
}
}
}
}
|
using Newtonsoft.Json;
using RestSharp;
using System.Linq;
namespace PodcastAPI
{
public sealed class ApiResponse
{
public readonly IRestResponse response;
private readonly string jsonString;
public ApiResponse(string jsonString, IRestResponse response)
{
this.response = response;
this.jsonString = jsonString;
}
public T ToJSON<T>()
{
return JsonConvert.DeserializeObject<T>(jsonString);
}
public override string ToString()
{
return jsonString;
}
public int GetFreeQuota()
{
var name = "x-listenapi-freequota";
var headerField = response.Headers.FirstOrDefault(h => h.Name.Equals(name)).Value?.ToString();
if (headerField != null && int.TryParse(headerField, out int result))
{
return result;
}
throw new System.Exception($"Cannot get header {name}");
}
public int GetUsage()
{
var name = "x-listenapi-usage";
var headerField = response.Headers.FirstOrDefault(h => h.Name.Equals(name)).Value?.ToString();
if (headerField != null && int.TryParse(headerField, out int result))
{
return result;
}
throw new System.Exception($"Cannot get header {name}");
}
public string GetNextBillingDate()
{
var name = "x-listenapi-nextbillingdate";
var headerField = response.Headers.FirstOrDefault(h => h.Name.Equals(name));
return headerField?.Value?.ToString();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _01.DogHouse
{
class Program
{
static void Main(string[] args)
{
double side = double.Parse(Console.ReadLine());
double height = double.Parse(Console.ReadLine());
double totalAreaSides = (side * side) + 2 * (side / 2) * (side / 2) +
(side / 2) * (height - side / 2) - (side / 5) * (side / 5);
double totalAreRoofs = side * side;
double greenPaint = totalAreaSides / 3;
double redPaint = totalAreRoofs / 5;
Console.WriteLine($"{greenPaint:f2}");
Console.WriteLine($"{redPaint:f2}");
}
}
}
|
namespace StudentInfoSystem.Models
{
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
public class User
{
[Key]
public int Id { get; set; }
[Index(IsUnique = true)]
[Required]
[MinLength(5)]
[MaxLength(20)]
public string Username { get; set; }
[Required]
[MinLength(6)]
[MaxLength(20)]
public string Password { get; set; }
[MinLength(7)]
[MaxLength(20)]
public string FacultyNumber { get; set; }
public Role Role { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Threading;
using Abc.Zebus.Serialization;
namespace Abc.Zebus.Dispatch
{
public class MessageDispatch
{
private static readonly object _exceptionsLock = new object();
private readonly IMessageSerializer _messageSerializer;
private readonly Action<MessageDispatch, DispatchResult> _continuation;
private Dictionary<Type, Exception>? _exceptions;
private int _remainingHandlerCount;
private bool _isCloned;
public MessageDispatch(MessageContext context, IMessage message, IMessageSerializer messageSerializer, Action<MessageDispatch, DispatchResult> continuation, bool shouldRunSynchronously = false)
{
_messageSerializer = messageSerializer;
_continuation = continuation;
ShouldRunSynchronously = shouldRunSynchronously;
Context = context;
Message = message;
}
public bool IsLocal { get; set; }
public bool ShouldRunSynchronously { get; }
public MessageContext Context { get; }
public IMessage Message { get; private set; }
public void SetIgnored()
{
_continuation(this, new DispatchResult(null));
}
public void SetHandled(IMessageHandlerInvoker invoker, Exception? error)
{
if (error != null)
AddException(invoker.MessageHandlerType, error);
if (Interlocked.Decrement(ref _remainingHandlerCount) == 0)
_continuation(this, new DispatchResult(_exceptions));
}
private void AddException(Type messageHandlerType, Exception error)
{
lock (_exceptionsLock)
{
if (_exceptions == null)
_exceptions = new Dictionary<Type, Exception>();
_exceptions[messageHandlerType] = error;
}
}
public void SetHandlerCount(int handlerCount)
{
_remainingHandlerCount = handlerCount;
}
internal void BeforeEnqueue()
{
if (!IsLocal || _isCloned)
return;
if (_messageSerializer.TryClone(Message, out var clone))
Message = clone;
_isCloned = true;
}
}
}
|
using System;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
#if NET40 || NET45
namespace Microsoft.VisualStudio.TestTools.UnitTesting
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class TestClassAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TestInitializeAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class TestMethodAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class ExpectedException : Attribute
{
Type exceptionType;
public ExpectedException(Type exceptionType)
{
this.exceptionType = exceptionType;
}
public bool Accept(Exception ex) => ex.GetType() == this.exceptionType;
}
public class Assert
{
public static Asserter Default;
public static void AreEqual<T>(T expected, T value)
{
Default.AreEqual(expected, value);
}
public static void IsInstanceOfType(object value, Type expectedType, string message = null)
{
Default.IsInstanceOfType(value, expectedType, message);
}
public static void Inconclusive(string message, params object[] parameters)
{
Default.Inconclusive(message, parameters);
}
public static void IsTrue(bool what)
{
Default.IsTrue(what);
}
}
public abstract class Asserter
{
public string CurrentClass { get; set; }
public string CurrentMethod { get; set; }
public TestState State { get; set; }
public abstract void AreEqual<T>(T expected, T value);
public abstract void IsInstanceOfType(object value, Type expectedType, string message);
public abstract void Inconclusive(string message, object[] parameters);
public abstract void IsTrue(bool what);
}
public enum TestState
{
Ok = 0,
Inconclusive = 1,
Error = 3,
}
}
namespace System.Reflection
{
public static class ReflectionExtensions
{
public static IEnumerable<T> GetCustomAttributes<T>(this MethodInfo mi)
{
return mi.GetCustomAttributes(typeof(T), true).OfType<T>();
}
public static IEnumerable<T> GetCustomAttributes<T>(this Type t)
{
return t.GetTypeInfo().GetCustomAttributes(typeof(T), true).OfType<T>();
}
}
}
#endif |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShortestPathReplyCodeChallenge2019
{
class Program
{
static void Main(string[] args)
{
//RunProgram("test");
//RunProgram("1_victoria_lake");
//RunProgram("2_himalayas");
//RunProgram("3_budapest");
RunProgram("4_manhattan");
//RunProgram("5_oceania");
Console.WriteLine("Completed! Press any key");
Console.ReadLine();
}
static public void Test(String fileName)
{
Parser parser = new Parser();
Map map = parser.GetParsedMap(fileName + ".txt");
RouteFinder finder = new RouteFinder();
var coos = finder.FindCoordinates(map);
foreach (var coo in coos)
{
Console.WriteLine("{0} {1}",coo.X,coo.Y);
}
/*
var rr = finder.FindCustomerRoutes(map);
var jr = finder.GetJoinRoutes(rr);
foreach (var j in jr)
{
Console.WriteLine(j.Count);
}
/*
var tree = finder.GetOptimalTree(rr);
var split_tree = finder.SplitTree(tree, 3);
foreach (var r in rr)
{
foreach (var p in r.Paths)
{
Console.WriteLine("{0} {1} {2} {3}", r.Office.X, r.Office.Y, p.GetDirection(),p.Cost);
}
}
foreach (var t in tree)
{
Console.WriteLine("A:{0} {1} B:{2} {3} Cost:{4}", t.A.X, t.A.Y, t.B.X, t.B.Y, t.Cost);
}
Console.WriteLine("************");
foreach (var st in split_tree)
{
Console.WriteLine("-------------");
foreach (var t in st)
{
Console.WriteLine("A:{0} {1} B:{2} {3} Cost:{4}", t.A.X, t.A.Y, t.B.X, t.B.Y, t.Cost);
}
}*/
}
//Optimal tree plus group of branches
static public void RunProgram(String fileName)
{
Parser parser = new Parser();
Map map = parser.GetParsedMap(fileName + ".txt");
RouteFinder finder = new RouteFinder();
var routes = finder.GetOptimalRoutes(map);
int total = 0;
foreach (var route in routes)
{
total += route.Reward;
}
Console.WriteLine(total);
Output.OutputFile(routes, fileName + "_answer.txt");
}
//2nd score. Locate near rewardest and try reach others
static public void RunProgram1(String fileName)
{
Parser parser = new Parser();
Map map = parser.GetParsedMap(fileName + ".txt");
RouteFinder finder = new RouteFinder();
var r = finder.FindRoutesAprox(map);
Output.OutputFile(r, fileName + "_answer.txt");
}
}
}
|
using System;
using Microsoft.Extensions.Configuration;
namespace HansKindberg.IdentityServer.Data.Transferring.Extensions
{
public static class DataImporterExtension
{
#region Methods
public static IDataImportResult Import(this IDataImporter dataImporter, IConfiguration configuration)
{
if(dataImporter == null)
throw new ArgumentNullException(nameof(dataImporter));
return dataImporter.ImportAsync(configuration, new ImportOptions()).Result;
}
#endregion
}
} |
using Akka.Actor;
using EasyExecute.Messages;
using System;
namespace EasyExecuteLib
{
public class EasyExecuteOptions
{
public TimeSpan? maxExecutionTimePerAskCall { set; get; }
public string serverActorSystemName { set; get; }
public ActorSystem actorSystem { set; get; }
public string actorSystemConfig { set; get; }
public TimeSpan? purgeInterval { set; get; }
public Action<Worker> onWorkerPurged { set; get; }
}
} |
using EasyWMI;
using System;
namespace EasyWMIDemo
{
class Program
{
static void Main(string[] args)
{
// Request WMI data from a remote machine.
WMIProcessor wmi = new WMIProcessor();
wmi.Request = WMI_ALIAS.CPU;
wmi.Filter = "name,threadcount,architecture";
wmi.RemoteExecute = true;
wmi.NodeName = "10.1.2.8";
Console.WriteLine(wmi.ExecuteRequest());
Console.WriteLine();
// Change RemoteExecute to false. Executes query on local machine.
wmi.RemoteExecute = false;
Console.WriteLine(wmi.ExecuteRequest());
Console.WriteLine();
// WMIData object with default request + Extra Request.
WMIData wmiData = new WMIData(true);
wmiData.GetData(WMI_ALIAS.NETWORK_INTERFACE_CARD_CONFIG, "ipaddress");
foreach ( var currentAlias in wmiData.Properties )
{
Console.WriteLine(currentAlias.Key.Value);
foreach( var currentProperty in wmiData.Properties[currentAlias.Key] )
{
Console.WriteLine("{0} : {1}", currentProperty.Key, currentProperty.Value);
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
|
using Newtonsoft.Json;
using PoeHUD.Hud.Settings;
namespace PoeHUD.Hud.Loot
{
public sealed class ItemAlertSettings : SettingsBase
{
public ItemAlertSettings()
{
Enable = true;
ShowItemOnMap = true;
Crafting = false;
ShowText = true;
HideOthers = true;
PlaySound = true;
SoundVolume = new RangeNode<int>(40, 0, 100);
TextSize = new RangeNode<int>(16, 10, 50);
Rares = true;
Uniques = true;
Maps = true;
Currency = true;
DivinationCards = true;
Jewels = true;
Talisman = true;
Rgb = true;
MinLinks = new RangeNode<int>(5, 0, 6);
MinSockets = new RangeNode<int>(6, 0, 6);
LootIcon = new RangeNode<int>(7, 1, 14);
DimOtherByPercent = new RangeNode<int>(100, 1, 100);
DimOtherByPercentToggle = true;
LootIconBorderColor = false;
QualityItems = new QualityItemsSettings();
BorderSettings = new BorderSettings();
WithBorder = true;
WithSound = false;
ShouldUseFilterFile = true;
FilePath = "config/NeverSink-SEMI-STRICT.filter";
}
public ToggleNode ShowItemOnMap { get; set; }
public ToggleNode Crafting { get; set; }
public ToggleNode ShowText { get; set; }
public RangeNode<int> DimOtherByPercent { get; set; }
public ToggleNode DimOtherByPercentToggle { get; set; }
public ToggleNode HideOthers { get; set; }
public ToggleNode PlaySound { get; set; }
public RangeNode<int> SoundVolume { get; set; }
public RangeNode<int> TextSize { get; set; }
public ToggleNode Rares { get; set; }
public ToggleNode Uniques { get; set; }
public ToggleNode Maps { get; set; }
public ToggleNode Currency { get; set; }
public ToggleNode DivinationCards { get; set; }
public ToggleNode Jewels { get; set; }
public ToggleNode Talisman { get; set; }
[JsonProperty("RGB")]
public ToggleNode Rgb { get; set; }
public RangeNode<int> MinLinks { get; set; }
public RangeNode<int> MinSockets { get; set; }
public RangeNode<int> LootIcon { get; set; }
public ToggleNode LootIconBorderColor { get; set; }
[PoeHUD.Plugins.IgnoreMenu]
[JsonProperty("Show quality items")]
public QualityItemsSettings QualityItems { get; set; }
[PoeHUD.Plugins.IgnoreMenu]
public BorderSettings BorderSettings { get; set; }
public ToggleNode WithBorder { get; set; }
public ToggleNode WithSound { get; set; }
public ToggleNode ShouldUseFilterFile { get; set; }
public FileNode FilePath { get; set; }
}
} |
using System.Collections.Generic;
namespace RavenNest.BusinessLogic.Docs.Models
{
public class DocumentApiMethodRequest
{
public DocumentApiMethodRequest(string contentType, string example)
{
this.ContentType = contentType;
Example = example;
}
public string ContentType { get; }
public string Example { get; }
}
} |
namespace Daishi.Tutorials.RobotFactory {
public abstract class RobotBuilder {
protected Robot robot;
public Robot Robot { get { return robot; } }
public abstract void BuildHead();
public abstract void BuildTorso();
public abstract void BuildArms();
public abstract void BuildLegs();
}
} |
namespace Jugnoon.Videos
{
public class VideoInfo
{
public string ProcessID { get; set; } = "";
public long ProcessedSize { get; set; } = 0;
public int ProcessedTime { get; set; } = 0;
public long TotalSize { get; set; } = 0;
public double ProcessingLeft { get; set; } = 100;
public double ProcessingCompleted { get; set; } = 0;
public string FileName { get; set; } = "";
public string Duration { get; set; } = "";
public int Duration_Sec { get; set; } = 0;
public int Hours { get; set; } = 0;
public int Minutes { get; set; } = 0;
public int Seconds { get; set; } = 0;
public string Start { get; set; } = "";
public int ErrorCode { get; set; } = 0;
public string ErrorMessage { get; set; } = "";
public string FFMPEGOutput { get; set; } = "";
// Output Properties
public string Acodec { get; set; } = "";
public string Vcodec { get; set; } = "";
public string SamplingRate { get; set; } = "";
public string Channel { get; set; } = "";
public string Audio_Bitrate { get; set; } = "";
public string Video_Bitrate { get; set; } = "";
public int Width { get; set; } = 0;
public int Height { get; set; } = 0;
public string FrameRate { get; set; } = "";
public string Type { get; set; } = "";
// Input Properties
public string Input_Acodec { get; set; } = "";
public string Input_Vcodec { get; set; } = "";
public string Input_SamplingRate { get; set; } = "";
public string Input_Channel { get; set; } = "";
public string Input_Audio_Bitrate { get; set; } = "";
public string Input_Video_Bitrate { get; set; } = "";
public int Input_Width { get; set; } = 0;
public int Input_Height { get; set; } = 0;
public string Input_FrameRate { get; set; } = "";
public string Input_Type { get; set; } = "";
public string Music { get; set; } = "";
public string Footage { get; set; } = "";
public string Producer { get; set; } = "";
public string Title { get; set; } = "";
}
}
/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
* Copyright 2007 - 2020 MediaSoftPro
* For more information email at support@mediasoftpro.com
*/
|
// ---------------------------------------------------------------------------------------------
#region // Copyright (c) 2005-2015, SIL International.
// <copyright from='2005' to='2015' company='SIL International'>
// Copyright (c) 2005-2015, SIL International.
//
// This software is distributed under the MIT License, as specified in the LICENSE.txt file.
// </copyright>
#endregion
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SIL.Pa.Model;
namespace SIL.Pa.PhoneticSearching
{
/// ----------------------------------------------------------------------------------------
public class PhoneticSearcher
{
public const string kBracketingError = "BRACKETING-ERROR";
private readonly PaProject _project;
private readonly SearchQuery _query;
private PatternParser _parser;
public WordListCache ResultCache { get; private set; }
public List<string> Errors { get; private set; }
public Action ReportProgressAction { get; set; }
/// ------------------------------------------------------------------------------------
public PhoneticSearcher(PaProject project, SearchQuery query)
{
_project = project;
_query = query;
Errors = new List<string>();
}
#region Methods for parsing search query pattern
/// ------------------------------------------------------------------------------------
public bool Parse()
{
if (!DoesPatternPassBasicChecks())
return false;
_parser = new PatternParser(_project, _query);
if (_parser.Parse())
return true;
Errors.AddRange(_parser.Errors);
return false;
}
#endregion
#region Methods for searching word list cache
/// ------------------------------------------------------------------------------------
public bool Search(bool returnCountOnly, out int resultCount)
{
ResultCache = (returnCountOnly ? null : new WordListCache());
resultCount = 0;
foreach (var wentry in _project.WordCache)
{
if (ReportProgressAction != null)
ReportProgressAction();
// Get a list of word(s) for this entry. If the query's IncludeAllUncertainPossibilities
// flag is set, there will be multiple words, one for each uncertain possibility.
// Otherwise there will be only one. Each word is delivered in the form of an array of
// phones.
var wordsList = (_query.IncludeAllUncertainPossibilities && wentry.ContiansUncertainties ?
wentry.GetAllPossibleUncertainWords(false) : new[] { wentry.Phones });
foreach (var phonesInWord in wordsList)
{
resultCount = SearchWord(phonesInWord, returnCountOnly,
(phoneIndexOfMatch, numberOfPhonesInMatch) =>
ResultCache.Add(wentry, phonesInWord, phoneIndexOfMatch, numberOfPhonesInMatch, true));
}
}
return true;
}
// ------------------------------------------------------------------------------------
public int SearchWord(string[] phonesInWord, bool returnCountOnly,
Action<int, int> addCacheEntryAction)
{
int matchCount = 0;
int startIndex = 0;
while (true)
{
int matchIndex;
int numberOfPhonesInMatch;
if (!_parser.SearchItemPatternMember.GetSearchItemMatch(phonesInWord, startIndex,
out matchIndex, out numberOfPhonesInMatch))
{
return matchCount;
}
startIndex = matchIndex + 1;
if (_parser.PrecedingPatternMember.GetEnvironmentMatch(phonesInWord.Take(matchIndex)) &&
_parser.FollowingPatternMember.GetEnvironmentMatch(phonesInWord.Skip(matchIndex + numberOfPhonesInMatch)))
{
matchCount++;
if (!returnCountOnly)
addCacheEntryAction(matchIndex, numberOfPhonesInMatch);
}
}
}
#endregion
#region Methods for verifying validity of search query pattern and building error string
/// ------------------------------------------------------------------------------------
public bool DoesPatternPassBasicChecks()
{
var checksPassed = true;
if (_query.SearchItem.Count(c => "#*+".Contains(c)) > 0)
{
Errors.Add(App.GetString("PhoneticSearchingMessages.InvalidCharactersInSearchItem",
"The search item portion of the search pattern contain an illegal symbol. " +
"The symbols '#', '+' and '*' are not valid in the search item."));
}
if (_query.PrecedingEnvironment.Count(c => "#*+".Contains(c)) > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.InvalidCharactersInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains an illegal combination of characters. " +
"The symbols '#', '+' or '*' are not allowed together in the preceding environment."));
}
if (_query.FollowingEnvironment.Count(c => "#*+".Contains(c)) > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.InvalidCharactersInFollowingEnvironment",
"The following environment portion of the search pattern contains an illegal combination of characters. " +
"The symbols '#', '+' or '*' are not allowed together in the following environment."));
}
int count = _query.PrecedingEnvironment.Count(c => c == '#');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyWordBoundarySymbolsInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains too many word boundary symbols. " +
"Only one is allowed and it must be at the beginning."));
}
if (count == 1 && !_query.PrecedingEnvironment.StartsWith("#"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedWordBoundarySymbolInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains a misplaced word boundary symbol. " +
"It must be at the beginning."));
}
count = _query.FollowingEnvironment.Count(c => c == '#');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyWordBoundarySymbolsInFollowingEnvironment",
"The following environment portion of the search pattern contains too many word boundary symbols. " +
"Only one is allowed and it must be at the end."));
}
if (count == 1 && !_query.FollowingEnvironment.EndsWith("#"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedWordBoundarySymbolInFollowingEnvironment",
"The following environment portion of the search pattern contains a misplaced word boundary symbol. " +
"It must be at the end."));
}
count = _query.PrecedingEnvironment.Count(c => c == '*');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyZeroOrMoreSymbolsInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains too many 'zero or more' symbols. " +
"Only one is allowed and it must be at the beginning."));
}
if (count == 1 && !_query.PrecedingEnvironment.StartsWith("*"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedZeroOrMoreSymbolInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains a misplaced 'zero or more' symbol. " +
"It must be at the beginning."));
}
count = _query.FollowingEnvironment.Count(c => c == '*');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyZeroOrMoreSymbolsInFollowingEnvironment",
"The following environment portion of the search pattern contains too many 'zero or more' symbols. " +
"Only one is allowed and it must be at the end."));
}
if (count == 1 && !_query.FollowingEnvironment.EndsWith("*"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedZeroOrMoreSymbolInFollowingEnvironment",
"The following environment portion of the search pattern contains a misplaced 'zero or more' symbol. " +
"It must be at the end."));
}
count = _query.PrecedingEnvironment.Count(c => c == '+');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyOneOrMoreSymbolsInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains too many 'one or more' symbols. " +
"Only one is allowed and it must be at the beginning."));
}
if (count == 1 && !_query.PrecedingEnvironment.StartsWith("+"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedOneOrMoreSymbolInPrecedingEnvironment",
"The preceding environment portion of the search pattern contains a misplaced 'one or more' symbol. " +
"It must be at the beginning."));
}
count = _query.FollowingEnvironment.Count(c => c == '+');
if (count > 1)
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.TooManyOneOrMoreSymbolsInFollowingEnvironment",
"The following environment portion of the search pattern contains too many 'one or more' symbols. " +
"Only one is allowed and it must be at the end."));
}
if (count == 1 && !_query.FollowingEnvironment.EndsWith("+"))
{
checksPassed = false;
Errors.Add(App.GetString("PhoneticSearchingMessages.MisplacedOneOrMoreSymbolInFollowingEnvironment",
"The following environment portion of the search pattern contains a misplaced 'one or more' symbol. " +
"It must be at the end."));
}
return checksPassed;
}
/// ------------------------------------------------------------------------------------
/// <summary>
/// Combines the list of error messages into a single message.
/// </summary>
/// ------------------------------------------------------------------------------------
public string GetCombinedErrorMessages(bool separateErrorsWithLineBreaks)
{
if (Errors.Count == 0)
return null;
var bracketingError = Errors.FirstOrDefault(msg => msg.StartsWith(kBracketingError));
if (bracketingError != null)
return bracketingError;
var errors = new StringBuilder();
foreach (var err in Errors)
{
errors.Append(err);
errors.Append(separateErrorsWithLineBreaks ? Environment.NewLine : " ");
}
var fmt = App.GetString("PhoneticSearchingMessages.GeneralErrorOverviewMsg",
"The following error(s) occurred using the search pattern:\n\n{0}");
return string.Format(fmt, errors.ToString().Trim());
}
#endregion
}
}
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Barebone.Routing.Fluent.Tests
{
using AppFunc = Func<IDictionary<string, object>, Task>;
using OwinEnv = IDictionary<string, object>;
public class Assert : Xunit.Assert {
public static void RoutesTo(OwinEnv owinEnv, AppFunc action, Routes routes){
var router = new Router();
router.AddRoutes(routes);
var result = router.Resolve(owinEnv);
Assert.True(result.Success);
Assert.True(action.Equals(result.Route.OwinAction));
}
public static void DoesNotRouteTo(OwinEnv owinEnv, AppFunc action, Routes routes){
var router = new Router();
router.AddRoutes(routes);
var result = router.Resolve(owinEnv);
Assert.False(result.Success);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AsyncInn.Models
{ //RoomAmenities is a pure Join Table.
public class RoomAmenities
{ // RoomID and AmenitiesID constitute a Composite Key for RoomAmenities.
public int RoomID { get; set; }
public int AmenitiesID { get; set; }
// Below are the Nav Properties for RoomAmenities. This model links to the Room and Amenities models.
public Room Room { get; set; }
public Amenities Amenities { get; set; }
}
}
|
#region License
// Copyright (c) Amos Voron. All rights reserved.
// Licensed under the Apache 2.0 License. See LICENSE in the project root for license information.
#endregion
using System;
using System.Linq;
using System.Text;
namespace QueryTalk.Wall
{
/// <summary>
/// This class is not intended for public use.
/// </summary>
public sealed class FromManyChainer : EndChainer, IBegin
{
internal override string Method
{
get
{
return Text.Method.FromMany;
}
}
internal FromManyChainer(Chainer prev,
TableArgument firstTable,
TableArgument secondTable,
TableArgument[] otherTables)
: base(prev)
{
CheckNullAndThrow(Arg(() => firstTable, firstTable));
CheckNullAndThrow(Arg(() => secondTable, secondTable));
CheckNullAndThrow(Arg(() => otherTables, otherTables));
if (otherTables.Where(table => table == null).Any())
{
Throw(QueryTalkExceptionType.ArgumentNull, "table = null");
}
Build = (buildContext, buildArgs) =>
{
StringBuilder sql = Text.GenerateSql(200);
ProcessTable(buildContext, buildArgs, firstTable, sql);
ProcessTable(buildContext, buildArgs, secondTable, sql);
Array.ForEach(otherTables, table =>
{
ProcessTable(buildContext, buildArgs, table, sql);
});
TryThrow(buildContext);
return sql.ToString();
};
}
private void ProcessTable(
BuildContext buildContext,
BuildArgs buildArgs,
TableArgument table,
StringBuilder sql)
{
sql.AppendLine()
.Append(Text.Select).S()
.Append(Text.Asterisk).S()
.Append(Text.From).S()
.Append(table.Build(buildContext, buildArgs))
.Terminate();
TryThrow(table.Exception);
}
}
}
|
using Bot.Builder.Community.Adapters.Infobip.Core;
using Bot.Builder.Community.Adapters.Infobip.Viber.Models;
using Microsoft.Bot.Schema;
namespace Bot.Builder.Community.Adapters.Infobip.Viber.ToActivity
{
public class InfobipViberToActivity: InfobipBaseConverter
{
public static Activity Convert(InfobipViberIncomingResult result)
{
var activity = ConvertToMessage(result);
activity.ChannelId = InfobipViberConstants.ChannelName;
activity.Text = result.Message.Text;
activity.TextFormat = TextFormatTypes.Plain;
return activity;
}
}
}
|
//---------------------------------------------------------------------
// <copyright file="ODataUntypedValue.cs" company="Microsoft">
// Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------
namespace Microsoft.OData
{
/// <summary>
/// OData representation of an untyped value.
/// </summary>
public sealed class ODataUntypedValue : ODataValue
{
/// <summary>Gets or sets the raw untyped value.</summary>
/// <returns>The raw untyped value.</returns>
/// <remarks>
/// The caller of the setter is responsible for formatting the value for the
/// data transmission protocol it will be used in.
/// For instance, if the protocol is JSON, the caller must format this value as JSON.
/// If the protocol is Atom, the caller must format this value as XML.
/// This library will not perform any formatting.
/// </remarks>
public string RawValue
{
get;
set;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Referencenumber_fi
{
public static class Check
{
public static string CheckNumbers(string input)
{
int length = input.Length;
char[] number = input.ToCharArray();
char[] multiplier = "7317317317317317317".ToCharArray();
List<string> multipliers = new List<string>();
List<string> numbers = new List<string>();
for (int i = 0; i < length; i++)
{
multipliers.Add(multiplier[i].ToString());
numbers.Add(number[i].ToString());
}
string[] reverse_numbers = numbers.ToArray();
string[] multiplierstr = multipliers.ToArray();
Array.Reverse(reverse_numbers);
int a = 0;
int sum = 0;
for (int i = 0; i < length; i++)
{
a = int.Parse(reverse_numbers[i]) * int.Parse(multiplierstr[i]);
sum += a;
}
int result = (10 - sum % 10);
if (result == 10)
{
result = 0;
}
return result.ToString();
}
}
}
|
using System;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace Accelerider.Windows.Infrastructure.Converters
{
public class StringToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var firstLetter = value.ToString().First().ToString();
var temp = new DrawingVisual();
var c = temp.RenderOpen();
var typeface = new Typeface(new FontFamily("Microsoft YaHei"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
c.DrawRectangle(Brushes.BlueViolet, null, new Rect(new Size(32, 32)));
c.DrawText(new FormattedText(firstLetter, culture, FlowDirection.LeftToRight, typeface, 16, Brushes.White), new Point(8, 5));
c.Close();
var image = new DrawingImage(temp.Drawing);
return image;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace Scalex.Utils
{
internal class ResourceRequestManager
{
private HttpClient _httpClient;
public ResourceRequestManager(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<byte[]> GetAttachmentWithCaching(string attachmentUrl, bool enableCache, string cacheKey)
{
var fileCache = new FileCache();
if (enableCache)
{
var cachedResult = await fileCache.LoadCachedFileBytes(cacheKey);
if (cachedResult != null)
{
return cachedResult;
}
}
var uri = new Uri(attachmentUrl);
var response = await _httpClient.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsByteArrayAsync();
if (enableCache)
{
new FileCache().StoreCachedFileBytes(cacheKey, content);
}
return content;
}
else
{
return null;
}
}
internal async Task<string> GetStringWithCaching(string url, bool enableCache, string cacheKey)
{
var fileCache = new FileCache();
if (enableCache)
{
var cachedResult = await fileCache.LoadCachedFileText(cacheKey);
if (cachedResult != null)
{
return cachedResult;
}
}
var uri = new Uri(url);
var response = await _httpClient.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
if (enableCache)
{
new FileCache().StoreCachedFileText(cacheKey, content);
}
return content;
}
else
{
return null;
}
}
}
} |
// CS0214: Pointers and fixed size buffers may only be used in an unsafe context
// Line: 11
// Compiler options: -unsafe
public class C
{
unsafe int* i;
public static void Main ()
{
var v = new C().i;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
public abstract class dfTouchInputSourceComponent : MonoBehaviour
{
public int Priority;
public abstract IDFTouchInputSource Source { get; }
}
|
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
namespace Blaster.WebApi.Security
{
public class IdTokenAccessor
{
private readonly IHttpContextAccessor _contextAccessor;
public IdTokenAccessor(IHttpContextAccessor contextAccessor)
{
_contextAccessor = contextAccessor;
}
public Task<string> IdToken => _contextAccessor.HttpContext != null
? _contextAccessor.HttpContext.GetTokenAsync("id_token")
: Task.FromResult<string>(null);
}
} |
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace WebHybridClient.Controllers
{
[Route("[controller]")]
public class StatusController : Controller
{
[Route("test")]
public IActionResult Test()
{
return View();
}
}
}
|
// Copyright (c) 2019-present Viktor Semenov
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace DevRating.VersionControl.Fake
{
public sealed class FakeFilePatch : FilePatch
{
private readonly Deletions _deletions;
private readonly Additions _additions;
public FakeFilePatch(Deletions deletions, Additions additions)
{
_deletions = deletions;
_additions = additions;
}
public Deletions Deletions()
{
return _deletions;
}
public Additions Additions()
{
return _additions;
}
}
} |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using XUnity.AutoTranslator.Plugin.Core.Constants;
using XUnity.AutoTranslator.Plugin.Core.Extensions;
using XUnity.Common.Constants;
using XUnity.Common.Harmony;
using XUnity.Common.Logging;
using XUnity.Common.MonoMod;
namespace XUnity.AutoTranslator.Plugin.Core.Hooks
{
internal static class ImageHooks
{
public static readonly Type[] All = new[] {
typeof( MaskableGraphic_OnEnable_Hook ),
typeof( Image_sprite_Hook ),
typeof( Image_overrideSprite_Hook ),
typeof( Image_material_Hook ),
typeof( RawImage_texture_Hook ),
typeof( Cursor_SetCursor_Hook ),
// fallback hooks on material (Prefix hooks)
typeof( Material_mainTexture_Hook ),
// Live2D
typeof( CubismRenderer_MainTexture_Hook ),
typeof( CubismRenderer_TryInitialize_Hook ),
// NGUI
typeof( UIAtlas_spriteMaterial_Hook ),
typeof( UISprite_OnInit_Hook ),
typeof( UISprite_material_Hook ),
typeof( UISprite_atlas_Hook ),
typeof( UI2DSprite_sprite2D_Hook ),
typeof( UI2DSprite_material_Hook ),
typeof( UITexture_mainTexture_Hook ),
typeof( UITexture_material_Hook ),
typeof( UIPanel_clipTexture_Hook ),
typeof( UIRect_OnInit_Hook ),
// Utage
typeof( DicingTextures_GetTexture_Hook ),
};
public static readonly Type[] Sprite = new[] {
typeof( Sprite_texture_Hook )
};
public static readonly Type[] SpriteRenderer = new[] {
typeof( SpriteRenderer_sprite_Hook ),
};
}
internal static class DicingTextures_GetTexture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.DicingTextures != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( ClrTypes.DicingTextures, "GetTexture", new[] { typeof( string ) } );
}
public static void Postfix( object __instance, ref Texture2D __result )
{
AutoTranslationPlugin.Current.Hook_ImageChanged( ref __result, false );
}
static Func<object, string, Texture2D> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Func<object, string, Texture2D>>();
}
static Texture2D MM_Detour( object __instance, string arg1 )
{
var result = _original( __instance, arg1 );
Postfix( __instance, ref result );
return result;
}
}
internal static class Sprite_texture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.Sprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.Sprite, "texture" )?.GetGetMethod();
}
static void Postfix( ref Texture2D __result )
{
AutoTranslationPlugin.Current.Hook_ImageChanged( ref __result, true );
}
static Func<object, Texture2D> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Func<object, Texture2D>>();
}
static Texture2D MM_Detour( object __instance )
{
var result = _original( __instance );
Postfix( ref result );
return result;
}
}
internal static class SpriteRenderer_sprite_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.SpriteRenderer != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.SpriteRenderer, "sprite" )?.GetSetMethod();
}
public static void Prefix( object __instance, ref Sprite value )
{
Texture2D texture;
var prev = CallOrigin.ImageHooksEnabled;
CallOrigin.ImageHooksEnabled = false;
try
{
texture = value.texture;
}
finally
{
CallOrigin.ImageHooksEnabled = prev;
}
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref value, ref texture, true, false );
}
//public static void Postfix( object __instance, ref Sprite value )
//{
// Texture2D _ = null;
// AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
//}
static Action<object, Sprite> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Sprite>>();
}
static void MM_Detour( object __instance, Sprite sprite )
{
//var prev = sprite;
Prefix( __instance, ref sprite );
_original( __instance, sprite );
//if( prev != sprite )
//{
// Postfix( __instance, ref sprite );
//}
}
}
internal static class CubismRenderer_MainTexture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.CubismRenderer != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.CubismRenderer, "MainTexture" )?.GetSetMethod();
}
public static void Prefix( object __instance, ref Texture2D value )
{
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref value, true, false );
}
static Action<object, Texture2D> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Texture2D>>();
}
static void MM_Detour( object __instance, ref Texture2D value )
{
Prefix( __instance, ref value );
_original( __instance, value );
}
}
internal static class CubismRenderer_TryInitialize_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.CubismRenderer != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( ClrTypes.CubismRenderer, "TryInitialize" );
}
public static void Prefix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, true, true );
}
static Action<object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object>>();
}
static void MM_Detour( object __instance )
{
Prefix( __instance );
_original( __instance );
}
}
internal static class Material_mainTexture_Hook
{
static bool Prepare( object instance )
{
return true;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( typeof( Material ), "mainTexture" )?.GetSetMethod();
}
public static void Prefix( object __instance, ref Texture value )
{
if( value is Texture2D texture2d )
{
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref texture2d, true, false );
value = texture2d;
}
}
static Action<object, Texture> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Texture>>();
}
static void MM_Detour( object __instance, ref Texture value )
{
Prefix( __instance, ref value );
_original( __instance, value );
}
}
internal static class MaskableGraphic_OnEnable_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.MaskableGraphic != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( ClrTypes.MaskableGraphic, "OnEnable" );
}
public static void Postfix( object __instance )
{
var type = __instance.GetType();
if( ( ClrTypes.Image != null && ClrTypes.Image.IsAssignableFrom( type ) )
|| ( ClrTypes.RawImage != null && ClrTypes.RawImage.IsAssignableFrom( type ) ) )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, true );
}
}
static Action<object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object>>();
}
static void MM_Detour( object __instance )
{
_original( __instance );
Postfix( __instance );
}
}
// FIXME: Cannot 'set' texture of sprite. MUST enable hook sprite
internal static class Image_sprite_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.Image != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.Image, "sprite" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, Sprite> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Sprite>>();
}
static void MM_Detour( object __instance, Sprite value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class Image_overrideSprite_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.Image != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.Image, "overrideSprite" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, Sprite> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Sprite>>();
}
static void MM_Detour( object __instance, Sprite value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class Image_material_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.Image != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.Image, "material" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, Material> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Material>>();
}
static void MM_Detour( object __instance, Material value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class RawImage_texture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.RawImage != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.RawImage, "texture" )?.GetSetMethod();
}
public static void Prefix( object __instance, ref Texture value )
{
if( value is Texture2D texture2d )
{
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref texture2d, true, false );
value = texture2d;
}
}
static Action<object, Texture> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Texture>>();
}
static void MM_Detour( object __instance, Texture value )
{
Prefix( __instance, ref value );
_original( __instance, value );
}
}
internal static class Cursor_SetCursor_Hook
{
static bool Prepare( object instance )
{
return true;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( typeof( Cursor ), "SetCursor", new[] { typeof( Texture2D ), typeof( Vector2 ), typeof( CursorMode ) } );
}
public static void Prefix( ref Texture2D texture )
{
AutoTranslationPlugin.Current.Hook_ImageChanged( ref texture, true );
}
static Action<Texture2D, Vector2, CursorMode> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<Texture2D, Vector2, CursorMode>>();
}
static void MM_Detour( Texture2D texture, Vector2 arg2, CursorMode arg3 )
{
Prefix( ref texture );
_original( texture, arg2, arg3 );
}
}
internal static class UIAtlas_spriteMaterial_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UIAtlas != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UIAtlas, "spriteMaterial" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, Material> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Material>>();
}
static void MM_Detour( object __instance, Material value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UISprite_OnInit_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UISprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( ClrTypes.UISprite, "OnInit" );
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, true );
}
static Action<object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object>>();
}
static void MM_Detour( object __instance )
{
_original( __instance );
Postfix( __instance );
}
}
internal static class UISprite_material_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UISprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UISprite, "material" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, Material> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, Material>>();
}
static void MM_Detour( object __instance, Material value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UISprite_atlas_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UISprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UISprite, "atlas" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
// Could be postfix, but SETTER will be called later
internal static class UITexture_mainTexture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UITexture != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UITexture, "mainTexture" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UITexture_material_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UITexture != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UITexture, "material" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UIRect_OnInit_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UIRect != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Method( ClrTypes.UIRect, "OnInit" );
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, true );
}
static Action<object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object>>();
}
static void MM_Detour( object __instance )
{
_original( __instance );
Postfix( __instance );
}
}
internal static class UI2DSprite_sprite2D_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UI2DSprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UI2DSprite, "sprite2D" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UI2DSprite_material_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UI2DSprite != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UI2DSprite, "material" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
internal static class UIPanel_clipTexture_Hook
{
static bool Prepare( object instance )
{
return ClrTypes.UIPanel != null;
}
static MethodBase TargetMethod( object instance )
{
return AccessToolsShim.Property( ClrTypes.UIPanel, "clipTexture" )?.GetSetMethod();
}
public static void Postfix( object __instance )
{
Texture2D _ = null;
AutoTranslationPlugin.Current.Hook_ImageChangedOnComponent( __instance, ref _, false, false );
}
static Action<object, object> _original;
static void MM_Init( object detour )
{
_original = detour.GenerateTrampolineEx<Action<object, object>>();
}
static void MM_Detour( object __instance, object value )
{
_original( __instance, value );
Postfix( __instance );
}
}
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.R.Debugger.Engine {
public static class DTEDebuggerExtensions {
/// <summary>
/// Forces debugger to refresh its variable views (Locals, Autos etc) by re-querying the debug engine.
/// </summary>
/// <param name="debugger"></param>
public static void RefreshVariableViews(this EnvDTE.Debugger debugger) {
// There's no proper way to do this, so just "change" a property that would invalidate the view.
debugger.HexDisplayMode = debugger.HexDisplayMode;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace TerritoryTools.Entities.AddressParsers
{
public class StreetTypeStreetNameFinder : Finder
{
private List<StreetType> streetTypes;
private List<AddressPartResult> possibilities
= new List<AddressPartResult>();
public StreetTypeStreetNameFinder(
AddressParseContainer container,
IEnumerable<StreetType> streetTypes) : base(container)
{
this.streetTypes = streetTypes.ToList();
}
protected override void FindMatch()
{
if (parsedAddress.StreetType.IsNotSet()
&& PossibleMatchesWereFound())
{
parsedAddress.StreetName = possibilities.First();
parsedAddress.StreetType = new AddressPartResult()
{
Value = string.Empty,
Index = parsedAddress.StreetName.Index
};
}
}
protected override void FindPossibleMatch(AddressPartResult part)
{
if (EndsWithStreetType(part.Value))
possibilities.Add(part);
}
protected override bool PossibleMatchesWereFound()
{
return possibilities.Count > 0;
}
private bool EndsWithStreetType(string value)
{
return streetTypes
.Exists(s => value.EndsWith(
s.Full,
StringComparison.CurrentCultureIgnoreCase)
&& value.Length > s.Full.Length);
}
}
}
|
using System;
/*Problem 6. The Biggest of Five Numbers
Write a program that finds the biggest of five numbers by using only five if statements.
*/
class Program
{
static void Main()
{
decimal a = 0.0006m;
decimal b = -0.005m;
decimal c = -1.2m;
decimal d = -0.05m;
decimal e = -1.2m;
decimal biggest;
biggest = a;
if (biggest < b)
{
biggest = b;
}
if (biggest < c)
{
biggest = c;
}
if (biggest < d)
{
biggest = d;
}
if (biggest < e)
{
biggest = e;
}
Console.WriteLine(biggest);
}
}
|
using System;
using System.ComponentModel.DataAnnotations;
namespace Paas.Pioneer.Admin.Core.Application.Contracts.LowCodeTable.Dto.Output
{
/// <summary>
/// 低代码表格
/// </summary>
public class LowCodeTableOutput
{
/// <summary>
/// Id
/// </summary>
[Required]
public Guid Id { get; set; }
/// <summary>
/// 所属节点(菜单父级Id)
/// </summary>
public Guid? MenuParentId { get; set; }
/// <summary>
/// 菜单名称
/// </summary>
[MaxLength(50)]
[Required]
public string MenuName { get; set; }
/// <summary>
/// 代码类名
/// </summary>
public string Taxon { get; set; }
/// <summary>
/// 表名
/// </summary>
[MaxLength(50)]
[Required]
public string LowCodeTableName { get; set; }
/// <summary>
/// 所属功能模块(业务场景)
/// </summary>
[MaxLength(100)]
[Required]
public string FunctionModule { get; set; }
/// <summary>
/// 描述
/// </summary>
[MaxLength(500)]
[Required]
public string Description { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; }
}
} |
namespace Fuxion;
using Fuxion.Identity;
using Fuxion.Repositories;
public interface IIdentityRepository : IKeyValueRepository<string, IIdentity> { } |
using System;
using Entitas.VisualDebugging.Unity.Editor;
using UnityEditor;
namespace Entitas.Generics
{
/// <summary>
/// An inspector drawer for <see cref="AddedListenersComponent{TEntity, TComponent}"/>/
/// <see cref="RemovedListenersComponent{TEntity, TComponent}"/>;
/// Shows information about the event subscribers.
/// </summary>
public class EventSystemListenerComponentDrawer : IComponentDrawer
{
public bool HandlesType(Type type)
{
return typeof(IListenerComponent).IsAssignableFrom(type);
}
public IComponent DrawComponent(IComponent component)
{
var listenerComponent = (IListenerComponent)component;
var listenerNames = listenerComponent.GetListenersNames();
if(listenerNames.Length == 0)
{
EditorGUILayout.LabelField($"No Subscribers");
}
else
{
EditorGUILayout.LabelField($"{listenerNames.Length} Subscribers");
for (int i = 0; i < listenerNames.Length; i++)
{
EditorGUILayout.LabelField($"- {listenerNames[i]}");
}
}
return listenerComponent;
}
}
} |
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace BlogSite.Migrations
{
public partial class StoredProcs : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
var assembly = Assembly.GetExecutingAssembly();
var resourceNames =
assembly.GetManifestResourceNames().Where(str => str.EndsWith(".sql"));
foreach (string resourceName in resourceNames)
{
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream))
{
string sql = reader.ReadToEnd();
migrationBuilder.Sql(sql);
}
}
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}
|
@using ResponsiveMenu.Mvc
@using ResponsiveMenu.Mvc.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, ResponsiveMenu.Mvc
@addTagHelper *, AspnetCore.Responsive.Razor |
using OpenBots.Server.Model.Core;
using System;
namespace OpenBots.Server.Model.Configuration
{
public class EmailAccount : NamedEntity
{
public bool IsDisabled { get; set; }
public bool IsDefault { get; set; }
public string Provider { get; set; }
public bool IsSslEnabled { get; set; }
public string Host { get; set; }
public int Port { get; set; }
public string Username { get; set; }
[DoNotAudit]
public string EncryptedPassword { get; set; }
public string PasswordHash { get; set; }
public string ApiKey { get; set; }
public string FromEmailAddress { get; set; }
public string FromName { get; set; }
public DateTime StartOnUTC { get; set; }
public DateTime EndOnUTC { get; set; }
}
}
|
using System;
class Orders
{
static void Main()
{
string product = Console.ReadLine();
int numberOfProducts = int.Parse(Console.ReadLine());
double result = Price(product, numberOfProducts);
Console.WriteLine($"{result:F2}");
}
private static double Price(string product, int numberOfProducts)
{
double sum = 0.0;
switch (product)
{
case "coffee":
sum = numberOfProducts * 1.50;
break;
case "water":
sum = numberOfProducts * 1.00;
break;
case "coke":
sum = numberOfProducts * 1.40;
break;
case "snacks":
sum = numberOfProducts * 2.00;
break;
}
return sum;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ruanal.Core.ApiSdk
{
public class CommandApi
{
public static ApiResult<List<CmdDetail>> GetCommands()
{
var v = SdkCore.InvokeApi<List<CmdDetail>>(ConfigConst.API_COMMAND_GETNEWS, null);
return v;
}
public static ApiResult<object> BeginExecute(int cmdid)
{
var v = SdkCore.InvokeApi<object>(ConfigConst.API_COMMAND_BEGINEXECUTE, new { cmdid = cmdid });
return v;
}
public static ApiResult<object> EndExecute(int cmdid, bool success, string msg)
{
var v = SdkCore.InvokeApi<object>(ConfigConst.API_COMMAND_ENDEXECUTE, new
{
cmdid = cmdid,
success = success ? 1 : 0,
msg = msg
});
return v;
}
}
}
|
namespace VRFI
{
public interface IFlickKeyAction
{
void OnFlickStart(VRFI_Operater operater);
void OnFlickEnd(VRFI_Operater operater);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Mail;
namespace Shahmat.Common
{
public class Helpers
{
public static List<long> New10DigitsRandomUniqueKey(int ammount)
{
return New10DigitsRandomUniqueKey(null, ammount);
}
public static List<long> New10DigitsRandomUniqueKey(List<long> baseList, int ammount)
{
List<long> keys;
if (baseList==null)
keys = new List<long>();
else
keys = baseList;
Random ran = new Random(DateTime.Now.Millisecond);
long keyFirstPart = 0;
long keySecondPart = 0;
long result = 0;
for (int i = 0; i < ammount; i++)
{
do
{
// first 10 numbers
keyFirstPart = ran.Next(10000000, 99999999);
// last 'n' numbers, in this case 2, easy to make it bigger up to 7
keySecondPart = ran.Next(10, 99);
//total key of 10 digits
result = long.Parse(keyFirstPart.ToString() + keySecondPart.ToString());
}
while (keys.Contains(result));
keys.Add(result);
}
return keys;
}
public static bool SendEmailViaGmail(string toAddress, string subject, string content)
{
return false;
}
public static String ToUnicodeString(string string2Encode)
{
Encoding srcEncoding = Encoding.GetEncoding("Windows-1250");
UnicodeEncoding dstEncoding = new UnicodeEncoding();
byte[] srcBytes = srcEncoding.GetBytes(string2Encode);
byte[] dstBytes = dstEncoding.GetBytes(string2Encode);
return dstEncoding.GetString(dstBytes);
}
public static string ConvertStringToUTF8(string originalString)
{
//Encoding encoding = Encoding.Default;
Encoding encoding = Encoding.GetEncoding("Windows-1250");
byte[] encBytes = encoding.GetBytes(originalString);
byte[] utf8Bytes = Encoding.Convert(encoding, Encoding.UTF8, encBytes);
return Encoding.UTF8.GetString(utf8Bytes);
}
}
}
|
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class Products
{
private string product;
private double price;
public Products(string product, double price)
{
this.product = product;
this.price = price;
}
public string IProduct
{
get { return product; }
set { this.product = value; }
}
public double Price
{
get { return price; }
set { this.price = value; }
}
public override string ToString()
{
return $"{product} costs {price:F2}";
}
}
public class GroceryShop
{
static string pattern = @"^(?<product>[A-Z]{1}[a-z]+)\:(?<price>[0-9]+\.[0-9]{2})$";
static string product;
static double price;
static List<Products> productsList = new List<Products>();
public static void Main()
{
ReadNextInputLinesUntilBillFrom(Console.ReadLine());
productsList.OrderByDescending(p => p.Price).ToList()
.ForEach(x => Console.WriteLine(x.ToString()));
}
static void ReadNextInputLinesUntilBillFrom(string inputProduct)
{
if (inputProduct != "bill")
{
if (Regex.IsMatch(inputProduct, pattern))
{
var match = Regex.Match(inputProduct, pattern);
product = match.Groups["product"].Value;
price = Convert.ToDouble(match.Groups["price"].Value);
AddToProductsList();
}
ReadNextInputLinesUntilBillFrom(Console.ReadLine());
}
}
static void AddToProductsList()
{
if (!productsList.Any(p => p.IProduct == product))
{
AddNewProduct();
}
else
{
UpdateProductPrice();
}
}
static void AddNewProduct()
{
var newProduct = new Products(product, price);
productsList.Add(newProduct);
}
private static void UpdateProductPrice()
{
var currentProduct = productsList.Where(p => p.IProduct == product).First();
currentProduct.Price = price;
}
}
|
using UnityEngine;
namespace HelperFunctions
{
namespace Clickable
{
namespace Text
{
public class ClickableText : ClickableObject
{
private DisplayText text;
private string textID = "";
public GameObject displayParent;
private const float BOUNDS_BORDER = 0.5f;
protected Color startColor;
void Awake()
{
text = gameObject.GetComponent<DisplayText>();
if (text == null)
{
text = gameObject.AddComponent<DisplayText>();
}
SetDisplayParent(displayParent);
useBounds = false;
startColor = renderer.material.color;
}
protected override void LateUpdate()
{
if (mouseOver)
{
currentColor = Color.Lerp(currentColor, hoverColor, Time.deltaTime * 5);
}
else
{
currentColor = Color.Lerp(currentColor, Color.white, Time.deltaTime * 5);
}
renderer.material.color = currentColor;
}
protected override void LeftClicked()
{
if (displayParent != null && MessageBox.isOpen)
{
MessageBox.ChooseResponse(this, textID);
}
}
public void SetMaxBounds(Bounds bounds)
{
float width = bounds.size.x - BOUNDS_BORDER;
float height = bounds.size.y - BOUNDS_BORDER;
text.SetMaxBounds(width, height);
}
public void SetMaxWidth(float width)
{
text.maxWidth = width;
text.SetMaxBounds(width, text.maxHeight);
}
public void SetMaxHeight(float height)
{
text.maxHeight = height;
text.SetMaxBounds(text.maxWidth, height);
}
public void SetDisplayParent(GameObject parent)
{
if (parent == null)
{
return;
}
displayParent = parent;
text.displayParent = parent;
SetMaxBounds(displayParent.renderer.bounds);
}
public void SetTextString(LocalizedString newString)
{
text.SetTextString(newString);
textID = newString.ID;
if (textID == "")
{
textID = newString.Text;
}
SetName(newString + " Clickable Text");
}
public void Display(bool on)
{
if (!on)
{
mouseOver = false;
}
text.Display(on);
}
public DisplayText GetDisplayText()
{
return text;
}
public void SetAnchor(TextAnchor anchor)
{
text.SetAnchor(anchor);
}
}
}
}
} |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
* -- BasicCharacterController2D
*
* Handles Gravity, Jump and Horizontal Movement
*/
namespace DYP
{
[RequireComponent(typeof(CharacterMotor2D))]
public class BasicMovementController2D : MonoBehaviour, IHas2DAxisMovement, ICanJump, ICanDash, IHasAction
{
[System.Serializable]
class InputBuffer
{
public Vector2 Input = Vector2.zero;
public bool IsJumpPressed = false;
public bool IsJumpHeld = false;
public bool IsJumpReleased = false;
public bool IsDashPressed = false;
public bool IsDashHeld = false;
}
[System.Serializable]
class MovementSettings
{
public float Speed = 8;
public float AccelerationTimeAirborne = .1f;
public float AccelerationTimeGrounded = .1f;
}
[System.Serializable]
class OnLadderSettings
{
public bool SnapToRestrictedArea = false;
public bool ExitLadderOnGround = true;
public float OnLadderSpeed = 4;
public bool LockFacingToRight = true;
}
[System.Serializable]
class Jump
{
public bool HasVariableJumpHeight = true;
public int AirJumpAllowed = 1;
public float MaxHeight = 3.5f;
public float MinHeight = 1.0f;
public float TimeToApex = .4f;
public float OnLadderJumpForce = 0.4f;
public float FallingJumpPaddingTime = 0.09f;
public float WillJumpPaddingTime = 0.15f;
}
[System.Serializable]
class WallInteraction
{
public bool CanWallSlide = true;
public float WallStickTime = 0.15f;
[HideInInspector]
public float WallStickTimer = 0.0f;
public float WallSlideSpeedLoss = 0.05f;
public float WallSlidingSpeedMax = 2;
public bool CanWallClimb = false;
public float WallClimbSpeed = 2;
public bool CanWallJump = true;
public Vector2 ClimbForce = new Vector2(12, 16);
public Vector2 OffForce = new Vector2(8, 15);
public Vector2 LeapForce = new Vector2(18, 17);
public bool CanGrabLedge = false;
public float LedgeDetectionOffset = 0.1f;
[HideInInspector]
public int WallDirX = 0;
}
[System.Serializable]
class Dash
{
public BaseDashModule Module;
public float WillDashPaddingTime = 0.15f;
private int m_DashDir;
public int DashDir { get { return m_DashDir; } } // 1: right, -1: left
private float m_DashTimer;
private float m_PrevDashTimer;
public void Start(int dashDir, float timeStep)
{
m_DashDir = dashDir;
m_PrevDashTimer = 0.0f;
m_DashTimer = timeStep;
}
public void _Update(float timeStep)
{
m_PrevDashTimer = m_DashTimer;
m_DashTimer += timeStep;
if (m_DashTimer > Module.DashTime)
{
m_DashTimer = Module.DashTime;
}
}
public float GetDashSpeed()
{
if (Module != null)
{
return Module.GetDashSpeed(m_PrevDashTimer, m_DashTimer);
}
else
{
return 0;
}
}
public float GetDashProgress()
{
return Module.GetDashProgress(m_DashTimer);
}
}
[System.Serializable]
class CustomAction
{
public BaseActionModule Module;
private int m_ActionDir;
public int ActionDir { get { return m_ActionDir; } }
private float m_ActionTimer;
private float m_PrevActionTimer;
public void Start(int actionDir)
{
m_ActionDir = actionDir;
m_PrevActionTimer = 0.0f;
m_ActionTimer = 0.0f;
}
public void _Update(float timeStep)
{
m_PrevActionTimer = m_ActionTimer;
m_ActionTimer += timeStep;
if (m_ActionTimer > Module.ActionTime)
{
m_ActionTimer = Module.ActionTime;
}
}
public Vector2 GetActionVelocity()
{
if (Module != null)
{
return Module.GetActionSpeed(m_PrevActionTimer, m_ActionTimer);
}
else
{
return Vector2.zero;
}
}
public float GetActionProgress()
{
return Module.GetActionProgress(m_ActionTimer);
}
}
[System.Serializable]
class OnLadderState
{
public bool IsInLadderArea = false;
public Bounds Area = new Bounds(Vector3.zero, Vector3.zero);
public Bounds BottomArea = new Bounds(Vector3.zero, Vector3.zero);
public Bounds TopArea = new Bounds(Vector3.zero, Vector3.zero);
public LadderZone AreaZone = LadderZone.Bottom;
public bool HasRestrictedArea = false;
public Bounds RestrictedArea = new Bounds();
public Vector2 RestrictedAreaTopRight = new Vector2(Mathf.Infinity, Mathf.Infinity);
public Vector2 RestrictedAreaBottomLeft = new Vector2(-Mathf.Infinity, -Mathf.Infinity);
}
[SerializeField]
private CharacterMotor2D m_Motor;
private InputBuffer m_InputBuffer = new InputBuffer();
[Header("Settings")]
[SerializeField]
private MovementSettings m_MovementSettings;
[SerializeField]
private OnLadderSettings m_OnLadderSettings;
[SerializeField]
private Jump m_Jump;
[SerializeField]
private WallInteraction m_WallInteraction;
private MotorState m_MotorState;
private float m_Gravity;
private bool m_ApplyGravity = true;
private float m_MaxJumpSpeed;
private float m_MinJumpSpeed;
private int m_AirJumpCounter = 0;
private int m_WillJumpPaddingFrame = -1;
private int m_FallingJumpPaddingFrame = -1;
private int m_WillDashPaddingFrame = -1;
private float m_CurrentTimeStep = 0;
private int m_FacingDirection = 1;
public int FacingDirection
{
get { return m_FacingDirection; }
private set
{
int oldFacing = m_FacingDirection;
m_FacingDirection = value;
if (m_FacingDirection != oldFacing)
{
OnFacingFlip(m_FacingDirection);
}
}
}
[SerializeField]
private Dash m_Dash = new Dash();
[SerializeField]
private CustomAction m_CustomAction = new CustomAction();
public BaseDashModule DashModule { get { return m_Dash.Module; } private set { m_Dash.Module = value; } }
public BaseActionModule ActionModule { get { return m_CustomAction.Module; } private set { m_CustomAction.Module = value; } }
private OnLadderState m_OnLadderState = new OnLadderState();
[Header("State")]
private Vector3 m_Velocity;
public Vector3 InputVelocity { get { return m_Velocity; } }
float IHas2DAxisMovement.MovementSpeed => throw new NotImplementedException();
private float m_VelocityXSmoothing;
// Action
public event Action<MotorState, MotorState> OnMotorStateChanged = delegate { };
public event System.Action OnJump = delegate { }; // on all jump! // OnEnterStateJump
public event System.Action OnJumpEnd = delegate { }; // on jump -> falling // OnLeaveStateJump
public event System.Action OnNormalJump = delegate { }; // on ground jump
public event System.Action OnLedgeJump = delegate { }; // on ledge jump
public event System.Action OnLadderJump = delegate { }; // on ladder jump
public event System.Action OnAirJump = delegate { }; // on air jump
public event System.Action<Vector2> OnWallJump = delegate { }; // on wall jump
public event System.Action<int> OnDash = delegate { }; // int represent dash direction
public event System.Action<float> OnDashStay = delegate { }; // float represent action progress
public event System.Action OnDashEnd = delegate { };
public event System.Action<int> OnWallSliding = delegate { }; // int represnet wall direction: 1 -> right, -1 -> left
public event System.Action OnWallSlidingEnd = delegate { };
public event System.Action<int> OnLedgeGrabbing = delegate { };
public event System.Action OnLedgeGrabbingEnd = delegate { };
public event System.Action OnLanded = delegate { }; // on grounded
public event System.Action<MotorState> OnResetJumpCounter = delegate { };
public event System.Action<int> OnFacingFlip = delegate { };
public event System.Action<int> OnAction = delegate { };
public event System.Action<float> OnActionStay = delegate { };
public event System.Action OnActionEnd = delegate { };
// Condition
public Func<bool> CanAirJumpFunc = null;
#region Monobehaviour
private void Reset()
{
m_Motor = GetComponent<CharacterMotor2D>();
}
private void Start()
{
Init();
}
private void FixedUpdate()
{
_Update(Time.fixedDeltaTime);
}
private void OnDrawGizmosSelected()
{
if (IsInLadderArea())
{
Gizmos.color = new Color(1.0f, 0.5f, 0.5f, 0.5f);
Gizmos.DrawCube(m_OnLadderState.Area.center, m_OnLadderState.Area.extents * 2);
Gizmos.color = (m_OnLadderState.AreaZone == LadderZone.Top) ? new Color(1.0f, 0.92f, 0.016f, 1.0f) : Color.white;
Gizmos.DrawWireCube(m_OnLadderState.TopArea.center, m_OnLadderState.TopArea.extents * 2);
Gizmos.color = (m_OnLadderState.AreaZone == LadderZone.Bottom) ? new Color(1.0f, 0.92f, 0.016f, 1.0f) : Color.white;
Gizmos.DrawWireCube(m_OnLadderState.BottomArea.center, m_OnLadderState.BottomArea.extents * 2);
if (IsRestrictedOnLadder())
{
Gizmos.color = Color.red;
Gizmos.DrawWireCube(m_OnLadderState.RestrictedArea.center, m_OnLadderState.RestrictedArea.extents * 2);
}
}
// draw ledge grabbing gizmos
if (m_Motor != null)
{
var boundingBox = m_Motor.Collider2D.bounds;
Vector2 origin = Vector2.zero;
origin.y = boundingBox.max.y + m_WallInteraction.LedgeDetectionOffset;
float distance = m_WallInteraction.LedgeDetectionOffset * 2;
float speedY = -m_Velocity.y * m_CurrentTimeStep;
distance = (speedY > distance) ? speedY : distance;
Vector2 hitPoint = Vector2.zero;
// right ledge line
origin.x = boundingBox.max.x + m_WallInteraction.LedgeDetectionOffset;
bool rightLedge = CheckIfAtLedge(1, ref hitPoint);
Gizmos.color = (rightLedge) ? Color.blue : Color.red;
Gizmos.DrawLine(origin, origin + Vector2.down * distance);
if (rightLedge)
{
Gizmos.DrawSphere(hitPoint, 0.03f);
}
// left ledge line
origin.x = boundingBox.min.x - m_WallInteraction.LedgeDetectionOffset;
bool leftLedge = CheckIfAtLedge(-1, ref hitPoint);
Gizmos.color = (leftLedge) ? Color.blue : Color.red;
Gizmos.DrawLine(origin, origin + Vector2.down * distance);
if (leftLedge)
{
Gizmos.DrawSphere(hitPoint, 0.03f);
}
}
// draw center
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(GetComponent<Collider2D>().bounds.center, .5f);
}
#endregion
#region Input Function
public void InputMovement(Vector2 axis)
{
// Update input buffer
m_InputBuffer.Input = new Vector2(axis.x, axis.y);
}
public void PressJump(bool value)
{
m_InputBuffer.IsJumpPressed = value;
// Do jump padding
if (m_InputBuffer.IsJumpPressed)
{
m_WillJumpPaddingFrame = calculateFramesFromTime(m_Jump.WillJumpPaddingTime, Time.fixedDeltaTime);
}
}
public void HoldJump(bool value)
{
m_InputBuffer.IsJumpHeld = value;
}
public void ReleaseJump(bool value)
{
m_InputBuffer.IsJumpReleased = value;
}
public void PressDash(bool value)
{
m_InputBuffer.IsDashPressed = value;
if (m_InputBuffer.IsDashPressed)
{
m_WillDashPaddingFrame = calculateFramesFromTime(m_Dash.WillDashPaddingTime, Time.fixedDeltaTime);
}
}
public void HoldDash(bool value)
{
m_InputBuffer.IsDashHeld = value;
}
public void ExecuteAction()
{
throw new NotImplementedException();
}
#endregion
public void SetFrozen(bool freeze)
{
if (freeze)
{
m_Velocity.x = 0;
changeState(MotorState.Frozen);
}
else
{
if (IsOnGround())
{
changeState(MotorState.OnGround);
}
else
{
changeState(MotorState.Falling);
}
}
}
public bool IsState(MotorState state)
{
return m_MotorState == state;
}
public bool IsInLadderArea()
{
return m_OnLadderState.IsInLadderArea;
}
public bool IsInLadderTopArea()
{
return m_OnLadderState.IsInLadderArea && m_OnLadderState.AreaZone == LadderZone.Top;
}
public bool IsOnGround()
{
return m_Motor.Collisions.Below;
}
public bool IsInAir()
{
return !m_Motor.Collisions.Below && !m_Motor.Collisions.Left && !m_Motor.Collisions.Right; //IsState(MotorState.Jumping) || IsState(MotorState.Falling);
}
public bool IsAgainstWall()
{
if (m_Motor.Collisions.Left)
{
float leftWallAngle = Vector2.Angle(m_Motor.Collisions.LeftNormal, Vector2.right);
if (leftWallAngle < 0.01f)
{
return true;
}
}
if (m_Motor.Collisions.Right)
{
float rightWallAngle = Vector2.Angle(m_Motor.Collisions.RightNormal, Vector2.left);
if (rightWallAngle < 0.01f)
{
return true;
}
}
return false;
}
public bool CheckIfAtLedge(int wallDirX, ref Vector2 ledgePoint)
{
// first raycast down, then check overlap
var boundingBox = m_Motor.Collider2D.bounds;
Vector2 origin = Vector2.zero;
origin.y = boundingBox.max.y + m_WallInteraction.LedgeDetectionOffset;
// right wall
if (wallDirX == 1)
{
origin.x = boundingBox.max.x + m_WallInteraction.LedgeDetectionOffset;
}
// left wall
else if (wallDirX == -1)
{
origin.x = boundingBox.min.x - m_WallInteraction.LedgeDetectionOffset;
}
float distance = m_WallInteraction.LedgeDetectionOffset * 2;
float speedY = -m_Velocity.y * m_CurrentTimeStep;
distance = (speedY > distance) ? speedY : distance;
RaycastHit2D hit = Physics2D.Raycast(origin, Vector2.down, distance, m_Motor.Raycaster.CollisionLayer);
ledgePoint = hit.point;
if (hit.collider != null)
{
Bounds overlapBox = new Bounds(
new Vector3(ledgePoint.x, ledgePoint.y) + Vector3.up * m_WallInteraction.LedgeDetectionOffset,
Vector3.one * m_WallInteraction.LedgeDetectionOffset);
Collider2D col = Physics2D.OverlapArea(overlapBox.min, overlapBox.max);
return (col == null);
}
else
{
return false;
}
}
public bool CanAirJump()
{
if (CanAirJumpFunc != null)
{
return CanAirJumpFunc();
}
else
{
return m_AirJumpCounter < m_Jump.AirJumpAllowed;
}
}
public void ChangeDashModule(BaseDashModule module, bool disableDashingState = false)
{
if (module != null)
{
DashModule = module;
if (disableDashingState)
{
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
else
{
DashModule = null;
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
public void ChangeActionModule(BaseActionModule module, bool disableActionState = false)
{
if (module != null)
{
ActionModule = module;
if (disableActionState)
{
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
else
{
ActionModule = null;
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
public void LadderAreaEnter(Bounds area, float topAreaHeight, float bottomAreaHeight)
{
m_OnLadderState.IsInLadderArea = true;
m_OnLadderState.Area = area;
m_OnLadderState.TopArea = new Bounds(
new Vector3(area.center.x, area.center.y + area.extents.y - topAreaHeight / 2, 0),
new Vector3(area.size.x, topAreaHeight, 100)
);
m_OnLadderState.BottomArea = new Bounds(
new Vector3(area.center.x, area.center.y - area.extents.y + bottomAreaHeight / 2, 0),
new Vector3(area.size.x, bottomAreaHeight, 100)
);
}
public void LadderAreaExit()
{
m_OnLadderState.IsInLadderArea = false;
m_OnLadderState.Area = new Bounds(Vector3.zero, Vector3.zero);
m_OnLadderState.TopArea = new Bounds(Vector3.zero, Vector3.zero);
m_OnLadderState.BottomArea = new Bounds(Vector3.zero, Vector3.zero);
if (IsState(MotorState.OnLadder))
{
exitLadderState();
}
}
public void SetLadderRestrictedArea(Bounds b, bool isTopIgnored = false)
{
m_OnLadderState.HasRestrictedArea = true;
m_OnLadderState.RestrictedArea = b;
m_OnLadderState.RestrictedAreaTopRight = b.center + b.extents;
m_OnLadderState.RestrictedAreaBottomLeft = b.center - b.extents;
if (isTopIgnored)
{
m_OnLadderState.RestrictedAreaTopRight.y = Mathf.Infinity;
}
}
public void SetLadderZone(LadderZone zone)
{
m_OnLadderState.AreaZone = zone;
}
public void ClearLadderRestrictedArea()
{
m_OnLadderState.HasRestrictedArea = false;
}
public bool IsRestrictedOnLadder()
{
return m_OnLadderState.HasRestrictedArea;
}
public void Init()
{
// S = V0 * t + a * t^2 * 0.5
// h = V0 * t + g * t^2 * 0.5
// h = g * t^2 * 0.5
// g = h / (t^2*0.5)
m_Gravity = -m_Jump.MaxHeight / (m_Jump.TimeToApex * m_Jump.TimeToApex * 0.5f);
m_MaxJumpSpeed = Mathf.Abs(m_Gravity) * m_Jump.TimeToApex;
m_MinJumpSpeed = Mathf.Sqrt(2 * Mathf.Abs(m_Gravity) * m_Jump.MinHeight);
m_AirJumpCounter = 0;
m_Motor.OnMotorCollisionEnter2D += onMotorCollisionEnter2D;
m_Motor.OnMotorCollisionStay2D += onMotorCollisionStay2D;
}
public void _Update(float timeStep)
{
m_CurrentTimeStep = timeStep;
updateTimers(timeStep);
updateState(timeStep);
// check padding frame
if (m_WillJumpPaddingFrame >= 0)
{
m_InputBuffer.IsJumpPressed = true;
}
if (m_WillDashPaddingFrame >= 0)
{
m_InputBuffer.IsDashPressed = true;
}
// read input from input driver
Vector2 input = m_InputBuffer.Input;
Vector2Int rawInput = Vector2Int.zero;
if (input.x > 0.0f)
rawInput.x = 1;
else if (input.x < 0.0f)
rawInput.x = -1;
if (input.y > 0.0f)
rawInput.y = 1;
else if (input.y < 0.0f)
rawInput.y = -1;
// check which side of character is collided
int wallDirX = 0;
if (m_Motor.Collisions.Right)
{
wallDirX = 1;
}
else if (m_Motor.Collisions.Left)
{
wallDirX = -1;
}
m_WallInteraction.WallDirX = wallDirX;
// check if want dashing
if (m_InputBuffer.IsDashPressed)
{
startDash(rawInput.x, timeStep);
m_InputBuffer.IsDashPressed = false;
}
// check if want climbing ladder
if (IsInLadderArea())
{
if (IsInLadderTopArea())
{
if (rawInput.y < 0)
{
enterLadderState();
}
}
else
{
if (rawInput.y > 0)
{
enterLadderState();
}
}
}
// dashing state
if (IsState(MotorState.Dashing))
{
m_Velocity.x = m_Dash.DashDir * m_Dash.GetDashSpeed(); //getDashSpeed();
if (!IsOnGround() && DashModule.UseGravity)
m_Velocity.y = 0;
if (DashModule.ChangeFacing)
{
FacingDirection = (int)Mathf.Sign(m_Velocity.x);
}
if (DashModule.UseCollision)
{
m_Motor.Move(m_Velocity * timeStep, false);
}
// teleport, if there is no obstacle on the target position -> teleport, or use collision to find the closest teleport position
else
{
bool cannotTeleportTo = Physics2D.OverlapBox(
m_Motor.Collider2D.bounds.center + m_Velocity * timeStep,
m_Motor.Collider2D.bounds.size,
0.0f,
m_Motor.Raycaster.CollisionLayer);
if (!cannotTeleportTo)
{
m_Motor.transform.Translate(m_Velocity * timeStep);
}
else
{
m_Motor.Move(m_Velocity * timeStep, false);
}
}
}
// on custom action
else if (IsState(MotorState.CustomAction))
{
//m_Velocity.x = m_ActionState.GetActionVelocity();
//if (!IsGrounded() && DashModule.UseGravity)
// m_Velocity.y = 0;
}
// on ladder state
else if (IsState(MotorState.OnLadder))
{
m_Velocity = input * m_OnLadderSettings.OnLadderSpeed;
// jump if jump input is true
if (m_InputBuffer.IsJumpPressed)
{
startJump(rawInput, wallDirX);
}
if (m_OnLadderSettings.LockFacingToRight)
{
FacingDirection = 1;
}
else
{
if (m_Velocity.x != 0.0f)
FacingDirection = (int)Mathf.Sign(m_Velocity.x);
}
//m_Motor.Move(m_Velocity * timeStep, false);
// dont do collision detection
if (m_OnLadderState.HasRestrictedArea)
{
// outside right, moving right disallowed
if (m_Motor.transform.position.x > m_OnLadderState.RestrictedAreaTopRight.x)
{
if (m_Velocity.x > 0.0f)
{
m_Velocity.x = 0.0f;
}
}
// outside left, moving left disallowed
if (m_Motor.transform.position.x < m_OnLadderState.RestrictedAreaBottomLeft.x)
{
if (m_Velocity.x < 0.0f)
{
m_Velocity.x = 0.0f;
}
}
// outside up, moving up disallowed
if (m_Motor.transform.position.y > m_OnLadderState.RestrictedAreaTopRight.y)
{
if (m_Velocity.y > 0.0f)
{
m_Velocity.y = 0.0f;
}
}
// outside down, moving down disallowed
if (m_Motor.transform.position.y < m_OnLadderState.RestrictedAreaBottomLeft.y)
{
if (m_Velocity.y < 0.0f)
{
m_Velocity.y = 0.0f;
}
}
}
Vector2 targetPos = m_Motor.transform.position + m_Velocity * timeStep;
Vector2 currPos = m_Motor.transform.position;
// call Motor.Move to update collision info
m_Motor.Move(targetPos - currPos);
// actual updated position
m_Motor.transform.position = targetPos;
// Second pass check
if (m_OnLadderState.HasRestrictedArea)
{
targetPos.x = Mathf.Clamp(targetPos.x, m_OnLadderState.RestrictedAreaBottomLeft.x, m_OnLadderState.RestrictedAreaTopRight.x);
targetPos.y = Mathf.Clamp(targetPos.y, m_OnLadderState.RestrictedAreaBottomLeft.y, m_OnLadderState.RestrictedAreaTopRight.y);
// restricted in x axis
if (targetPos.x != m_Motor.transform.position.x)
{
if (!m_OnLadderSettings.SnapToRestrictedArea)
{
targetPos.x = Mathf.Lerp(m_Motor.transform.position.x, targetPos.x, 0.25f);
}
}
// restricted in y axis
if (targetPos.y != m_Motor.transform.position.y)
{
if (!m_OnLadderSettings.SnapToRestrictedArea)
{
targetPos.y = Mathf.Lerp(m_Motor.transform.position.y, targetPos.y, 0.25f);
}
}
m_Motor.transform.position = targetPos;
}
}
else if (IsState(MotorState.Frozen))
{
// Reset gravity if collision happened in y axis
if (m_Motor.Collisions.Above)
{
//Debug.Log("Reset Vec Y");
m_Velocity.y = 0;
}
else if (m_Motor.Collisions.Below)
{
// falling downward
if (m_Velocity.y < 0.0f)
{
m_Velocity.y = 0;
}
}
if (m_ApplyGravity)
{
float gravity = m_Gravity;
m_Velocity.y += gravity * timeStep;
}
m_Motor.Move(m_Velocity * timeStep, false);
}
else // other state
{
// fall through one way platform
if (m_InputBuffer.IsJumpHeld && rawInput.y < 0)
{
m_Motor.FallThrough();
changeState(MotorState.Falling);
}
// setup velocity.x based on input
float targetVecX = input.x * m_MovementSettings.Speed;
// smooth x direction motion
if (IsOnGround())
{
m_Velocity.x = targetVecX;
m_VelocityXSmoothing = targetVecX;
}
else
{
m_Velocity.x = Mathf.SmoothDamp(m_Velocity.x, targetVecX, ref m_VelocityXSmoothing, m_MovementSettings.AccelerationTimeAirborne);
}
/*
m_Velocity.x = Mathf.SmoothDamp(m_Velocity.x, targetVecX, ref m_VelocityXSmoothing,
(m_Motor.Collisions.Below) ? m_MovementSettings.AccelerationTimeGrounded : m_MovementSettings.AccelerationTimeAirborne);
*/
// check wall sticking and jumping
bool isStickToWall = false;
bool isGrabbingLedge = false;
Vector2 ledgePos = Vector2.zero;
if (IsAgainstWall())
{
// ledge grabbing logic
if (m_WallInteraction.CanGrabLedge)
{
if (CheckIfAtLedge(wallDirX, ref ledgePos))
{
if (!IsState(MotorState.OnLedge))
{
if (m_Velocity.y < 0 && wallDirX == rawInput.x)
{
isGrabbingLedge = true;
m_Velocity.y = 0;
float adjustY = ledgePos.y - m_Motor.Collider2D.bounds.max.y;
m_Motor.transform.position += Vector3.up * adjustY;
}
}
else
{
isGrabbingLedge = true;
}
}
if (isGrabbingLedge)
{
changeState(MotorState.OnLedge);
m_AirJumpCounter = 0;
OnResetJumpCounter.Invoke(MotorState.OnLedge);
// check if still sticking to wall
if (m_WallInteraction.WallStickTimer > 0.0f)
{
m_VelocityXSmoothing = 0;
m_Velocity.x = 0;
// leaving wall
if (rawInput.x == -wallDirX)
{
m_WallInteraction.WallStickTimer -= timeStep;
}
// not leaving wall
else
{
m_WallInteraction.WallStickTimer = m_WallInteraction.WallStickTime;
}
}
else
{
changeState(MotorState.Falling);
m_WallInteraction.WallStickTimer = m_WallInteraction.WallStickTime;
}
}
}
// wall sliding logic
if (!isGrabbingLedge && m_WallInteraction.CanWallSlide)
{
// is OnGround, press against wall and jump
if (IsOnGround())
{
if (!IsState(MotorState.WallSliding))
{
if (m_WallInteraction.CanWallClimb)
{
if (rawInput.x == wallDirX && m_InputBuffer.IsJumpPressed)
{
isStickToWall = true;
consumeJumpPressed();
}
}
}
}
// is not OnGround, press against wall or was wallsliding
else
{
if (IsState(MotorState.WallSliding) || rawInput.x == wallDirX)
{
isStickToWall = true;
}
}
if (isStickToWall)
{
changeState(MotorState.WallSliding);
m_AirJumpCounter = 0;
OnResetJumpCounter.Invoke(MotorState.WallSliding);
// check if still sticking to wall
if (m_WallInteraction.WallStickTimer > 0.0f)
{
m_VelocityXSmoothing = 0;
m_Velocity.x = 0;
if (rawInput.x != wallDirX && rawInput.x != 0)
{
m_WallInteraction.WallStickTimer -= timeStep;
if (m_WallInteraction.WallStickTimer < 0.0f)
{
changeState(MotorState.Falling);
m_WallInteraction.WallStickTimer = m_WallInteraction.WallStickTime;
}
}
else
{
m_WallInteraction.WallStickTimer = m_WallInteraction.WallStickTime;
}
}
else
{
changeState(MotorState.Falling);
m_WallInteraction.WallStickTimer = m_WallInteraction.WallStickTime;
}
}
}
}
// Reset gravity if collision happened in y axis
if (m_Motor.Collisions.Above)
{
//Debug.Log("Reset Vec Y");
m_Velocity.y = 0;
}
else if (m_Motor.Collisions.Below)
{
// falling downward
if (m_Velocity.y < 0.0f)
{
m_Velocity.y = 0;
}
}
// jump if jump input is true
if (m_InputBuffer.IsJumpPressed && rawInput.y >= 0)
{
startJump(rawInput, wallDirX);
}
// variable jump height based on user input
if (m_Jump.HasVariableJumpHeight)
{
if (!m_InputBuffer.IsJumpHeld && rawInput.y >= 0)
{
if (m_Velocity.y > m_MinJumpSpeed)
m_Velocity.y = m_MinJumpSpeed;
}
}
if (m_ApplyGravity)
{
float gravity = m_Gravity;
if (IsState(MotorState.WallSliding) && m_Velocity.y < 0)
{
gravity *= m_WallInteraction.WallSlideSpeedLoss;
}
m_Velocity.y += gravity * timeStep;
}
// control ledge grabbing speed
if (isGrabbingLedge)
{
if (IsState(MotorState.OnLedge))
{
if (m_Velocity.y < 0)
{
m_Velocity.y = 0;
}
}
FacingDirection = (m_Motor.Collisions.Right) ? 1 : -1;
}
// control wall sliding speed
else if (isStickToWall)
{
if (m_WallInteraction.CanWallClimb)
{
if (IsState(MotorState.WallSliding))
{
m_Velocity.y = input.y * m_WallInteraction.WallClimbSpeed;
}
}
else
{
if (m_Velocity.y < -m_WallInteraction.WallSlidingSpeedMax)
{
m_Velocity.y = -m_WallInteraction.WallSlidingSpeedMax;
}
}
FacingDirection = (m_Motor.Collisions.Right) ? 1 : -1;
}
else
{
if (m_Velocity.x != 0.0f)
FacingDirection = (int)Mathf.Sign(m_Velocity.x);
}
m_Motor.Move(m_Velocity * timeStep, false);
}
// check ladder area
if (IsInLadderArea())
{
if (m_OnLadderState.BottomArea.Contains(m_Motor.Collider2D.bounds.center))
{
m_OnLadderState.AreaZone = LadderZone.Bottom;
}
else if (m_OnLadderState.TopArea.Contains(m_Motor.Collider2D.bounds.center))
{
m_OnLadderState.AreaZone = LadderZone.Top;
}
else if (m_OnLadderState.Area.Contains(m_Motor.Collider2D.bounds.center))
{
m_OnLadderState.AreaZone = LadderZone.Middle;
}
}
}
private void updateTimers(float timeStep)
{
if (IsState(MotorState.Dashing))
{
m_Dash._Update(timeStep);
}
if (IsState(MotorState.CustomAction))
{
m_CustomAction._Update(timeStep);
}
if (m_FallingJumpPaddingFrame >= 0) m_FallingJumpPaddingFrame--;
if (m_WillJumpPaddingFrame >= 0) m_WillJumpPaddingFrame--;
if (m_WillDashPaddingFrame >= 0) m_WillDashPaddingFrame--;
}
private void updateState(float timeStep)
{
if (IsState(MotorState.Dashing))
{
OnDashStay(m_Dash.GetDashProgress());
if (m_Dash.GetDashProgress() >= 1.0f)
{
endDash();
}
}
if (IsState(MotorState.Dashing))
{
return;
}
if (IsState(MotorState.CustomAction))
{
OnActionStay(m_CustomAction.GetActionProgress());
if (m_CustomAction.GetActionProgress() >= 1.0f)
{
endAction();
}
}
if (IsState(MotorState.CustomAction))
{
return;
}
if (IsState(MotorState.Jumping))
{
if (m_Motor.Velocity.y < 0)
{
endJump();
}
}
if (IsOnGround())
{
if (IsState(MotorState.OnLadder))
{
if (m_OnLadderSettings.ExitLadderOnGround)
{
if (!IsInLadderTopArea())
{
changeState(MotorState.OnGround);
}
}
}
else
{
if (!IsState(MotorState.Frozen))
{
changeState(MotorState.OnGround);
}
}
}
else
{
if (IsState(MotorState.OnGround))
{
m_FallingJumpPaddingFrame = calculateFramesFromTime(m_Jump.FallingJumpPaddingTime, timeStep);
changeState(MotorState.Falling);
}
}
if (IsState(MotorState.WallSliding))
{
if (!IsAgainstWall())
{
if (m_Motor.Velocity.y < 0.0f)
{
changeState(MotorState.Falling);
}
else
{
changeState(MotorState.Jumping);
}
}
}
}
private void startJump(Vector2Int rawInput, int wallDirX)
{
bool success = false;
if (IsState(MotorState.OnLedge))
{
ledgeJump();
success = true;
}
else if (IsState(MotorState.WallSliding))
{
if (m_WallInteraction.CanWallJump)
{
wallJump(rawInput.x, wallDirX);
success = true;
}
}
else
{
success = normalJump();
}
if (success)
{
consumeJumpPressed();
changeState(MotorState.Jumping);
OnJump.Invoke();
}
}
private bool normalJump()
{
if (IsState(MotorState.OnGround))
{
m_Velocity.y = m_MaxJumpSpeed;
OnNormalJump.Invoke();
return true;
}
else if (IsState(MotorState.OnLadder))
{
m_Velocity.y = m_Jump.OnLadderJumpForce;
OnLadderJump.Invoke();
return true;
}
else if (m_FallingJumpPaddingFrame >= 0)
{
m_Velocity.y = m_MaxJumpSpeed;
OnNormalJump.Invoke();
return true;
}
else if (CanAirJump())
{
m_Velocity.y = m_MaxJumpSpeed;
m_AirJumpCounter++;
OnAirJump.Invoke();
return true;
}
else
{
return false;
}
}
private void ledgeJump()
{
m_Velocity.y = m_MaxJumpSpeed;
OnLedgeJump.Invoke();
}
private void wallJump(int rawInputX, int wallDirX)
{
bool climbing = wallDirX == rawInputX;
Vector2 jumpVec;
// climbing
if (climbing || rawInputX == 0)
{
jumpVec.x = -wallDirX * m_WallInteraction.ClimbForce.x;
jumpVec.y = m_WallInteraction.ClimbForce.y;
}
// jump leap
else
{
jumpVec.x = -wallDirX * m_WallInteraction.LeapForce.x;
jumpVec.y = m_WallInteraction.LeapForce.y;
}
OnWallJump.Invoke(jumpVec);
m_Velocity = jumpVec;
}
/// <summary>
/// Called if jump pressed input is successfully executed
/// </summary>
private void consumeJumpPressed()
{
m_InputBuffer.IsJumpPressed = false;
m_FallingJumpPaddingFrame = -1;
m_WillJumpPaddingFrame = -1;
}
// highest point reached, start falling
private void endJump()
{
if (IsState(MotorState.Jumping))
{
changeState(MotorState.Falling);
}
}
private void startDash(int rawInputX, float timeStep)
{
if (DashModule == null)
{
return;
}
if (IsState(MotorState.Dashing))
{
return;
}
if (DashModule.CanOnlyBeUsedOnGround)
{
if (!IsOnGround())
{
return;
}
}
int dashDir = (rawInputX != 0) ? rawInputX : FacingDirection;
if (!DashModule.CanDashToSlidingWall)
{
// Skip the dash if cannot dash towards the current sliding wall
if (IsState(MotorState.WallSliding))
{
int wallDir = (m_Motor.Collisions.Right) ? 1 : -1;
if (dashDir == wallDir)
{
return;
}
}
}
consumeDashPressed();
if (DashModule.ChangeFacing)
{
FacingDirection = (int)Mathf.Sign(m_Velocity.x);
}
if (!IsOnGround() && DashModule.UseGravity)
m_Velocity.y = 0;
m_Dash.Start(dashDir, timeStep);
OnDash.Invoke(dashDir);
changeState(MotorState.Dashing);
}
private void endDash()
{
if (IsState(MotorState.Dashing))
{
// smooth out or sudden stop
float vecX = m_Dash.DashDir * m_Dash.GetDashSpeed();
m_VelocityXSmoothing = vecX;
m_Velocity.x = vecX;
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
/// <summary>
/// Called if dash pressed input is successfully executed
/// </summary>
private void consumeDashPressed()
{
m_InputBuffer.IsDashPressed = false;
m_WillDashPaddingFrame = -1;
}
private void startAction(int rawInputX)
{
if (ActionModule == null)
{
return;
}
if (IsState(MotorState.CustomAction))
{
return;
}
if (DashModule.CanOnlyBeUsedOnGround)
{
if (!IsOnGround())
{
return;
}
}
int actionDir = (rawInputX != 0) ? rawInputX : FacingDirection;
if (!ActionModule.CanUseToSlidingWall)
{
if (IsState(MotorState.WallSliding))
{
int wallDir = (m_Motor.Collisions.Right) ? 1 : -1;
if (actionDir == wallDir)
{
return;
}
}
}
m_CustomAction.Start(actionDir);
changeState(MotorState.CustomAction);
}
private void endAction()
{
if (IsState(MotorState.CustomAction))
{
// smooth out or sudden stop
Vector2 vec = new Vector2(m_CustomAction.ActionDir, 1) * m_CustomAction.GetActionVelocity();
m_VelocityXSmoothing = vec.x;
m_Velocity = vec;
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
}
private void enterLadderState()
{
m_Velocity.x = 0;
m_Velocity.y = 0;
changeState(MotorState.OnLadder);
m_AirJumpCounter = 0;
OnResetJumpCounter.Invoke(MotorState.OnLadder);
m_ApplyGravity = false;
}
private void exitLadderState()
{
m_Velocity.y = 0;
changeState(IsOnGround() ? MotorState.OnGround : MotorState.Falling);
}
// change state and callback
private void changeState(MotorState state)
{
if (m_MotorState == state)
{
return;
}
if (IsState(MotorState.OnLadder))
{
m_ApplyGravity = true;
}
// exit old state action
if (IsState(MotorState.Jumping))
{
OnJumpEnd.Invoke();
}
if (IsState(MotorState.Dashing))
{
OnDashEnd.Invoke();
}
if (IsState(MotorState.WallSliding))
{
OnWallSlidingEnd.Invoke();
}
if (IsState(MotorState.OnLedge))
{
OnLedgeGrabbingEnd.Invoke();
}
// set new state
var prevState = m_MotorState;
m_MotorState = state;
if (IsState(MotorState.OnGround))
{
m_AirJumpCounter = 0;
OnResetJumpCounter.Invoke(MotorState.OnGround);
if (prevState != MotorState.Frozen)
{
OnLanded.Invoke();
}
}
if (IsState(MotorState.OnLedge))
{
OnLedgeGrabbing.Invoke(m_WallInteraction.WallDirX);
}
if (IsState(MotorState.WallSliding))
{
OnWallSliding.Invoke(m_WallInteraction.WallDirX);
}
OnMotorStateChanged.Invoke(prevState, m_MotorState);
}
private int calculateFramesFromTime(float time, float timeStep)
{
return Mathf.RoundToInt(time / timeStep);
}
private void onMotorCollisionEnter2D(MotorCollision2D col)
{
if (col.IsSurface(MotorCollision2D.CollisionSurface.Ground))
{
onCollisionEnterGround();
}
if (col.IsSurface(MotorCollision2D.CollisionSurface.Ceiling))
{
onCollisionEnterCeiling();
}
if (col.IsSurface(MotorCollision2D.CollisionSurface.Left))
{
onCollisionEnterLeft();
}
if (col.IsSurface(MotorCollision2D.CollisionSurface.Right))
{
onCollisionEnterRight();
}
}
private void onCollisionEnterGround()
{
//Debug.Log("Ground!");
}
private void onCollisionEnterCeiling()
{
//Debug.Log("Ceiliing!");
}
private void onCollisionEnterLeft()
{
//Debug.Log("Left!");
}
private void onCollisionEnterRight()
{
//Debug.Log("Right!");
}
private void onMotorCollisionStay2D(MotorCollision2D col)
{
if (col.IsSurface(MotorCollision2D.CollisionSurface.Ground))
{
onCollisionStayGround();
}
if (col.IsSurface(MotorCollision2D.CollisionSurface.Left))
{
onCollisionStayLeft();
}
if (col.IsSurface(MotorCollision2D.CollisionSurface.Right))
{
onCollisionStayRight();
}
}
private void onCollisionStayGround()
{
//Debug.Log("Ground!");
//m_AirJumpCounter = 0;
}
private void onCollisionStayLeft()
{
//Debug.Log("Left!");
//if (m_WallJumpSettings.CanWallJump)
//{
// m_AirJumpCounter = 0;
//}
}
private void onCollisionStayRight()
{
//Debug.Log("Right!");
//if (m_WallJumpSettings.CanWallJump)
//{
// m_AirJumpCounter = 0;
//}
}
}
}
|
using System;
namespace MAVN.Service.OperationsHistory.Client.Models.Requests
{
/// <summary>
/// Represents a base period request model
/// </summary>
public class PeriodRequest
{
/// <summary>
/// Represents FromDate
/// </summary>
public DateTime FromDate { get; set; }
/// <summary>
/// Represents ToDate
/// </summary>
public DateTime ToDate { get; set; }
}
}
|
namespace AillieoUtils.CSFixedPoint {
internal static class FPTanLut_38912 {
internal static fp[] table = new fp[] {
fp.CreateWithRaw(5791093012), // 1.34834391348672
fp.CreateWithRaw(5791383120), // 1.34841145951166
fp.CreateWithRaw(5791673246), // 1.34847900990283
fp.CreateWithRaw(5791963392), // 1.34854656466072
fp.CreateWithRaw(5792253556), // 1.34861412378585
fp.CreateWithRaw(5792543739), // 1.3486816872787
fp.CreateWithRaw(5792833941), // 1.34874925513978
fp.CreateWithRaw(5793124161), // 1.34881682736959
fp.CreateWithRaw(5793414401), // 1.34888440396864
fp.CreateWithRaw(5793704659), // 1.34895198493742
fp.CreateWithRaw(5793994936), // 1.34901957027644
fp.CreateWithRaw(5794285231), // 1.3490871599862
fp.CreateWithRaw(5794575545), // 1.34915475406719
fp.CreateWithRaw(5794865879), // 1.34922235251992
fp.CreateWithRaw(5795156231), // 1.3492899553449
fp.CreateWithRaw(5795446601), // 1.34935756254263
fp.CreateWithRaw(5795736991), // 1.34942517411359
fp.CreateWithRaw(5796027399), // 1.34949279005831
fp.CreateWithRaw(5796317826), // 1.34956041037728
fp.CreateWithRaw(5796608272), // 1.349628035071
fp.CreateWithRaw(5796898737), // 1.34969566413998
fp.CreateWithRaw(5797189220), // 1.34976329758471
fp.CreateWithRaw(5797479722), // 1.34983093540571
fp.CreateWithRaw(5797770243), // 1.34989857760347
fp.CreateWithRaw(5798060783), // 1.34996622417849
fp.CreateWithRaw(5798351342), // 1.35003387513128
fp.CreateWithRaw(5798641919), // 1.35010153046234
fp.CreateWithRaw(5798932515), // 1.35016919017217
fp.CreateWithRaw(5799223130), // 1.35023685426128
fp.CreateWithRaw(5799513764), // 1.35030452273017
fp.CreateWithRaw(5799804417), // 1.35037219557934
fp.CreateWithRaw(5800095088), // 1.35043987280929
fp.CreateWithRaw(5800385779), // 1.35050755442054
fp.CreateWithRaw(5800676488), // 1.35057524041357
fp.CreateWithRaw(5800967216), // 1.3506429307889
fp.CreateWithRaw(5801257963), // 1.35071062554703
fp.CreateWithRaw(5801548728), // 1.35077832468846
fp.CreateWithRaw(5801839513), // 1.35084602821369
fp.CreateWithRaw(5802130316), // 1.35091373612324
fp.CreateWithRaw(5802421138), // 1.35098144841759
fp.CreateWithRaw(5802711979), // 1.35104916509727
fp.CreateWithRaw(5803002839), // 1.35111688616276
fp.CreateWithRaw(5803293717), // 1.35118461161458
fp.CreateWithRaw(5803584615), // 1.35125234145322
fp.CreateWithRaw(5803875531), // 1.3513200756792
fp.CreateWithRaw(5804166466), // 1.35138781429301
fp.CreateWithRaw(5804457420), // 1.35145555729516
fp.CreateWithRaw(5804748393), // 1.35152330468616
fp.CreateWithRaw(5805039385), // 1.35159105646651
fp.CreateWithRaw(5805330395), // 1.35165881263671
fp.CreateWithRaw(5805621425), // 1.35172657319727
fp.CreateWithRaw(5805912473), // 1.35179433814869
fp.CreateWithRaw(5806203540), // 1.35186210749148
fp.CreateWithRaw(5806494626), // 1.35192988122614
fp.CreateWithRaw(5806785731), // 1.35199765935318
fp.CreateWithRaw(5807076854), // 1.3520654418731
fp.CreateWithRaw(5807367997), // 1.35213322878641
fp.CreateWithRaw(5807659158), // 1.3522010200936
fp.CreateWithRaw(5807950339), // 1.3522688157952
fp.CreateWithRaw(5808241538), // 1.3523366158917
fp.CreateWithRaw(5808532756), // 1.3524044203836
fp.CreateWithRaw(5808823993), // 1.35247222927142
fp.CreateWithRaw(5809115249), // 1.35254004255566
fp.CreateWithRaw(5809406524), // 1.35260786023682
fp.CreateWithRaw(5809697817), // 1.3526756823154
fp.CreateWithRaw(5809989130), // 1.35274350879193
fp.CreateWithRaw(5810280461), // 1.35281133966689
fp.CreateWithRaw(5810571811), // 1.3528791749408
fp.CreateWithRaw(5810863180), // 1.35294701461417
fp.CreateWithRaw(5811154569), // 1.35301485868749
fp.CreateWithRaw(5811445976), // 1.35308270716127
fp.CreateWithRaw(5811737401), // 1.35315056003603
fp.CreateWithRaw(5812028846), // 1.35321841731226
fp.CreateWithRaw(5812320310), // 1.35328627899048
fp.CreateWithRaw(5812611792), // 1.35335414507119
fp.CreateWithRaw(5812903294), // 1.35342201555489
fp.CreateWithRaw(5813194814), // 1.35348989044209
fp.CreateWithRaw(5813486354), // 1.3535577697333
fp.CreateWithRaw(5813777912), // 1.35362565342903
fp.CreateWithRaw(5814069489), // 1.35369354152978
fp.CreateWithRaw(5814361085), // 1.35376143403606
fp.CreateWithRaw(5814652700), // 1.35382933094837
fp.CreateWithRaw(5814944334), // 1.35389723226723
fp.CreateWithRaw(5815235987), // 1.35396513799313
fp.CreateWithRaw(5815527659), // 1.3540330481266
fp.CreateWithRaw(5815819350), // 1.35410096266812
fp.CreateWithRaw(5816111059), // 1.35416888161822
fp.CreateWithRaw(5816402788), // 1.3542368049774
fp.CreateWithRaw(5816694535), // 1.35430473274616
fp.CreateWithRaw(5816986302), // 1.35437266492502
fp.CreateWithRaw(5817278087), // 1.35444060151447
fp.CreateWithRaw(5817569892), // 1.35450854251504
fp.CreateWithRaw(5817861715), // 1.35457648792722
fp.CreateWithRaw(5818153557), // 1.35464443775153
fp.CreateWithRaw(5818445419), // 1.35471239198846
fp.CreateWithRaw(5818737299), // 1.35478035063854
fp.CreateWithRaw(5819029198), // 1.35484831370227
fp.CreateWithRaw(5819321116), // 1.35491628118015
fp.CreateWithRaw(5819613053), // 1.35498425307269
fp.CreateWithRaw(5819905009), // 1.35505222938041
fp.CreateWithRaw(5820196984), // 1.35512021010381
fp.CreateWithRaw(5820488978), // 1.35518819524339
fp.CreateWithRaw(5820780991), // 1.35525618479968
fp.CreateWithRaw(5821073023), // 1.35532417877317
fp.CreateWithRaw(5821365074), // 1.35539217716437
fp.CreateWithRaw(5821657144), // 1.3554601799738
fp.CreateWithRaw(5821949232), // 1.35552818720196
fp.CreateWithRaw(5822241340), // 1.35559619884936
fp.CreateWithRaw(5822533467), // 1.35566421491652
fp.CreateWithRaw(5822825613), // 1.35573223540393
fp.CreateWithRaw(5823117777), // 1.3558002603121
fp.CreateWithRaw(5823409961), // 1.35586828964156
fp.CreateWithRaw(5823702164), // 1.3559363233928
fp.CreateWithRaw(5823994386), // 1.35600436156634
fp.CreateWithRaw(5824286626), // 1.35607240416268
fp.CreateWithRaw(5824578886), // 1.35614045118234
fp.CreateWithRaw(5824871165), // 1.35620850262582
fp.CreateWithRaw(5825163463), // 1.35627655849363
fp.CreateWithRaw(5825455779), // 1.35634461878629
fp.CreateWithRaw(5825748115), // 1.3564126835043
fp.CreateWithRaw(5826040470), // 1.35648075264817
fp.CreateWithRaw(5826332844), // 1.35654882621842
fp.CreateWithRaw(5826625236), // 1.35661690421555
fp.CreateWithRaw(5826917648), // 1.35668498664007
fp.CreateWithRaw(5827210079), // 1.3567530734925
fp.CreateWithRaw(5827502529), // 1.35682116477333
fp.CreateWithRaw(5827794998), // 1.35688926048309
fp.CreateWithRaw(5828087485), // 1.35695736062229
fp.CreateWithRaw(5828379992), // 1.35702546519143
fp.CreateWithRaw(5828672518), // 1.35709357419102
fp.CreateWithRaw(5828965063), // 1.35716168762158
fp.CreateWithRaw(5829257627), // 1.35722980548362
fp.CreateWithRaw(5829550210), // 1.35729792777764
fp.CreateWithRaw(5829842812), // 1.35736605450416
fp.CreateWithRaw(5830135433), // 1.35743418566369
fp.CreateWithRaw(5830428074), // 1.35750232125674
fp.CreateWithRaw(5830720733), // 1.35757046128382
fp.CreateWithRaw(5831013411), // 1.35763860574544
fp.CreateWithRaw(5831306108), // 1.35770675464212
fp.CreateWithRaw(5831598825), // 1.35777490797436
fp.CreateWithRaw(5831891560), // 1.35784306574267
fp.CreateWithRaw(5832184314), // 1.35791122794757
fp.CreateWithRaw(5832477088), // 1.35797939458957
fp.CreateWithRaw(5832769880), // 1.35804756566918
fp.CreateWithRaw(5833062692), // 1.35811574118692
fp.CreateWithRaw(5833355523), // 1.35818392114328
fp.CreateWithRaw(5833648373), // 1.35825210553879
fp.CreateWithRaw(5833941241), // 1.35832029437396
fp.CreateWithRaw(5834234129), // 1.3583884876493
fp.CreateWithRaw(5834527036), // 1.35845668536532
fp.CreateWithRaw(5834819962), // 1.35852488752254
fp.CreateWithRaw(5835112907), // 1.35859309412146
fp.CreateWithRaw(5835405872), // 1.35866130516259
fp.CreateWithRaw(5835698855), // 1.35872952064646
fp.CreateWithRaw(5835991857), // 1.35879774057357
fp.CreateWithRaw(5836284879), // 1.35886596494444
fp.CreateWithRaw(5836577919), // 1.35893419375957
fp.CreateWithRaw(5836870979), // 1.35900242701949
fp.CreateWithRaw(5837164057), // 1.3590706647247
fp.CreateWithRaw(5837457155), // 1.35913890687572
fp.CreateWithRaw(5837750272), // 1.35920715347305
fp.CreateWithRaw(5838043408), // 1.35927540451722
fp.CreateWithRaw(5838336563), // 1.35934366000873
fp.CreateWithRaw(5838629737), // 1.3594119199481
fp.CreateWithRaw(5838922931), // 1.35948018433584
fp.CreateWithRaw(5839216143), // 1.35954845317247
fp.CreateWithRaw(5839509375), // 1.3596167264585
fp.CreateWithRaw(5839802625), // 1.35968500419443
fp.CreateWithRaw(5840095895), // 1.3597532863808
fp.CreateWithRaw(5840389184), // 1.3598215730181
fp.CreateWithRaw(5840682492), // 1.35988986410685
fp.CreateWithRaw(5840975819), // 1.35995815964757
fp.CreateWithRaw(5841269165), // 1.36002645964077
fp.CreateWithRaw(5841562531), // 1.36009476408697
fp.CreateWithRaw(5841855915), // 1.36016307298667
fp.CreateWithRaw(5842149319), // 1.36023138634039
fp.CreateWithRaw(5842442742), // 1.36029970414866
fp.CreateWithRaw(5842736183), // 1.36036802641197
fp.CreateWithRaw(5843029644), // 1.36043635313084
fp.CreateWithRaw(5843323125), // 1.3605046843058
fp.CreateWithRaw(5843616624), // 1.36057301993735
fp.CreateWithRaw(5843910142), // 1.36064136002601
fp.CreateWithRaw(5844203680), // 1.36070970457229
fp.CreateWithRaw(5844497237), // 1.3607780535767
fp.CreateWithRaw(5844790813), // 1.36084640703977
fp.CreateWithRaw(5845084408), // 1.36091476496201
fp.CreateWithRaw(5845378022), // 1.36098312734393
fp.CreateWithRaw(5845671655), // 1.36105149418605
fp.CreateWithRaw(5845965308), // 1.36111986548887
fp.CreateWithRaw(5846258979), // 1.36118824125293
fp.CreateWithRaw(5846552670), // 1.36125662147873
fp.CreateWithRaw(5846846380), // 1.36132500616678
fp.CreateWithRaw(5847140109), // 1.36139339531761
fp.CreateWithRaw(5847433858), // 1.36146178893173
fp.CreateWithRaw(5847727625), // 1.36153018700965
fp.CreateWithRaw(5848021412), // 1.36159858955189
fp.CreateWithRaw(5848315218), // 1.36166699655896
fp.CreateWithRaw(5848609043), // 1.36173540803139
fp.CreateWithRaw(5848902887), // 1.36180382396968
fp.CreateWithRaw(5849196750), // 1.36187224437436
fp.CreateWithRaw(5849490633), // 1.36194066924594
fp.CreateWithRaw(5849784535), // 1.36200909858493
fp.CreateWithRaw(5850078456), // 1.36207753239185
fp.CreateWithRaw(5850372396), // 1.36214597066722
fp.CreateWithRaw(5850666355), // 1.36221441341155
fp.CreateWithRaw(5850960334), // 1.36228286062537
fp.CreateWithRaw(5851254332), // 1.36235131230918
fp.CreateWithRaw(5851548348), // 1.3624197684635
fp.CreateWithRaw(5851842385), // 1.36248822908885
fp.CreateWithRaw(5852136440), // 1.36255669418575
fp.CreateWithRaw(5852430515), // 1.36262516375471
fp.CreateWithRaw(5852724608), // 1.36269363779626
fp.CreateWithRaw(5853018721), // 1.3627621163109
fp.CreateWithRaw(5853312853), // 1.36283059929915
fp.CreateWithRaw(5853607005), // 1.36289908676153
fp.CreateWithRaw(5853901176), // 1.36296757869857
fp.CreateWithRaw(5854195365), // 1.36303607511077
fp.CreateWithRaw(5854489574), // 1.36310457599865
fp.CreateWithRaw(5854783803), // 1.36317308136273
fp.CreateWithRaw(5855078050), // 1.36324159120353
fp.CreateWithRaw(5855372317), // 1.36331010552156
fp.CreateWithRaw(5855666603), // 1.36337862431735
fp.CreateWithRaw(5855960908), // 1.36344714759141
fp.CreateWithRaw(5856255233), // 1.36351567534426
fp.CreateWithRaw(5856549576), // 1.36358420757641
fp.CreateWithRaw(5856843939), // 1.36365274428839
fp.CreateWithRaw(5857138321), // 1.3637212854807
fp.CreateWithRaw(5857432723), // 1.36378983115388
fp.CreateWithRaw(5857727144), // 1.36385838130844
fp.CreateWithRaw(5858021584), // 1.3639269359449
fp.CreateWithRaw(5858316043), // 1.36399549506377
fp.CreateWithRaw(5858610521), // 1.36406405866557
fp.CreateWithRaw(5858905019), // 1.36413262675083
fp.CreateWithRaw(5859199536), // 1.36420119932006
fp.CreateWithRaw(5859494072), // 1.36426977637377
fp.CreateWithRaw(5859788627), // 1.3643383579125
fp.CreateWithRaw(5860083202), // 1.36440694393675
fp.CreateWithRaw(5860377796), // 1.36447553444704
fp.CreateWithRaw(5860672409), // 1.3645441294439
fp.CreateWithRaw(5860967042), // 1.36461272892785
fp.CreateWithRaw(5861261694), // 1.3646813328994
fp.CreateWithRaw(5861556365), // 1.36474994135907
fp.CreateWithRaw(5861851055), // 1.36481855430738
fp.CreateWithRaw(5862145765), // 1.36488717174485
fp.CreateWithRaw(5862440494), // 1.364955793672
fp.CreateWithRaw(5862735242), // 1.36502442008935
fp.CreateWithRaw(5863030010), // 1.36509305099742
fp.CreateWithRaw(5863324796), // 1.36516168639673
fp.CreateWithRaw(5863619602), // 1.3652303262878
fp.CreateWithRaw(5863914428), // 1.36529897067115
fp.CreateWithRaw(5864209272), // 1.36536761954729
fp.CreateWithRaw(5864504136), // 1.36543627291676
fp.CreateWithRaw(5864799020), // 1.36550493078006
fp.CreateWithRaw(5865093922), // 1.36557359313772
fp.CreateWithRaw(5865388844), // 1.36564225999026
fp.CreateWithRaw(5865683785), // 1.36571093133819
fp.CreateWithRaw(5865978746), // 1.36577960718205
fp.CreateWithRaw(5866273726), // 1.36584828752235
fp.CreateWithRaw(5866568725), // 1.36591697235961
fp.CreateWithRaw(5866863743), // 1.36598566169434
fp.CreateWithRaw(5867158781), // 1.36605435552708
fp.CreateWithRaw(5867453838), // 1.36612305385835
fp.CreateWithRaw(5867748915), // 1.36619175668865
fp.CreateWithRaw(5868044010), // 1.36626046401852
fp.CreateWithRaw(5868339125), // 1.36632917584848
fp.CreateWithRaw(5868634260), // 1.36639789217904
fp.CreateWithRaw(5868929413), // 1.36646661301073
fp.CreateWithRaw(5869224587), // 1.36653533834407
fp.CreateWithRaw(5869519779), // 1.36660406817957
fp.CreateWithRaw(5869814991), // 1.36667280251777
fp.CreateWithRaw(5870110222), // 1.36674154135919
fp.CreateWithRaw(5870405472), // 1.36681028470433
fp.CreateWithRaw(5870700742), // 1.36687903255373
fp.CreateWithRaw(5870996031), // 1.36694778490791
fp.CreateWithRaw(5871291339), // 1.36701654176739
fp.CreateWithRaw(5871586667), // 1.36708530313269
fp.CreateWithRaw(5871882014), // 1.36715406900434
fp.CreateWithRaw(5872177381), // 1.36722283938285
fp.CreateWithRaw(5872472767), // 1.36729161426875
fp.CreateWithRaw(5872768172), // 1.36736039366255
fp.CreateWithRaw(5873063597), // 1.36742917756479
fp.CreateWithRaw(5873359041), // 1.36749796597598
fp.CreateWithRaw(5873654504), // 1.36756675889665
fp.CreateWithRaw(5873949987), // 1.36763555632732
fp.CreateWithRaw(5874245489), // 1.36770435826851
fp.CreateWithRaw(5874541010), // 1.36777316472075
fp.CreateWithRaw(5874836551), // 1.36784197568455
fp.CreateWithRaw(5875132111), // 1.36791079116044
fp.CreateWithRaw(5875427691), // 1.36797961114895
fp.CreateWithRaw(5875723290), // 1.36804843565059
fp.CreateWithRaw(5876018908), // 1.36811726466589
fp.CreateWithRaw(5876314546), // 1.36818609819537
fp.CreateWithRaw(5876610203), // 1.36825493623956
fp.CreateWithRaw(5876905880), // 1.36832377879897
fp.CreateWithRaw(5877201576), // 1.36839262587414
fp.CreateWithRaw(5877497291), // 1.36846147746558
fp.CreateWithRaw(5877793026), // 1.36853033357382
fp.CreateWithRaw(5878088780), // 1.36859919419939
fp.CreateWithRaw(5878384553), // 1.3686680593428
fp.CreateWithRaw(5878680346), // 1.36873692900458
fp.CreateWithRaw(5878976159), // 1.36880580318525
fp.CreateWithRaw(5879271991), // 1.36887468188534
fp.CreateWithRaw(5879567842), // 1.36894356510537
fp.CreateWithRaw(5879863712), // 1.36901245284587
fp.CreateWithRaw(5880159602), // 1.36908134510736
fp.CreateWithRaw(5880455512), // 1.36915024189036
fp.CreateWithRaw(5880751441), // 1.3692191431954
fp.CreateWithRaw(5881047389), // 1.36928804902301
fp.CreateWithRaw(5881343357), // 1.3693569593737
fp.CreateWithRaw(5881639344), // 1.369425874248
fp.CreateWithRaw(5881935350), // 1.36949479364644
fp.CreateWithRaw(5882231376), // 1.36956371756954
fp.CreateWithRaw(5882527422), // 1.36963264601782
fp.CreateWithRaw(5882823487), // 1.36970157899182
fp.CreateWithRaw(5883119571), // 1.36977051649205
fp.CreateWithRaw(5883415675), // 1.36983945851905
fp.CreateWithRaw(5883711798), // 1.36990840507333
fp.CreateWithRaw(5884007940), // 1.36997735615542
fp.CreateWithRaw(5884304103), // 1.37004631176584
fp.CreateWithRaw(5884600284), // 1.37011527190513
fp.CreateWithRaw(5884896485), // 1.37018423657381
fp.CreateWithRaw(5885192706), // 1.3702532057724
fp.CreateWithRaw(5885488945), // 1.37032217950142
fp.CreateWithRaw(5885785205), // 1.37039115776141
fp.CreateWithRaw(5886081484), // 1.37046014055289
fp.CreateWithRaw(5886377782), // 1.37052912787639
fp.CreateWithRaw(5886674100), // 1.37059811973242
fp.CreateWithRaw(5886970437), // 1.37066711612153
fp.CreateWithRaw(5887266794), // 1.37073611704423
fp.CreateWithRaw(5887563170), // 1.37080512250104
fp.CreateWithRaw(5887859565), // 1.37087413249251
fp.CreateWithRaw(5888155981), // 1.37094314701914
fp.CreateWithRaw(5888452415), // 1.37101216608147
fp.CreateWithRaw(5888748869), // 1.37108118968003
fp.CreateWithRaw(5889045343), // 1.37115021781534
fp.CreateWithRaw(5889341836), // 1.37121925048793
fp.CreateWithRaw(5889638349), // 1.37128828769832
fp.CreateWithRaw(5889934881), // 1.37135732944704
fp.CreateWithRaw(5890231432), // 1.37142637573463
fp.CreateWithRaw(5890528003), // 1.37149542656159
fp.CreateWithRaw(5890824594), // 1.37156448192847
fp.CreateWithRaw(5891121204), // 1.37163354183579
fp.CreateWithRaw(5891417833), // 1.37170260628408
fp.CreateWithRaw(5891714482), // 1.37177167527386
fp.CreateWithRaw(5892011151), // 1.37184074880566
fp.CreateWithRaw(5892307839), // 1.37190982688001
fp.CreateWithRaw(5892604547), // 1.37197890949744
fp.CreateWithRaw(5892901274), // 1.37204799665847
fp.CreateWithRaw(5893198020), // 1.37211708836363
fp.CreateWithRaw(5893494786), // 1.37218618461345
fp.CreateWithRaw(5893791572), // 1.37225528540845
fp.CreateWithRaw(5894088377), // 1.37232439074917
fp.CreateWithRaw(5894385202), // 1.37239350063614
fp.CreateWithRaw(5894682046), // 1.37246261506987
fp.CreateWithRaw(5894978910), // 1.37253173405091
fp.CreateWithRaw(5895275793), // 1.37260085757977
fp.CreateWithRaw(5895572696), // 1.37266998565698
fp.CreateWithRaw(5895869618), // 1.37273911828309
fp.CreateWithRaw(5896166560), // 1.3728082554586
fp.CreateWithRaw(5896463522), // 1.37287739718405
fp.CreateWithRaw(5896760503), // 1.37294654345997
fp.CreateWithRaw(5897057503), // 1.3730156942869
fp.CreateWithRaw(5897354523), // 1.37308484966534
fp.CreateWithRaw(5897651563), // 1.37315400959585
fp.CreateWithRaw(5897948622), // 1.37322317407894
fp.CreateWithRaw(5898245701), // 1.37329234311514
fp.CreateWithRaw(5898542799), // 1.37336151670498
fp.CreateWithRaw(5898839917), // 1.373430694849
fp.CreateWithRaw(5899137055), // 1.37349987754772
fp.CreateWithRaw(5899434212), // 1.37356906480167
fp.CreateWithRaw(5899731388), // 1.37363825661138
fp.CreateWithRaw(5900028584), // 1.37370745297737
fp.CreateWithRaw(5900325800), // 1.37377665390019
fp.CreateWithRaw(5900623035), // 1.37384585938036
fp.CreateWithRaw(5900920290), // 1.3739150694184
fp.CreateWithRaw(5901217565), // 1.37398428401485
fp.CreateWithRaw(5901514859), // 1.37405350317024
fp.CreateWithRaw(5901812172), // 1.3741227268851
fp.CreateWithRaw(5902109505), // 1.37419195515996
fp.CreateWithRaw(5902406858), // 1.37426118799535
fp.CreateWithRaw(5902704230), // 1.37433042539179
fp.CreateWithRaw(5903001622), // 1.37439966734982
fp.CreateWithRaw(5903299034), // 1.37446891386998
fp.CreateWithRaw(5903596465), // 1.37453816495278
fp.CreateWithRaw(5903893916), // 1.37460742059876
fp.CreateWithRaw(5904191386), // 1.37467668080845
fp.CreateWithRaw(5904488876), // 1.37474594558239
fp.CreateWithRaw(5904786386), // 1.37481521492109
fp.CreateWithRaw(5905083915), // 1.3748844888251
fp.CreateWithRaw(5905381464), // 1.37495376729495
fp.CreateWithRaw(5905679032), // 1.37502305033116
fp.CreateWithRaw(5905976620), // 1.37509233793426
fp.CreateWithRaw(5906274228), // 1.37516163010479
fp.CreateWithRaw(5906571855), // 1.37523092684329
fp.CreateWithRaw(5906869502), // 1.37530022815027
fp.CreateWithRaw(5907167168), // 1.37536953402627
fp.CreateWithRaw(5907464854), // 1.37543884447183
fp.CreateWithRaw(5907762560), // 1.37550815948747
fp.CreateWithRaw(5908060285), // 1.37557747907372
fp.CreateWithRaw(5908358030), // 1.37564680323113
fp.CreateWithRaw(5908655795), // 1.37571613196021
fp.CreateWithRaw(5908953579), // 1.37578546526151
fp.CreateWithRaw(5909251383), // 1.37585480313555
fp.CreateWithRaw(5909549207), // 1.37592414558287
fp.CreateWithRaw(5909847050), // 1.37599349260399
fp.CreateWithRaw(5910144913), // 1.37606284419945
fp.CreateWithRaw(5910442795), // 1.37613220036979
fp.CreateWithRaw(5910740697), // 1.37620156111553
fp.CreateWithRaw(5911038619), // 1.37627092643721
fp.CreateWithRaw(5911336560), // 1.37634029633536
fp.CreateWithRaw(5911634522), // 1.37640967081051
fp.CreateWithRaw(5911932502), // 1.37647904986319
fp.CreateWithRaw(5912230503), // 1.37654843349395
fp.CreateWithRaw(5912528523), // 1.3766178217033
fp.CreateWithRaw(5912826563), // 1.37668721449179
fp.CreateWithRaw(5913124622), // 1.37675661185995
fp.CreateWithRaw(5913422701), // 1.3768260138083
fp.CreateWithRaw(5913720800), // 1.37689542033739
fp.CreateWithRaw(5914018918), // 1.37696483144775
fp.CreateWithRaw(5914317056), // 1.3770342471399
fp.CreateWithRaw(5914615214), // 1.37710366741439
fp.CreateWithRaw(5914913392), // 1.37717309227175
fp.CreateWithRaw(5915211589), // 1.3772425217125
fp.CreateWithRaw(5915509806), // 1.3773119557372
fp.CreateWithRaw(5915808042), // 1.37738139434635
fp.CreateWithRaw(5916106299), // 1.37745083754051
fp.CreateWithRaw(5916404575), // 1.37752028532021
fp.CreateWithRaw(5916702870), // 1.37758973768597
fp.CreateWithRaw(5917001186), // 1.37765919463834
fp.CreateWithRaw(5917299521), // 1.37772865617785
fp.CreateWithRaw(5917597875), // 1.37779812230503
fp.CreateWithRaw(5917896250), // 1.37786759302041
fp.CreateWithRaw(5918194644), // 1.37793706832454
fp.CreateWithRaw(5918493058), // 1.37800654821794
fp.CreateWithRaw(5918791491), // 1.37807603270116
fp.CreateWithRaw(5919089945), // 1.37814552177471
fp.CreateWithRaw(5919388418), // 1.37821501543915
fp.CreateWithRaw(5919686910), // 1.378284513695
fp.CreateWithRaw(5919985423), // 1.3783540165428
fp.CreateWithRaw(5920283955), // 1.37842352398308
fp.CreateWithRaw(5920582507), // 1.37849303601639
fp.CreateWithRaw(5920881079), // 1.37856255264324
fp.CreateWithRaw(5921179670), // 1.37863207386419
fp.CreateWithRaw(5921478281), // 1.37870159967976
fp.CreateWithRaw(5921776912), // 1.37877113009049
fp.CreateWithRaw(5922075562), // 1.37884066509692
fp.CreateWithRaw(5922374233), // 1.37891020469958
fp.CreateWithRaw(5922672923), // 1.37897974889901
fp.CreateWithRaw(5922971633), // 1.37904929769574
fp.CreateWithRaw(5923270362), // 1.3791188510903
fp.CreateWithRaw(5923569112), // 1.37918840908325
fp.CreateWithRaw(5923867881), // 1.3792579716751
fp.CreateWithRaw(5924166669), // 1.3793275388664
fp.CreateWithRaw(5924465478), // 1.37939711065768
fp.CreateWithRaw(5924764306), // 1.37946668704948
fp.CreateWithRaw(5925063154), // 1.37953626804233
fp.CreateWithRaw(5925362022), // 1.37960585363678
fp.CreateWithRaw(5925660910), // 1.37967544383335
fp.CreateWithRaw(5925959817), // 1.37974503863259
fp.CreateWithRaw(5926258744), // 1.37981463803503
fp.CreateWithRaw(5926557691), // 1.3798842420412
fp.CreateWithRaw(5926856658), // 1.37995385065166
fp.CreateWithRaw(5927155645), // 1.38002346386692
fp.CreateWithRaw(5927454651), // 1.38009308168753
fp.CreateWithRaw(5927753677), // 1.38016270411402
fp.CreateWithRaw(5928052723), // 1.38023233114694
fp.CreateWithRaw(5928351788), // 1.38030196278682
fp.CreateWithRaw(5928650874), // 1.38037159903419
fp.CreateWithRaw(5928949979), // 1.3804412398896
fp.CreateWithRaw(5929249104), // 1.38051088535358
fp.CreateWithRaw(5929548249), // 1.38058053542667
fp.CreateWithRaw(5929847413), // 1.38065019010941
fp.CreateWithRaw(5930146598), // 1.38071984940233
fp.CreateWithRaw(5930445802), // 1.38078951330597
fp.CreateWithRaw(5930745026), // 1.38085918182087
fp.CreateWithRaw(5931044270), // 1.38092885494757
fp.CreateWithRaw(5931343533), // 1.3809985326866
fp.CreateWithRaw(5931642817), // 1.38106821503851
fp.CreateWithRaw(5931942120), // 1.38113790200384
fp.CreateWithRaw(5932241443), // 1.38120759358311
fp.CreateWithRaw(5932540786), // 1.38127728977687
fp.CreateWithRaw(5932840148), // 1.38134699058566
fp.CreateWithRaw(5933139531), // 1.38141669601001
fp.CreateWithRaw(5933438933), // 1.38148640605047
fp.CreateWithRaw(5933738356), // 1.38155612070757
fp.CreateWithRaw(5934037798), // 1.38162583998185
fp.CreateWithRaw(5934337259), // 1.38169556387385
fp.CreateWithRaw(5934636741), // 1.38176529238411
fp.CreateWithRaw(5934936243), // 1.38183502551317
fp.CreateWithRaw(5935235764), // 1.38190476326157
fp.CreateWithRaw(5935535305), // 1.38197450562984
fp.CreateWithRaw(5935834866), // 1.38204425261853
fp.CreateWithRaw(5936134447), // 1.38211400422817
fp.CreateWithRaw(5936434048), // 1.38218376045931
fp.CreateWithRaw(5936733668), // 1.38225352131248
fp.CreateWithRaw(5937033309), // 1.38232328678823
fp.CreateWithRaw(5937332969), // 1.38239305688709
fp.CreateWithRaw(5937632649), // 1.3824628316096
fp.CreateWithRaw(5937932349), // 1.3825326109563
fp.CreateWithRaw(5938232069), // 1.38260239492774
fp.CreateWithRaw(5938531809), // 1.38267218352445
fp.CreateWithRaw(5938831568), // 1.38274197674697
fp.CreateWithRaw(5939131348), // 1.38281177459585
fp.CreateWithRaw(5939431147), // 1.38288157707161
fp.CreateWithRaw(5939730966), // 1.38295138417481
fp.CreateWithRaw(5940030806), // 1.38302119590599
fp.CreateWithRaw(5940330665), // 1.38309101226568
fp.CreateWithRaw(5940630543), // 1.38316083325442
fp.CreateWithRaw(5940930442), // 1.38323065887276
fp.CreateWithRaw(5941230361), // 1.38330048912123
fp.CreateWithRaw(5941530299), // 1.38337032400038
fp.CreateWithRaw(5941830258), // 1.38344016351075
fp.CreateWithRaw(5942130236), // 1.38351000765287
fp.CreateWithRaw(5942430234), // 1.3835798564273
fp.CreateWithRaw(5942730252), // 1.38364970983457
fp.CreateWithRaw(5943030290), // 1.38371956787521
fp.CreateWithRaw(5943330348), // 1.38378943054979
fp.CreateWithRaw(5943630426), // 1.38385929785882
fp.CreateWithRaw(5943930524), // 1.38392916980286
fp.CreateWithRaw(5944230641), // 1.38399904638245
fp.CreateWithRaw(5944530779), // 1.38406892759813
fp.CreateWithRaw(5944830936), // 1.38413881345044
fp.CreateWithRaw(5945131114), // 1.38420870393992
fp.CreateWithRaw(5945431311), // 1.38427859906712
fp.CreateWithRaw(5945731528), // 1.38434849883257
fp.CreateWithRaw(5946031765), // 1.38441840323683
fp.CreateWithRaw(5946332022), // 1.38448831228042
fp.CreateWithRaw(5946632299), // 1.38455822596389
fp.CreateWithRaw(5946932596), // 1.38462814428779
fp.CreateWithRaw(5947232913), // 1.38469806725266
fp.CreateWithRaw(5947533250), // 1.38476799485904
fp.CreateWithRaw(5947833607), // 1.38483792710747
fp.CreateWithRaw(5948133983), // 1.38490786399849
fp.CreateWithRaw(5948434380), // 1.38497780553265
fp.CreateWithRaw(5948734796), // 1.3850477517105
fp.CreateWithRaw(5949035233), // 1.38511770253256
fp.CreateWithRaw(5949335689), // 1.3851876579994
fp.CreateWithRaw(5949636166), // 1.38525761811154
fp.CreateWithRaw(5949936662), // 1.38532758286953
fp.CreateWithRaw(5950237178), // 1.38539755227392
fp.CreateWithRaw(5950537715), // 1.38546752632525
fp.CreateWithRaw(5950838271), // 1.38553750502406
fp.CreateWithRaw(5951138847), // 1.3856074883709
fp.CreateWithRaw(5951439443), // 1.3856774763663
fp.CreateWithRaw(5951740059), // 1.38574746901082
fp.CreateWithRaw(5952040696), // 1.385817466305
fp.CreateWithRaw(5952341352), // 1.38588746824937
fp.CreateWithRaw(5952642028), // 1.38595747484449
fp.CreateWithRaw(5952942724), // 1.3860274860909
fp.CreateWithRaw(5953243440), // 1.38609750198914
fp.CreateWithRaw(5953544176), // 1.38616752253975
fp.CreateWithRaw(5953844932), // 1.38623754774329
fp.CreateWithRaw(5954145707), // 1.38630757760029
fp.CreateWithRaw(5954446503), // 1.38637761211129
fp.CreateWithRaw(5954747319), // 1.38644765127686
fp.CreateWithRaw(5955048155), // 1.38651769509752
fp.CreateWithRaw(5955349011), // 1.38658774357382
fp.CreateWithRaw(5955649887), // 1.38665779670631
fp.CreateWithRaw(5955950783), // 1.38672785449553
fp.CreateWithRaw(5956251699), // 1.38679791694203
fp.CreateWithRaw(5956552635), // 1.38686798404635
fp.CreateWithRaw(5956853591), // 1.38693805580903
fp.CreateWithRaw(5957154567), // 1.38700813223063
fp.CreateWithRaw(5957455563), // 1.38707821331169
fp.CreateWithRaw(5957756579), // 1.38714829905274
fp.CreateWithRaw(5958057615), // 1.38721838945435
fp.CreateWithRaw(5958358671), // 1.38728848451705
fp.CreateWithRaw(5958659747), // 1.38735858424138
fp.CreateWithRaw(5958960843), // 1.3874286886279
fp.CreateWithRaw(5959261959), // 1.38749879767715
fp.CreateWithRaw(5959563095), // 1.38756891138968
fp.CreateWithRaw(5959864251), // 1.38763902976603
fp.CreateWithRaw(5960165427), // 1.38770915280674
fp.CreateWithRaw(5960466623), // 1.38777928051237
fp.CreateWithRaw(5960767840), // 1.38784941288346
fp.CreateWithRaw(5961069076), // 1.38791954992055
fp.CreateWithRaw(5961370332), // 1.3879896916242
fp.CreateWithRaw(5961671609), // 1.38805983799494
fp.CreateWithRaw(5961972905), // 1.38812998903333
fp.CreateWithRaw(5962274221), // 1.38820014473991
fp.CreateWithRaw(5962575558), // 1.38827030511522
fp.CreateWithRaw(5962876915), // 1.38834047015982
fp.CreateWithRaw(5963178291), // 1.38841063987426
fp.CreateWithRaw(5963479688), // 1.38848081425907
fp.CreateWithRaw(5963781105), // 1.3885509933148
fp.CreateWithRaw(5964082541), // 1.38862117704201
fp.CreateWithRaw(5964383998), // 1.38869136544124
fp.CreateWithRaw(5964685475), // 1.38876155851303
fp.CreateWithRaw(5964986972), // 1.38883175625794
fp.CreateWithRaw(5965288489), // 1.3889019586765
fp.CreateWithRaw(5965590027), // 1.38897216576928
fp.CreateWithRaw(5965891584), // 1.38904237753681
fp.CreateWithRaw(5966193161), // 1.38911259397965
fp.CreateWithRaw(5966494759), // 1.38918281509833
fp.CreateWithRaw(5966796376), // 1.38925304089342
fp.CreateWithRaw(5967098014), // 1.38932327136545
fp.CreateWithRaw(5967399671), // 1.38939350651497
fp.CreateWithRaw(5967701349), // 1.38946374634254
fp.CreateWithRaw(5968003047), // 1.3895339908487
fp.CreateWithRaw(5968304765), // 1.389604240034
fp.CreateWithRaw(5968606503), // 1.38967449389899
fp.CreateWithRaw(5968908261), // 1.38974475244421
fp.CreateWithRaw(5969210039), // 1.38981501567022
fp.CreateWithRaw(5969511838), // 1.38988528357755
fp.CreateWithRaw(5969813656), // 1.38995555616677
fp.CreateWithRaw(5970115495), // 1.39002583343842
fp.CreateWithRaw(5970417353), // 1.39009611539305
fp.CreateWithRaw(5970719232), // 1.39016640203121
fp.CreateWithRaw(5971021131), // 1.39023669335344
fp.CreateWithRaw(5971323050), // 1.39030698936029
fp.CreateWithRaw(5971624989), // 1.39037729005233
fp.CreateWithRaw(5971926949), // 1.39044759543008
fp.CreateWithRaw(5972228928), // 1.39051790549411
fp.CreateWithRaw(5972530928), // 1.39058822024496
fp.CreateWithRaw(5972832947), // 1.39065853968318
fp.CreateWithRaw(5973134987), // 1.39072886380933
fp.CreateWithRaw(5973437047), // 1.39079919262394
fp.CreateWithRaw(5973739127), // 1.39086952612758
fp.CreateWithRaw(5974041227), // 1.39093986432079
fp.CreateWithRaw(5974343348), // 1.39101020720411
fp.CreateWithRaw(5974645488), // 1.39108055477811
fp.CreateWithRaw(5974947649), // 1.39115090704333
fp.CreateWithRaw(5975249830), // 1.39122126400031
fp.CreateWithRaw(5975552031), // 1.39129162564962
fp.CreateWithRaw(5975854252), // 1.3913619919918
fp.CreateWithRaw(5976156493), // 1.3914323630274
fp.CreateWithRaw(5976458755), // 1.39150273875697
fp.CreateWithRaw(5976761036), // 1.39157311918107
fp.CreateWithRaw(5977063338), // 1.39164350430024
fp.CreateWithRaw(5977365660), // 1.39171389411503
fp.CreateWithRaw(5977668002), // 1.39178428862599
fp.CreateWithRaw(5977970365), // 1.39185468783368
fp.CreateWithRaw(5978272747), // 1.39192509173865
fp.CreateWithRaw(5978575150), // 1.39199550034144
fp.CreateWithRaw(5978877572), // 1.39206591364262
fp.CreateWithRaw(5979180015), // 1.39213633164272
fp.CreateWithRaw(5979482479), // 1.3922067543423
fp.CreateWithRaw(5979784962), // 1.39227718174192
fp.CreateWithRaw(5980087466), // 1.39234761384211
fp.CreateWithRaw(5980389989), // 1.39241805064345
fp.CreateWithRaw(5980692533), // 1.39248849214647
fp.CreateWithRaw(5980995097), // 1.39255893835173
fp.CreateWithRaw(5981297682), // 1.39262938925978
fp.CreateWithRaw(5981600286), // 1.39269984487117
fp.CreateWithRaw(5981902911), // 1.39277030518646
fp.CreateWithRaw(5982205556), // 1.39284077020619
fp.CreateWithRaw(5982508221), // 1.39291123993092
fp.CreateWithRaw(5982810907), // 1.39298171436121
fp.CreateWithRaw(5983113612), // 1.39305219349759
fp.CreateWithRaw(5983416338), // 1.39312267734063
fp.CreateWithRaw(5983719084), // 1.39319316589088
fp.CreateWithRaw(5984021850), // 1.39326365914889
fp.CreateWithRaw(5984324637), // 1.39333415711521
fp.CreateWithRaw(5984627443), // 1.3934046597904
fp.CreateWithRaw(5984930270), // 1.39347516717501
fp.CreateWithRaw(5985233117), // 1.39354567926959
fp.CreateWithRaw(5985535985), // 1.39361619607469
fp.CreateWithRaw(5985838872), // 1.39368671759087
fp.CreateWithRaw(5986141780), // 1.39375724381868
fp.CreateWithRaw(5986444708), // 1.39382777475868
fp.CreateWithRaw(5986747657), // 1.39389831041141
fp.CreateWithRaw(5987050625), // 1.39396885077743
fp.CreateWithRaw(5987353614), // 1.3940393958573
fp.CreateWithRaw(5987656623), // 1.39410994565157
fp.CreateWithRaw(5987959652), // 1.39418050016078
fp.CreateWithRaw(5988262702), // 1.39425105938551
fp.CreateWithRaw(5988565772), // 1.39432162332629
fp.CreateWithRaw(5988868862), // 1.39439219198368
fp.CreateWithRaw(5989171972), // 1.39446276535824
fp.CreateWithRaw(5989475103), // 1.39453334345053
fp.CreateWithRaw(5989778254), // 1.39460392626109
fp.CreateWithRaw(5990081425), // 1.39467451379047
fp.CreateWithRaw(5990384616), // 1.39474510603924
fp.CreateWithRaw(5990687828), // 1.39481570300795
fp.CreateWithRaw(5990991060), // 1.39488630469716
fp.CreateWithRaw(5991294312), // 1.39495691110741
fp.CreateWithRaw(5991597585), // 1.39502752223926
fp.CreateWithRaw(5991900877), // 1.39509813809327
fp.CreateWithRaw(5992204190), // 1.39516875866999
fp.CreateWithRaw(5992507524), // 1.39523938396998
fp.CreateWithRaw(5992810877), // 1.39531001399379
fp.CreateWithRaw(5993114251), // 1.39538064874197
fp.CreateWithRaw(5993417646), // 1.39545128821509
fp.CreateWithRaw(5993721060), // 1.3955219324137
fp.CreateWithRaw(5994024495), // 1.39559258133834
fp.CreateWithRaw(5994327950), // 1.39566323498959
fp.CreateWithRaw(5994631425), // 1.39573389336799
fp.CreateWithRaw(5994934921), // 1.3958045564741
fp.CreateWithRaw(5995238437), // 1.39587522430847
fp.CreateWithRaw(5995541974), // 1.39594589687167
fp.CreateWithRaw(5995845530), // 1.39601657416424
fp.CreateWithRaw(5996149107), // 1.39608725618674
fp.CreateWithRaw(5996452704), // 1.39615794293974
fp.CreateWithRaw(5996756322), // 1.39622863442378
fp.CreateWithRaw(5997059960), // 1.39629933063941
fp.CreateWithRaw(5997363618), // 1.39637003158721
fp.CreateWithRaw(5997667297), // 1.39644073726772
fp.CreateWithRaw(5997970996), // 1.3965114476815
fp.CreateWithRaw(5998274715), // 1.39658216282911
fp.CreateWithRaw(5998578455), // 1.3966528827111
fp.CreateWithRaw(5998882215), // 1.39672360732803
fp.CreateWithRaw(5999185995), // 1.39679433668045
fp.CreateWithRaw(5999489795), // 1.39686507076893
fp.CreateWithRaw(5999793616), // 1.39693580959402
fp.CreateWithRaw(6000097458), // 1.39700655315628
fp.CreateWithRaw(6000401319), // 1.39707730145627
fp.CreateWithRaw(6000705201), // 1.39714805449454
fp.CreateWithRaw(6001009104), // 1.39721881227164
fp.CreateWithRaw(6001313026), // 1.39728957478815
fp.CreateWithRaw(6001616969), // 1.3973603420446
fp.CreateWithRaw(6001920933), // 1.39743111404157
fp.CreateWithRaw(6002224916), // 1.39750189077961
fp.CreateWithRaw(6002528921), // 1.39757267225928
fp.CreateWithRaw(6002832945), // 1.39764345848113
fp.CreateWithRaw(6003136990), // 1.39771424944573
fp.CreateWithRaw(6003441055), // 1.39778504515363
fp.CreateWithRaw(6003745141), // 1.39785584560538
fp.CreateWithRaw(6004049247), // 1.39792665080156
fp.CreateWithRaw(6004353373), // 1.39799746074271
fp.CreateWithRaw(6004657520), // 1.39806827542939
fp.CreateWithRaw(6004961687), // 1.39813909486217
fp.CreateWithRaw(6005265875), // 1.3982099190416
fp.CreateWithRaw(6005570083), // 1.39828074796824
fp.CreateWithRaw(6005874311), // 1.39835158164264
fp.CreateWithRaw(6006178560), // 1.39842242006538
fp.CreateWithRaw(6006482829), // 1.398493263237
fp.CreateWithRaw(6006787118), // 1.39856411115806
fp.CreateWithRaw(6007091428), // 1.39863496382913
fp.CreateWithRaw(6007395758), // 1.39870582125077
fp.CreateWithRaw(6007700109), // 1.39877668342352
fp.CreateWithRaw(6008004480), // 1.39884755034796
fp.CreateWithRaw(6008308872), // 1.39891842202464
fp.CreateWithRaw(6008613284), // 1.39898929845412
fp.CreateWithRaw(6008917716), // 1.39906017963696
fp.CreateWithRaw(6009222169), // 1.39913106557372
fp.CreateWithRaw(6009526642), // 1.39920195626495
fp.CreateWithRaw(6009831136), // 1.39927285171123
fp.CreateWithRaw(6010135650), // 1.39934375191311
fp.CreateWithRaw(6010440184), // 1.39941465687115
fp.CreateWithRaw(6010744739), // 1.3994855665859
fp.CreateWithRaw(6011049315), // 1.39955648105794
fp.CreateWithRaw(6011353910), // 1.39962740028781
fp.CreateWithRaw(6011658527), // 1.39969832427609
fp.CreateWithRaw(6011963163), // 1.39976925302333
fp.CreateWithRaw(6012267820), // 1.39984018653008
fp.CreateWithRaw(6012572498), // 1.39991112479692
fp.CreateWithRaw(6012877196), // 1.3999820678244
fp.CreateWithRaw(6013181914), // 1.40005301561309
fp.CreateWithRaw(6013486653), // 1.40012396816354
fp.CreateWithRaw(6013791412), // 1.40019492547631
fp.CreateWithRaw(6014096192), // 1.40026588755197
fp.CreateWithRaw(6014400992), // 1.40033685439108
fp.CreateWithRaw(6014705813), // 1.40040782599419
fp.CreateWithRaw(6015010654), // 1.40047880236187
fp.CreateWithRaw(6015315516), // 1.40054978349469
fp.CreateWithRaw(6015620398), // 1.40062076939319
fp.CreateWithRaw(6015925301), // 1.40069176005796
fp.CreateWithRaw(6016230224), // 1.40076275548953
fp.CreateWithRaw(6016535167), // 1.40083375568848
fp.CreateWithRaw(6016840131), // 1.40090476065538
fp.CreateWithRaw(6017145116), // 1.40097577039077
fp.CreateWithRaw(6017450121), // 1.40104678489523
fp.CreateWithRaw(6017755146), // 1.40111780416931
fp.CreateWithRaw(6018060192), // 1.40118882821358
fp.CreateWithRaw(6018365259), // 1.40125985702859
fp.CreateWithRaw(6018670346), // 1.40133089061492
fp.CreateWithRaw(6018975453), // 1.40140192897312
fp.CreateWithRaw(6019280581), // 1.40147297210376
fp.CreateWithRaw(6019585729), // 1.4015440200074
fp.CreateWithRaw(6019890898), // 1.4016150726846
fp.CreateWithRaw(6020196088), // 1.40168613013593
fp.CreateWithRaw(6020501298), // 1.40175719236194
fp.CreateWithRaw(6020806528), // 1.4018282593632
fp.CreateWithRaw(6021111779), // 1.40189933114028
fp.CreateWithRaw(6021417051), // 1.40197040769373
fp.CreateWithRaw(6021722342), // 1.40204148902412
fp.CreateWithRaw(6022027655), // 1.40211257513201
fp.CreateWithRaw(6022332988), // 1.40218366601797
fp.CreateWithRaw(6022638342), // 1.40225476168256
fp.CreateWithRaw(6022943716), // 1.40232586212634
fp.CreateWithRaw(6023249110), // 1.40239696734988
fp.CreateWithRaw(6023554525), // 1.40246807735374
fp.CreateWithRaw(6023859961), // 1.40253919213849
fp.CreateWithRaw(6024165417), // 1.40261031170468
fp.CreateWithRaw(6024470894), // 1.40268143605289
fp.CreateWithRaw(6024776391), // 1.40275256518367
fp.CreateWithRaw(6025081909), // 1.40282369909759
fp.CreateWithRaw(6025387448), // 1.40289483779521
fp.CreateWithRaw(6025693006), // 1.40296598127711
fp.CreateWithRaw(6025998586), // 1.40303712954383
fp.CreateWithRaw(6026304186), // 1.40310828259596
fp.CreateWithRaw(6026609807), // 1.40317944043405
fp.CreateWithRaw(6026915448), // 1.40325060305866
fp.CreateWithRaw(6027221109), // 1.40332177047037
fp.CreateWithRaw(6027526792), // 1.40339294266973
fp.CreateWithRaw(6027832495), // 1.40346411965731
fp.CreateWithRaw(6028138218), // 1.40353530143368
fp.CreateWithRaw(6028443962), // 1.4036064879994
fp.CreateWithRaw(6028749726), // 1.40367767935504
fp.CreateWithRaw(6029055512), // 1.40374887550116
fp.CreateWithRaw(6029361317), // 1.40382007643833
fp.CreateWithRaw(6029667144), // 1.40389128216711
fp.CreateWithRaw(6029972990), // 1.40396249268807
fp.CreateWithRaw(6030278858), // 1.40403370800177
fp.CreateWithRaw(6030584746), // 1.40410492810879
fp.CreateWithRaw(6030890654), // 1.40417615300967
fp.CreateWithRaw(6031196584), // 1.404247382705
fp.CreateWithRaw(6031502534), // 1.40431861719534
fp.CreateWithRaw(6031808504), // 1.40438985648125
fp.CreateWithRaw(6032114495), // 1.4044611005633
fp.CreateWithRaw(6032420507), // 1.40453234944205
fp.CreateWithRaw(6032726539), // 1.40460360311808
fp.CreateWithRaw(6033032592), // 1.40467486159195
fp.CreateWithRaw(6033338665), // 1.40474612486422
fp.CreateWithRaw(6033644759), // 1.40481739293546
fp.CreateWithRaw(6033950874), // 1.40488866580624
fp.CreateWithRaw(6034257009), // 1.40495994347712
fp.CreateWithRaw(6034563165), // 1.40503122594868
fp.CreateWithRaw(6034869341), // 1.40510251322147
fp.CreateWithRaw(6035175538), // 1.40517380529608
fp.CreateWithRaw(6035481756), // 1.40524510217305
fp.CreateWithRaw(6035787995), // 1.40531640385296
fp.CreateWithRaw(6036094254), // 1.40538771033638
fp.CreateWithRaw(6036400533), // 1.40545902162388
fp.CreateWithRaw(6036706834), // 1.40553033771602
fp.CreateWithRaw(6037013154), // 1.40560165861336
fp.CreateWithRaw(6037319496), // 1.40567298431649
fp.CreateWithRaw(6037625858), // 1.40574431482596
fp.CreateWithRaw(6037932241), // 1.40581565014234
fp.CreateWithRaw(6038238645), // 1.4058869902662
fp.CreateWithRaw(6038545069), // 1.40595833519811
fp.CreateWithRaw(6038851514), // 1.40602968493864
fp.CreateWithRaw(6039157979), // 1.40610103948835
fp.CreateWithRaw(6039464465), // 1.40617239884782
fp.CreateWithRaw(6039770972), // 1.4062437630176
fp.CreateWithRaw(6040077499), // 1.40631513199828
fp.CreateWithRaw(6040384047), // 1.40638650579042
fp.CreateWithRaw(6040690616), // 1.40645788439458
fp.CreateWithRaw(6040997206), // 1.40652926781133
fp.CreateWithRaw(6041303816), // 1.40660065604126
fp.CreateWithRaw(6041610447), // 1.40667204908491
fp.CreateWithRaw(6041917098), // 1.40674344694287
fp.CreateWithRaw(6042223770), // 1.4068148496157
fp.CreateWithRaw(6042530463), // 1.40688625710396
fp.CreateWithRaw(6042837176), // 1.40695766940824
fp.CreateWithRaw(6043143911), // 1.4070290865291
fp.CreateWithRaw(6043450666), // 1.4071005084671
fp.CreateWithRaw(6043757441), // 1.40717193522283
fp.CreateWithRaw(6044064237), // 1.40724336679684
fp.CreateWithRaw(6044371054), // 1.4073148031897
fp.CreateWithRaw(6044677892), // 1.407386244402
fp.CreateWithRaw(6044984750), // 1.40745769043428
fp.CreateWithRaw(6045291629), // 1.40752914128714
fp.CreateWithRaw(6045598529), // 1.40760059696113
fp.CreateWithRaw(6045905450), // 1.40767205745683
fp.CreateWithRaw(6046212391), // 1.4077435227748
fp.CreateWithRaw(6046519353), // 1.40781499291563
fp.CreateWithRaw(6046826336), // 1.40788646787986
fp.CreateWithRaw(6047133339), // 1.40795794766809
fp.CreateWithRaw(6047440363), // 1.40802943228087
fp.CreateWithRaw(6047747408), // 1.40810092171879
fp.CreateWithRaw(6048054473), // 1.4081724159824
fp.CreateWithRaw(6048361560), // 1.40824391507228
fp.CreateWithRaw(6048668667), // 1.40831541898901
fp.CreateWithRaw(6048975794), // 1.40838692773314
fp.CreateWithRaw(6049282943), // 1.40845844130526
fp.CreateWithRaw(6049590112), // 1.40852995970593
fp.CreateWithRaw(6049897302), // 1.40860148293573
fp.CreateWithRaw(6050204512), // 1.40867301099523
fp.CreateWithRaw(6050511744), // 1.40874454388499
fp.CreateWithRaw(6050818996), // 1.40881608160559
fp.CreateWithRaw(6051126269), // 1.40888762415761
fp.CreateWithRaw(6051433563), // 1.4089591715416
fp.CreateWithRaw(6051740877), // 1.40903072375815
fp.CreateWithRaw(6052048212), // 1.40910228080783
fp.CreateWithRaw(6052355568), // 1.40917384269121
fp.CreateWithRaw(6052662945), // 1.40924540940886
fp.CreateWithRaw(6052970342), // 1.40931698096135
fp.CreateWithRaw(6053277761), // 1.40938855734925
fp.CreateWithRaw(6053585200), // 1.40946013857314
fp.CreateWithRaw(6053892659), // 1.40953172463359
fp.CreateWithRaw(6054200140), // 1.40960331553118
fp.CreateWithRaw(6054507641), // 1.40967491126646
fp.CreateWithRaw(6054815164), // 1.40974651184003
fp.CreateWithRaw(6055122706), // 1.40981811725244
fp.CreateWithRaw(6055430270), // 1.40988972750428
fp.CreateWithRaw(6055737855), // 1.40996134259611
fp.CreateWithRaw(6056045460), // 1.41003296252851
fp.CreateWithRaw(6056353086), // 1.41010458730206
fp.CreateWithRaw(6056660733), // 1.41017621691731
fp.CreateWithRaw(6056968400), // 1.41024785137486
fp.CreateWithRaw(6057276089), // 1.41031949067527
fp.CreateWithRaw(6057583798), // 1.41039113481911
fp.CreateWithRaw(6057891528), // 1.41046278380696
fp.CreateWithRaw(6058199279), // 1.41053443763939
fp.CreateWithRaw(6058507051), // 1.41060609631698
fp.CreateWithRaw(6058814843), // 1.4106777598403
fp.CreateWithRaw(6059122657), // 1.41074942820992
fp.CreateWithRaw(6059430491), // 1.41082110142642
fp.CreateWithRaw(6059738346), // 1.41089277949037
fp.CreateWithRaw(6060046221), // 1.41096446240235
fp.CreateWithRaw(6060354118), // 1.41103615016292
fp.CreateWithRaw(6060662035), // 1.41110784277267
fp.CreateWithRaw(6060969974), // 1.41117954023217
fp.CreateWithRaw(6061277933), // 1.41125124254199
fp.CreateWithRaw(6061585913), // 1.41132294970271
fp.CreateWithRaw(6061893913), // 1.4113946617149
fp.CreateWithRaw(6062201935), // 1.41146637857914
fp.CreateWithRaw(6062509977), // 1.411538100296
fp.CreateWithRaw(6062818041), // 1.41160982686606
fp.CreateWithRaw(6063126125), // 1.41168155828989
fp.CreateWithRaw(6063434230), // 1.41175329456807
fp.CreateWithRaw(6063742356), // 1.41182503570117
fp.CreateWithRaw(6064050502), // 1.41189678168977
fp.CreateWithRaw(6064358670), // 1.41196853253444
fp.CreateWithRaw(6064666858), // 1.41204028823576
fp.CreateWithRaw(6064975067), // 1.4121120487943
fp.CreateWithRaw(6065283297), // 1.41218381421064
fp.CreateWithRaw(6065591548), // 1.41225558448536
fp.CreateWithRaw(6065899820), // 1.41232735961903
fp.CreateWithRaw(6066208113), // 1.41239913961223
fp.CreateWithRaw(6066516427), // 1.41247092446553
fp.CreateWithRaw(6066824761), // 1.41254271417951
fp.CreateWithRaw(6067133116), // 1.41261450875474
fp.CreateWithRaw(6067441493), // 1.41268630819181
fp.CreateWithRaw(6067749890), // 1.41275811249128
fp.CreateWithRaw(6068058308), // 1.41282992165374
fp.CreateWithRaw(6068366747), // 1.41290173567977
fp.CreateWithRaw(6068675206), // 1.41297355456992
fp.CreateWithRaw(6068983687), // 1.4130453783248
fp.CreateWithRaw(6069292189), // 1.41311720694496
fp.CreateWithRaw(6069600711), // 1.413189040431
fp.CreateWithRaw(6069909255), // 1.41326087878348
fp.CreateWithRaw(6070217819), // 1.41333272200298
fp.CreateWithRaw(6070526404), // 1.41340457009008
fp.CreateWithRaw(6070835010), // 1.41347642304536
fp.CreateWithRaw(6071143637), // 1.41354828086939
fp.CreateWithRaw(6071452285), // 1.41362014356276
fp.CreateWithRaw(6071760954), // 1.41369201112603
fp.CreateWithRaw(6072069644), // 1.41376388355979
fp.CreateWithRaw(6072378354), // 1.41383576086462
fp.CreateWithRaw(6072687086), // 1.41390764304109
fp.CreateWithRaw(6072995838), // 1.41397953008977
fp.CreateWithRaw(6073304612), // 1.41405142201126
fp.CreateWithRaw(6073613406), // 1.41412331880612
fp.CreateWithRaw(6073922222), // 1.41419522047494
fp.CreateWithRaw(6074231058), // 1.41426712701829
fp.CreateWithRaw(6074539915), // 1.41433903843675
fp.CreateWithRaw(6074848793), // 1.41441095473091
fp.CreateWithRaw(6075157692), // 1.41448287590132
fp.CreateWithRaw(6075466612), // 1.41455480194859
fp.CreateWithRaw(6075775553), // 1.41462673287328
fp.CreateWithRaw(6076084515), // 1.41469866867598
fp.CreateWithRaw(6076393498), // 1.41477060935726
fp.CreateWithRaw(6076702502), // 1.4148425549177
fp.CreateWithRaw(6077011527), // 1.41491450535788
fp.CreateWithRaw(6077320572), // 1.41498646067838
fp.CreateWithRaw(6077629639), // 1.41505842087978
fp.CreateWithRaw(6077938727), // 1.41513038596266
fp.CreateWithRaw(6078247835), // 1.4152023559276
fp.CreateWithRaw(6078556965), // 1.41527433077518
fp.CreateWithRaw(6078866116), // 1.41534631050597
fp.CreateWithRaw(6079175287), // 1.41541829512057
fp.CreateWithRaw(6079484480), // 1.41549028461953
fp.CreateWithRaw(6079793693), // 1.41556227900346
fp.CreateWithRaw(6080102928), // 1.41563427827292
fp.CreateWithRaw(6080412183), // 1.4157062824285
fp.CreateWithRaw(6080721460), // 1.41577829147077
fp.CreateWithRaw(6081030757), // 1.41585030540033
fp.CreateWithRaw(6081340076), // 1.41592232421773
fp.CreateWithRaw(6081649415), // 1.41599434792358
fp.CreateWithRaw(6081958776), // 1.41606637651845
fp.CreateWithRaw(6082268157), // 1.41613841000291
fp.CreateWithRaw(6082577560), // 1.41621044837756
fp.CreateWithRaw(6082886983), // 1.41628249164296
fp.CreateWithRaw(6083196427), // 1.41635453979971
fp.CreateWithRaw(6083505893), // 1.41642659284838
fp.CreateWithRaw(6083815379), // 1.41649865078955
fp.CreateWithRaw(6084124887), // 1.4165707136238
fp.CreateWithRaw(6084434416), // 1.41664278135172
fp.CreateWithRaw(6084743965), // 1.41671485397389
fp.CreateWithRaw(6085053536), // 1.41678693149089
fp.CreateWithRaw(6085363127), // 1.41685901390329
fp.CreateWithRaw(6085672740), // 1.41693110121169
fp.CreateWithRaw(6085982374), // 1.41700319341666
fp.CreateWithRaw(6086292028), // 1.41707529051879
fp.CreateWithRaw(6086601704), // 1.41714739251865
fp.CreateWithRaw(6086911401), // 1.41721949941683
fp.CreateWithRaw(6087221119), // 1.41729161121391
fp.CreateWithRaw(6087530857), // 1.41736372791047
fp.CreateWithRaw(6087840617), // 1.4174358495071
fp.CreateWithRaw(6088150398), // 1.41750797600438
fp.CreateWithRaw(6088460200), // 1.41758010740288
fp.CreateWithRaw(6088770023), // 1.4176522437032
fp.CreateWithRaw(6089079867), // 1.41772438490591
fp.CreateWithRaw(6089389733), // 1.4177965310116
fp.CreateWithRaw(6089699619), // 1.41786868202085
fp.CreateWithRaw(6090009526), // 1.41794083793425
fp.CreateWithRaw(6090319454), // 1.41801299875236
fp.CreateWithRaw(6090629404), // 1.41808516447579
fp.CreateWithRaw(6090939374), // 1.41815733510511
fp.CreateWithRaw(6091249366), // 1.41822951064091
fp.CreateWithRaw(6091559379), // 1.41830169108376
fp.CreateWithRaw(6091869412), // 1.41837387643426
fp.CreateWithRaw(6092179467), // 1.41844606669298
fp.CreateWithRaw(6092489543), // 1.41851826186051
fp.CreateWithRaw(6092799640), // 1.41859046193743
fp.CreateWithRaw(6093109758), // 1.41866266692433
fp.CreateWithRaw(6093419897), // 1.41873487682179
fp.CreateWithRaw(6093730057), // 1.41880709163039
fp.CreateWithRaw(6094040239), // 1.41887931135072
fp.CreateWithRaw(6094350441), // 1.41895153598337
fp.CreateWithRaw(6094660665), // 1.41902376552891
fp.CreateWithRaw(6094970909), // 1.41909599998793
fp.CreateWithRaw(6095281175), // 1.41916823936101
fp.CreateWithRaw(6095591462), // 1.41924048364875
fp.CreateWithRaw(6095901770), // 1.41931273285172
fp.CreateWithRaw(6096212099), // 1.41938498697051
fp.CreateWithRaw(6096522449), // 1.4194572460057
fp.CreateWithRaw(6096832820), // 1.41952950995788
fp.CreateWithRaw(6097143213), // 1.41960177882764
fp.CreateWithRaw(6097453626), // 1.41967405261555
fp.CreateWithRaw(6097764061), // 1.41974633132221
fp.CreateWithRaw(6098074517), // 1.41981861494819
};
}
}
|
using System;
using System.Collections.Generic;
namespace Data.Model
{
public sealed class Profile
{
public string Id { get; set; }
public string DisplayName { get; set; }
public string ForwardingAddress { get; set; }
public DateTime CreatedUtc { get; set; }
// navigation properties
public ICollection<Address> Addresses { get; set; }
}
} |
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Persistence;
namespace GrowCreate.PipelineCRM.Services
{
public class DbService
{
[ThreadStatic]
private static volatile Database _db;
public static Database db()
{
var dbConn = new Database("umbracoDbDSN");
if (ConfigurationManager.ConnectionStrings["PipelineDb"] != null)
{
var _dbConn = new Database("PipelineDb");
if (_dbConn != null)
{
dbConn = _dbConn;
}
}
return _db ?? (_db = dbConn);
}
}
} |
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Strategy.Properties;
namespace Strategy.Library.Components
{
/// <summary>
/// Displays an exception.
/// </summary>
/// <remarks>Adapted from http://nickgravelyn.com/2008/10/catching-exceptions-on-xbox-360/. </remarks>
public class ExceptionDebugGame : Game
{
/// <summary>
/// The name of the font to display the exception with.
/// </summary>
public string FontName { get; set; }
/// <summary>
/// Creates a new execption debug game.
/// </summary>
/// <param name="exception">The exception to display.</param>
public ExceptionDebugGame(Exception exception)
{
Exception = exception;
FontName = "Fonts/TextLight";
new GraphicsDeviceManager(this)
{
PreferredBackBufferWidth = 1280,
PreferredBackBufferHeight = 720
};
// do not add this as a component because we do not want it to be
// reinitialized if the faulting game has already initialized it;
// instead we only want to call Update on it
_services = new GamerServicesComponent(this);
Content.RootDirectory = "Content";
}
protected override void LoadContent()
{
_font = Content.Load<SpriteFont>(FontName);
_spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void Update(GameTime gameTime)
{
if (!_messageDisplayed)
{
try
{
if (!Guide.IsVisible)
{
Guide.BeginShowMessageBox(
Resources.ExceptionMessageTitle,
Resources.ExceptionMessage,
new string[] { Resources.ExceptionMessageExit,
Resources.ExceptionMessageDebug },
0,
MessageBoxIcon.Error,
result =>
{
int? choice = Guide.EndShowMessageBox(result);
if (choice.HasValue && choice.Value == 0)
{
Exit();
}
},
null);
_messageDisplayed = true;
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e);
}
}
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
{
Exit();
}
_services.Update(gameTime);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
_spriteBatch.Begin();
_spriteBatch.DrawString(
_font,
Resources.ExceptionHeader,
new Vector2(100f, 100f),
Color.White);
_spriteBatch.DrawString(
_font,
Resources.ExceptionExitPrompt,
new Vector2(100f, 120f),
Color.White);
_spriteBatch.DrawString(
_font,
string.Format(Resources.ExceptionException, Exception.Message),
new Vector2(100f, 140f),
Color.White);
_spriteBatch.DrawString(
_font,
string.Format(Resources.ExceptionTrace, Exception.StackTrace),
new Vector2(100f, 160f),
Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
private bool _messageDisplayed = false;
private SpriteBatch _spriteBatch;
private SpriteFont _font;
private GamerServicesComponent _services;
private readonly Exception Exception;
}
}
|
using System.Collections.Generic;
using UnityEngine;
namespace Master
{
public interface IDustItemDatabase
{
IEnumerable<DustItemData> All();
}
public class DustItemDatabase : IDustItemDatabase
{
private DustItemData[] datas;
public DustItemDatabase()
{
Debug.Log("database initialize");
datas = Resources.LoadAll<DustItemData>("Items/");
}
public IEnumerable<DustItemData> All() => datas;
}
} |
/*
* Microsoft Public License (Ms-PL) - Copyright (c) 2020-2021 Sean Moss
* This file is subject to the terms and conditions of the Microsoft Public License, the text of which can be found in
* the 'LICENSE' file at the root of this repository, or online at <https://opensource.org/licenses/MS-PL>.
*/
using System;
using System.Runtime.InteropServices;
namespace Vega.Graphics
{
internal unsafe static partial class VSL
{
// Shader base types
public enum BaseType : byte
{
Void = 0,
Boolean = 1,
Signed = 2,
Unsigned = 3,
Float = 4,
Sampler = 5,
Image = 6,
ROBuffer = 7,
RWBuffer = 8,
ROTexels = 9,
RWTexels = 10
}
// Texel-type ranks
public enum TexelRank : byte
{
E1D = 0,
E2D = 1,
E3D = 2,
E1DArray = 3,
E2DArray = 4,
Cube = 5,
Buffer = 6
}
// Texel base types
public enum TexelType : byte
{
Signed = 0,
Unsigned = 1,
Float = 2,
UNorm = 3,
SNorm = 4
}
// Interface variable type (binary compatible)
[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct InterfaceVariable
{
[FieldOffset(0)] public byte Location;
[FieldOffset(1)] public BaseType BaseType;
[FieldOffset(2)] public fixed byte Dims[2];
[FieldOffset(4)] public byte ArraySize;
[FieldOffset(5)] public fixed byte _Padding_[3];
}
// Binding variable type (binary compatible)
[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct BindingVariable
{
// Shared fields
[FieldOffset(0)] public byte Slot;
[FieldOffset(1)] public BaseType BaseType;
[FieldOffset(2)] public ushort StageMask;
// Buffer fields
[FieldOffset(4)] public ushort BufferSize;
// Texel fields
[FieldOffset(4)] public TexelRank Rank;
[FieldOffset(5)] public TexelType TexelType;
[FieldOffset(6)] public byte TexelSize;
[FieldOffset(7)] public byte TexelComponents;
}
// Subpass input description (binary compatible)
[StructLayout(LayoutKind.Explicit, Size = 4)]
public struct SubpassInput
{
[FieldOffset(0)] public TexelType ComponentType;
[FieldOffset(1)] public byte ComponentCount;
[FieldOffset(2)] public fixed byte _Padding_[2];
}
// Struct member (binary compatible, without the variable length name)
[StructLayout(LayoutKind.Explicit, Size = 6)]
public struct StructMember
{
[FieldOffset(0)] public ushort Offset;
[FieldOffset(2)] public BaseType BaseType;
[FieldOffset(3)] public fixed byte Dims[2];
[FieldOffset(5)] public byte ArraySize;
}
// Parses a vertex format from a given base type and dimensions
private static VertexFormat? ParseVertexFormat(BaseType baseType, uint dim0, uint dim1) => baseType switch {
BaseType.Signed =>
(dim0 == 1) ? VertexFormat.Int : (dim0 == 2) ? VertexFormat.Int2 :
(dim0 == 3) ? VertexFormat.Int3 : VertexFormat.Int4,
BaseType.Unsigned =>
(dim0 == 1) ? VertexFormat.UInt : (dim0 == 2) ? VertexFormat.UInt2 :
(dim0 == 3) ? VertexFormat.UInt3 : VertexFormat.UInt4,
BaseType.Float => dim1 switch {
1 =>
(dim0 == 1) ? VertexFormat.Float : (dim0 == 2) ? VertexFormat.Float2 :
(dim0 == 3) ? VertexFormat.Float3 : VertexFormat.Float4,
2 =>
(dim0 == 2) ? VertexFormat.Float2x2 : (dim0 == 3) ? VertexFormat.Float2x3 : VertexFormat.Float2x4,
3 =>
(dim0 == 2) ? VertexFormat.Float3x2 : (dim0 == 3) ? VertexFormat.Float3x3 : VertexFormat.Float3x4,
4 =>
(dim0 == 2) ? VertexFormat.Float4x2 : (dim0 == 3) ? VertexFormat.Float4x3 : VertexFormat.Float4x4,
_ => null
},
_ => null
};
// Parses a texel format from a given base type and dimensions
private static TexelFormat? ParseTexelFormat(TexelType baseType, uint size, uint dim) => baseType switch {
TexelType.Signed =>
(dim == 1) ? TexelFormat.Int : (dim == 2) ? TexelFormat.Int2 : TexelFormat.Int4,
TexelType.Unsigned =>
(dim == 1) ? TexelFormat.UInt : (dim == 2) ? TexelFormat.UInt2 : TexelFormat.UInt4,
TexelType.Float =>
(dim == 1) ? TexelFormat.Float : (dim == 2) ? TexelFormat.Float2 : TexelFormat.Float4,
TexelType.UNorm =>
(size == 1)
? ((dim == 1) ? TexelFormat.UNorm : (dim == 2) ? TexelFormat.UNorm2 : TexelFormat.UNorm4)
: (size == 2)
? ((dim == 1) ? TexelFormat.U16Norm : (dim == 2) ? TexelFormat.U16Norm2 : TexelFormat.U16Norm4)
: null,
TexelType.SNorm =>
(size == 1)
? ((dim == 1) ? TexelFormat.SNorm : (dim == 2) ? TexelFormat.SNorm2 : TexelFormat.SNorm4)
: (size == 2)
? ((dim == 1) ? TexelFormat.S16Norm : (dim == 2) ? TexelFormat.S16Norm2 : TexelFormat.S16Norm4)
: null,
_ => null
};
// Parses a BindingType for a binding variable
private static BindingType? ParseBindingType(in BindingVariable bvar) => bvar.BaseType switch {
BaseType.Sampler => bvar.Rank switch {
TexelRank.E1D => BindingType.Sampler1D,
TexelRank.E2D => BindingType.Sampler2D,
TexelRank.E3D => BindingType.Sampler3D,
TexelRank.E1DArray => BindingType.Sampler1DArray,
TexelRank.E2DArray => BindingType.Sampler2DArray,
TexelRank.Cube => BindingType.SamplerCube,
_ => null
},
BaseType.Image => bvar.Rank switch {
TexelRank.E1D => BindingType.Image1D,
TexelRank.E2D => BindingType.Image2D,
TexelRank.E3D => BindingType.Image3D,
TexelRank.E1DArray => BindingType.Image1DArray,
TexelRank.E2DArray => BindingType.Image2DArray,
_ => null
},
BaseType.ROBuffer => BindingType.ROBuffer,
BaseType.RWBuffer => BindingType.RWBuffer,
BaseType.ROTexels => BindingType.ROTexels,
BaseType.RWTexels => BindingType.RWTexels,
_ => null
};
// Parses a texel type for a binding variable
private static TexelFormat? ParseBindingTexelFormat(in BindingVariable bvar) => bvar.BaseType switch {
BaseType.Sampler => bvar.TexelType switch {
TexelType.Signed => TexelFormat.Int4,
TexelType.Unsigned => TexelFormat.UInt4,
TexelType.Float => TexelFormat.Float4,
TexelType.UNorm =>
(bvar.TexelSize == 1) ? TexelFormat.UNorm4 : (bvar.TexelSize == 2) ? TexelFormat.U16Norm4 : null,
TexelType.SNorm =>
(bvar.TexelSize == 1) ? TexelFormat.SNorm4 : (bvar.TexelSize == 2) ? TexelFormat.S16Norm4 : null,
_ => null
},
BaseType.Image => ParseTexelFormat(bvar.TexelType, bvar.TexelSize, bvar.TexelComponents),
BaseType.ROTexels => bvar.TexelType switch {
TexelType.Signed => TexelFormat.Int4,
TexelType.Unsigned => TexelFormat.UInt4,
TexelType.Float => TexelFormat.Float4,
TexelType.UNorm =>
(bvar.TexelSize == 1) ? TexelFormat.UNorm4 : (bvar.TexelSize == 2) ? TexelFormat.U16Norm4 : null,
TexelType.SNorm =>
(bvar.TexelSize == 1) ? TexelFormat.SNorm4 : (bvar.TexelSize == 2) ? TexelFormat.S16Norm4 : null,
_ => null
},
BaseType.RWTexels => ParseTexelFormat(bvar.TexelType, bvar.TexelSize, bvar.TexelComponents),
_ => null
};
}
}
|
using System;
using System.IO;
using System.Reflection;
namespace DotnetActionsToolkit.Tests
{
public static class TestingUtils
{
public static string GetAssemblyDirectory()
{
var location = Assembly.GetExecutingAssembly().Location;
return Path.GetDirectoryName(location);
}
}
}
|
using System.Linq;
using System.Collections.Generic;
namespace DotAutomatedClassCreator
{
class DotParser
{
private string[] excludes = new string[] { "edge", "node", "graph" };
public DotParser()
{
}
public bool isFirstLineAGraphHeader(string str)
{
return str.Contains("digraph");
}
public bool isLineAClassBegining(string line){
return (line.Contains("[") && !excludes.Any(x => line.Contains(x)));
}
public string[] deleteLinesTillNextClass(string[] lines)
{
for (int i = 0; i < lines.Count(); i++)
{
if (isLineAClassBegining(lines[i]))
{
return lines.Skip(i).ToArray();
}
}
return null;
}
public List<string> parseLinesTillClassEnd(string[] lines)
{
int i = 0;
List<string> newClass = new List<string>();
string line = lines[i];
while (!line.Contains("]"))
{
newClass.Add(line);
i++;
line = lines[i];
}
newClass.Add(line);
return newClass;
}
}
} |
// using LibOptimization;
// using System;
// Console.WriteLine("Rodando!");
// //Instantiation objective Function
// var func = new LibOptimization.BenchmarkFunction.clsBenchRosenblock(2);
// //Instantiation optimization class and set objective function.
// var opt = new LibOptimization.Optimization.clsOptPSO(func);
// opt.Init();
// // //Do calc
// opt.DoIteration();
// //per 100 iteration
// while (opt.DoIteration(100) == false)
// {
// LibOptimization.Util.clsUtil.DebugValue(opt, ai_isOutValue: false);
// }
// LibOptimization.Util.clsUtil.DebugValue(opt);
// // //Check Error
// // if (opt.IsRecentError() == true)
// // {
// // return;
// // }
// // else
// // {
// // //Get Result
// // LibOptimization.Util.clsUtil.DebugValue(opt);
// // }
// Console.WriteLine("Done!"); |
using System;
using System.Threading.Tasks;
namespace TechTalk.SpecFlow.Bindings
{
public class BindingDelegateInvoker : IBindingDelegateInvoker
{
public virtual async Task<object> InvokeDelegateAsync(Delegate bindingDelegate, object[] invokeArgs)
{
if (typeof(Task).IsAssignableFrom(bindingDelegate.Method.ReturnType))
return await InvokeBindingDelegateAsync(bindingDelegate, invokeArgs);
return InvokeBindingDelegateSync(bindingDelegate, invokeArgs);
}
protected virtual object InvokeBindingDelegateSync(Delegate bindingDelegate, object[] invokeArgs)
{
return bindingDelegate.DynamicInvoke(invokeArgs);
}
protected virtual async Task<object> InvokeBindingDelegateAsync(Delegate bindingDelegate, object[] invokeArgs)
{
var r = bindingDelegate.DynamicInvoke(invokeArgs);
if (r is Task t)
await t;
return r;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace UniHumanoid
{
public interface ISkeletonDetector
{
Skeleton Detect(IList<IBone> bones);
}
public class BvhSkeletonEstimator : ISkeletonDetector
{
static IBone GetRoot(IList<IBone> bones)
{
var hips = bones.Where(x => x.Parent == null).ToArray();
if (hips.Length != 1)
{
throw new System.Exception("Require unique root");
}
return hips[0];
}
static IBone SelectBone(Func<IBone, IBone, IBone> selector, IList<IBone> bones)
{
if (bones == null || bones.Count == 0) throw new Exception("no bones");
var current = bones[0];
for (var i = 1; i < bones.Count; ++i)
{
current = selector(current, bones[i]);
}
return current;
}
static void GetSpineAndHips(IBone hips, out IBone spine, out IBone leg_L, out IBone leg_R)
{
if (hips.Children.Count != 3) throw new System.Exception("Hips require 3 children");
spine = SelectBone((l, r) => l.CenterOfDescendant().y > r.CenterOfDescendant().y ? l : r, hips.Children);
leg_L = SelectBone((l, r) => l.CenterOfDescendant().x < r.CenterOfDescendant().x ? l : r, hips.Children);
leg_R = SelectBone((l, r) => l.CenterOfDescendant().x > r.CenterOfDescendant().x ? l : r, hips.Children);
}
static void GetNeckAndArms(IBone chest, out IBone neck, out IBone arm_L, out IBone arm_R)
{
if (chest.Children.Count != 3) throw new System.Exception("Chest require 3 children");
neck = SelectBone((l, r) => l.CenterOfDescendant().y > r.CenterOfDescendant().y ? l : r, chest.Children);
arm_L = SelectBone((l, r) => l.CenterOfDescendant().x < r.CenterOfDescendant().x ? l : r, chest.Children);
arm_R = SelectBone((l, r) => l.CenterOfDescendant().x > r.CenterOfDescendant().x ? l : r, chest.Children);
}
struct Arm
{
public IBone Shoulder;
public IBone UpperArm;
public IBone LowerArm;
public IBone Hand;
}
Arm GetArm(IBone shoulder)
{
var bones = shoulder.Traverse().ToArray();
switch (bones.Length)
{
case 0:
case 1:
case 2:
case 3:
throw new NotImplementedException();
default:
return new Arm
{
Shoulder = bones[0],
UpperArm = bones[1],
LowerArm = bones[2],
Hand = bones[3],
};
}
}
struct Leg
{
public IBone UpperLeg;
public IBone LowerLeg;
public IBone Foot;
public IBone Toes;
}
Leg GetLeg(IBone leg)
{
var bones = leg.Traverse().Where(x => !x.Name.ToLower().Contains("buttock")).ToArray();
switch (bones.Length)
{
case 0:
case 1:
case 2:
throw new NotImplementedException();
case 3:
return new Leg
{
UpperLeg = bones[0],
LowerLeg = bones[1],
Foot = bones[2],
};
default:
return new Leg
{
UpperLeg = bones[bones.Length - 4],
LowerLeg = bones[bones.Length - 3],
Foot = bones[bones.Length - 2],
Toes = bones[bones.Length - 1],
};
}
}
public Skeleton Detect(IList<IBone> bones)
{
//
// search bones
//
var root = GetRoot(bones);
var hips = root.Traverse().First(x => x.Children.Count == 3);
IBone spine, hip_L, hip_R;
GetSpineAndHips(hips, out spine, out hip_L, out hip_R);
var legLeft = GetLeg(hip_L);
var legRight = GetLeg(hip_R);
var spineToChest = new List<IBone>();
foreach(var x in spine.Traverse())
{
spineToChest.Add(x);
if (x.Children.Count == 3) break;
}
IBone neck, shoulder_L, shoulder_R;
GetNeckAndArms(spineToChest.Last(), out neck, out shoulder_L, out shoulder_R);
var armLeft = GetArm(shoulder_L);
var armRight = GetArm(shoulder_R);
var neckToHead = neck.Traverse().ToArray();
//
// set result
//
var skeleton = new Skeleton();
skeleton.Set(HumanBodyBones.Hips, bones, hips);
switch (spineToChest.Count)
{
case 0:
throw new Exception();
case 1:
skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
break;
case 2:
skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
break;
#if UNITY_5_6_OR_NEWER
case 3:
skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
skeleton.Set(HumanBodyBones.UpperChest, bones, spineToChest[2]);
break;
#endif
default:
skeleton.Set(HumanBodyBones.Spine, bones, spineToChest[0]);
#if UNITY_5_6_OR_NEWER
skeleton.Set(HumanBodyBones.Chest, bones, spineToChest[1]);
skeleton.Set(HumanBodyBones.UpperChest, bones, spineToChest.Last());
#else
skeleton.Set(HumanBodyBones.Chest, bones, spineToChest.Last());
#endif
break;
}
switch (neckToHead.Length)
{
case 0:
throw new Exception();
case 1:
skeleton.Set(HumanBodyBones.Head, bones, neckToHead[0]);
break;
case 2:
skeleton.Set(HumanBodyBones.Neck, bones, neckToHead[0]);
skeleton.Set(HumanBodyBones.Head, bones, neckToHead[1]);
break;
default:
skeleton.Set(HumanBodyBones.Neck, bones, neckToHead[0]);
skeleton.Set(HumanBodyBones.Head, bones, neckToHead.Where(x => x.Parent.Children.Count==1).Last());
break;
}
skeleton.Set(HumanBodyBones.LeftUpperLeg, bones, legLeft.UpperLeg);
skeleton.Set(HumanBodyBones.LeftLowerLeg, bones, legLeft.LowerLeg);
skeleton.Set(HumanBodyBones.LeftFoot, bones, legLeft.Foot);
skeleton.Set(HumanBodyBones.LeftToes, bones, legLeft.Toes);
skeleton.Set(HumanBodyBones.RightUpperLeg, bones, legRight.UpperLeg);
skeleton.Set(HumanBodyBones.RightLowerLeg, bones, legRight.LowerLeg);
skeleton.Set(HumanBodyBones.RightFoot, bones, legRight.Foot);
skeleton.Set(HumanBodyBones.RightToes, bones, legRight.Toes);
skeleton.Set(HumanBodyBones.LeftShoulder, bones, armLeft.Shoulder);
skeleton.Set(HumanBodyBones.LeftUpperArm, bones, armLeft.UpperArm);
skeleton.Set(HumanBodyBones.LeftLowerArm, bones, armLeft.LowerArm);
skeleton.Set(HumanBodyBones.LeftHand, bones, armLeft.Hand);
skeleton.Set(HumanBodyBones.RightShoulder, bones, armRight.Shoulder);
skeleton.Set(HumanBodyBones.RightUpperArm, bones, armRight.UpperArm);
skeleton.Set(HumanBodyBones.RightLowerArm, bones, armRight.LowerArm);
skeleton.Set(HumanBodyBones.RightHand, bones, armRight.Hand);
return skeleton;
}
public Skeleton Detect(Bvh bvh)
{
var root = new BvhBone(bvh.Root.Name, Vector3.zero);
root.Build(bvh.Root);
return Detect(root.Traverse().Select(x => (IBone)x).ToList());
}
public Skeleton Detect(Transform t)
{
var root = new BvhBone(t.name, Vector3.zero);
root.Build(t);
return Detect(root.Traverse().Select(x => (IBone)x).ToList());
}
}
}
|
using System;
using HandHistories.Objects.Hand;
namespace HandHistories.Parser.Compression
{
public class HandHistoryTinyFormatCompressorImpl : IHandHistoryCompressor
{
public string CompressHandHistory(string fullHandText)
{
throw new NotImplementedException();
}
public string UncompressHandHistory(string compressedHandHistory)
{
throw new NotImplementedException();
}
public string CompressHandHistory(HandHistory parsedHandHistory)
{
throw new NotImplementedException();
}
}
}
|
using Microsoft.Extensions.Logging;
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace LoggingScopeSample
{
class SampleController
{
private readonly ILogger<SampleController> _logger;
public SampleController(ILogger<SampleController> logger)
{
_logger = logger;
_logger.LogTrace("ILogger injected into {0}", nameof(SampleController));
}
public async Task NetworkRequestSampleAsync(string url)
{
using (_logger.BeginScope("NetworkRequestSampleAsync, url: {0}", url))
{
try
{
_logger.LogInformation(LoggingEvents.Networking, "Started");
var client = new HttpClient();
string result = await client.GetStringAsync(url);
_logger.LogInformation(LoggingEvents.Networking, "Completed with characters {0} received", result.Length);
}
catch (Exception ex)
{
_logger.LogError(LoggingEvents.Networking, ex, "Error, error message: {0}, HResult: {1}", ex.Message, ex.HResult);
}
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using DeckGenerator.IO;
namespace DeckGenerator
{
public class DeckGenerator
{
public string PathToImages;
public string TargetPath;
public string TargetImagesPath => Path.Join(TargetPath, "images");
public string FinalFilePath = "";
public List<CardItem> CardsData;
public DeckGenerator(string targetPath, string pathToImages, List<CardItem> cardsData)
{
PathToImages = pathToImages;
TargetPath = targetPath;
CardsData = cardsData;
}
public void Generate()
{
Console.WriteLine("Generating folder structure...");
GenerateFolderStructure();
Console.WriteLine("Building deck json...");
string json = DeckJsonBuilder.CreateDeckJson(GenerateCardItems());
Console.WriteLine("Saving data.json at target path...");
File.WriteAllText(Path.Join(TargetPath, "data.json"), json);
Console.WriteLine("Moving images to target directory...");
MoveImagesToTargetDirectory();
Console.WriteLine("Zipping deck...");
ZipDeck();
Console.WriteLine("Clearing files...");
DeleteDirectory(TargetPath);
}
private void GenerateFolderStructure()
{
Directory.CreateDirectory(TargetPath);
Directory.CreateDirectory(TargetImagesPath);
}
private List<CardItem> GenerateCardItems()
{
List<CardItem> cardItems = new List<CardItem>();
for (var i = 0; i < CardsData.Count; i++)
{
var cardData = CardsData[i];
cardItems.Add(new CardItem(cardData.Answer, $"image{i}.jpg", cardData.Description));
}
return cardItems;
}
private void MoveImagesToTargetDirectory()
{
if (Directory.Exists(DeckIO.TempImageFolder))
{
if (Directory.GetFiles(TargetImagesPath).Length > 0)
{
RemoveImagesFromDirectory();
}
string[] filesPath = Directory.GetFiles(DeckIO.TempImageFolder);
for (var i = 0; i < filesPath.Length; i++)
{
var filePath = filesPath[i];
File.Move(filePath, Path.Join(TargetImagesPath, $"image{i}.jpg"));
}
}
else
{
Console.WriteLine($"Path to downloaded images doesn't exist. {DeckIO.TempImageFolder}");
}
}
private void RemoveImagesFromDirectory()
{
string[] filePaths = Directory.GetFiles(TargetImagesPath);
foreach (var filePath in filePaths)
{
File.Delete(filePath);
}
}
private void ZipDeck()
{
string directoryName = Path.GetDirectoryName(TargetPath);
string targetFileName = $"{directoryName}.deck";
if (File.Exists(targetFileName))
{
File.Delete(targetFileName);
}
ZipFile.CreateFromDirectory(TargetPath,targetFileName, CompressionLevel.Optimal, true);
FinalFilePath = targetFileName;
}
public void DeleteDirectory(string targetDir)
{
string[] files = Directory.GetFiles(targetDir);
string[] dirs = Directory.GetDirectories(targetDir);
foreach (string file in files)
{
File.SetAttributes(file, FileAttributes.Normal);
File.Delete(file);
}
foreach (string dir in dirs)
{
DeleteDirectory(dir);
}
Directory.Delete(targetDir, false);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AMP.Models;
using AMP.Utilities;
namespace AMP.WorkflowClasses
{
public class RequestBuilder:WorkflowBuilderBase
{
public RequestBuilder(WorkflowMaster workflowMaster, IAMPRepository ampRepository, string userId)
{
_ampRepository = ampRepository;
_userId = userId;
_workflow = workflowMaster;
}
public void BuildWorkflowMaster()
{
SetStageAwaitingApproval();
SetRequestStepId();
SetActionBy();
SetActionDate();
SetStatusActive();
SetAuditData();
SetWorkflowId();
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.