content
stringlengths
23
1.05M
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; using DeOps.Implementation; using DeOps.Implementation.Transport; namespace DeOps.Interface.Settings { public partial class UpnpSetup : CustomIconForm { OpCore Core; public UPnPHandler UPnP; public UpnpLog Log; public UpnpSetup(OpCore core) { InitializeComponent(); Core = core; UPnP = core.Network.UPnPControl; UPnP.Logging = true; UPnP.Log.SafeClear(); RefreshInterface(); } private void RefreshLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { RefreshLink.Text = "Refreshing..."; EntryList.Items.Clear(); // add ports in seperate thread UPnP.ActionQueue.Enqueue(() => { string type = IPradio.Checked ? "WANIP" : "WANPPP"; UPnP.RefreshDevices(); foreach (UPnPDevice device in UPnP.Devices.Where(d => d.Name.Contains(type))) for (int i = 0; i < 250; i++) { PortEntry entry = UPnP.GetPortEntry(device, i); if (entry == null) break; else // add to list box BeginInvoke(new Action(() => EntryList.Items.Add(entry))); } // finish BeginInvoke(new Action(() => RefreshLink.Text = "Refresh")); }); RefreshInterface(); } private void RemoveLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { RemoveLink.Text = "Removing..."; List<PortEntry> remove = new List<PortEntry>(); foreach (PortEntry entry in EntryList.SelectedItems) remove.Add(entry); UPnP.ActionQueue.Enqueue(() => { foreach (PortEntry entry in remove) { UPnP.ClosePort(entry.Device, entry.Protocol, entry.Port); BeginInvoke(new Action(() => EntryList.Items.Remove(entry))); } // finish BeginInvoke(new Action(() => RemoveLink.Text = "Remove Selected")); }); RefreshInterface(); } private void AddDeOpsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AddDeOpsLink.Text = "Resetting..."; UPnP.Initialize(); if (Core.Context.Lookup != null) Core.Context.Lookup.Network.UPnPControl.Initialize(); UPnP.ActionQueue.Enqueue(() => BeginInvoke(new Action(() => AddDeOpsLink.Text = "Reset DeOps Ports"))); RefreshInterface(); } private void LogLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (Log == null) { Log = new UpnpLog(this); Log.Show(); } else { Log.WindowState = FormWindowState.Normal; Log.Activate(); } } private void CloseButton_Click(object sender, EventArgs e) { UPnP.Logging = false; Close(); } private void ActionTimer_Tick(object sender, EventArgs e) { RefreshInterface(); } private void RefreshInterface() { bool active = (UPnP.WorkingThread != null); ActionLabel.Visible = active; RefreshLink.Enabled = !active; RemoveLink.Enabled = !active; AddDeOpsLink.Enabled = !active; IPradio.Enabled = !active; PPPradio.Enabled = !active; } } }
using SwaggerWcf.Test.Service.Data; using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Web; namespace SwaggerWcf.Test.Service { [ServiceContract] public interface IAuthorService : IBaseService, IBaseCRUDService<Author> { } }
@using MortgageCalc.Core.Models; @model AmortizationSchedule @{ var anyPMI = Model.MonthlyPayments[0].PMI > 0; } <table class="table table-bordered table-sm table-hover table-responsive"> <thead> <tr> <th>Year</th> <th>Month</th> <th>Principal</th> <th>Interest</th> <th>Escrow</th> @if (anyPMI) { <th>PMI</th> } <th>Total</th> <th>"Rent"</th> <th>Cum. Principal</th> <th>Cum. Interest</th> <th>Cum. Escrow</th> @if (anyPMI) { <th>Cum. PMI</th> } <th>Cum. Total</th> <th>Cum. "Rent"</th> </tr> </thead> <tbody> @for (var monthIdx = 0; monthIdx < Model.MonthlyPayments.Count; monthIdx++) { var monthPayment = Model.MonthlyPayments[monthIdx]; var monthCumulativeSummary = Model.MonthlyCumulativePaymentAmounts[monthIdx]; <tr> <td>@((monthIdx / 12) + 1)</td> <td>@((monthIdx % 12) + 1)</td> <td>@monthPayment.Principal</td> <td>@monthPayment.Interest</td> <td>@monthPayment.Escrow</td> @if (anyPMI) { <td>@monthPayment.PMI</td> } <td>@monthPayment.Total</td> <td>@monthPayment.Rent</td> <td>@monthCumulativeSummary.Principal</td> <td>@monthCumulativeSummary.Interest</td> <td>@monthCumulativeSummary.Escrow</td> @if (anyPMI) { <td>@monthCumulativeSummary.PMI</td> } <td>@monthCumulativeSummary.Total</td> <td>@monthCumulativeSummary.Rent</td> </tr> } </tbody> </table>
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace V3 { public class Selector : PanelBase { [SerializeField] private Button[] buttons; [SerializeField] private float r = 120f; private float angle; public void InitButtonPosition(int size) { for(int i = 0;i < GameManager.Instance.MaxSize;i ++) { if(i>=size) { buttons[i].gameObject.SetActive(false); } else { buttons[i].gameObject.SetActive(true); angle = Mathf.PI * 2 * i / size; buttons[i].transform.localPosition = new Vector3(r * Mathf.Sin(angle), r * Mathf.Cos(angle), 0); } } } } }
namespace MLG2007.Helper.CalendarStore { partial class Calendars { partial class CalendarsDataTable { } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class StartGameButton : MonoBehaviour { public GameObject game_ui; public GameObject hide_ui; public Text colour_text; public void StartGame() { game_ui.SetActive(true); colour_text.GetComponent<TextScript>().ResetGame(); hide_ui.SetActive(false); } }
namespace Leak.Extensions { public interface MoreMapping { void Add(string code, MoreHandler handler); } }
namespace Bandersnatch { public static class Pipeline { } }
namespace Book.Views.Samples.Chapter18.Sample01 { using System; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; using ReactiveUI; using ViewModels.Samples.Chapter18.Sample01; public partial class ChildView : ReactiveUserControl<ChildViewModel> { public ChildView() { InitializeComponent(); this .WhenActivated( disposables => { this.ViewModel?.LogMessage("Activated"); this .OneWayBind(this.ViewModel, x => x.Name, x => x.nameLabel.Content) .DisposeWith(disposables); Disposable .Create(() => this.ViewModel?.LogMessage("Deactivated")) .DisposeWith(disposables); }); this .Events() .Loaded .Do(_ => this.ViewModel?.LogMessage("Loaded")) .Subscribe(); this .Events() .Unloaded .Do(_ => this.ViewModel?.LogMessage("Unloaded")) .Subscribe(); } } }
namespace TezosPayments.DependencyInjection; public interface ITezosPaymentsProvider { ITezosPayments GetTezosPayments(string name); }
using UnityEngine; namespace ScriptableEvents.Listeners { [AddComponentMenu("Scriptable Events/Long Scriptable Event Listener", 2)] public class LongScriptableEventListener : BaseScriptableEventListener<long> { } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Archimedes.Patterns { /// <summary> /// Generic EventData /// </summary> /// <typeparam name="T">Type of submited Value</typeparam> public class EventArgs<T> : EventArgs { public EventArgs(T value){ Value = value; } /// <summary> /// Eventdata Value /// </summary> public T Value { get; protected set; } } }
using System; using System.Collections.Generic; using System.Text; using FastReport.Utils; namespace FastReport.Data { public class SQLiteAssemblyInitializer : AssemblyInitializerBase { public SQLiteAssemblyInitializer() { RegisteredObjects.AddConnection(typeof(SQLiteDataConnection)); } } }
using PostSharp.Aspects; using PostSharp.Serialization; using PostSharpExceptionHandling.Attributes.Common.ExceptionHandling; namespace PostSharpExceptionHandling.Example.Attributes.ExceptionHandling { [PSerializable] internal class ChangeSalaryWithInadmissibleValueAttribute : LoggingExceptionHandlerAttribute { public override void Catch(MethodExecutionArgs args) { } public override void Finally(MethodExecutionArgs args) { } } }
using System; namespace DbBridge.Classes { public class Alias { private string _alias; private string _column; public Alias(string column, string alias) { if (string.IsNullOrEmpty(alias)) throw new ArgumentException("Alias can not be empty."); _alias = alias; _column = column; } public override string ToString() { return $"{ _alias }.{ _column }"; } } }
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using EcmaScript.NET; using Yahoo.Yui.Compressor; using YuiCompressionType = Yahoo.Yui.Compressor.CompressionType; using BundleTransformer.Core; using BundleTransformer.Core.Assets; using BundleTransformer.Core.Minifiers; using BundleTransformer.Core.Utilities; using CoreStrings = BundleTransformer.Core.Resources.Strings; using BundleTransformer.Yui.Configuration; using BtCompressionType = BundleTransformer.Yui.CompressionType; using YuiStrings = BundleTransformer.Yui.Resources.Strings; namespace BundleTransformer.Yui.Minifiers { /// <summary> /// Minifier, which produces minifiction of JS code /// by using YUI Compressor for .NET /// </summary> public sealed class YuiJsMinifier : YuiMinifierBase { /// <summary> /// Name of minifier /// </summary> const string MINIFIER_NAME = "YUI JS minifier"; /// <summary> /// Name of code type /// </summary> const string CODE_TYPE = "JS"; /// <summary> /// JS compressor /// </summary> private readonly JavaScriptCompressor _jsCompressor; /// <summary> /// Synchronizer of minification /// </summary> private readonly object _minificationSynchronizer = new object(); /// <summary> /// Gets or sets a code compression type /// </summary> public override BtCompressionType CompressionType { get { return Utils.GetEnumFromOtherEnum<YuiCompressionType, BtCompressionType>(_jsCompressor.CompressionType); } set { _jsCompressor.CompressionType = Utils.GetEnumFromOtherEnum<BtCompressionType, YuiCompressionType>(value); } } /// <summary> /// Gets or sets a flag for whether to allow obfuscation of code /// </summary> public bool ObfuscateJavascript { get { return _jsCompressor.ObfuscateJavascript; } set { _jsCompressor.ObfuscateJavascript = value; } } /// <summary> /// Gets or sets a flag for whether to preserve unnecessary /// semicolons (such as right before a '}') /// </summary> public bool PreserveAllSemicolons { get { return _jsCompressor.PreserveAllSemicolons; } set { _jsCompressor.PreserveAllSemicolons = value; } } /// <summary> /// Gets or sets a flag for whether to disable all the built-in micro optimizations /// </summary> public bool DisableOptimizations { get { return _jsCompressor.DisableOptimizations; } set { _jsCompressor.DisableOptimizations = value; } } /// <summary> /// Gets or sets a flag for whether to ignore when processing code, that /// executed in eval operator /// </summary> public bool IgnoreEval { get { return _jsCompressor.IgnoreEval; } set { _jsCompressor.IgnoreEval = value; } } /// <summary> /// Gets or sets a severity level of errors /// 0 - only syntax error messages; /// 1 - only syntax error messages and warnings. /// </summary> public int Severity { get { return (_jsCompressor.LoggingType == LoggingType.Debug) ? 1 : 0; } set { _jsCompressor.LoggingType = (value == 1) ? LoggingType.Debug : LoggingType.None; } } /// <summary> /// Gets or sets a column number, after which must be inserted a line break. /// Specify 0 to get a line break after each semi-colon in JS. /// </summary> public override int LineBreakPosition { get { return _jsCompressor.LineBreakPosition; } set { _jsCompressor.LineBreakPosition = value; } } /// <summary> /// Gets or sets the type of Encoding. /// Eg. ASCII, BigEndianUnicode, Unicode, UTF32, UTF7, UTF8. /// </summary> public Encoding Encoding { get { return _jsCompressor.Encoding; } set { _jsCompressor.Encoding = value; } } /// <summary> /// Gets or sets the culture you want the thread to run under. /// This affects the treatment of numbers etc - e.g. 9.00 could be output as 9,00 /// (this is mainly for non English OS's)/ /// </summary> public CultureInfo ThreadCulture { get { return _jsCompressor.ThreadCulture; } set { _jsCompressor.ThreadCulture = value; } } /// <summary> /// Constructs a instance of YUI JS minifier /// </summary> public YuiJsMinifier() : this(BundleTransformerContext.Current.Configuration.GetYuiSettings()) { } /// <summary> /// Constructs a instance of YUI JS minifier /// </summary> /// <param name="yuiConfig">Configuration settings of YUI Minifier</param> public YuiJsMinifier(YuiSettings yuiConfig) { _jsCompressor = new JavaScriptCompressor(); JsMinifierSettings jsMinifierConfig = yuiConfig.JsMinifier; CompressionType = jsMinifierConfig.CompressionType; ObfuscateJavascript = jsMinifierConfig.ObfuscateJavascript; PreserveAllSemicolons = jsMinifierConfig.PreserveAllSemicolons; DisableOptimizations = jsMinifierConfig.DisableOptimizations; IgnoreEval = jsMinifierConfig.IgnoreEval; LineBreakPosition = jsMinifierConfig.LineBreakPosition; Encoding = ParseEncoding(jsMinifierConfig.Encoding); ThreadCulture = ParseThreadCulture(jsMinifierConfig.ThreadCulture); Severity = jsMinifierConfig.Severity; } /// <summary> /// Produces a code minifiction of JS asset by using YUI Compressor for .NET /// </summary> /// <param name="asset">JS asset</param> /// <returns>JS asset with minified text content</returns> public override IAsset Minify(IAsset asset) { if (asset == null) { throw new ArgumentException(CoreStrings.Common_ValueIsEmpty, "asset"); } if (asset.Minified) { return asset; } lock (_minificationSynchronizer) { InnerMinify(asset); } return asset; } /// <summary> /// Produces a code minifiction of JS assets by using YUI Compressor for .NET /// </summary> /// <param name="assets">Set of JS assets</param> /// <returns>Set of JS assets with minified text content</returns> public override IList<IAsset> Minify(IList<IAsset> assets) { if (assets == null) { throw new ArgumentException(CoreStrings.Common_ValueIsEmpty, "assets"); } if (assets.Count == 0) { return assets; } var assetsToProcessing = assets.Where(a => a.IsScript && !a.Minified).ToList(); if (assetsToProcessing.Count == 0) { return assets; } lock (_minificationSynchronizer) { foreach (var asset in assetsToProcessing) { InnerMinify(asset); } } return assets; } private void InnerMinify(IAsset asset) { string content = asset.Content; string newContent; string assetUrl = asset.Url; try { newContent = !string.IsNullOrEmpty(content) ? _jsCompressor.Compress(content) : string.Empty; var errorReporter = _jsCompressor.ErrorReporter as CustomErrorReporter; if (errorReporter != null && errorReporter.ErrorMessages.Count > 0) { var errorMessage = new StringBuilder(); foreach (var errorDetail in errorReporter.ErrorMessages) { errorMessage.AppendLine(errorDetail); errorMessage.AppendLine(); } errorReporter.ErrorMessages.Clear(); throw new YuiCompressingException(errorMessage.ToString()); } } catch (EcmaScriptRuntimeException e) { throw new AssetMinificationException( string.Format(CoreStrings.Minifiers_MinificationSyntaxError, CODE_TYPE, assetUrl, MINIFIER_NAME, e.Message), e); } catch (EcmaScriptException e) { throw new AssetMinificationException( string.Format(CoreStrings.Minifiers_MinificationSyntaxError, CODE_TYPE, assetUrl, MINIFIER_NAME, e.Message), e); } catch (YuiCompressingException e) { throw new AssetMinificationException( string.Format(CoreStrings.Minifiers_MinificationSyntaxError, CODE_TYPE, assetUrl, MINIFIER_NAME, e.Message), e); } catch (Exception e) { throw new AssetMinificationException( string.Format(CoreStrings.Minifiers_MinificationFailed, CODE_TYPE, assetUrl, MINIFIER_NAME, e.Message), e); } asset.Content = newContent; asset.Minified = true; } /// <summary> /// Parses a encoding type /// </summary> /// <param name="encoding">String representation of the encoding type</param> /// <returns>Encoding type</returns> private static Encoding ParseEncoding(string encoding) { if (string.IsNullOrWhiteSpace(encoding)) { return Encoding.Default; } Encoding convertedEncoding; switch (encoding.ToLowerInvariant()) { case "ascii": convertedEncoding = Encoding.ASCII; break; case "bigendianunicode": convertedEncoding = Encoding.BigEndianUnicode; break; case "unicode": convertedEncoding = Encoding.Unicode; break; case "utf32": case "utf-32": convertedEncoding = Encoding.UTF32; break; case "utf7": case "utf-7": convertedEncoding = Encoding.UTF7; break; case "utf8": case "utf-8": convertedEncoding = Encoding.UTF8; break; case "default": convertedEncoding = Encoding.Default; break; default: throw new ArgumentException( string.Format(YuiStrings.Minifiers_InvalidEncoding, encoding), "encoding"); } return convertedEncoding; } /// <summary> /// Parses a thread culture /// </summary> /// <param name="threadCulture">String representation of the thread culture</param> /// <returns>Thread culture</returns> private static CultureInfo ParseThreadCulture(string threadCulture) { if (string.IsNullOrWhiteSpace(threadCulture)) { return CultureInfo.InvariantCulture; } CultureInfo convertedThreadCulture; try { switch (threadCulture.ToLowerInvariant()) { case "iv": case "ivl": case "invariantculture": case "invariant culture": case "invariant language": case "invariant language (invariant country)": { convertedThreadCulture = CultureInfo.InvariantCulture; break; } default: { convertedThreadCulture = CultureInfo.CreateSpecificCulture(threadCulture); break; } } } catch { throw new ArgumentException( string.Format(YuiStrings.Minifiers_InvalidThreadCulture, threadCulture), "threadCulture"); } return convertedThreadCulture; } } }
namespace StrategyPattern._3_DuckBehaviorImplementation.Behaviors.Fly; public class FlyBehavior : IFlyBehavior { public string Fly() { return "Flying"; } }
using System; using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.Build.Framework; using Logger = SharpGen.Logging.Logger; using Task = Microsoft.Build.Utilities.Task; namespace SharpGenTools.Sdk.Tasks { public abstract class SharpTaskBase : Task, ICancelableTask { private volatile bool isCancellationRequested; // ReSharper disable MemberCanBePrivate.Global, UnusedAutoPropertyAccessor.Global [Required] public bool DebugWaitForDebuggerAttach { get; set; } // ReSharper restore UnusedAutoPropertyAccessor.Global, MemberCanBePrivate.Global protected Logger SharpGenLogger { get; private set; } protected bool IsCancellationRequested => isCancellationRequested; protected void PrepareExecute() { BindingRedirectResolution.Enable(); SharpGenLogger = new Logger(new MSBuildSharpGenLogger(Log)); #if DEBUG if (DebugWaitForDebuggerAttach) WaitForDebuggerAttach(); #endif } [Conditional("DEBUG")] private void WaitForDebuggerAttach() { if (!Debugger.IsAttached) { SharpGenLogger.Warning(null, $"{GetType().Name} is waiting for attach: {Process.GetCurrentProcess().Id}"); Thread.Yield(); } while (!Debugger.IsAttached && !IsCancellationRequested) Thread.Sleep(TimeSpan.FromSeconds(1)); } public void Cancel() { isCancellationRequested = true; } } }
namespace МоитеГуми.Models.Connection { using static Data.Models.DataConstatnt.Connection; public class ConnectionViewModel { public string connection { get; set; } } }
using System; using System.Collections.Generic; using System.Text; using FluentAssertions; using Xunit; namespace ShoppingCart.Tests { public class CartItemTest { [Fact] public void Ctor_ShouldCreate() { var arrange = new CartItem(new Product("product", 15, new Category("category")), 5); arrange.Quantity.Should().Be(5); arrange.Product.Price.Should().Be(15); arrange.Product.Title.Should().BeEquivalentTo("product"); arrange.Product.Category.Title.Should().BeEquivalentTo("category"); } [Fact] public void Ctor_when_title_null_or_empty_throw_exception() { Action action = () => new CartItem(new Product("product", 15, new Category("category")), 0); action.Should().Throw<Exception>().WithMessage("Quantity must be greather than zero"); } } }
using System; using System.IO; namespace Threats.Filesystem.CreateFile { class Program { static string execPath; static string rootPath; static Program() { execPath = Environment.CurrentDirectory; //execPath = Path.GetDirectoryName(new Uri(typeof(Program).Assembly.GetName().CodeBase).LocalPath); rootPath = Path.GetPathRoot(execPath); } static void Main(string[] args) { var filePath = Path.Combine(rootPath, "remoteuserfile.threat"); Console.WriteLine($"Creating {filePath}"); Console.WriteLine("-------------------------------"); CreateText(filePath, "This is created by a remote user\n"); AppendText(filePath, "Quite a threat.\n"); Console.WriteLine(); Console.WriteLine($"Reading {filePath}"); Console.WriteLine("-------------------------------"); Console.Write(File.ReadAllText(filePath)); Console.WriteLine(); Console.WriteLine($"Deleting {filePath}"); Console.WriteLine("-------------------------------"); File.Delete(filePath); } static void AppendText(string filePath, string contents) { using (var sw = File.AppendText(filePath)) { sw.Write(contents); } } static void CreateText(string filePath, string contents) { using (var sw = File.AppendText(filePath)) { sw.Write(contents); } } } }
using UnityEngine; namespace U3Gear.Library.Engine.Cameras { public abstract class BaseCamerasCtrl : MonoBehaviour { /// <summary> /// Awake is called when the script instance is being loaded. /// </summary> protected virtual void Awake() { } /// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// Update is the most commonly used function to implement any kind of game behavior. /// </summary> protected virtual void Update() { } /// <summary> /// LateUpdate is called after all Update functions have been called. /// This is useful to order script execution. /// For example a follow camera should always be implemented in LateUpdate /// because it tracks objects that might have moved inside Update. /// </summary> protected virtual void LateUpdate() { } } }
namespace OSC.Net.Model.GetDateTime { /// <summary> /// GetDateTime command options class. /// </summary> public class Options { /// <summary> /// Gets or sets dateTimeZone. /// </summary> public string dateTimeZone { get; set; } } }
namespace FakeItEasy.Tests.Core { using System.Collections.Generic; using System.Linq; using FakeItEasy.Core; public class EnumerableOfFakeCallsFactory : DummyFactory<IEnumerable<IFakeObjectCall>> { protected override IEnumerable<IFakeObjectCall> Create() { return Enumerable.Empty<IFakeObjectCall>(); } } }
namespace Armut.Iyzipay.Request { public class CreateThreedsPaymentRequest : BaseRequest { public string PaymentId { get; set; } public string ConversationData { get; set; } public override string ToPKIRequestString() { return ToStringRequestBuilder.NewInstance() .AppendSuper(base.ToPKIRequestString()) .Append("paymentId", PaymentId) .Append("conversationData", ConversationData) .GetRequestString(); } } }
using System.Threading.Tasks; namespace SharkFramework { public interface IServiceSingleton { Task InitializeAsync(); } }
namespace Ndapi.Enums { public enum AlertButton { Button1 = NdapiConstants.D2FC_DFAL_BTN1, Button2 = NdapiConstants.D2FC_DFAL_BTN2, Button3 = NdapiConstants.D2FC_DFAL_BTN3 } public enum Justification { Left = NdapiConstants.D2FC_JUST_LEFT, Right = NdapiConstants.D2FC_JUST_RIGHT, Center = NdapiConstants.D2FC_JUST_CENTER, Start = NdapiConstants.D2FC_JUST_START, End = NdapiConstants.D2FC_JUST_END } public enum AlertStyle { Stop = NdapiConstants.D2FC_ALST_STOP, Caution = NdapiConstants.D2FC_ALST_CAUTION, Note = NdapiConstants.D2FC_ALST_NOTE } public enum DataSourceArgumentMode { In = NdapiConstants.D2FC_DSMO_IN, Out = NdapiConstants.D2FC_DSMO_OUT, InOut = NdapiConstants.D2FC_DSMO_IN_OUT } public enum LineArrowStyle { None = NdapiConstants.D2FC_ARST_NONE, Start = NdapiConstants.D2FC_ARST_START, End = NdapiConstants.D2FC_ARST_END, Both = NdapiConstants.D2FC_ARST_BOTH, MiddleToStart = NdapiConstants.D2FC_ARST_MDLTOSTRT, MiddleToEnd = NdapiConstants.D2FC_ARST_MDLTOEND } public enum GraphicsObjectType { Arc = NdapiConstants.D2FC_GRTY_ARC, Image = NdapiConstants.D2FC_GRTY_IMAGE, Line = NdapiConstants.D2FC_GRTY_LINE, Polygon = NdapiConstants.D2FC_GRTY_POLY, Rectangle = NdapiConstants.D2FC_GRTY_RECT, RoundedRectangle = NdapiConstants.D2FC_GRTY_RREC, Text = NdapiConstants.D2FC_GRTY_TEXT, Group = NdapiConstants.D2FC_GRTY_GROUP, Frame = NdapiConstants.D2FC_GRTY_FRAME } public enum Bevel { Raised = NdapiConstants.D2FC_BEST_RAISED, Lowered = NdapiConstants.D2FC_BEST_LOWERED, None = NdapiConstants.D2FC_BEST_NONE, Inset = NdapiConstants.D2FC_BEST_NSET, Outset = NdapiConstants.D2FC_BEST_OUTSET, Plain = NdapiConstants.D2FC_BEST_PLAIN } public enum DataSourceColumnType { Varchar2 = NdapiConstants.D2FC_DSTY_VARCHAR2, Number = NdapiConstants.D2FC_DSTY_NUMBER, Long = NdapiConstants.D2FC_DSTY_LONG, Rowid = NdapiConstants.D2FC_DSTY_ROWID, Date = NdapiConstants.D2FC_DSTY_DATE, Raw = NdapiConstants.D2FC_DSTY_RAW, LongRaw = NdapiConstants.D2FC_DSTY_LONG_RAW, Char = NdapiConstants.D2FC_DSTY_CHAR, Mlslabel = NdapiConstants.D2FC_DSTY_MLSLABEL, Table = NdapiConstants.D2FC_DSTY_TABLE, Record = NdapiConstants.D2FC_DSTY_RECORD, Refcursor = NdapiConstants.D2FC_DSTY_REFCURSOR, Namedtype = NdapiConstants.D2FC_DSTY_NAMEDTYPE, Objectref = NdapiConstants.D2FC_DSTY_OBJECTREF, Varray = NdapiConstants.D2FC_DSTY_VARRAY, Nestedtab = NdapiConstants.D2FC_DSTY_NESTEDTAB, Blob = NdapiConstants.D2FC_DSTY_BLOB, Clob = NdapiConstants.D2FC_DSTY_CLOB, Bfile = NdapiConstants.D2FC_DSTY_BFILE } public enum CommunicationMode { Synchronous = NdapiConstants.D2FC_COMO_SYNCH, Asynchronous = NdapiConstants.D2FC_COMO_ASYNCH } public enum CoordinateSystem { Character = NdapiConstants.D2FC_COSY_CHARACTER, Real = NdapiConstants.D2FC_COSY_REAL } public enum QueryDataSourceType { None = NdapiConstants.D2FC_QRDA_NONE, Table = NdapiConstants.D2FC_QRDA_TABLE, Procedure = NdapiConstants.D2FC_QRDA_PROCEDURE, Trig = NdapiConstants.D2FC_QRDA_TRANS_TRIG, Query = NdapiConstants.D2FC_QRDA_FRM_CLS_QUERY } public enum DMLDataTargetType { None = NdapiConstants.D2FC_DMDA_NONE, Table = NdapiConstants.D2FC_DMDA_TABLE, Procedure = NdapiConstants.D2FC_DMDA_PROCEDURE, TransationalTrigger = NdapiConstants.D2FC_DMDA_TRANS_TRIG } public enum EdgeAtachmentType { Start = NdapiConstants.D2FC_PRAT_START, End = NdapiConstants.D2FC_PRAT_END, Top = NdapiConstants.D2FC_PRAT_TOP, Bottom = NdapiConstants.D2FC_PRAT_BOTTOM } public enum ExecutionMode { Batch = NdapiConstants.D2FC_EXMO_BATCH, Runtime = NdapiConstants.D2FC_EXMO_RUNTIME } public enum SourceType { Filesystem = NdapiConstants.D2FC_LISR_FS, Database = NdapiConstants.D2FC_LISR_DB } public enum UpdateLayout { Manual = NdapiConstants.D2FC_UPLA_MANUAL, Automatic = NdapiConstants.D2FC_UPLA_AUTO, Locked = NdapiConstants.D2FC_UPLA_LOCKED } public enum ItemType { ChartArea = NdapiConstants.D2FC_ITTY_CA, CheckBox = NdapiConstants.D2FC_ITTY_CB, DisplayItem = NdapiConstants.D2FC_ITTY_DI, Image = NdapiConstants.D2FC_ITTY_IM, ListItem = NdapiConstants.D2FC_ITTY_LS, ActiveX = NdapiConstants.D2FC_ITTY_ACT, OLE = NdapiConstants.D2FC_ITTY_OLE, Button = NdapiConstants.D2FC_ITTY_PB, RadioGroup = NdapiConstants.D2FC_ITTY_RD, Sound = NdapiConstants.D2FC_ITTY_SN, TextItem = NdapiConstants.D2FC_ITTY_TI, UserArea = NdapiConstants.D2FC_ITTY_UA, VBX = NdapiConstants.D2FC_ITTY_VBX, Tree = NdapiConstants.D2FC_ITTY_TRE, Bean = NdapiConstants.D2FC_ITTY_BA } public enum OleActivationStyle { Doubleclick = NdapiConstants.D2FC_OLAC_DOUBLECLICK, Manual = NdapiConstants.D2FC_OLAC_MANUAL, Focus = NdapiConstants.D2FC_OLAC_FOCUS } public enum PromptDisplayStyle { Hidden = NdapiConstants.D2FC_PRDI_HIDDEN, First = NdapiConstants.D2FC_PRDI_FIRST, Each = NdapiConstants.D2FC_PRDI_EACH } public enum ProgramUnitType { Unknown = NdapiConstants.D2FC_PGTY_UNKNOWN, Procedure = NdapiConstants.D2FC_PGTY_PROCEDURE, Function = NdapiConstants.D2FC_PGTY_FUNCTION, PackageSpecification = NdapiConstants.D2FC_PGTY_PACKAGESPEC, PackageBody = NdapiConstants.D2FC_PGTY_PACKAGEBODY } public enum RealUnit { Pixel = NdapiConstants.D2FC_REUN_PIXEL, Centimeter = NdapiConstants.D2FC_REUN_CENTIMETER, Inch = NdapiConstants.D2FC_REUN_INCH, Point = NdapiConstants.D2FC_REUN_POINT, Decipoint = NdapiConstants.D2FC_REUN_DECIPOINT } public enum RelationType { Join = NdapiConstants.D2FC_RELT_JOIN, Ref = NdapiConstants.D2FC_RELT_REF } public enum RuntimeCompatibility { Forms_45 = NdapiConstants.D2FC_RUCO_45, Forms_50 = NdapiConstants.D2FC_RUCO_50 } public enum TabAttachmentEdge { Top = NdapiConstants.D2FC_TAAT_TOP, Bottom = NdapiConstants.D2FC_TAAT_BOTTOM, Left = NdapiConstants.D2FC_TAAT_LEFT, Right = NdapiConstants.D2FC_TAAT_RIGHT, Start = NdapiConstants.D2FC_TAAT_START, End = NdapiConstants.D2FC_TAAT_END } public enum TabStyle { Chamfered = NdapiConstants.D2FC_TAST_CHAMFERED, Square = NdapiConstants.D2FC_TAST_SQUARE, Rounded = NdapiConstants.D2FC_TAST_ROUNDED } public enum VisualAttributeType { Common = NdapiConstants.D2FC_VATY_COMMON, Prompt = NdapiConstants.D2FC_VATY_PROMPT, Title = NdapiConstants.D2FC_VATY_TITLE } public enum ColumnSpecificationDataType { Char = NdapiConstants.D2FC_CODA_CHAR, Number = NdapiConstants.D2FC_CODA_NUMBER, Date = NdapiConstants.D2FC_CODA_DATE, Long = NdapiConstants.D2FC_CODA_LONG, RefObject = NdapiConstants.D2FC_CODA_REF } public enum SoundChannels { Auto = NdapiConstants.D2FC_AUCH_AUTO, Mono = NdapiConstants.D2FC_AUCH_MONO, Stereo = NdapiConstants.D2FC_AUCH_STEREO } public enum CalculationMode { None = NdapiConstants.D2FC_CAMO_NONE, Formula = NdapiConstants.D2FC_CAMO_FORMULA, Summary = NdapiConstants.D2FC_CAMO_SUMMARY } public enum CursorMode { Open = NdapiConstants.D2FC_CRMO_OPEN, Close = NdapiConstants.D2FC_CRMO_CLOSE } public enum ObjectEdgeCapStyle { Butt = NdapiConstants.D2FC_CAST_BUTT, Round = NdapiConstants.D2FC_CAST_ROUND, Projecting = NdapiConstants.D2FC_CAST_PROJECT } public enum CompressionQuality { None = NdapiConstants.D2FC_CMQL_NONE, Min = NdapiConstants.D2FC_CMQL_MIN, Low = NdapiConstants.D2FC_CMQL_LOW, Med = NdapiConstants.D2FC_CMQL_MED, High = NdapiConstants.D2FC_CMQL_HIGH, Max = NdapiConstants.D2FC_CMQL_MAX } public enum CaseRestriction { Mixed = NdapiConstants.D2FC_CARS_MIXED, Upper = NdapiConstants.D2FC_CARS_UPPER, Lower = NdapiConstants.D2FC_CARS_LOWER } public enum CanvasType { Content = NdapiConstants.D2FC_CNTY_CONTENT, Stacked = NdapiConstants.D2FC_CNTY_STACKED, VerticalToolbar = NdapiConstants.D2FC_CNTY_VTOOLBAR, HorizontalToolbar = NdapiConstants.D2FC_CNTY_HTOOLBAR, Tab = NdapiConstants.D2FC_CNTY_TAB } public enum CheckBoxOtherValues { Illegal = NdapiConstants.D2FC_CHBX_ILLEGAL, Checked = NdapiConstants.D2FC_CHBX_CHECKED, Unchecked = NdapiConstants.D2FC_CHBX_UNCHECKED } public enum LanguageDirection { Default = NdapiConstants.D2FC_LADI_DEFAULT, LeftToRight = NdapiConstants.D2FC_LADI_TORIGHT, RigthToLeft = NdapiConstants.D2FC_LADI_TOLEFT } public enum InitialKeyboardDirection { Default = NdapiConstants.D2FC_INKB_DEFAULT, Roman = NdapiConstants.D2FC_INKB_ROMAN, Native = NdapiConstants.D2FC_INKB_NATIVE } public enum ImageDepth { Orig = NdapiConstants.D2FC_IMDP_ORIG, Mono = NdapiConstants.D2FC_IMDP_MONO, Gray = NdapiConstants.D2FC_IMDP_GRAY, Lut = NdapiConstants.D2FC_IMDP_LUT, Rgb = NdapiConstants.D2FC_IMDP_RGB } public enum DashStyle { Solid = NdapiConstants.D2FC_DAST_SOLID, Dotted = NdapiConstants.D2FC_DAST_DOT, Dashed = NdapiConstants.D2FC_DAST_DASH, DashDot = NdapiConstants.D2FC_DAST_DASHDOT, DoubleDot = NdapiConstants.D2FC_DAST_DOUBDOT, LongDash = NdapiConstants.D2FC_DAST_LONGDASH, DashDoubleDot = NdapiConstants.D2FC_DAST_DASHDOUBDOT } public enum ExecutionStyle { Override = NdapiConstants.D2FC_EXHI_OVERRIDE, Before = NdapiConstants.D2FC_EXHI_BEFORE, After = NdapiConstants.D2FC_EXHI_AFTER } public enum FrameAlignment { Start = NdapiConstants.D2FC_FRAL_START, End = NdapiConstants.D2FC_FRAL_END, Center = NdapiConstants.D2FC_FRAL_CENTER, Fill = NdapiConstants.D2FC_FRAL_FILL, Column = NdapiConstants.D2FC_FRAL_COLUMN } public enum FontSpacing { Ultradense = NdapiConstants.D2FC_FOSP_ULTRADENSE, Extradense = NdapiConstants.D2FC_FOSP_EXTRADENSE, Dense = NdapiConstants.D2FC_FOSP_DENSE, Semidense = NdapiConstants.D2FC_FOSP_SEMIDENSE, Normal = NdapiConstants.D2FC_FOSP_NORMAL, Semiexpand = NdapiConstants.D2FC_FOSP_SEMIEXPAND, Expand = NdapiConstants.D2FC_FOSP_EXPAND, Extraexpand = NdapiConstants.D2FC_FOSP_EXTRAEXPAND, Ultraexpand = NdapiConstants.D2FC_FOSP_ULTRAEXPAND } public enum FontStyle { Plain = NdapiConstants.D2FC_FOST_PLAIN, Italic = NdapiConstants.D2FC_FOST_ITALIC, Oblique = NdapiConstants.D2FC_FOST_OBLIQUE, Underline = NdapiConstants.D2FC_FOST_UNDERLINE, Outline = NdapiConstants.D2FC_FOST_OUTLINE, Shadow = NdapiConstants.D2FC_FOST_SHADOW, Inverted = NdapiConstants.D2FC_FOST_INVERTED, Overstrike = NdapiConstants.D2FC_FOST_OVERSTRIKE, Blink = NdapiConstants.D2FC_FOST_BLINK } public enum FontWeight { Ultralight = NdapiConstants.D2FC_FOWG_ULTRALIGHT, Extralight = NdapiConstants.D2FC_FOWG_EXTRALIGHT, Light = NdapiConstants.D2FC_FOWG_LIGHT, Demilight = NdapiConstants.D2FC_FOWG_DEMILIGHT, Medium = NdapiConstants.D2FC_FOWG_MEDIUM, Demibold = NdapiConstants.D2FC_FOWG_DEMIBOLD, Bold = NdapiConstants.D2FC_FOWG_BOLD, Extrabold = NdapiConstants.D2FC_FOWG_EXTRABOLD, Ultrabold = NdapiConstants.D2FC_FOWG_ULTRABOLD } public enum LayoutStyle { Form = NdapiConstants.D2FC_LAST_FORM, Tabular = NdapiConstants.D2FC_LAST_TABULAR } public enum HorizontalOrigin { Left = NdapiConstants.D2FC_HOOR_LEFT, Right = NdapiConstants.D2FC_HOOR_RIGHT, Center = NdapiConstants.D2FC_HOOR_CENTER } public enum HorizontalJustification { Left = NdapiConstants.D2FC_HOJU_LEFT, Right = NdapiConstants.D2FC_HOJU_RIGHT, Center = NdapiConstants.D2FC_HOJU_CENTER, Start = NdapiConstants.D2FC_HOJU_START, End = NdapiConstants.D2FC_HOJU_END } public enum ItemDataType { Char = NdapiConstants.D2FC_DATY_CHAR, Number = NdapiConstants.D2FC_DATY_NUMBER, Date = NdapiConstants.D2FC_DATY_DATE, Alpha = NdapiConstants.D2FC_DATY_ALPHA, Integer = NdapiConstants.D2FC_DATY_INTEGER, Datetime = NdapiConstants.D2FC_DATY_DATETIME, Long = NdapiConstants.D2FC_DATY_LONG, Rnumber = NdapiConstants.D2FC_DATY_RNUMBER, Jdate = NdapiConstants.D2FC_DATY_JDATE, Edate = NdapiConstants.D2FC_DATY_EDATE, Time = NdapiConstants.D2FC_DATY_TIME, Rinteger = NdapiConstants.D2FC_DATY_RINTEGER, Money = NdapiConstants.D2FC_DATY_MONEY, Rmoney = NdapiConstants.D2FC_DATY_RMONEY, Objectref = NdapiConstants.D2FC_DATY_OBJECTREF } public enum ImageFormat { Bmp = NdapiConstants.D2FC_IMFM_BMP, Cals = NdapiConstants.D2FC_IMFM_CALS, Gif = NdapiConstants.D2FC_IMFM_GIF, Jfif = NdapiConstants.D2FC_IMFM_JFIF, Pict = NdapiConstants.D2FC_IMFM_PICT, Ras = NdapiConstants.D2FC_IMFM_RAS, Tiff = NdapiConstants.D2FC_IMFM_TIFF, Tpic = NdapiConstants.D2FC_IMFM_TPIC, Native = NdapiConstants.D2FC_IMFM_NATIVE } public enum DisplayQuality { High = NdapiConstants.D2FC_DIQL_HIGH, Medium = NdapiConstants.D2FC_DIQL_MEDIUM, Low = NdapiConstants.D2FC_DIQL_LOW } public enum ImageSizingStyle { Crop = NdapiConstants.D2FC_SIST_CROP, Adjust = NdapiConstants.D2FC_SIST_ADJUST, Fill = NdapiConstants.D2FC_SIST_FILL } public enum JoinStyle { Mitre = NdapiConstants.D2FC_JOST_MITRE, Bevel = NdapiConstants.D2FC_JOST_BEVEL, Round = NdapiConstants.D2FC_JOST_ROUND } public enum KeyMode { Unique = NdapiConstants.D2FC_KEMO_UNIQUE, Updateable = NdapiConstants.D2FC_KEMO_UPDATEABLE, NonUpdateable = NdapiConstants.D2FC_KEMO_NUPDATEABLE, Automatic = NdapiConstants.D2FC_KEMO_AUTO } public enum Alignment { Start = NdapiConstants.D2FC_ALIG_START, End = NdapiConstants.D2FC_ALIG_END, Center = NdapiConstants.D2FC_ALIG_CENTER } public enum InteractionMode { Blocking = NdapiConstants.D2FC_INMO_BLOCKING, NonBlocking = NdapiConstants.D2FC_INMO_NONBLOCKING } public enum IsolationMode { Read = NdapiConstants.D2FC_ISMO_READ, Serial = NdapiConstants.D2FC_ISMO_SERIAL } public enum LockingMode { Immediate = NdapiConstants.D2FC_LOMO_IMMEDIATE, Delayed = NdapiConstants.D2FC_LOMO_DELAYED, Automatic = NdapiConstants.D2FC_LOMO_AUTO } public enum ListStyle { Poplist = NdapiConstants.D2FC_LSST_POPLIST, Tlist = NdapiConstants.D2FC_LSST_TLIST, Combo = NdapiConstants.D2FC_LSST_COMBO } public enum ListType { RecordGroup = NdapiConstants.D2FC_LSTY_RECORDGROUP, Old = NdapiConstants.D2FC_LSTY_OLD } public enum MenuCommandType { Null = NdapiConstants.D2FC_COTY_NULL, Menu = NdapiConstants.D2FC_COTY_MENU, Plsql = NdapiConstants.D2FC_COTY_PLSQL } public enum DeleteRecordBehavior { Cascading = NdapiConstants.D2FC_DERE_CASCADING, Isolated = NdapiConstants.D2FC_DERE_ISOLATED, NonIsolated = NdapiConstants.D2FC_DERE_NON_ISOLATED } public enum MagicMenuItemType { None = NdapiConstants.D2FC_MAIT_NONE, Cut = NdapiConstants.D2FC_MAIT_CUT, Copy = NdapiConstants.D2FC_MAIT_COPY, Paste = NdapiConstants.D2FC_MAIT_PASTE, Clear = NdapiConstants.D2FC_MAIT_CLEAR, Undo = NdapiConstants.D2FC_MAIT_UNDO, Help = NdapiConstants.D2FC_MAIT_HELP, About = NdapiConstants.D2FC_MAIT_ABOUT, Quit = NdapiConstants.D2FC_MAIT_QUIT, Window = NdapiConstants.D2FC_MAIT_WINDOW, PageSetup = NdapiConstants.D2FC_MAIT_PAGESETUP } public enum MouseNavigationLimit { Form = NdapiConstants.D2FC_MONA_FORM, Block = NdapiConstants.D2FC_MONA_BLOCK, Record = NdapiConstants.D2FC_MONA_RECORD, Item = NdapiConstants.D2FC_MONA_ITEM } public enum MenuItemType { Plain = NdapiConstants.D2FC_MNIT_PLAIN, Check = NdapiConstants.D2FC_MNIT_CHECK, Radio = NdapiConstants.D2FC_MNIT_RADIO, Separator = NdapiConstants.D2FC_MNIT_SEPARATOR, Magic = NdapiConstants.D2FC_MNIT_MAGIC } public enum NavigationStyle { SameRecord = NdapiConstants.D2FC_NAST_SAMERECORD, ChangeRecord = NdapiConstants.D2FC_NAST_CHANGERECORD, ChangeBlock = NdapiConstants.D2FC_NAST_CHANGEBLOCK } public enum RecordOrientation { Vertical = NdapiConstants.D2FC_REOR_VERTICAL, Horizontal = NdapiConstants.D2FC_REOR_HORIZONTAL } public enum OleTenantTypes { Any = NdapiConstants.D2FC_OLTN_ANY, None = NdapiConstants.D2FC_OLTN_NONE, Static = NdapiConstants.D2FC_OLTN_STATIC, Linked = NdapiConstants.D2FC_OLTN_LINKED, Embedded = NdapiConstants.D2FC_OLTN_EMBEDDED, Control = NdapiConstants.D2FC_OLTN_CONTROL } public enum ParameterDataType { Char = NdapiConstants.D2FC_PADA_CHAR, Number = NdapiConstants.D2FC_PADA_NUMBER, Date = NdapiConstants.D2FC_PADA_DATE } public enum RecordGroupType { Query = NdapiConstants.D2FC_REGR_QUERY, Static = NdapiConstants.D2FC_REGR_STATIC } public enum ReadingOrder { Default = NdapiConstants.D2FC_READ_DEFAULT, LeftToRight = NdapiConstants.D2FC_READ_TORIGHT, RightToLeft = NdapiConstants.D2FC_READ_TOLEFT } public enum ReportDestinationType { Preview = NdapiConstants.D2FC_RPDE_PREVIEW, File = NdapiConstants.D2FC_RPDE_FILE, Printer = NdapiConstants.D2FC_RPDE_PRINTER, Mail = NdapiConstants.D2FC_RPDE_MAIL, Cache = NdapiConstants.D2FC_RPDE_CACHE, Screen = NdapiConstants.D2FC_RPDE_SCREEN } public enum OleResizeStyle { Clip = NdapiConstants.D2FC_OLRE_CLIP, Scale = NdapiConstants.D2FC_OLRE_SCALE, Initial = NdapiConstants.D2FC_OLRE_INITIAL, Dynamic = NdapiConstants.D2FC_OLRE_DYNAMIC } public enum SoundCompression { Auto = NdapiConstants.D2FC_COMP_AUTO, Off = NdapiConstants.D2FC_COMP_OFF, On = NdapiConstants.D2FC_COMP_ON } public enum SoundFormat { Au = NdapiConstants.D2FC_SNFM_AU, Aiff = NdapiConstants.D2FC_SNFM_AIFF, C = NdapiConstants.D2FC_SNFM_AIFF_C, Wave = NdapiConstants.D2FC_SNFM_WAVE } public enum SoundQuality { Auto = NdapiConstants.D2FC_SNQL_AUTO, Highest = NdapiConstants.D2FC_SNQL_HIGHEST, High = NdapiConstants.D2FC_SNQL_HIGH, Medium = NdapiConstants.D2FC_SNQL_MEDIUM, Low = NdapiConstants.D2FC_SNQL_LOW, Lowest = NdapiConstants.D2FC_SNQL_LOWEST } public enum ScrollBarOrientation { Vertical = NdapiConstants.D2FC_SCOR_VERTICAL, Horizontal = NdapiConstants.D2FC_SCOR_HORIZONTAL } public enum ScrollBarAlignment { Start = NdapiConstants.D2FC_SCAL_START, End = NdapiConstants.D2FC_SCAL_END } public enum LineSpacing { Single = NdapiConstants.D2FC_LISP_SINGLE, OneAndAHalf = NdapiConstants.D2FC_LISP_ONEHALF, Double = NdapiConstants.D2FC_LISP_DOUBLE, Custom = NdapiConstants.D2FC_LISP_CUSTOM } public enum SummaryFunction { None = NdapiConstants.D2FC_SUFU_NONE, Avg = NdapiConstants.D2FC_SUFU_AVG, Count = NdapiConstants.D2FC_SUFU_COUNT, Max = NdapiConstants.D2FC_SUFU_MAX, Min = NdapiConstants.D2FC_SUFU_MIN, Stddev = NdapiConstants.D2FC_SUFU_STDDEV, Sum = NdapiConstants.D2FC_SUFU_SUM, Var = NdapiConstants.D2FC_SUFU_VAR } public enum OleTenantAspect { Content = NdapiConstants.D2FC_OLET_CONTENT, Icon = NdapiConstants.D2FC_OLET_ICON, Thumbnail = NdapiConstants.D2FC_OLET_THUMBNAIL } public enum TriggerStyle { PLSQL = NdapiConstants.D2FC_TRST_PLSQL, V2 = NdapiConstants.D2FC_TRST_V2 } public enum VerticalOrigin { Top = NdapiConstants.D2FC_VEOR_TOP, Center = NdapiConstants.D2FC_VEOR_CENTER, Bottom = NdapiConstants.D2FC_VEOR_BOTTOM } public enum VerticalJustification { Top = NdapiConstants.D2FC_VEJU_TOP, Center = NdapiConstants.D2FC_VEJU_CENTER, Bottom = NdapiConstants.D2FC_VEJU_BOTTOM } public enum KeyboardState { Any = NdapiConstants.D2FC_KBST_ANY, Roman = NdapiConstants.D2FC_KBST_ROMAN, Native = NdapiConstants.D2FC_KBST_NATIVE } public enum ValidationUnit { Default = NdapiConstants.D2FC_VAUN_DEFAULT, Form = NdapiConstants.D2FC_VAUN_FORM, Block = NdapiConstants.D2FC_VAUN_BLOCK, Record = NdapiConstants.D2FC_VAUN_RECORD, Item = NdapiConstants.D2FC_VAUN_ITEM } public enum WrapStyle { None = NdapiConstants.D2FC_WRST_NONE, Character = NdapiConstants.D2FC_WRST_CHARACTER, Word = NdapiConstants.D2FC_WRST_WORD } public enum WindowStyle { Document = NdapiConstants.D2FC_WIST_DOCUMENT, Dialog = NdapiConstants.D2FC_WIST_DIALOG } public enum FrameTitleAlignment { Left = NdapiConstants.D2FC_JUST_LEFT, Right = NdapiConstants.D2FC_JUST_RIGHT, Center = NdapiConstants.D2FC_JUST_CENTER, Start = NdapiConstants.D2FC_JUST_START, End = NdapiConstants.D2FC_JUST_END } public enum PropertyType { Unknown = NdapiConstants.D2FP_TYP_UNKNOWN, Boolean = NdapiConstants.D2FP_TYP_BOOLEAN, Number = NdapiConstants.D2FP_TYP_NUMBER, Text = NdapiConstants.D2FP_TYP_TEXT, Object = NdapiConstants.D2FP_TYP_OBJECT } public enum CursorStyle { Unspecified = NdapiConstants.D2FC_CURSOR_STYLE_UNSPECIFIED, Busy = NdapiConstants.D2FC_CURSOR_STYLE_BUSY, Crosshair = NdapiConstants.D2FC_CURSOR_STYLE_CROSSHAIR, DefaultCursor = NdapiConstants.D2FC_CURSOR_STYLE_DEFAULT, Insertion = NdapiConstants.D2FC_CURSOR_STYLE_INSERTION, Hand = NdapiConstants.D2FC_CURSOR_STYLE_HAND, Move = NdapiConstants.D2FC_CURSOR_STYLE_MOVE, NorthResize = NdapiConstants.D2FC_CURSOR_STYLE_NRESIZE, SouthResize = NdapiConstants.D2FC_CURSOR_STYLE_SRESIZE, EastResize = NdapiConstants.D2FC_CURSOR_STYLE_ERESIZE, WestResize = NdapiConstants.D2FC_CURSOR_STYLE_WRESIZE, NortheastResize = NdapiConstants.D2FC_CURSOR_STYLE_NERESIZE, Northwestresize = NdapiConstants.D2FC_CURSOR_STYLE_NWRESIZE, SoutheastResize = NdapiConstants.D2FC_CURSOR_STYLE_SERESIZE, SouthwestResize = NdapiConstants.D2FC_CURSOR_STYLE_SWRESIZE } public enum GradientStartSide { None = NdapiConstants.D2FC_GRADIENT_NONE, Left = NdapiConstants.D2FC_GRADIENT_LEFT, Top = NdapiConstants.D2FC_GRADIENT_TOP, Right = NdapiConstants.D2FC_GRADIENT_RIGHT, Bottom = NdapiConstants.D2FC_GRADIENT_BOTTOM } public enum EventType { Database = NdapiConstants.D2FC_EVENT_TYPE_DATABASE, UserDefined = NdapiConstants.D2FC_EVENT_TYPE_USERDEFINED, SystemIdle = NdapiConstants.D2FC_EVENT_TYPE_SYSTEMIDLE, SystemDbIdle = NdapiConstants.D2FC_EVENT_TYPE_SYSTEMDBIDLE, SystemLogout = NdapiConstants.D2FC_EVENT_TYPE_SYSTEMLOGOUT, SystemEmPing = NdapiConstants.D2FC_EVENT_TYPE_SYSTEMEMPING, SystemMediaDone = NdapiConstants.D2FC_EVENT_TYPE_SYSTEMMEDIADONE } public enum EventScope { Application = NdapiConstants.D2FC_EVENT_SCOPE_APPLICATION, Form = NdapiConstants.D2FC_EVENT_SCOPE_FORM } public enum EventViewMode { Browse = NdapiConstants.D2FC_EVENT_VIEW_MODE_BROWSE, Locked = NdapiConstants.D2FC_EVENT_VIEW_MODE_LOCKED, Remove = NdapiConstants.D2FC_EVENT_VIEW_MODE_REMOVE } }
using SFA.DAS.Assessor.Functions.Domain.Interfaces; using SFA.DAS.Assessor.Functions.Domain.Print.Types; namespace SFA.DAS.Assessor.Functions.Domain.Print.Interfaces { public interface IPrintRequestCommand : IQueueCommand<CertificatePrintStatusUpdateMessage> { } }
public enum TileType { None, Normal, Grass, Ice, Bumper, Plateform }
using Common.Http.Interface; using Common.Http.Wrapper; using System.Net; namespace Common.Http { public class HttpWebRequestFactory : IHttpWebRequestFactory { public IHttpWebRequest Create(string uri) { return new WrapHttpWebRequest((HttpWebRequest)WebRequest.Create(uri)); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace HandDVR { public class BioIKTarget : MonoBehaviour { public Transform HandBone; public Transform HandPosition; public Transform Finger; public float HandScale; void LateUpdate() { Vector3 pos = (Finger.position - HandPosition.position) * HandScale + HandPosition.position; transform.position = HandBone.position - HandPosition.position + pos; } } }
using System.Text.RegularExpressions; namespace IxMilia.Dxf { internal class DxfEncodingHelper { private static readonly Regex DxfCodePagePattern = new Regex(@"^ANSI_(\d+)$", RegexOptions.IgnoreCase); public static bool TryParseEncoding(string encodingName, out int codePage) { var match = DxfCodePagePattern.Match(encodingName); if (match.Success && match.Groups.Count >= 2 && int.TryParse(match.Groups[1].Value, out codePage)) { return true; } codePage = 0; return false; } } }
using UnityEngine; using UnityEditor; namespace Community.UI { #if UNITY_EDITOR ///----------------------------------------------------------------------- /// <copyright file="ReadOnlyAttribute.cs"> /// Code by andyman from Unity Answers: /// http://answers.unity3d.com/questions/489942/how-to-make-a-readonly-property-in-inspector.html /// </copyright> /// <author>It3ration</author> ///----------------------------------------------------------------------- /// <summary> /// Makes a field read-only in the Unity editor with <code>[ReadOnly]</code>. /// </summary> public class ReadOnlyAttribute : PropertyAttribute { } ///----------------------------------------------------------------------- /// <copyright file="ReadOnlyAttribute.cs"> /// Code by andyman from Unity Answers: /// http://answers.unity3d.com/questions/489942/how-to-make-a-readonly-property-in-inspector.html /// </copyright> /// <author>It3ration</author> ///----------------------------------------------------------------------- /// <summary> /// Makes a field read-only in the Unity editor with <code>[ReadOnly]</code>. /// </summary> [CustomPropertyDrawer(typeof(ReadOnlyAttribute))] public class ReadOnlyDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { GUI.enabled = false; EditorGUI.PropertyField(position, property, label, true); GUI.enabled = true; } public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { return EditorGUI.GetPropertyHeight(property, label, true); } } #endif }
@model dynamic <a asp-action="Edit" asp-controller="Admin" asp-route-id="@Model.Name" class="btn btn-primary btn-sm">@T["Edit"]</a> <a asp-action="Delete" asp-controller="Admin" asp-route-id="@Model.Name" class="btn btn-danger btn-sm" itemprop="RemoveUrl UnsafeUrl">@T["Delete"]</a>
using Microsoft.EntityFrameworkCore; using Secure.SecurityDoors.Data.Enums; using Secure.SecurityDoors.Data.Models; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; namespace Secure.SecurityDoors.Logic.Specifications { /// <summary> /// DoorReader specification. /// </summary> [ExcludeFromCodeCoverage] public static class DoorReaderSpecification { /// <summary> /// DoorReader query with no tracking. /// </summary> /// <param name="doorReaderDbSet">Database set of DoorReader.</param> /// <param name="withNoTracking">With no tracking.</param> /// <returns>DoorReader query.</returns> public static IQueryable<DoorReader> GetDoorReaderQuery( this DbSet<DoorReader> doorReaderDbSet, bool withNoTracking) => withNoTracking ? doorReaderDbSet.AsNoTracking() : doorReaderDbSet; /// <summary> /// Apply includes for DoorReaderQuery. /// </summary> /// <param name="doorReaderQuery">Query.</param> /// <param name="includes">Array of includes.</param> /// <returns>DoorReader query.</returns> public static IQueryable<DoorReader> Includes( this IQueryable<DoorReader> doorReaderQuery, string[] includes) { if (includes.Contains(nameof(DoorReader.Door))) { doorReaderQuery = doorReaderQuery .Include(doorReader => doorReader.Door); } return doorReaderQuery; } /// <summary> /// Apply filter by serial number. /// </summary> /// <param name="doorReaderQuery">Query.</param> /// <param name="serialNumbers">Serial numbers filter.</param> /// <returns>Card query.</returns> public static IQueryable<DoorReader> ApplyFilterBySerialNumbers( this IQueryable<DoorReader> doorReaderQuery, IList<string> serialNumbers) => serialNumbers is not null && serialNumbers.Any() ? doorReaderQuery.Where(doorReader => serialNumbers.Contains(doorReader.SerialNumber)) : doorReaderQuery; /// <summary> /// Apply filter by door reader type. /// </summary> /// <param name="doorReaderQuery">Query.</param> /// <param name="typeFilter">Type filter.</param> /// <returns>DoorReader query.</returns> public static IQueryable<DoorReader> ApplyFilterByType( this IQueryable<DoorReader> doorReaderQuery, DoorReaderType? typeFilter) => typeFilter.HasValue ? doorReaderQuery.Where(doorReader => doorReader.Type == typeFilter) : doorReaderQuery; } }
namespace PhilipDaubmeier.DigitalstromClient.Model.Structure { public class StructureResponse : IWiremessagePayload { public Apartment Apartment { get; set; } = new Apartment(); } }
using System; namespace Sunburst.Win32UI.Interop { public struct LOGBRUSH { public uint lbStyle; public int lbColor; public IntPtr lbHatch; } }
// Copyright (c) Arun Mahapatra. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Noted.Extensions.Libraries.Kindle { using System; using Noted.Core.Models; public class Clipping { public Clipping() => this.PageNumber = -1; public string Book { get; set; } = null!; public string Author { get; set; } = null!; public ClippingType Type { get; set; } public int PageNumber { get; set; } public LineLocation Location { get; set; } public DateTime CreationDate { get; set; } public string Content { get; set; } = null!; } }
namespace Dissonance.Engine.Graphics { public enum CullMode { Off, Front = 1028, Back = 1029, Both = 1032 } }
using System; using System.Collections.Generic; using System.Data; using System.Data.SQLite; using System.Windows.Forms; namespace DAL { class SQLiteDatabase { String dbConnection; // Default Constructor for SQLiteDatabase Class. public SQLiteDatabase() { dbConnection = "Data Source= DataBase/SignToLearn.s3db"; } /// Allows the programmer to run a query against the Database. public DataTable GetDataTable(string sql) { DataTable dt = new DataTable(); try { SQLiteConnection cnn = new SQLiteConnection(dbConnection); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); mycommand.CommandText = sql; SQLiteDataReader reader = mycommand.ExecuteReader(); dt.Load(reader); reader.Close(); cnn.Close(); } catch (Exception e) { throw new Exception(e.Message); } return dt; } /// Allows the programmer to interact with the database for purposes other than a query. public int ExecuteNonQuery(string sql) { SQLiteConnection cnn = new SQLiteConnection(dbConnection); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); mycommand.CommandText = sql; int rowsUpdated = mycommand.ExecuteNonQuery(); cnn.Close(); return rowsUpdated; } /// Allows the programmer to retrieve single items from the DB. public string ExecuteScalar(string sql) { SQLiteConnection cnn = new SQLiteConnection(dbConnection); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); mycommand.CommandText = sql; object value = mycommand.ExecuteScalar(); cnn.Close(); if (value != null) { return value.ToString(); } return ""; } /// Allows the programmer to easily update rows in the DB. public bool Update(String tableName, Dictionary<String, String> data, String where) { String vals = ""; Boolean returnCode = true; if (data.Count >= 1) { foreach (KeyValuePair<String, String> val in data) { vals += String.Format(" {0} = '{1}',", val.Key.ToString(), val.Value.ToString()); } vals = vals.Substring(0, vals.Length - 1); } try { this.ExecuteNonQuery(String.Format("update {0} set {1} where {2};", tableName, vals, where)); } catch { returnCode = false; } return returnCode; } /// Allows the programmer to easily delete rows from the DB. public bool Delete(String tableName, String where) { Boolean returnCode = true; try { this.ExecuteNonQuery(String.Format("delete from {0} where {1};", tableName, where)); } catch (Exception fail) { MessageBox.Show(fail.Message); returnCode = false; } return returnCode; } /// Allows the programmer to easily insert into the DB public bool Insert(String tableName, Dictionary<String, String> data) { String columns = ""; String values = ""; Boolean returnCode = true; foreach (KeyValuePair<String, String> val in data) { columns += String.Format(" {0},", val.Key.ToString()); values += String.Format(" '{0}',", val.Value); } columns = columns.Substring(0, columns.Length - 1); values = values.Substring(0, values.Length - 1); try { this.ExecuteNonQuery(String.Format("insert into {0}({1}) values({2});", tableName, columns, values)); } catch (Exception fail) { MessageBox.Show(fail.Message); returnCode = false; } return returnCode; } /// Allows the programmer to easily delete all data from the DB. public bool ClearDB() { DataTable tables; try { tables = this.GetDataTable("select NAME from SQLITE_MASTER where type='table' order by NAME;"); foreach (DataRow table in tables.Rows) { this.ClearTable(table["NAME"].ToString()); } return true; } catch { return false; } } /// Allows the user to easily clear all data from a specific table. public bool ClearTable(String table) { try { this.ExecuteNonQuery(String.Format("delete from {0};", table)); return true; } catch { return false; } } } }
using System; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using JetBrains.Annotations; namespace ldy985.BinaryReaderExtensions { /// <summary>Extension methods for <see cref="BinaryReader" />.</summary> public static partial class BinaryReaderExtensions { /// <summary>Reads a structure (see Remarks).</summary> /// <param name="reader">The <see cref="BinaryReader" /> to read from.</param> /// <typeparam name="T">Structure type.</typeparam> /// <returns>The structure read.</returns> /// <exception cref="ArgumentNullException"><paramref name="reader" /> is <c>null</c>.</exception> /// <remarks> /// The structure will be read using <see cref="Marshal.SizeOf{T}()" /> and /// <see cref="Marshal.PtrToStructure{T}(System.IntPtr)" />. /// </remarks> /// <exception cref="IOException"></exception> /// <exception cref="ObjectDisposedException"></exception> [MustUseReturnValue] public static T ReadStruct<T>(this BinaryReader reader) where T : struct { int size = Marshal.SizeOf<T>(); byte[] data = reader.ReadBytes(size); return Unsafe.ReadUnaligned<T>(ref data[0]); } } }
namespace Lounge.Services.Users.Models.ConnectionEntities { public class ModelConstants { public class Connection { public const int MaxNotesLength = 24; } } }
using System; namespace Com.Game.Data { [Serializable] public class SysSkillDescVo { public string unikey; public string skill_id; public string 不解析; public int effect_num; public string effect_desc1; public string effect_num1; public string effect_desc2; public string effect_num2; public string effect_desc3; public string effect_num3; public string effect_desc4; public string effect_num4; public string effect_desc5; public string effect_num5; public string coefficient; } }
using System; using System.Collections.Generic; namespace Plus.Domain.Entities { /// <summary> /// Entity /// </summary> [Serializable] public abstract class Entity : Entity<int>, IEntity { } /// <summary> /// Entity /// </summary> /// <typeparam name="TPrimaryKey"></typeparam> [Serializable] public abstract class Entity<TPrimaryKey> : IEntity<TPrimaryKey> { public virtual TPrimaryKey Id { get; set; } public virtual bool IsTransient() { return EqualityComparer<TPrimaryKey>.Default.Equals(Id, default); } public override bool Equals(object obj) { if (obj == null || !(obj is Entity<TPrimaryKey>)) { return false; } if (ReferenceEquals(this, obj)) { return true; } Entity<TPrimaryKey> entity = (Entity<TPrimaryKey>)obj; if (IsTransient() && entity.IsTransient()) { return false; } Type type = GetType(); Type type2 = entity.GetType(); if (!type.IsAssignableFrom(type2) && !type2.IsAssignableFrom(type)) { return false; } return Id.Equals(entity.Id); } public override int GetHashCode() { return Id.GetHashCode(); } public static bool operator ==(Entity<TPrimaryKey> left, Entity<TPrimaryKey> right) { if (Equals(left, null)) { return Equals(right, null); } return left.Equals(right); } public static bool operator !=(Entity<TPrimaryKey> left, Entity<TPrimaryKey> right) { return !(left == right); } public override string ToString() { return $"[{GetType().Name} {Id}]"; } } }
using Android.Graphics; namespace Microsoft.Band.Tiles.Pages { public partial class Icon { public Color Color { get { return new Color(GetColor()); } set { SetColor(value); } } public ElementColorSource ColorSource { get { return GetColorSource(); } set { SetColorSource(value); } } } }
using NUnit.Framework; using Pixelator.Api.Codec.Layout.Padding; namespace Pixelator.Api.Tests.Codec.Layout.Padding { [TestFixture] class IsoPaddingTest : PaddingTest { protected override Api.Codec.Layout.Padding.Padding Padding { get { return new IsoPadding(); } } protected override bool PaddingIsStructured { get { return true; } } } }
using System.Linq; using PhotoShare.Client.Core.Dtos; using PhotoShare.Models; using PhotoShare.Services.Contracts; namespace PhotoShare.Client.Core.Commands { using System; using Contracts; public class AddFriendCommand : ICommand { private readonly IUserService userService; public AddFriendCommand(IUserService userService) { this.userService = userService; } // AddFriend <username1> <username2> public string Execute(string[] data) { var username = data[0]; var friendUsername = data[1]; var userExists = this.userService.Exists(username); var friendExistrs = this.userService.Exists(friendUsername); if (!userExists) { throw new ArgumentException($"{username} not found!"); } if (!friendExistrs) { throw new ArgumentException($"{friendUsername} not found!"); } var user = this.userService.ByUsername<UserFriendsDto>(username); var friend = this.userService.ByUsername<UserFriendsDto>(friendUsername); var isSentRequestFromFriend = friend.Friends.Any(n => n.Username == user.Username); var isSentRequestFromUser = user.Friends.Any(n => n.Username == friend.Username); if (isSentRequestFromFriend && isSentRequestFromUser) { throw new ArgumentException($"{friend.Username} is already a friend to {user.Username}"); } else if (isSentRequestFromUser && !isSentRequestFromFriend) { throw new InvalidOperationException("Request is already send!"); } else if (isSentRequestFromFriend && !isSentRequestFromUser) { throw new InvalidOperationException("Request is already send!"); } this.userService.AddFriend(user.Id, friend.Id); return $"Friend {friend.Username} added to {user.Username}"; } } }
using System; using System.Linq; using ReMi.BusinessEntities.Exceptions; using ReMi.BusinessLogic.ReleasePlan; using ReMi.Commands.Metrics; using ReMi.Commands.ReleaseCalendar; using ReMi.Commands.ReleasePlan; using ReMi.Contracts.Cqrs.Commands; using ReMi.Contracts.Cqrs.Events; using ReMi.DataAccess.BusinessEntityGateways.ReleaseCalendar; using ReMi.Events.ReleaseCalendar; namespace ReMi.CommandHandlers.ReleaseCalendar { public class BookReleaseWindowHandler : IHandleCommand<BookReleaseWindowCommand> { public Func<IReleaseWindowGateway> ReleaseWindowGatewayFactory { get; set; } public ICommandDispatcher CommandDispatcher { get; set; } public IPublishEvent EventPublisher { get; set; } public IReleaseWindowOverlappingChecker ReleaseWindowOverlappingChecker { get; set; } public IReleaseWindowHelper ReleaseWindowHelper { get; set; } public void Handle(BookReleaseWindowCommand command) { var releaseWindow = command.ReleaseWindow; if (releaseWindow.Products.Count() != 1 && !ReleaseWindowHelper.IsMaintenance(releaseWindow)) { throw new ApplicationException("Only maintenance windows can have multiple products"); } using (var releaseWindowGateway = ReleaseWindowGatewayFactory()) { var overlapped = ReleaseWindowOverlappingChecker.FindOverlappedWindow(command.ReleaseWindow); if (overlapped != null) { throw new ReleaseAlreadyBookedException(overlapped, releaseWindow.StartTime); } releaseWindow.OriginalStartTime = releaseWindow.StartTime; releaseWindowGateway.Create(releaseWindow, command.CommandContext.UserId); EventPublisher.Publish(new ReleaseWindowBookedEvent { ReleaseWindow = releaseWindow }); CommandDispatcher.Send(new CreateCheckListCommand { ReleaseWindowId = releaseWindow.ExternalId }); CommandDispatcher.Send(new CreateReleaseMetricsCommand { ReleaseWindow = releaseWindow }); } } } }
using System.ComponentModel; namespace LinqAn.Google.Metrics { /// <summary> /// The total revenue from purchased product items. /// </summary> [Description("The total revenue from purchased product items.")] public class ItemRevenue: Metric<decimal> { /// <summary> /// Instantiates a <seealso cref="ItemRevenue" />. /// </summary> public ItemRevenue(): base("Product Revenue",true,"ga:itemRevenue") { } } }
using UnityEngine; using UnityEngine.Events; using System; namespace Leap.Unity.Interaction { /** * Add an InteractionHandEvents component to an interactable object to expose * standard Unity event dispatchers for the onHandGrasp and onHandRelease events. * The events become accessible in the Unity inspector panel where you can hook * up the events to call the functions of other scripts. * * OnHandGrasp is dispatched when a hand grasps the interactable object. * * OnHandRelease is dispatched when a hand releases the object. * * Both events include the Leap.Hand object involved in the event. * * Contrast these events with those defined by the InteractionGraspEvents component, * which are dispatched whenever the object changes from a grasped state to an * ungrasped state or vice versa, taking multiple simultaneous grasps into account. * @since 4.1.4 */ [RequireComponent(typeof(InteractionBehaviourBase))] public class InteractionHandEvents : MonoBehaviour { /** Extends UnityEvent to provide hand related events containing a Leap.Hand parameter. */ [Serializable] public class HandEvent : UnityEvent<Hand> { } /** * Dispatched when a hand grasps the interactable object. * @since 4.1.4 */ public HandEvent onHandGrasp; /** * Dispatched when a hand releases the object. * @since 4.1.4 */ public HandEvent onHandRelease; private InteractionBehaviourBase _interactionBehaviour; void Awake() { _interactionBehaviour = GetComponent<InteractionBehaviourBase>(); if (_interactionBehaviour != null) { _interactionBehaviour.OnHandGraspedEvent += onHandGrasp.Invoke; _interactionBehaviour.OnHandReleasedEvent += onHandRelease.Invoke; } } void OnDestroy() { if (_interactionBehaviour != null) { _interactionBehaviour.OnHandGraspedEvent -= onHandGrasp.Invoke; _interactionBehaviour.OnHandReleasedEvent -= onHandRelease.Invoke; } } } }
//TODO: License for samples/tutorials ??? namespace FoundationDB.Samples.Benchmarks { using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.IO; using System.Threading; using System.Threading.Tasks; using Doxense.Mathematics.Statistics; using FoundationDB.Client; public class SamplerTest : IAsyncTest { public SamplerTest(double ratio) { this.Ratio = ratio; } public double Ratio { get; } #region IAsyncTest... public string Name { get { return "SamplerTest"; } } private static string FormatSize(long size) { if (size < 10000) return size.ToString("N0"); double x = size / 1024.0; if (x < 800) return x.ToString("N1") + " kB"; x /= 1024.0; if (x < 800) return x.ToString("N2") + " MB"; x /= 1024.0; return x.ToString("N2") + " GB"; } public async Task Run(IFdbDatabase db, TextWriter log, CancellationToken ct) { // estimate the number of machines... Console.WriteLine("# Detecting cluster topology..."); var servers = await db.QueryAsync(tr => tr .WithReadAccessToSystemKeys() .GetRange(KeyRange.StartsWith(Fdb.System.ServerList)) .Select(kvp => new { Node = kvp.Value.Substring(8, 16).ToHexaString(), Machine = kvp.Value.Substring(24, 16).ToHexaString(), DataCenter = kvp.Value.Substring(40, 16).ToHexaString() }), ct ); var numNodes = servers.Select(s => s.Node).Distinct().Count(); var numMachines = servers.Select(s => s.Machine).Distinct().Count(); var numDCs = servers.Select(s => s.DataCenter).Distinct().Count(); Console.WriteLine("# > Found " + numNodes + " process(es) on " + numMachines + " machine(s) in " + numDCs + " datacenter(s)"); Console.WriteLine("# Reading list of shards..."); // dump keyServers var ranges = await Fdb.System.GetChunksAsync(db, FdbKey.MinValue, FdbKey.MaxValue, ct); Console.WriteLine("# > Found " + ranges.Count + " shards:"); // take a sample var rnd = new Random(1234); int sz = Math.Max((int)Math.Ceiling(this.Ratio * ranges.Count), 1); if (sz > 500) sz = 500; //SAFETY if (sz < 50) sz = Math.Max(sz, Math.Min(50, ranges.Count)); var samples = new List<KeyRange>(); for (int i = 0; i < sz; i++) { int p = rnd.Next(ranges.Count); samples.Add(ranges[p]); ranges.RemoveAt(p); } Console.WriteLine("# Sampling " + sz + " out of " + ranges.Count + " shards (" + (100.0 * sz / ranges.Count).ToString("N1") + "%) ..."); Console.WriteLine("{0,9}{1,10}{2,10}{3,10} : K+V size distribution", "Count", "Keys", "Values", "Total"); var rangeOptions = new FdbRangeOptions { Mode = FdbStreamingMode.WantAll }; samples = samples.OrderBy(x => x.Begin).ToList(); long total = 0; int workers = Math.Min(numMachines, 8); var sw = Stopwatch.StartNew(); var tasks = new List<Task>(); while(samples.Count > 0) { while (tasks.Count < workers && samples.Count > 0) { var range = samples[0]; samples.RemoveAt(0); tasks.Add(Task.Run(async () => { var hh = new RobustHistogram(RobustHistogram.TimeScale.Ticks); #region Method 1: get_range everything... using (var tr = await db.BeginTransactionAsync(ct)) { long keySize = 0; long valueSize = 0; long count = 0; int iter = 0; var beginSelector = KeySelector.FirstGreaterOrEqual(range.Begin); var endSelector = KeySelector.FirstGreaterOrEqual(range.End); while (true) { FdbRangeChunk data = default(FdbRangeChunk); FdbException error = null; try { data = await tr.Snapshot.GetRangeAsync( beginSelector, endSelector, rangeOptions, iter ).ConfigureAwait(false); } catch (FdbException e) { error = e; } if (error != null) { await tr.OnErrorAsync(error.Code).ConfigureAwait(false); continue; } if (data.Count == 0) break; count += data.Count; foreach (var kvp in data) { keySize += kvp.Key.Count; valueSize += kvp.Value.Count; hh.Add(TimeSpan.FromTicks(kvp.Key.Count + kvp.Value.Count)); } if (!data.HasMore) break; beginSelector = KeySelector.FirstGreaterThan(data.Last); ++iter; } long totalSize = keySize + valueSize; Interlocked.Add(ref total, totalSize); Console.WriteLine("{0,9}{1,10}{2,10}{3,10} : {4}", count.ToString("N0"), FormatSize(keySize), FormatSize(valueSize), FormatSize(totalSize), hh.GetDistribution(begin: 1, end: 10000, fold:2)); } #endregion #region Method 2: estimate the count using key selectors... //long counter = await Fdb.System.EstimateCountAsync(db, range, ct); //Console.WriteLine("COUNT = " + counter.ToString("N0")); #endregion }, ct)); } var done = await Task.WhenAny(tasks); tasks.Remove(done); } await Task.WhenAll(tasks); sw.Stop(); Console.WriteLine("> Sampled " + FormatSize(total) + " (" + total.ToString("N0") + " bytes) in " + sw.Elapsed.TotalSeconds.ToString("N1") + " sec"); Console.WriteLine("> Estimated total size is " + FormatSize(total * ranges.Count / sz)); } #endregion } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; namespace Develappers.BillomatNet.Queries { public class SupplierFilter { public string Name { get; set; } public string Email { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string CountryCode { get; set; } public string CreditorIdentifier { get; set; } public string Note { get; set; } public string ClientNumber { get; set; } public List<int> PurchaseInvoiceIds { get; set; } public List<string> Tags { get; set; } } }
using System; using System.Windows.Input; namespace BrightSharp.Commands { public class RelayCommand : ICommand { private readonly Action _methodToExecute; private readonly Action<object> _methodToExecuteWithParam; private readonly Func<object, bool> _canExecuteEvaluator; public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public RelayCommand(Action<object> methodToExecute, Func<object, bool> canExecuteEvaluator = null) { _methodToExecuteWithParam = methodToExecute; _canExecuteEvaluator = canExecuteEvaluator; } public RelayCommand(Action methodToExecute) { _methodToExecute = methodToExecute; } public bool CanExecute(object parameter) { if (_canExecuteEvaluator == null) return true; else return _canExecuteEvaluator.Invoke(parameter); } public void Execute(object parameter) { _methodToExecuteWithParam?.Invoke(parameter); _methodToExecute?.Invoke(); } } public class RelayCommand<T> : ICommand where T : class { private readonly Action<T> _methodToExecuteWithParam; private readonly Func<T, bool> _canExecuteEvaluator; public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } public RelayCommand(Action<T> methodToExecute, Func<T, bool> canExecuteEvaluator = null) { _methodToExecuteWithParam = methodToExecute; _canExecuteEvaluator = canExecuteEvaluator; } public bool CanExecute(object parameter) { if (_canExecuteEvaluator == null) return true; return _canExecuteEvaluator.Invoke(parameter as T); } public void Execute(object parameter) { _methodToExecuteWithParam?.Invoke(parameter as T); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Log4Pro.IS.TRM.DAL { /// <summary> /// Csomagolási egység státusz /// </summary> public enum PackagingUnitStatus { /// <summary> /// Létrehozva /// </summary> Created, /// <summary> /// Kitárolva /// </summary> PutOut, /// <summary> /// Kanbanállványon /// </summary> OnKanban, /// <summary> /// Termelésben /// </summary> InProduction, } }
using System.Collections.Generic; using System.Linq; using HearthDb.Enums; namespace HearthDb.Deckstrings { public class Deck { /// <summary> /// DbfId of the hero. Required. /// This can be a specific hero for a class, i.e. Medivh over Jaina. /// </summary> public int HeroDbfId { get; set; } /// <summary> /// Dictionary of (DbfId, Count) for each card. /// Needs to be a total of 30 cards to be accepted by Hearthstone. /// </summary> public Dictionary<int, int> CardDbfIds { get; set; } = new Dictionary<int, int>(); /// <summary> /// Format of the deck. Required. /// </summary> public FormatType Format { get; set; } /// <summary> /// Year of the deck format. Optional. /// </summary> public ZodiacYear ZodiacYear { get; set; } /// <summary> /// Name of the deck. Optional. /// </summary> public string Name { get; set; } /// <summary> /// Hearthstones internal ID of the deck. Optional. /// </summary> public long DeckId { get; set; } /// <summary> /// Gets the card object for the given HeroDbfId /// </summary> public Card GetHero() => Cards.GetFromDbfId(HeroDbfId, false); /// <summary> /// Converts (DbfId, Count) dictionary to (CardObject, Count). /// </summary> public Dictionary<Card, int> GetCards() => CardDbfIds .Select(x => new { Card = Cards.GetFromDbfId(x.Key), Count = x.Value }) .Where(x => x.Card != null).ToDictionary(x => x.Card, x => x.Count); } }
using System; using System.Collections.Generic; using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Threading; using Consolonia.Core.Drawing.PixelBuffer; using Consolonia.Core.Dummy; namespace Consolonia.Core.Infrastructure { internal class ConsoleWindow : IWindowImpl { private readonly IConsole _console; private readonly IKeyboardDevice _myKeyboardDevice; internal readonly List<Rect> InvalidatedRects = new(50); private IInputRoot _inputRoot; public ConsoleWindow() { _myKeyboardDevice = AvaloniaLocator.Current.GetService<IKeyboardDevice>(); _console = AvaloniaLocator.Current.GetService<IConsole>(); _console.Resized += OnConsoleOnResized; _console.KeyPress += ConsoleOnKeyPress; } private void OnConsoleOnResized() { PixelBufferSize pixelBufferSize = _console.Size; var size = new Size(pixelBufferSize.Width, pixelBufferSize.Height); Resized(size, PlatformResizeReason.Unspecified); //todo; Invalidate(new Rect(size)); } public void Dispose() { Closed?.Invoke(); _console.Resized -= OnConsoleOnResized; _console.KeyPress -= ConsoleOnKeyPress; _console.Dispose(); } public IRenderer CreateRenderer(IRenderRoot root) { /*return new X11ImmediateRendererProxy(root, AvaloniaLocator.Current.GetService<IRenderLoop>()) { DrawDirtyRects = false, DrawFps = false };*/ return new AdvancedDeferredRenderer(root, AvaloniaLocator.Current.GetService<IRenderLoop>()) { RenderRoot = this // RenderOnlyOnRenderThread = true }; } public void Invalidate(Rect rect) { if (rect.IsEmpty) return; InvalidatedRects.Add(rect); /* This is the code for drawing invalid rectangles var _console = AvaloniaLocator.Current.GetService<IConsole>(); using (_console.StoreCaret()) { for (int y = (int)rect.Y; y < rect.Bottom; y++) { if (y < Console.WindowHeight - 2) { Console.SetCursorPosition((int)rect.X, y); Console.BackgroundColor = ConsoleColor.Magenta; Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine(string.Concat(Enumerable.Range(0, (int)rect.Width).Select(i => ' '))); } } }*/ //Paint(new Rect(0, 0, ClientSize.Width, ClientSize.Height)); //Paint(new Rect(rect.Left, rect.Top, rect.Width, rect.Height)); } public void SetInputRoot(IInputRoot inputRoot) { _inputRoot = inputRoot; } public Point PointToClient(PixelPoint point) { return point.ToPoint(1); } public PixelPoint PointToScreen(Point point) { throw new NotImplementedException(); } public void SetCursor(ICursorImpl cursor) { throw new NotImplementedException(); } public IPopupImpl CreatePopup() { return null; // when returning null top window overlay layer will be used } public void SetTransparencyLevelHint(WindowTransparencyLevel transparencyLevel) { } public Size ClientSize { get { PixelBufferSize pixelBufferSize = _console.Size; return new Size(pixelBufferSize.Width, pixelBufferSize.Height); } } public Size? FrameSize { get; } public double RenderScaling => 1; public IEnumerable<object> Surfaces => new[] { this }; public Action<RawInputEventArgs> Input { get; set; } public Action<Rect> Paint { get; set; } public Action<Size, PlatformResizeReason> Resized { get; set; } public Action<double> ScalingChanged { get; set; } public Action<WindowTransparencyLevel> TransparencyLevelChanged { get; set; } public Action Closed { get; set; } public Action LostFocus { get; set; } public IMouseDevice MouseDevice => new DummyMouse(); public WindowTransparencyLevel TransparencyLevel => WindowTransparencyLevel.None; public AcrylicPlatformCompensationLevels AcrylicCompensationLevels => new(1, 1, 1); public void Show(bool activate, bool isDialog) { if (activate) Activated(); } public void Hide() { throw new NotImplementedException(); } public void Activate() { throw new NotImplementedException(); } public void SetTopmost(bool value) { throw new NotImplementedException(); } public double DesktopScaling { get; } = 1d; public PixelPoint Position { get; } public Action<PixelPoint> PositionChanged { get; set; } public Action Deactivated { get; set; } public Action Activated { get; set; } public IPlatformHandle Handle { get; } public Size MaxAutoSizeHint { get; } public IScreenImpl Screen { get; } public void SetTitle(string title) { Console.Title = title; } public void SetParent(IWindowImpl parent) { throw new NotImplementedException(); } public void SetEnabled(bool enable) { throw new NotImplementedException(); } public void SetSystemDecorations(SystemDecorations enabled) { throw new NotImplementedException(); } public void SetIcon(IWindowIconImpl icon) { } public void ShowTaskbarIcon(bool value) { } public void CanResize(bool value) { throw new NotImplementedException(); } public void BeginMoveDrag(PointerPressedEventArgs e) { throw new NotImplementedException(); } public void BeginResizeDrag(WindowEdge edge, PointerPressedEventArgs e) { throw new NotImplementedException(); } public void Resize(Size clientSize, PlatformResizeReason reason = PlatformResizeReason.Application) { Resized(clientSize, reason); } public void Move(PixelPoint point) { throw new NotImplementedException(); } public void SetMinMaxSize(Size minSize, Size maxSize) { throw new NotImplementedException(); } public void SetExtendClientAreaToDecorationsHint(bool extendIntoClientAreaHint) { throw new NotImplementedException(); } public void SetExtendClientAreaChromeHints(ExtendClientAreaChromeHints hints) { throw new NotImplementedException(); } public void SetExtendClientAreaTitleBarHeightHint(double titleBarHeight) { throw new NotImplementedException(); } public WindowState WindowState { get; set; } public Action<WindowState> WindowStateChanged { get; set; } public Action GotInputWhenDisabled { get; set; } public Func<bool> Closing { get; set; } public bool IsClientAreaExtendedToDecorations { get; } public Action<bool> ExtendClientAreaToDecorationsChanged { get; set; } public bool NeedsManagedDecorations { get; } public Thickness ExtendedMargins { get; } public Thickness OffScreenMargin { get; } private async void ConsoleOnKeyPress(Key key, char keyChar, RawInputModifiers rawInputModifiers) { bool handled = false; if (!char.IsControl(keyChar)) await Dispatcher.UIThread.InvokeAsync(() => { var rawTextInputEventArgs = new RawTextInputEventArgs(_myKeyboardDevice, (ulong)DateTime.Now.Ticks, _inputRoot, keyChar.ToString()); Input(rawTextInputEventArgs); if (rawTextInputEventArgs.Handled) handled = true; }); if (handled) return; await Dispatcher.UIThread.InvokeAsync(() => { Input(new RawKeyEventArgs(_myKeyboardDevice, (ulong)DateTime.Now.Ticks, _inputRoot, RawKeyEventType.KeyDown, key, rawInputModifiers)); }); await Dispatcher.UIThread.InvokeAsync(() => { Input(new RawKeyEventArgs(_myKeyboardDevice, (ulong)DateTime.Now.Ticks, _inputRoot, RawKeyEventType.KeyUp, key, rawInputModifiers)); }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Avalonia.Platform; namespace AvaloniaEdit.AvaloniaMocks { public class MockRuntimePlatform : IRuntimePlatform { IUnmanagedBlob IRuntimePlatform.AllocBlob(int size) { throw new NotImplementedException(); } RuntimePlatformInfo IRuntimePlatform.GetRuntimeInfo() { return new RuntimePlatformInfo(); } IDisposable IRuntimePlatform.StartSystemTimer(TimeSpan interval, Action tick) { throw new NotImplementedException(); } } }
using CssUI.Internal; namespace CssUI.HTML { [MetaEnum] public enum EEncType : int {/* Docs: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fs-formenctype */ /// <summary> /// /// </summary> [MetaKeyword("application/x-www-form-urlencoded")] UrlEncoded, /// <summary> /// /// </summary> [MetaKeyword("multipart/form-data")] FormData, /// <summary> /// /// </summary> [MetaKeyword("text/plain")] Plain, } }
using NUnit.Framework; using Ploeh.AutoFixture; using Podcaster.UnitTests.Base; using Podcaster.Web.Models.Account; namespace Podcaster.UnitTests.WebClient.ViewModels.Account { [TestFixture] public class ExternalLoginConfirmationViewModelTests : BaseTestClass { [Test] public void Setters_ShouldSetPropertiesCorrectly() { // Arrange var expectedEmail = this.Fixture.Create<string>(); var sut = new ExternalLoginConfirmationViewModel(); // Act sut.Email = expectedEmail; // Assert Assert.AreSame(expectedEmail, sut.Email); } } }
@inherits ViewPage<Durwella.UrlShortening.Web.ServiceModel.HelloResponse> <h2 style="color:green">@Model.Result</h2> <p><a href="/">&lt; home</a></p>
namespace P02.VehiclesExtension { using P02.VehiclesExtension; using P02.VehiclesExtension.Models; using System; public class StartUp { public static void Main() { string[] carArgs = Console.ReadLine().Split(); double carFuelQuantity = double.Parse(carArgs[1]); double carFuelConsumption = double.Parse(carArgs[2]); int carTankCapasity = int.Parse(carArgs[3]); Car car = new Car(carFuelQuantity, carFuelConsumption, carTankCapasity); string[] truckArgs = Console.ReadLine().Split(); double truckFuelQuantity = double.Parse(truckArgs[1]); double truckFuelConsumption = double.Parse(truckArgs[2]); int truckTankCapasity = int.Parse(truckArgs[3]); Truck truck = new Truck(truckFuelQuantity, truckFuelConsumption, truckTankCapasity); string[] busArgs = Console.ReadLine().Split(); double busFuelQuantity = double.Parse(busArgs[1]); double busFuelConsumption = double.Parse(busArgs[2]); int busTankCapasity = int.Parse(busArgs[3]); Bus bus = new Bus(busFuelQuantity, busFuelConsumption, busTankCapasity); int commandCount = int.Parse(Console.ReadLine()); for (int i = 0; i < commandCount; i++) { string[] commandArgs = Console.ReadLine().Split(); string command = commandArgs[0]; string commandType = commandArgs[1]; if (command == "Drive") { double distance = double.Parse(commandArgs[2]); if (commandType == "Car") { Console.WriteLine(car.Drive(distance)); } else if(commandType == "Truck") { Console.WriteLine(truck.Drive(distance)); } else { Console.WriteLine(bus.Drive(distance)); } } else if(command == "Refuel") { double fuelAmount = double.Parse(commandArgs[2]); try { if (commandType == "Car") { car.Refuel(fuelAmount); } else if (commandType == "Truck") { truck.Refuel(fuelAmount); } else { bus.Refuel(fuelAmount); } } catch (Exception exception) { Console.WriteLine(exception.Message); } } else { double distance = double.Parse(commandArgs[2]); Console.WriteLine(bus.DriveEmpty(distance)); } } Console.WriteLine(car); Console.WriteLine(truck); Console.WriteLine(bus); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OSGeo.MapGuide.Test.Common { /// <summary> /// A simple logger interface /// </summary> public interface ITestLogger : IDisposable { void Write(string format, params object[] args); void WriteLine(string format, params object[] args); } /// <summary> /// A logger for command line output /// </summary> public class TestLoggerConsole : ITestLogger { public void Write(string format, params object[] args) { Console.Write(format, args); } public void WriteLine(string format, params object[] args) { Console.WriteLine(format, args); } public void Dispose() { } } /// <summary> /// A logger for file output /// </summary> public class TestLoggerFile : ITestLogger { private StreamWriter sw; public TestLoggerFile(string file, bool append) { sw = new StreamWriter(file, append); } public void Write(string format, params object[] args) { sw.Write(format, args); } public void WriteLine(string format, params object[] args) { sw.WriteLine(format, args); } public void Dispose() { if (sw != null) { sw.Close(); sw = null; } } } }
using System; using System.Collections; using System.Collections.Generic; namespace Flinq { public static class FlinqIListExtensions { public static T FirstOrDefault<T>(this IList<T> list) { if(list == null) throw new ArgumentNullException("list"); if(list.Count == 0) return default(T); return list[0]; } } }
using Xunit; public class SentenceTest { [Fact] public void OneWordWithOneVowel() => Assert.Equal("a", Sentence.WordWithMostVowels("a")); [Fact] public void OneWordWithOneVowelAndOneConsonant() => Assert.Equal("oh", Sentence.WordWithMostVowels("oh")); [Fact] public void OneWordWithTwoVowelsAndOneConsonant() => Assert.Equal("tea", Sentence.WordWithMostVowels("tea")); [Fact] public void LongestWordIsNotWordWithMostVowels() => Assert.Equal("area", Sentence.WordWithMostVowels("the area of a circle")); [Fact] public void LastWordIsWordWithMostVowels() => Assert.Equal("cooking", Sentence.WordWithMostVowels("do you fancy cooking")); [Fact] public void MixedCasing() => Assert.Equal("YOUR", Sentence.WordWithMostVowels("TEST YOUR MIGHT")); [Fact] public void IgnoreWordWithoutVowels() => Assert.Equal("guitarist", Sentence.WordWithMostVowels("fantastic rhythm guitarist")); [Fact] public void WordWithAllVowels() => Assert.Equal("Sequoia", Sentence.WordWithMostVowels("Mountain Sequoia Trees")); [Fact] public void TieBreakerWithEquallyLongWords() => Assert.Equal("old", Sentence.WordWithMostVowels("her old dad")); [Fact] public void TieBreakerWithFirstWordBeingWinner() => Assert.Equal("evening", Sentence.WordWithMostVowels("evening Aeon multiple")); [Fact] public void TieBreakerWithLastWordBeingWinner() => Assert.Equal("plains", Sentence.WordWithMostVowels("a bear was seen on the plains")); }
using System.Numerics; namespace PersistentPlanet.Controls.Controls { public interface IAxisUpdatedEvent { Vector2 Axis { get; set; } } }
using Portal.Service.Implements; using Portal.Service.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Site.OnlineStore.Areas.Admin.Controllers { public class HomeController : BaseManagementController { #region Properties private IMenuService _menuService = new MenuService(); #endregion #region Actions public ActionResult Index() { return View(); } [ChildActionOnly] public ActionResult Menu() { var menu = _menuService.GetMenuByType((int)Portal.Infractructure.Utility.Define.MenuEnum.Admin); return PartialView(menu); } #endregion } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MaterialAnimator : MonoBehaviour { public AnimationCurve valueSpectrum = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(1f, 1f)); public Material material; public string propertyName; //private Color baseColor; private float timeSince; private float endTime; private bool isAnimating; private bool isAnimatingReverse; void Start() { if (material == null) { if (GetComponent<Renderer>() == null) Debug.LogError("Material and Renderer are not set on object"); else material = GetComponent<Renderer>().material; } endTime = valueSpectrum.keys[1].time; //baseColor = GetComponent<Renderer>().material.GetColor("_TintColor"); } void Update() { if (isAnimating) { timeSince += Time.deltaTime; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); //baseColor.a = valueSpectrum.Evaluate(timeSince); //GetComponent<Renderer>().material.SetColor("_TintColor", baseColor); if (timeSince >= endTime) isAnimating = false; } if (isAnimatingReverse) { timeSince -= Time.deltaTime; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); if (timeSince <= 0) isAnimatingReverse = false; } } public void StartAnimatingMaterial() { isAnimating = true; timeSince = 0; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); } public void StopAnimatingMaterial() { isAnimating = false; timeSince = endTime; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); } public void StartAnimatingMaterialReverse() { isAnimatingReverse = true; timeSince = endTime; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); } public void StopAnimatingMaterialReverse() { isAnimatingReverse = false; timeSince = 0; material.SetFloat(propertyName, valueSpectrum.Evaluate(timeSince)); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MetroLog.Targets { public class LogReadQuery { public bool IsTraceEnabled { get; set; } public bool IsDebugEnabled { get; set; } public bool IsInfoEnabled { get; set; } public bool IsWarnEnabled { get; set; } public bool IsErrorEnabled { get; set; } public bool IsFatalEnabled { get; set; } /// <summary> /// Gets or sets the number of items to read. /// </summary> /// <remarks>By default this is set to <c>1000</c>. Set to <c>0</c> to remove any limit.</remarks> public int Top { get; set; } /// <summary> /// Gets or sets the earliest date/time to read. /// </summary> /// <remarks>By default this is <c>DateTime.UtcNow.AddDays(-7)</c>. Set to <c>DateTime.MinValue</c> to remove this constraint.</remarks> public DateTime FromDateTimeUtc { get; set; } public LogReadQuery() { IsTraceEnabled = false; IsDebugEnabled = false; IsInfoEnabled = true; IsWarnEnabled = true; IsErrorEnabled = true; IsFatalEnabled = true; Top = 1000; FromDateTimeUtc = DateTime.UtcNow.AddDays(-7); } public void SetLevels(LogLevel from, LogLevel to) { IsTraceEnabled = LogLevel.Trace >= from && LogLevel.Trace <= to; IsDebugEnabled = LogLevel.Debug >= from && LogLevel.Debug <= to; IsInfoEnabled = LogLevel.Info >= from && LogLevel.Info <= to; IsWarnEnabled = LogLevel.Warn >= from && LogLevel.Warn <= to; IsErrorEnabled = LogLevel.Error >= from && LogLevel.Error <= to; IsFatalEnabled = LogLevel.Fatal >= from && LogLevel.Fatal <= to; } } }
using System.Text.Json; namespace Onebot.Protocol.Extensions { public static class JsonElementExtensions { public static T GetObject<T>(this JsonElement element, JsonSerializerOptions options = null) => JsonSerializer.Deserialize<T>(element.GetRawText(), options ?? new JsonSerializerOptions()); } }
using System; using System.Runtime.Serialization; namespace SharpRemote.CodeGeneration.Serialization.Binary { /// <summary> /// Classifies messages into method calls and -results. /// </summary> [Flags] [DataContract] internal enum MessageType2 : byte { /// <summary> /// The method is a call and carries target, method and parameter values. /// </summary> [EnumMember] Call = 0, /// <summary> /// The method is a result from a previous call and carries return value / exception, if available. /// </summary> [EnumMember] Result = 1, /// <summary> /// The method call resulted in an exception. /// </summary> [EnumMember] Exception = 2 } }
using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using YouTubeCleanupTool.Domain.Entities; namespace YouTubeCleanupTool.Domain { public interface IYouTubeCleanupToolDbContext { Task<List<PlaylistItemData>> GetPlaylistItems(); Task<List<PlaylistData>> GetPlaylists(); Task<List<VideoData>> GetVideos(); Task<InsertStatus> UpsertPlaylist(PlaylistData data); Task<InsertStatus> UpsertPlaylistItem(PlaylistItemData data); Task<InsertStatus> UpsertVideo(VideoData data); void Migrate(); Task<int> SaveChangesAsync(CancellationToken cancellationToken = default); Task<bool> VideoExists(string id); Task<List<string>> GetVideoTitles(); Task<List<IData>> FindAll(string regex); Task<PlaylistItemData> GetPlaylistItem(string playlistId, string videoId); void RemovePlaylistItem(PlaylistItemData playlistItem); Task<List<VideoData>> GetUncategorizedVideos(List<string> playlistTitles); void RemovePlaylist(string playlistId); Task<List<PlaylistItemData>> GetPlaylistItems(string playlistId); } }
using Xamarin.Forms; namespace MagicGradients.Toolkit.Controls { public class TextContent : Label { public TextContent() { HorizontalOptions = LayoutOptions.Fill; VerticalOptions = LayoutOptions.Fill; HorizontalTextAlignment = TextAlignment.Center; VerticalTextAlignment = TextAlignment.Center; } } }
using System; using System.Collections; namespace TeslaCanBusInspector.Common { public static class BitArrayConverter { public static short ToInt16(byte[] bytes, int bitOffset, byte bitLength) { const int maxBits = sizeof(short) * 8; Guard(bytes, bitOffset, bitLength, maxBits); var source = new BitArray(bytes); var dest = new BitArray(maxBits); var destOffset = maxBits - bitLength; for (var i = 0; i < bitLength; i++) { if (source.Get(bitOffset + i)) { dest.Set(destOffset + i, true); } } var buf = new byte[maxBits / 8]; dest.CopyTo(buf, 0); return BitConverter.ToInt16(buf); } public static int ToInt32(byte[] bytes, int bitOffset, byte bitLength) { const int maxBits = sizeof(int) * 8; Guard(bytes, bitOffset, bitLength, maxBits); var source = new BitArray(bytes); var dest = new BitArray(maxBits); var destOffset = maxBits - bitLength; for (var i = 0; i < bitLength; i++) { if (source.Get(bitOffset + i)) { dest.Set(destOffset + i, true); } } var buf = new byte[maxBits / 8]; dest.CopyTo(buf, 0); return BitConverter.ToInt32(buf); } public static ushort ToUInt16(byte[] bytes, int bitOffset, byte bitLength) { const int maxBits = sizeof(ushort) * 8; Guard(bytes, bitOffset, bitLength, maxBits); var source = new BitArray(bytes); var dest = new BitArray(maxBits); for (var i = 0; i < bitLength; i++) { if (source.Get(bitOffset + i)) { dest.Set(i, true); } } var buf = new byte[maxBits / 8]; dest.CopyTo(buf, 0); return BitConverter.ToUInt16(buf); } public static uint ToUInt32(byte[] bytes, int bitOffset, byte bitLength) { const int maxBits = sizeof(uint) * 8; Guard(bytes, bitOffset, bitLength, maxBits); var source = new BitArray(bytes); var dest = new BitArray(maxBits); var destOffset = maxBits - bitLength; for (var i = 0; i < bitLength; i++) { if (source.Get(bitOffset + i)) { dest.Set(destOffset + i, true); } } var buf = new byte[maxBits / 8]; dest.CopyTo(buf, 0); return BitConverter.ToUInt32(buf); } private static void Guard(byte[] bytes, int bitOffset, byte bitLength, byte maxLength) { if (bytes == null) throw new ArgumentNullException(nameof(bytes)); if (bitOffset < 0) { throw new ArgumentOutOfRangeException(nameof(bitOffset), $"{nameof(bitOffset)} must be larger than 0 (actual value: {bitOffset})"); } if (bitLength > maxLength) { throw new ArgumentOutOfRangeException(nameof(bitLength), $"{nameof(bitLength)} cannot be larger than {maxLength} (actual value: {bitLength})"); } } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class NoteObject : MonoBehaviour { public bool canBePressed; public KeyCode keyToPress; public GameObject hitEffect, missEffect; // Update is called once per frame void Update() { if (Input.GetKeyDown(keyToPress)) { if (canBePressed) { if (transform.parent.tag == "Special") { Transform special = transform.parent; special.GetChild(0).gameObject.SetActive(false); special.GetChild(1).gameObject.SetActive(false); special.GetChild(2).gameObject.SetActive(false); special.GetChild(3).gameObject.SetActive(false); } else { gameObject.SetActive(false); } RhythmManager.instance.NoteHit(); Instantiate(hitEffect, transform.position, hitEffect.transform.rotation); switch (keyToPress) { case KeyCode.A: EventManager.Instance.attackButtonHitEvent.Invoke(); break; case KeyCode.S: EventManager.Instance.magicButtonHitEvent.Invoke(); break; case KeyCode.D: EventManager.Instance.potionButtonHitEvent.Invoke(); break; case KeyCode.F: EventManager.Instance.defenseButtonHitEvent.Invoke(); break; } } } } public void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Activator") { canBePressed = true; } } public void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Activator") { canBePressed = false; if (gameObject.activeSelf) { RhythmManager.instance.NoteMiss(); Instantiate(missEffect, transform.position, hitEffect.transform.rotation); } } } }
using Autofac; using EmberKernel.Services.EventBus; namespace EmberKernel.Services.Statistic.DataSource.SourceManager { public interface IEventSourceManager : IKernelService { void Track<TEvent>(ILifetimeScope scope) where TEvent : Event<TEvent>; void Untrack<TEvent>() where TEvent : Event<TEvent>; } }
using System; namespace VPX.ApiModels { public class UserWithoutGroupModel { public Guid Value { get; set; } public string Display { get; set; } } }
using Goomer.Services.Data.Contracts; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Kendo.Mvc.Extensions; using Kendo.Mvc.UI; using Goomer.Web.Infrastructure.Mapping; using Goomer.Web.Areas.Administration.Models; namespace Goomer.Web.Areas.Administration.Controllers { [Authorize(Roles ="Admin")] public class UsersController : Controller { private readonly IUsersService usersService; public UsersController(IUsersService usersService) { this.usersService = usersService; } public ActionResult Read([DataSourceRequest] DataSourceRequest request) { var users = this.usersService.AllUsers().To<EditUserViewModel>().ToList(); return this.Json(users.ToDataSourceResult(request)); } [HttpPost] public ActionResult Update([DataSourceRequest] DataSourceRequest request, EditUserViewModel user) { if (user != null && this.ModelState.IsValid) { this.usersService.Update(user.Id,user.IsDeleted,user.Email,user.PhoneNumber,user.IsAdmin); } return this.Json(new[] { user }.ToDataSourceResult(request, this.ModelState)); } // GET: Administration/Users public ActionResult Index() { var users = this.usersService.AllUsers().To<EditUserViewModel>().ToList(); return View(users); } } }
using System; using System.Collections.Generic; using WhiteRabbit.SampleApp.Interfaces; namespace WhiteRabbit.SampleApp.Infrastructure.Messaging { public class CommandDispatcher : DispatcherBase<ICommandHandler> { public CommandDispatcher(IEnumerable<ICommandHandler> handlers) : base(typeof(ICommandHandler<>), handlers) { } public override void Dispatch<TCommand>(TCommand cmd) { if (Handlers.ContainsKey(cmd.GetType())) { dynamic handler = Handlers[cmd.GetType()]; handler.Handle((dynamic)cmd); } else { throw new Exception("No command handler found for command:" + cmd.GetType()); } } } }
using System; namespace EvolutionSimulation.FSM.Creature.Transitions { /// <summary> /// This transition is for males creatures and is to go to a female /// who is in heat. /// Wander -> Go to mate /// </summary> class GoToMateTransition : CreatureTransition { public GoToMateTransition(Entities.Creature creature) { this.creature = creature; } public override bool Evaluate() { // Do not go to a mate if the creature is a female if (creature.stats.Gender == Genetics.Gender.Female) return false; return creature.Mate() && !creature.stats.IsNewBorn(); // It has to be adult } public override string ToString() { return "MateTransition"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Numerics; namespace Encryptior { public class Models { public class ProjectData { public string EncryptedFilename { get; set; } public string DataFolder { get; set; } } public class File { public string FileHash { get; set; } public string Owner { get; set; } public double CostUSD { get; set; } public string Password { get; set; } public string TransactionHash { get; set; } } public class Balance { public double BalanceETH { get; set; } public double ETH2USD { get; set; } public double BalanceUSD { get; set; } public BigInteger Nonce { get; set; } } public class TransactionInput { public long Timestamp { get; set; } public string FileHash { get; set; } public double CostUSD { get; set; } public double ETH2USD { get; set; } public double CostETH { get; set; } public BigInteger CostWei { get; set; } public string ByteCode { get; set; } public GasPrice GasPrice { get; set; } public BigInteger GasLimit { get; set; } public string ContractAddress { get; set; } public string PayTo { get; set; } public BigInteger Nonce { get; set; } public BigInteger SelectedGasPrice { get; set; } } public class TransactionEntry { public long Timestamp { get; set; } public string TransactionHash { get; set; } public string FileHash { get; set; } public string Status { get; set; } public string From { get; set; } public string To { get; set; } public double CostUSD { get; set; } public double ETH2USD { get; set; } public double CostETH { get; set; } } public class TransactionResult { public long Timestamp { get; set; } public string TransactionHash { get; set; } public string Status { get; set; } } public class GasPrice { public BigInteger LowPrice { get; set; } public BigInteger MediumPrice { get; set; } public BigInteger HighPrice { get; set; } public double LowPriceWait { get; set; } public double MediumPriceWait { get; set; } public double HighPriceWait { get; set; } } public class CurrentVersion { public string Version { get; set; } public string DownloadLink { get; set; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Undesirable_Communication.Model.Connection; using Undesirable_Communication.Model.Connection.Outgoing; namespace Undesirable_Communication.Model.ChatMessage.Outgoing { public class OutgoingMessageList { public ICollection<OutgoingMessage> Messages { get; set; } public OutgoingChatConnection Connection { get; set; } public static OutgoingMessageList Parse(ICollection<Message> messages, ChatConnection x, Guid currentUserId) { if(messages == null || x == null) { return null; } return new OutgoingMessageList { Connection = OutgoingChatConnection.Parse(x, ""), Messages = messages.Select(y => OutgoingMessage.Parse(y, currentUserId)).ToList() }; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MohyoButton.Models { public class KeyInfo { /// <summary> /// Consumer Key /// </summary> public string ConsumerKey; /// <summary> /// Consumer Secret /// </summary> public string ConsumerSecret; /// <summary> /// Access Token /// </summary> public string AccessToken; /// <summary> /// Access Token Secret /// </summary> public string AccessTokenSecret; /// <summary> /// User defined message /// </summary> public string CountMessage; /// <summary> /// Post count message /// </summary> public bool PostCountMessage; /// <summary> /// User defined post word list /// </summary> public string UserWordListName; } }
using System; using System.Collections.Generic; using System.Linq; using DOL.WHD.Section14c.Business.Factories; using DOL.WHD.Section14c.Domain.Models; using DOL.WHD.Section14c.Domain.Models.Submission; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace DOL.WHD.Section14c.Test.Business.Factories { [TestClass] public class ApplicationSummaryFactoryTests { private readonly IApplicationSummaryFactory _factory; public ApplicationSummaryFactoryTests() { _factory = new ApplicationSummaryFactory(); } [TestMethod] public void ApplicationSummaryFactory_Build() { // Arrange var appId = Guid.NewGuid().ToString(); var applicationType = "New"; var certificateStatusName = "Issued"; var certificateEffectiveDate = DateTime.Now; var certificateExpirationDate = DateTime.Now; var certificateNumber = "xxxxxx"; var state = "OH"; var types = new List<string> {"Business", "Hospital"}; var numWorkSites = 3; var numWorkersPerSite = 5; var employerName = "Employer Name"; var submission = new ApplicationSubmission { Id = appId, ApplicationType = new Response {Display = applicationType}, Status = new Status {Name = certificateStatusName}, CertificateEffectiveDate = certificateEffectiveDate, CertificateExpirationDate = certificateExpirationDate, CertificateNumber = certificateNumber, EstablishmentType = types.Select( x => new ApplicationSubmissionEstablishmentType {EstablishmentType = new Response {ShortDisplay = x}}) .ToList(), Employer = new EmployerInfo { PhysicalAddress = new Address {State = state}, LegalName = employerName }, WorkSites = Enumerable.Repeat( new WorkSite {Employees = Enumerable.Repeat(new Employee(), numWorkersPerSite).ToList()}, numWorkSites).ToList() }; // Act var summary = _factory.Build(submission); // Assert Assert.AreEqual(appId, summary.Id); Assert.AreEqual(certificateStatusName, summary.Status.Name); Assert.AreEqual(certificateEffectiveDate, summary.CertificateEffectiveDate); Assert.AreEqual(certificateExpirationDate, summary.CertificateExpirationDate); Assert.AreEqual(certificateNumber, summary.CertificateNumber); for (int i = 0; i < types.Count; i++) { Assert.AreEqual(types[i], summary.CertificateType.ElementAt(i).Display); } Assert.AreEqual(state, summary.State); Assert.AreEqual(numWorkSites, summary.NumWorkSites); Assert.AreEqual(numWorkSites * numWorkersPerSite, summary.NumWorkers); Assert.AreEqual(applicationType, summary.ApplicationType.Display); Assert.AreEqual(employerName, summary.EmployerName); } } }
using System; using RippleLibSharp.Transactions; namespace RippleLibSharp.Nodes { public class RippleFieldGroup { public UInt32 Flags { get; set; } public string Account { get; set; } public string Owner { get; set; } public RippleCurrency Balance { get; set; } public string OwnerNode { get; set; } public UInt32 OwnerCount { get; set; } public UInt32 Sequence { get; set; } public string ExchangeRate { get; set; } public string RootIndex { get; set; } public string TakerGetsCurrency { get; set; } public string TakerGetsIssuer { get; set; } public string TakerPaysCurrency { get; set; } public string TakerPaysIssuer { get; set; } public string IndexPrevious { get; set; } public string LedgerEntryType { get; set; } public string LedgerIndex { get; set; } public string PreviousTxnID { get; set; } public UInt32 PreviousTxnLgrSeq { get; set; } public string BookDirectory { get; set; } public RippleCurrency TakerGets { get; set; } public RippleCurrency TakerPays { get; set; } public RippleCurrency HighLimit { get; set; } public RippleCurrency LowLimit { get; set; } public string HighNode { get; set; } public string LowNode { get; set; } public string BookNode { get; set; } public string IndexNext { get; set; } public MemoIndice [] Memos { get; set; } } }
using System; using System.Collections.Generic; using System.Text; namespace MyMeetUp.Logic.Entities.Enums { public enum ERegistrationStatus { Preregistration=0, Registered=1, Canceled=2, Forbidden=3 } }
using System; using System.Collections.Generic; using System.Text; using Microsoft.Extensions.Logging; // ReSharper disable once CheckNamespace namespace Microsoft.Azure.WebJobs.Script.Diagnostics { /// <summary> /// <see cref="ILoggerProvider"/> to verify if the surrogate of the real provider doesn't get removed. /// </summary> public class FunctionFileLoggerProvider : ILoggerProvider { /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { throw new NotImplementedException(); } /// <summary> /// Creates a new <see cref="T:Microsoft.Extensions.Logging.ILogger" /> instance. /// </summary> /// <param name="categoryName">The category name for messages produced by the logger.</param> /// <returns>The instance of <see cref="T:Microsoft.Extensions.Logging.ILogger" /> that was created.</returns> public ILogger CreateLogger(string categoryName) { throw new NotImplementedException(); } } }
namespace Sudoku.UI.Data.ValueConverters; /// <summary> /// Defines a converter that can convert an <see cref="int"/> value to a <see cref="string"/>. /// </summary> public sealed class Int32ToStringConverter : IValueConverter { /// <inheritdoc/> public object Convert(object value, Type targetType, object? parameter, string language) => (value, parameter) switch { (double d, string s) => d.ToString(s), (double d, _) => d.ToString(), _ => string.Empty }; /// <inheritdoc/> public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException(); }
/* Linked list data structure example Copyright 2017, Sjors van Gelderen */ using System; using System.Collections.Generic; namespace Program { // Linked list data structure and associated functionality class LinkedList<T> where T : IEquatable<T> { public T Value { get; set; } public LinkedList<T> Next { get; set; } // No default elements public LinkedList() { } // Populate with elements from the get-go public LinkedList(T[] _elements) { foreach(var element in _elements) { Insert(element); } } /* Insert element into list Complexity: O(1) */ public void Insert(T _value) { var temp_next = Next; Next = new LinkedList<T>(); Next.Value = _value; Next.Next = temp_next; } /* Find and delete element in list Complexity: O(n) */ public void Delete(T _value) { if(Next == null) { Console.WriteLine("Error, element not in collection!"); } else if(EqualityComparer<T>.Default.Equals(Next.Value, _value)) { Next = Next.Next; } else { Next.Delete(_value); } } /* Find index of value in list Complexity: O(n) */ public int Search(T _value, int _iteration = 0) { if(Next == null) { return -1; } else if(EqualityComparer<T>.Default.Equals(Next.Value, _value)) { return _iteration; } else { return Next.Search(_value, _iteration + 1); } } public void Print() { if(Next == null) { Console.Write(Environment.NewLine); } else { Console.Write("{0}, ", Next.Value.ToString()); Next.Print(); } } } static class Program { // Generate string from elements in a collection static string StringFromCollection<T>(ref T[] _collection) { string buffer = "["; foreach(var element in _collection) { buffer += element.ToString(); buffer += ", "; } buffer += "]"; return buffer; } static void Main() { Console.WriteLine("Linked list data structure example - " + "Copyright 2017, Sjors van Gelderen" + Environment.NewLine); var random = new Random(); // Generate list of integers var int_collection = new int[16]; for(int i = 0; i < int_collection.Length; i++) { int_collection[i] = random.Next(100); } var int_list = new LinkedList<int>(int_collection); int_list.Print(); // Find number 10 in list Console.WriteLine("Searching for element 10 in list"); var search_result = int_list.Search(10); if(search_result >= 0) { Console.WriteLine("10 found at index {0}", search_result); } else { Console.WriteLine("10 not in the list!"); } // Delete root of list int_list.Print(); Console.WriteLine("Deleting first value in list"); int_list.Delete(int_list.Next.Value); int_list.Print(); // Generate list of strings var string_collection = new string[]{ "aardvark", "bishop", "cadbury's" }; var string_list = new LinkedList<string>(string_collection); // Insert an element string_list.Print(); Console.WriteLine("Inserting element in list"); string_list.Insert("duke"); string_list.Print(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace Tinkar.Protobuf.XUnitTests { internal static class NativeMethods { public static void PreventSleep() { SetThreadExecutionState(ExecutionState.EsContinuous | ExecutionState.EsSystemRequired); } public static void AllowSleep() { SetThreadExecutionState(ExecutionState.EsContinuous); } [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern ExecutionState SetThreadExecutionState(ExecutionState esFlags); [FlagsAttribute] private enum ExecutionState : uint { EsAwaymodeRequired = 0x00000040, EsContinuous = 0x80000000, EsDisplayRequired = 0x00000002, EsSystemRequired = 0x00000001 } } }
/* * DAWN OF LIGHT - The first free open source DAoC server emulator * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ using System; using System.IO; using System.Net; namespace DOL.Config { /// <summary> /// Base configuration for the server. /// </summary> public class BaseServerConfiguration { /// <summary> /// Whether or not to try and auto-detect the external IP of the server. /// </summary> private bool _detectRegionIP; /// <summary> /// Whether or not to enable UPnP mapping. /// </summary> private bool _enableUPnP; /// <summary> /// The listening address of the server. /// </summary> private IPAddress _ip; /// <summary> /// The listening port of the server. /// </summary> private ushort _port; /// <summary> /// The region (external) address of the server. /// </summary> private IPAddress _regionIP; /// <summary> /// The region (external) port of the server. /// </summary> private ushort _regionPort; /// <summary> /// The UDP listening address of the server. /// </summary> private IPAddress _udpIP; /// <summary> /// The UDP listening port of the server. /// </summary> private ushort _udpPort; /// <summary> /// Constructs a server configuration with default values. /// </summary> protected BaseServerConfiguration() { _port = 10300; _ip = IPAddress.Any; _regionIP = IPAddress.Any; _regionPort = 10400; _udpIP = IPAddress.Any; _udpPort = 10400; _detectRegionIP = true; _enableUPnP = true; } /// <summary> /// Gets/sets the listening port for the server. /// </summary> public ushort Port { get { return _port; } set { _port = value; } } /// <summary> /// Gets/sets the listening address for the server. /// </summary> public IPAddress IP { get { return _ip; } set { _ip = value; } } /// <summary>p /// Gets/sets the region (external) address for the server. /// </summary> public IPAddress RegionIP { get { return _regionIP; } set { _regionIP = value; } } /// <summary> /// Gets/sets the region (external) port for the server. /// </summary> public ushort RegionPort { get { return _regionPort; } set { _regionPort = value; } } /// <summary> /// Gets/sets the UDP listening address for the server. /// </summary> public IPAddress UDPIP { get { return _udpIP; } set { _udpIP = value; } } /// <summary> /// Gets/sets the UDP listening port for the server. /// </summary> public ushort UDPPort { get { return _udpPort; } set { _udpPort = value; } } /// <summary> /// Whether or not to enable UPnP mapping. /// </summary> public bool EnableUPnP { get { return _enableUPnP; } set { _enableUPnP = value; } } /// <summary> /// Whether or not to try and auto-detect the external IP of the server. /// </summary> public bool DetectRegionIP { get { return _detectRegionIP; } set { _detectRegionIP = value; } } /// <summary> /// Loads the configuration values from the given configuration element. /// </summary> /// <param name="root">the root config element</param> protected virtual void LoadFromConfig(ConfigElement root) { string ip = root["Server"]["IP"].GetString("any"); _ip = ip == "any" ? IPAddress.Any : IPAddress.Parse(ip); _port = (ushort) root["Server"]["Port"].GetInt(_port); ip = root["Server"]["RegionIP"].GetString("any"); _regionIP = ip == "any" ? IPAddress.Any : IPAddress.Parse(ip); _regionPort = (ushort) root["Server"]["RegionPort"].GetInt(_regionPort); ip = root["Server"]["UdpIP"].GetString("any"); _udpIP = ip == "any" ? IPAddress.Any : IPAddress.Parse(ip); _udpPort = (ushort) root["Server"]["UdpPort"].GetInt(_udpPort); _enableUPnP = root["Server"]["EnableUPnP"].GetBoolean(_enableUPnP); _detectRegionIP = root["Server"]["DetectRegionIP"].GetBoolean(_detectRegionIP); } /// <summary> /// Load the configuration from an XML source file. /// </summary> /// <param name="configFile">the file to load from</param> public void LoadFromXMLFile(FileInfo configFile) { if (configFile == null) throw new ArgumentNullException("configFile"); XMLConfigFile xmlConfig = XMLConfigFile.ParseXMLFile(configFile); LoadFromConfig(xmlConfig); } /// <summary> /// Saves the values to the given configuration element. /// </summary> /// <param name="root">the configuration element to save to</param> protected virtual void SaveToConfig(ConfigElement root) { root["Server"]["Port"].Set(_port); root["Server"]["IP"].Set(_ip); root["Server"]["RegionIP"].Set(_regionIP); root["Server"]["RegionPort"].Set(_regionPort); root["Server"]["UdpIP"].Set(_udpIP); root["Server"]["UdpPort"].Set(_udpPort); root["Server"]["EnableUPnP"].Set(_enableUPnP); root["Server"]["DetectRegionIP"].Set(_detectRegionIP); } /// <summary> /// Saves the values to the given XML configuration file. /// </summary> /// <param name="configFile">the file to save to</param> public void SaveToXMLFile(FileInfo configFile) { if (configFile == null) throw new ArgumentNullException("configFile"); var config = new XMLConfigFile(); SaveToConfig(config); config.Save(configFile); } } }
/* * Copyright 2019 Google LLC * * 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 * * https://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.Collections; using System.Collections.Generic; using UnityEngine; // This is an abstraction layer that wraps the code browser implementations so that // the rest of the app can interact with it without knowing about which concrete implementation // is being used. // // If the USE_ZFBROWSER symbol is defined, this class will use ZFBrowser for the implementation; // otherwise, it uses a basic text box implementation. public class CodeBrowserWrapper : MonoBehaviour { bool initialized; ICodeBrowser codeBrowser; [SerializeField] BasicCodeBrowser basicCodeBrowser; private void LazyInitialize() { Debug.Assert(basicCodeBrowser != null, "basicCodeBrowser property not set in CodeBrowserWrapper"); initialized = true; #if USE_ZFBROWSER basicCodeBrowser.gameObject.SetActive(false); ZenFulcrum.EmbeddedBrowser.Browser zfBrowser = gameObject.AddComponent<ZenFulcrum.EmbeddedBrowser.Browser>(); zfBrowser.Url = "localGame://gamebuilder/js-editor.html"; zfBrowser.allowContextMenuOn = ZenFulcrum.EmbeddedBrowser.BrowserNative.ContextMenuOrigin.Editable; ZenFulcrum.EmbeddedBrowser.PointerUIGUI pointerScript = gameObject.AddComponent<ZenFulcrum.EmbeddedBrowser.PointerUIGUI>(); pointerScript.enableMouseInput = true; pointerScript.enableTouchInput = true; pointerScript.enableInput = true; pointerScript.automaticResize = true; codeBrowser = new ZfBrowserImpl(zfBrowser); #else codeBrowser = basicCodeBrowser; // Don't do this: // basicCodeBrowser.gameObject.SetActive(true); // Because this causes the code browser to appear onscreen during init, // which we don't want. #endif } public ICodeBrowser GetCodeBrowser() { if (!initialized) { LazyInitialize(); } return codeBrowser; } } public interface ICodeBrowser { void Show(bool show); bool KeyboardHasFocus(); void SetCode(string liveCode); void SetScrollTop(int scrollTop); void SetReadOnly(bool readOnly); void CheckIsReadyAsync(System.Action<bool> callback); void AddSystemSource(string contents, string fileName); void GetCodeAsync(System.Action<string> callback); void GetScrollTopAsync(System.Action<int> scrollTop, System.Action onError); void AddError(int baseOneLineNumber, string message); void ClearErrors(); void ZoomIn(); void ZoomOut(); float GetZoom(); void SetZoom(float zoom); } #if USE_ZFBROWSER class ZfBrowserImpl : ICodeBrowser { ZenFulcrum.EmbeddedBrowser.Browser browser; ZenFulcrum.EmbeddedBrowser.PointerUIGUI browserUI; public ZfBrowserImpl(ZenFulcrum.EmbeddedBrowser.Browser browser) { this.browser = browser; browserUI = browser.GetComponentInChildren<ZenFulcrum.EmbeddedBrowser.PointerUIGUI>(); } public void Show(bool show) { } public bool KeyboardHasFocus() { return browserUI.KeyboardHasFocus; } public void SetCode(string liveCode) { browser.CallFunction("setCode", liveCode); } public void SetScrollTop(int scrollTop) { browser.CallFunction("setScrollTop", scrollTop); } public void SetReadOnly(bool readOnly) { browser.CallFunction("setReadOnly", readOnly); } public void CheckIsReadyAsync(System.Action<bool> callback) { browser.CallFunction("isReady").Then(value => callback.Invoke((bool)value)); } public void AddSystemSource(string contents, string fileName) { browser.CallFunction("addSystemSource", contents, fileName); } public void GetCodeAsync(System.Action<string> callback) { browser.CallFunction("getCode").Then(value => callback.Invoke((string)value)); } public void GetScrollTopAsync(System.Action<int> callback, System.Action onError) { browser.CallFunction("getScrollTop").Then(value => callback.Invoke((int)value)).Catch(unused => onError.Invoke()); } public void AddError(int baseOneLineNumber, string message) { ZenFulcrum.EmbeddedBrowser.JSONNode[] args = new ZenFulcrum.EmbeddedBrowser.JSONNode[] { new ZenFulcrum.EmbeddedBrowser.JSONNode((double)baseOneLineNumber), new ZenFulcrum.EmbeddedBrowser.JSONNode(message) }; browser.CallFunction("addError", args); } public void ClearErrors() { browser.CallFunction("clearErrors"); } public void ZoomIn() { browser.Zoom++; } public void ZoomOut() { browser.Zoom--; } public float GetZoom() { return browser.Zoom; } public void SetZoom(float newZoom) { browser.Zoom = newZoom; } } #endif
using Heartbeat.Runtime.Analyzers.Interfaces; using Heartbeat.Runtime.Proxies; using Microsoft.Extensions.Logging; namespace Heartbeat.Runtime.Analyzers { public sealed class HttpWebRequestAnalyzer : ProxyInstanceAnalyzerBase<HttpWebRequestProxy>, ILoggerDump { public HttpWebRequestAnalyzer(RuntimeContext context, HttpWebRequestProxy targetObject) : base(context, targetObject) { } public void Dump(ILogger logger) { var webRequestProxy = TargetObject; var uri = webRequestProxy.Address.Value; using (logger.BeginScope(webRequestProxy)) { logger.LogInformation($"uri: {uri}"); using (logger.BeginScope("Headers")) { var headerCollectionAnalyzer = new WebHeaderCollectionAnalyzer(Context, webRequestProxy.Headers); headerCollectionAnalyzer.Dump(logger); } using (logger.BeginScope("_HttpResponse")) { var responseProxy = webRequestProxy.Response; if (responseProxy != null) { var httpWebResponseAnalyzer = new HttpWebResponseAnalyzer(Context, responseProxy); httpWebResponseAnalyzer.Dump(logger); } } // var startTimestamp = (long) webRequestObject.Type.GetFieldByName("m_StartTimestamp") // .GetValue(webRequestObject.Address); // var startTime = // TimeSpan.FromTicks( // unchecked((long) (startTimestamp * 4.876196D))); // TODO get tickFrequency; //logger.LogInformation($" start = {startTime} "); //// m_Aborted:0x0 (System.Int32) //// m_OnceFailed:false (System.Boolean) //// m_Retry:false (System.Boolean) //// m_BodyStarted:true (System.Boolean) //// m_RequestSubmitted:true (System.Boolean) //// m_StartTimestamp:0x8f4548c2db (System.Int64) //// _HttpResponse:NULL (System.Net.HttpWebResponse) //// _OriginUri:00000078edcea920 (System.Uri) } } } }
using Microsoft.EntityFrameworkCore; using SerieFlix.Domain.Entities; using SerieFlix.Repository.Context; using System.Collections.Generic; namespace SerieFlix.Tests.MockData.Repository { public static class DbContextMock { public static SerieFlixContext GetContext() { var options = new DbContextOptionsBuilder<SerieFlixContext>() .UseInMemoryDatabase(databaseName: "serieflix") .Options; var dbContextMock = new SerieFlixContext(options); PopuleSeries(dbContextMock); return dbContextMock; } private static void PopuleSeries(SerieFlixContext dbContextMock) { var series = new List<Serie>(); for (int i = 1; i <= 20; i++) { series.Add(new Serie(Genero.Acao, $"Titulo {i}", $"Descrição {i}", 2000 + i, false)); } dbContextMock.AddRange(series); dbContextMock.SaveChanges(); } } }
using Xunit; namespace PreMailer.Net.Tests { public class StyleClassTests { [Fact] public void SingleAttribute_ShouldNotAppendSemiColonToString() { var clazz = new StyleClass(); clazz.Attributes["color"] = CssAttribute.FromRule("color: red"); Assert.Equal("color: red", clazz.ToString()); } [Fact] public void MultipleAttributes_ShouldJoinAttributesWithSemiColonInString() { var clazz = new StyleClass(); clazz.Attributes["color"] = CssAttribute.FromRule("color: red"); clazz.Attributes["height"] = CssAttribute.FromRule("height: 100%"); Assert.Equal("color: red;height: 100%", clazz.ToString()); } [Fact] public void Merge_ShouldAddNonExistingAttributesToClass() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("100%", target.Attributes["height"].Value); } [Fact] public void Merge_ShouldOverrideExistingEntriesIfSpecified() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("100%", target.Attributes["height"].Value); } [Fact] public void Merge_ShouldNotOverrideExistingEntriesIfNotSpecified() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, false); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("50%", target.Attributes["height"].Value); } [Fact] public void Merge_ShouldNotOverrideExistingImportantEntriesIfNewEntryIsNotImportant() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50% !important"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("50%", target.Attributes["height"].Value); } [Fact] public void Merge_ShouldOverrideExistingImportantEntriesIfNewEntryIsImportant() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["height"] = CssAttribute.FromRule("height: 50% !important"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100% !important"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("100%", target.Attributes["height"].Value); } [Fact] public void Merge_ShouldOverrideExistingEntriesIfSpecifiedIgnoringCasing() { var target = new StyleClass(); var donator = new StyleClass(); target.Attributes["color"] = CssAttribute.FromRule("color: red"); target.Attributes["HEight"] = CssAttribute.FromRule("height: 50%"); donator.Attributes["height"] = CssAttribute.FromRule("height: 100%"); target.Merge(donator, true); Assert.True(target.Attributes.ContainsKey("height")); Assert.Equal("100%", target.Attributes["height"].Value); } } }
using System; using Ephimes.Domain.Entities; using Ephimes.Domain.Interfaces.Repositories; using Ephimes.Domain.Interfaces.Services; namespace Ephimes.Domain.Services { public class UsuarioService : IUsuarioService { public UsuarioService(IUsuarioRepository repository) { Repository = repository; } public IUsuarioRepository Repository { get; private set; } public Usuario BuscarUsuario(int idUsuario) { try { //var nota = Repository.GetById(idNotaFiscal); //nota.DarBaixa(); //Repository.Update(nota); return new Usuario(""); } catch (Exception ex) { throw new Exception(ex.Message); } } } }
using System; using System.Collections.Concurrent; using System.Linq; using System.Threading.Tasks; namespace DepsWebApp.Services { internal class AccountService: IAccountService { private readonly BlockingCollection<string> _accounts = new BlockingCollection<string>(); ///<inheritdoc/> public Task<string> RegisterAsync(string login, string password) { //This could be removed as field attributes in model are capable of doing that. if (string.IsNullOrEmpty(login)) throw new ArgumentNullException(nameof(login)); if (string.IsNullOrEmpty(password)) throw new ArgumentNullException(nameof(password)); var toEncodeString = $"{login}:{password}"; var encodedCredentials = Base64Encode(toEncodeString); if (_accounts.Contains(encodedCredentials)) { return Task.FromException<string>(new InvalidOperationException("Account already exists")); } _accounts.TryAdd(encodedCredentials); return Task.FromResult(encodedCredentials); } /// <inheritdoc /> public Task<bool> GetAccount(string encodedString) { return Task.FromResult(_accounts.Contains(encodedString)); } /// <summary> /// Method to encode account credentials to Base64 /// </summary> /// <param name="plainText">input string</param> /// <returns>encoded to base 64 string</returns> private static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return Convert.ToBase64String(plainTextBytes); } } }
using System.Windows.Input; namespace BookShuffler.ViewModels { public class MainWindowCommands { public ICommand SaveProject { get; set; } public ICommand NewProject { get; set; } public ICommand OpenProject { get; set; } public ICommand ImportMarkdown { get; set; } public ICommand AttachEntity { get; set; } public ICommand DetachEntity { get; set; } public ICommand AutoArrange { get; set; } public ICommand EditCategories { get; set; } public ICommand CreateCard { get; set; } public ICommand CreateSection { get; set; } public ICommand DeleteEntity { get; set; } public ICommand SetCanvasScale { get; set; } public ICommand SetTreeScale { get; set; } public ICommand ExportRoot { get; set; } public ICommand ExportSection { get; set; } public ICommand OpenMarkdown { get; set; } public ICommand ReloadMarkdown { get; set; } } }
#if ANDROMEDA_SERIALIZER_CBOR||UNITY_EDITOR using Dahomey.Cbor; using Dahomey.Cbor.Util; using System.IO; using UnityEngine; namespace Andromeda.Saving.Cbor { [AddComponentMenu("")] public class CborSavingSystem : SavingSystemBase { protected override GameState LoadFile(string saveFile) { GameState state = new GameState(); string saveFilePath = GetPathFromSaveFile(saveFile); if (!File.Exists(saveFilePath)) return state; byte[] bytes = File.ReadAllBytes(saveFilePath); if (bytes == null) return state; state = Dahomey.Cbor.Cbor.Deserialize<GameState>(bytes); return state != null ? state : new GameState(); } protected override void SaveFile(string saveFile, GameState state) { string saveFilePath = GetPathFromSaveFile(saveFile); byte[] bytes = null; using (ByteBufferWriter writer = new ByteBufferWriter()) { Dahomey.Cbor.Cbor.Serialize(state, writer, CborOptions.Default); bytes = writer.WrittenSpan.ToArray(); } using (FileStream stream = File.Open(saveFilePath, FileMode.Create)) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(bytes); } } } } } #endif // ANDROMEDA_SERIALIZER_CBOR
using System.Text.Json.Serialization; namespace MinimalBFF.Adapters.OpenWeatherMap; public class OpenWeatherMapResponse { public double Lat { get; set; } public double Lon { get; set; } public string Timezone { get; set; } [JsonPropertyName("timezone_offset")] public int TimezoneOffset { get; set; } [JsonPropertyName("current")] public Weather CurrentWeather { get; set; } } public class Weather { public int Dt { get; set; } public int Sunrise { get; set; } public int Sunset { get; set; } public double Temp { get; set; } [JsonPropertyName("feels_like")] public double FeelsLike { get; set; } public int Pressure { get; set; } public int Humidity { get; set; } [JsonPropertyName("dew_point")] public double DewPoint { get; set; } public double Uvi { get; set; } public int Clouds { get; set; } public int Visibility { get; set; } [JsonPropertyName("wind_speed")] public double WindSpeed { get; set; } [JsonPropertyName("wind_deg")] public int WindDeg { get; set; } [JsonPropertyName("wind_gust")] public double WindGust { get; set; } [JsonPropertyName("weather")] public List<WeatherDescription> WeatherDescription { get; set; } } public class WeatherDescription { public int Id { get; set; } public string Main { get; set; } public string Description { get; set; } public string Icon { get; set; } }
using System; namespace HandControl.Services { public static class UnixTimestampConverter { /// <summary> /// Выполняет преобразование DateTime в Unix timestamp. /// </summary> /// <returns>Unix time.</returns> public static long DateTimeToUnix(DateTime time) { var origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var diff = time.ToUniversalTime() - origin; return (long)Math.Floor(diff.TotalSeconds); } /// <summary> /// Выполняет установку последнего времени изменения из unix времени. /// </summary> public static DateTime DateTimeFromUnix(long dateTime) { var outer = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var time = outer.AddSeconds(dateTime).ToLocalTime(); return time; } } }