content stringlengths 23 1.05M |
|---|
namespace SFA.Apprenticeships.Infrastructure.Communication.Email
{
using Application.Interfaces.Communications;
using Domain.Entities;
using SendGrid;
public abstract class EmailMessageFormatter
{
public abstract void PopulateMessage(EmailRequest request, ISendGrid message);
}
} |
using MahApps.Metro.IconPacks;
using OnPoint.ViewModels;
using ReactiveUI;
using System;
using System.Reactive;
using System.Reactive.Linq;
namespace OnPoint.WpfTestApp
{
public class Person : ChangeableObject, IEquatable<Person>
{
private static int _IdIndex = 0;
public int ID { get => _ID; set => this.RaiseAndSetIfChanged(ref _ID, value); }
private int _ID = default;
public string FirstName { get => _FirstName; set => this.RaiseAndSetIfChanged(ref _FirstName, value); }
private string _FirstName = default;
public string LastName { get => _LastName; set => this.RaiseAndSetIfChanged(ref _LastName, value); }
private string _LastName = default;
public PackIconMaterialKind Icon { get => _Icon; set => this.RaiseAndSetIfChanged(ref _Icon, value); }
private PackIconMaterialKind _Icon = default;
public string DisplayName => ToString();
public Person()
{
ID = _IdIndex--;
Observable.Merge
(
this.WhenAnyValue(x => x.FirstName).Select(_ => Unit.Default),
this.WhenAnyValue(x => x.LastName).Select(_ => Unit.Default),
this.WhenAnyValue(x => x.Icon).Select(_ => Unit.Default)
)
.Subscribe(_ => { IsChanged = true; this.RaisePropertyChanged(nameof(DisplayName)); });
}
public Person(int id, string firstName, string lastName, PackIconMaterialKind icon) : this()
{
ID = id;
FirstName = firstName;
LastName = lastName;
Icon = icon;
IsChanged = false;
}
public override string ToString() => $"{LastName}, {FirstName}";
public bool Equals(Person other) => ID == other?.ID;
}
} |
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class LvlGenerator : MonoBehaviour {
public GameObject lvlButtonPrefab;
public GameObject canvas;
public int numberOfLvls = 11;
// Use this for initialization
void Start () {
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 4; j++)
{
if((i-1)*4 +j <= numberOfLvls)
{
GameObject button = Instantiate(lvlButtonPrefab) as GameObject;
button.transform.SetParent(canvas.transform);
button.GetComponent<RectTransform>().position = new Vector3(100 + 100*j, 600 - 100*i, 0);
int lvl = (i-1)*4 +j;
button.GetComponentInChildren<Text>().text = (lvl).ToString();
button.GetComponent<Button>().onClick.RemoveAllListeners();
button.GetComponent<Button>().onClick.AddListener(delegate{LoadLvl(lvl);});
}
}
}
}
public void LoadLvl(int lvl)
{
Application.LoadLevel (lvl);
}
}
|
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class ChoiceButtonTimer : MonoBehaviour
{
public Image timerIcon;
public TMPro.TextMeshProUGUI text;
public int choiceIndex = 0;
public float choiceTime;
void Start()
{
StartCoroutine(countDown());
}
private IEnumerator countDown()
{
float timeLeft = choiceTime;
while (timeLeft > 0)
{
yield return new WaitForEndOfFrame();
timeLeft -= Time.deltaTime;
timerIcon.fillAmount = 1 - (timeLeft / choiceTime);
if (Input.GetKey((choiceIndex + 1).ToString()))
{
ChooseOption();
}
}
Destroy(gameObject);
}
public void ChooseOption()
{
FindObjectOfType<MoralGameManager>().choiceIndex = choiceIndex;
timerIcon.color = Color.green;
text.color = Color.green;
foreach (ChoiceButtonTimer button in FindObjectsOfType<ChoiceButtonTimer>())
{
if (button != this)
{
button.Deselect();
}
}
}
public void Deselect()
{
timerIcon.color = Color.white;
text.color = Color.white;
}
}
|
// Copyright (c) Alexandre Mutel. All rights reserved.
// This file is licensed under the BSD-Clause 2 license.
// See the license.txt file in the project root for more information.
using System;
using System.Collections.Generic;
namespace Markdig.Extensions.MediaLinks
{
/// <summary>
/// Options for the <see cref="MediaLinkExtension"/>.
/// </summary>
public class MediaOptions
{
public MediaOptions()
{
Width = "500";
Height = "281";
Class = "";
ExtensionToMimeType = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{".3gp", "video/3gpp"},
{".3g2", "video/3gpp2"},
{".avi", "video/x-msvideo"},
{".uvh", "video/vnd.dece.hd"},
{".uvm", "video/vnd.dece.mobile"},
{".uvu", "video/vnd.uvvu.mp4"},
{".uvp", "video/vnd.dece.pd"},
{".uvs", "video/vnd.dece.sd"},
{".uvv", "video/vnd.dece.video"},
{".fvt", "video/vnd.fvt"},
{".f4v", "video/x-f4v"},
{".flv", "video/x-flv"},
{".fli", "video/x-fli"},
{".h261", "video/h261"},
{".h263", "video/h263"},
{".h264", "video/h264"},
{".jpm", "video/jpm"},
{".jpgv", "video/jpeg"},
{".m4v", "video/x-m4v"},
{".asf", "video/x-ms-asf"},
{".pyv", "video/vnd.ms-playready.media.pyv"},
{".wm", "video/x-ms-wm"},
{".wmx", "video/x-ms-wmx"},
{".wmv", "video/x-ms-wmv"},
{".wvx", "video/x-ms-wvx"},
{".mj2", "video/mj2"},
{".mxu", "video/vnd.mpegurl"},
{".mpeg", "video/mpeg"},
{".mp4", "video/mp4"},
{".ogv", "video/ogg"},
{".webm", "video/webm"},
{".qt", "video/quicktime"},
{".movie", "video/x-sgi-movie"},
{".viv", "video/vnd.vivo"},
{".adp", "audio/adpcm"},
{".aac", "audio/x-aac"},
{".aif", "audio/x-aiff"},
{".uva", "audio/vnd.dece.audio"},
{".eol", "audio/vnd.digital-winds"},
{".dra", "audio/vnd.dra"},
{".dts", "audio/vnd.dts"},
{".dtshd", "audio/vnd.dts.hd"},
{".rip", "audio/vnd.rip"},
{".lvp", "audio/vnd.lucent.voice"},
{".m3u", "audio/x-mpegurl"},
{".pya", "audio/vnd.ms-playready.media.pya"},
{".wma", "audio/x-ms-wma"},
{".wax", "audio/x-ms-wax"},
{".mid", "audio/midi"},
{".mp3", "audio/mpeg"},
{".mpga", "audio/mpeg"},
{".mp4a", "audio/mp4"},
{".ecelp4800", "audio/vnd.nuera.ecelp4800"},
{".ecelp7470", "audio/vnd.nuera.ecelp7470"},
{".ecelp9600", "audio/vnd.nuera.ecelp9600"},
{".oga", "audio/ogg"},
{".ogg", "audio/ogg"},
{".weba", "audio/webm"},
{".ram", "audio/x-pn-realaudio"},
{".rmp", "audio/x-pn-realaudio-plugin"},
{".au", "audio/basic"},
{".wav", "audio/x-wav"},
};
Hosts = new List<IHostProvider>(HostProviderBuilder.KnownHosts.Values);
}
public string Width { get; set; }
public string Height { get; set; }
public string Class { get; set; }
public Dictionary<string, string> ExtensionToMimeType { get; }
public List<IHostProvider> Hosts { get; }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TddShop.Cli
{
public class Program
{
static void Main(string[] args)
{
int a = 20;
int b = 9;
var sum = AddTwoNumbers(a, b);
if (sum == 29)
{
Console.WriteLine("Success!");
}
else
{
Console.WriteLine("Failure:(");
}
Console.ReadLine();
}
public static int AddTwoNumbers(int a, int b)
{
return a + b;
}
}
}
|
using System.Data;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Data.Sqlite;
namespace Umbraco.Cms.Persistence.Sqlite.Services;
public class SqlitePreferDeferredTransactionsConnection : DbConnection
{
private readonly SqliteConnection _inner;
public SqlitePreferDeferredTransactionsConnection(SqliteConnection inner)
{
_inner = inner;
}
protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
=> _inner.BeginTransaction(isolationLevel, deferred: true); // <-- The important bit
public override void ChangeDatabase(string databaseName)
=> _inner.ChangeDatabase(databaseName);
public override void Close()
=> _inner.Close();
public override void Open()
=> _inner.Open();
public override string Database
=> _inner.Database;
public override ConnectionState State
=> _inner.State;
public override string DataSource
=> _inner.DataSource;
public override string ServerVersion
=> _inner.ServerVersion;
protected override DbCommand CreateDbCommand()
=> new CommandWrapper(_inner.CreateCommand());
[AllowNull]
public override string ConnectionString
{
get => _inner.ConnectionString;
set => _inner.ConnectionString = value;
}
private class CommandWrapper : DbCommand
{
private readonly DbCommand _inner;
public CommandWrapper(DbCommand inner)
{
_inner = inner;
}
public override void Cancel()
=> _inner.Cancel();
public override int ExecuteNonQuery()
=> _inner.ExecuteNonQuery();
public override object? ExecuteScalar()
=> _inner.ExecuteScalar();
public override void Prepare()
=> _inner.Prepare();
[AllowNull]
public override string CommandText
{
get => _inner.CommandText;
set => _inner.CommandText = value;
}
public override int CommandTimeout
{
get => _inner.CommandTimeout;
set => _inner.CommandTimeout = value;
}
public override CommandType CommandType
{
get => _inner.CommandType;
set => _inner.CommandType = value;
}
public override UpdateRowSource UpdatedRowSource
{
get => _inner.UpdatedRowSource;
set => _inner.UpdatedRowSource = value;
}
protected override DbConnection? DbConnection
{
get => _inner.Connection;
set
{
_inner.Connection = (value as SqlitePreferDeferredTransactionsConnection)?._inner;
}
}
protected override DbParameterCollection DbParameterCollection
=> _inner.Parameters;
protected override DbTransaction? DbTransaction
{
get => _inner.Transaction;
set => _inner.Transaction = value;
}
public override bool DesignTimeVisible
{
get => _inner.DesignTimeVisible;
set => _inner.DesignTimeVisible = value;
}
protected override DbParameter CreateDbParameter()
=> _inner.CreateParameter();
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
=> _inner.ExecuteReader(behavior);
}
}
|
namespace FindWhere.Web.Controllers
{
using FindWhere.Model;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web.Mvc;
public class CategoriesController : AdminController
{
// GET: Categories
public ActionResult Index()
{
var allCategories = this.Context.Categories.ToList();
return View(allCategories);
}
// GET: Categories/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Category category = this.Context.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
return View(category);
}
// GET: Categories/Create
public ActionResult Create()
{
return View();
}
// POST: Categories/Create
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "Id,Name")] Category category)
{
if (ModelState.IsValid)
{
if (this.Context.Categories.Any(c => c.Name == category.Name))
{
return this.RedirectWithError("Categories", "Create", "The category already exists!");
}
this.Context.Categories.Add(category);
this.Context.SaveChanges();
return this.RedirectWithSuccess("Categories", "Index", "New category successfuly added!");
}
return View(category);
}
// GET: Categories/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Category category = this.Context.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
return View(category);
}
// POST: Categories/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include = "Id,Name")] Category category)
{
if (ModelState.IsValid)
{
this.Context.Entry(category).State = EntityState.Modified;
this.Context.SaveChanges();
return this.RedirectWithSuccess("Categories", "Index", "Category successfuly saved!");
}
return View(category);
}
// GET: Categories/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Category category = this.Context.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
return View(category);
}
// POST: Categories/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public ActionResult DeleteConfirmed(int id)
{
Category category = this.Context.Categories.Find(id);
this.Context.Categories.Remove(category);
this.Context.SaveChanges();
return this.RedirectWithSuccess("Categories", "Index", "Category successfuly deleted!");
}
}
}
|
namespace WiseOldManConnector.Models;
public class ConnectorCollectionResponse<T> : ConnectorResponseBase {
internal ConnectorCollectionResponse(T data) : this(new List<T> { data }, null) { }
internal ConnectorCollectionResponse(IEnumerable<T> data) : this(data, null) { }
internal ConnectorCollectionResponse(T data, string message) : this(new List<T> { data }, message) { }
internal ConnectorCollectionResponse(IEnumerable<T> data, string message) : base(message) {
Data = data;
}
public IEnumerable<T> Data { get; set; }
}
|
using AlugaiWEB.Models;
using AutoMapper;
using Core;
using Core.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
namespace AlugaiWEB.Controllers
{
public class AnuncioController : Controller
{
IAnuncioService _anuncioService;
IImovelService _imovelService;
IPessoaService _pessoaService;
IMapper _mapper;
public AnuncioController(IAnuncioService anuncioService, IImovelService imovelService,
IPessoaService pessoaService, IMapper mapper)
{
_anuncioService = anuncioService;
_imovelService = imovelService;
_pessoaService = pessoaService;
_mapper = mapper;
}
public ActionResult Index()
{
var listarAnuncios = _anuncioService.ObterTodos();
var listarAnunciosModel = _mapper.Map<List<AnuncioModel>>(listarAnuncios);
return View(listarAnunciosModel);
}
public ActionResult Details(int id)
{
Anuncio anuncio = _anuncioService.Buscar(id);
AnuncioModel anuncioModel = _mapper.Map<AnuncioModel>(anuncio);
return View(anuncioModel);
}
public ActionResult Create()
{
IEnumerable<Imovel> listarImoveis = _imovelService.ObterTodos();
IEnumerable<Pessoa> listarPessoas = _pessoaService.ObterTodos();
ViewBag.IdImovel = new SelectList(listarImoveis, "CodigoImovel", "Descricao", null);
ViewBag.IdPessoa = new SelectList(listarPessoas, "CodigoPessoa", "Nome", null);
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(AnuncioModel anuncioModel)
{
if (ModelState.IsValid)
{
var anuncio = _mapper.Map<Anuncio>(anuncioModel);
anuncio.Data = DateTime.Now;
_anuncioService.Inserir(anuncio);
}
return RedirectToAction(nameof(Index));
}
public ActionResult Edit(int id)
{
Anuncio anuncio = _anuncioService.Buscar(id);
AnuncioModel anuncioModel = _mapper.Map<AnuncioModel>(anuncio);
IEnumerable<Imovel> listarImoveis = _imovelService.ObterTodos();
IEnumerable<Pessoa> listarPessoas = _pessoaService.ObterTodos();
ViewBag.IdImovel = new SelectList(listarImoveis, "CodigoImovel", "Descricao", null);
ViewBag.IdPessoa = new SelectList(listarPessoas, "CodigoPessoa", "Nome", null);
return View(anuncioModel);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(int id, AnuncioModel anuncioModel)
{
if (ModelState.IsValid)
{
var anuncio = _mapper.Map<Anuncio>(anuncioModel);
_anuncioService.Alterar(anuncio);
}
return RedirectToAction(nameof(Index));
}
public ActionResult Delete(int id)
{
Anuncio anuncio = _anuncioService.Buscar(id);
AnuncioModel anuncioModel = _mapper.Map<AnuncioModel>(anuncio);
return View(anuncioModel);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Delete(int id, AnuncioModel anuncioModel)
{
_anuncioService.Excluir(id);
return RedirectToAction(nameof(Index));
}
}
}
|
using Infra.Contexts;
using Infra.Seeds;
using Microsoft.EntityFrameworkCore;
namespace Api.Configuration;
public static class Migrations
{
public static void UseMigrations(this WebApplication? app)
{
using (var scope = app.Services.CreateScope())
using (var context = scope.ServiceProvider.GetRequiredService<Context>())
{
if (context.Database.IsRelational() && context.Database.CanConnect())
{
context.Database.OpenConnection();
if (context.Database.GetPendingMigrations().Any())
{
context.Database.Migrate();
context.ApplySeeds();
}
context.Database.CloseConnection();
}
}
}
} |
using HandSchool.Internals;
using HandSchool.JLU.Services;
using HandSchool.Services;
using HandSchool.ViewModels;
using HandSchool.Views;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace HandSchool.JLU.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class InitializePage : ViewObject
{
public InitializePage()
{
InitializeComponent();
}
public override void SetNavigationArguments(object param)
{
base.SetNavigationArguments(param);
var sch = param as ISchoolWrapper;
Core.Configure.Write(Core.ConfigSchool, sch.SchoolId);
Core.App.InjectService(sch);
sch.PreLoad();
sch.PostLoad();
ExecuteLogic();
}
private async void ExecuteLogic()
{
var vpn = WebVpn.UseVpn;
var result2 = false;
if (vpn)
{
await System.Threading.Tasks.Task.Delay(1200);
vpnCheck.Text = "";
vpnProgress.IsRunning = true;
result2 = await LoginViewModel.RequestAsync(Loader.Vpn) == RequestLoginState.Success;
vpnProgress.IsRunning = false;
vpnCheck.Text = result2 ? "√" : "×";
vpnCheck.TextColor = result2 ? Color.DarkGreen : Color.Red;
}
else
{
vpnCheck.Text = "N";
vpnCheck.TextColor = Color.Blue;
}
if (!vpn || result2)
{
await System.Threading.Tasks.Task.Delay(1200);
jwxtCheck.Text = "";
jwxtProgress.IsRunning = true;
var result = await LoginViewModel.RequestAsync(Core.App.Service) == RequestLoginState.Success;
jwxtProgress.IsRunning = false;
jwxtCheck.Text = result ? "√" : "×";
jwxtCheck.TextColor = result ? Color.DarkGreen : Color.Red;
if (result && !((UIMS)Core.App.Service).OutsideSchool)
{
kcbCheck.Text = "";
kcbProgress.IsRunning = true;
await ScheduleViewModel.Instance.Refresh();
kcbProgress.IsRunning = false;
kcbCheck.Text = "√";
kcbCheck.TextColor = Color.DarkGreen;
gradeCheck.Text = "";
gradeProgress.IsRunning = true;
await GradePointViewModel.Instance.ExecuteLoadNewerItemsCommand();
await GradePointViewModel.Instance.ExecuteLoadAllItemsCommand();
gradeProgress.IsRunning = false;
gradeCheck.Text = "√";
gradeCheck.TextColor = Color.DarkGreen;
}
}
await System.Threading.Tasks.Task.Delay(500);
await Navigation.PushAsync<WelcomePage>();
}
}
} |
//
// OpenRemoteServer.cs
//
// Author:
// Félix Velasco <felix.velasco@gmail.com>
//
// Copyright (C) 2009 Félix Velasco
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using Mono.Unix;
using Gtk;
using Banshee.Base;
using Banshee.Gui.Dialogs;
using Banshee.Configuration;
namespace Banshee.Daap
{
public class OpenRemoteServer : BansheeDialog
{
private Entry address_entry;
private SpinButton port_entry;
public OpenRemoteServer () : base (Catalog.GetString ("Open remote DAAP server"), null)
{
VBox.Spacing = 6;
VBox.PackStart (new Label () {
Xalign = 0.0f,
Text = Catalog.GetString ("Enter server IP address and port:")
}, true, true, 0);
HBox box = new HBox ();
box.Spacing = 12;
VBox.PackStart (box, false, false, 0);
address_entry = new Entry ();
address_entry.Activated += OnEntryActivated;
address_entry.WidthChars = 30;
address_entry.Show ();
port_entry = new SpinButton (1d, 65535d, 1d);
port_entry.Value = 3689;
port_entry.Show ();
box.PackStart (address_entry, true, true, 0);
box.PackEnd (port_entry, false, false, 0);
address_entry.HasFocus = true;
VBox.ShowAll ();
AddStockButton (Stock.Cancel, ResponseType.Cancel);
AddStockButton (Stock.Ok, ResponseType.Ok, true);
}
private void OnEntryActivated (object o, EventArgs args)
{
Respond (ResponseType.Ok);
}
public string Address {
get { return address_entry.Text; }
}
public int Port {
get { return port_entry.ValueAsInt; }
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace ACM.Business
{
/// <summary>
/// Product's Entity class
/// </summary>
public class Product : IValidatable, IEquatable<Product>
{
#region Properties
/// <summary>
/// Product's Current Price
/// </summary>
public double? CurrentPrice { get; set; }
/// <summary>
/// Product Id
/// </summary>
public long ProductId { get; set; }
/// <summary>
/// Product Description
/// </summary>
[Required]
[StringLength(int.MaxValue, MinimumLength = 1)]
public string Description { get; set; }
/// <summary>
/// Product Name
/// </summary>
[Required]
[StringLength(int.MaxValue, MinimumLength = 1)]
public string Name { get; set; }
#endregion
#region Interfaces
#region IValidatable
/// <summary>
/// Implementation of IValidatable.Validate()
/// </summary>
/// <exception cref="ValidationException"></exception>
public void Validate()
{
ValidationContext ctx = new ValidationContext(this);
Validator.ValidateObject(this, ctx, true);
}
#endregion
#endregion
#region Overrides
/// <summary>
/// Equals comparison
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public bool Equals(Product other)
{
return GetHashCode() == other.GetHashCode();
}
/// <summary>
/// HashCode Generator
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return HashCode.Combine(CurrentPrice, ProductId, Description, Name);
}
#endregion
}
}
|
using RingoBotNet.Models;
using System.Threading.Tasks;
namespace RingoBotNet.Data
{
public interface IUserData
{
Task<User> CreateUserIfNotExists(ConversationInfo info, string userId = null, string username = null);
Task<User> GetUser(string userId);
Task ResetAuthorization(string userId);
Task SaveStateToken(string userId, string state);
Task SaveUserAccessToken(string userId, BearerAccessToken token);
Task SetTokenValidated(string userId, string state);
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
namespace Anonymous_Downsite
{
class Program
{
static void Main(string[] args)
{
int numberOfSites = int.Parse(Console.ReadLine());
int securityKey = int.Parse(Console.ReadLine());
decimal totaLoss = 0.0M;
BigInteger token = BigInteger.Pow(securityKey, numberOfSites);
List<string> affectedSites = new List<string>();
for (int i = 0; i < numberOfSites; i++)
{
var tokens = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string siteName = tokens[0];
affectedSites.Add(siteName);
long siteVisits = long.Parse(tokens[1]);
decimal sitePrice = decimal.Parse(tokens[2]);
totaLoss += siteVisits * sitePrice;
}
foreach (var item in affectedSites)
{
Console.WriteLine(item);
}
Console.WriteLine($"Total Loss: {totaLoss:F20}");
Console.WriteLine($"Security Token: {token}");
}
}
}
|
using System;
using System.Windows.Forms;
using System.Configuration;
using System.Diagnostics;
using System.Threading;
namespace TestApp {
public partial class MyApp : Form {
public MyApp() {
InitializeComponent();
matrix.ColumnCount = 2;
matrix.RowCount = 2;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
matrix[j, i].Value = 0;
}
}
}
/// <summary>
/// Увеличение размеров матрицы
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void enlargeTheMatrixToolStripMenuItem_Click(object sender, EventArgs e) {
matrix.ColumnCount++;
matrix.RowCount++;
int SIZE = matrix.Columns.Count;
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
if (i == SIZE - 1 || j == SIZE - 1) {
matrix[j, i].Value = 0;
}
}
}
}
/// <summary>
/// Уменьшение размеров матрицы
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void reduseTheMatrixToolStripMenuItem_Click(object sender, EventArgs e) {
if (matrix.ColumnCount == 1 && matrix.RowCount == 1) return;
matrix.ColumnCount--;
matrix.RowCount--;
}
/// <summary>
/// Проверка, чтобы в ячейках не было других символов кроме цифр
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void matrix_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
int i = e.ColumnIndex; int j = e.RowIndex;
if (matrix[i, j].Value == null) return;
int cellInt;
bool isNum = int.TryParse(matrix[i, j].Value.ToString(), out cellInt);
if (!isNum)
matrix[i, j].Value = 0;
}
/// <summary>
/// Выполнение метода Гаусса
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gaussMethodToolStripMenuItem_Click(object sender, EventArgs e) {
GaussMethod.ServiceClient gaussClient = new GaussMethod.ServiceClient();
int SIZE = matrix.Columns.Count;
int inCnt = 0;
bool flag = true;
double[] inData = new double[SIZE * SIZE];
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
inData[inCnt++] = Convert.ToDouble(matrix[j, i].Value);
if (inData[inCnt - 1] != 0) flag = false;
}
}
if (flag) {
//значит матрица нулевая
MessageBox.Show($"Определитель: 0");
return;
}
//ЗАПУСК
double[] outData = gaussClient.StartGauss(inData, SIZE);
int outCnt = 0;
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
matrix[j, i].Value = outData[outCnt++];
}
}
double det = outData[outCnt];
MessageBox.Show($"Определитель: {det}");
gaussClient.Close();
}
private void generateMatrixToolStripMenuItem_Click(object sender, EventArgs e) {
int SIZE = matrix.Columns.Count;
Random rnd = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
matrix[j, i].Value = rnd.Next(-30, 30);
}
}
}
private void testToolStripMenuItem_Click(object sender, EventArgs e) {
MessageBox.Show("Раздел тестируется :)");
//GaussMethod.ServiceClient gaussClient = new GaussMethod.ServiceClient();
//int SIZE = matrix.Columns.Count;
//int inCnt = 0;
//double[] inData = new double[SIZE * SIZE];
//for (int i = 0; i < SIZE; i++) {
// for (int j = 0; j < SIZE; j++) {
// inData[inCnt++] = Convert.ToDouble(matrix[j, i].Value);
// }
//}
//double[] outData = gaussClient.GetObrMatrix(inData, SIZE);
//int outCnt = 0;
//for (int i = 0; i < SIZE - 1; i++) {
// for (int j = 0; j < SIZE - 1; j++) {
// matrix[j, i].Value = outData[outCnt++];
// }
//}
//gaussClient.Close();
}
}
}
|
using CM.WeeklyTeamReport.Domain.Commands;
using CM.WeeklyTeamReport.Domain.Entities.Implementations;
using CM.WeeklyTeamReport.Domain.Entities.Interfaces;
using CM.WeeklyTeamReport.Domain.Repositories.Dto;
using CM.WeeklyTeamReport.Domain.Repositories.Interfaces;
using CM.WeeklyTeamReport.Domain.Repositories.Managers;
using FluentAssertions;
using Moq;
using System;
using System.Collections.Generic;
using Xunit;
namespace CM.WeeklyTeamReport.Domain.Tests
{
public class CompanyManagerTests
{
[Fact]
public void ShouldReadAllCompanies()
{
var fixture = new CompanyManagerFixture();
var company1 = new Company { Name = "Trevor Philips Industries", ID = 1 };
var company2 = new Company { Name = "Aperture Science", ID = 2 };
var readedCompanies = new List<ICompany>() {company1,company2};
var companyDto1 = new CompanyDto { Name = "Trevor Philips Industries", ID = 1 };
var companyDto2 = new CompanyDto { Name = "Aperture Science", ID = 2 };
fixture.CompanyRepository.Setup(x => x.ReadAll()).Returns(readedCompanies);
fixture.CompanyCommands.Setup(x => x.companyToDto(company1)).Returns(companyDto1);
fixture.CompanyCommands.Setup(x => x.companyToDto(company2)).Returns(companyDto2);
var manager = fixture.GetCompanyManager();
var companies = (List <CompanyDto>)manager.readAll();
fixture.CompanyRepository.Verify(x => x.ReadAll(), Times.Once);
fixture.CompanyCommands.Verify(x => x.companyToDto(company1), Times.Once);
fixture.CompanyCommands.Verify(x => x.companyToDto(company2), Times.Once);
companies.Should().HaveCount(2);
companies[0].ID.Should().Be(1);
companies[0].Name.Should().Be("Trevor Philips Industries");
companies[1].ID.Should().Be(2);
companies[1].Name.Should().Be("Aperture Science");
}
[Theory]
[InlineData(1)]
[InlineData(5)]
public void ShouldReadCompanyByID(int id)
{
var fixture = new CompanyManagerFixture();
var companyStub = new Company { Name = "Trevor Philips Industries", ID = id };
var companyDtoStub = new CompanyDto { Name = "Trevor Philips Industries", ID = id };
fixture.CompanyRepository.Setup(x => x.Read(id)).Returns(companyStub);
fixture.CompanyCommands.Setup(x => x.companyToDto(companyStub)).Returns(companyDtoStub);
var manager = fixture.GetCompanyManager();
var company = manager.read(id);
fixture.CompanyRepository.Verify(x => x.Read(id), Times.Once);
fixture.CompanyCommands.Verify(x => x.companyToDto(companyStub), Times.Once);
company.Should().NotBeNull();
company.Should().BeOfType<CompanyDto>();
company.ID.Should().Be(id);
company.Name.Should().Be("Trevor Philips Industries");
}
[Fact]
public void ShouldReturnNull()
{
var fixture = new CompanyManagerFixture();
fixture.CompanyRepository.Setup(x => x.Read(1)).Returns((Company)null);
var manager = fixture.GetCompanyManager();
var company = manager.read(1);
company.Should().BeNull();
}
[Theory]
[InlineData(1)]
[InlineData(5)]
public void ShouldDeleteCompanyByID(int id)
{
var fixture = new CompanyManagerFixture();
var company = new Company { Name = "Trevor Philips Industries", ID = id };
fixture.CompanyRepository.Setup(x => x.Delete(id));
var manager = fixture.GetCompanyManager();
manager.delete(id);
fixture.CompanyRepository.Verify(x => x.Delete(id), Times.Once);
}
[Theory]
[InlineData(1)]
[InlineData(5)]
public void ShouldCreateCompany(int id)
{
var fixture = new CompanyManagerFixture();
var companyDto = new CompanyDto { Name = "Trevor Philips Industries", ID = id };
var company = new Company { Name = "Trevor Philips Industries", ID = id };
var newCompany = new Company { Name = "Trevor Philips Industries", ID = id };
fixture.CompanyCommands.Setup(x => x.dtoToCompany(companyDto)).Returns(company);
fixture.CompanyRepository.Setup(x => x.Create(company)).Returns(newCompany);
var manager = fixture.GetCompanyManager();
var createdCompany = manager.create(companyDto);
fixture.CompanyRepository.Verify(x => x.Create(company), Times.Once);
fixture.CompanyCommands.Verify(x => x.dtoToCompany(companyDto), Times.Once);
createdCompany.ID.Should().Be(companyDto.ID);
createdCompany.Name.Should().Be(companyDto.Name);
}
[Theory]
[InlineData(1)]
[InlineData(5)]
public void ShouldUpdateCompany(int id)
{
var fixture = new CompanyManagerFixture();
var oldCompanyDto = new CompanyDto { Name = "Trevor Philips Industries", ID = id };
var newCompanyDto = new CompanyDto { Name = "Trevor Philips Industries", ID = 0 };
var newCompany = new Company { Name = "Trevor Philips Industries", ID = id };
fixture.CompanyCommands.Setup(x => x.dtoToCompany(newCompanyDto)).Returns(newCompany);
fixture.CompanyRepository.Setup(x => x.Update(newCompany));
var manager = fixture.GetCompanyManager();
manager.update(oldCompanyDto, newCompanyDto);
fixture.CompanyCommands.Verify(x => x.dtoToCompany(newCompanyDto), Times.Once);
fixture.CompanyRepository.Verify(x => x.Update(newCompany), Times.Once);
newCompanyDto.ID.Should().Be(oldCompanyDto.ID);
newCompanyDto.Name.Should().Be("Trevor Philips Industries");
}
public class CompanyManagerFixture
{
public CompanyManagerFixture()
{
CompanyRepository = new Mock<ICompanyRepository>();
CompanyCommands = new Mock<ICompanyCommand>();
}
public Mock<ICompanyRepository> CompanyRepository { get; private set; }
public Mock<ICompanyCommand> CompanyCommands { get; private set; }
public CompanyManager GetCompanyManager()
{
return new CompanyManager(CompanyRepository.Object, CompanyCommands.Object);
}
}
}
}
|
using System;
using AiForms.Effects;
using AiForms.Effects.Droid;
using Android.Graphics;
using Android.Util;
using Android.Views;
using Android.Widget;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportEffect(typeof(SizeToFitPlatformEffect), nameof(SizeToFit))]
namespace AiForms.Effects.Droid
{
[Android.Runtime.Preserve(AllMembers = true)]
public class SizeToFitPlatformEffect : AiEffectBase
{
FormsTextView _view;
float _orgFontSize;
protected override void OnAttachedOverride()
{
_view = Control as FormsTextView;
_orgFontSize = _view.TextSize;
UpdateFitFont();
}
protected override void OnDetachedOverride()
{
if (!IsDisposed){
_view.SetTextSize(ComplexUnitType.Px, _orgFontSize);
System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing");
}
_view = null;
System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely");
}
protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args)
{
base.OnElementPropertyChanged(args);
if (!IsSupportedByApi)
return;
if (args.PropertyName == VisualElement.HeightProperty.PropertyName ||
args.PropertyName == VisualElement.WidthProperty.PropertyName ||
args.PropertyName == Label.TextProperty.PropertyName ||
args.PropertyName == SizeToFit.CanExpandProperty.PropertyName)
{
UpdateFitFont();
}
else if (args.PropertyName == Label.FontProperty.PropertyName)
{
_orgFontSize = _view.TextSize;
UpdateFitFont();
}
//else if (args.PropertyName == Label.VerticalTextAlignmentProperty.PropertyName){
// var label = Element as Label;
// _view.Gravity = label.HorizontalTextAlignment.ToHorizontalGravityFlags() | label.VerticalTextAlignment.ToVerticalGravityFlags();
//}
}
void UpdateFitFont()
{
var formsView = Element as Xamarin.Forms.View;
if (formsView.Width < 0 || formsView.Height < 0)
{
return;
}
var nativeHeight = _view.Context.ToPixels(formsView.Height);
var nativeWidth = _view.Context.ToPixels(formsView.Width);
var height = MeasureTextSize(_view.Text, nativeWidth, _orgFontSize, _view.Typeface);
var fontSize = _orgFontSize;
if (SizeToFit.GetCanExpand(Element) && height < nativeHeight)
{
while (height < nativeHeight)
{
fontSize += 1f;
height = MeasureTextSize(_view.Text, nativeWidth, fontSize, _view.Typeface);
}
}
while (height > nativeHeight && fontSize > 0)
{
fontSize -= 1f;
height = MeasureTextSize(_view.Text, nativeWidth, fontSize, _view.Typeface);
}
_view.SetTextSize(ComplexUnitType.Px, fontSize);
if (!IsFastRenderer)
{
_view.SetHeight(Container.Height);
}
}
public double MeasureTextSize(string text, double width, double fontSize, Typeface typeface = null)
{
var textView = new TextView(_view.Context);
textView.Typeface = typeface ?? Typeface.Default;
textView.SetText(text, TextView.BufferType.Normal);
textView.SetTextSize(ComplexUnitType.Px, (float)fontSize);
int widthMeasureSpec = Android.Views.View.MeasureSpec.MakeMeasureSpec(
(int)width, MeasureSpecMode.AtMost);
int heightMeasureSpec = Android.Views.View.MeasureSpec.MakeMeasureSpec(
0, MeasureSpecMode.Unspecified);
textView.Measure(widthMeasureSpec, heightMeasureSpec);
var height = (double)textView.MeasuredHeight;
textView.Dispose();
return height;
}
}
} |
using Papagei.Client;
using System;
namespace Playground.Client
{
public class ClientControlledEntity : ClientEntity
{
public MyState State => (MyState)StateBase;
public Action Shutdown = () => { };
public Action Frozen = () => { };
public Action Unfrozen = () => { };
private int actionCount = 0;
public override void Reset()
{
base.Reset();
actionCount = 0;
}
public bool Up, Down, Left, Right, Action;
}
}
|
using System;
using System.Threading;
using BeetleX.Redis;
using Microsoft.Extensions.Logging.Abstractions;
using RemoteEntity.Redis;
namespace RemoteEntity.Samples.Producer
{
class Program
{
static void Main(string[] args)
{
var redisDb = new RedisDB();
redisDb.DataFormater = new JsonFormater();
redisDb.Host.AddWriteHost("localhost");
var redisEntityStorage = new RedisEntityStorage(redisDb);
var redisEntityPubSub = new RedisEntityPubSub(redisDb);
var entityHive = new EntityHive(redisEntityStorage, redisEntityPubSub, NullLogger.Instance);
var obj = new SomeValueObject
{
SomeNumber = 456.55m,
SomeText = "Update"
};
for(int i=0; i<50; i++)
{
// Publish 50 messages
obj.SomeText = $"Update no {i}";
Console.WriteLine(obj.SomeText);
entityHive.PublishEntity(obj, "ObjectIdentifier");
Thread.Sleep(1500);
}
}
}
}
|
using System.Threading;
using System.Threading.Tasks;
using ServiceComponents.Api.Mediator;
namespace ServiceComponents.Infrastructure.Dispatchers
{
public interface IDispatchCommand
{
Task DispatchAsync<T>(T command, CancellationToken cancellationToken = default) where T : ICommand;
}
}
|
using UnityEngine;
using System.Collections;
public class CameraReflex : MonoBehaviour {
OLDTVTube _oldtvtube;
// Use this for initialization
void Start () {
/*
_oldtvtube = GetComponent<OLDTVTube>();
string frontCam = WebCamTexture.devices[0].name;
foreach ( WebCamDevice device in WebCamTexture.devices ) {
if ( device.isFrontFacing ) {
frontCam = device.name;
break;
}
}
Debug.Log( "Using " + frontCam + " as webcam" );
WebCamTexture webcamTexture = new WebCamTexture( frontCam );
// You can use any kind of texture as reflex, as your webcam or a render to texture
_oldtvtube.reflex = webcamTexture;
webcamTexture.Play();
*/
}
}
|
using NUnit.Framework;
using System;
using UnityEngine.XR.ARSubsystems;
namespace UnityEditor.XR.ARSubsystems.Tests
{
[TestFixture]
class ARSubsystemEditorTests
{
[MenuItem("AR Foundation/Image Libraries/Clear data stores")]
static void ClearReferenceImageLibraryDataStores()
{
foreach (var library in XRReferenceImageLibrary.All())
{
library.ClearDataStore();
}
}
[Test]
public void CanRoundtripGuid()
{
var guid = Guid.NewGuid();
guid.Decompose(out var low, out var high);
var recomposedGuid = GuidUtil.Compose(low, high);
Assert.AreEqual(guid, recomposedGuid);
}
}
}
|
using CaixaEletronico.Dominio.Entidade;
using System;
using System.Collections.Generic;
using System.Text;
namespace CaixaEletronico.Repositorio
{
public class CaixaRepositorio
{
/// <summary>
/// Lista com a movimentação.
/// </summary>
private List<Caixa> ListaCaixa = new List<Caixa>();
public List<Caixa> Processar(Caixa caixa)
{
ListaCaixa.Add(caixa);
return ListaCaixa;
}
}
}
|
//
// HttpListenerManagerTable.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2010 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Security;
using System.Text;
using System.Threading;
namespace System.ServiceModel.Channels.Http
{
// instantiated per service host
internal class HttpListenerManagerTable
{
// static members
static readonly List<HttpListenerManagerTable> instances = new List<HttpListenerManagerTable> ();
public static HttpListenerManagerTable GetOrCreate (object serviceHostKey)
{
var m = instances.FirstOrDefault (p => p.ServiceHostKey == serviceHostKey);
if (m == null) {
m = new HttpListenerManagerTable (serviceHostKey);
instances.Add (m);
}
return m;
}
// instance members
HttpListenerManagerTable (object serviceHostKey)
{
ServiceHostKey = serviceHostKey ?? new object ();
listeners = new Dictionary<Uri, HttpListenerManager> ();
}
Dictionary<Uri,HttpListenerManager> listeners;
public object ServiceHostKey { get; private set; }
public HttpListenerManager GetOrCreateManager (Uri uri, HttpTransportBindingElement element)
{
var m = listeners.FirstOrDefault (p => p.Key.Equals (uri)).Value;
if (m == null) {
// Two special cases
string absolutePath = uri.AbsolutePath;
if (absolutePath.EndsWith ("/js", StringComparison.Ordinal) ||
absolutePath.EndsWith ("/jsdebug", StringComparison.Ordinal))
return CreateListenerManager (uri, element);
// Try without the query, if any
UriBuilder ub = null;
if (!String.IsNullOrEmpty (uri.Query)) {
ub = new UriBuilder (uri);
ub.Query = null;
m = listeners.FirstOrDefault (p => p.Key.Equals (ub.Uri)).Value;
if (m != null)
return m;
}
// Chop off the part following the last / in the absolut path part
// of the Uri - this is the operation being called in, the remaining
// left-hand side of the absolute path should be the service
// endpoint address
if (ub == null) {
ub = new UriBuilder (uri);
ub.Query = null;
}
int lastSlash = absolutePath.LastIndexOf ('/');
if (lastSlash != -1) {
ub.Path = absolutePath.Substring (0, lastSlash);
m = listeners.FirstOrDefault (p => p.Key.Equals (ub.Uri)).Value;
if (m != null)
return m;
}
}
if (m == null)
return CreateListenerManager (uri, element);
return m;
}
HttpListenerManager CreateListenerManager (Uri uri, HttpTransportBindingElement element)
{
HttpListenerManager m;
if (ServiceHostingEnvironment.InAspNet)
m = new AspNetHttpListenerManager (uri);
else
m = new HttpStandaloneListenerManager (uri, element);
listeners [uri] = m;
return m;
}
}
}
|
using System;
using System.Collections.Generic;
using MonoTouch.Foundation;
namespace Eto.Platform.iOS.Forms
{
public class iosObject<T, W> : WidgetHandler<T, W>
where T: NSObject
where W: Widget
{
List<NSObject> notifications;
List<ControlObserver> observers;
class ControlObserver : NSObject
{
public Action Action { get; set; }
public NSString KeyPath { get; set; }
[Export("observeValueForKeyPath:ofObject:change:context:")]
public void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
{
Action();
}
}
protected void AddObserver(NSString key, Action<NSNotification> notification)
{
if (notifications == null) notifications = new List<NSObject>();
notifications.Add(NSNotificationCenter.DefaultCenter.AddObserver(key, notification, Control));
}
protected void AddObserver(NSObject obj, NSString key, Action<NSNotification> notification)
{
if (notifications == null) notifications = new List<NSObject>();
notifications.Add(NSNotificationCenter.DefaultCenter.AddObserver(key, notification, obj));
}
protected void AddControlObserver(NSString key, Action action)
{
if (observers == null) observers = new List<ControlObserver>();
var observer = new ControlObserver{ Action = action, KeyPath = key };
observers.Add (observer);
Control.AddObserver(observer, key, NSKeyValueObservingOptions.New, IntPtr.Zero);
}
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
if (observers != null) {
foreach (var observer in observers)
Control.RemoveObserver(observer, observer.KeyPath);
}
// dispose in finalizer as well
if (notifications != null) {
NSNotificationCenter.DefaultCenter.RemoveObservers(notifications);
notifications = null;
}
}
}
}
|
using System;
using System.Globalization;
using Avalonia.Data.Converters;
using SysMonAvalonia.Localization;
namespace SysMonAvalonia.Converters
{
class DataValueConverter : IValueConverter
{
public static DataValueConverter Instance = new DataValueConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string param = (string)parameter;
if (param.Contains("temp"))
{
if (value is sbyte)
{
sbyte temp = (sbyte)value;
if (temp == -100) return "--";
if (temp >= 0) return $"+{temp}°";
else return $"{temp}°";
}
}
if (param.Contains("percent")) return $"{value}%";
if (param.Contains("pressure")) return $"{value} {Language.Locale.Pressure}";
if (param.Contains("uvindex")) return $"{GetNameUVIndex((byte)value)} ({value})";
return null;
}
private string GetNameUVIndex(byte index)
{
if (index < 3) return Language.Locale.UVIndexLow;
else if (index > 2 && index < 6) return Language.Locale.UVIndexMedium;
else if (index > 5 && index < 8) return Language.Locale.UVIndexHigh;
else if (index > 7 && index < 11) return Language.Locale.UVIndexVeryHigh;
else return Language.Locale.UVIndexExtrem;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
|
// Copyright (C) The original author or authors
//
// This software may be modified and distributed under the terms
// of the zlib license. See the LICENSE file for details.
using System.Diagnostics;
namespace ScatteredLogic.Internal.DataStructures
{
internal sealed class RingBuffer<T>
{
private readonly T[] data;
private int front;
private int rear;
private int count;
public RingBuffer(int size)
{
Debug.Assert(size > 0);
data = new T[size];
}
public int Count => count;
public void Enqueue(T element)
{
Debug.Assert(Count < data.Length);
data[rear++] = element;
++count;
if (rear == data.Length) rear = 0;
}
public T Dequeue()
{
Debug.Assert(Count > 0);
T element = data[front];
data[front++] = default(T);
--count;
if (front == data.Length) front = 0;
return element;
}
}
}
|
using System.Threading.Tasks;
namespace GodelTech.Database.EntityFrameworkCore
{
/// <summary>
/// Interface of data service.
/// </summary>
public interface IDataService
{
/// <summary>
/// Apply data.
/// </summary>
Task ApplyDataAsync();
}
}
|
using System;
using AosComMeasurer;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AosComMeasurerTest
{
[TestClass]
public class MsgParserTest
{
//[TestMethod]
public void MsgParserTestMethod()
{
BoardState boardState = new BoardState();
MeasurerState measurerState = new MeasurerState();
//ComMsgParser parser = new ComMsgParser(boardState, measurerState);
string str1 = "m0 p0 s0 d35 b0 v0 i0000000000000000 ok";
//parser.Parse(str1);
}
}
}
|
using Sync.Client;
using Sync.Plugins;
using Sync.Tools.ConfigurationAttribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sync.Tools.ConfigurationAttribute
{
class ClientListAttribute : ListAttribute
{
public override string[] ValueList => ClientManager.Instance.Clients.Select(c=>c.ClientName).ToArray();
}
class SourceListAttribute : ListAttribute
{
public override string[] ValueList => SyncHost.Instance.Sources.SourceList.Select(s => s.Name).ToArray();
}
}
|
namespace DiscountAPI.Application.Model.Response
{
public class TotalDiscountResponse
{
public decimal TotalAmount { get; set; }
public decimal DiscountedTotalAmount { get; set; }
}
} |
using Microsoft.IdentityModel.Tokens;
using System.Text;
namespace Auth0.AuthenticationApi.Tokens
{
internal class SymmetricSignedDecoder : SignedDecoder
{
public SymmetricSignedDecoder(string clientSecret)
: base(JwtSignatureAlgorithm.HS256, new [] { new SymmetricSecurityKey(Encoding.ASCII.GetBytes(clientSecret)) })
{
}
}
}
|
using System;
namespace Ductus.FluentDocker.Model.Builders.FileBuilder
{
public sealed class EntrypointCommand : ICommand
{
public EntrypointCommand(string executable, params string[] args)
{
Executable = executable;
Arguments = args ?? Array.Empty<string>();
}
public string Executable { get; }
public string[] Arguments { get; }
public override string ToString()
{
if (Arguments.Length == 0) {
return $"ENTRYPOINT [\"{Executable}\"]";
}
return $"ENTRYPOINT [\"{Executable}\",\"{string.Join("\",\"", Arguments)}\"]";
}
}
}
|
using System;
using System.Runtime.InteropServices;
using Stream = System.IO.Stream;
using BinaryReader = System.IO.BinaryReader;
using IOException = System.IO.IOException;
namespace antlr
{
/*ANTLR Translator Generator
* Project led by Terence Parr at http://www.jGuru.com
* Software rights: http://www.antlr.org/license.html
*
* $Id:$
*/
//
// ANTLR C# Code Generator by Micheal Jordan
// Kunle Odutola : kunle UNDERSCORE odutola AT hotmail DOT com
// Anthony Oguntimehin
//
// With many thanks to Eric V. Smith from the ANTLR list.
//
/*A Stream of characters fed to the lexer from a InputStream that can
* be rewound via mark()/rewind() methods.
* <p>
* A dynamic array is used to buffer up all the input characters. Normally,
* "k" characters are stored in the buffer. More characters may be stored during
* guess mode (testing syntactic predicate), or when LT(i>k) is referenced.
* Consumption of characters is deferred. In other words, reading the next
* character is not done by conume(), but deferred until needed by LA or LT.
* <p>
*/
// SAS: added this class to handle Binary input w/ FileInputStream
public class ByteBuffer:InputBuffer
{
// char source
[NonSerialized()]
internal Stream input;
private const int BUF_SIZE = 16;
/// <summary>
/// Small buffer used to avoid reading individual chars
/// </summary>
private byte[] buf = new byte[BUF_SIZE];
/*Create a character buffer */
public ByteBuffer(Stream input_) : base()
{
input = input_;
}
/*Ensure that the character buffer is sufficiently full */
override public void fill(int amount)
{
// try
// {
syncConsume();
// Fill the buffer sufficiently to hold needed characters
int bytesToRead = (amount + markerOffset) - queue.Count;
int c;
while (bytesToRead > 0)
{
// Read a few characters
c = input.Read(buf, 0, BUF_SIZE);
for (int i = 0; i < c; i++)
{
// Append the next character
queue.Add(unchecked((char) buf[i]));
}
if (c < BUF_SIZE)
{
queue.Add(CharScanner.EOF_CHAR);
break;
}
bytesToRead -= c;
}
// }
// catch (IOException io)
// {
// throw new CharStreamIOException(io);
// }
}
}
} |
using Microsoft.Practices.ServiceLocation;
using StructureMap;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MvcApp.Tests.StructureMapRegistry
{
public class StructureMapDependencyScope : ServiceLocatorImplBase
{
#region Constants and Fields
private const string NestedContainerKey = "Nested.Container.Key";
#endregion
#region Constructors and Destructors
public StructureMapDependencyScope(IContainer container)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
Container = container;
}
#endregion
#region Public Properties
public IContainer Container { get; set; }
private Dictionary<string, IContainer> _items;
public IContainer CurrentNestedContainer
{
get
{
try
{
return (IContainer)Items[NestedContainerKey];
}
catch
{
return null;
}
}
set
{
Items[NestedContainerKey] = value;
}
}
#endregion
#region Properties
private Dictionary<string, IContainer> Items
{
get
{
return _items ?? new Dictionary<string, IContainer>();
}
}
#endregion
#region Public Methods and Operators
public void CreateNestedContainer()
{
if (CurrentNestedContainer != null)
{
return;
}
CurrentNestedContainer = Container.GetNestedContainer();
}
public void Dispose()
{
DisposeNestedContainer();
Container.Dispose();
}
public void DisposeNestedContainer()
{
if (CurrentNestedContainer != null)
{
CurrentNestedContainer.Dispose();
CurrentNestedContainer = null;
}
}
public IEnumerable<object> GetServices(Type serviceType)
{
return DoGetAllInstances(serviceType);
}
#endregion
#region Methods
protected override IEnumerable<object> DoGetAllInstances(Type serviceType)
{
return (CurrentNestedContainer ?? Container).GetAllInstances(serviceType).Cast<object>();
}
protected override object DoGetInstance(Type serviceType, string key)
{
IContainer container = (CurrentNestedContainer ?? Container);
if (string.IsNullOrEmpty(key))
{
return serviceType.IsAbstract || serviceType.IsInterface
? container.TryGetInstance(serviceType)
: container.GetInstance(serviceType);
}
return container.GetInstance(serviceType, key);
}
#endregion
}
}
|
namespace EnvironmentAssessment.Common.VimApi
{
public class ClusterConfigInfoEx : ComputeResourceConfigInfo
{
protected ClusterDasConfigInfo _dasConfig;
protected ClusterDasVmConfigInfo[] _dasVmConfig;
protected ClusterDrsConfigInfo _drsConfig;
protected ClusterDrsVmConfigInfo[] _drsVmConfig;
protected ClusterRuleInfo[] _rule;
protected ClusterOrchestrationInfo _orchestration;
protected ClusterVmOrchestrationInfo[] _vmOrchestration;
protected ClusterDpmConfigInfo _dpmConfigInfo;
protected ClusterDpmHostConfigInfo[] _dpmHostConfig;
protected VsanClusterConfigInfo _vsanConfigInfo;
protected VsanHostConfigInfo[] _vsanHostConfig;
protected ClusterGroupInfo[] _group;
protected ClusterInfraUpdateHaConfigInfo _infraUpdateHaConfig;
protected ClusterProactiveDrsConfigInfo _proactiveDrsConfig;
public ClusterDasConfigInfo DasConfig
{
get
{
return this._dasConfig;
}
set
{
this._dasConfig = value;
}
}
public ClusterDasVmConfigInfo[] DasVmConfig
{
get
{
return this._dasVmConfig;
}
set
{
this._dasVmConfig = value;
}
}
public ClusterDrsConfigInfo DrsConfig
{
get
{
return this._drsConfig;
}
set
{
this._drsConfig = value;
}
}
public ClusterDrsVmConfigInfo[] DrsVmConfig
{
get
{
return this._drsVmConfig;
}
set
{
this._drsVmConfig = value;
}
}
public ClusterRuleInfo[] Rule
{
get
{
return this._rule;
}
set
{
this._rule = value;
}
}
public ClusterOrchestrationInfo Orchestration
{
get
{
return this._orchestration;
}
set
{
this._orchestration = value;
}
}
public ClusterVmOrchestrationInfo[] VmOrchestration
{
get
{
return this._vmOrchestration;
}
set
{
this._vmOrchestration = value;
}
}
public ClusterDpmConfigInfo DpmConfigInfo
{
get
{
return this._dpmConfigInfo;
}
set
{
this._dpmConfigInfo = value;
}
}
public ClusterDpmHostConfigInfo[] DpmHostConfig
{
get
{
return this._dpmHostConfig;
}
set
{
this._dpmHostConfig = value;
}
}
public VsanClusterConfigInfo VsanConfigInfo
{
get
{
return this._vsanConfigInfo;
}
set
{
this._vsanConfigInfo = value;
}
}
public VsanHostConfigInfo[] VsanHostConfig
{
get
{
return this._vsanHostConfig;
}
set
{
this._vsanHostConfig = value;
}
}
public ClusterGroupInfo[] Group
{
get
{
return this._group;
}
set
{
this._group = value;
}
}
public ClusterInfraUpdateHaConfigInfo InfraUpdateHaConfig
{
get
{
return this._infraUpdateHaConfig;
}
set
{
this._infraUpdateHaConfig = value;
}
}
public ClusterProactiveDrsConfigInfo ProactiveDrsConfig
{
get
{
return this._proactiveDrsConfig;
}
set
{
this._proactiveDrsConfig = value;
}
}
}
}
|
using System.Collections;
using TowerDungeon.UI;
using UnityEngine;
namespace TowerDungeon.Character
{
public class ForcePowerUp : MonoBehaviour
{
public SpriteRenderer player_sprite;
public PlayerLife playerLife_script;
public int savePreviousPower;
public PlayerControl playerControl;
int powered;
public bool powerUpActivated = false;
public PowerUpUI powerUpUI_script;
void Start()
{
playerLife_script = GetComponent<PlayerLife>();
playerControl = GetComponent<PlayerControl>();
savePreviousPower = playerControl.CurrentPower;
powered = 5;
player_sprite = GetComponent<SpriteRenderer>();
powerUpUI_script.ActiveFeedbackPowerUp(powerUpUI_script.ImageForce, powerUpActivated);
}
void Update()
{
if (powerUpActivated)
{
player_sprite.color = Color.Lerp(Color.blue, Color.white, Mathf.PingPong(2 * Time.time, .5f));
powerUpUI_script.ActiveFeedbackPowerUp(powerUpUI_script.ImageForce, powerUpActivated);
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("force"))
{
StartCoroutine(nameof(growPower));
}
}
IEnumerator growPower()
{
powerUpActivated = true;
//playerControl.CurrentPower = powered;
Debug.Log(playerControl.CurrentPower);
yield return new WaitForSeconds(10f);
powerUpActivated = false;
player_sprite.color = Color.white;
//playerControl.CurrentPower = savePreviousPower;
Debug.Log("Power atual: " + playerControl.CurrentPower);
powerUpUI_script.ActiveFeedbackPowerUp(powerUpUI_script.ImageForce, powerUpActivated);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// The HUD for the game
/// </summary>
public class HUD : MonoBehaviour
{
#region Fields
// score support
[SerializeField]
Text scoreText;
int score = 0;
const string ScorePrefix = "Score: ";
#endregion
/// <summary>
/// Use this for initialization
/// </summary>
void Start()
{
// add listener for PointsAddedEvent
EventManager.AddListener(HandlePointsAddedEvent);
// initialize score text
scoreText.text = ScorePrefix + score;
}
#region Private methods
/// <summary>
/// Handles the points added event by updating the displayed score
/// </summary>
/// <param name="points">points to add</param>
void HandlePointsAddedEvent(int points)
{
score += points;
scoreText.text = ScorePrefix + score;
}
#endregion
}
|
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace AspNetCorePlayground.Filters
{
public class MyActionFilter : IActionFilter
{
public void OnActionExecuting(ActionExecutingContext context)
{
context.Result = new BadRequestObjectResult(new {Error = "JWT Token is expired."});
}
public void OnActionExecuted(ActionExecutedContext context)
{
System.Console.WriteLine("Bar");
}
}
} |
using Database.Core.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Database.Core.Configuration
{
public class AccountHistoryConfiguration : IEntityTypeConfiguration<AccountHistory>
{
public void Configure(EntityTypeBuilder<AccountHistory> builder)
{
builder.HasOne(ah => ah.User)
.WithMany(user => user.AccountHistories)
.HasForeignKey(ah => ah.UserId);
}
}
}
|
using log4net;
namespace UberStrok.Realtime.Server.Game
{
public class PlayingPeerState : PeerState
{
public double _timer;
public PlayingPeerState(GamePeer peer) : base(peer)
{
// Space
}
public override void OnEnter()
{
/*
MatchStart event changes the match state of the client to match running,
which in turn changes the player state to playing.
The client does not care about the roundNumber apparently (in TeamDeathMatch atleast).
*/
Peer.Events.Game.SendMatchStart(Room.RoundNumber, Room.EndTime);
/*
This is to reset the top scoreboard to not display "STARTS IN".
*/
Peer.Events.Game.SendUpdateRoundScore(Room.RoundNumber, 0, 0);
}
public override void OnResume()
{
_timer = 0;
}
public override void OnExit()
{
// Space
}
public override void OnUpdate()
{
double dt = Peer.Room.Loop.DeltaTime.TotalMilliseconds;
if (Peer.Actor.Info.Health > 100 || Peer.Actor.Info.ArmorPoints > Peer.Actor.Info.ArmorPointCapacity)
_timer += dt;
else
_timer = 0;
if (_timer > 1000)
{
if (Peer.Actor.Info.Health > 100)
Peer.Actor.Info.Health -= 1;
if (Peer.Actor.Info.ArmorPoints > Peer.Actor.Info.ArmorPointCapacity)
Peer.Actor.Info.ArmorPoints -= 1;
_timer -= 1000;
}
}
}
}
|
namespace GeometricThings.Geometry
{
using GeometricThings.Interface;
/// <summary>
/// Defines the <see cref="GeometricCalculator" />.
/// </summary>
public class GeometricCalculator
{
/// <summary>
/// Returns area of an object if the object is not null, else returns 0
/// </summary>
/// <param name="thing">The thing<see cref="IGeometricThing"/>.</param>
/// <returns>The <see cref="float"/>.</returns>
public float GetArea(IGeometricThing thing)
{
return thing != null ? thing.GetArea() : 0;
}
/// <summary>
/// Returns perimeter of an object if the object is not null, else returns 0
/// </summary>
/// <param name="thing">The thing<see cref="IGeometricThing"/>.</param>
/// <returns>The <see cref="float"/>.</returns>
public float GetPerimeter(IGeometricThing thing)
{
return thing != null ? thing.GetPerimeter() : 0;
}
/// <summary>
/// Returns the sum of perimetes of objects in an array
/// </summary>
/// <param name="things">The things<see cref="IGeometricThing []"/>.</param>
/// <returns>The <see cref="float"/>.</returns>
public float GetPerimeter(IGeometricThing[] things)
{
float sam = 0;
foreach (var item in things)
{
sam += GetPerimeter(item);
}
return sam;
}
}
}
|
using System;
using System.Collections.Concurrent;
namespace LiteDB.Realtime.Subscriptions
{
using Subscriptions = ConcurrentDictionary<ISubscription, byte>;
internal class Unsubscriber : IDisposable
{
private readonly Subscriptions _subscriptions;
private readonly ISubscription _subscription;
private bool _isDisposed = false;
internal Unsubscriber(Subscriptions subscriptions, ISubscription subscription)
{
_subscriptions = subscriptions;
_subscription = subscription;
}
public void Dispose()
{
if (_isDisposed) return;
if (_subscriptions.ContainsKey(_subscription))
{
_subscriptions.TryRemove(_subscription, out _);
}
_isDisposed = true;
GC.SuppressFinalize(this);
}
~Unsubscriber()
{
Dispose();
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Threading;
/*
* Unity supports multithreading, but "Unity's types" can only be accessed or modified
* inside the main thread. Child threads should operate on primitive or custom types and
* then their results should be passed back to the main thread.
* This class helps in the synchronization and distributes the background
* operations among a pool of threads;
*/
public class ThreadPoolExecutor : MonoBehaviour
{
// the number of threads that runs in this pool
public int NumberOfThreads = 2;
// reference to the threads
private Thread[] threads;
// set to false to stop receiving actions and to end the threads in the pool
private bool keepThreadExecuting;
// A queue for the actions that should be executed in the main thread (at the
// end of some computation performed in the child thread). An action is any
// function with no parameters and no return.
private Queue<Action> actionsToRunInMainThread;
// A queue for the actions that should be executed in a child thread.
private Queue<Action> actionsToRunInBackground;
// Adds an action to the background queue if the pool is still active and returns true;
// it returns false otherwise (if the pool is not active anymore).
public bool AddBackgroundAction(Action action){
if(keepThreadExecuting){
lock(actionsToRunInBackground){
actionsToRunInBackground.Enqueue(action);
}
return true;
}
return false;
}
// Adds an action to the main thread queue.
// This can be called inside a child thread to apply some
// modifications to some unity types, after some calculations.
public void AddMainThreadAction(Action action){
lock(actionsToRunInMainThread){
actionsToRunInMainThread.Enqueue(action);
}
}
public void StopReceiving(){
keepThreadExecuting = false;
}
// Start is called before the first frame update
void Start()
{
// initialize the queues
actionsToRunInBackground = new Queue<Action>();
actionsToRunInMainThread = new Queue<Action>();
keepThreadExecuting = true;
// initialize the threads
threads = new Thread[NumberOfThreads];
for(int i=0;i<NumberOfThreads;i++){
threads[i] = new Thread(new ThreadStart(runningThread));
threads[i].Start();
}
}
// Stop receiving actions on pool's destroy
void OnDestroy(){
StopReceiving();
for(int i=0;i<NumberOfThreads;i++){
threads[i].Abort();
}
}
// Executes all the last actions in actionsToRunInMainThread
void Update()
{
int actionsToExecute = 0;
lock(actionsToRunInMainThread){
actionsToExecute = actionsToRunInMainThread.Count;
}
while(actionsToExecute>0){
Action nextAction;
lock(actionsToRunInMainThread){
nextAction = actionsToRunInMainThread.Dequeue();
actionsToExecute = actionsToRunInMainThread.Count;
}
nextAction();
}
}
// This function is executed in each thread and should execute
// the actions in actionsToRunInBackground.
// If there is no action to perform, the threads stay in busy wait.
void runningThread(){
while(keepThreadExecuting){
Action nextAction = ()=>{};// check for actions..
bool found = false;
lock(actionsToRunInBackground){
if(actionsToRunInBackground.Count>0){
found = true;
nextAction = actionsToRunInBackground.Dequeue();
}
}
if(found){
nextAction(); // execute the action in the current thread
}else{
Thread.Sleep(1);
}
}
}
}
|
#nullable disable
namespace Amazon.Kms
{
public sealed class Grant
{
public string GrantId { get; set; }
public GrantConstraints Constraints { get; set; }
public string GranteePrincipal { get; set; }
public string IssuingAccount { get; set; }
public string Name { get; set; }
public string[] Operations { get; set; }
public string RetiringPrincipal { get; set; }
// UnixTime seconds
public double CreationDate { get; set; }
}
}
/*
{
"Constraints": {
"EncryptionContextEquals": {
"string" : "string"
},
"EncryptionContextSubset": {
"string" : "string"
}
},
"CreationDate": number,
"GranteePrincipal": "string",
"GrantId": "string",
"IssuingAccount": "string",
"KeyId": "string",
"Name": "string",
"Operations": [ "string" ],
"RetiringPrincipal": "string"
}
*/
|
// SPDX-FileCopyrightText: © 2022 MONAI Consortium
// SPDX-License-Identifier: Apache License 2.0
using Monai.Deploy.Messaging.Events;
namespace Monai.Deploy.WorkflowManager.TaskManager.API
{
public class ExecutionStatus
{
/// <summary>
/// Gets or sets the status of the execution.
/// </summary>
public TaskExecutionStatus Status { get; set; } = TaskExecutionStatus.Unknown;
/// <summary>
/// Gets or sets the reason of a failure.
/// </summary>
public FailureReason FailureReason { get; set; } = FailureReason.None;
/// <summary>
/// Gets or sets any errors of the execution.
/// </summary>
public string Errors { get; set; } = string.Empty;
}
}
|
using System.Collections.Generic;
using System.Text;
using Sourcelyzer.Model;
namespace Sourcelyzer.Analyzing.Nuget.Config
{
public class InvalidNuGetConfigLocation : NuGetAnalyzerResult
{
internal InvalidNuGetConfigLocation(IRepository repository, string nugetConfigPath, string solutionFilePath) :
base(repository)
{
NuGetConfigPath = nugetConfigPath;
SolutionFilePath = solutionFilePath;
}
public override string Title => "Invalid location of NuGet.config";
public override string ShortTitle => Title;
public override IDictionary<string, string> TechnicalInfo => new Dictionary<string, string>();
private string NuGetConfigPath { get; }
private string SolutionFilePath { get; }
public override string ToMarkdown()
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine(
"The repository has `NuGet.config` in the wrong location. It must be located beside solution file.");
stringBuilder.AppendLine();
stringBuilder.AppendLine($"Expected: `{SolutionFilePath}`");
stringBuilder.AppendLine($"Actual: `{NuGetConfigPath}`");
return stringBuilder.ToString();
}
}
}
|
using System.Threading.Tasks;
using OpenInvoicePeru.Servicio.ApiSunatDto;
namespace OpenInvoicePeru.Servicio
{
public interface IValidezComprobanteHelper
{
Task<BaseResponseDto<TokenResponseDto>> GenerarToken(string clientId, string clientSecret);
Task<ValidacionResponse> Validar(string rucReceptor, string token, ValidacionRequest request);
}
} |
// DigitalRune Engine - Copyright (C) DigitalRune GmbH
// This file is subject to the terms and conditions defined in
// file 'LICENSE.TXT', which is part of this source code package.
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#if PORTABLE || WINDOWS_UWP
#pragma warning disable 1574 // Disable warning "XML comment has cref attribute that could not be resolved."
#endif
namespace DigitalRune.Graphics.Effects
{
/// <summary>
/// Defines the standard semantics for default effect parameters.
/// </summary>
/// <remarks>
/// <para>
/// The standard semantic define the meaning of effect parameters. See
/// <see cref="EffectParameterDescription"/>.
/// </para>
/// <para>
/// <strong>Important:</strong> General semantics specified in an .fx files are case-insensitive.
/// Therefore, use the <see cref="StringComparer.InvariantCultureIgnoreCase"/> string comparer
/// for parsing .fx files. But when accessed from code (C# or VB.NET) the strings are
/// case-sensitive! That means the standard semantics stored in
/// <see cref="EffectParameterDescription"/> can be compared directly.
/// </para>
/// </remarks>
public static class DefaultEffectParameterSemantics
{
#region ----- Animation -----
/// <summary>
/// The weight of a morph target (<see cref="float"/> or an array of <see cref="float"/>).
/// </summary>
public const string MorphWeight = "MorphWeight";
/// <summary>
/// The skinning matrices for mesh skinning (array of <see cref="Matrix"/>).
/// </summary>
public const string Bones = "Bones";
#endregion
#region ----- Material -----
/// <summary>
/// The diffuse material color as RGB (<see cref="Vector3"/>) or RGBA (<see cref="Vector4"/>).
/// </summary>
public const string DiffuseColor = "DiffuseColor";
/// <summary>
/// The albedo texture (<see cref="Texture2D"/>).
/// </summary>
public const string DiffuseTexture = "DiffuseTexture";
/// <summary>
/// The specular material color as RGB (<see cref="Vector3"/>) or RGBA (<see cref="Vector4"/>).
/// </summary>
public const string SpecularColor = "SpecularColor";
/// <summary>
/// The gloss texture (<see cref="Texture2D"/>) containing the specular intensity (not specular
/// power).
/// </summary>
public const string SpecularTexture = "SpecularTexture";
/// <summary>
/// The material specular color exponent as a single value (<see cref="float"/>) or a
/// per-component value (<see cref="Vector3"/>).
/// </summary>
public const string SpecularPower = "SpecularPower";
/// <summary>
/// The emissive material color as RGB (<see cref="Vector3"/>) or RGBA (<see cref="Vector4"/>).
/// </summary>
public const string EmissiveColor = "EmissiveColor";
/// <summary>
/// The emissive texture (<see cref="Texture2D"/>).
/// </summary>
public const string EmissiveTexture = "EmissiveTexture";
/// <summary>
/// The opacity (alpha) as a single value (<see cref="float"/>).
/// </summary>
public const string Opacity = "Opacity";
/// <summary>
/// The opacity (alpha) as a single value (<see cref="float"/>).
/// </summary>
public const string Alpha = "Alpha";
/// <summary>
/// The blend mode (<see cref="float"/>): 0 = additive blending, 1 = normal alpha blending
/// </summary>
public const string BlendMode = "BlendMode";
/// <summary>
/// The reference value (<see cref="float"/>) used for alpha testing.
/// </summary>
public const string ReferenceAlpha = "ReferenceAlpha";
///// <summary>
///// The opacity texture (<see cref="Texture2D"/>).
///// </summary>
//public const string OpacityTexture = "OpacityTexture";
/// <summary>
/// The surface normal texture (<see cref="Texture2D"/>).
/// </summary>
public const string NormalTexture = "NormalTexture";
///// <summary>
///// The height value of a bump map (<see cref="float"/>).
///// </summary>
//public const string Height = "Height";
///// <summary>
///// The height texture (<see cref="Texture2D"/>).
///// </summary>
//public const string HeightTexture = "HeightTexture";
/// <summary>
/// The power of the Fresnel term (<see cref="float"/>).
/// </summary>
public const string FresnelPower = "FresnelPower";
///// <summary>
///// The refraction value that gives the coefficients to determine the normal for an environment
///// map lookup. Given as a single value (<see cref="float"/>), a per-component value
///// (<see cref="Vector4"/>), or a texture (<see cref="Texture2D"/>).
///// </summary>
//public const string Refraction = "Refraction";
///// <summary>
///// The texture coordinate transform matrix (<see cref="Matrix"/>).
///// </summary>
//public const string TextureMatrix = "TextureMatrix";
/// <summary>
/// The instance color as RGB (<see cref="Vector3"/>).
/// </summary>
public const string InstanceColor = "InstanceColor";
/// <summary>
/// The instance opacity (alpha) as a single value (<see cref="float"/>).
/// </summary>
public const string InstanceAlpha = "InstanceAlpha";
#endregion
#region ----- Render Properties -----
/// <summary>
/// The zero-based index of the current effect pass (<see cref="int"/>).
/// </summary>
public const string PassIndex = "PassIndex";
/// <summary>
/// The source texture which is usually the last backbuffer or the result of a previous
/// post-processor (<see cref="Texture2D"/>).
/// </summary>
public const string SourceTexture = "SourceTexture";
// RenderTargetSize was removed because:
// - It does not work with cube map render targets. (context.RenderTarget is currentlyRenderTarget2D.
// - ViewportSize should be used instead. Having two similar semantics is confusing.
// - It does not work if we forget to set context.RenderTarget.
///// <summary>
///// The render target width and height in pixels (<see cref="Vector2"/>).
///// </summary>
//public const string RenderTargetSize = "RenderTargetSize";
/// <summary>
/// The viewport width and height in pixels (<see cref="Vector2"/>).
/// </summary>
public const string ViewportSize = "ViewportSize";
#endregion
#region ----- Simulation -----
/// <summary>
/// The <see cref="RenderContext.Time">simulation time</see> in seconds (<see cref="float"/>).
/// </summary>
public const string Time = "Time";
/// <summary>
/// The <see cref="RenderContext.Time">simulation time</see> of the previous frame in seconds
/// (<see cref="float"/>).
/// </summary>
public const string LastTime = "LastTime";
/// <summary>
/// The time since the previous frame in seconds (<see cref="float"/>).
/// </summary>
public const string ElapsedTime = "ElapsedTime";
#endregion
#region ----- Deferred Rendering -----
/// <summary>
/// The G-buffer texture (<see cref="Texture"/> or <see cref="Texture2D"/>).
/// </summary>
public const string GBuffer = "GBuffer";
/// <summary>
/// The light buffer texture (<see cref="Texture"/> or <see cref="Texture2D"/>).
/// </summary>
public const string LightBuffer = "LightBuffer";
/// <summary>
/// The normals fitting texture (<see cref="Texture"/> or <see cref="Texture2D"/>) for encoding
/// "best fit" normals.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
public const string NormalsFittingTexture = "NormalsFittingTexture";
#endregion
#region ----- Misc -----
///// <summary>
///// A random value (<see cref="float"/>, <see cref="Vector2"/>, <see cref="Vector3"/>, or
///// <see cref="Vector4"/>).
///// </summary>
//public const string RandomValue = "RandomValue";
/// <summary>
/// An 8-bit texture (alpha only) with 16x16 dither values (<see cref="Texture"/> or
/// <see cref="Texture2D"/>).
/// </summary>
public const string DitherMap = "DitherMap";
/// <summary>
/// A quadratic RGBA texture (8 bit per channel) with random values (<see cref="Texture"/> or
/// <see cref="Texture2D"/>).
/// </summary>
public const string JitterMap = "JitterMap";
/// <summary>
/// The width of the quadratic <see cref="JitterMap"/> in texels (<see cref="float"/> or <see cref="Vector2"/>).
/// </summary>
public const string JitterMapSize = "JitterMapSize";
/// <summary>
/// A quadratic, tileable RGBA texture (8 bit per channel) with smooth noise values
/// (<see cref="Texture"/> or <see cref="Texture2D"/>).
/// </summary>
public const string NoiseMap = "NoiseMap";
/// <summary>
/// A 4-element vector with user-defined data for debugging (<see cref="Vector4"/>).
/// </summary>
/// <seealso cref="DefaultEffectBinder.Debug0"/>
/// <seealso cref="DefaultEffectBinder.Debug1"/>
public const string Debug = "Debug";
/// <summary>
/// A value containing <see cref="float.NaN"/> (<see cref="float"/>).
/// </summary>
public const string NaN = "NaN";
#endregion
}
}
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Text;
namespace NBXplorer.Models
{
public class RescanRequest
{
public class TransactionToRescan
{
public uint256 BlockId
{
get; set;
}
public uint256 TransactionId
{
get; set;
}
public Transaction Transaction
{
get; set;
}
}
public List<TransactionToRescan> Transactions
{
get; set;
} = new List<TransactionToRescan>();
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR.ARFoundation;
namespace ARKitStream
{
public class FacePreview : MonoBehaviour
{
[SerializeField] ARFaceManager faceManager = null;
void OnEnable()
{
faceManager.facesChanged += OnFaceChanged;
}
void OnDisable()
{
faceManager.facesChanged -= OnFaceChanged;
}
void OnFaceChanged(ARFacesChangedEventArgs args)
{
// Debug.Log($"Face Changed: {args}");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace BDSA2017.Lecture06.Demos
{
public static class ParallelLinq
{
public static void Run()
{
var numbers = Enumerable.Range(1, 5000000);
var query = from n in numbers.AsParallel().AsOrdered()
where Enumerable.Range(2, (int) Math.Sqrt(n)).All(i => n%i > 0)
select n;
var (primes, duration) = query.Measure();
Console.WriteLine("Primes: {0}, first: {1}, last: {2}", duration, primes.First(), primes.Last());
}
public static (T[] result, TimeSpan duration) Measure<T>(this IEnumerable<T> action)
{
var stopwatch = Stopwatch.StartNew();
var result = action.ToArray();
stopwatch.Stop();
return (result, stopwatch.Elapsed);
}
}
}
|
using UnityEngine;
using System.Collections;
public class WarpSpeed : MonoBehaviour {
public float WarpDistortion;
public float Speed;
ParticleSystem particles;
ParticleSystemRenderer rend;
bool isWarping = true;
void Awake()
{
particles = GetComponent<ParticleSystem>();
rend = particles.GetComponent<ParticleSystemRenderer>();
}
void Update()
{
if(isWarping && !atWarpSpeed())
{
rend.velocityScale += WarpDistortion * (Time.deltaTime * Speed);
}
if(!isWarping && !atNormalSpeed())
{
rend.velocityScale -= WarpDistortion * (Time.deltaTime * Speed);
}
}
public void Engage()
{
isWarping = true;
}
public void Disengage()
{
isWarping = false;
}
bool atWarpSpeed()
{
return rend.velocityScale < WarpDistortion;
}
bool atNormalSpeed()
{
return rend.velocityScale > 0;
}
}
|
using Urho;
namespace UrhoSharp.Interfaces
{
public class KeyDownEventArguments : KeyEventArguments
{
public KeyDownEventArguments(KeyDownEventArgs args) : base(args)
{
}
public KeyDownEventArguments(Key key, int scancode, bool repeat, int buttons, int qualifiers) : base(key,
scancode, repeat, buttons, qualifiers)
{
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttitudeContrellerFine : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Input.gyro.enabled = true;
}
// Update is called once per frame
void Update()
{
Quaternion q = Input.gyro.attitude;
q = GyroToUnity(q);
transform.rotation = q;
}
private static Quaternion GyroToUnity(Quaternion q)
{
return new Quaternion(q.x, q.z, q.y, -q.w);
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nucleus.Base
{
/// <summary>
/// A collection of ParameterGroups.
/// Each group within this collection must have a unique name.
/// </summary>
[Serializable]
public class ParameterGroupCollection : ObservableKeyedCollection<string, ParameterGroup>
{
#region Methods
/// <summary>
/// Get the key for the specified group
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
protected override string GetKeyForItem(ParameterGroup item)
{
return item.Name;
}
#endregion
}
}
|
using Newtonsoft.Json.Linq;
using PlacetoPay.Redirection.Helpers;
using PlacetoPay.Redirection.Validators;
using System.Collections.Generic;
namespace PlacetoPay.Redirection.Entities
{
/// <summary>
/// Class <c>Amount</c>
/// </summary>
public class Amount : AmountBase
{
protected const string AMOUNT = "amount";
protected const string DETAILS = "details";
protected const string TAXES = "taxes";
protected new AmountValidator validator = new AmountValidator();
protected List<TaxDetail> taxes;
protected List<AmountDetail> details;
protected double taxAmount;
/// <summary>
/// Amount constructor.
/// </summary>
public Amount() { }
/// <summary>
/// Amount constructor.
/// </summary>
/// <param name="data">string</param>
public Amount(string data) : this(JsonFormatter.ParseJObject(data)) { }
/// <summary>
/// Amount constructor.
/// </summary>
/// <param name="data">JObject</param>
public Amount(JObject data) : base(data)
{
if (data.ContainsKey(TAXES))
{
SetTaxes(data.GetValue(TAXES).ToObject<JArray>());
}
if (data.ContainsKey(DETAILS))
{
SetDetails(data.GetValue(DETAILS).ToObject<JArray>());
}
}
/// <summary>
/// Amount constructor.
/// </summary>
/// <param name="taxes">List</param>
/// <param name="details">List</param>
/// <param name="total">double</param>
/// <param name="currency">double</param>
public Amount(
List<TaxDetail> taxes,
List<AmountDetail> details,
double total,
string currency
) : base(currency, total)
{
this.taxes = taxes;
this.details = details;
}
/// <summary>
/// Taxes property.
/// </summary>
public List<TaxDetail> Taxes
{
get { return taxes; }
set { taxes = value; }
}
/// <summary>
/// Details property.
/// </summary>
public List<AmountDetail> Details
{
get { return details; }
set { details = value; }
}
/// <summary>
/// TaxtAmount property.
/// </summary>
public double TaxAmount
{
get { return taxAmount; }
set { taxAmount = value; }
}
/// <summary>
/// Set list of taxes.
/// </summary>
/// <param name="data">object</param>
/// <returns>Amount</returns>
private Amount SetTaxes(object data)
{
if (data != null && data.GetType() == typeof(JArray))
{
List<TaxDetail> list = new List<TaxDetail>();
foreach (var tax in (JArray)data)
{
JObject taxDetail = tax.ToObject<JObject>();
list.Add(new TaxDetail(taxDetail));
taxAmount += (double)taxDetail.GetValue(AMOUNT);
}
data = list;
}
taxes = (List<TaxDetail>)data;
return this;
}
/// <summary>
/// Set list of amount details.
/// </summary>
/// <param name="data">object</param>
/// <returns>Amount</returns>
private Amount SetDetails(object data)
{
if (data != null)
{
List<AmountDetail> list = new List<AmountDetail>();
foreach (var detail in (JArray)data)
{
JObject amountDetail = detail.ToObject<JObject>();
list.Add(new AmountDetail(amountDetail));
}
data = list;
}
details = (List<AmountDetail>)data;
return this;
}
/// <summary>
/// Convert taxes list to json array.
/// </summary>
/// <returns>JArray</returns>
private JArray TaxesToJArray()
{
JArray taxes = new JArray();
if (Taxes != null)
{
foreach (var taxe in Taxes)
{
taxes.Add(taxe.ToJsonObject());
}
}
return taxes;
}
/// <summary>
/// Convert details list to json array.
/// </summary>
/// <returns>JArray</returns>
private JArray DetailsToJArray()
{
JArray details = new JArray();
if (Details != null)
{
foreach (var detail in Details)
{
details.Add(detail.ToJsonObject());
}
}
return details;
}
/// <summary>
/// Json Object sent back from API.
/// </summary>
/// <returns>JsonObject</returns>
public override JObject ToJsonObject()
{
JObject jsonBase = base.ToJsonObject();
jsonBase.Merge(new JObject
{
{ TAXES, TaxesToJArray() },
{ DETAILS, DetailsToJArray() },
}, new JsonMergeSettings
{
MergeArrayHandling = MergeArrayHandling.Union
});
return JObjectFilter(jsonBase);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Librarian.DataAccess;
using Librarian.Sorting;
namespace Librarian
{
public class Library
{
private static readonly IComparer<Book> AuthorThenName = new BookComparer();
private readonly List<Book> _books;
private readonly ISortStrategy _bookSortingStrategy;
private bool _sortedBooks;
public Library(IBookRepository bookRepository, ISortStrategy bookSortingStrategy)
{
_books = bookRepository.GetBooks().ToList();
_bookSortingStrategy = bookSortingStrategy;
_sortedBooks = false;
}
public void PrintBooks()
{
if (!_sortedBooks)
{
SortBooks();
}
foreach (var collection in _books.GroupBy(it => it.Author))
{
var author = collection.Key;
Console.WriteLine(author);
Console.WriteLine("--------------------\n");
foreach (var book in collection)
{
Console.WriteLine("\t" + book.Title);
}
Console.WriteLine();
}
}
public void SortBooks()
{
var sorted = _bookSortingStrategy.Sort(_books, AuthorThenName).ToList();
_books.Clear();
_books.AddRange(sorted);
_sortedBooks = true;
}
private class BookComparer : IComparer<Book>
{
public int Compare(Book x, Book y)
{
var authorComparison = string.Compare(x.Author, y.Author, StringComparison.Ordinal);
var nameComparison = string.Compare(x.Title, y.Title, StringComparison.Ordinal);
return authorComparison != 0 ? authorComparison : nameComparison;
}
}
}
} |
// Copyright (c). All rights reserved.
//
// Licensed under the MIT license.
using Shouldly;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.Dism.Tests
{
public class GetDriversTest : DismInstallWimTestBase
{
public GetDriversTest(TestWimTemplate template, ITestOutputHelper testOutput)
: base(template, testOutput)
{
}
[Fact]
public void GetDriversFromOnlineSession()
{
using (DismSession session = DismApi.OpenOnlineSession())
{
DismDriverPackageCollection drivers = DismApi.GetDrivers(session, allDrivers: false);
ValidateDrivers(drivers);
}
}
[Fact]
public void GetDriversFromWim()
{
DismDriverPackageCollection drivers = DismApi.GetDrivers(Session, allDrivers: true);
ValidateDrivers(drivers);
}
private void ValidateDrivers(DismDriverPackageCollection drivers)
{
drivers.ShouldNotBeNull();
drivers.Count.ShouldNotBe(0);
foreach (DismDriverPackage driver in drivers)
{
driver.ClassDescription.ShouldNotBeNullOrWhiteSpace();
driver.ClassGuid.ShouldNotBeNullOrWhiteSpace();
driver.OriginalFileName.ShouldNotBeNullOrWhiteSpace();
}
}
}
} |
using MediatR;
using petshelterApi.Database;
using petshelterApi.Domain.User;
using petshelterApi.Helpers;
using petshelterApi.Services;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace petshelterApi.Features
{
public class UpdateUser
{
public class Query : IRequest<Model>
{
public string UserId { get; set; }
}
public class Model
{
public List<Shelter> Shelters { get; set; }
public class Shelter
{
public int Id { get; set; }
public string Name { get; set; }
}
}
public class Command : IRequest<CommandResult>
{
public string UserId { get; set; }
public int ShelterId { get; set; }
}
public class QueryHandler : IRequestHandler<Query, Model>
{
private readonly PetShelterDbContext _petShelterDbContext;
private readonly IAuth0ApiClient _userManager;
public QueryHandler(
PetShelterDbContext petShelterDbContext,
IAuth0ApiClient auth0ApiClient)
{
_petShelterDbContext = petShelterDbContext;
_userManager = auth0ApiClient;
}
public async Task<Model> Handle(Query query, CancellationToken cancellationToken)
{
var shelters = _petShelterDbContext.Shelters.Select(x => new Model.Shelter()
{
Id = x.Id,
Name = x.Name
}).ToList();
return new Model()
{
Shelters = shelters
};
}
}
public class CommandHandler : IRequestHandler<Command, CommandResult>
{
private readonly PetShelterDbContext _petShelterDbContext;
private readonly IAuth0ApiClient _userManager;
public CommandHandler(
PetShelterDbContext petShelterDbContext,
IAuth0ApiClient auth0ApiClient)
{
_petShelterDbContext = petShelterDbContext;
_userManager = auth0ApiClient;
}
public async Task<CommandResult> Handle(Command command, CancellationToken cancellationToken)
{
var shelter = _petShelterDbContext.Shelters.FirstOrDefault(x => x.Id == command.ShelterId);
var user = await _userManager.GetUser(command.UserId);
var result = await _userManager.UpdateUser(new Auth0UpdateUser(user.Id, user.Connection)
{
ShelterId = shelter?.Id,
Roles = user.Roles //command.Roles
});
if (result.IsSuccessStatusCode)
{
return new CommandResult(System.Net.HttpStatusCode.OK, "Shelter assigned to user.", user.Id);
}
return new CommandResult(result.StatusCode, "Something went wrong.");
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public bool test;
public float speed = 4;
public Vector2[] points;
public int curPoint;
private SimpleTween path;
void Start()
{
//InvokeRepeating("Clockwise", 0, 2f / speed); //testing
path = new SimpleTween(transform.position, points[0], Time.time, 1);
transform.Rotate(transform.forward, 90);
}
// Update is called once per frame
void Update()
{
if (Vector3.Distance(transform.position, path.EndPos) > 0.01f)
{
float timeFraction = (Time.time - path.StartTime) / path.Duration;
transform.position = Vector3.Lerp(path.StartPos, path.EndPos, timeFraction);
}
else
{
//transform.position = path.EndPos;
curPoint++;
if (curPoint == points.Length) curPoint = 0;
path.Link(points[curPoint]);
transform.Rotate(transform.forward, -90);
}
//transform.position = transform.position + (Vector3)dir;
//transform.position = transform.position + (speed * Time.deltaTime * transform.right);
}
//void Clockwise() //testing
//{
// transform.Rotate(transform.forward, -90);
//}
void Move(Vector2 dir)
{
//anims
//movement
//this.dir = dir;
}
}
|
// Copyright (c) Quarrel. All rights reserved.
using DiscordAPI.Models.Channels;
namespace Quarrel.ViewModels.Messages.Gateway
{
public sealed class GatewayChannelCreatedMessage
{
public GatewayChannelCreatedMessage(Channel channel)
{
Channel = channel;
}
public Channel Channel { get; }
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;
using TMPro;
public class TheRomanceManager : MonoBehaviour
{
public GameObject firework1;
public GameObject firework2;
public GameObject heartFlow;
public GameObject loveText;
// Start is called before the first frame update
void Start()
{
Invoke("StartTheHeartFlow", 2f);
Invoke("enhanceTheHeartColor1", 5f);
Invoke("ShowHeart", 5f);
Invoke("enhanceTheHeartColor2", 7f);
Invoke("enhanceTheHeartColor3", 9f);
Invoke("StartTheFirework", 12f);
Invoke("ShowTheText", 30f);
}
// Update is called once per frame
void Update()
{
}
void StartTheHeartFlow()
{
heartFlow.SetActive(true);
}
void ShowHeart()
{
VisualEffect vfx = heartFlow.GetComponent<VisualEffect>();
vfx.SetFloat("zeroToDisableHeart", 1); //0 to disable, 1 to enable
}
void enhanceTheHeartColor1()
{
float basicNumber = 0.01f;
basicNumber = basicNumber * 1;
VisualEffect vfx = heartFlow.GetComponent<VisualEffect>();
vfx.SetFloat("particalSize", basicNumber);
}
void enhanceTheHeartColor2()
{
float basicNumber = 0.01f;
basicNumber = basicNumber * 2;
VisualEffect vfx = heartFlow.GetComponent<VisualEffect>();
vfx.SetFloat("particalSize", basicNumber);
}
void enhanceTheHeartColor3()
{
float basicNumber = 0.01f;
basicNumber = basicNumber * 3;
VisualEffect vfx = heartFlow.GetComponent<VisualEffect>();
vfx.SetFloat("particalSize", basicNumber);
}
void StartTheFirework()
{
VisualEffect vfx = heartFlow.GetComponent<VisualEffect>();
vfx.SetFloat("setZeroToDisableOutsidePoint", 0.0f);
firework1.SetActive(true);
firework2.SetActive(true);
}
void ShowTheText()
{
enhanceTheHeartColor1();
StartCoroutine(TypeTextSlowly());
loveText.SetActive(true);
}
IEnumerator TypeTextSlowly()
{
// string text = " I Love You\nToo";
string text = "";
loveText.GetComponent<TextMeshPro>().text = text;
yield return new WaitForSeconds(1f);
text = "I";
loveText.GetComponent<TextMeshPro>().text = text;
yield return new WaitForSeconds(1f);
text = " I Love";
loveText.GetComponent<TextMeshPro>().text = text;
yield return new WaitForSeconds(1f);
text = " I Love You";
loveText.GetComponent<TextMeshPro>().text = text;
yield return new WaitForSeconds(1f);
text = " I Love You\nToo";
loveText.GetComponent<TextMeshPro>().text = text;
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace Framework.Core.ReflectionHelpers
{
public static class ValueExtensions
{
public static T ConvertFromDBVal<T>(object obj)
{
if (obj == null || obj == DBNull.Value)
{
return default(T); // returns the default value for the type
}
else
{
return (T)obj;
}
}
public static string RemoveHtmlTags(this string objRef)
{
if (string.IsNullOrWhiteSpace(objRef))
{
return objRef;
}
return Regex.Replace(objRef, @"<[^>]*>", String.Empty);
}
public static string DescriptionAttr<T>(this T source)
{
string descript = "";
FieldInfo fi = source.GetType().GetField(source.ToString());
try
{
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);
if (attributes != null && attributes.Length > 0)
{
descript = attributes[0].Description;
}
else
{
descript = source.ToString();
}
}
catch (Exception)
{ //do nothing
}
return descript;
}
public static T? ConvertToNullable<T>(this String s) where T : struct
{
try
{
return (T?)TypeDescriptor.GetConverter(typeof(T)).ConvertFrom(s);
}
catch (Exception)
{
return null;
}
}
public static bool ContainsCaseInsensitive(this string text, string value, bool nullSafe = true)
{
if (nullSafe && text == null)
return false;
return text.IndexOf(value, StringComparison.CurrentCultureIgnoreCase) >= 0;
}
}
}
|
using Boteco32.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Boteco32.Interfaces
{
public interface IProdutoService
{
Task Adicionar(Produto produto);
Task Atualizar(Produto produto);
Task Delete(Produto produto);
Task<List<Produto>> BuscarProdutos();
Produto BuscarProdutoPorId(int id);
}
}
|
using Swifter.Readers;
using Swifter.RW;
using Swifter.Tools;
using Swifter.Writers;
using System;
using System.Runtime.CompilerServices;
namespace Swifter.Reflection
{
sealed class XStructFieldInfo<TValue> : XFieldInfo, IXFieldRW
{
private long offset;
private Type declaringType;
public int Order => 999;
public bool CanRead => true;
public bool CanWrite => true;
public Type FieldType => typeof(TValue);
internal override void Initialize(System.Reflection.FieldInfo fieldInfo, XBindingFlags flags)
{
offset = TypeHelper.OffsetOf(fieldInfo) + TypeHelper.ObjectHandleSize;
declaringType = fieldInfo.DeclaringType;
base.Initialize(fieldInfo, flags);
}
[MethodImpl(VersionDifferences.AggressiveInlining)]
IntPtr GetAddress(object obj) => (IntPtr)((long)Pointer.UnBox(obj) + offset);
[MethodImpl(VersionDifferences.AggressiveInlining)]
IntPtr GetAddressCheck(object obj)
{
if (obj.GetType() != declaringType)
{
throw new System.Reflection.TargetException(nameof(obj));
}
return GetAddress(obj);
}
[MethodImpl(VersionDifferences.AggressiveInlining)]
unsafe IntPtr GetAddress(TypedReference typedRef)
{
if (declaringType != __reftype(typedRef))
{
throw new System.Reflection.TargetException(nameof(typedRef));
}
return (IntPtr)((long)Pointer.UnBox(typedRef) + offset - TypeHelper.ObjectHandleSize);
}
public override object GetValue(object obj)
{
return Pointer.GetValue<TValue>(GetAddressCheck(obj));
}
public override unsafe object GetValue(TypedReference typedRef)
{
return Pointer.GetValue<TValue>(GetAddress(typedRef));
}
public void OnReadValue(object obj, IValueWriter valueWriter)
{
ValueInterface<TValue>.Content.WriteValue(valueWriter, Pointer.GetValue<TValue>(GetAddress(obj)));
}
public void OnWriteValue(object obj, IValueReader valueReader)
{
Pointer.SetValue(GetAddress(obj), ValueInterface<TValue>.Content.ReadValue(valueReader));
}
public T ReadValue<T>(object obj)
{
if (TypeInfo<T>.Int64TypeHandle == TypeInfo<TValue>.Int64TypeHandle)
{
return Pointer.GetValue<T>(GetAddress(obj));
}
return XConvert<TValue, T>.Convert(Pointer.GetValue<TValue>(GetAddress(obj)));
}
public override void SetValue(object obj, object value)
{
Pointer.SetValue(GetAddressCheck(obj), (TValue)value);
}
public override void SetValue(TypedReference typedRef, object value)
{
Pointer.SetValue(GetAddress(typedRef), (TValue)value);
}
public void WriteValue<T>(object obj, T value)
{
if (TypeInfo<T>.Int64TypeHandle == TypeInfo<TValue>.Int64TypeHandle)
{
Pointer.SetValue(GetAddress(obj), value);
return;
}
Pointer.SetValue(GetAddress(obj), XConvert<T, TValue>.Convert(value));
}
}
} |
// C# Collections
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Linked_list_Example
{
class Linked_list
{
static void Main()
{
var value = new LinkedList<int>(); // linkedlist collection
value.AddLast(100); // add element
value.AddLast(200);
value.AddLast(300);
value.AddLast(400);
value.AddLast(500);
value.AddFirst(600);
value.AddFirst(700);
LinkedListNode<int> node = value.Find(500); // find the node
value.AddBefore(node, 450);
foreach (int num in value)
{
Console.WriteLine(num);
Console.ReadLine();
}
}
}
} |
/*
* This file was auto-generated by TestGenerator
* Do not modify it; modify TestGenerator.java and rerun it instead.
*/
/*
* It's super important to test all following cases because they test replacements for Trigonometric functions
* so if one is wrong your result might be wrong at all
*/
using AngouriMath;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.Core.TrigTableConstTest
{
[TestClass]
public class TestTrigTableConstSin
{
[TestMethod]
public void Sin1Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 1);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin2Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 2);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin3Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 3);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin4Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 4);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin5Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 5);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin6Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 6);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin7Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 7);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin8Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 8);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin9Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 9);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin10Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 10);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin11Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 11);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin12Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 12);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin13Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 13);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin14Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 14);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin15Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 15);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin16Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 16);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin17Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 17);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin18Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 18);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin19Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 19);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin20Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 20);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin21Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 21);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin22Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 22);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin23Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 23);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin24Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 24);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin25Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 25);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin26Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 26);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin27Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 27);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin28Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 28);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Sin29Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Sin(2 * MathS.pi / 29);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
}
[TestClass]
public class TestTrigTableConstCos
{
[TestMethod]
public void Cos1Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 1);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos2Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 2);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos3Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 3);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos4Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 4);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos5Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 5);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos6Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 6);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos7Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 7);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos8Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 8);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos9Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 9);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos10Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 10);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos11Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 11);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos12Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 12);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos13Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 13);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos14Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 14);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos15Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 15);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos16Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 16);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos17Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 17);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos18Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 18);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos19Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 19);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos20Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 20);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos21Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 21);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos22Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 22);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos23Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 23);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos24Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 24);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos25Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 25);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos26Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 26);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos27Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 27);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos28Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 28);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cos29Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cos(2 * MathS.pi / 29);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
}
[TestClass]
public class TestTrigTableConstTan
{
[TestMethod]
public void Tan1Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 1);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan2Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 2);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan3Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 3);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan5Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 5);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan6Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 6);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan7Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 7);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan8Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 8);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan9Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 9);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan10Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 10);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan11Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 11);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan12Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 12);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan13Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 13);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan14Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 14);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan15Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 15);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan16Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 16);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan17Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 17);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan18Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 18);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan19Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 19);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan20Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 20);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan21Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 21);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan22Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 22);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan23Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 23);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan24Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 24);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan25Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 25);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan26Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 26);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan27Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 27);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan28Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 28);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Tan29Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Tan(2 * MathS.pi / 29);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
}
[TestClass]
public class TestTrigTableConstCotan
{
[TestMethod]
public void Cotan3Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 3);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan5Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 5);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan6Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 6);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan7Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 7);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan8Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 8);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan9Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 9);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan10Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 10);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan11Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 11);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan12Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 12);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan13Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 13);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan14Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 14);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan15Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 15);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan16Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 16);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan17Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 17);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan18Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 18);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan19Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 19);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan20Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 20);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan21Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 21);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan22Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 22);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan23Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 23);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan24Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 24);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan25Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 25);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan26Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 26);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan27Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 27);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan28Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 28);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
[TestMethod]
public void Cotan29Test()
{
MathS.Settings.PrecisionErrorCommon.Set(1e-8m);
var toSimplify = MathS.Cotan(2 * MathS.pi / 29);
var expected = toSimplify.Eval();
var real = toSimplify.Simplify().Eval();
Assert.IsTrue(expected == real, "expected: " + expected.ToString() + " Got instead: " + real.ToString());
MathS.Settings.PrecisionErrorCommon.Unset();
}
}
}
|
using Helpers;
using Reface.AppStarter.AppModules;
namespace WebApiUT.AppModules
{
[HelpersAppModule]
public class TestAppModule : AppModule
{
}
}
|
@using NewLife.Cube.Extensions
@{
var set = ViewBag.PageSetting as PageSetting;
}
<div class="col">
@if (set.EnableKey)
{
<div class="me-3">
<div class="input-group mb-2">
<input name="q" type="search" id="q" value="@Context.Request.GetRequestValue("q")" class="form-control" placeholder="搜索关键字">
<button class="btn" type="submit">搜索</button>
</div>
</div>
}
</div> |
#load "interfaces.csx"
using Microsoft.Extensions.Logging;
public class Logger : ILoggingService
{
private readonly ILogger _logger;
public Logger(ILogger<Logger> logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public void LogInformation(string message, params object[] parameters)
{
_logger.LogInformation(message, parameters);
}
}
|
using System;
namespace uFrame.Kernel
{
[Obsolete("Use uframe kernel")]
public class uFrameMVVMKernel : uFrameKernel
{
}
} |
using System;
using Kassandra.Core.Models.Query;
namespace Kassandra.Core
{
public interface IQuery
{
string Query { get; set; }
IQuery MustCatchExceptions();
IQuery Parameter(string parameterName, object parameterValue, bool condition = true);
void ExecuteNonQuery();
IQuery Error(Action<QueryErrorEventArgs> args);
IQuery ConnectionOpening(Action<OpenConnectionEventArgs> args);
IQuery ConnectionOpened(Action<OpenConnectionEventArgs> args);
IQuery QueryExecuting(Action<QueryExecutionEventArgs> args);
IQuery QueryExecuted(Action<QueryExecutionEventArgs> args);
IQuery ConnectionClosing(Action<CloseConnectionEventArgs> args);
IQuery ConnectionClosed(Action<CloseConnectionEventArgs> args);
}
public enum QueryType
{
Query,
StoredProcedure
}
} |
using System.ComponentModel.DataAnnotations;
namespace MyProject.Web.Models
{
public class ProjectsModel
{
[Display(Name = "Project/Task Name:")]
public string project_name { get; set; }
[Display(Name = "Assign to:")]
public long assign_to { get; set; }
[Display(Name = "Project/Task Description:")]
public string project_description { get; set; }
[Display(Name = "Deadline:")]
public string project_deadline { get; set; }
}
}
|
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.UI.ViewManagement
{
public partial class ApplicationViewTitleBar
{
/// <summary>
/// Constructor is not public in UWP
/// </summary>
internal ApplicationViewTitleBar()
{
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonInactiveBackgroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonInactiveBackgroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonInactiveBackgroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonHoverForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonHoverForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonHoverForegroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonHoverBackgroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonHoverBackgroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonHoverBackgroundColor");
}
}
public global::Windows.UI.Color? ButtonForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonForegroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonBackgroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonBackgroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonBackgroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonInactiveForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonInactiveForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonInactiveForegroundColor");
}
}
#if !__WASM__
[global::Uno.NotImplemented]
public global::Windows.UI.Color? BackgroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.BackgroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.BackgroundColor");
}
}
#endif
[global::Uno.NotImplemented]
public global::Windows.UI.Color? InactiveForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.InactiveForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.InactiveForegroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? InactiveBackgroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.InactiveBackgroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.InactiveBackgroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ForegroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonPressedForegroundColor
{
get
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonPressedForegroundColor");
return null;
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonPressedForegroundColor");
}
}
[global::Uno.NotImplemented]
public global::Windows.UI.Color? ButtonPressedBackgroundColor
{
get
{
throw new global::System.NotImplementedException("The member Color? ApplicationViewTitleBar.ButtonPressedBackgroundColor is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.ViewManagement.ApplicationViewTitleBar", "Color? ApplicationViewTitleBar.ButtonPressedBackgroundColor");
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Harmony;
using MelonLoader;
namespace NoMeansYes
{
public class NoMeansYes : MelonMod
{
public override void OnApplicationStart()
{
var target = typeof(UnitActionFeedback1031).GetMethod("OnCreate");
var postfix = typeof(NoMeansYes).GetMethod(nameof(ModifyNpcFeedback),
BindingFlags.Public | BindingFlags.Static);
Harmony.Patch(target, postfix: new HarmonyMethod(postfix));
}
// ReSharper disable once InconsistentNaming
public static void ModifyNpcFeedback(UnitActionFeedback1031 __instance)
{
// Only apply on player
var isPlayer = __instance.trainsUnit.GetHashCode() == g.world.playerUnit.GetHashCode();
if (!isPlayer) return;
__instance.state = 1;
}
}
}
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
{
/// <summary>
/// Internal for testing purposes only. This class provides wrapper functionality
/// over SMO objects in order to facilitate unit testing
/// </summary>
internal class SmoWrapper
{
public virtual Server CreateServer(ServerConnection serverConn)
{
return serverConn == null ? null : new Server(serverConn);
}
public virtual bool IsConnectionOpen(SmoObjectBase smoObj)
{
SqlSmoObject sqlObj = smoObj as SqlSmoObject;
return sqlObj != null
&& sqlObj.ExecutionManager != null
&& sqlObj.ExecutionManager.ConnectionContext != null
&& sqlObj.ExecutionManager.ConnectionContext.IsOpen;
}
public virtual void OpenConnection(SmoObjectBase smoObj)
{
SqlSmoObject sqlObj = smoObj as SqlSmoObject;
if (sqlObj != null
&& sqlObj.ExecutionManager != null
&& sqlObj.ExecutionManager.ConnectionContext != null)
{
sqlObj.ExecutionManager.ConnectionContext.Connect();
}
}
}
} |
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Cathei.BakingSheet.Editor
{
public static class PackageGenerationTools
{
[MenuItem("Tools/Generate Package")]
public static void GeneratePackage()
{
var githubRef = Environment.GetEnvironmentVariable("GITHUB_REF");
// GITHUB_REF = refs/heads/v1.X.X
if (githubRef != null)
PlayerSettings.bundleVersion = githubRef.Substring(11);
var outputPath = Path.Combine(
Path.GetDirectoryName(Directory.GetCurrentDirectory()), "Build",
$"BakingSheet.{PlayerSettings.bundleVersion}.unitypackage");
AssetDatabase.ExportPackage(new string [] {
"Assets/Plugins/BakingSheet"
}, outputPath, ExportPackageOptions.Recurse);
Debug.Log("Generating Unity Package Completed");
}
}
}
|
using rbkApiModules.Infrastructure.Models;
using rbkApiModules.UIAnnotations;
using System;
using System.ComponentModel.DataAnnotations;
namespace rbkApiModules.Demo.Models
{
public class Post: BaseEntity
{
protected Post()
{
}
public Post(string title, Blog blog)
{
Title = title;
Blog = blog;
}
public string Title { get; private set; }
public Guid BlogId { get; private set; }
public Blog Blog { get; private set; }
}
}
|
namespace ElasticEngine
{
public interface IElasticIndexResponse
{
}
} |
using System.IO;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RetroClash.Extensions;
namespace RetroClash.Logic.StreamEntry.Alliance
{
public class JoinRequestAllianceStreamEntry : AllianceStreamEntry
{
public JoinRequestAllianceStreamEntry()
{
StreamEntryType = 3;
}
[JsonProperty("msg")]
public string Message { get; set; }
[JsonProperty("responder_name")]
public string ResponderName { get; set; }
[JsonProperty("state")]
public int State { get; set; }
public override async Task Encode(MemoryStream stream)
{
await base.Encode(stream);
await stream.WriteStringAsync(Message); // Message
await stream.WriteStringAsync(ResponderName); // ResponderName
await stream.WriteIntAsync(State); // State
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class televisionActivate : Activatable {
VideoPlayer tv;
override public void activate()
{
tv = transform.Find("TVScreen").GetComponent<VideoPlayer>();
tv.Play();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
using Microsoft.EntityFrameworkCore;
using Senai.CodeTur.Dominio.Entidades;
using Senai.CodeTur.Dominio.Interfaces.Repositorios;
using Senai.CodeTur.Infra.Data.Contextos;
using Senai.CodeTur.Infra.Data.Repositorios;
using Xunit;
namespace Senai.CodeTur.Teste.XUnit.Repositorios
{
public class TesteUsuario
{
[Fact]
public void VerificaSeUsuarioEInvalido()
{
var options = new DbContextOptionsBuilder<CodeTurContext>()
.UseInMemoryDatabase(databaseName: "UsuarioEInvalido")
.Options;
// Use a clean instance of the context to run the test
using (var context = new CodeTurContext(options))
{
var repo = new UsuarioRepositorio(context);
var validacao = repo.EfetuarLogin("admin@gmail.co", "12345");
Assert.Null(validacao);
}
}
[Fact]
public void VerificaSeUsuarioEValido()
{
var options = new DbContextOptionsBuilder<CodeTurContext>()
.UseInMemoryDatabase(databaseName: "UsuarioEValido")
.Options;
// Use a clean instance of the context to run the test
using (var context = new CodeTurContext(options))
{
var repo = new UsuarioRepositorio(context);
var validacao = repo.EfetuarLogin("admin@codetur.com", "12345");
Assert.Null(validacao);
}
}
[Fact]
public void VerificaSeUsuarioEValidoEInfoCorretas()
{
var options = new DbContextOptionsBuilder<CodeTurContext>()
.UseInMemoryDatabase(databaseName: "UsuarioEValidoEInfoCorretas")
.Options;
UsuarioDominio usuario = new UsuarioDominio()
{
Email = "admin@codetur.com",
Senha = "Codetur@132",
Tipo = "Administrador"
};
// Use a clean instance of the context to run the test
using (var context = new CodeTurContext(options))
{
var repo = new UsuarioRepositorio(context);
context.Usuarios.Add(usuario);
context.SaveChanges();
UsuarioDominio usuarioRetorno = repo.EfetuarLogin(usuario.Email, usuario.Senha);
Assert.Equal(usuarioRetorno.Email, usuario.Email);
Assert.Equal(usuarioRetorno.Senha, usuario.Senha);
}
}
}
}
|
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Sokan.Yastah.Data.Auditing;
namespace Sokan.Yastah.Data.Characters
{
public enum CharacterManagementAdministrationActionType
{
GuildCreated = AuditingActionCategory.CharacterManagement + 0x010100,
GuildModified = AuditingActionCategory.CharacterManagement + 0x010200,
GuildDeleted = AuditingActionCategory.CharacterManagement + 0x010300,
GuildRestored = AuditingActionCategory.CharacterManagement + 0x010400,
DivisionCreated = AuditingActionCategory.CharacterManagement + 0x020100,
DivisionModified = AuditingActionCategory.CharacterManagement + 0x020200,
DivisionDeleted = AuditingActionCategory.CharacterManagement + 0x020300,
DivisionRestored = AuditingActionCategory.CharacterManagement + 0x020400,
LevelDefinitionsInitialized = AuditingActionCategory.CharacterManagement + 0x030100,
LevelDefinitionsUpdated = AuditingActionCategory.CharacterManagement + 0x030200,
CharacterCreated = AuditingActionCategory.CharacterManagement + 0x040100,
CharacterModified = AuditingActionCategory.CharacterManagement + 0x040200,
CharacterDeleted = AuditingActionCategory.CharacterManagement + 0x040300,
CharacterRestored = AuditingActionCategory.CharacterManagement + 0x040400,
}
internal class CharacterManagementAdministrationActionTypeDataConfiguration
: IEntityTypeConfiguration<AuditableActionTypeEntity>
{
public void Configure(
EntityTypeBuilder<AuditableActionTypeEntity> entityBuilder)
{
var types = Enum.GetValues(typeof(CharacterManagementAdministrationActionType))
.Cast<CharacterManagementAdministrationActionType>();
foreach (var type in types)
entityBuilder.HasData(new AuditableActionTypeEntity(
id: (int)type,
categoryId: (int)AuditingActionCategory.CharacterManagement,
name: type.ToString()));
}
}
}
|
using System.Windows.Input;
namespace MP.ForismaticQuotes.Test
{
public class MainViewModel : BindableBase
{
public ICommand GetQuoteCmd { get; }
public MainViewModel()
{
GetQuoteCmd = new RelayCommand(GetQuoteAsync);
}
public string QuoteText { get; set; } = string.Empty;
public string QuoteAuthor { get; set; } = string.Empty;
private async void GetQuoteAsync(object obj)
{
using (ForismaticWorker worker = new ForismaticQuotes.ForismaticWorker())
{
var output = await worker.GetQuoteAsync().ConfigureAwait(false);
QuoteText = output[0];
QuoteAuthor = output[1];
RaisePropertyChanged(null);
}
}
}
} |
using UnityEngine;
using UnityEngine.UI;
/*
* class to display a countdown timer in the form:
* "Countdown seconds remaining = 12"
*
* when finsished display message:
* "countdown has finished"
*/
public class DigitalCountdown : MonoBehaviour
{
// reference to UI Text object whose text we'll update with countdowm message
private Text textClock;
// how many seconds to count down from
private CountdownTimer countdownTimer;
//---------------------------------
void Awake()
{
// get reference to Text component inside our parent GameObject
textClock = GetComponent<Text>();
// get reference to CountdownTimer object
countdownTimer = GetComponent<CountdownTimer>();
}
//---------------------------------
void Start()
{
// reset countdown timer to start from 30 seconds
countdownTimer.ResetTimer(30);
}
//---------------------------------
void Update ()
{
// get seconds remaining (as a whole number)
int timeRemaining = countdownTimer.GetSecondsRemaining();
// get message based on seconds left
string message = TimerMessage(timeRemaining);
// update 'text' componnent of our UI Text object with string message
textClock.text = message;
}
//---------------------------------
private string TimerMessage(int secondsLeft)
{
// if no seconds left, return timer finished message
if (secondsLeft < 0){
return "countdown has finished";
} else {
// if 1 or more seconds left then build String message of seconds left
return "Countdown seconds remaining = " + secondsLeft;
}
}
}
|
using UnityEngine;
using System.Collections;
public class MemConst
{
public static float TopBarHeight = 25;
public static int InspectorWidth = 400;
public static string[] ShowTypes = new string[] { "Table View", "TreeMap View" };
public static string[] MemTypeCategories = new string[] { "All", "Native", "Managed", "Others" };
public static string[] MemTypeLimitations = new string[] { "All", "n >= 1MB", "1MB > n >= 1KB", "n < 1KB" };
public static int TableBorder = 10;
public static float SplitterRatio = 0.4f;
public static int _1KB = 1024;
public static int _1MB = _1KB * _1KB;
public static readonly string SearchResultTypeString = "{search_result}";
}
public class MemStyles
{
public static GUIStyle Toolbar = "Toolbar";
public static GUIStyle ToolbarButton = "ToolbarButton";
public static GUIStyle Background = "AnimationCurveEditorBackground";
public static GUIStyle SearchTextField = "ToolbarSeachTextField";
public static GUIStyle SearchCancelButton = "ToolbarSeachCancelButton";
}
|
namespace Aima.ConstraintSatisfaction
{
public class Assigment<T>
{
public readonly string Name;
public readonly T Value;
public Assigment(string name, T value)
{
Name = name;
Value = value;
}
public override string ToString()
{
return $"{Name} = {Value}";
}
}
} |
// -----------------------------------------------------------------------
// <copyright file="LibLlvmGeneratorLibrary.cs" company="Ubiquity.NET Contributors">
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
using System.Collections.Generic;
using System.IO;
using CppSharp.AST;
using CppSharp.Passes;
using LlvmBindingsGenerator.Configuration;
using LlvmBindingsGenerator.Passes;
namespace LlvmBindingsGenerator
{
/// <summary>ILibrary implementation for the LUbiquity.NET.Llvm Interop</summary>
/// <remarks>
/// This class provides the library specific bridging from the generalized
/// CppSharp infrastructure for the specific needs of the Ubiquity.NET.Llvm.Interop library
/// </remarks>
internal class LibLlvmGeneratorLibrary
: ILibrary
{
/// <summary>Initializes a new instance of the <see cref="LibLlvmGeneratorLibrary"/> class.</summary>
/// <param name="llvmRoot">Root path to standard LLVM source</param>
/// <param name="outputPath">Output path of the generated code files</param>
/// <remarks>
/// The <paramref name="llvmRoot"/> only needs to have the files required to parse the LLVM-C API
/// </remarks>
public LibLlvmGeneratorLibrary( IGeneratorConfig configuration, string llvmRoot, string extensionsRoot, string outputPath )
{
Configuration = configuration;
CommonInclude = Path.Combine( llvmRoot, "include" );
ArchInclude = Path.Combine( llvmRoot, "x64-Release", "include" );
ExtensionsInclude = Path.Combine( extensionsRoot, "include" );
OutputPath = Path.GetFullPath( outputPath );
InternalTypePrinter = new LibLLVMTypePrinter();
Type.TypePrinterDelegate = t => InternalTypePrinter.GetName( t, TypeNameKind.Native );
}
public void Setup( IDriver driver )
{
Driver = driver;
driver.Options.UseHeaderDirectories = true;
driver.Options.GenerationOutputMode = CppSharp.GenerationOutputMode.FilePerUnit;
driver.Options.OutputDir = OutputPath;
driver.ParserOptions.SetupMSVC();
driver.ParserOptions.AddIncludeDirs( CommonInclude );
driver.ParserOptions.AddIncludeDirs( ArchInclude );
driver.ParserOptions.AddIncludeDirs( ExtensionsInclude );
var coreHeaders = Directory.EnumerateFiles( Path.Combine( CommonInclude, "llvm-c" ), "*.h", SearchOption.AllDirectories );
var extHeaders = Directory.EnumerateFiles( Path.Combine( ExtensionsInclude, "libllvm-c" ), "*.h", SearchOption.AllDirectories );
var module = driver.Options.AddModule( "Ubiquity.NET.Llvm.Interop" );
module.Headers.AddRange( coreHeaders );
module.Headers.AddRange( extHeaders );
}
public void SetupPasses( )
{
// Analysis passes that markup, but don't otherwise modify the AST run first
// always start the passes with the IgnoreSystemHeaders pass to ensure that
// transformation only occurs for the desired headers. Other passes depend on
// TranslationUnit.IsGenerated to ignore headers.
Driver.AddTranslationUnitPass( new IgnoreSystemHeadersPass( Configuration.IgnoredHeaders ) );
Driver.AddTranslationUnitPass( new IgnoreDuplicateNamesPass( ) );
// configuration validation - generates warnings for entries in configuration that
// have no corresponding elements in the source AST. (either from typos in the config
// or version to version changes in the underlying LLVM source)
Driver.AddTranslationUnitPass( new IdentifyReduntantConfigurationEntriesPass( Configuration ) );
Driver.AddTranslationUnitPass( new CheckFlagEnumsPass( ) );
// General transformations - These passes may alter the in memory AST
Driver.AddTranslationUnitPass( new PODToValueTypePass( ) );
Driver.AddTranslationUnitPass( new MarkFunctionsInternalPass( Configuration ) );
Driver.AddTranslationUnitPass( new AddMissingParameterNamesPass( ) );
Driver.AddTranslationUnitPass( new FixInconsistentLLVMHandleDeclarations( ) );
Driver.AddTranslationUnitPass( new ConvertLLVMBoolPass( Configuration ) );
Driver.AddTranslationUnitPass( new DeAnonymizeEnumsPass( Configuration.AnonymousEnums ) );
Driver.AddTranslationUnitPass( new MapHandleAliasTypesPass( Configuration ) );
Driver.AddTranslationUnitPass( new MarkDeprecatedFunctionsAsObsoletePass( Configuration ) );
Driver.AddTranslationUnitPass( new AddMarshalingAttributesPass( Configuration ) );
// validations to apply after all transforms complete
Driver.AddTranslationUnitPass( new ValidateMarshalingInfoPass( Configuration ) );
Driver.AddTranslationUnitPass( new ValidateExtensionNamingPass( ) );
}
public void Preprocess( ASTContext ctx )
{
// purge all the CppSharp type mapping to prevent any conversions/mapping
// Only the raw source should be in the AST until later stages adjust it.
Driver.Context.TypeMaps.TypeMaps.Clear();
InternalTypePrinter.Context = Driver.Context;
}
public void Postprocess( ASTContext ctx )
{
}
public IEnumerable<ICodeGenerator> CreateGenerators( )
{
var templateFactory = new LibLlvmTemplateFactory( Configuration, InternalTypePrinter );
return templateFactory.CreateTemplates( Driver.Context );
}
private IDriver Driver;
private readonly LibLLVMTypePrinter InternalTypePrinter;
private readonly IGeneratorConfig Configuration;
private readonly string CommonInclude;
private readonly string ArchInclude;
private readonly string ExtensionsInclude;
private readonly string OutputPath;
}
}
|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
namespace System.Fabric.Query
{
using System.Collections.Generic;
using System.Fabric;
using System.Fabric.Common.Serialization;
using System.Fabric.Interop;
/// <summary>
/// <para>Contains the detailed deactivation information about a node.</para>
/// </summary>
public sealed class NodeDeactivationResult
{
internal NodeDeactivationResult(
NodeDeactivationIntent effectiveIntent,
NodeDeactivationStatus status,
IList<NodeDeactivationTask> tasks,
IList<SafetyCheck> pendingSafetyChecks)
{
this.EffectiveIntent = effectiveIntent;
this.Status = status;
this.Tasks = tasks;
this.PendingSafetyChecks = pendingSafetyChecks;
}
private NodeDeactivationResult() { }
/// <summary>
/// <para>A node may get deactivated by multiple tasks at the same time. Each task may specify a different node
/// deactivation intent. In this case, effective intent is highest intent among all deactivation tasks, where ordering
/// is defined as Pause < Restart < RemoveData.</para>
/// </summary>
/// <value>
/// <para>Returns <see cref="System.Fabric.NodeDeactivationIntent" />.</para>
/// </value>
[JsonCustomization(PropertyName = JsonPropertyNames.NodeDeactivationIntent)]
public NodeDeactivationIntent EffectiveIntent { get; private set; }
/// <summary>
/// <para>Specifies the deactivation status for a node.</para>
/// </summary>
/// <value>
/// <para>Returns <see cref="System.Fabric.NodeDeactivationStatus" />.</para>
/// </value>
[JsonCustomization(PropertyName = JsonPropertyNames.NodeDeactivationStatus)]
public NodeDeactivationStatus Status { get; private set; }
/// <summary>
/// <para>Contains information about all the node deactivation tasks for a node.</para>
/// </summary>
/// <value>
/// <para>Returns <see cref="System.Collections.Generic.IList{T}" />.</para>
/// </value>
[JsonCustomization(PropertyName = JsonPropertyNames.NodeDeactivationTask)]
public IList<NodeDeactivationTask> Tasks { get; private set; }
/// <summary>
/// <para>
/// Gets a list of safety checks that are currently failing.
/// </para>
/// </summary>
/// <value>
/// <para>The list of failing safety checks.</para>
/// </value>
public IList<SafetyCheck> PendingSafetyChecks { get; private set; }
internal static unsafe NodeDeactivationResult CreateFromNative(
NativeTypes.FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM nativeResult)
{
IList<NodeDeactivationTask> tasks = new List<NodeDeactivationTask>();
IList<SafetyCheck> pendingSafetyChecks = new List<SafetyCheck>();
var nativeTasks = (NativeTypes.FABRIC_NODE_DEACTIVATION_TASK_LIST*)nativeResult.Tasks;
var nativeItemArray = (NativeTypes.FABRIC_NODE_DEACTIVATION_TASK*)nativeTasks->Items;
for (int i = 0; i < nativeTasks->Count; ++i)
{
var nativeItem = *(nativeItemArray + i);
tasks.Add(NodeDeactivationTask.CreateFromNative(nativeItem));
}
if (nativeResult.Reserved != IntPtr.Zero)
{
var ex1 = (NativeTypes.FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM_EX1*)nativeResult.Reserved;
pendingSafetyChecks = SafetyCheck.FromNativeList(
(NativeTypes.FABRIC_SAFETY_CHECK_LIST*)ex1->PendingSafetyChecks);
}
var nodeDeactivationResult = new NodeDeactivationResult(
(NodeDeactivationIntent)nativeResult.EffectiveIntent,
(NodeDeactivationStatus)nativeResult.Status,
tasks,
pendingSafetyChecks);
return nodeDeactivationResult;
}
}
} |
using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal interface IWeightsGenerator
{
BoneWeight[] Calculate(Vector2[] vertices, Edge[] edges, Vector2[] controlPoints, Edge[] bones, int[] pins);
}
}
|
namespace NewsTrack.Identity.Results
{
public enum AuthenticateResult
{
Ok,
Failed,
Lockout
}
} |
//
// C4Base_defs.cs
//
// Copyright (c) 2019 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using LiteCore.Util;
namespace LiteCore.Interop
{
internal enum C4ErrorDomain : uint
{
LiteCoreDomain = 1,
POSIXDomain,
SQLiteDomain,
FleeceDomain,
NetworkDomain,
WebSocketDomain,
MaxErrorDomainPlus1
}
internal enum C4ErrorCode : int
{
AssertionFailed = 1,
Unimplemented,
UnsupportedEncryption,
BadRevisionID,
CorruptRevisionData,
NotOpen,
NotFound,
Conflict,
InvalidParameter,
UnexpectedError,
CantOpenFile,
IOError,
MemoryError,
NotWriteable,
CorruptData,
Busy,
NotInTransaction,
TransactionNotClosed,
Unsupported,
NotADatabaseFile,
WrongFormat,
Crypto,
InvalidQuery,
MissingIndex,
InvalidQueryParam,
RemoteError,
DatabaseTooOld,
DatabaseTooNew,
BadDocID,
CantUpgradeDatabase,
DeltaBaseUnknown,
CorruptDelta,
NumErrorCodesPlus1
}
internal enum C4NetworkErrorCode : int
{
DNSFailure = 1,
UnknownHost,
Timeout,
InvalidURL,
TooManyRedirects,
TLSHandshakeFailed,
TLSCertExpired,
TLSCertUntrusted,
TLSClientCertRequired,
TLSClientCertRejected,
TLSCertUnknownRoot,
InvalidRedirect,
}
internal enum C4LogLevel : sbyte
{
Debug,
Verbose,
Info,
Warning,
Error,
None
}
internal unsafe partial struct C4Error
{
public C4ErrorDomain domain;
public int code;
public int internal_info;
}
internal unsafe struct C4LogDomain
{
}
internal unsafe struct C4LogFileOptions
{
public C4LogLevel log_level;
public FLSlice base_path;
public long max_size_bytes;
public int max_rotate_count;
private byte _use_plaintext;
public FLSlice header;
public bool use_plaintext
{
get {
return Convert.ToBoolean(_use_plaintext);
}
set {
_use_plaintext = Convert.ToByte(value);
}
}
}
} |
// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
using System;
using ClassicalSharp.Model;
using OpenTK;
namespace ClassicalSharp.Entities {
/// <summary> Entity component that performs management of hack states. </summary>
public sealed class HacksComponent {
Game game;
public HacksComponent(Game game) { this.game = game; }
public byte UserType;
/// <summary> The speed that the player move at, relative to normal speed,
/// when the 'speeding' key binding is held down. </summary>
public float SpeedMultiplier = 10;
/// <summary> Whether blocks that the player places that intersect themselves
/// should cause the player to be pushed back in the opposite direction of the placed block. </summary>
public bool PushbackPlacing;
/// <summary> Whether the player should be able to step up whole blocks, instead of just slabs. </summary>
public bool FullBlockStep;
/// <summary> Whether the player has allowed hacks usage as an option.
/// Note that all 'can use X' set by the server override this. </summary>
public bool Enabled = true;
/// <summary> Whether the player is allowed to use any type of hacks. </summary>
public bool CanAnyHacks = true;
public bool CanUseThirdPersonCamera = true;
public bool CanSpeed = true;
public bool CanFly = true;
public bool CanRespawn = true;
public bool CanNoclip = true;
public bool CanPushbackBlocks = true;
public bool CanSeeAllNames = true;
public bool CanDoubleJump = true;
public bool CanBePushed = true;
public float BaseHorSpeed = 1;
/// <summary> Amount of jumps the player can perform. </summary>
public int MaxJumps = 1;
/// <summary> Whether the player should slide after letting go of movement buttons in noclip. </summary>
public bool NoclipSlide = true;
/// <summary> Whether the player has allowed the usage of fast double jumping abilities. </summary>
public bool WOMStyleHacks;
public bool Noclip, Flying, FlyingUp, FlyingDown, Speeding, HalfSpeeding;
public bool CanJumpHigher { get { return Enabled && CanAnyHacks && CanSpeed; } }
public bool Floating; // true if Noclip or Flying
public string HacksFlags;
string GetFlagValue(string flag) {
int start = HacksFlags.IndexOf(flag, StringComparison.OrdinalIgnoreCase);
if (start < 0) return null;
start += flag.Length;
int end = HacksFlags.IndexOf(' ', start);
if (end < 0) end = HacksFlags.Length;
return HacksFlags.Substring(start, end - start);
}
float ParseFlagReal(string flag) {
string num = GetFlagValue(flag);
if (num == null || game.ClassicMode) return 1f;
float value = 0;
if (!Utils.TryParseDecimal(num, out value)) return 1f;
return value;
}
int ParseFlagInt(string flags) {
string num = GetFlagValue(flags);
if (num == null || game.ClassicMode) return 1;
int value = 0;
if (!int.TryParse(num, out value)) return 1;
return value;
}
void SetAllHacks(bool allowed) {
CanAnyHacks = CanFly = CanNoclip = CanRespawn = CanSpeed =
CanPushbackBlocks = CanUseThirdPersonCamera = allowed;
}
void ParseFlag(ref bool target, string flag) {
if (HacksFlags.Contains("+" + flag)) {
target = true;
} else if (HacksFlags.Contains("-" + flag)) {
target = false;
}
}
void ParseAllFlag(string flag) {
if (HacksFlags.Contains("+" + flag)) {
SetAllHacks(true);
} else if (HacksFlags.Contains("-" + flag)) {
SetAllHacks(false);
}
}
/// <summary> Sets the user type of this user. This is used to control permissions for grass,
/// bedrock, water and lava blocks on servers that don't support CPE block permissions. </summary>
public void SetUserType(byte value, bool setBlockPerms) {
bool isOp = value >= 100 && value <= 127;
UserType = value;
CanSeeAllNames = isOp;
if (!setBlockPerms) return;
BlockInfo.CanPlace[Block.Bedrock] = isOp;
BlockInfo.CanDelete[Block.Bedrock] = isOp;
BlockInfo.CanPlace[Block.Water] = isOp;
BlockInfo.CanPlace[Block.StillWater] = isOp;
BlockInfo.CanPlace[Block.Lava] = isOp;
BlockInfo.CanPlace[Block.StillLava] = isOp;
}
/// <summary> Disables any hacks if their respective CanHackX value is set to false. </summary>
public void CheckHacksConsistency() {
if (!CanFly || !Enabled) { Flying = false; FlyingDown = false; FlyingUp = false; }
if (!CanNoclip || !Enabled) Noclip = false;
if (!CanSpeed || !Enabled) { Speeding = false; HalfSpeeding = false; }
CanDoubleJump = CanAnyHacks && Enabled && CanSpeed;
CanSeeAllNames = CanAnyHacks && CanSeeAllNames;
if (!CanUseThirdPersonCamera || !Enabled)
game.CycleCamera();
}
/// <summary> Updates ability to use hacks, and raises HackPermissionsChanged event. </summary>
/// <remarks> Parses hack flags specified in the motd and/or name of the server. </remarks>
/// <remarks> Recognises +/-hax, +/-fly, +/-noclip, +/-speed, +/-respawn, +/-ophax, and horspeed=xyz </remarks>
public void UpdateHacksState() {
SetAllHacks(true);
CanBePushed = true;
if (HacksFlags == null) return;
// By default (this is also the case with WoM), we can use hacks.
if (HacksFlags.Contains("-hax")) SetAllHacks(false);
ParseFlag(ref CanFly, "fly");
ParseFlag(ref CanNoclip, "noclip");
ParseFlag(ref CanSpeed, "speed");
ParseFlag(ref CanRespawn, "respawn");
ParseFlag(ref CanBePushed, "push");
if (UserType == 0x64) ParseAllFlag("ophax");
BaseHorSpeed = ParseFlagReal("horspeed=");
MaxJumps = ParseFlagInt("jumps=");
CheckHacksConsistency();
Events.RaiseHackPermissionsChanged();
}
}
}
|
// ******************************************************************
// Copyright (c) William Bradley
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using Android.App;
using Android.Content;
using Android.Views;
using Java.Lang;
using PlatformBindings.Common;
using PlatformBindings.Enums;
using System;
using System.Threading.Tasks;
namespace PlatformBindings.Models.DialogHandling
{
public abstract class AlertDialogHandlerBase
{
public static AlertDialogHandlerBase Pick(Context Context)
{
if (AndroidAppServices.UseAppCompatUI) return new CompatAlertDialogHandler(Context);
else return new AlertDialogHandler(Context);
}
public AlertDialogHandlerBase(Context Context)
{
this.Context = Context;
PrimaryButtonClicked += (s, e) =>
{
if (e.Cancel) Show();
else Waiter.TrySetResult(DialogResult.Primary);
};
SecondaryButtonClicked += (s, e) =>
{
if (e.Cancel) Show();
else Waiter.TrySetResult(DialogResult.Secondary);
};
}
public void SetTitle(string text)
{
SetTitle(new Java.Lang.String(text));
}
public abstract void SetTitle(ICharSequence text);
public void SetMessage(string text)
{
SetMessage(new Java.Lang.String(text));
}
public abstract void SetMessage(ICharSequence text);
public void SetPrimaryButton(string text)
{
SetPrimaryButton(new Java.Lang.String(text));
}
public abstract void SetPrimaryButton(ICharSequence text);
public void SetSecondaryButton(string text)
{
SetSecondaryButton(new Java.Lang.String(text));
}
public abstract void SetSecondaryButton(ICharSequence text);
public virtual void SetView(View View)
{
this.View = View;
SetViewInternal(View);
}
protected abstract void SetViewInternal(View View);
public virtual void SetView(int LayoutResId)
{
var activity = Context as Activity;
var layout = activity.LayoutInflater.Inflate(LayoutResId, null);
SetView(layout);
}
public abstract void Show();
public virtual void Hide()
{
Dialog?.Hide();
}
public async Task<DialogResult> ShowAsync()
{
PlatformBindingHelpers.OnUIThread(() =>
{
Show();
});
return await Waiter.Task;
}
~AlertDialogHandlerBase()
{
Waiter = null;
}
public Context Context { get; }
public abstract event EventHandler<DialogButtonEventArgs> PrimaryButtonClicked;
public abstract event EventHandler<DialogButtonEventArgs> SecondaryButtonClicked;
private TaskCompletionSource<DialogResult> Waiter = new TaskCompletionSource<DialogResult>();
public abstract Dialog Dialog { get; }
public View View { get; private set; }
protected class AlertDialogButtonHandler : Java.Lang.Object, View.IOnClickListener
{
public AlertDialogButtonHandler(AlertDialogHandlerBase Handler)
{
this.Handler = Handler;
}
public void OnClick(View v)
{
var args = new DialogButtonEventArgs();
Click?.Invoke(v, args);
if (!args.Cancel)
{
Handler.Hide();
}
}
private readonly AlertDialogHandlerBase Handler;
public event EventHandler<DialogButtonEventArgs> Click;
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ResolutionSetter : MonoBehaviour
{
//Attach this script to a Dropdown GameObject
Dropdown m_Dropdown;
//This is the string that stores the current selection m_Text of the Dropdown
string m_Message;
//This Text outputs the current selection to the screen
public Text m_Text;
//This is the index value of the Dropdown
int m_DropdownValue;
void Start()
{
//Fetch the Dropdown GameObject
m_Dropdown = GetComponent<Dropdown>();
//Add listener for when the value of the Dropdown changes, to take action
m_Dropdown.onValueChanged.AddListener(delegate {
DropdownValueChanged(m_Dropdown);
});
setCameraSensorRes(m_Dropdown.options[m_DropdownValue].text);
}
void DropdownValueChanged(Dropdown change)
{
setCameraSensorRes(m_Dropdown.options[change.value].text);
}
void setCameraSensorRes(string resolution)
{
CameraSensor.width = System.Convert.ToInt32(resolution.Split('x')[0]);
CameraSensor.height = System.Convert.ToInt32(resolution.Split('x')[1]);
}
} |
using System.Linq;
using Simple1C.Impl.Com;
using Simple1C.Interface;
namespace Simple1C.Impl
{
internal class MetadataAccessor
{
private readonly MappingSource mappingSource;
private readonly GlobalContext globalContext;
public MetadataAccessor(MappingSource mappingSource, GlobalContext globalContext)
{
this.mappingSource = mappingSource;
this.globalContext = globalContext;
}
public Metadata GetMetadata(ConfigurationName configurationName)
{
Metadata result;
if (!mappingSource.MetadataCache.TryGetValue(configurationName, out result))
{
result = CreateMetadata(configurationName);
mappingSource.MetadataCache.TryAdd(configurationName, result);
}
return result;
}
private Metadata CreateMetadata(ConfigurationName name)
{
var metadata = globalContext.FindMetaByName(name);
if (name.Scope == ConfigurationScope.Константы)
return new Metadata(name.Fullname, new[]
{
new MetadataRequisite {MaxLength = GetMaxLength(metadata.ComObject)}
});
var descriptor = MetadataHelpers.GetDescriptor(name.Scope);
var attributes = MetadataHelpers.GetAttributes(metadata.ComObject, descriptor).ToArray();
var result = new MetadataRequisite[attributes.Length];
for (var i = 0; i < attributes.Length; i++)
{
var attr = attributes[i];
result[i] = new MetadataRequisite
{
Name = Call.Имя(attr),
MaxLength = GetMaxLength(attr)
};
}
return new Metadata(name.Fullname, result);
}
private int? GetMaxLength(object attribute)
{
var type = ComHelpers.GetProperty(attribute, "Тип");
var typesObject = ComHelpers.Invoke(type, "Типы");
var typesCount = Call.Количество(typesObject);
if (typesCount != 1)
return null;
var typeObject = Call.Получить(typesObject, 0);
var stringPresentation = globalContext.String(typeObject);
if (stringPresentation != "Строка")
return null;
var квалификаторыСтроки = ComHelpers.GetProperty(type, "КвалификаторыСтроки");
var result = Call.IntProp(квалификаторыСтроки, "Длина");
if (result == 0)
return null;
return result;
}
}
} |
namespace MyMoviesProject.Models.Movies
{
public enum MovieSorting
{
Id = 0,
Name = 1,
Year= 2,
Rating = 3
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.