content stringlengths 23 1.05M |
|---|
using UnityEngine;
using UnityEngine.Assertions;
public class ProjectionManagerRoomSample : MonoBehaviour
{
#region Field
public ProjectionManagerRoom projectionManager;
public Camera cameraFront;
public Camera cameraLeft;
public Camera cameraRight;
public Camera cameraBack;
public Camera cameraBottom;
public int resolutionX = 1920;
public int resolutionY = 1080;
public int resolutionZ = 0;
protected RenderTexture renderTextureFront;
protected RenderTexture renderTextureLeft;
protected RenderTexture renderTextureRight;
protected RenderTexture renderTextureBack;
protected RenderTexture renderTextureBottom;
#endregion Field
#region Method
protected virtual void Awake()
{
Assert.IsNotNull<Camera>(this.cameraFront);
Assert.IsNotNull<Camera>(this.cameraLeft);
Assert.IsNotNull<Camera>(this.cameraRight);
Assert.IsNotNull<Camera>(this.cameraBack);
Assert.IsNotNull<Camera>(this.cameraBottom);
this.renderTextureFront = new RenderTexture(resolutionX, resolutionY, resolutionZ);
this.renderTextureLeft = new RenderTexture(resolutionX, resolutionY, resolutionZ);
this.renderTextureRight = new RenderTexture(resolutionX, resolutionY, resolutionZ);
this.renderTextureBack = new RenderTexture(resolutionX, resolutionY, resolutionZ);
this.renderTextureBottom = new RenderTexture(resolutionX, resolutionY, resolutionZ);
this.cameraFront.targetTexture = this.renderTextureFront;
this.cameraLeft.targetTexture = this.renderTextureLeft;
this.cameraRight.targetTexture = this.renderTextureRight;
this.cameraBack.targetTexture = this.renderTextureBack;
this.cameraBottom.targetTexture = this.renderTextureBottom;
this.projectionManager.textureFront = this.renderTextureFront;
this.projectionManager.textureLeft = this.renderTextureLeft;
this.projectionManager.textureRight = this.renderTextureRight;
this.projectionManager.textureBack = this.renderTextureBack;
this.projectionManager.textureBottom = this.renderTextureBottom;
}
protected virtual void OnDestroy()
{
// NOTE:
// Camera shows null in sometimes. For example when scene will be closed.
ClearRenderTarget(this.cameraFront);
ClearRenderTarget(this.cameraLeft);
ClearRenderTarget(this.cameraRight);
ClearRenderTarget(this.cameraBack);
ClearRenderTarget(this.cameraBottom);
DestroyImmediate(this.renderTextureFront);
DestroyImmediate(this.renderTextureLeft);
DestroyImmediate(this.renderTextureRight);
DestroyImmediate(this.renderTextureBack);
DestroyImmediate(this.renderTextureBottom);
}
protected virtual void ClearRenderTarget(Camera camera)
{
if (camera != null)
{
camera.targetTexture = null;
}
}
#endregion Method
} |
using Microsoft.AspNetCore.Mvc;
namespace FSL.eBook.RWP.ED2Core.DesignPatterns.UnitOfWorkChapter.Scenario2
{
public sealed class UnitOfWorkController :
Controller
{
private readonly IUnitOfWork _unitOfWork;
public UnitOfWorkController(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public IActionResult Index()
{
var product = new Product()
{
Id = 1,
Name = "product 1"
};
var payment = new Payment()
{
Id = 1,
Name = "product 1",
ProductId = product.Id
};
_unitOfWork.Add(product);
_unitOfWork.Add(payment);
_unitOfWork.Commit();
return Content("Unit Of Work Pattern");
}
}
} |
using FeedbackApi;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<FeedbackDbContext>(options =>
options.UseInMemoryDatabase(builder.Environment.ApplicationName));
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new() { Title = builder.Environment.ApplicationName, Version = "v1" });
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", $"{builder.Environment.ApplicationName} v1"));
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.MapGet("/feedbacks", async (FeedbackDbContext db) =>
{
return await db.Feedbacks.ToListAsync();
});
app.MapGet("/feedbacks/{id}", async (FeedbackDbContext db, string id) =>
{
return await db.Feedbacks.Include(x => x.Attachments).FirstOrDefaultAsync(x => x.Id == id)
is Feedback feedback ? Results.Ok(feedback) : Results.NotFound();
});
app.MapPost("/feedbacks", async (FeedbackDbContext db, Feedback feedback) =>
{
db.Add(feedback);
await db.SaveChangesAsync();
return Results.Created($"/feedbacks/{feedback.Id}", feedback);
});
app.MapPut("/feedbacks/{id}", async (FeedbackDbContext db, string id, Feedback feedback) =>
{
if (id != feedback.Id)
{
return Results.BadRequest();
}
if (!await db.Feedbacks.AnyAsync(x => x.Id == id))
{
return Results.NotFound();
}
db.Update(feedback);
await db.SaveChangesAsync();
return Results.Ok();
});
app.MapDelete("/feedbacks/{id}", async (FeedbackDbContext db, string id) =>
{
var feedback = await db.Feedbacks.FindAsync(id);
if (feedback is null)
{
return Results.NotFound();
}
db.Remove(feedback);
await db.SaveChangesAsync();
return Results.Ok();
});
app.Run();
|
using EMS.Event_Services.API.Context.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace EMS.Event_Services.API.Context.EntityConfigurations
{
class SubscriptionEntityTypeConfiguration
: IEntityTypeConfiguration<ClubSubscription>
{
public void Configure(EntityTypeBuilder<ClubSubscription> builder)
{
builder.ToTable("ClubSubscription");
builder.HasKey(ci => ci.ClubSubscriptionId);
builder.HasOne<Club>()
.WithMany()
.HasForeignKey(ci => ci.ClubId);
}
}
} |
namespace ZetaResourceEditor.UI.Helper.Grid
{
using DevExpress.XtraGrid.Views.Grid;
using Zeta.EnterpriseLibrary.Tools.Storage;
internal class FilterSerializer :
LayoutSerializerBase
{
public FilterSerializer(
GridView gridView,
IPersistentPairStorage storage,
string key) :
base(gridView, storage, key)
{
}
protected override string KeyPrefix
{
get
{
return @"Filter";
}
}
public override void Reset()
{
base.Reset();
gridView.ClearColumnsFilter();
if (gridView.ActiveFilter != null)
{
gridView.ActiveFilter.Clear();
}
gridView.ActiveFilterEnabled = false;
gridView.ActiveFilterCriteria = null;
gridView.ActiveFilterString = null;
if (gridView.MRUFilters != null)
{
gridView.MRUFilters.Clear();
}
}
protected override string[] Fields
{
get
{
return
new[]
{
//@"ActiveFilterEnabled",
@"ActiveFilterString"
//@"MRUFilters",
//@"ActiveFilter",
};
}
}
}
} |
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Effects;
namespace Microsoft.Expression.Media.Effects
{
public sealed class ColorToneEffect : ShaderEffect
{
public ColorToneEffect()
{
base.PixelShader = new PixelShader
{
UriSource = Global.MakePackUri("Shaders/ColorTone.ps")
};
base.UpdateShaderValue(ColorToneEffect.InputProperty);
base.UpdateShaderValue(ColorToneEffect.DesaturationProperty);
base.UpdateShaderValue(ColorToneEffect.ToneAmountProperty);
base.UpdateShaderValue(ColorToneEffect.LightColorProperty);
base.UpdateShaderValue(ColorToneEffect.DarkColorProperty);
}
public double Desaturation
{
get
{
return (double)base.GetValue(ColorToneEffect.DesaturationProperty);
}
set
{
base.SetValue(ColorToneEffect.DesaturationProperty, value);
}
}
public double ToneAmount
{
get
{
return (double)base.GetValue(ColorToneEffect.ToneAmountProperty);
}
set
{
base.SetValue(ColorToneEffect.ToneAmountProperty, value);
}
}
public Color LightColor
{
get
{
return (Color)base.GetValue(ColorToneEffect.LightColorProperty);
}
set
{
base.SetValue(ColorToneEffect.LightColorProperty, value);
}
}
public Color DarkColor
{
get
{
return (Color)base.GetValue(ColorToneEffect.DarkColorProperty);
}
set
{
base.SetValue(ColorToneEffect.DarkColorProperty, value);
}
}
private Brush Input
{
get
{
return (Brush)base.GetValue(ColorToneEffect.InputProperty);
}
set
{
base.SetValue(ColorToneEffect.InputProperty, value);
}
}
private const double DefaultDesaturation = 0.5;
private const double DefaultToneAmount = 0.5;
private static readonly Color DefaultLightColor = Color.FromArgb(byte.MaxValue, byte.MaxValue, 229, 128);
private static readonly Color DefaultDarkColor = Color.FromArgb(byte.MaxValue, 51, 128, 0);
public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(ColorToneEffect), 0);
public static readonly DependencyProperty DesaturationProperty = DependencyProperty.Register("Desaturation", typeof(double), typeof(ColorToneEffect), new PropertyMetadata(0.5, ShaderEffect.PixelShaderConstantCallback(0)));
public static readonly DependencyProperty ToneAmountProperty = DependencyProperty.Register("ToneAmount", typeof(double), typeof(ColorToneEffect), new PropertyMetadata(0.5, ShaderEffect.PixelShaderConstantCallback(1)));
public static readonly DependencyProperty LightColorProperty = DependencyProperty.Register("LightColor", typeof(Color), typeof(ColorToneEffect), new PropertyMetadata(ColorToneEffect.DefaultLightColor, ShaderEffect.PixelShaderConstantCallback(2)));
public static readonly DependencyProperty DarkColorProperty = DependencyProperty.Register("DarkColor", typeof(Color), typeof(ColorToneEffect), new PropertyMetadata(ColorToneEffect.DefaultDarkColor, ShaderEffect.PixelShaderConstantCallback(3)));
}
}
|
using System;
using System.Windows;
using Microsoft.Xaml.Behaviors;
namespace UtcTickTime.Behaviors
{
public class CleanupBehavior : Behavior<Window>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.Closed += Closed;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.Closed -= Closed;
}
private void Closed(object sender, EventArgs e)
{
if (AssociatedObject.DataContext is IDisposable disposable)
disposable.Dispose();
}
}
} |
using System.Net.Mime;
using Microsoft.AspNetCore.Mvc;
using TotalDecoupling.BusinessLayer.Services.Interfaces;
namespace TotalDecoupling.Controllers;
[ApiController]
[Route("api/[controller]")]
[Produces(MediaTypeNames.Application.Json)]
public class ImageController : ControllerBase
{
private readonly IImageService imageService;
public ImageController(IImageService imageService)
{
this.imageService = imageService;
}
[HttpGet]
public async Task<IActionResult> GetImage()
=> CreateResponse(await imageService.GetImageAsync());
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YxFramwork.Common.Model;
using YxFramwork.Framework;
using YxFramwork.Framework.Core;
using YxFramwork.Manager;
using YxFramwork.View;
namespace Assets.Scripts.Hall.View.TaskWindows
{
public class TaskBindPhoneView : TaskBasseView
{
/// <summary>
/// 手机号输入
/// </summary>
public UIInput MobileNumInput;
/// <summary>
/// 手机号显示
/// </summary>
public UILabel MobileNumLabel;
/// <summary>
/// 绑定验证码输入
/// </summary>
public UIInput BindVerificationInput;
/// <summary>
/// 解绑验证码输入
/// </summary>
public UIInput UnBindVerificationInput;
/// <summary>
/// 验证周期(s)
/// </summary>
public int VerificationCyc = 60;
/// <summary>
/// 验证码倒计时格式
/// </summary>
public string VerifTimeFormat = "({0})";
/// <summary>
/// 必须绑定
/// </summary>
public bool MustFillin;
protected override void OnStart()
{
var mobileNum = UserInfoModel.Instance.UserInfo.PhoneNumber;
ChangeState(!string.IsNullOrEmpty(mobileNum));
MobileNumLabel.text = mobileNum;
MobileNumInput.value = mobileNum;
}
private UIButton _veriBtn;
private UILabel _verifyLabel;
/// <summary>
/// 发送验证码请求
/// </summary>
public void OnSendVerification(UIButton btn,UILabel label)
{
if (!btn.isEnabled)
{
YxMessageTip.Show("验证码已发送,请稍后再试!");
return;
}
_veriBtn = btn;
_verifyLabel = label;
var phone = MobileNumInput.value;
if (string.IsNullOrEmpty(phone) || phone.Length<11)
{
YxMessageBox.Show("请输入手机号码!!!");
return;
}
btn.isEnabled = false;
var parm = new Dictionary<string, object>();
parm["phone"] = phone;
Facade.Instance<TwManager>().SendAction("sendTelephoneVerify", parm, OnVerificationSuccess, true, OnFaile);
_coroutine = StartCoroutine(VerifFinishCyc(btn, label));
}
private Coroutine _coroutine;
private void OnFaile(object msg)
{
if (_coroutine != null)
{
StopCoroutine(_coroutine);
}
if(_veriBtn!=null) _veriBtn.isEnabled = true;
if (_verifyLabel != null) _verifyLabel.text = "";
if (!(msg is IDictionary<string, object>)) return;
var dict = (IDictionary<string, object>) msg;
var emsgobj = dict["errorMessages"];
if (!(emsgobj is Dictionary<string, object>)) return;
var emsDict = emsgobj as Dictionary<string, object>;
if (!emsDict.ContainsKey("sendTelephoneVerify")) return;
var actionMsgObj = emsDict["sendTelephoneVerify"];
var emsg = actionMsgObj == null ? "" : actionMsgObj.ToString();
YxMessageBox.Show(emsg);
}
private IEnumerator VerifFinishCyc(UIButtonColor btn, UILabel label)
{
btn.isEnabled = false;
if (label != null)
{
label.gameObject.SetActive(true);
var waitOnce = new WaitForSeconds(1);
var total = VerificationCyc;
while (total>=0)
{
label.text = string.Format(VerifTimeFormat, total--);
yield return waitOnce;
}
label.gameObject.SetActive(false);
}
else
{
yield return new WaitForSeconds(VerificationCyc);
}
btn.isEnabled = true;
}
/// <summary>
/// 验证码请求成功
/// </summary>
/// <param name="msg"></param>
private void OnVerificationSuccess(object msg)
{
ShowInfos(msg,"验证码已发送,请查看您的手机",3);
}
/// <summary>
/// 发送绑定手机
/// </summary>
public void OnSendBindPhone()
{
var mobile = MobileNumInput.value;
if (string.IsNullOrEmpty(mobile))
{
YxMessageBox.Show("请输入手机号码!!!");
return;
}
var verification = BindVerificationInput.value;
if (string.IsNullOrEmpty(verification))
{
YxMessageBox.Show("请输入验证码!!!");
return;
}
var pram = new Dictionary<string, object>();
pram["phone"] = mobile;
pram["verify"] = verification;
Facade.Instance<TwManager>().SendAction("getBindPhoneAward", pram, BoundphoneSuccess);
}
/// <summary>
/// 绑定手机成功
/// </summary>
/// <param name="msg"></param>
private void BoundphoneSuccess(object msg)
{
BindVerificationInput.value = "";
if (FinishState!=null) ChangeState(true);
var mobileNum = MobileNumInput.value;
UserInfoModel.Instance.UserInfo.PhoneNumber = mobileNum;
MobileNumLabel.text = mobileNum;
UserInfoModel.Instance.Save();
var pram = (IDictionary)msg;
if (pram.Contains("coin"))
{
var coin = int.Parse(pram["coin"].ToString());
if (coin > 0)
{
UserInfoModel.Instance.UserInfo.CoinA += coin;
ShowInfos(msg, string.Format("恭喜您,首次绑定手机成功!!!\n奖励{0}金币!!", coin));
}
}
else
{
ShowInfos(msg, "恭喜您,绑定手机成功!!!");
}
if (FinishState==null)Close();
}
/// <summary>
/// 发送解绑手机 todo
/// </summary>
public void OnSendUnBindPhone()
{
var pram = new Dictionary<string, object>();
pram["verify"] = UnBindVerificationInput.value;
Facade.Instance<TwManager>().SendAction("getUnBindPhoneAward", pram, UnBoundphoneSuccess);
}
/// <summary>
/// 完成解绑操作
/// </summary>
/// <param name="msg"></param>
private void UnBoundphoneSuccess(object msg)
{
UnBindVerificationInput.value = "";
ShowInfos(msg, "该账号已经解除手机绑定!!!");
UserInfoModel.Instance.UserInfo.PhoneNumber = "";
MobileNumLabel.text = "";
ChangeState(false);
}
public YxWindow ParentWindow;
public override void Close()
{
if (ParentWindow == null) return;
if (MustFillin && string.IsNullOrEmpty(UserInfoModel.Instance.UserInfo.PhoneNumber)) return;
ParentWindow.Close();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Extensions.Caching.Distributed;
namespace AwesomeCMSCore.Modules.Helper.Services
{
public interface ICacheService: IDistributedCache
{
}
}
|
using System;
using System.Collections.Generic;
using ClosedXML.Excel;
using KeySwitchManager.Domain.MidiMessages.Models.Aggregations;
namespace KeySwitchManager.Infrastructures.Storage.Spreadsheet.ClosedXml.KeySwitches.Translators
{
[Flags]
internal enum TranslateMidiMessageType
{
Status = 0x1,
ChannelInStatus = 0x2,
Data1 = 0x4,
Data2 = 0x8,
}
internal class MidiMessageCellInfo
{
public string HeaderCellName { get; }
public int MidiDataValue { get; }
public MidiMessageCellInfo( string headerCellName, int midiDataValue )
{
HeaderCellName = headerCellName;
MidiDataValue = midiDataValue;
}
}
internal interface IMidiMessageTranslator
{
int Translate(
IEnumerable<IMidiMessage> midiMessages,
IXLWorksheet sheet,
int headerRow,
int row,
TranslateMidiMessageType type );
}
} |
using System;
abstract class QuickSortProgram
{
public static void Main(System.String[] args)
{
System.Int32[] V_0;
int V_1;
bool V_2;
// No-op
System.String[] expr01 = args;
int expr02 = expr01.Length;
int expr03 = (Int32)expr02;
System.Int32[] expr04 = new int[expr03];
V_0 = expr04;
int expr0A = 0;
V_1 = expr0A;
goto IL_1F;
IL_0E: // No-op
System.Int32[] expr0F = V_0;
int expr10 = V_1;
System.String[] expr11 = args;
int expr12 = V_1;
string expr13 = expr11[expr12];
int expr14 = System.Int32.Parse(expr13);
expr0F[expr10] = expr14;
// No-op
int expr1B = V_1;
int expr1C = 1;
int expr1D = expr1B + expr1C;
V_1 = expr1D;
IL_1F: int expr1F = V_1;
System.Int32[] expr20 = V_0;
int expr21 = expr20.Length;
int expr22 = (Int32)expr21;
bool expr23 = expr1F < expr22;
V_2 = expr23;
bool expr26 = V_2;
if (expr26) goto IL_0E;
System.Int32[] expr29 = V_0;
int expr2A = 0;
System.Int32[] expr2B = V_0;
int expr2C = expr2B.Length;
int expr2D = (Int32)expr2C;
int expr2E = 1;
int expr2F = expr2D - expr2E;
QuickSortProgram.QuickSort(expr29, expr2A, expr2F);
// No-op
int expr36 = 0;
V_1 = expr36;
goto IL_5C;
IL_3A: // No-op
System.Int32[] expr3B = V_0;
int expr3C = V_1;
object expr3D = expr3B[expr3C];
string expr42 = expr3D.ToString();
string expr47 = " ";
string expr4C = System.String.Concat(expr42, expr47);
System.Console.Write(expr4C);
// No-op
// No-op
int expr58 = V_1;
int expr59 = 1;
int expr5A = expr58 + expr59;
V_1 = expr5A;
IL_5C: int expr5C = V_1;
System.Int32[] expr5D = V_0;
int expr5E = expr5D.Length;
int expr5F = (Int32)expr5E;
bool expr60 = expr5C < expr5F;
V_2 = expr60;
bool expr63 = V_2;
if (expr63) goto IL_3A;
return;
}
public static void QuickSort(System.Int32[] array, int left, int right)
{
int V_0;
int V_1;
bool V_2;
// No-op
int expr01 = right;
int expr02 = left;
bool expr03 = expr01 > expr02;
int expr05 = 0;
bool expr06 = expr03 == (expr05 != 0);
V_2 = expr06;
bool expr09 = V_2;
if (expr09) goto IL_34;
// No-op
int expr0D = left;
int expr0E = right;
int expr0F = expr0D + expr0E;
int expr10 = 2;
int expr11 = expr0F / expr10;
V_0 = expr11;
System.Int32[] expr13 = array;
int expr14 = left;
int expr15 = right;
int expr16 = V_0;
int expr17 = QuickSortProgram.Partition(expr13, expr14, expr15, expr16);
V_1 = expr17;
System.Int32[] expr1D = array;
int expr1E = left;
int expr1F = V_1;
int expr20 = 1;
int expr21 = expr1F - expr20;
QuickSortProgram.QuickSort(expr1D, expr1E, expr21);
// No-op
System.Int32[] expr28 = array;
int expr29 = V_1;
int expr2A = 1;
int expr2B = expr29 + expr2A;
int expr2C = right;
QuickSortProgram.QuickSort(expr28, expr2B, expr2C);
// No-op
// No-op
IL_34: return;
}
private static int Partition(System.Int32[] array, int left, int right, int pivotIndex)
{
int V_0;
int V_1;
int V_2;
int V_3;
bool V_4;
// No-op
System.Int32[] expr01 = array;
int expr02 = pivotIndex;
int expr03 = expr01[expr02];
V_0 = expr03;
System.Int32[] expr05 = array;
int expr06 = pivotIndex;
int expr07 = right;
QuickSortProgram.Swap(expr05, expr06, expr07);
// No-op
int expr0E = left;
V_1 = expr0E;
int expr10 = left;
V_2 = expr10;
goto IL_35;
IL_14: // No-op
System.Int32[] expr15 = array;
int expr16 = V_2;
int expr17 = expr15[expr16];
int expr18 = V_0;
bool expr19 = expr17 > expr18;
V_4 = expr19;
bool expr1D = V_4;
if (expr1D) goto IL_30;
// No-op
System.Int32[] expr22 = array;
int expr23 = V_1;
int expr24 = V_2;
QuickSortProgram.Swap(expr22, expr23, expr24);
// No-op
int expr2B = V_1;
int expr2C = 1;
int expr2D = expr2B + expr2C;
V_1 = expr2D;
// No-op
IL_30: // No-op
int expr31 = V_2;
int expr32 = 1;
int expr33 = expr31 + expr32;
V_2 = expr33;
IL_35: int expr35 = V_2;
int expr36 = right;
bool expr37 = expr35 < expr36;
V_4 = expr37;
bool expr3B = V_4;
if (expr3B) goto IL_14;
System.Int32[] expr3F = array;
int expr40 = right;
int expr41 = V_1;
QuickSortProgram.Swap(expr3F, expr40, expr41);
// No-op
int expr48 = V_1;
V_3 = expr48;
goto IL_4C;
IL_4C: int expr4C = V_3;
return expr4C;
}
private static void Swap(System.Int32[] array, int index1, int index2)
{
int V_0;
// No-op
System.Int32[] expr01 = array;
int expr02 = index1;
int expr03 = expr01[expr02];
V_0 = expr03;
System.Int32[] expr05 = array;
int expr06 = index1;
System.Int32[] expr07 = array;
int expr08 = index2;
int expr09 = expr07[expr08];
expr05[expr06] = expr09;
System.Int32[] expr0B = array;
int expr0C = index2;
int expr0D = V_0;
expr0B[expr0C] = expr0D;
return;
}
}
|
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ShopMenu : Overlay
{
[SerializeField]
private GameObject shopItemPanel = null;
private List<RectTransform> itemPanels = null;
private ShopItemCollection items = null;
public override void Initialize()
{
string jsonstring = (Resources.Load(@"ShopItem", typeof(TextAsset)) as TextAsset).text;
items = JsonUtility.FromJson<ShopItemCollection>(jsonstring);
itemPanels = new List<RectTransform>();
float anchor = 0;
float x = 320;
for (int i = 0; i < 3; i++)
{
//Instantiate -> position -> button function -> increment
GameObject itemPanel = Instantiate(shopItemPanel, transform);
RectTransform rectTransform = itemPanel.GetComponent<RectTransform>();
rectTransform.anchorMin = new Vector2(anchor, 0.5f);
rectTransform.anchorMax = new Vector2(anchor, 0.5f);
rectTransform.anchoredPosition = new Vector2(x, 0.0f);
anchor += 0.5f;
x -= 320;
itemPanels.Add(rectTransform);
}
}
public void Back()
{
Time.timeScale = 1.0f;
gameObject.SetActive(false);
}
}
[System.Serializable]
public class ShopItemCollection
{
[System.Serializable]
public class ShopItem
{
public int id;
public int price;
public string name;
public override string ToString()
{
string result = "";
result += $"id : {id}\n";
result += $"price : {price}\n";
result += $"name : {name}\n";
return result;
}
}
public List<ShopItem> items;
public override string ToString()
{
string result = $"ShopItemCollection\nitem count : {items.Count}\n";
for (int i = 0; i < items.Count; i++)
{
result += items[i].ToString();
}
return result;
}
} |
namespace briefCore.Data.Maps
{
using Library.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class EditionInCategoryMap
{
public EditionInCategoryMap(EntityTypeBuilder<EditionInCategory> builder)
{
builder.ToTable("edition_in_category");
builder.HasKey(eu => new { eu.EditionId, eu.CategoryId });
builder.HasOne(ec => ec.Edition)
.WithMany(e => e.EditionInCategories)
.HasForeignKey(ec => ec.EditionId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasOne(ec => ec.Category)
.WithMany(c => c.EditionInCategories)
.HasForeignKey(ec => ec.CategoryId)
.OnDelete(DeleteBehavior.Cascade);
}
}
} |
using JoshMake;
class Program
{
static public void Configuration()
{
Project helloWorld = new Project("HelloWorld");
// Make and add msvc while turning on some flags.
var msvc = new msvc();
msvc.AddCompilerFlag(msvc.CompilerFlag.Warnings1);
//msvc.AddLinkerFlag(msvc.LinkerFlag.LinkTimeCodeGeneration);
helloWorld.AddCompiler(msvc);
helloWorld.AddFolder("TestFiles");
helloWorld.Compile();
}
} |
namespace TheCrushinator.XamarinFormly.Models
{
public class AsyncValidators
{
}
}
|
using System;
namespace Tailviewer.Api
{
/// <summary>
/// Describes a column of a log file.
/// </summary>
/// <remarks>
/// TODO: Introduce required EqualityComparer
/// TODO: Introduce optional Comparer (for sorting)
/// </remarks>
public interface IColumnDescriptor
{
/// <summary>
/// Id of this column, two columns are the same if they have the same id.
/// </summary>
string Id { get; }
/// <summary>
/// The type of the data provided by this column.
/// </summary>
Type DataType { get; }
/// <summary>
/// The value used when an invalid row is accessed or
/// when no value is available.
/// </summary>
object DefaultValue { get; }
}
/// <summary>
/// Describes a column of a log file.
/// </summary>
/// <typeparam name="T"></typeparam>
public interface IColumnDescriptor<out T>
: IColumnDescriptor
{
/// <summary>
/// The value used when an invalid row is accessed or
/// when no value is available.
/// </summary>
new T DefaultValue { get; }
}
} |
// SharpMath - C# Mathematical Library
// Copyright (c) 2014 Morten Bakkedal
// This code is published under the MIT License.
using System;
using System.Collections.Generic;
namespace SharpMath.Optimization
{
/// <summary>
/// Represents a set of variables with some values assigned.
/// </summary>
public interface IPoint : IEnumerable<VariableAssignment>
{
/// <summary>
/// Tests if this point contains this variable, i.e. if a value is assigned to it.
/// </summary>
bool ContainsVariable(Variable variable);
/// <summary>
/// The value assigned to a variable. Throws <see cref="VariableNotAssignedException" /> if not assigned.
/// </summary>
double this[Variable variable]
{
get;
}
/// <summary>
/// Number of variables.
/// </summary>
int Count
{
get;
}
}
}
|
using Sandbox;
using System;
using System.Collections.Generic;
namespace guesswho.weapons
{
public partial class SMG : BaseWeapon
{
public override string ViewModelPath => "weapons/rust_smg/v_rust_smg.vmdl";
public override string Icon => "/ui/weapons/dm_smg.png";
public override int SlotLocation => 2;
public override float PrimaryRate => 15;
public override float ReloadTime => 4f;
public override int ClipSize => 30;
public override void Spawn()
{
base.Spawn();
SetModel("weapons/rust_smg/rust_smg.vmdl");
}
public override void AttackPrimary()
{
TimeSinceSecondaryAttack = 0;
TimeSincePrimaryAttack = 0;
if(Ammo == 0)
{
Reload();
return;
}
Ammo -= 1;
ShootEffects();
PlaySound("rust_smg.shoot");
ShootBullet(.05f, 1.5f, 8.0f);
}
[ClientRpc]
protected override void ShootEffects()
{
Particles.Create("particles/pistol_ejectbrass.vpcf", EffectEntity, "ejection_point");
base.ShootEffects();
}
}
}
|
namespace NWaves.DemoForms
{
partial class AmsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.envelopesPanel = new System.Windows.Forms.Panel();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.band4ComboBox = new System.Windows.Forms.ComboBox();
this.band3ComboBox = new System.Windows.Forms.ComboBox();
this.band2ComboBox = new System.Windows.Forms.ComboBox();
this.band1ComboBox = new System.Windows.Forms.ComboBox();
this.filterbankComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.filterCountTextBox = new System.Windows.Forms.TextBox();
this.filterbankButton = new System.Windows.Forms.Button();
this.modulationSpectrumPanel = new System.Windows.Forms.Panel();
this.lowFreqTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.highFreqTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.samplingRateTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.fftSizeTextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.computeButton = new System.Windows.Forms.Button();
this.longTermHopSizeTextBox = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.longTermFftSizeTextBox = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.hopSizeTextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.analysisFftTextBox = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.nextButton = new System.Windows.Forms.Button();
this.infoLabel = new System.Windows.Forms.Label();
this.prevButton = new System.Windows.Forms.Button();
this.temporalCheckBox = new System.Windows.Forms.CheckBox();
this.herzTextBox = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.shapeComboBox = new System.Windows.Forms.ComboBox();
this.overlapCheckBox = new System.Windows.Forms.CheckBox();
this.filterbankPanel = new NWaves.DemoForms.UserControls.GroupPlot();
this.menuStrip1.SuspendLayout();
this.envelopesPanel.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1187, 28);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24);
this.fileToolStripMenuItem.Text = "&File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26);
this.openToolStripMenuItem.Text = "&Open...";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// envelopesPanel
//
this.envelopesPanel.BackColor = System.Drawing.Color.White;
this.envelopesPanel.Controls.Add(this.label15);
this.envelopesPanel.Controls.Add(this.label14);
this.envelopesPanel.Controls.Add(this.label13);
this.envelopesPanel.Controls.Add(this.label12);
this.envelopesPanel.Controls.Add(this.band4ComboBox);
this.envelopesPanel.Controls.Add(this.band3ComboBox);
this.envelopesPanel.Controls.Add(this.band2ComboBox);
this.envelopesPanel.Controls.Add(this.band1ComboBox);
this.envelopesPanel.Location = new System.Drawing.Point(12, 319);
this.envelopesPanel.Name = "envelopesPanel";
this.envelopesPanel.Size = new System.Drawing.Size(1168, 370);
this.envelopesPanel.TabIndex = 1;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(1055, 255);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(49, 17);
this.label15.TabIndex = 7;
this.label15.Text = "Band#";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(1055, 170);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(49, 17);
this.label14.TabIndex = 6;
this.label14.Text = "Band#";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(1055, 89);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(49, 17);
this.label13.TabIndex = 5;
this.label13.Text = "Band#";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(1055, 8);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(49, 17);
this.label12.TabIndex = 4;
this.label12.Text = "Band#";
//
// band4ComboBox
//
this.band4ComboBox.FormattingEnabled = true;
this.band4ComboBox.Location = new System.Drawing.Point(1110, 252);
this.band4ComboBox.Name = "band4ComboBox";
this.band4ComboBox.Size = new System.Drawing.Size(52, 24);
this.band4ComboBox.TabIndex = 3;
this.band4ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged);
//
// band3ComboBox
//
this.band3ComboBox.FormattingEnabled = true;
this.band3ComboBox.Location = new System.Drawing.Point(1110, 167);
this.band3ComboBox.Name = "band3ComboBox";
this.band3ComboBox.Size = new System.Drawing.Size(52, 24);
this.band3ComboBox.TabIndex = 2;
this.band3ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged);
//
// band2ComboBox
//
this.band2ComboBox.FormattingEnabled = true;
this.band2ComboBox.Location = new System.Drawing.Point(1110, 86);
this.band2ComboBox.Name = "band2ComboBox";
this.band2ComboBox.Size = new System.Drawing.Size(52, 24);
this.band2ComboBox.TabIndex = 1;
this.band2ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged);
//
// band1ComboBox
//
this.band1ComboBox.FormattingEnabled = true;
this.band1ComboBox.Location = new System.Drawing.Point(1110, 5);
this.band1ComboBox.Name = "band1ComboBox";
this.band1ComboBox.Size = new System.Drawing.Size(52, 24);
this.band1ComboBox.TabIndex = 0;
this.band1ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged);
//
// filterbankComboBox
//
this.filterbankComboBox.FormattingEnabled = true;
this.filterbankComboBox.Items.AddRange(new object[] {
"Herz",
"Mel",
"Bark",
"Critical bands",
"ERB",
"Octave bands"});
this.filterbankComboBox.Location = new System.Drawing.Point(184, 42);
this.filterbankComboBox.Name = "filterbankComboBox";
this.filterbankComboBox.Size = new System.Drawing.Size(92, 24);
this.filterbankComboBox.TabIndex = 2;
this.filterbankComboBox.Text = "Mel";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(104, 45);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 17);
this.label1.TabIndex = 3;
this.label1.Text = "Filter bank";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 17);
this.label2.TabIndex = 5;
this.label2.Text = "Size";
//
// filterCountTextBox
//
this.filterCountTextBox.Location = new System.Drawing.Point(54, 43);
this.filterCountTextBox.Name = "filterCountTextBox";
this.filterCountTextBox.Size = new System.Drawing.Size(38, 22);
this.filterCountTextBox.TabIndex = 6;
this.filterCountTextBox.Text = "13";
//
// filterbankButton
//
this.filterbankButton.Location = new System.Drawing.Point(372, 78);
this.filterbankButton.Name = "filterbankButton";
this.filterbankButton.Size = new System.Drawing.Size(240, 51);
this.filterbankButton.TabIndex = 7;
this.filterbankButton.Text = ">>";
this.filterbankButton.UseVisualStyleBackColor = true;
this.filterbankButton.Click += new System.EventHandler(this.filterbankButton_Click);
//
// modulationSpectrumPanel
//
this.modulationSpectrumPanel.BackColor = System.Drawing.Color.White;
this.modulationSpectrumPanel.Location = new System.Drawing.Point(865, 65);
this.modulationSpectrumPanel.Name = "modulationSpectrumPanel";
this.modulationSpectrumPanel.Size = new System.Drawing.Size(315, 248);
this.modulationSpectrumPanel.TabIndex = 8;
//
// lowFreqTextBox
//
this.lowFreqTextBox.Location = new System.Drawing.Point(105, 78);
this.lowFreqTextBox.Name = "lowFreqTextBox";
this.lowFreqTextBox.Size = new System.Drawing.Size(70, 22);
this.lowFreqTextBox.TabIndex = 10;
this.lowFreqTextBox.Text = "200";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(13, 82);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(62, 17);
this.label3.TabIndex = 9;
this.label3.Text = "LowFreq";
//
// highFreqTextBox
//
this.highFreqTextBox.Location = new System.Drawing.Point(105, 107);
this.highFreqTextBox.Name = "highFreqTextBox";
this.highFreqTextBox.Size = new System.Drawing.Size(70, 22);
this.highFreqTextBox.TabIndex = 12;
this.highFreqTextBox.Text = "3800";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(13, 110);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(66, 17);
this.label4.TabIndex = 11;
this.label4.Text = "HighFreq";
//
// samplingRateTextBox
//
this.samplingRateTextBox.Location = new System.Drawing.Point(282, 106);
this.samplingRateTextBox.Name = "samplingRateTextBox";
this.samplingRateTextBox.Size = new System.Drawing.Size(70, 22);
this.samplingRateTextBox.TabIndex = 16;
this.samplingRateTextBox.Text = "16000";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(181, 109);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(95, 17);
this.label5.TabIndex = 15;
this.label5.Text = "Sampling rate";
//
// fftSizeTextBox
//
this.fftSizeTextBox.Location = new System.Drawing.Point(282, 78);
this.fftSizeTextBox.Name = "fftSizeTextBox";
this.fftSizeTextBox.Size = new System.Drawing.Size(70, 22);
this.fftSizeTextBox.TabIndex = 14;
this.fftSizeTextBox.Text = "512";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(181, 82);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(62, 17);
this.label6.TabIndex = 13;
this.label6.Text = "FFT size";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.computeButton);
this.groupBox1.Controls.Add(this.longTermHopSizeTextBox);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.longTermFftSizeTextBox);
this.groupBox1.Controls.Add(this.label10);
this.groupBox1.Controls.Add(this.hopSizeTextBox);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.analysisFftTextBox);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.ForeColor = System.Drawing.Color.MidnightBlue;
this.groupBox1.Location = new System.Drawing.Point(621, 60);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(238, 253);
this.groupBox1.TabIndex = 28;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Extractor parameters";
//
// computeButton
//
this.computeButton.Location = new System.Drawing.Point(22, 185);
this.computeButton.Name = "computeButton";
this.computeButton.Size = new System.Drawing.Size(193, 58);
this.computeButton.TabIndex = 36;
this.computeButton.Text = ">>";
this.computeButton.UseVisualStyleBackColor = true;
this.computeButton.Click += new System.EventHandler(this.computeButton_Click);
//
// longTermHopSizeTextBox
//
this.longTermHopSizeTextBox.Location = new System.Drawing.Point(156, 146);
this.longTermHopSizeTextBox.Name = "longTermHopSizeTextBox";
this.longTermHopSizeTextBox.Size = new System.Drawing.Size(59, 22);
this.longTermHopSizeTextBox.TabIndex = 35;
this.longTermHopSizeTextBox.Text = "32";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(19, 146);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(130, 17);
this.label9.TabIndex = 34;
this.label9.Text = "Long-term hop size";
//
// longTermFftSizeTextBox
//
this.longTermFftSizeTextBox.Location = new System.Drawing.Point(156, 111);
this.longTermFftSizeTextBox.Name = "longTermFftSizeTextBox";
this.longTermFftSizeTextBox.Size = new System.Drawing.Size(59, 22);
this.longTermFftSizeTextBox.TabIndex = 33;
this.longTermFftSizeTextBox.Text = "64";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(19, 111);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(131, 17);
this.label10.TabIndex = 32;
this.label10.Text = "Long-term FFT size";
//
// hopSizeTextBox
//
this.hopSizeTextBox.Location = new System.Drawing.Point(156, 76);
this.hopSizeTextBox.Name = "hopSizeTextBox";
this.hopSizeTextBox.Size = new System.Drawing.Size(59, 22);
this.hopSizeTextBox.TabIndex = 31;
this.hopSizeTextBox.Text = "0,03125";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(19, 76);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(87, 17);
this.label7.TabIndex = 30;
this.label7.Text = "Overlap size";
//
// analysisFftTextBox
//
this.analysisFftTextBox.Location = new System.Drawing.Point(156, 42);
this.analysisFftTextBox.Name = "analysisFftTextBox";
this.analysisFftTextBox.Size = new System.Drawing.Size(59, 22);
this.analysisFftTextBox.TabIndex = 29;
this.analysisFftTextBox.Text = "0,0625";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(20, 42);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(86, 17);
this.label8.TabIndex = 28;
this.label8.Text = "Window size";
//
// nextButton
//
this.nextButton.BackColor = System.Drawing.Color.Transparent;
this.nextButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.nextButton.Location = new System.Drawing.Point(1142, 31);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(38, 34);
this.nextButton.TabIndex = 29;
this.nextButton.Text = ">";
this.nextButton.UseVisualStyleBackColor = false;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// infoLabel
//
this.infoLabel.AutoSize = true;
this.infoLabel.Location = new System.Drawing.Point(1040, 40);
this.infoLabel.Name = "infoLabel";
this.infoLabel.Size = new System.Drawing.Size(62, 17);
this.infoLabel.TabIndex = 30;
this.infoLabel.Text = "10x1024";
//
// prevButton
//
this.prevButton.BackColor = System.Drawing.Color.Transparent;
this.prevButton.FlatAppearance.BorderColor = System.Drawing.Color.Black;
this.prevButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.prevButton.Location = new System.Drawing.Point(1108, 31);
this.prevButton.Name = "prevButton";
this.prevButton.Size = new System.Drawing.Size(38, 34);
this.prevButton.TabIndex = 31;
this.prevButton.Text = "<";
this.prevButton.UseVisualStyleBackColor = false;
this.prevButton.Click += new System.EventHandler(this.prevButton_Click);
//
// temporalCheckBox
//
this.temporalCheckBox.AutoSize = true;
this.temporalCheckBox.Location = new System.Drawing.Point(865, 38);
this.temporalCheckBox.Name = "temporalCheckBox";
this.temporalCheckBox.Size = new System.Drawing.Size(104, 21);
this.temporalCheckBox.TabIndex = 32;
this.temporalCheckBox.Text = "time plot for";
this.temporalCheckBox.UseVisualStyleBackColor = true;
this.temporalCheckBox.CheckedChanged += new System.EventHandler(this.temporalCheckBox_CheckedChanged);
//
// herzTextBox
//
this.herzTextBox.Location = new System.Drawing.Point(965, 38);
this.herzTextBox.Name = "herzTextBox";
this.herzTextBox.Size = new System.Drawing.Size(27, 22);
this.herzTextBox.TabIndex = 33;
this.herzTextBox.Text = "4";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(994, 40);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(25, 17);
this.label16.TabIndex = 34;
this.label16.Text = "Hz";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(369, 45);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(49, 17);
this.label11.TabIndex = 36;
this.label11.Text = "Shape";
//
// shapeComboBox
//
this.shapeComboBox.FormattingEnabled = true;
this.shapeComboBox.Items.AddRange(new object[] {
"Triangular",
"Rectangular",
"Trapezoidal",
"BiQuad"});
this.shapeComboBox.Location = new System.Drawing.Point(443, 42);
this.shapeComboBox.Name = "shapeComboBox";
this.shapeComboBox.Size = new System.Drawing.Size(169, 24);
this.shapeComboBox.TabIndex = 35;
this.shapeComboBox.Text = "Triangular";
//
// overlapCheckBox
//
this.overlapCheckBox.AutoSize = true;
this.overlapCheckBox.Location = new System.Drawing.Point(283, 43);
this.overlapCheckBox.Name = "overlapCheckBox";
this.overlapCheckBox.Size = new System.Drawing.Size(77, 21);
this.overlapCheckBox.TabIndex = 37;
this.overlapCheckBox.Text = "overlap";
this.overlapCheckBox.UseVisualStyleBackColor = true;
//
// filterbankPanel
//
this.filterbankPanel.AutoScroll = true;
this.filterbankPanel.BackColor = System.Drawing.Color.White;
this.filterbankPanel.Gain = 100;
this.filterbankPanel.Groups = null;
this.filterbankPanel.Location = new System.Drawing.Point(12, 138);
this.filterbankPanel.Name = "filterbankPanel";
this.filterbankPanel.Size = new System.Drawing.Size(600, 175);
this.filterbankPanel.Stride = 2;
this.filterbankPanel.TabIndex = 38;
//
// AmsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1187, 701);
this.Controls.Add(this.filterbankPanel);
this.Controls.Add(this.overlapCheckBox);
this.Controls.Add(this.label11);
this.Controls.Add(this.shapeComboBox);
this.Controls.Add(this.label16);
this.Controls.Add(this.herzTextBox);
this.Controls.Add(this.temporalCheckBox);
this.Controls.Add(this.prevButton);
this.Controls.Add(this.infoLabel);
this.Controls.Add(this.nextButton);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.samplingRateTextBox);
this.Controls.Add(this.label5);
this.Controls.Add(this.fftSizeTextBox);
this.Controls.Add(this.label6);
this.Controls.Add(this.highFreqTextBox);
this.Controls.Add(this.label4);
this.Controls.Add(this.lowFreqTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.modulationSpectrumPanel);
this.Controls.Add(this.filterbankButton);
this.Controls.Add(this.filterCountTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.filterbankComboBox);
this.Controls.Add(this.envelopesPanel);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "AmsForm";
this.Text = "AmsForm";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.envelopesPanel.ResumeLayout(false);
this.envelopesPanel.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.Panel envelopesPanel;
private System.Windows.Forms.ComboBox filterbankComboBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox filterCountTextBox;
private System.Windows.Forms.Button filterbankButton;
private System.Windows.Forms.Panel modulationSpectrumPanel;
private System.Windows.Forms.TextBox lowFreqTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox highFreqTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox samplingRateTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox fftSizeTextBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button computeButton;
private System.Windows.Forms.TextBox longTermHopSizeTextBox;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox longTermFftSizeTextBox;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox hopSizeTextBox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox analysisFftTextBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox band4ComboBox;
private System.Windows.Forms.ComboBox band3ComboBox;
private System.Windows.Forms.ComboBox band2ComboBox;
private System.Windows.Forms.ComboBox band1ComboBox;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Label infoLabel;
private System.Windows.Forms.Button prevButton;
private System.Windows.Forms.CheckBox temporalCheckBox;
private System.Windows.Forms.TextBox herzTextBox;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.ComboBox shapeComboBox;
private System.Windows.Forms.CheckBox overlapCheckBox;
private UserControls.GroupPlot filterbankPanel;
}
} |
namespace RoundsCardGameCP.Data;
[UseScoreboard]
public partial class RoundsCardGamePlayerItem : PlayerTrick<EnumSuitList, RoundsCardGameCardInformation>
{//anything needed is here
[ScoreColumn]
public int RoundsWon { get; set; }
[ScoreColumn]
public int CurrentPoints { get; set; }
[ScoreColumn]
public int TotalScore { get; set; }
} |
using System;
namespace Mariana.AVM2.Core {
/// <summary>
/// An object that can be used to access traits and dynamic properties in the global
/// scope of an application domain.
/// </summary>
/// <remarks>
/// The global object for an application domain can be obtained using the
/// <see cref="ApplicationDomain.globalObject" qualifyHint="true"/> property.
/// </remarks>
internal sealed class ASGlobalObject : ASObject {
private readonly ApplicationDomain m_domain;
internal ASGlobalObject(ApplicationDomain domain) {
m_domain = domain;
}
/// <summary>
/// Returns the <see cref="ApplicationDomain"/> instance representing the application
/// domain to which this global object belongs.
/// </summary>
public ApplicationDomain applicationDomain => m_domain;
/// <summary>
/// Performs a trait lookup on the object.
/// </summary>
/// <param name="name">The name of the trait to find.</param>
/// <param name="trait">The trait with the name <paramref name="name"/>, if one
/// exists.</param>
/// <returns>A <see cref="BindStatus"/> indicating the result of the lookup.</returns>
internal override BindStatus AS_lookupTrait(in QName name, out Trait? trait) {
BindStatus bindStatus = m_domain.lookupGlobalTrait(name, noInherited: false, out trait);
if (bindStatus != BindStatus.NOT_FOUND)
return bindStatus;
return AS_class.lookupTrait(name, isStatic: false, out trait);
}
/// <summary>
/// Performs a trait lookup on the object.
/// </summary>
/// <param name="name">The name of the trait to find.</param>
/// <param name="nsSet">A set of namespaces in which to search for the trait.</param>
/// <param name="trait">The trait with the name <paramref name="name"/> in a namespace of
/// <paramref name="nsSet"/>, if one exists.</param>
/// <returns>A <see cref="BindStatus"/> indicating the result of the lookup.</returns>
internal override BindStatus AS_lookupTrait(string name, in NamespaceSet nsSet, out Trait? trait) {
BindStatus bindStatus = m_domain.lookupGlobalTrait(name, nsSet, noInherited: false, out trait);
if (bindStatus != BindStatus.NOT_FOUND)
return bindStatus;
return AS_class.lookupTrait(name, nsSet, isStatic: false, out trait);
}
}
}
|
using Cybtans.Serialization;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
namespace Benchmark
{
public class ModelA
{
public int IntValue { get; set; } = 1;
public string StringValue { get; set; } = "Hellow World";
public float FloatValue { get; set; } = 55555.99999f;
public double DoubleValue { get; set; } = Math.PI;
public byte ByteValue { get; set; } = 0xFF;
public double SmallDouble { get; set; } = 5;
public double SmallDecimal { get; set; } = 700.50;
public float SmallFloat { get; set; } = 50;
public double SmallDouble2 { get; set; } = 5.5;
public byte[] BufferValue { get; set; } = new byte[] { 0x01, 0x02, 0x03, 0x05, 0xFF };
public int[] ArrayIntValue { get; set; } = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
public string[] ArrayStringValue { get; set; } = new string[] { "Baar", "Foo", "Delta" };
public List<string> ListStringValue { get; set; } = new List<string>();
public ModelB ModelBValue { get; set; }
public List<ModelB> ModelBListValue { get; set; }
public Dictionary<string, ModelB> MapValue { get; set; }
}
public class ModelB
{
public int Id { get; set; }
public string Name { get; set; }
public bool Checked { get; set; }
public DateTime CreateDate { get; set; }
public DateTime? UpdateDate { get; set; }
}
}
|
/*
* Pixel Anti Cheat
* ======================================================
* This library allows you to organize a simple anti-cheat
* for your game and take care of data security. You can
* use it in your projects for free.
*
* Note that it does not guarantee 100% protection for
* your game. If you are developing a multiplayer game -
* never trust the client and check everything on
* the server.
* ======================================================
* @developer TinyPlay
* @author Ilya Rastorguev
* @url https://github.com/TinyPlay/Pixel-Anticheat
*/
namespace PixelAnticheat.Editor.Common
{
using System;
/// <summary>
/// Allowed Assembly
/// </summary>
internal class AllowedAssembly
{
public string name;
public int[] hashes;
public AllowedAssembly(string name, int[] hashes)
{
this.name = name;
this.hashes = hashes;
}
public bool AddHash(int hash)
{
if (Array.IndexOf(hashes, hash) != -1) return false;
int oldLen = hashes.Length;
int newLen = oldLen + 1;
int[] newHashesArray = new int[newLen];
Array.Copy(hashes, newHashesArray, oldLen);
hashes = newHashesArray;
hashes[oldLen] = hash;
return true;
}
public override string ToString()
{
return name + " (hashes: " + hashes.Length + ")";
}
}
} |
using System;
using Microsoft.Extensions.DependencyInjection;
namespace MyLab.Search.EsAdapter.SearchEngine
{
/// <summary>
/// Integration methods for <see cref="IServiceCollection"/>
/// </summary>
public static class SearchEngineIntegration
{
/// <summary>
/// Adds search engine for model <see cref="TDoc"/>
/// </summary>
public static IServiceCollection AddEsSearchEngine<TSearchEngine, TDoc>(this IServiceCollection services)
where TSearchEngine : class, IEsSearchEngine<TDoc>
where TDoc: class
{
if (services == null) throw new ArgumentNullException(nameof(services));
return services.AddSingleton<IEsSearchEngine<TDoc>, TSearchEngine>();
}
}
}
|
using System;
using Xamarin.Forms;
using SkiaSharp;
using SkiaSharp.Views.Forms;
namespace SkiaSharpFormsDemos.Transforms
{
public class SkewShadowTextPage : ContentPage
{
public SkewShadowTextPage()
{
Title = "Shadow Text";
SKCanvasView canvasView = new SKCanvasView();
canvasView.PaintSurface += OnCanvasViewPaintSurface;
Content = canvasView;
}
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
{
SKImageInfo info = args.Info;
SKSurface surface = args.Surface;
SKCanvas canvas = surface.Canvas;
canvas.Clear();
using (SKPaint textPaint = new SKPaint())
{
textPaint.Style = SKPaintStyle.Fill;
textPaint.TextSize = info.Width / 6; // empirically determined
// Common to shadow and text
string text = "shadow";
float xText = 20;
float yText = info.Height / 2;
// Shadow
textPaint.Color = SKColors.LightGray;
canvas.Save();
canvas.Translate(xText, yText);
canvas.Skew((float)Math.Tan(-Math.PI / 4), 0);
canvas.Scale(1, 3);
canvas.Translate(-xText, -yText);
canvas.DrawText(text, xText, yText, textPaint);
canvas.Restore();
// Text
textPaint.Color = SKColors.Blue;
canvas.DrawText(text, xText, yText, textPaint);
}
}
}
}
|
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SqzTo.Domain.Entities;
namespace SqzTo.Infrastructure.Persistence.Configurations
{
/// <summary>
/// Default configuration for the <see cref="SqzLink"/>.
/// </summary>
public class SqzLinkEntityConfiguration : IEntityTypeConfiguration<SqzLink>
{
public void Configure(EntityTypeBuilder<SqzLink> builder)
{
builder.ToTable("sqzlinks")
.HasKey(link => link.Id);
builder.Property(link => link.Id)
.ValueGeneratedOnAdd();
builder.HasOne(link => link.Group)
.WithMany(group => group.SqzLinks)
.HasForeignKey(entity => entity.GroupId)
.OnDelete(DeleteBehavior.SetNull);
builder.Property(link => link.Domain)
.IsRequired()
.HasColumnName("domain");
builder.Property(link => link.Key)
.IsRequired()
.HasColumnName("key");
builder.Property(link => link.DestinationUrl)
.IsRequired()
.HasColumnName("destination_url");
builder.Property(link => link.Description)
.HasMaxLength(256)
.HasColumnName("description");
}
}
}
|
using MongoDB.Bson;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace MongoConnector.Net
{
class Program
{
static void Main(string[] args)
{
ConnectorApp opLogApp = new ConnectorApp();
opLogApp.Init();
opLogApp.Run();
opLogApp.Exit();
}
}
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Threading.Tasks;
namespace BuildXL.Processes.Remoting
{
/// <summary>
/// Represents a process pip that executes remotely.
/// </summary>
public interface IRemoteProcessPip : IDisposable
{
/// <summary>
/// Allows awaiting remote processing completion.
/// </summary>
/// <exception cref="TaskCanceledException">
/// The caller-provided cancellation token was signaled or the object was disposed.
/// </exception>
Task<IRemoteProcessPipResult> Completion { get; }
}
}
|
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Chroma64.Emulator.CPU
{
public enum RoundMode
{
/// <summary>
/// Rounding towards nearest representable value.
/// </summary>
FE_TONEAREST = 0x00000000,
/// <summary>
/// Rounding towards negative infinity.
/// </summary>
FE_DOWNWARD = 0x00000100,
/// <summary>
/// Rounding towards positive infinity.
/// </summary>
FE_UPWARD = 0x00000200,
/// <summary>
/// Rounding towards zero.
/// </summary>
FE_TOWARDZERO = 0x00000300,
}
class COP1
{
private int fcr31 = 0;
public int FCR31
{
get { return fcr31; }
set
{
fcr31 = value;
// Set Rounding Mode
switch (value & 0b11)
{
case 0b00:
SetRound(RoundMode.FE_TONEAREST);
break;
case 0b01:
SetRound(RoundMode.FE_TOWARDZERO);
break;
case 0b10:
SetRound(RoundMode.FE_UPWARD);
break;
case 0b11:
SetRound(RoundMode.FE_DOWNWARD);
break;
}
}
}
private byte[] bytes = new byte[32 * 8];
private MainCPU parent;
public COP1(MainCPU parent)
{
this.parent = parent;
}
#region Rounding Mode Functions
[DllImport("ucrtbase.dll", EntryPoint = "fegetround", CallingConvention = CallingConvention.Cdecl)]
public static extern RoundMode GetRound();
[DllImport("ucrtbase.dll", EntryPoint = "fesetround", CallingConvention = CallingConvention.Cdecl)]
public static extern int SetRound(RoundMode roundingMode);
#endregion
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetFGR<T>(int index, T value) where T : unmanaged
{
fixed (byte* ptr = bytes)
{
if ((parent.COP0.GetReg(COP0REG.Status) & (1 << 26)) == 0)
{
ulong val = sizeof(T) == 8 ? (*(ulong*)&value) : (*(uint*)&value);
uint hi = (uint)((val & 0xFFFFFFFF00000000) >> 32);
uint lo = (uint)(val & 0xFFFFFFFF);
*(uint*)(ptr + 8 * index) = lo;
*(uint*)(ptr + 8 * (index + 1)) = hi;
}
else
{
if (sizeof(T) == 4)
{
uint val = *(uint*)&value;
*(uint*)(ptr + 8 * index) = val;
}
else
{
ulong val = *(ulong*)&value;
*(ulong*)(ptr + 8 * index) = val;
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe T GetFGR<T>(int index) where T : unmanaged
{
fixed (byte* ptr = bytes)
{
if ((parent.COP0.GetReg(COP0REG.Status) & (1 << 26)) == 0)
{
uint lo = *(uint*)(ptr + 8 * index);
uint hi = *(uint*)(ptr + 8 * (index + 1));
ulong val = lo | (((ulong)hi) << 32);
return *(T*)&val;
}
else
return *(T*)(ptr + 8 * index);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetCondition(bool value)
{
if (value)
fcr31 |= 1 << 23;
else
fcr31 &= ~(1 << 23);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool GetCondition()
{
return (fcr31 & (1 << 23)) != 0;
}
#region CVT Instructions
// CVT.D.fmt
public void CVT_D_S(int src, int dest) { SetFGR(dest, (double)GetFGR<float>(src)); }
public void CVT_D_W(int src, int dest) { SetFGR(dest, (double)GetFGR<int>(src)); }
public void CVT_D_L(int src, int dest) { SetFGR(dest, (double)GetFGR<long>(src)); }
// CVT.S.fmt
public void CVT_S_D(int src, int dest) { SetFGR(dest, (float)GetFGR<double>(src)); }
public void CVT_S_W(int src, int dest) { SetFGR(dest, (float)GetFGR<int>(src)); }
public void CVT_S_L(int src, int dest) { SetFGR(dest, (float)GetFGR<long>(src)); }
// CVT.W.fmt
public void CVT_W_D(int src, int dest) { SetFGR(dest, (int)GetFGR<double>(src)); }
public void CVT_W_S(int src, int dest) { SetFGR(dest, (int)GetFGR<float>(src)); }
// CVT.L.fmt
public void CVT_L_D(int src, int dest) { SetFGR(dest, (long)GetFGR<double>(src)); }
public void CVT_L_S(int src, int dest) { SetFGR(dest, (long)GetFGR<float>(src)); }
#endregion
#region ABS Instructions
public void ABS_D(int src, int dest) { SetFGR(dest, Math.Abs(GetFGR<double>(src))); }
public void ABS_S(int src, int dest) { SetFGR(dest, Math.Abs(GetFGR<float>(src))); }
#endregion
#region ADD Instructions
public void ADD_D(int op1, int op2, int dest) { SetFGR(dest, GetFGR<double>(op1) + GetFGR<double>(op2)); }
public void ADD_S(int op1, int op2, int dest) { SetFGR(dest, GetFGR<float>(op1) + GetFGR<float>(op2)); }
#endregion
#region MUL Instructions
public void MUL_D(int op1, int op2, int dest) { SetFGR(dest, GetFGR<double>(op1) * GetFGR<double>(op2)); }
public void MUL_S(int op1, int op2, int dest) { SetFGR(dest, GetFGR<float>(op1) * GetFGR<float>(op2)); }
#endregion
#region SUB Instructions
public void SUB_D(int op1, int op2, int dest) { SetFGR(dest, GetFGR<double>(op1) - GetFGR<double>(op2)); }
public void SUB_S(int op1, int op2, int dest) { SetFGR(dest, GetFGR<float>(op1) - GetFGR<float>(op2)); }
#endregion
#region DIV Instructions
public void DIV_D(int op1, int op2, int dest) { SetFGR(dest, GetFGR<double>(op1) / GetFGR<double>(op2)); }
public void DIV_S(int op1, int op2, int dest) { SetFGR(dest, GetFGR<float>(op1) / GetFGR<float>(op2)); }
#endregion
#region TRUNC Instructions
// TRUNC.L.fmt
public void TRUNC_L_D(int src, int dest)
{
RoundMode curRound = GetRound();
SetRound(RoundMode.FE_TOWARDZERO);
SetFGR(dest, (long)GetFGR<double>(src));
SetRound(curRound);
}
public void TRUNC_L_S(int src, int dest)
{
RoundMode curRound = GetRound();
SetRound(RoundMode.FE_TOWARDZERO);
SetFGR(dest, (long)GetFGR<float>(src));
SetRound(curRound);
}
// TRUNC.W.fmt
public void TRUNC_W_D(int src, int dest)
{
RoundMode curRound = GetRound();
SetRound(RoundMode.FE_TOWARDZERO);
SetFGR(dest, (int)GetFGR<double>(src));
SetRound(curRound);
}
public void TRUNC_W_S(int src, int dest)
{
RoundMode curRound = GetRound();
SetRound(RoundMode.FE_TOWARDZERO);
SetFGR(dest, (int)GetFGR<float>(src));
SetRound(curRound);
}
#endregion
#region Compare Instructions
// C.EQ.fmt
public void C_EQ_D(int op1, int op2) { SetCondition(GetFGR<double>(op1) == GetFGR<double>(op2)); }
public void C_EQ_S(int op1, int op2) { SetCondition(GetFGR<float>(op1) == GetFGR<float>(op2)); }
// C.LE.fmt
public void C_LE_D(int op1, int op2) { SetCondition(GetFGR<double>(op1) <= GetFGR<double>(op2)); }
public void C_LE_S(int op1, int op2) { SetCondition(GetFGR<float>(op1) <= GetFGR<float>(op2)); }
// C.LT.fmt
public void C_LT_D(int op1, int op2) { SetCondition(GetFGR<double>(op1) < GetFGR<double>(op2)); }
public void C_LT_S(int op1, int op2) { SetCondition(GetFGR<float>(op1) < GetFGR<float>(op2)); }
#endregion
}
}
|
using System.Collections.Generic;
using DAL.Siniflar;
using OBJ;
namespace BL
{
public class BSiparis :DSiparis
{
//Siparis ürün ekleme
public new OIslemSonuc<int> siparisEkle(OSiparis _s)
{
return base.siparisEkle(_s);
}//siparisEkle()
//Siparis ürün güncelleme
public new OIslemSonuc<bool> siparisGuncelle(OSiparis _s)
{
return base.siparisGuncelle(_s);
}//siparisGuncelle()
//Siparis ürün silme
public new OIslemSonuc<bool> siparisSil(int id)
{
return base.siparisSil(id);
}//siparisSil()
//Siparis ürün bilgisi
public new OIslemSonuc<OSiparis> siparisBilgisi(int id)
{
return base.siparisBilgisi(id);
}//siparisBilgisi()
//Siparis ürün arama
public new OIslemSonuc<List<OSiparis>> siparisAra(string ad)
{
return base.siparisAra(ad);
}//siparisAra()
//Siparis ürün görüntüleme
public new OIslemSonuc<List<OSiparis>> siparisListele()
{
return base.siparisListele();
}//siparisListele()
//Siparis ürün görüntüleme
public new OIslemSonuc<List<OSiparis>> teslimEdilmemisSiparisListele()
{
return base.teslimEdilmemisSiparisListele();
}//teslimEdilmemisSiparisListele()
//siparis durum güncellemesi
public new OIslemSonuc<bool> siparisDurumGuncelle(OSiparis _s)
{
return base.siparisDurumGuncelle(_s);
}//siparisDurumGuncelle()
// Sepete bir ürün ekleme
public new OIslemSonuc<bool> sepeteEkle(OSepet _s)
{
return base.sepeteEkle(_s);
}//sepeteEkle()
//sepete bir çok ürün ekleme
public new OIslemSonuc<bool> cokluSepeteEkleme(List<OSepet> _s)
{
return base.cokluSepeteEkleme(_s);
}//cokluSepeteEkleme()
//sepetten bir ürün silme
public new OIslemSonuc<bool> sepettenSil(int id)
{
return base.sepettenSil(id);
}//sepettenSil()
//bir sepetteki tüm ürünleri silme
public new OIslemSonuc<bool> cokluSepettenSil(int siparis_)
{
return base.cokluSepettenSil(siparis_);
}//cokluSepettenSil()
//bir sepetteki ürünleri listeleme
public new OIslemSonuc<List<OSepet>> sepettekiler(int siparis_)
{
return base.sepettekiler(siparis_);
}//sepettekiler()
}
}
|
#region License
//
// Author: Einar Ingebrigtsen <einar@dolittle.com>
// Copyright (c) 2007-2010, DoLittle Studios
//
// Licensed under the Microsoft Permissive License (Ms-PL), Version 1.1 (the "License")
// you may not use this file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://balder.codeplex.com/license
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
using System.Linq.Expressions;
using System.Reflection;
namespace Balder.Core.Extensions
{
public static class ExpressionExtensions
{
public static MemberExpression GetMemberExpression(this Expression expression)
{
var lambda = expression as LambdaExpression;
MemberExpression memberExpression;
if (lambda.Body is UnaryExpression)
{
var unaryExpression = lambda.Body as UnaryExpression;
memberExpression = unaryExpression.Operand as MemberExpression;
}
else
{
memberExpression = lambda.Body as MemberExpression;
}
return memberExpression;
}
public static FieldInfo GetFieldInfo(this Expression expression)
{
var memberExpression = GetMemberExpression(expression);
var fieldInfo = memberExpression.Member as FieldInfo;
return fieldInfo;
}
public static PropertyInfo GetPropertyInfo(this Expression expression)
{
var memberExpression = GetMemberExpression(expression);
var propertyInfo = memberExpression.Member as PropertyInfo;
return propertyInfo;
}
public static object GetInstance(this Expression expression)
{
var memberExpression = GetMemberExpression(expression);
var constantExpression = memberExpression.Expression as ConstantExpression;
if (null == constantExpression)
{
var innerMember = memberExpression.Expression as MemberExpression;
constantExpression = innerMember.Expression as ConstantExpression;
if( null != innerMember && innerMember.Member is PropertyInfo )
{
var value = ((PropertyInfo) innerMember.Member).GetValue(constantExpression.Value, null);
return value;
}
}
return constantExpression.Value;
}
public static T GetInstance<T>(this Expression expression)
{
return (T)GetInstance(expression);
}
}
} |
@model HealthHub.Web.ViewModels.Doctor.DoctorsViewModel
@{ ViewData["Title"] = "Default"; }
<div class="form-group row">
<label class="col-sm-2 col-form-label">Doctor</label>
<div class="col-sm-10">
<div class="form-control">@Model.FullName</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Clinic</label>
<div class="col-sm-10">
<div class="form-control">@Model.ClinicName</div>
</div>
</div>
|
namespace DurableBotEngine.Configurations
{
public class LineMessagingApiSettings
{
public string ChannelSecret { get; set; }
public string ChannelAccessToken { get; set; }
}
}
|
using System.Collections;
using Enmeshed.BuildingBlocks.Application.Abstractions.Exceptions;
using FluentValidation;
using FluentValidation.Validators;
namespace Enmeshed.BuildingBlocks.Application.FluentValidation
{
public class ValueInValidator<T, TProperty> : PropertyValidator<T, TProperty>
{
private readonly string _commaSeparatedListOfValidValues;
public ValueInValidator(IEnumerable validValues)
{
if (validValues == null) throw new ArgumentNullException(nameof(validValues));
var validValuesList = new List<object>();
foreach (var validValue in validValues) validValuesList.Add(validValue);
ValidValues = validValuesList;
var numberOfValidValues = ValidValues.Count();
if (numberOfValidValues == 0)
throw new ArgumentException("At least one valid option is expected", nameof(validValues));
_commaSeparatedListOfValidValues =
$"[{string.Join(", ", ValidValues.Select(v => v == null ? "null" : v.ToString()).ToArray())}]";
}
public IEnumerable<object?> ValidValues { get; }
public override string Name => "ValueInValidator";
private void ValidateValidValuesType()
{
var propertyValueType = typeof(TProperty);
foreach (var validValue in ValidValues)
if (validValue == null || validValue.GetType() != propertyValueType)
throw new ArgumentException(
$"All objects in 'validValues' have to be of type '{propertyValueType}'");
}
public override bool IsValid(ValidationContext<T> context, TProperty value)
{
if (value == null) return ValidValues.Contains(null);
ValidateValidValuesType();
if (!ValidValues.Contains(value))
{
context.MessageFormatter.AppendArgument("ValidValues", _commaSeparatedListOfValidValues);
return false;
}
return true;
}
protected override string GetDefaultMessageTemplate(string errorCode)
{
return $"'{{PropertyName}}' must have one of the following values: {ValidValues}";
}
}
public static class ValidatorExtensions
{
public static IRuleBuilderOptions<T, TProperty> In<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder,
params TProperty[] validOptions)
{
return ruleBuilder
.SetValidator(new ValueInValidator<T, TProperty>(validOptions))
.WithErrorCode(GenericApplicationErrors.Validation.InvalidPropertyValue().Code);
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace DesignPatterns.Command
{
public abstract class RemoteControlDevice
{
public abstract void TurnOn();
public abstract void TurnOff();
}
} |
using System;
namespace Singyeong
{
/// <summary>
/// An exception thrown when a Singyeong server sends
/// <see cref="SingyeongOpcode.Invalid" /> indicating that an error
/// occured.
/// </summary>
public class UnknownErrorException : Exception
{
/// <summary>
/// Initializes a new instance of
/// <see cref="UnknownErrorException"/>.
/// </summary>
/// <param name="message">
/// The error message sent by the server.
/// </param>
public UnknownErrorException(string message) : base(message)
{ }
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImputationH31per.Modele.Entite;
namespace ImputationH31per.Vue.RapportMensuel.Modele.Entite
{
public class TicketItem : InformationBaseItem<IInformationTicketTfs>
{
public TicketItem(EnumTypeItem typeItem)
: base(typeItem)
{
}
public TicketItem(IInformationImputationTfs information)
: base(information)
{
}
protected override string ObtenirLibelleEntite()
{
return String.Format("{0} : {1}", Information.NumeroComplet(), Information.NomComplet());
}
protected override bool EntiteEgale(IInformationTicketTfs entite)
{
return (Entite.Numero == entite.Numero)
&& (Entite.NumeroComplementaire == entite.NumeroComplementaire);
}
public override EnumTypeInformation TypeInformation
{
get { return EnumTypeInformation.Ticket; }
}
public static readonly TicketItem Tous = new TicketItem(EnumTypeItem.Tous);
}
} |
namespace WatchMe.Web.Controllers
{
using Base;
using Data.Models;
using Infastructure.Mapping;
using Microsoft.AspNet.Identity;
using System.Linq;
using System.Web.Mvc;
using ViewModels.Movies;
using WatchMe.Services.Data.Contracts;
public class MoviesController : BaseController
{
private IMoviesService moviesService;
private IUsersService usersService;
public MoviesController(IMoviesService moviesService, IUsersService usersService)
{
this.usersService = usersService;
this.moviesService = moviesService;
}
public ActionResult Details(string id)
{
MovieState? movieState = null;
if (this.User.Identity.IsAuthenticated)
{
movieState = this.moviesService.GetMovieStateForCurrentUser(id, this.User.Identity.GetUserId());
}
var movie = this.moviesService.MovieById(id).To<MovieViewModel>().FirstOrDefault();
movie.State = movieState;
return View(movie);
}
[OutputCache(Duration = 24 * 60 * 60)]
[ChildActionOnly]
public ActionResult DailyMovie()
{
var dailyMovie = this.moviesService.GetDailyMovie().To<DailyMovieViewModel>().FirstOrDefault();
return PartialView("Partials/_SidebarDailyMovie", dailyMovie);
}
[Authorize]
public ActionResult ChangeStatus(string movieId, int statusNumber)
{
this.usersService.ChangeMovieStatus(movieId, statusNumber, this.User.Identity.GetUserId());
return this.RedirectToAction("Details", new { id = movieId });
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Rebus.Logging;
using Rebus.Testing;
using Rhino.Mocks;
namespace Rebus.AdoNet
{
public abstract class FixtureBase
{
protected DisposableTracker Disposables { get; }
public FixtureBase()
{
Disposables = new DisposableTracker();
}
[SetUp]
public void SetUp()
{
//TimeMachine.Reset();
FakeMessageContext.Reset();
RebusLoggerFactory.Reset();
}
[TearDown]
public void TearDown()
{
Disposables.DisposeTheDisposables();
}
}
}
|
namespace BeanstalkWorker.SimpleRouting
{
public static class RoutingConstants
{
public const string HeaderName = "Task";
public const string HeaderType = "String";
}
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace s.library
{
public class Parse:Function
{
public Parse(Node<Object> defaultScope,char lineSplit)
: base()
{
this.defaultScope = defaultScope;
this.lineSplit = lineSplit;
}
private char lineSplit;
private Node<Object> defaultScope;
public override string ToString()
{
return "parse";
}
public override Function.Function_Type Function_type()
{
return Function_Type.Fun_BuildIn;
}
public override object exec(Node<object> args)
{
String str = args.First() as String;
args = args.Rest();
Node<Object> scope = defaultScope;
if (args != null)
{
scope = args.First() as Node<Object>;
}
Node<Token> tokens = Token.run(str, lineSplit);
Exp exp = Exp.Parse(tokens);
UserFunction f = new UserFunction(exp, scope);
return f.exec(null);
}
}
}
|
using System;
namespace _07.TerabytesToBits
{
class Program
{
static void Main(string[] args)
{
decimal a = decimal.Parse(Console.ReadLine());
a = a * 1024 * 1024 * 1024 * 1024 * 8;
Console.WriteLine("{0:0}",a);
}
}
}
|
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
namespace AGGE.CharacterController2D {
public class GameManager : MonoBehaviour {
public bool showCurves = true;
public AudioClip[] jumpSounds;
public Material[] materials;
public static GameManager instance;
bool initLeftTrigger;
AudioSource audioSource;
protected void Awake() {
instance = this;
audioSource = GetComponent<AudioSource>();
}
protected void Update() {
if (Input.GetKeyDown(KeyCode.R)) {
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
if (Input.GetKeyDown(KeyCode.H)) {
showCurves = !showCurves;
}
float leftTrigger = GetLeftTrigger();
float timeScale = 1 - (leftTrigger / 1.2f);
if (timeScale > 0.9f) {
timeScale = 1f;
}
if (timeScale < 0.05f) {
timeScale = 0.05f;
}
Time.timeScale = timeScale;
}
float GetLeftTrigger() {
float trigger = Gamepad.current == null
? 0
: Gamepad.current.leftTrigger.ReadValue();
if (!initLeftTrigger) {
if (trigger == 0) {
return 0;
} else {
initLeftTrigger = true;
}
}
return (trigger - 1) / -2;
}
public void PlayJumpSound() {
int index = Random.Range(0, jumpSounds.Length);
audioSource.clip = jumpSounds[index];
audioSource.Play();
}
}
} |
using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using VocabInstaller.Validations;
namespace VocabInstaller.Models {
public class Card {
[HiddenInput(DisplayValue = false)]
public int Id { get; set; }
[HiddenInput(DisplayValue = false)]
public int UserId { get; set; }
[Required]
[StringLength(maximumLength: 256)]
[Unique("Question", userEach:true, editMode:true, ErrorMessage = "The question already exists.")]
public string Question { get; set; }
[Required]
[StringLength(maximumLength: 256)]
public string Answer { get; set; }
[StringLength(maximumLength: 512)]
public string Note { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}", ApplyFormatInEditMode = true)]
public DateTime CreatedAt { get; set; }
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}", ApplyFormatInEditMode = true)]
public DateTime ReviewedAt { get; set; }
[Display(Name = "Review Level")]
[Range(0, 5, ErrorMessage = "Please enter a revew lebel between 0 and 5")]
public int ReviewLevel { get; set; }
}
}
|
using System.Net;
using System.ServiceProcess;
namespace Sequencing.WeatherApp.Service
{
partial class EmailSendService : ServiceBase
{
public EmailSendService()
{
InitializeComponent();
}
private EmailSendProcessor proc;
private PushNotificationSender pushSender;
protected override void OnStart(string[] args)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
pushSender = new PushNotificationSender();
pushSender.Init();
proc = new EmailSendProcessor();
proc.Start();
}
protected override void OnStop()
{
proc.Stop();
pushSender.Stop();
}
}
}
|
using System;
using System.Collections.Generic;
using System.Dynamic;
namespace Ganss.Excel
{
/// <summary>
/// A caching factory of <see cref="TypeMapper"/> objects.
/// </summary>
public class TypeMapperFactory : ITypeMapperFactory
{
Dictionary<Type, TypeMapper> TypeMappers { get; set; } = new Dictionary<Type, TypeMapper>();
/// <summary>
/// Creates a <see cref="TypeMapper"/> for the specified type.
/// </summary>
/// <param name="type">The type to create a <see cref="TypeMapper"/> object for.</param>
/// <returns>A <see cref="TypeMapper"/> for the specified type.</returns>
public TypeMapper Create(Type type)
{
if (!TypeMappers.TryGetValue(type, out TypeMapper typeMapper))
typeMapper = TypeMappers[type] = TypeMapper.Create(type);
return typeMapper;
}
/// <summary>
/// Creates a <see cref="TypeMapper"/> for the specified object.
/// </summary>
/// <param name="o">The object to create a <see cref="TypeMapper"/> object for.</param>
/// <returns>A <see cref="TypeMapper"/> for the specified object.</returns>
public TypeMapper Create(object o)
{
if (o is ExpandoObject eo)
{
return TypeMapper.Create(eo);
}
else
{
return Create(o.GetType());
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BullSpriteCont : PawnSpriteCont
{
[SerializeField]
protected BullPawn bullPawn;
public void SetIsSinging()
{
bullPawn.OwnStateMachine.isSinging = true;
}
public override void FlashSprite(bool toggle)
{
if (!isFlashing)
{
StartCoroutine(FlashBullSprite());
}
}
IEnumerator FlashBullSprite()
{
spriteTexture.color = Color.red;
isFlashing = true;
yield return new WaitForSeconds(0.3f);
spriteTexture.color = Color.white;
isFlashing = false;
}
}
|
using System.ComponentModel.DataAnnotations;
using MyE.Entities;
using Newtonsoft.Json;
namespace MyE.Business.Entities.Response
{
public class EjemplarRes
{
[Display(Name = "ejemplarId")]
[JsonProperty(PropertyName = "ejemplarId")]
public int ejemplarId { get; set; }
[Display(Name = "numeroSerieEjemplar")]
[JsonProperty(PropertyName = "numeroSerieEjemplar")]
public int numeroSerieEjemplar { get; set; }
[Display(Name = "nombreModelo")]
[JsonProperty(PropertyName = "nombreModelo")]
public string nombreModelo{ get; set; }
//public EquipoRes Equipo { get; set; }
public EjemplarRes(Ejemplar objEjemplar, bool isLogin = false)
{
this.ejemplarId = objEjemplar.EjemplarId;
this.numeroSerieEjemplar = objEjemplar.NumSerie;
//this.Equipo = new EquipoRes(objEjemplar.Equipo);
this.nombreModelo = objEjemplar.Equipo.Modelo.Nmodelo;
}
public EjemplarRes() { }
}
}
|
namespace StudentsLearning.Services.Data.Contracts
{
#region
using System.Collections.Generic;
using System.Linq;
using StudentsLearning.Data.Models;
#endregion
public interface ITopicsServices
{
IQueryable<Topic> All(int sectionId, int page, int pageSize);
IQueryable<Topic> All(string contributorId);
IQueryable<Topic> GetById(int id);
IQueryable<Topic> GetByTitle(string title);
void Add(Topic topic, User contributor);
// void Update(Topic topic, ZipFile newfile, ICollection<Example> newExamples);
void Update(Topic topic);
void Delete(Topic topic);
}
} |
using System;
namespace Crypto.Infrastructure
{
public static class Algorithms
{
/// <summary>
/// Finds the greatest common denomintor of two numbers.
/// </summary>
/// <param name="a">The first number.</param>
/// <param name="b">The second number.</param>
/// <returns>The greatest common denomintor of a and b.</returns>
public static (int Value, int X, int Y) GCD(
int a, int b)
{
(int Value, int X, int Y) GCDInternal(
int r1, int r2, int x1, int x2, int y1, int y2)
{
int r3 = r1 - r2 * (r1 / r2);
int x3 = x1 - x2 * (r1 / r2);
int y3 = y1 - y2 * (r1 / r2);
return r3 != 0
? GCDInternal(r2, r3, x2, x3, y2, y3)
: (r2, x2, y2);
}
var result = GCDInternal(Math.Max(a, b), Math.Min(a, b), 1, 0, 0, 1);
return a > b
? result
: (result.Value, result.Y, result.X);
}
/// <summary>
/// Finds m^p mod n.
/// </summary>
/// <param name="m">The divident.</param>
/// <param name="p">The power.</param>
/// <param name="n">The modulo</param>
/// <returns>m^p mod n.</returns>
public static int Modulo(int m, int p, int n)
{
int value = m % n;
int result = (p & 1) != 0 ? value : 1;
for (int i = 2; i <= p; i <<= 1)
{
value = (value * value) % n;
if ((p & i) != 0)
{
result *= value;
result %= n;
}
}
return result;
}
}
}
|
using System;
using System.Collections.Generic;
using Microsoft.Html.Editor.Intellisense;
using Microsoft.VisualStudio.Utilities;
using Microsoft.Web.Editor;
namespace MadsKristensen.EditorExtensions.Html
{
[HtmlCompletionProvider(CompletionType.Values, "link", "sizes")]
[ContentType(HtmlContentTypeDefinition.HtmlContentType)]
public class AppleLinkCompletion : StaticListCompletion
{
protected override string KeyProperty { get { return "rel"; } }
public AppleLinkCompletion()
: base(new Dictionary<string, IEnumerable<string>>(StringComparer.OrdinalIgnoreCase)
{
{ "apple-touch-icon", Values("72x72", "114x114", "144x144") }
}) { }
}
}
|
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace HolePunch.Proxies
{
public interface IProxyServer
{
Guid Id { get; }
IReadOnlyCollection<IProxySession> Sessions { get; }
ProxyServerStatus Status { get; }
int ListenPort { get; }
IPEndPoint ForwardEndPoint { get; }
event Action<IProxySession> OnConnected;
event Action<IProxySession> OnDisconnected;
Task Start();
Task Stop();
}
}
|
using System.Collections.Generic;
using SqExpress.Syntax.Names;
using SqExpress.Syntax.Select;
using SqExpress.Syntax.Value;
namespace SqExpress.Syntax.Functions
{
public class ExprAnalyticFunction : IExprSelecting
{
public ExprAnalyticFunction(ExprFunctionName name, IReadOnlyList<ExprValue>? arguments, ExprOver over)
{
this.Name = name;
this.Arguments = arguments;
this.Over = over;
}
public ExprFunctionName Name { get; }
public IReadOnlyList<ExprValue>? Arguments { get; }
public ExprOver Over { get; }
public TRes Accept<TRes, TArg>(IExprVisitor<TRes, TArg> visitor, TArg arg)
=> visitor.VisitExprAnalyticFunction(this, arg);
}
} |
namespace MyStrom.Api.Models
{
public class Report
{
public decimal Power { get; set; }
public bool Relay { get; set; }
public decimal Temperature { get; set; }
}
} |
using System;
using System.Threading.Tasks;
using System.Windows.Input;
namespace CodeMonkeys.MVVM.Commands
{
public class AsyncCommand :
ICommand
{
private readonly Func<object, Task> _executeFunc;
private readonly Predicate<object> _canExecute;
public event EventHandler CanExecuteChanged;
public AsyncCommand(
Func<object, Task> executeFunc)
{
if (executeFunc == null)
throw new ArgumentNullException(
nameof(executeFunc));
_executeFunc = executeFunc;
}
public AsyncCommand(
Func<Task> executeFunc)
: this(aiObject => executeFunc())
{
if (executeFunc == null)
throw new ArgumentNullException(
nameof(executeFunc));
}
public AsyncCommand(
Func<object, Task> executeFunc,
Predicate<object> canExecute)
: this(executeFunc)
{
if (canExecute == null)
throw new ArgumentNullException(
nameof(canExecute));
_canExecute = canExecute;
}
public AsyncCommand(
Func<Task> executeFunc,
Func<bool> canExecuteFunc)
: this(
aiObject => executeFunc(),
aiObject => canExecuteFunc())
{
if (executeFunc == null)
throw new ArgumentNullException(
nameof(executeFunc));
if (canExecuteFunc == null)
throw new ArgumentNullException(
nameof(canExecuteFunc));
}
public async Task Execute(
object parameter)
{
if (!CanExecute(
parameter))
return;
await _executeFunc(
parameter);
}
async void ICommand.Execute(
object parameter)
{
await Execute(
parameter);
}
public bool CanExecute(
object parameter)
{
if (_canExecute != null)
return _canExecute(
parameter);
return true;
}
public void UpdateCanExecute()
{
var threadSafeCall = CanExecuteChanged;
threadSafeCall?.Invoke(
this,
EventArgs.Empty);
}
}
} |
public static class PointerType // TypeDefIndex: 4210
{
// Fields
public static readonly string mouse; // 0x0
public static readonly string touch; // 0x8
public static readonly string pen; // 0x10
public static readonly string unknown; // 0x18
// Methods
// RVA: 0x15C8470 Offset: 0x15C8571 VA: 0x15C8470
internal static string GetPointerType(int pointerId) { }
// RVA: 0x15C53E0 Offset: 0x15C54E1 VA: 0x15C53E0
internal static bool IsDirectManipulationDevice(string pointerType) { }
// RVA: 0x15C8540 Offset: 0x15C8641 VA: 0x15C8540
private static void .cctor() { }
}
|
#region usings
using System.Linq;
using osu.Core;
using osu.Core.Config;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Mods.Online.Base;
using osu.Mods.Online.Multi.Match.Packets;
using osuTK;
using osuTK.Graphics;
using Sym.Networking.NetworkingHandlers.Peer;
using Sym.Networking.Packets;
#endregion
namespace osu.Mods.Online.Multi.Match.Pieces
{
public class Chat : MultiplayerContainer
{
private string playerColorHex = SymcolOsuModSet.SymConfigManager.GetBindable<string>(SymSetting.PlayerColor);
private readonly FillFlowContainer<ChatMessage> messageFlow;
private readonly OsuScrollContainer scroll;
public Chat(OsuNetworkingHandler osuNetworkingHandler) : base (osuNetworkingHandler)
{
OsuTextBox textBox;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
RelativeSizeAxes = Axes.Both;
Height = 0.46f;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.8f
},
scroll = new OsuScrollContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
Children = new Drawable[]
{
messageFlow = new FillFlowContainer<ChatMessage>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
}
},
textBox = new OsuTextBox
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X,
Width = 0.98f,
Height = 36,
Position = new Vector2(0, -12),
Colour = Color4.White,
PlaceholderText = "Type Message Here!",
ReleaseFocusOnCommit = false,
}
};
textBox.OnCommit += (s, r) =>
{
AddMessage(textBox.Text);
textBox.Text = "";
};
}
protected override void OnPacketRecieve(PacketInfo<Host> info)
{
if (info.Packet is ChatPacket chatPacket)
Add(chatPacket);
}
public void Add(ChatPacket packet)
{
ChatMessage message = new ChatMessage(packet);
messageFlow.Add(message);
if (scroll.IsScrolledToEnd(10) || !messageFlow.Children.Any())
scrollToEnd();
}
public void AddMessage(string message)
{
if (message == "" | message == " ")
return;
try
{
OsuColour.FromHex(playerColorHex);
}
catch
{
playerColorHex = "#ffffff";
}
SendPacket(new ChatPacket
{
AuthorColor = playerColorHex,
Message = message,
});
}
private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd());
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UI_Manager : singleton<UI_Manager>
{
[SerializeField]
GameObject[] keyFeaturesList;
[SerializeField]
GameObject videoScreen;
[SerializeField]
Slider rotationSlider;
private void Awake()
{
//If the video is unassigned
if (videoScreen == null)
{
//find the tagged object.
videoScreen = GameObject.FindGameObjectWithTag("Video");
}
}
//Getter allows to objects fields to be accesed by other scripts without changing them.
public Slider GetSlider()
{
return rotationSlider;
}
//Show the video player.
public void ShowVideo()
{
videoScreen.SetActive(true);
}
//A function that needs to be passed a number that fits the desired gameobject.
//We first ensure all previous key features are disabled then only enable the new one.
public void ShowKeyFeature(int arrayNumber)
{
foreach (GameObject item in keyFeaturesList)
{
item.SetActive(false);
}
keyFeaturesList[arrayNumber].SetActive(true);
}
//Opens the product website on the users device.
//May want to add check here to ensure the user wants to be directed away from the app.
public void ShowWebsite()
{
Application.OpenURL("https://www.sony.co.uk/electronics/headband-headphones/wh-h900n");
}
}
|
using System.Xml.Serialization;
using System.IO;
using System.Text;
public class SavingSystem
{
public static void SaveDialogue(string path, DialogueSystemContainer dsContainer)
{
var serializer = new XmlSerializer(typeof(DialogueSystemContainer));
var encoding = Encoding.GetEncoding("UTF-8");
using (var stream = new StreamWriter(path, false, encoding))
{
serializer.Serialize(stream, dsContainer);
}
}
public static DialogueSystemContainer LoadDialogue(string path)
{
var serializer = new XmlSerializer(typeof(DialogueSystemContainer));
using (var stream = new FileStream(path, FileMode.Open))
{
return serializer.Deserialize(stream) as DialogueSystemContainer;
}
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
using UnitConverter.Currency.Models;
namespace UnitConverter.Currency.Loaders
{
public interface ICurrencyDataLoader
{
Task<List<CurrencyConverterItem>> LoadCurrencyConverterItem();
Task<List<CurrencyItem>> LoadCurrencyItem();
}
} |
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using MLAgents;
public class GridArea : MonoBehaviour
{
[HideInInspector]
public List<GameObject> actorObjs;
[HideInInspector]
public int[] players;
public GameObject trueAgent;
IFloatProperties m_ResetParameters;
Camera m_AgentCam;
public GameObject goalPref;
public GameObject pitPref;
GameObject[] m_Objects;
GameObject m_Plane;
GameObject m_Sn;
GameObject m_Ss;
GameObject m_Se;
GameObject m_Sw;
Vector3 m_InitialPosition;
public void Start()
{
m_ResetParameters = FindObjectOfType<Academy>().FloatProperties;
m_Objects = new[] { goalPref, pitPref };
m_AgentCam = transform.Find("agentCam").GetComponent<Camera>();
actorObjs = new List<GameObject>();
var sceneTransform = transform.Find("scene");
m_Plane = sceneTransform.Find("Plane").gameObject;
m_Sn = sceneTransform.Find("sN").gameObject;
m_Ss = sceneTransform.Find("sS").gameObject;
m_Sw = sceneTransform.Find("sW").gameObject;
m_Se = sceneTransform.Find("sE").gameObject;
m_InitialPosition = transform.position;
}
public void SetEnvironment()
{
transform.position = m_InitialPosition * (m_ResetParameters.GetPropertyWithDefault("gridSize", 5f) + 1);
var playersList = new List<int>();
for (var i = 0; i < (int)m_ResetParameters.GetPropertyWithDefault("numObstacles", 1); i++)
{
playersList.Add(1);
}
for (var i = 0; i < (int)m_ResetParameters.GetPropertyWithDefault("numGoals", 1f); i++)
{
playersList.Add(0);
}
players = playersList.ToArray();
var gridSize = (int)m_ResetParameters.GetPropertyWithDefault("gridSize", 5f);
m_Plane.transform.localScale = new Vector3(gridSize / 10.0f, 1f, gridSize / 10.0f);
m_Plane.transform.localPosition = new Vector3((gridSize - 1) / 2f, -0.5f, (gridSize - 1) / 2f);
m_Sn.transform.localScale = new Vector3(1, 1, gridSize + 2);
m_Ss.transform.localScale = new Vector3(1, 1, gridSize + 2);
m_Sn.transform.localPosition = new Vector3((gridSize - 1) / 2f, 0.0f, gridSize);
m_Ss.transform.localPosition = new Vector3((gridSize - 1) / 2f, 0.0f, -1);
m_Se.transform.localScale = new Vector3(1, 1, gridSize + 2);
m_Sw.transform.localScale = new Vector3(1, 1, gridSize + 2);
m_Se.transform.localPosition = new Vector3(gridSize, 0.0f, (gridSize - 1) / 2f);
m_Sw.transform.localPosition = new Vector3(-1, 0.0f, (gridSize - 1) / 2f);
m_AgentCam.orthographicSize = (gridSize) / 2f;
m_AgentCam.transform.localPosition = new Vector3((gridSize - 1) / 2f, gridSize + 1f, (gridSize - 1) / 2f);
}
public void AreaReset()
{
var gridSize = (int)m_ResetParameters.GetPropertyWithDefault("gridSize", 5f);
foreach (var actor in actorObjs)
{
DestroyImmediate(actor);
}
SetEnvironment();
actorObjs.Clear();
var numbers = new HashSet<int>();
while (numbers.Count < players.Length + 1)
{
numbers.Add(Random.Range(0, gridSize * gridSize));
}
var numbersA = Enumerable.ToArray(numbers);
for (var i = 0; i < players.Length; i++)
{
var x = (numbersA[i]) / gridSize;
var y = (numbersA[i]) % gridSize;
var actorObj = Instantiate(m_Objects[players[i]], transform);
actorObj.transform.localPosition = new Vector3(x, -0.25f, y);
actorObjs.Add(actorObj);
}
var xA = (numbersA[players.Length]) / gridSize;
var yA = (numbersA[players.Length]) % gridSize;
trueAgent.transform.localPosition = new Vector3(xA, -0.25f, yA);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1_Exercises
{
class Exercises
{
public string Topic { get; set; }
public string CourseName { get; set; }
public string JudgeLink { get; set; }
public List<string> Problems { get; set; }
}
class Exers
{
static void Main(string[] args)
{
var input = Console.ReadLine();
var data = new List<Exercises>();
while (input != "go go go")
{
var courseInfo = input.Split(new[] { " -> ", ", " }, StringSplitOptions.RemoveEmptyEntries);
var newExerc = new Exercises();
newExerc.Topic = courseInfo[0];
newExerc.CourseName = courseInfo[1];
newExerc.JudgeLink = courseInfo[2];
newExerc.Problems = courseInfo.Skip(3).ToList();
data.Add(newExerc);
input = Console.ReadLine();
}
foreach (var exerc in data)
{
Console.WriteLine("Exercises: {0}", exerc.Topic);
Console.WriteLine("Problems for exercises and homework for the \"{0}\" course @ SoftUni.", exerc.CourseName);
Console.WriteLine("Check your solutions here: {0}", exerc.JudgeLink);
int count = 1;
foreach (var item in exerc.Problems)
{
Console.WriteLine("{0}. {1}", count, item);
count++;
}
}
}
}
}
|
using System;
using System.Collections;
using System.Drawing;
using System.Linq;
namespace SmartQuant.Charting
{
public class TTitleItem
{
public string Text { get; set; }
public Color Color { get; set; }
public TTitleItem() : this("", Color.Black)
{
}
public TTitleItem(string text) : this(text, Color.Black)
{
}
public TTitleItem(string text, Color color)
{
Text = text;
Color = color;
}
}
public enum ETitleStrategy
{
Smart,
None,
}
[Serializable]
public class TTitle
{
private Pad pad;
public ArrayList Items { get; } = new ArrayList();
public bool ItemsEnabled { get; set; } = false;
public string Text { get; set; }
public Font Font { get; set; } = new Font("Arial", 8f);
public Color Color { get; set; } = Color.Black;
public ETitlePosition Position { get; set; } = ETitlePosition.Left;
public int X { get; set; } = 0;
public int Y { get; set; } = 0;
public int Width => (int)this.pad.Graphics.MeasureString(GetText(), Font).Width;
public int Height => (int)this.pad.Graphics.MeasureString(GetText(), Font).Height;
public ETitleStrategy Strategy { get; set; } = ETitleStrategy.Smart;
public TTitle(Pad pad, string text = "")
{
this.pad = pad;
Text = Text;
}
public void Add(string text, Color color) => Items.Add(new TTitleItem(text, color));
private string GetText() => Text + string.Join(" ", Items.Cast<TTitleItem>().Select(i => i.Text));
public void Paint()
{
var brush = new SolidBrush(Color);
if (!string.IsNullOrEmpty(Text))
this.pad.Graphics.DrawString(Text, Font, brush, X, Y);
if (Strategy == ETitleStrategy.Smart && Text == "" && ItemsEnabled && Items.Count != 0)
this.pad.Graphics.DrawString(((TTitleItem)Items[0]).Text, Font, brush, X, Y);
if (!ItemsEnabled)
return;
string str = Text;
foreach (TTitleItem item in Items)
{
string text = str + " ";
int num = X + (int)this.pad.Graphics.MeasureString(text, Font).Width;
this.pad.Graphics.DrawString(item.Text, Font, new SolidBrush(item.Color), num, Y);
str = text + item.Text;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using BlogEngine.Core.Json;
using BlogEngine.Core.Providers;
namespace BlogEngine.Core.Notes
{
/// <summary>
/// Settings for quick notes
/// </summary>
public class QuickSettings
{
/// <summary>
/// Quick settings
/// </summary>
/// <param name="user"></param>
public QuickSettings(string user)
{
Settings = BlogService.FillQuickSettings(user);
if (Settings == null)
Settings = new List<QuickSetting>();
}
/// <summary>
/// List of settings
/// </summary>
public List<QuickSetting> Settings { get; set; }
/// <summary>
/// List of categories
/// </summary>
public List<JsonCategory> Categories
{
get
{
var cats = new List<JsonCategory>();
foreach (var c in Category.Categories)
{
cats.Add(new JsonCategory { Id = c.Id, Title = c.Title });
}
return cats;
}
}
#region Methods
/// <summary>
/// Save to collection (add or replace)
/// </summary>
/// <param name="setting">Setting</param>
public void Save(QuickSetting setting)
{
var idx = Settings.FindIndex(s => s.Author == setting.Author && s.SettingName == setting.SettingName);
if(idx < 0)
{
Settings.Add(setting);
}
else
{
Settings[idx] = setting;
}
}
#endregion
}
}
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Rendering;
using MniamMniam.Models.CookBookModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
namespace MniamMniam.ViewModels
{
public class CreateRecipeViewModel
{
public string Name { get; set; }
[Display(Name="Time")]
public int TimeNeeded { get; set; }
public string Text { get; set; }
[Display(Name="How to prepare")]
public string DetailedText { get; set; }
public int[] SelectedTags { get; set; }
public int[] SelectedIngredient { get; set; }
public int[] SelectedIngredientAmount { get; set; }
public IFormFile file { get; set; }
public List<IFormFile> files { get; set; }
public IEnumerable<SelectListItem> AllTags { get; set; }
public IEnumerable<SelectListItem> AllIngredients { get; set; }
}
public class EditRecipeViewModel
{
public Recipe Recipe { get; set; }
public string Name { get; set; }
[Display(Name = "Time")]
public int TimeNeeded { get; set; }
public string Text { get; set; }
[Display(Name = "How to prepare")]
public string DetailedText { get; set; }
[ScaffoldColumn(false)]
public string ApplicationUserId { get; set; }
public int[] SelectedTags { get; set; }
public int[] SelectedIngredient { get; set; }
public int[] SelectedIngredientAmount { get; set; }
//public IFormFile File { get; set; }
//public List<IFormFile> files { get; set; }
public IEnumerable<SelectListItem> AllTags { get; set; }
public IEnumerable<SelectListItem> AllIngredients { get; set; }
}
}
|
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Zappr.Core.Entities;
namespace Zappr.Infrastructure.Data.Configurations
{
public class UserRatedEpisodeConfiguration : IEntityTypeConfiguration<UserRatedEpisode>
{
public void Configure(EntityTypeBuilder<UserRatedEpisode> builder)
{
builder.ToTable("UserRatedEpisode");
builder.HasKey(ue => new { ue.UserId, ue.EpisodeId });
builder.HasOne(ue => ue.User).WithMany(u => u.RatedEpisodes).HasForeignKey(ue => ue.UserId);
builder.HasOne(ue => ue.Episode).WithMany().HasForeignKey(ue => ue.EpisodeId);
}
}
} |
/*--------------------------------------------------------------------------------------------------
* Author: Dr. Dana Vrajitoru
* Author: Dan Cassidy
* Date: 2015-10-07
* Assignment: Homework 6
* Source File: CritterControl.cs
* Language: C#
* Course: CSCI-C 490, Game Programming and Design, TuTh 17:30
* Purpose: Controls the different aspects of critters, including respawn and collision
* behavior.
--------------------------------------------------------------------------------------------------*/
using UnityEngine;
public class CritterControl : MonoBehaviour
{
public bool friend = false;
public int scoreValue = 0;
public bool respawn = true;
public int healthValue = Constants.DefaultCritterHealth;
static Camera mainCam = null;
static GameMaster master = null;
static PlayerControl player = null;
AudioSource sound;
float baseScaleX = 1.0f;
float baseScaleY = 1.0f;
/*----------------------------------------------------------------------------------------------
* Name: OnCollisionEnter2D
* Type: Method
* Purpose: Handles collisions with other physics objects.
* Input: Collision2D colInfo, contains the collision information for this collision.
* Output: Nothing.
----------------------------------------------------------------------------------------------*/
void OnCollisionEnter2D(Collision2D colInfo)
{
// Determine what this object has collided with via tag.
switch (colInfo.collider.tag)
{
case Constants.PlayerTag:
// Play contact sound.
sound.Play();
// Determine if this object should respawn or not.
if (respawn)
Respawn();
else
gameObject.SetActive(false);
// Check if this object is a friend.
if (friend)
{
// This object is a friend. Add points, add a friend pickup, and add health.
master.AddPoints(scoreValue);
master.FriendPickup();
player.AddHealth(healthValue);
}
else
{
// This object is not a friend. Reduce points and health accordingly.
master.AddPoints(-scoreValue);
player.AddHealth(-healthValue);
}
break;
case Constants.GroundTag:
// Determine if this object should respawn or not.
if (respawn)
Respawn();
else
gameObject.SetActive(false);
break;
case Constants.BulletTag:
// Check if this object is a friend.
if (!friend)
{
// Play contact sound.
sound.Play();
// Determine if this object should respawn or not.
if (respawn)
Respawn();
else
gameObject.SetActive(false);
// Add points.
master.AddPoints(scoreValue);
}
break;
}
}
/*----------------------------------------------------------------------------------------------
* Name: Respawn
* Type: Method
* Purpose: Respawn the critter at the top of the screen within some random range.
* Input: Nothing.
* Output: Nothing.
----------------------------------------------------------------------------------------------*/
void Respawn()
{
// Randomly scale the object.
float randScale = Random.Range(Constants.ScaleMin, Constants.ScaleMin + 1);
transform.localScale = new Vector3(baseScaleX * randScale, baseScaleY * randScale,
transform.localScale.z);
// Reset x and y velocity to 0.
GetComponent<Rigidbody2D>().velocity = new Vector2(0.0f, 0.0f);
// Randomize the initial position based on the screen size above the top of the screen
float x = Random.Range(Constants.CritterSpawnXMin, Screen.width - 9);
float y = Screen.height + Random.Range(Constants.CritterSpawnYMin,
Constants.CritterSpawnYMax + 1);
// Then covert it to world coordinates and assign it to the critter.
Vector3 pos = mainCam.ScreenToWorldPoint(new Vector3(x, y, 0f));
pos.z = transform.position.z;
transform.position = pos;
}
/*----------------------------------------------------------------------------------------------
* Name: Start
* Type: Method
* Purpose: Performs one-time initialization tasks.
* Input: Nothing.
* Output: Nothing.
----------------------------------------------------------------------------------------------*/
void Start()
{
// Find the camera from the object tagged as Player.
if (!mainCam)
mainCam = GameObject.FindWithTag(Constants.PlayerTag).GetComponent<PlayerControl>().
mainCam;
// Find the game master object.
if (!master)
master = GameObject.Find(Constants.GMObjectName).GetComponent<GameMaster>();
// Find the player object.
if (!player)
player = GameObject.Find(Constants.PlayerObjectName).GetComponent<PlayerControl>();
// Store the audio source for easy access.
sound = GetComponent<AudioSource>();
// Set the base transform scale so we don't get really big or really small objects
// eventually.
baseScaleX = transform.localScale.x;
baseScaleY = transform.localScale.y;
// Spawn the object.
Respawn();
}
}
|
using UnityEngine;
using System.Xml;
namespace PlayGen.Unity.Utilities.Editor.iOSRequirements
{
public class iOSRequirements : MonoBehaviour
{
private static string FilePath => Application.dataPath + "/iOSRequirements/Editor/iOSRequirements/Requirements.xml";
public static XmlDocument ReadXml()
{
var text = System.IO.File.ReadAllText(FilePath);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(text);
return xmlDoc;
}
public static void WriteToXml(XmlDocument requirements)
{
requirements.Save(FilePath);
Debug.Log(string.Format("Saved changes to {0}", FilePath));
}
/// <summary>
/// Check that the xml data is valid
/// Each node contains a Key, Value and Required element
/// </summary>
/// <param name="requirementsXml"></param>
/// <param name="message"></param>
/// <returns></returns>
public static bool IsXmlValid(XmlDocument requirementsXml, out string message)
{
message = null;
foreach (XmlNode childNode in requirementsXml.FirstChild.ChildNodes)
{
if (childNode["Key"] == null || childNode["Value"] == null || childNode["Required"] == null)
{
message = "Xml structure is invalid.";
return false;
}
}
return true;
}
/// <summary>
/// Check if requirements that are enabled have a description
/// </summary>
/// <param name="requirementsXml"></param>
/// <param name="message"></param>
/// <returns></returns>
public static bool isRequirementDataValid(XmlDocument requirementsXml, out string message)
{
message = null;
foreach (XmlNode childNode in requirementsXml.FirstChild.ChildNodes)
{
if (childNode["Required"].InnerText == "True" && string.IsNullOrEmpty(childNode["Value"].InnerText))
{
message = "All enabled requiremnents must have a description!";
return false;
}
}
return true;
}
}
}
|
namespace Amazon.Lambda.APIGatewayEvents
{
using System.Collections.Generic;
using System.Runtime.Serialization;
/// <summary>
/// The response object for Lambda functions handling request from from API Gateway proxy
/// http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html
/// </summary>
[DataContract]
public class APIGatewayProxyResponse
{
/// <summary>
/// The HTTP status code for the request
/// </summary>
[DataMember(Name = "statusCode")]
public int StatusCode { get; set; }
/// <summary>
/// The Http headers return in the response
/// </summary>
[DataMember(Name = "headers")]
public IDictionary<string, string> Headers { get; set; }
/// <summary>
/// The response body
/// </summary>
[DataMember(Name = "body")]
public string Body { get; set; }
/// <summary>
/// Flag indicating whether the body should be treated as a base64-encoded string
/// </summary>
[DataMember(Name = "isBase64Encoded")]
public bool IsBase64Encoded { get; set; }
}
}
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace WorkspaceServer.Packaging
{
public class PackageSource
{
private readonly DirectoryInfo _directory;
private readonly Uri _uri;
public PackageSource(string value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
// Uri.IsWellFormed will return false for path-like strings:
// (https://docs.microsoft.com/en-us/dotnet/api/system.uri.iswellformeduristring?view=netcore-2.2)
if (Uri.IsWellFormedUriString(value, UriKind.Absolute) &&
Uri.TryCreate(value, UriKind.Absolute, out var uri)
&& uri?.Scheme != null)
{
_uri = uri;
}
else
{
_directory = new DirectoryInfo(value);
}
}
public override string ToString()
{
return _directory?.ToString() ?? _uri.ToString();
}
}
} |
namespace RangeIt.Ranges.RangeStrategies.Iota
{
using System.Collections;
using System.Collections.Generic;
internal abstract class AIotaGeneratorStrategy<T> : IRangeStrategy<T>
{
internal uint Count { get; set; }
internal AIotaGeneratorStrategy(uint count) => Count = count;
public virtual bool Equals(IRangeStrategy<T> other)
{
if (other == null)
return false;
if (other is AIotaGeneratorStrategy<T>)
return (other as AIotaGeneratorStrategy<T>)?.Count == Count;
return false;
}
public abstract IEnumerator<T> GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
|
using Microsoft.AspNetCore.Razor.TagHelpers;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TagHelpersDemo.TagHelpers;
using Xunit;
namespace TagHelpersDemo.Tests.TagHelpers
{
public class HandTagHelperTests
{
[Fact]
public void Process_Generates_Expected_Output()
{
// ==== Arrange ====
const string ROOT_HTML_ELEMENT_TAG = "div";
var context = new TagHelperContext(
new TagHelperAttributeList(),
new Dictionary<object, object>(),
Guid.NewGuid().ToString("N"));
var output = new TagHelperOutput(ROOT_HTML_ELEMENT_TAG,
new TagHelperAttributeList(),
(cache, encoder) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
var handTagHelper = new HandTagHelper
{
Player = "John"
};
// ==== Act ====
handTagHelper.Process(context, output);
// ==== Assert ====
// Compare root HTML elements
Assert.Equal(ROOT_HTML_ELEMENT_TAG, output.TagName);
// Compare root HTML elements' class attribute values
Assert.Equal("row", output.Attributes["class"].Value);
// Compare to the content of the root HTML element (should be empty, since no cards are defined)
Assert.Equal(string.Empty, output.Content.GetContent());
}
}
}
|
using Prezencka.Services;
using System;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Prezencka.ViewModels
{
public sealed class SettingsViewModel : BaseViewModel
{
public string Name { get; set; }
public string Id { get; set; }
public string Company { get; set; }
public TimeSpan WorkingTime { get; set; }
public TimeSpan RestTime { get; set; }
public TimeSpan ArriveTime { get; set; }
public TimeSpan RestStartTime { get; set; }
public TimeSpan LeaveTime { get; set; }
public ICommand LoadCommand { get; }
public ICommand SaveCommand { get; }
private readonly SettingsService _settingsSerivce;
public SettingsViewModel()
{
_settingsSerivce = App.SettingsService;
LoadCommand = new Command(LoadSettings);
SaveCommand = new Command(async () => await SaveSettings());
}
private void LoadSettings()
{
Name = _settingsSerivce.Name;
Id = _settingsSerivce.Id;
Company = _settingsSerivce.Company;
WorkingTime = _settingsSerivce.WorkingTime;
RestTime = _settingsSerivce.RestTime;
ArriveTime = _settingsSerivce.ArriveTime;
RestStartTime = _settingsSerivce.RestStartTime;
LeaveTime = _settingsSerivce.LeaveTime;
RaiseAllPropertiesChanged();
}
private async Task SaveSettings()
{
if (!IsTimeValid())
{
await DisplayAlert("CHYBA", "Vami zadaný čas nie je správny.", "OK");
return;
}
_settingsSerivce.Name = Name;
_settingsSerivce.Id = Id;
_settingsSerivce.Company = Company;
_settingsSerivce.WorkingTime = WorkingTime;
_settingsSerivce.RestTime = RestTime;
_settingsSerivce.ArriveTime = ArriveTime;
_settingsSerivce.RestStartTime = RestStartTime;
_settingsSerivce.LeaveTime = LeaveTime;
await _settingsSerivce.FlushSettings();
await DisplayAlert("ULOŽENÉ", "Vaše nastavenia boli úspešne uložené.", "OK");
}
private static bool IsTimeValid()
{
return true;
}
}
}
|
using PuntoDeVentaDemo.COMMON.Entidades;
using System.Collections.Generic;
namespace PuntoDeVentaDemo.COMMON.Interfaces
{
/// <summary>
/// Proporciona los métodos relacionados a los productos vendidos en las ventas
/// </summary>
public interface IProductoVendidoManager : IGenericManager<productovendido>
{
#region Métodos
/// <summary>
/// Obtiene los productos contenidos en una venta
/// </summary>
/// <param name="idVenta">Id de la venta</param>
/// <returns>Conjunto de productos contenidos en una venta</returns>
IEnumerable<productovendido> ProductosDeUnaVenta(int idVenta);
/// <summary>
/// Obteine el total de un tipo de producto vendido
/// </summary>
/// <param name="idProducto">Id de productos</param>
/// <returns>Canitdad de total de producto vendido en específico</returns>
int TotalDeProductosVendidos(int idProducto);
#endregion
}
} |
using FSQL.Interfaces;
using FSQL.ProgramParts.Core;
using FSQL.ProgramParts.Functions;
namespace FSQL.ProgramParts.Statements {
public class Simulate : StatementBase, IExpression {
private readonly CodeBlock _block;
public Simulate(CodeBlock block) {
_block = block;
}
protected override object OnExecute(IExecutionContext ctx, params object[] parms) {
var simCtx = ctx.Enter("__Simulation__");
object returnValue = null;
try {
simCtx.InSimulationMode = true;
returnValue = _block.InvokeGeneric(simCtx, parms);
} finally {
simCtx.Exit(returnValue);
}
return returnValue;
}
public override void Dispose() {
_block.Dispose();
}
object IExpression.GetGenericValue(IExecutionContext ctx) => OnExecute(ctx);
public override string ToString() {
return "simulate" + _block;
}
}
} |
using System;
using System.IO.Packaging;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Reactive;
using System.Reactive.Linq;
using System.Windows.Media.Imaging;
using Akavache;
using GitHub.Caches;
using GitHub.Logging;
using GitHub.Extensions;
using GitHub.Models;
using System.Windows;
namespace GitHub.Services
{
[Export(typeof(IAvatarProvider))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class AvatarProvider : IAvatarProvider
{
readonly IImageCache imageCache;
readonly IBlobCache cache;
public BitmapImage DefaultUserBitmapImage { get; private set; }
public BitmapImage DefaultOrgBitmapImage { get; private set; }
static AvatarProvider()
{
// Calling `Application.Current` will install pack URI scheme via Application.cctor.
// This is needed when unit testing for the pack:// URL format to be understood.
if (Application.Current != null) { }
}
[ImportingConstructor]
public AvatarProvider(ISharedCache sharedCache, IImageCache imageCache)
{
Guard.ArgumentNotNull(sharedCache, nameof(sharedCache));
Guard.ArgumentNotNull(imageCache, nameof(imageCache));
cache = sharedCache.LocalMachine;
this.imageCache = imageCache;
DefaultUserBitmapImage = CreateBitmapImage("pack://application:,,,/GitHub.App;component/Images/default_user_avatar.png");
DefaultOrgBitmapImage = CreateBitmapImage("pack://application:,,,/GitHub.App;component/Images/default_org_avatar.png");
}
public static BitmapImage CreateBitmapImage(string packUrl)
{
Guard.ArgumentNotEmptyString(packUrl, nameof(packUrl));
var bitmap = new BitmapImage(new Uri(packUrl));
bitmap.Freeze();
return bitmap;
}
public IObservable<BitmapSource> GetAvatar(IAvatarContainer apiAccount)
{
Guard.ArgumentNotNull(apiAccount, nameof(apiAccount));
if (apiAccount.AvatarUrl == null)
{
return Observable.Return(DefaultAvatar(apiAccount));
}
Uri avatarUrl;
Uri.TryCreate(apiAccount.AvatarUrl, UriKind.Absolute, out avatarUrl);
Log.Assert(avatarUrl != null, "Cannot have a null avatar url");
return imageCache.GetImage(avatarUrl)
.Catch<BitmapSource, Exception>(_ => Observable.Return(DefaultAvatar(apiAccount)));
}
public IObservable<BitmapSource> GetAvatar(string url)
{
if (url == null)
{
return Observable.Return(DefaultUserBitmapImage);
}
Uri avatarUrl;
Uri.TryCreate(url, UriKind.Absolute, out avatarUrl);
Log.Assert(avatarUrl != null, "Cannot have a null avatar url");
return imageCache.GetImage(avatarUrl)
.Catch<BitmapSource, Exception>(_ => Observable.Return(DefaultUserBitmapImage));
}
public IObservable<Unit> InvalidateAvatar(IAvatarContainer apiAccount)
{
return String.IsNullOrWhiteSpace(apiAccount?.Login)
? Observable.Return(Unit.Default)
: cache.Invalidate(apiAccount.Login);
}
BitmapImage DefaultAvatar(IAvatarContainer apiAccount)
{
Guard.ArgumentNotNull(apiAccount, nameof(apiAccount));
return apiAccount.IsUser ? DefaultUserBitmapImage : DefaultOrgBitmapImage;
}
protected virtual void Dispose(bool disposing)
{ }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
} |
using System.Windows.Forms;
namespace Projekt_wlasciwy
{
class ErrorController
{
public static void ThrowUserError(string Message = "Something went wrong.")
{
MessageBox.Show(Message + "Check Log", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static void ThrowUserInfo(string Message)
{
if(Message is null)
return;
MessageBox.Show(Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
|
using System.Collections.Generic;
namespace MASIC.Data
{
/// <summary>
/// Container for tracking similar parent ions
/// </summary>
public class SimilarParentIonsData
{
/// <summary>
/// Pointer array of index values in the original data
/// </summary>
public int[] MZPointerArray { get; set; }
/// <summary>
/// Number of parent ions with true in IonUsed[]
/// </summary>
public int IonInUseCount { get; set; }
/// <summary>
/// Flags for whether a parent ion has already been grouped with another parent ion
/// </summary>
public bool[] IonUsed { get; }
/// <summary>
/// List of unique m/z values
/// </summary>
public List<UniqueMZListItem> UniqueMZList { get; }
/// <summary>
/// Constructor
/// </summary>
public SimilarParentIonsData(int parentIonCount)
{
MZPointerArray = new int[parentIonCount];
IonUsed = new bool[parentIonCount];
UniqueMZList = new List<UniqueMZListItem>();
}
/// <summary>
/// Show the value of IonInUseCount
/// </summary>
public override string ToString()
{
return "IonInUseCount: " + IonInUseCount;
}
}
}
|
namespace BlogSharp.MvcExtensions.Handlers
{
using System.Web.Routing;
public class BlogMvcRouteHandler : System.Web.Mvc.MvcRouteHandler
{
protected override System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var controller = requestContext.RouteData.Values["controller"];
return new BlogMvcHandler(requestContext);
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CloudsFlowing : MonoBehaviour
{
bool movingDown = true;
void Start()
{
Invoke("StartMakingFlowing", Random.Range(0, 2));
}
private void StartMakingFlowing()
{
StartCoroutine(FlowingCloud());
}
IEnumerator FlowingCloud()
{
float time = 0;
while (true)
{
time += Time.deltaTime;
transform.position += new Vector3(0, time % 2 >= 1 ? 2 * Time.deltaTime : -2 * Time.deltaTime, 0);
yield return new WaitForEndOfFrame();
}
}
}
|
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Tabletop.Events
{
/// <summary>
/// An event sent by the server to the client to tell the client to open a tabletop game window.
/// </summary>
[Serializable, NetSerializable]
public sealed class TabletopPlayEvent : EntityEventArgs
{
public EntityUid TableUid;
public EntityUid CameraUid;
public string Title;
public Vector2i Size;
public TabletopPlayEvent(EntityUid tableUid, EntityUid cameraUid, string title, Vector2i size)
{
TableUid = tableUid;
CameraUid = cameraUid;
Title = title;
Size = size;
}
}
}
|
using UnityEngine;
namespace StandardRender
{
public class SceneData : ScriptableObject
{
}
}
|
using UnityEngine;
using System.Collections;
public enum ScaleType {
kCrop,
kInside
}
class Texture2DHelpers {
public static Texture2D rescaleCenter(Texture2D srcTexture, Vector2 destSize, ScaleType scaleType) {
var srcSize = new Vector2(
srcTexture.width,
srcTexture.height);
var scale = Texture2DHelpers.scaleFactor(
srcSize,
destSize,
scaleType);
var scaledSize = srcSize * scale;
// Convert float values to int
var srcWidth = srcTexture.width;
var scaledWidth = (int) scaledSize.x;
var scaledHeight = (int) scaledSize.y;
var destWidth = (int) destSize.x;
var destHeight = (int) destSize.y;
var minX = Helpers.clamp((destWidth - scaledWidth) / 2, 0, destWidth - 1);
var maxX = destWidth - 1 - minX;
var minY = Helpers.clamp((destHeight - scaledHeight) / 2, 0, destHeight - 1);
var maxY = destHeight - 1 - minY;
var srcPixels = srcTexture.GetPixels();
var destPixels = new Color[destWidth * destHeight];
for (var destX=0; destX < destWidth; ++destX) {
for (var destY=0; destY < destHeight; ++destY) {
Color destPixel;
if (destX >= minX && destX <= maxX && destY >= minY && destY <= maxY) {
var scaledX = destX - minX;
var scaledY = destY - minY;
var srcX = (int) (scaledX / scale);
var srcY = (int) (scaledY / scale);
var srcOffset = srcY * srcWidth + srcX;
destPixel = srcPixels[srcOffset];
} else {
destPixel = fillColor;
}
var destOffset = destY * destWidth + destX;
destPixels[destOffset] = destPixel;
}
}
var destTexture = new Texture2D(destWidth, destHeight);
destTexture.SetPixels(destPixels);
destTexture.Apply();
return destTexture;
}
public static float scaleFactor(Vector2 srcSize, Vector2 destSize, ScaleType scaleType) {
var scaleX = destSize.x / srcSize.x;
var scaleY = destSize.y / srcSize.y;
float scale;
switch (scaleType) {
case ScaleType.kCrop:
scale = Mathf.Max(scaleX, scaleY);
break;
case ScaleType.kInside:
scale = Mathf.Min(scaleX, scaleY);
break;
default:
Debug.LogWarning("unknow scale type");
scale = 1.0f;
break;
}
return scale;
}
} |
using stackattack.Users;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Web;
namespace stackattack.Persistence
{
internal class UserTable : SQLiteTable<User>
{
private const int TestUserID = 1;
protected override string TableName { get { return "users"; } }
private void AddCommandParams(SQLiteCommand com, User item)
{
com.Parameters.AddWithValue("@TotalScore", item.TotalScore);
}
protected override string GetCreateSql()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine($"create table {this.TableName} (");
sb.AppendLine("ID integer not null primary key,");
sb.AppendLine("TotalScore integer,");
sb.Length = sb.Length - 3;
sb.AppendLine(")");
return sb.ToString();
}
protected override string GetInsertSql(SQLiteCommand com, User item)
{
AddCommandParams(com, item);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"insert into {this.TableName} (");
sb.AppendLine("TotalScore,");
sb.Length = sb.Length - 3;
sb.AppendLine(") values (");
sb.AppendLine("@TotalScore,");
sb.Length = sb.Length - 3;
sb.AppendLine(")");
return sb.ToString();
}
protected override string GetUpdateSql(SQLiteCommand com, User item)
{
AddCommandParams(com, item);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"update {this.TableName} set");
sb.AppendLine("TotalScore = @TotalScore");
sb.AppendLine($"where ID = {item.ID}");
return sb.ToString();
}
public override void Create(SQLiteConnection con)
{
base.Create(con);
// Create user for table existence verification
User user = new User();
Save(con, user);
}
public bool Exists(SQLiteConnection con)
{
return Get(con, TestUserID) != null;
}
}
} |
using Telegram.Bot.AspNetPipeline.Mvc.Extensions.Main;
namespace Telegram.Bot.AspNetPipeline.Mvc.Extensions.MvcFeatures
{
/// <summary>
/// Implemented with <see cref="ServicesBus"/>.
/// </summary>
public interface IMvcFeaturesProvider
{
IMvcFeatures MvcFeatures { get; }
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CanonBehavior : MonoBehaviour
{
public Transform canonBallPos;
public GameObject canonBallPrefab;
public float speed = 1;
public int initialNumberOfPooledInstance = 10;
private ObjectPooler pool;
private void Awake()
{
pool = new ObjectPooler(initialNumberOfPooledInstance, canonBallPrefab);
}
// Update is called once per frame
void Update()
{
this.transform.Translate(new Vector3(Input.GetAxis("Horizontal") * Time.deltaTime * speed, 0));
if (Input.GetKeyDown(KeyCode.Space))
{
Fire();
}
}
void Fire()
{
GameObject bullet = pool.GetObject();
bullet.transform.position = canonBallPos.position;
bullet.GetComponent<CanonBallBehavior>().Fire();
}
}
|
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Threading.Tasks;
using Atlassian.Jira.Linq;
using Atlassian.Jira;
using System.Linq;
namespace JiraModule
{
/// <summary>
/// Saves changes made to a Jira.Issue object
/// </summary>
[Alias("Save-Issue")]
[Cmdlet(VerbsData.Save, "JIssue")]
[OutputType(typeof(Atlassian.Jira.Issue))]
[OutputType(typeof(JiraModule.AsyncResult))]
public class SaveIssue : AsyncActionCmdlet
{
[Alias("JiraIssue")]
[Parameter(
Position = 0,
ValueFromPipeline = true
)]
public Atlassian.Jira.Issue Issue { get; set; }
protected override void ProcessRecord()
{
StartAsyncTask(
$"Save issue [{Issue.Key}]",
Issue.SaveChangesAsync()
);
}
protected override void EndProcessing()
{
WaitAll();
}
}
}
|
using Newtonsoft.Json;
namespace SurveyMonkey.Enums
{
[JsonConverter(typeof(TolerantJsonConverter))]
public enum QuestionRequiredType
{
All,
AtLeast,
AtMost,
Exactly,
Range
}
} |
using AniSharp.Types.Edges;
using AniSharp.Types.Groups;
using CSGraphQL.GraphQL;
namespace AniSharp.Types.Connections
{
public class StaffConnection : GraphQlType
{
[TypeField] public StaffEdge[] Edges { get; set; }
[TypeField] public Staff.Staff[] Nodes { get; set; }
[TypeField] public PageInfo PageInfo { get; set; }
}
} |
using System;
using System.Web.Hosting;
namespace SignalR.Hosting.AspNet
{
internal class AspNetShutDownDetector : IRegisteredObject
{
private readonly Action _onShutdown;
public AspNetShutDownDetector(Action onShutdown)
{
_onShutdown = onShutdown;
HostingEnvironment.RegisterObject(this);
}
public void Stop(bool immediate)
{
try
{
if (!immediate)
{
_onShutdown();
}
}
catch
{
// Swallow the exception as Stop should never throw
// TODO: Log exceptions
}
finally
{
HostingEnvironment.UnregisterObject(this);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MapTileGenerator.Core
{
/// <summary>
/// 默认的瓦片输出方式:以文件方式存储;
/// </summary>
public class DefaultOutputStrategy : ITileOutputStrategy
{
protected string _rootPath;
protected IDictionary<string, string> _zoomFolderDic = new Dictionary<string, string>();
protected IDictionary<string,string> _zoomAndXFolderDic = new Dictionary<string, string>();
public DefaultOutputStrategy()
{
}
#region ITileOutputStrategy 成员
public void Init(string rootPath)
{
_rootPath = rootPath;
}
public void Write(Stream input, OutputTile outputTile)
{
string filePath = BuildTilePath(outputTile);
using (FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
byte[] buffer = new byte[8192];//8K
int ret = input.Read(buffer, 0, buffer.Length);
while (ret > 0)
{
fs.Write(buffer, 0, ret);
ret = input.Read(buffer, 0, buffer.Length);
}
}
}
protected virtual string BuildTilePath(OutputTile outputTile)
{
string zoomFolder;
if (!_zoomFolderDic.ContainsKey(outputTile.Zoom))
{
zoomFolder = Path.Combine(_rootPath, outputTile.Zoom);
Directory.CreateDirectory(zoomFolder);
_zoomFolderDic[outputTile.Zoom] = zoomFolder;
}
else
{
zoomFolder = _zoomFolderDic[outputTile.Zoom];
}
string zoomXFolder;
string zoomXKey = outputTile.Zoom + "_" + outputTile.X;
if (!_zoomAndXFolderDic.ContainsKey(zoomXKey))
{
zoomXFolder = Path.Combine(zoomFolder, outputTile.X);
Directory.CreateDirectory(zoomXFolder);
_zoomFolderDic[zoomXKey] = zoomXFolder;
}
else
{
zoomXFolder = _zoomFolderDic[zoomXKey];
}
return Path.Combine(zoomXFolder, outputTile.Y + ".png");
}
#endregion
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class PanelBackgroundColorOR : MonoBehaviour
{
private Image panel;
public ColorDataOR color;
// private void AdjustColor(ColorReference _color)
// {
// if (panel == null)
// panel = this.GetComponent<Image>();
//
// panel.color = _color.Value;
// }
} |
using DatabaseBenchmark.Core.Interfaces;
using Microsoft.Azure.Cosmos;
namespace DatabaseBenchmark.Databases.CosmosDb
{
public class CosmosDbDistinctValuesProvider : IDistinctValuesProvider
{
private readonly Database _database;
private readonly IExecutionEnvironment _environment;
public CosmosDbDistinctValuesProvider(
Database database,
IExecutionEnvironment environment)
{
_database = database;
_environment = environment;
}
public List<object> GetDistinctValues(string tableName, string columnName)
{
var container = _database.GetContainer(tableName);
var query = $"SELECT DISTINCT VALUE c.{columnName} FROM c";
if (_environment.TraceQueries)
{
_environment.WriteLine(query);
}
return container.Query<object>(new PartitionKey(CosmosDbConstants.DummyPartitionKeyValue), query).Items;
}
}
}
|
using PMS.HelperClasses;
using PMSEntity;
using PMSInterface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PMS.Controllers
{
public class UserController : Controller
{
private IUserRepository repo;
public UserController(IUserRepository repo)
{
this.repo = repo;
}
// GET: User
public ActionResult Index()
{
return View(this.repo.GetAll());
}
[HttpGet]
public ActionResult Create()
{
return View();
}
[HttpPost]
public ActionResult Create(User user)
{
if (user != null)
{
user.IpAddress = Utilities.GetIpAddress();
user.CreatedDate = DateTime.Now;
user.Password = Utilities.GetPasswordHash(user.Password);
user.ConfirmPassword = Utilities.GetPasswordHash(user.ConfirmPassword);
this.repo.Insert(user);
return RedirectToAction("Index", "User");
}
return RedirectToAction("Index", "User");
}
[HttpGet]
public ActionResult Edit(long id)
{
User user = this.repo.Get(id);
return View(user);
}
[HttpPost]
public ActionResult Edit(User user)
{
if (user != null)
{
user.IpAddress = Utilities.GetIpAddress();
user.EditedDate = DateTime.Now;
user.Password = Utilities.GetPasswordHash(user.Password);
user.ConfirmPassword = Utilities.GetPasswordHash(user.ConfirmPassword);
this.repo.Update(user);
return RedirectToAction("Index", "User");
}
return RedirectToAction("Index", "User");
}
public ActionResult Delete(long id)
{
User user = this.repo.Get(id);
this.repo.Delete(user);
return RedirectToAction("Index", "User");
}
public ActionResult Details(long id)
{
User user = this.repo.Get(id);
return View(user);
}
}
} |
using KeatsLib.Data;
using KeatsLib.Input;
using System;
/// <summary>
/// A manager for a custom Event system within Unity.
/// </summary>
public partial class EventManager
{
/// <summary>
/// Holder class for all events that are only designed to occur on local clients.
/// </summary>
public static partial class Local
{
}
}
|
@using Hangman.Models;
@{
Layout = "_Layout";
}
<div class="hangman-content">
<div class="hangman-container">
<img id="hangman-img" src="" />
</div>
<div class="hangman-container">
<div id="letters">
<p>
@foreach(Letter letter in @Model.GetLetters()) {
@* <span class="letter">@letter.Character</span>
<span class="letter-spacer"> </span> *@
if(@letter.CorrectlyGuessed) {
<span class="letter">@letter.Character</span>
<span class="letter-spacer"> </span>
} else {
<span class="letter"></span>
<span class="letter-spacer"> </span>
}
}
</p>
</div>
</div>
<div class="hangman-container">
<div id="incorrect-guesses">
<h2>Incorrect Guesses</h2>
<p>
@foreach(Guess guess in @Model.GetAllIncorrectGuesses()) {
<span class="letter">@guess.Answer</span>
<span class="letter-spacer"> </span>
}
</p>
</div>
<a href='/games/@Model.Id/guesses/new'>Make a Guess!</a>
<a href='/games/@Model.Id/guesses'>See all guesses</a>
<a href='/games'>Back to games</a>
</div> |
// ReSharper disable InconsistentNaming
namespace SpectrumEngine.Emu;
/// <summary>
/// This class implements the emulation of the Z80 CPU.
/// </summary>
/// <remarks>
/// This file contains the code for processing extended Z80 instructions (with `$ED` prefix).
/// </remarks>
public partial class Z80Cpu
{
/// <summary>
/// This array contains the 256 function references, each executing a standard Z80 instruction.
/// </summary>
private Action[]? _extendedInstrs;
/// <summary>
/// Initialize the table of standard instructions.
/// </summary>
private void InitializeExtendedInstructionsTable()
{
_extendedInstrs = new Action[]
{
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 00-07
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 08-0f
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 10-17
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 18-1f
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 20-27
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 28-2f
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 30-37
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 38-3f
InBC, OutCB, SbcHLBC, LdNNiBC, Neg, Retn, Im0, LdIA, // 40-47
InCC, OutCC, AdcHLBC, LdBCNNi, Neg, Retn, Im0, LdRA, // 48-4f
InDC, OutCD, SbcHLDE, LdNNiDE, Neg, Retn, Im1, LdAI, // 50-57
InEC, OutCE, AdcHLDE, LdDENNi, Neg, Retn, Im2, LdAR, // 58-5f
InHC, OutCH, SbcHLHL, LdNNiHL, Neg, Retn, Im0, Rrd, // 60-67
InLC, OutCL, AdcHLHL, LdHLNNi, Neg, Retn, Im0, Rld, // 68-6f
InC, OutC0, SbcHLSP, LdNNiSP, Neg, Retn, Im1, Nop, // 70-77
InAC, OutCA, AdcHLSP, LdSPNNi, Neg, Retn, Im2, Nop, // 78-7f
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 80-87
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 88-8f
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 90-97
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // 98-9f
Ldi, Cpi, Ini, Outi, Nop, Nop, Nop, Nop, // a0-a7
Ldd, Cpd, Ind, Outd, Nop, Nop, Nop, Nop, // a8-af
Ldir, Cpir, Inir, Otir, Nop, Nop, Nop, Nop, // b0-b7
Lddr, Cpdr, Indr, Otdr, Nop, Nop, Nop, Nop, // b8-bf
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // c0-c7
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // c8-cf
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // d0-d7
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // d8-df
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // e0-e7
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // e8-ef
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // f0-f7
Nop, Nop, Nop, Nop, Nop, Nop, Nop, Nop, // f8-ff
};
}
/// <summary>
/// "in b,(c)" operation (0x40)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register B in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InBC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.B = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.B]);
F53Updated = true;
}
/// <summary>
/// "out (c),b" operation (0x41)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register B is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCB()
{
WritePort(Regs.BC, Regs.B);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "sbc hl,bc" operation (0x42)
/// </summary>
/// <remarks>
/// The contents of the register pair BC and the Carry Flag are subtracted from the contents of HL, and the result
/// is stored in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if borrow from bit 12; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is set.
/// C is set if borrow; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void SbcHLBC()
{
TactPlus7(Regs.HL);
Sbc16(Regs.BC);
}
/// <summary>
/// "ld (NN),bc" operation (0x43)
/// </summary>
/// <remarks>
/// The low-order byte of register pair BC is loaded to memory address (NN); the upper byte is loaded to memory
/// address(NN + 1).
///
/// T-States: 20 (4, 4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:4,pc+2:3,pc+3:3,nn:3,nn+1:3
/// </remarks>
private void LdNNiBC()
{
Store16(Regs.C, Regs.B);
}
/// <summary>
/// "neg" operation (0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c)
/// </summary>
/// <remarks>
/// The contents of the Accumulator are negated (two's complement).
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if borrow from bit 4; otherwise, it is reset.
/// P/V is set if Accumulator was 80h before operation; otherwise, it is reset.
/// N is set.
/// C is set if Accumulator was not 00h before operation; otherwise, it is reset.
///
/// T-States: 8 (4, 4)
/// Contention breakdown: pc:4,pc+1:4
/// </remarks>
private void Neg()
{
var tmp = Regs.A;
Regs.A = 0;
Sub8(tmp);
}
/// <summary>
/// "im 0" operation (0x46, 0x4E, 0x66, 0x6E)
/// </summary>
/// <remarks>
/// Sets Interrupt Mode to 0
///
/// T-States: 8 (4, 4)
/// Contention breakdown: pc:4,pc+1:4
/// </remarks>
private void Im0()
{
InterruptMode = 0;
}
/// <summary>
/// "ld i,a" operation (0x47)
/// </summary>
/// <remarks>
///
/// The contents of A are loaded to I
///
/// T-States: 4, 5 (9)
/// Contention breakdown: pc:4,pc+1:5
/// </remarks>
private void LdIA()
{
TactPlus1(Regs.IR);
Regs.I = Regs.A;
}
/// <summary>
/// "in c,(c)" operation (0x48)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register C in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InCC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.C = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.C]);
F53Updated = true;
}
/// <summary>
/// "out (c),c" operation (0x49)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register C is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCC()
{
WritePort(Regs.BC, Regs.C);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "adc hl,bc" operation (0x4A)
/// </summary>
/// <remarks>
/// The contents of register pair BC are added with the Carry flag to the contents of HL, and the result is stored
/// in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if carry from bit 11; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is reset.
/// C is set if carry from bit 15; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void AdcHLBC()
{
TactPlus7(Regs.HL);
Adc16(Regs.BC);
}
/// <summary>
/// "ld bc,(NN)" operation (0x4B)
/// </summary>
/// <remarks>
/// The contents of memory address (NN) are loaded to the low-order portion of BC (C), and the contents of the next
/// highest memory address (NN + 1) are loaded to the high-order portion of BC (B).
///
/// T-States: 16 (4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:3,pc+2:3,nn:3,nn+1:3
/// </remarks>
private void LdBCNNi()
{
ushort tmp = FetchCodeByte();
tmp += (ushort)(FetchCodeByte() << 8);
Regs.C = ReadMemory(tmp);
tmp += 1;
Regs.WZ = tmp;
Regs.B = ReadMemory(tmp);
}
/// <summary>
/// "ld r,a" operation (0x4f)
/// </summary>
/// <remarks>
///
/// The contents of A are loaded to R
///
/// T-States: 4, 5 (9)
/// Contention breakdown: pc:4,pc+1:5
/// </remarks>
private void LdRA()
{
TactPlus1(Regs.IR);
Regs.R = Regs.A;
}
/// <summary>
/// "in d,(c)" operation (0x50)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register D in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InDC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.D = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.D]);
F53Updated = true;
}
/// <summary>
/// "out (c),d" operation (0x51)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register D is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCD()
{
WritePort(Regs.BC, Regs.D);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "sbc hl,de" operation (0x52)
/// </summary>
/// <remarks>
/// The contents of the register pair DE and the Carry Flag are subtracted from the contents of HL, and the result
/// is stored in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if borrow from bit 12; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is set.
/// C is set if borrow; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void SbcHLDE()
{
TactPlus7(Regs.HL);
Sbc16(Regs.DE);
}
/// <summary>
/// "ld (NN),de" operation (0x53)
/// </summary>
/// <remarks>
/// The low-order byte of register pair DE is loaded to memory address (NN); the upper byte is loaded to memory
/// address(NN + 1).
///
/// T-States: 20 (4, 4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:4,pc+2:3,pc+3:3,nn:3,nn+1:3
/// </remarks>
private void LdNNiDE()
{
Store16(Regs.E, Regs.D);
}
/// <summary>
/// "im 1" operation (0x56, 0x76)
/// </summary>
/// <remarks>
/// Sets Interrupt Mode to 1
///
/// T-States: 8 (4, 4)
/// Contention breakdown: pc:4,pc+1:4
/// </remarks>
private void Im1()
{
InterruptMode = 1;
}
/// <summary>
/// "ld a,i" operation (0x57)
/// </summary>
/// <remarks>
/// The contents of I are loaded to A
///
/// S is set if the I Register is negative; otherwise, it is reset.
/// Z is set if the I Register is 0; otherwise, it is reset.
/// H is reset.
/// P/V contains contents of IFF2.
/// N is reset.
/// C is not affected.
/// If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.
///
/// T-States: 9 (4, 5)
/// Contention breakdown: pc:4,pc+1:5
/// </remarks>
private void LdAI()
{
TactPlus1(Regs.IR);
Regs.A = Regs.I;
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.A] | (Iff2 ? FlagsSetMask.PV : 0));
F53Updated = true;
}
/// <summary>
/// "in e,(c)" operation (0x58)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register C in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InEC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.E = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.E]);
F53Updated = true;
}
/// <summary>
/// "out (c),e" operation (0x59)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register E is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCE()
{
WritePort(Regs.BC, Regs.E);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "adc hl,de" operation (0x5A)
/// </summary>
/// <remarks>
/// The contents of register pair DE are added with the Carry flag to the contents of HL, and the result is stored
/// in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if carry from bit 11; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is reset.
/// C is set if carry from bit 15; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void AdcHLDE()
{
TactPlus7(Regs.HL);
Adc16(Regs.DE);
}
/// <summary>
/// "ld de,(NN)" operation (0x5B)
/// </summary>
/// <remarks>
/// The contents of memory address (NN) are loaded to the low-order portion of DE (E), and the contents of the next
/// highest memory address (NN + 1) are loaded to the high-order portion of DE (D).
///
/// T-States: 16 (4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:3,pc+2:3,nn:3,nn+1:3
/// </remarks>
private void LdDENNi()
{
ushort tmp = FetchCodeByte();
tmp += (ushort)(FetchCodeByte() << 8);
Regs.E = ReadMemory(tmp);
tmp += 1;
Regs.WZ = tmp;
Regs.D = ReadMemory(tmp);
}
/// <summary>
/// "ld a,r" operation (0x5F)
/// </summary>
/// <remarks>
/// The contents of R are loaded to A
///
/// S is set if the R Register is negative; otherwise, it is reset.
/// Z is set if the R Register is 0; otherwise, it is reset.
/// H is reset.
/// P/V contains contents of IFF2.
/// N is reset.
/// C is not affected.
/// If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.
///
/// T-States: 9 (4, 5)
/// Contention breakdown: pc:4,pc+1:5
/// </remarks>
private void LdAR()
{
TactPlus1(Regs.IR);
Regs.A = Regs.R;
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.A] | (Iff2 ? FlagsSetMask.PV : 0));
F53Updated = true;
}
/// <summary>
/// "im 2" operation (0x5E, 0x7E)
/// </summary>
/// <remarks>
/// Sets Interrupt Mode to 2
///
/// T-States: 8 (4, 4)
/// Contention breakdown: pc:4,pc+1:4
/// </remarks>
private void Im2()
{
InterruptMode = 2;
}
/// <summary>
/// "in h,(c)" operation (0x60)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register H in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InHC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.H = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.H]);
F53Updated = true;
}
/// <summary>
/// "out (c),h" operation (0x61)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register H is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCH()
{
WritePort(Regs.BC, Regs.H);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "sbc hl,hl" operation (0x62)
/// </summary>
/// <remarks>
/// The contents of the register pair HL and the Carry Flag are subtracted from the contents of HL, and the result
/// is stored in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if borrow from bit 12; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is set.
/// C is set if borrow; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void SbcHLHL()
{
TactPlus7(Regs.HL);
Sbc16(Regs.HL);
}
/// <summary>
/// "rrd" operation (0x67)
/// </summary>
/// <remarks>
/// The contents of the low-order four bits (bits 3, 2, 1, and 0) of memory location (HL) are copied to the
/// low-order four bits of A. The previous contents of the low-order four bits of A are opied to the high-order
/// four bits(7, 6, 5, and 4) of location (HL); and the previous contents of the high-order four bits of (HL)
/// are copied to the low-order four bits of (HL). The contents of the high-order bits of A are unaffected.
///
/// S is set if A is negative after an operation; otherwise, it is reset.
/// Z is set if A is 0 after an operation; otherwise, it is reset.
/// H is reset.
/// P/V is set if the parity of A is even after an operation; otherwise,
/// it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 18 (4, 4, 3, 4, 3)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×4,hl(write):3
/// Gate array contention breakdown: pc:4,pc+1:4,hl:7,hl(write):3
/// </remarks>
private void Rrd()
{
var tmp = ReadMemory(Regs.HL);
TactPlus4(Regs.HL);
WriteMemory(Regs.HL, (byte)((Regs.A << 4) | (tmp >> 4)));
Regs.A = (byte)((Regs.A & 0xf0) | (tmp & 0x0f));
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53PVTable![Regs.A]);
Regs.WZ = (ushort)(Regs.HL + 1);
}
/// <summary>
/// "in l,(c)" operation (0x68)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register L in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InLC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.L = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.L]);
F53Updated = true;
}
/// <summary>
/// "out (c),l" operation (0x69)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register L is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCL()
{
WritePort(Regs.BC, Regs.L);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "adc hl,hl" operation (0x6A)
/// </summary>
/// <remarks>
/// The contents of register pair HL are added with the Carry flag to the contents of HL, and the result is stored
/// in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if carry from bit 11; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is reset.
/// C is set if carry from bit 15; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void AdcHLHL()
{
TactPlus7(Regs.HL);
Adc16(Regs.HL);
}
/// <summary>
/// "rld" operation (0x6F)
/// </summary>
/// <remarks>
/// The contents of the low-order four bits (bits 3, 2, 1, and 0) of the memory location (HL) are copied to the
/// high-order four bits (7, 6, 5, and 4) of that same memory location; the previous contents of those high-order
/// four bits are copied to the low-order four bits of A; and the previous contents of the low-order four bits of
/// A are copied to the low-order four bits of memory location(HL). The contents of the high-order bits of A are
/// unaffected.
///
/// S is set if A is negative after an operation; otherwise, it is reset.
/// Z is set if the A is 0 after an operation; otherwise, it is reset.
/// H is reset.
/// P/V is set if the parity of A is even after an operation; otherwise,
/// it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 18 (4, 4, 3, 4, 3)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×4,hl(write):3
/// Gate array contention breakdown: pc:4,pc+1:4,hl:7,hl(write):3
/// </remarks>
private void Rld()
{
var tmp = ReadMemory(Regs.HL);
TactPlus4(Regs.HL);
WriteMemory(Regs.HL, (byte)((tmp << 4) | (Regs.A & 0x0f)));
Regs.A = (byte)((Regs.A & 0xf0) | (tmp >> 4));
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53PVTable![Regs.A]);
Regs.WZ = (ushort)(Regs.HL + 1);
}
/// <summary>
/// "in (c)" operation (0x70)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
var tmp = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![tmp]);
F53Updated = true;
}
/// <summary>
/// "out (c),0" operation (0x71)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then 0 is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutC0()
{
WritePort(Regs.BC, 0);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "sbc hl,sp" operation (0x72)
/// </summary>
/// <remarks>
/// The contents of the register pair SP and the Carry Flag are subtracted from the contents of HL, and the result
/// is stored in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if borrow from bit 12; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is set.
/// C is set if borrow; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void SbcHLSP()
{
TactPlus7(Regs.HL);
Sbc16(Regs.SP);
}
/// <summary>
/// "ld (NN),sp" operation (0x73)
/// </summary>
/// <remarks>
/// The low-order byte of register pair SP is loaded to memory address (NN); the upper byte is loaded to memory
/// address(NN + 1).
///
/// T-States: 20 (4, 4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:4,pc+2:3,pc+3:3,nn:3,nn+1:3
/// </remarks>
private void LdNNiSP()
{
Store16((byte)Regs.SP, (byte)(Regs.SP >> 8));
}
/// <summary>
/// "in a,(c)" operation (0x78)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then one byte from the selected port is placed on the data bus and written to
/// Register A in the CPU.
///
/// S is set if input data is negative; otherwise, it is reset.
/// Z is set if input data is 0; otherwise, it is reset.
/// H is reset.
/// P/V is set if parity is even; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void InAC()
{
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.A = ReadPort(Regs.BC);
Regs.F = (byte)((Regs.F & FlagsSetMask.C) | s_SZ53Table![Regs.A]);
F53Updated = true;
}
/// <summary>
/// "out (c),a" operation (0x79)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. The contents of Register B are placed on the top half (A8 through A15) of
/// the address bus at this time. Then the byte contained in register A is placed on the data bus and written to
/// the selected peripheral device.
///
/// T-States: 12 (4, 4, 4)
/// Contention breakdown: pc:4,pc+1:4,I/O
/// </remarks>
private void OutCA()
{
WritePort(Regs.BC, Regs.A);
Regs.WZ = (ushort)(Regs.BC + 1);
}
/// <summary>
/// "adc hl,sp" operation (0x7A)
/// </summary>
/// <remarks>
/// The contents of register pair SP are added with the Carry flag to the contents of HL, and the result is stored
/// in HL.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if result is 0; otherwise, it is reset.
/// H is set if carry from bit 11; otherwise, it is reset.
/// P/V is set if overflow; otherwise, it is reset.
/// N is reset.
/// C is set if carry from bit 15; otherwise, it is reset.
///
/// T-States: 15 (4, 4, 4, 3)
/// Contention breakdown: pc:4,pc+1:11
/// </remarks>
private void AdcHLSP()
{
TactPlus7(Regs.HL);
Adc16(Regs.SP);
}
/// <summary>
/// "ld sp,(NN)" operation (0x7B)
/// </summary>
/// <remarks>
/// The contents of memory address (NN) are loaded to the low-order portion of SP, and the contents of the next
/// highest memory address (NN + 1) are loaded to the high-order portion of SP.
///
/// T-States: 16 (4, 3, 3, 3, 3)
/// Contention breakdown: pc:4,pc+1:3,pc+2:3,nn:3,nn+1:3
/// </remarks>
private void LdSPNNi()
{
ushort tmp = FetchCodeByte();
tmp += (ushort)(FetchCodeByte() << 8);
var val = ReadMemory(tmp);
tmp += 1;
Regs.WZ = tmp;
Regs.SP = (ushort)((ReadMemory(tmp) << 8) + val);
}
/// <summary>
/// "retn" operation (0x45, 0x4d, 0x55, 0x5d, 0x65, 0x6d, 0x75, 0x7d)
/// </summary>
/// <remarks>
/// This instruction is used at the end of a nonmaskable interrupts service routine to restore the contents of PC.
/// The state of IFF2 is copied back to IFF1 so that maskable interrupts are enabled immediately following the
/// RETN if they were enabled before the nonmaskable interrupt.
///
/// T-States: 14 (4, 4, 4, 3, 3)
/// Contention breakdown: pc:4,pc+1:4,sp:3,sp+1:3
/// </remarks>
private void Retn()
{
Iff1 = Iff2;
Ret();
}
/// <summary>
/// "ldi" operation (0xA0)
/// </summary>
/// <remarks>
/// A byte of data is transferred from the memory location addressed by the contents of HL to the memory location
/// addressed by the contents of DE. Then both these register pairs are incremented and BC is decremented.
///
/// S is not affected.
/// Z is not affected.
/// H is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,de:3,de:1 ×2
/// Gate array contention breakdown: pc:4,pc+1:4,hl:3,de:5
/// </remarks>
private void Ldi()
{
var tmp = ReadMemory(Regs.HL);
Regs.BC--;
WriteMemory(Regs.DE, tmp);
TactPlus2(Regs.DE);
Regs.DE++;
Regs.HL++;
tmp += Regs.A;
Regs.F = (byte)
((Regs.F & (FlagsSetMask.C | FlagsSetMask.Z | FlagsSetMask.S)) |
(Regs.BC != 0 ? FlagsSetMask.PV : 0) |
(tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
}
/// <summary>
/// "cpi" operation (0xA1)
/// </summary>
/// <remarks>
/// The contents of the memory location addressed by HL is compared with the contents of A. With a true compare, Z
/// flag is set. Then HL is incremented and BC is decremented.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if A is (HL); otherwise, it is reset.
/// H is set if borrow from bit 4; otherwise, it is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×5
/// Gate array contention breakdown: pc:4,pc+1:4,hl:8
/// </remarks>
private void Cpi()
{
var value = ReadMemory(Regs.HL);
var tmp = (byte)(Regs.A - value);
var lookup =
((Regs.A & 0x08) >> 3) |
((value & 0x08) >> 2) |
((tmp & 0x08) >> 1);
TactPlus5(Regs.HL);
Regs.HL++;
Regs.BC--;
Regs.F = (byte)
((Regs.F & FlagsSetMask.C) |
(Regs.BC != 0 ? (FlagsSetMask.PV | FlagsSetMask.N) : FlagsSetMask.N) |
s_HalfCarrySubFlags[lookup] |
(tmp != 0 ? 0 : FlagsSetMask.Z) |
(tmp & FlagsSetMask.S));
if ((Regs.F & FlagsSetMask.H) != 0)
{
tmp -= 1;
}
Regs.F |= (byte)((tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
Regs.WZ++;
}
/// <summary>
/// "ini" operation (0xA2)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. Register B can be used as a byte counter, and its contents are placed on
/// the top half (A8 through A15) of the address bus at this time. Then one byte from the selected port is placed
/// on the data bus and written to the CPU. The contents of the HL register pair are then placed on the address
/// bus and the input byte is written to the corresponding location of memory. Finally, B is decremented and HL
/// is incremented.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,I/O,hl:3
/// </remarks>
private void Ini()
{
TactPlus1(Regs.IR);
var tmp = ReadPort(Regs.BC);
WriteMemory(Regs.HL, tmp);
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.B--;
Regs.HL++;
var tmp2 = (byte)(tmp + Regs.C + 1);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
}
/// <summary>
/// "outi" operation (0xa3)
/// </summary>
/// <remarks>
/// The contents of the HL register pair are placed on the address bus to select a location in memory. The byte
/// contained in this memory location is temporarily stored in the CPU. Then, after B is decremented, the contents
/// of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at one of 256
/// possible ports. Register B is used as a byte counter, and its decremented value is placed on the top half (A8
/// through A15) of the address bus. The byte to be output is placed on the data bus and written to a selected
/// peripheral device. Finally, the HL is incremented.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,hl:3,I/O
/// </remarks>
private void Outi()
{
TactPlus1(Regs.IR);
var tmp = ReadMemory(Regs.HL);
Regs.B--;
Regs.WZ = (ushort)(Regs.BC + 1);
WritePort(Regs.BC, tmp);
Regs.HL++;
var tmp2 = (byte)(tmp + Regs.L);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
}
/// <summary>
/// "ldd" operation (0xA8)
/// </summary>
/// <remarks>
/// Transfers a byte of data from the memory location addressed by HL to the memory location addressed by DE. Then
/// DE, HL, and BC is decremented.
///
/// S is not affected.
/// Z is not affected.
/// H is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,de:3,de:1 ×2
/// Gate array contention breakdown: pc:4,pc+1:4,hl:3,de:5
/// </remarks>
private void Ldd()
{
var tmp = ReadMemory(Regs.HL);
Regs.BC--;
WriteMemory(Regs.DE, tmp);
TactPlus2(Regs.DE);
Regs.DE--;
Regs.HL--;
tmp += Regs.A;
Regs.F = (byte)
((Regs.F & (FlagsSetMask.C | FlagsSetMask.Z | FlagsSetMask.S)) |
(Regs.BC != 0 ? FlagsSetMask.PV : 0) |
(tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
}
/// <summary>
/// "cpd" operation (0xA9)
/// </summary>
/// <remarks>
/// The contents of the memory location addressed by HL is compared with the contents of A. During the compare
/// operation, the Zero flag is set or reset. HL and BC are decremented.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if A is (HL); otherwise, it is reset.
/// H is set if borrow from bit 4; otherwise, it is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×5
/// Gate array contention breakdown: pc:4,pc+1:4,hl:8
/// </remarks>
private void Cpd()
{
var value = ReadMemory(Regs.HL);
var tmp = (byte)(Regs.A - value);
var lookup =
((Regs.A & 0x08) >> 3) |
((value & 0x08) >> 2) |
((tmp & 0x08) >> 1);
TactPlus5(Regs.HL);
Regs.HL--;
Regs.BC--;
Regs.F = (byte)
((Regs.F & FlagsSetMask.C) |
(Regs.BC != 0 ? FlagsSetMask.PV | FlagsSetMask.N : FlagsSetMask.N) |
s_HalfCarrySubFlags[lookup] |
(tmp != 0 ? 0 : FlagsSetMask.Z) |
(tmp & FlagsSetMask.S));
if ((Regs.F & FlagsSetMask.H) != 0)
{
tmp -= 1;
}
Regs.F |= (byte)((tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
Regs.WZ--;
}
/// <summary>
/// "ind" operation (0xAA)
/// </summary>
/// <remarks>
/// The contents of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at
/// one of 256 possible ports. Register B is used as a byte counter, and its contents are placed on the top half
/// (A8 through A15) of the address bus at this time. Then one byte from the selected port is placed on the data
/// bus and written to the CPU. The contents of HL are placed on the address bus and the input byte is written to
/// the corresponding location of memory. Finally, B and HLL are decremented.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,I/O,hl:3
/// </remarks>
private void Ind()
{
TactPlus1(Regs.IR);
var tmp = ReadPort(Regs.BC);
WriteMemory(Regs.HL, tmp);
Regs.WZ = (ushort)(Regs.BC - 1);
Regs.B--;
Regs.HL--;
var tmp2 = (byte)(tmp + Regs.C - 1);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
}
/// <summary>
/// "outd" operation (0xAD)
/// </summary>
/// <remarks>
/// The contents of the HL register pair are placed on the address bus to select a location in memory. The byte
/// contained in this memory location is temporarily stored in the CPU. Then, after B is decremented, the
/// contents of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at
/// one of 256 possible ports. Register B is used as a byte counter, and its decremented value is placed on the
/// top half (A8 through A15) of the address bus. The byte to be output is placed on the data bus and written to
/// a selected peripheral device. Finally, the HL is decremented.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,hl:3,I/O
/// </remarks>
private void Outd()
{
TactPlus1(Regs.IR);
var tmp = ReadMemory(Regs.HL);
Regs.B--;
Regs.WZ = (ushort)(Regs.BC - 1);
WritePort(Regs.BC, tmp);
Regs.HL--;
var tmp2 = (byte)(tmp + Regs.L);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
}
/// <summary>
/// "ldir" operation (0xB0)
/// </summary>
/// <remarks>
/// Transfers a byte of data from the memory location addressed by HL to the memory location addressed DE. Then HL
/// and DE are incremented. BC is decremented. If decrementing allows the BC to go to 0, the instruction is
/// terminated. If BC isnot 0, the program counter is decremented by two and the instruction is repeated.
/// Interrupts are recognized and two refresh cycles are executed after each data transfer. When the BC is set to
/// 0 prior to instruction execution, the instruction loops through 64 KB.
///
/// S is not affected.
/// Z is not affected.
/// H is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 4, 3, 5, 5)
/// BC=0: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,de:3,de:1 ×2,[de:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:4,hl:3,de:5,[5]
/// </remarks>
private void Ldir()
{
var tmp = ReadMemory(Regs.HL);
WriteMemory(Regs.DE, tmp);
TactPlus2(Regs.DE);
Regs.BC--;
tmp += Regs.A;
Regs.F = (byte)
((Regs.F & (FlagsSetMask.C | FlagsSetMask.Z | FlagsSetMask.S)) |
(Regs.BC != 0 ? FlagsSetMask.PV : 0) |
(tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
if (Regs.BC != 0)
{
TactPlus5(Regs.DE);
Regs.PC -= 2;
Regs.WZ = (byte)(Regs.PC +1);
}
Regs.HL++;
Regs.DE++;
}
/// <summary>
/// "cpir" operation (0xB1)
/// </summary>
/// <remarks>
/// The contents of the memory location addressed HL is compared with the contents of A. During a compare
/// operation, the Zero flag is set or reset. Then HL is incremented and BC is decremented. If decrementing causes
/// BC to go to 0 or if A = (HL), the instruction is terminated. If BC is not 0 and A is not equal (HL), the
/// program counter is decremented by two and the instruction is repeated. Interrupts are recognized and two
/// refresh cycles are executed after each data transfer. If BC is set to 0 before instruction execution, the
/// instruction loops through 64 KB if no match is found.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if A is (HL); otherwise, it is reset.
/// H is set if borrow from bit 4; otherwise, it is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is set.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 4, 3, 5, 5)
/// BC=0: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×5,[hl:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:4,hl:8,[5]
/// </remarks>
private void Cpir()
{
var value = ReadMemory(Regs.HL);
var tmp = (byte)(Regs.A - value);
var lookup =
((Regs.A & 0x08) >> 3) |
((value & 0x08) >> 2) |
((tmp & 0x08) >> 1);
TactPlus5(Regs.HL);
Regs.BC--;
Regs.F = (byte)
((Regs.F & FlagsSetMask.C) |
(Regs.BC != 0 ? FlagsSetMask.PV | FlagsSetMask.N : FlagsSetMask.N) |
s_HalfCarrySubFlags[lookup] |
(tmp != 0 ? 0 : FlagsSetMask.Z) |
(tmp & FlagsSetMask.S));
if ((Regs.F & FlagsSetMask.H) != 0)
{
tmp -= 1;
}
Regs.F |= (byte)((tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
if ((Regs.F & (FlagsSetMask.PV | FlagsSetMask.Z)) == FlagsSetMask.PV)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
Regs.WZ = (byte)(Regs.PC + 1);
}
else
{
Regs.WZ++;
}
Regs.HL++;
}
/// <summary>
/// "inir" operation (0xB2)
/// </summary>
/// <remarks>
/// The contents of Register C are placed on the bottom half (A0 through A7) of the address bus to select the I/O
/// device at one of 256 possible ports. Register B can be used as a byte counter, and its contents are placed on
/// the top half (A8 through A15) of the address bus at this time. Then one byte from the selected port is placed
/// on the data bus and written to the CPU. The contents of the HL register pair are then placed on the address
/// bus and the input byte is written to the corresponding location of memory. Finally, B is decremented and HL
/// is incremented. If decrementing causes B to go to 0, the instruction is terminated. If B is not 0, PC is
/// decremented by two and the instruction repeated. Interrupts are recognized and two refresh cycles execute after
/// each data transfer.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 5, 3, 4, 5)
/// BC=0: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,I/O,hl:3,[hl:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:5,I/O,hl:3,[5]
/// </remarks>
private void Inir()
{
TactPlus1(Regs.IR);
var tmp = ReadPort(Regs.BC);
WriteMemory(Regs.HL, tmp);
Regs.WZ = (ushort)(Regs.BC + 1);
Regs.B--;
var tmp2 = (byte)(tmp + Regs.C + 1);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
if (Regs.B != 0)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
}
Regs.HL++;
}
/// <summary>
/// "otir" operation (0xB3)
/// </summary>
/// <remarks>
/// The contents of the HL register pair are placed on the address bus to select a location in memory. The byte
/// contained in this memory location is temporarily stored in the CPU. Then, after B is decremented, the contents
/// of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at one of 256
/// possible ports. Register B is used as a byte counter, and its decremented value is placed on the top half (A8
/// through A15) of the address bus. The byte to be output is placed on the data bus and written to a selected
/// peripheral device. Finally, the HL is incremented. If the decremented B Register is not 0, PC is decremented
/// by two and the instruction is repeated. If B has gone to 0, the instruction is terminated. Interrupts are
/// recognized and two refresh cycles are executed after each data transfer.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
/// T-States:
/// BC!=0: 21 (4, 5, 3, 4, 5)
/// BC=0: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,hl:3,I/O,[bc:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:5,hl:3,I/O,[5]
/// </remarks>
private void Otir()
{
TactPlus1(Regs.IR);
var tmp = ReadMemory(Regs.HL);
Regs.B--;
Regs.WZ = (byte)(Regs.BC + 1);
WritePort(Regs.BC, tmp);
Regs.HL++;
var tmp2 = (byte)(tmp + Regs.L);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
if (Regs.B != 0)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
}
}
/// <summary>
/// "lddr" operation (0xB8)
/// </summary>
/// <remarks>
/// Transfers a byte of data from the memory location addressed by HL to the memory location addressed by DE. Then
/// DE, HL, and BC is decremented. If decrementing causes BC to go to 0, the instruction is terminated. If BC is
/// not 0, PC is decremented by two and the instruction is repeated. Interrupts are recognized and two refresh
/// cycles execute after each data transfer. When BC is set to 0, prior to instruction execution, the instruction
/// loops through 64 KB.
///
/// S is not affected.
/// Z is not affected.
/// H is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is reset.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 4, 3, 5, 5)
/// BC=0: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,de:3,de:1 ×2,[de:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:4,hl:3,de:5,[5]
/// </remarks>
private void Lddr()
{
var tmp = ReadMemory(Regs.HL);
WriteMemory(Regs.DE, tmp);
TactPlus2(Regs.DE);
Regs.BC--;
tmp += Regs.A;
Regs.F = (byte)
((Regs.F & (FlagsSetMask.C | FlagsSetMask.Z | FlagsSetMask.S)) |
(Regs.BC != 0 ? FlagsSetMask.PV : 0) |
(tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
if (Regs.BC != 0)
{
TactPlus5(Regs.DE);
Regs.PC -= 2;
Regs.WZ = (byte)(Regs.PC + 1);
}
Regs.HL--;
Regs.DE--;
}
/// <summary>
/// "cpdr" operation (0xB9)
/// </summary>
/// <remarks>
/// The contents of the memory location addressed by HL is compared with the contents of A. During the compare
/// operation, the Zero flag is set or reset. HL and BC are decremented. If BC is not 0 and A = (HL), PC is
/// decremented by two and the instruction is repeated. Interrupts are recognized and two refresh cycles execute
/// after each data transfer. When the BC is set to 0, prior to instruction execution, the instruction loops
/// through 64 KB if no match is found.
///
/// S is set if result is negative; otherwise, it is reset.
/// Z is set if A is (HL); otherwise, it is reset.
/// H is set if borrow from bit 4; otherwise, it is reset.
/// P/V is set if BC – 1 is not 0; otherwise, it is reset.
/// N is set.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 4, 3, 5, 5)
/// BC=0: 16 (4, 4, 3, 5)
/// Contention breakdown: pc:4,pc+1:4,hl:3,hl:1 ×5,[hl:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:4,hl:8,[5]
/// </remarks>
private void Cpdr()
{
var value = ReadMemory(Regs.HL);
var tmp = (byte)(Regs.A - value);
var lookup =
((Regs.A & 0x08) >> 3) |
((value & 0x08) >> 2) |
((tmp & 0x08) >> 1);
TactPlus5(Regs.HL);
Regs.BC--;
Regs.F = (byte)
((Regs.F & FlagsSetMask.C) |
(Regs.BC != 0 ? FlagsSetMask.PV | FlagsSetMask.N : FlagsSetMask.N) |
s_HalfCarrySubFlags[lookup] |
(tmp != 0 ? 0 : FlagsSetMask.Z) |
(tmp & FlagsSetMask.S));
if ((Regs.F & FlagsSetMask.H) != 0)
{
tmp -= 1;
}
Regs.F |= (byte)((tmp & FlagsSetMask.R3) | ((tmp & 0x02) != 0 ? FlagsSetMask.R5 : 0));
F53Updated = true;
if ((Regs.F & (FlagsSetMask.PV | FlagsSetMask.Z)) == FlagsSetMask.PV)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
Regs.WZ = (byte)(Regs.PC + 1);
}
else
{
Regs.WZ--;
}
Regs.HL--;
}
/// <summary>
/// "indr" operation (0xBA)
/// </summary>
/// <remarks>
/// The contents of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at
/// one of 256 possible ports. Register B is used as a byte counter, and its contents are placed on the top half
/// (A8 through A15) of the address bus at this time. Then one byte from the selected port is placed on the data
/// bus and written to the CPU. The contents of HL are placed on the address bus and the input byte is written to
/// the corresponding location of memory. Finally, B and HL are decremented. If decrementing causes B to go to 0,
/// the instruction is terminated. If B is not 0, PC is decremented by two and the instruction repeated. Interrupts
/// are recognized and two refresh cycles are executed after each data transfer.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 5, 3, 4, 5)
/// BC=0: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,I/O,hl:3,[hl:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:5,I/O,hl:3,[5]
/// </remarks>
private void Indr()
{
TactPlus1(Regs.IR);
var tmp = ReadPort(Regs.BC);
WriteMemory(Regs.HL, tmp);
Regs.WZ = (ushort)(Regs.BC - 1);
Regs.B--;
var tmp2 = (byte)(tmp + Regs.C - 1);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
if (Regs.B != 0)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
}
Regs.HL--;
}
/// <summary>
/// "otdr" operation (0xBB)
/// </summary>
/// <remarks>
/// The contents of the HL register pair are placed on the address bus to select a location in memory. The byte
/// contained in this memory location is temporarily stored in the CPU. Then, after B is decremented, the
/// contents of C are placed on the bottom half (A0 through A7) of the address bus to select the I/O device at
/// one of 256 possible ports. Register B is used as a byte counter, and its decremented value is placed on the
/// top half (A8 through A15) of the address bus. The byte to be output is placed on the data bus and written to
/// a selected peripheral device. Finally, the HL is decremented. If the decremented B Register is not 0, PC is
/// decremented by two and the instruction is repeated. If B has gone to 0, the instruction is terminated.
/// Interrupts are recognized and two refresh cycles are executed after each data transfer.
///
/// S is unknown.
/// Z is set if B – 1 = 0; otherwise it is reset.
/// H is unknown.
/// P/V is unknown.
/// N is set.
/// C is not affected.
///
/// T-States:
/// BC!=0: 21 (4, 5, 3, 4, 5)
/// BC=0: 16 (4, 5, 3, 4)
/// Contention breakdown: pc:4,pc+1:5,hl:3,I/O,[bc:1 ×5]
/// Gate array contention breakdown: pc:4,pc+1:5,hl:3,I/O,[5]
/// </remarks>
private void Otdr()
{
TactPlus1(Regs.IR);
var tmp = ReadMemory(Regs.HL);
Regs.B--;
Regs.WZ = (byte)(Regs.BC - 1);
WritePort(Regs.BC, tmp);
Regs.HL--;
var tmp2 = (byte)(tmp + Regs.L);
Regs.F = (byte)
(((tmp & 0x80) != 0 ? FlagsSetMask.N : 0) |
(tmp2 < tmp ? FlagsSetMask.H | FlagsSetMask.C : 0) |
(s_ParityTable![(tmp2 & 0x07) ^ Regs.B] != 0 ? FlagsSetMask.PV : 0) |
s_SZ53Table![Regs.B]);
F53Updated = true;
if (Regs.B != 0)
{
TactPlus5(Regs.HL);
Regs.PC -= 2;
}
}
} |
using System;
namespace Newtonsoft.Json
{
// Token: 0x02000026 RID: 38
public class JsonWriterException : Exception
{
// Token: 0x060001EB RID: 491 RVA: 0x0000873E File Offset: 0x0000693E
public JsonWriterException()
{
}
// Token: 0x060001EC RID: 492 RVA: 0x00008746 File Offset: 0x00006946
public JsonWriterException(string message) : base(message)
{
}
// Token: 0x060001ED RID: 493 RVA: 0x0000874F File Offset: 0x0000694F
public JsonWriterException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
|
using Mitternacht.Common;
namespace Mitternacht.Database.Models {
public class Warning : DbEntity, IModerationPoints {
public ulong GuildId { get; set; }
public ulong UserId { get; set; }
public string Reason { get; set; }
public bool Forgiven { get; set; }
public string ForgivenBy { get; set; }
public string Moderator { get; set; }
public long PointsLight { get; set; }
public long PointsMedium { get; set; }
public long PointsHard { get; set; }
public bool Hidden { get; set; }
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.