content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SynoDownloader.UserControls
{
/// <summary>
/// Interaction logic for AddSubFolderDialog.xaml
/// </summary>
public partial class AddSubFolderDialog : UserControl
{
public AddSubFolderDialog()
{
InitializeComponent();
}
}
}
| 23.37931 | 57 | 0.731563 | [
"MIT"
] | bbo76/syno.downloader | src/UserControls/AddSubFolderDialog.xaml.cs | 680 | C# |
using AElf.Kernel.SmartContract.Application;
using AElf.Kernel.TransactionPool.Infrastructure;
using AElf.Kernel.Txn.Application;
using AElf.Modularity;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
namespace AElf.Kernel.TransactionPool
{
[DependsOn(typeof(CoreKernelAElfModule))]
public class TransactionPoolAElfModule : AElfModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var services = context.Services;
// Validate signature and tx size.
services.AddSingleton<ITransactionValidationProvider, BasicTransactionValidationProvider>();
services.AddSingleton<ITransactionValidationProvider, TransactionExecutionValidationProvider>();
services.AddSingleton<ITransactionValidationProvider, TransactionMethodValidationProvider>();
services.AddSingleton<ITransactionReadOnlyExecutionService, TransactionReadOnlyExecutionService>();
var configuration = context.Services.GetConfiguration();
Configure<TransactionOptions>(configuration.GetSection("Transaction"));
}
}
} | 45.307692 | 111 | 0.75382 | [
"MIT"
] | AElfProject/AElf | src/AElf.Kernel.TransactionPool/TransactionPoolAElfModule.cs | 1,178 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PEQuick.Flags;
using PEQuick.MetaData;
using PEQuick.TableRows;
namespace PEQuick.IL
{
public class MethodBody
{
private MethodBodyFormat _format;
private uint _size;
private byte[] _methodBody;
private List<(int Location, Row Row)> _tags = new List<(int Location, Row Row)>();
public MethodBody(uint rva, MetaDataTables tables)
{
var methodBody = tables.GetRVA(rva);
_format = (MethodBodyFormat)methodBody[0] & MethodBodyFormat.Mask;
switch (_format)
{
case MethodBodyFormat.Tiny:
//TinyFormat
_size = (ushort)(methodBody[0] >> 2);
ParseIL(methodBody.Slice(1, (int)_size), tables);
_methodBody = methodBody.Slice(0, (int)_size + 1).ToArray();
break;
case MethodBodyFormat.Fat:
//FatFormat
ParseFatBody(methodBody, tables);
break;
default:
throw new InvalidOperationException();
}
}
public Span<byte> GetBody(Dictionary<uint,uint> remapper)
{
//TODO remap the body as needed, for now this isn't being
//done
return _methodBody.AsSpan();
}
public IEnumerable<Row> DependentTags => _tags.Select(t => t.Row);
private void ParseFatBody(Span<byte> input, MetaDataTables tables)
{
var originalSpan = input;
input = input.Read(out ushort headerFlags);
input = input.Read(out ushort maxStack);
input = input.Read(out uint codeSize);
input = input.Read(out uint localvar);
ParseIL(input.Slice(0, (int)codeSize), tables);
var totalBodySize = originalSpan.Length - input.Slice((int)codeSize).Length;
_methodBody = originalSpan.Slice(0, totalBodySize).ToArray();
//TODO exception handlers and extra sections
}
private void ParseIL(Span<byte> il, MetaDataTables tables)
{
var intialLength = il.Length;
while (il.Length > 0)
{
OperandType opType;
var currentByte = il[0];
if (currentByte == 0xfe)
{
opType = ILTracer.GetTwoByteOperandType(il[1]);
il = il.Slice(2);
}
else
{
opType = ILTracer.GetSingleByteOperandType(currentByte);
il = il.Slice(1);
}
// Now we need to decide what to do based on the operand
switch (opType)
{
case OperandType.InlineBrTarget:
case OperandType.InlineI:
case OperandType.ShortInlineR:
il = il.Slice(4);
break;
case OperandType.ShortInlineI:
case OperandType.ShortInlineVar:
case OperandType.ShortInlineBrTarget:
il = il.Slice(1);
break;
case OperandType.InlineField:
case OperandType.InlineMethod:
case OperandType.InlineSig:
case OperandType.InlineString:
case OperandType.InlineTok:
case OperandType.InlineType:
var currentIndex = intialLength - il.Length;
il = il.Read(out uint tag);
_tags.Add((currentIndex, tables.GetRowByTag(tag)));
break;
case OperandType.InlineNone:
break;
case OperandType.InlineSwitch:
il = il.Read(out int numSwitches);
for (var i = 0; i < numSwitches; i++)
{
il = il.Read(out int switchTarget);
}
break;
default:
throw new NotImplementedException();
}
}
}
}
}
| 37.040984 | 91 | 0.474884 | [
"MIT"
] | Drawaes/dotnetXperiments | PEQuick/PEQuick/IL/MethodBody.cs | 4,521 | C# |
namespace MonoGameMPE.Core.Profiles {
public class RingProfile : Profile
{
public float Radius { get; set; }
public CircleRadiation Radiate { get; set; }
public override void GetOffsetAndHeading(out Vector offset, out Axis heading) {
FastRand.NextUnitVector(out heading);
if (Radiate == CircleRadiation.In)
offset = new Vector(-heading.X * Radius, -heading.Y * Radius);
else
offset = new Vector(heading.X * Radius, heading.Y * Radius);
if (Radiate == CircleRadiation.None)
FastRand.NextUnitVector(out heading);
}
}
} | 34.736842 | 87 | 0.593939 | [
"MIT"
] | Jjagg/MgMercury | Core/Profiles/RingProfile.cs | 662 | C# |
using InventorySystem.Items.Radio;
using Nexus.Entities.Items.Base;
using Nexus.Enums;
namespace Nexus.Entities.Items
{
/// <summary>
/// Represents an in-game inventory radio.
/// </summary>
public class RadioItem : BaseItem
{
internal InventorySystem.Items.Radio.RadioItem radio;
public RadioItem(InventorySystem.Items.Radio.RadioItem radio, bool addToApi = false) : base(radio, addToApi)
=> this.radio = radio;
/// <summary>
/// Gets a value indicating whether this radio is usable or not.
/// </summary>
public bool IsUsable { get => radio.IsUsable; }
/// <summary>
/// Gets or sets the battery's percentage.
/// </summary>
public byte Battery { get => radio.BatteryPercent; set => radio.BatteryPercent = value; }
/// <summary>
/// Gets or sets the current radio range.
/// </summary>
public RadioLevel Mode { get => (RadioLevel)radio.CurRange; set => radio.CurRange = (int)value; }
/// <summary>
/// Gets or sets the current range ID.
/// </summary>
public byte RangeId { get => radio._radio.NetworkcurRangeId; set => radio._radio.NetworkcurRangeId = value; }
/// <summary>
/// Gets the <see cref="global::Radio"/> component.
/// </summary>
public Radio Radio { get => radio._radio; }
/// <summary>
/// Gets an array of all radio ranges.
/// </summary>
public RadioRangeMode[] Modes { get => radio.Ranges; set => radio.Ranges = value; }
/// <summary>
/// Disables this radio.
/// </summary>
public void Disable()
=> radio.ServerProcessCmd(RadioMessages.RadioCommand.Disable);
/// <summary>
/// Enables this radio.
/// </summary>
public void Enable()
=> radio.ServerProcessCmd(RadioMessages.RadioCommand.Enable);
/// <summary>
/// Switches to the next mode.
/// </summary>
public void ChangeMode()
=> radio.ServerProcessCmd(RadioMessages.RadioCommand.ChangeRange);
}
} | 32.268657 | 117 | 0.581406 | [
"MIT"
] | NexusCommunity/Nexus | Nexus/Entities/Items/RadioItem.cs | 2,164 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
private static int doll = 0;
private static int train = 0;
private static int bear = 0;
private static int bicycle = 0;
private static Stack<int> materials = new Stack<int>(ReadArr());
private static Queue<int> magicLevels = new Queue<int>(ReadArr());
public static void Main(string[] args)
{
Crafting();
PrintOutput();
}
private static void PrintOutput()
{
if ((doll > 0 && train > 0) || (bear > 0 && bicycle > 0)) { Console.WriteLine("The presents are crafted! Merry Christmas!"); }
else { Console.WriteLine("No presents this Christmas!"); }
if (materials.Any()) { Console.WriteLine($"Materials left: {string.Join(", ", materials.ToArray())}"); }
if (magicLevels.Any()) { Console.WriteLine($"Magic left: {string.Join(", ", magicLevels.ToArray())}"); }
if (bicycle > 0) { Console.WriteLine($"Bicycle: {bicycle}"); }
if (doll > 0) { Console.WriteLine($"Doll: {doll}"); }
if (bear > 0) { Console.WriteLine($"Teddy bear: {bear}"); }
if (train > 0) { Console.WriteLine($"Wooden train: {train}"); }
}
private static void Crafting()
{
while (materials.Any() && magicLevels.Any())
{
int material = materials.Peek();
if (material == 0)
{
materials.Pop();
continue;
}
int magicLevel = magicLevels.Peek();
if (magicLevel == 0)
{
magicLevels.Dequeue();
continue;
}
materials.Pop();
magicLevels.Dequeue();
int product = material * magicLevel;
if (product < 0)
{
int sum = material + magicLevel;
materials.Push(sum);
}
else
{
switch (product)
{
case 150: doll++; break;
case 250: train++; break;
case 300: bear++; break;
case 400: bicycle++; break;
default:
material += 15;
materials.Push(material);
break;
}
}
}
}
public static int[] ReadArr()
{
return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
}
}
| 29.552941 | 134 | 0.487261 | [
"MIT"
] | aalishov/School | School-2020_2021/11B_Solutions/03-Module Algorithms/S08-StackAndQueue/P14-SantasPresentFactory/Program.cs | 2,514 | C# |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Polly;
using Polly.Registry;
using Stoolball.Caching;
using Stoolball.Matches;
namespace Stoolball.Data.Cache
{
public class CachedMatchListingDataSource : IMatchListingDataSource
{
private readonly ICacheableMatchListingDataSource _matchListingDataSource;
private readonly IReadOnlyPolicyRegistry<string> _policyRegistry;
private readonly IMatchFilterQueryStringSerializer _matchFilterSerializer;
public CachedMatchListingDataSource(IReadOnlyPolicyRegistry<string> policyRegistry, ICacheableMatchListingDataSource matchListingDataSource, IMatchFilterQueryStringSerializer matchFilterSerializer)
{
_policyRegistry = policyRegistry ?? throw new ArgumentNullException(nameof(policyRegistry));
_matchListingDataSource = matchListingDataSource ?? throw new ArgumentNullException(nameof(matchListingDataSource));
_matchFilterSerializer = matchFilterSerializer ?? throw new ArgumentNullException(nameof(matchFilterSerializer));
}
/// <inheritdoc />
public async Task<List<MatchListing>> ReadMatchListings(MatchFilter filter, MatchSortOrder sortOrder)
{
filter = filter ?? new MatchFilter();
var cachePolicy = _policyRegistry.Get<IAsyncPolicy>(CacheConstants.MatchesPolicy);
var cacheKey = CacheConstants.MatchListingsCacheKeyPrefix + _matchFilterSerializer.Serialize(filter) + sortOrder.ToString();
return await cachePolicy.ExecuteAsync(async context => await _matchListingDataSource.ReadMatchListings(filter, sortOrder), new Context(cacheKey));
}
/// <inheritdoc />
public async Task<int> ReadTotalMatches(MatchFilter filter)
{
return await _matchListingDataSource.ReadTotalMatches(filter).ConfigureAwait(false);
}
}
}
| 48.075 | 205 | 0.75299 | [
"Apache-2.0"
] | stoolball-england/stoolball-org-uk | Stoolball.Data.Cache/CachedMatchListingDataSource.cs | 1,925 | C# |
using ARKBreedingStats.uiControls;
namespace ARKBreedingStats
{
partial class BreedingPlan
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BreedingPlan));
this.tableLayoutMain = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPageBreedableSpecies = new System.Windows.Forms.TabPage();
this.listViewSpeciesBP = new System.Windows.Forms.ListView();
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tabPageTags = new System.Windows.Forms.TabPage();
this.cbOwnerFilterLibrary = new System.Windows.Forms.CheckBox();
this.cbServerFilterLibrary = new System.Windows.Forms.CheckBox();
this.cbBPTagExcludeDefault = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.tagSelectorList1 = new ARKBreedingStats.uiControls.TagSelectorList();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.lbBreedingPlanHeader = new System.Windows.Forms.Label();
this.pedigreeCreatureBestPossibleInSpecies = new ARKBreedingStats.PedigreeCreature();
this.btShowAllCreatures = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.pedigreeCreature1 = new ARKBreedingStats.PedigreeCreature();
this.lbBPBreedingScore = new System.Windows.Forms.Label();
this.pedigreeCreature2 = new ARKBreedingStats.PedigreeCreature();
this.gbBPOffspring = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.labelBreedingInfos = new System.Windows.Forms.Label();
this.listViewRaisingTimes = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lbBPBreedingTimes = new System.Windows.Forms.Label();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.lbBPProbabilityBest = new System.Windows.Forms.Label();
this.pedigreeCreatureBest = new ARKBreedingStats.PedigreeCreature();
this.pedigreeCreatureWorst = new ARKBreedingStats.PedigreeCreature();
this.lbMutationProbability = new System.Windows.Forms.Label();
this.btBPJustMated = new System.Windows.Forms.Button();
this.offspringPossibilities1 = new ARKBreedingStats.OffspringPossibilities();
this.panelCombinations = new System.Windows.Forms.Panel();
this.lbBreedingPlanInfo = new System.Windows.Forms.Label();
this.flowLayoutPanelPairs = new System.Windows.Forms.FlowLayoutPanel();
this.gbBPBreedingMode = new System.Windows.Forms.GroupBox();
this.cbBPMutationLimitOnlyOnePartner = new System.Windows.Forms.CheckBox();
this.cbBPOnlyOneSuggestionForFemales = new System.Windows.Forms.CheckBox();
this.cbBPIncludeCryoCreatures = new System.Windows.Forms.CheckBox();
this.nudBPMutationLimit = new ARKBreedingStats.uiControls.Nud();
this.label2 = new System.Windows.Forms.Label();
this.cbBPIncludeCooldowneds = new System.Windows.Forms.CheckBox();
this.rbBPTopStatsCn = new System.Windows.Forms.RadioButton();
this.rbBPHighStats = new System.Windows.Forms.RadioButton();
this.rbBPTopStats = new System.Windows.Forms.RadioButton();
this.statWeighting1 = new ARKBreedingStats.uiControls.StatWeighting();
this.tableLayoutMain.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPageBreedableSpecies.SuspendLayout();
this.tabPageTags.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.gbBPOffspring.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.panelCombinations.SuspendLayout();
this.gbBPBreedingMode.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudBPMutationLimit)).BeginInit();
this.SuspendLayout();
//
// tableLayoutMain
//
this.tableLayoutMain.ColumnCount = 2;
this.tableLayoutMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
this.tableLayoutMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutMain.Controls.Add(this.tabControl1, 0, 0);
this.tableLayoutMain.Controls.Add(this.tableLayoutPanel1, 1, 0);
this.tableLayoutMain.Controls.Add(this.gbBPBreedingMode, 0, 1);
this.tableLayoutMain.Controls.Add(this.statWeighting1, 0, 2);
this.tableLayoutMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutMain.Location = new System.Drawing.Point(0, 0);
this.tableLayoutMain.Name = "tableLayoutMain";
this.tableLayoutMain.RowCount = 3;
this.tableLayoutMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 215F));
this.tableLayoutMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 260F));
this.tableLayoutMain.Size = new System.Drawing.Size(1732, 1023);
this.tableLayoutMain.TabIndex = 5;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPageBreedableSpecies);
this.tabControl1.Controls.Add(this.tabPageTags);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(244, 542);
this.tabControl1.TabIndex = 8;
//
// tabPageBreedableSpecies
//
this.tabPageBreedableSpecies.Controls.Add(this.listViewSpeciesBP);
this.tabPageBreedableSpecies.Location = new System.Drawing.Point(4, 22);
this.tabPageBreedableSpecies.Name = "tabPageBreedableSpecies";
this.tabPageBreedableSpecies.Padding = new System.Windows.Forms.Padding(3);
this.tabPageBreedableSpecies.Size = new System.Drawing.Size(236, 516);
this.tabPageBreedableSpecies.TabIndex = 0;
this.tabPageBreedableSpecies.Text = "Breedable Species";
this.tabPageBreedableSpecies.UseVisualStyleBackColor = true;
//
// listViewSpeciesBP
//
this.listViewSpeciesBP.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader5});
this.listViewSpeciesBP.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewSpeciesBP.FullRowSelect = true;
this.listViewSpeciesBP.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listViewSpeciesBP.HideSelection = false;
this.listViewSpeciesBP.Location = new System.Drawing.Point(3, 3);
this.listViewSpeciesBP.MultiSelect = false;
this.listViewSpeciesBP.Name = "listViewSpeciesBP";
this.listViewSpeciesBP.Size = new System.Drawing.Size(230, 510);
this.listViewSpeciesBP.TabIndex = 3;
this.listViewSpeciesBP.UseCompatibleStateImageBehavior = false;
this.listViewSpeciesBP.View = System.Windows.Forms.View.Details;
this.listViewSpeciesBP.SelectedIndexChanged += new System.EventHandler(this.listViewSpeciesBP_SelectedIndexChanged);
//
// columnHeader5
//
this.columnHeader5.Text = "Species";
this.columnHeader5.Width = 178;
//
// tabPageTags
//
this.tabPageTags.Controls.Add(this.cbOwnerFilterLibrary);
this.tabPageTags.Controls.Add(this.cbServerFilterLibrary);
this.tabPageTags.Controls.Add(this.cbBPTagExcludeDefault);
this.tabPageTags.Controls.Add(this.label1);
this.tabPageTags.Controls.Add(this.tagSelectorList1);
this.tabPageTags.Location = new System.Drawing.Point(4, 22);
this.tabPageTags.Name = "tabPageTags";
this.tabPageTags.Padding = new System.Windows.Forms.Padding(3);
this.tabPageTags.Size = new System.Drawing.Size(236, 516);
this.tabPageTags.TabIndex = 1;
this.tabPageTags.Text = "Tags";
this.tabPageTags.UseVisualStyleBackColor = true;
//
// cbOwnerFilterLibrary
//
this.cbOwnerFilterLibrary.AutoSize = true;
this.cbOwnerFilterLibrary.Location = new System.Drawing.Point(3, 29);
this.cbOwnerFilterLibrary.Name = "cbOwnerFilterLibrary";
this.cbOwnerFilterLibrary.Size = new System.Drawing.Size(139, 17);
this.cbOwnerFilterLibrary.TabIndex = 6;
this.cbOwnerFilterLibrary.Text = "Owner Filter from Library";
this.cbOwnerFilterLibrary.UseVisualStyleBackColor = true;
this.cbOwnerFilterLibrary.CheckedChanged += new System.EventHandler(this.cbOwnerFilterLibrary_CheckedChanged);
//
// cbServerFilterLibrary
//
this.cbServerFilterLibrary.AutoSize = true;
this.cbServerFilterLibrary.Location = new System.Drawing.Point(3, 6);
this.cbServerFilterLibrary.Name = "cbServerFilterLibrary";
this.cbServerFilterLibrary.Size = new System.Drawing.Size(139, 17);
this.cbServerFilterLibrary.TabIndex = 5;
this.cbServerFilterLibrary.Text = "Server Filter from Library";
this.cbServerFilterLibrary.UseVisualStyleBackColor = true;
this.cbServerFilterLibrary.CheckedChanged += new System.EventHandler(this.cbServerFilterLibrary_CheckedChanged);
//
// cbBPTagExcludeDefault
//
this.cbBPTagExcludeDefault.AutoSize = true;
this.cbBPTagExcludeDefault.Location = new System.Drawing.Point(6, 121);
this.cbBPTagExcludeDefault.Name = "cbBPTagExcludeDefault";
this.cbBPTagExcludeDefault.Size = new System.Drawing.Size(160, 17);
this.cbBPTagExcludeDefault.TabIndex = 4;
this.cbBPTagExcludeDefault.Text = "Exclude creatures by default";
this.cbBPTagExcludeDefault.UseVisualStyleBackColor = true;
this.cbBPTagExcludeDefault.CheckedChanged += new System.EventHandler(this.cbTagExcludeDefault_CheckedChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(6, 49);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(174, 69);
this.label1.TabIndex = 2;
this.label1.Text = "Consider creatures by tag. \r\n✕ excludes creatures, ✓ includes creatures (even if " +
"they have an exclusive tag). Add tags in the library with F3.";
//
// tagSelectorList1
//
this.tagSelectorList1.AutoScroll = true;
this.tagSelectorList1.Location = new System.Drawing.Point(6, 144);
this.tagSelectorList1.Name = "tagSelectorList1";
this.tagSelectorList1.Size = new System.Drawing.Size(174, 263);
this.tagSelectorList1.TabIndex = 3;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.gbBPOffspring, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.panelCombinations, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(253, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutMain.SetRowSpan(this.tableLayoutPanel1, 3);
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 128F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 182F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1476, 1017);
this.tableLayoutPanel1.TabIndex = 4;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.lbBreedingPlanHeader);
this.flowLayoutPanel1.Controls.Add(this.pedigreeCreatureBestPossibleInSpecies);
this.flowLayoutPanel1.Controls.Add(this.btShowAllCreatures);
this.flowLayoutPanel1.Controls.Add(this.panel1);
this.flowLayoutPanel1.Controls.Add(this.pedigreeCreature1);
this.flowLayoutPanel1.Controls.Add(this.lbBPBreedingScore);
this.flowLayoutPanel1.Controls.Add(this.pedigreeCreature2);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1470, 122);
this.flowLayoutPanel1.TabIndex = 5;
//
// lbBreedingPlanHeader
//
this.flowLayoutPanel1.SetFlowBreak(this.lbBreedingPlanHeader, true);
this.lbBreedingPlanHeader.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbBreedingPlanHeader.Location = new System.Drawing.Point(3, 0);
this.lbBreedingPlanHeader.Name = "lbBreedingPlanHeader";
this.lbBreedingPlanHeader.Size = new System.Drawing.Size(599, 27);
this.lbBreedingPlanHeader.TabIndex = 1;
this.lbBreedingPlanHeader.Text = "Select a species and click on \"Determine Best Breeding\" to see suggestions";
this.lbBreedingPlanHeader.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// pedigreeCreatureBestPossibleInSpecies
//
this.pedigreeCreatureBestPossibleInSpecies.Creature = null;
this.pedigreeCreatureBestPossibleInSpecies.IsVirtual = false;
this.pedigreeCreatureBestPossibleInSpecies.Location = new System.Drawing.Point(3, 44);
this.pedigreeCreatureBestPossibleInSpecies.Name = "pedigreeCreatureBestPossibleInSpecies";
this.pedigreeCreatureBestPossibleInSpecies.OnlyLevels = false;
this.pedigreeCreatureBestPossibleInSpecies.Size = new System.Drawing.Size(325, 35);
this.pedigreeCreatureBestPossibleInSpecies.TabIndex = 5;
this.pedigreeCreatureBestPossibleInSpecies.TotalLevelUnknown = false;
//
// btShowAllCreatures
//
this.btShowAllCreatures.Location = new System.Drawing.Point(426, 44);
this.btShowAllCreatures.Margin = new System.Windows.Forms.Padding(95, 3, 3, 3);
this.btShowAllCreatures.Name = "btShowAllCreatures";
this.btShowAllCreatures.Size = new System.Drawing.Size(297, 35);
this.btShowAllCreatures.TabIndex = 6;
this.btShowAllCreatures.Text = "Unset restriction to …";
this.btShowAllCreatures.UseVisualStyleBackColor = true;
this.btShowAllCreatures.Click += new System.EventHandler(this.btShowAllCreatures_Click);
//
// panel1
//
this.flowLayoutPanel1.SetFlowBreak(this.panel1, true);
this.panel1.Location = new System.Drawing.Point(729, 44);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(10, 32);
this.panel1.TabIndex = 7;
//
// pedigreeCreature1
//
this.pedigreeCreature1.Creature = null;
this.pedigreeCreature1.IsVirtual = false;
this.pedigreeCreature1.Location = new System.Drawing.Point(3, 82);
this.pedigreeCreature1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.pedigreeCreature1.Name = "pedigreeCreature1";
this.pedigreeCreature1.OnlyLevels = false;
this.pedigreeCreature1.Size = new System.Drawing.Size(325, 35);
this.pedigreeCreature1.TabIndex = 2;
this.pedigreeCreature1.TotalLevelUnknown = false;
//
// lbBPBreedingScore
//
this.lbBPBreedingScore.Location = new System.Drawing.Point(334, 97);
this.lbBPBreedingScore.Margin = new System.Windows.Forms.Padding(3, 15, 3, 0);
this.lbBPBreedingScore.Name = "lbBPBreedingScore";
this.lbBPBreedingScore.Size = new System.Drawing.Size(87, 20);
this.lbBPBreedingScore.TabIndex = 4;
this.lbBPBreedingScore.Text = "Breeding-Score";
//
// pedigreeCreature2
//
this.pedigreeCreature2.Creature = null;
this.pedigreeCreature2.IsVirtual = false;
this.pedigreeCreature2.Location = new System.Drawing.Point(427, 82);
this.pedigreeCreature2.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
this.pedigreeCreature2.Name = "pedigreeCreature2";
this.pedigreeCreature2.OnlyLevels = false;
this.pedigreeCreature2.Size = new System.Drawing.Size(325, 35);
this.pedigreeCreature2.TabIndex = 3;
this.pedigreeCreature2.TotalLevelUnknown = false;
//
// gbBPOffspring
//
this.gbBPOffspring.Controls.Add(this.tableLayoutPanel2);
this.gbBPOffspring.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbBPOffspring.Location = new System.Drawing.Point(3, 838);
this.gbBPOffspring.Name = "gbBPOffspring";
this.gbBPOffspring.Size = new System.Drawing.Size(1470, 176);
this.gbBPOffspring.TabIndex = 2;
this.gbBPOffspring.TabStop = false;
this.gbBPOffspring.Text = "Offspring";
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.offspringPossibilities1, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1464, 157);
this.tableLayoutPanel2.TabIndex = 9;
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 1;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.labelBreedingInfos, 0, 2);
this.tableLayoutPanel4.Controls.Add(this.listViewRaisingTimes, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.lbBPBreedingTimes, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(614, 3);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 3;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.Size = new System.Drawing.Size(847, 151);
this.tableLayoutPanel4.TabIndex = 0;
//
// labelBreedingInfos
//
this.labelBreedingInfos.AutoSize = true;
this.labelBreedingInfos.Location = new System.Drawing.Point(3, 121);
this.labelBreedingInfos.Name = "labelBreedingInfos";
this.labelBreedingInfos.Size = new System.Drawing.Size(75, 13);
this.labelBreedingInfos.TabIndex = 7;
this.labelBreedingInfos.Text = "Breeding Infos";
//
// listViewRaisingTimes
//
this.listViewRaisingTimes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4});
this.listViewRaisingTimes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listViewRaisingTimes.HideSelection = false;
this.listViewRaisingTimes.Location = new System.Drawing.Point(3, 20);
this.listViewRaisingTimes.Name = "listViewRaisingTimes";
this.listViewRaisingTimes.ShowGroups = false;
this.listViewRaisingTimes.Size = new System.Drawing.Size(351, 98);
this.listViewRaisingTimes.TabIndex = 4;
this.listViewRaisingTimes.UseCompatibleStateImageBehavior = false;
this.listViewRaisingTimes.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "";
this.columnHeader1.Width = 70;
//
// columnHeader2
//
this.columnHeader2.Text = "Time";
this.columnHeader2.Width = 70;
//
// columnHeader3
//
this.columnHeader3.Text = "Total Time";
this.columnHeader3.Width = 70;
//
// columnHeader4
//
this.columnHeader4.Text = "Finished at";
this.columnHeader4.Width = 103;
//
// lbBPBreedingTimes
//
this.lbBPBreedingTimes.AutoSize = true;
this.lbBPBreedingTimes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbBPBreedingTimes.Location = new System.Drawing.Point(3, 0);
this.lbBPBreedingTimes.Name = "lbBPBreedingTimes";
this.lbBPBreedingTimes.Size = new System.Drawing.Size(121, 17);
this.lbBPBreedingTimes.TabIndex = 3;
this.lbBPBreedingTimes.Text = "Breeding Times";
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.lbBPProbabilityBest);
this.flowLayoutPanel2.Controls.Add(this.pedigreeCreatureBest);
this.flowLayoutPanel2.Controls.Add(this.pedigreeCreatureWorst);
this.flowLayoutPanel2.Controls.Add(this.lbMutationProbability);
this.flowLayoutPanel2.Controls.Add(this.btBPJustMated);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(352, 151);
this.flowLayoutPanel2.TabIndex = 8;
//
// lbBPProbabilityBest
//
this.lbBPProbabilityBest.AutoSize = true;
this.flowLayoutPanel2.SetFlowBreak(this.lbBPProbabilityBest, true);
this.lbBPProbabilityBest.Location = new System.Drawing.Point(3, 0);
this.lbBPProbabilityBest.Name = "lbBPProbabilityBest";
this.lbBPProbabilityBest.Size = new System.Drawing.Size(202, 13);
this.lbBPProbabilityBest.TabIndex = 6;
this.lbBPProbabilityBest.Text = "Probability for this Best Possible outcome:";
//
// pedigreeCreatureBest
//
this.pedigreeCreatureBest.Creature = null;
this.pedigreeCreatureBest.Cursor = System.Windows.Forms.Cursors.Hand;
this.flowLayoutPanel2.SetFlowBreak(this.pedigreeCreatureBest, true);
this.pedigreeCreatureBest.IsVirtual = false;
this.pedigreeCreatureBest.Location = new System.Drawing.Point(3, 16);
this.pedigreeCreatureBest.Name = "pedigreeCreatureBest";
this.pedigreeCreatureBest.OnlyLevels = false;
this.pedigreeCreatureBest.Size = new System.Drawing.Size(325, 35);
this.pedigreeCreatureBest.TabIndex = 1;
this.pedigreeCreatureBest.TotalLevelUnknown = false;
//
// pedigreeCreatureWorst
//
this.pedigreeCreatureWorst.Creature = null;
this.pedigreeCreatureWorst.Cursor = System.Windows.Forms.Cursors.Hand;
this.flowLayoutPanel2.SetFlowBreak(this.pedigreeCreatureWorst, true);
this.pedigreeCreatureWorst.IsVirtual = false;
this.pedigreeCreatureWorst.Location = new System.Drawing.Point(3, 57);
this.pedigreeCreatureWorst.Name = "pedigreeCreatureWorst";
this.pedigreeCreatureWorst.OnlyLevels = false;
this.pedigreeCreatureWorst.Size = new System.Drawing.Size(325, 35);
this.pedigreeCreatureWorst.TabIndex = 2;
this.pedigreeCreatureWorst.TotalLevelUnknown = false;
//
// lbMutationProbability
//
this.lbMutationProbability.AutoSize = true;
this.flowLayoutPanel2.SetFlowBreak(this.lbMutationProbability, true);
this.lbMutationProbability.Location = new System.Drawing.Point(3, 95);
this.lbMutationProbability.Name = "lbMutationProbability";
this.lbMutationProbability.Size = new System.Drawing.Size(115, 13);
this.lbMutationProbability.TabIndex = 7;
this.lbMutationProbability.Text = "Probability of mutations";
//
// btBPJustMated
//
this.btBPJustMated.Location = new System.Drawing.Point(3, 111);
this.btBPJustMated.Name = "btBPJustMated";
this.btBPJustMated.Size = new System.Drawing.Size(325, 29);
this.btBPJustMated.TabIndex = 0;
this.btBPJustMated.Text = "These Parents just mated";
this.btBPJustMated.UseVisualStyleBackColor = true;
this.btBPJustMated.Click += new System.EventHandler(this.buttonJustMated_Click);
//
// offspringPossibilities1
//
this.offspringPossibilities1.Location = new System.Drawing.Point(361, 3);
this.offspringPossibilities1.Name = "offspringPossibilities1";
this.offspringPossibilities1.Size = new System.Drawing.Size(247, 151);
this.offspringPossibilities1.TabIndex = 1;
//
// panelCombinations
//
this.panelCombinations.Controls.Add(this.lbBreedingPlanInfo);
this.panelCombinations.Controls.Add(this.flowLayoutPanelPairs);
this.panelCombinations.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelCombinations.Location = new System.Drawing.Point(3, 131);
this.panelCombinations.Name = "panelCombinations";
this.panelCombinations.Size = new System.Drawing.Size(1470, 701);
this.panelCombinations.TabIndex = 3;
//
// lbBreedingPlanInfo
//
this.lbBreedingPlanInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbBreedingPlanInfo.Location = new System.Drawing.Point(10, 75);
this.lbBreedingPlanInfo.Name = "lbBreedingPlanInfo";
this.lbBreedingPlanInfo.Size = new System.Drawing.Size(683, 193);
this.lbBreedingPlanInfo.TabIndex = 0;
this.lbBreedingPlanInfo.Text = "Infotext";
this.lbBreedingPlanInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lbBreedingPlanInfo.Visible = false;
//
// flowLayoutPanelPairs
//
this.flowLayoutPanelPairs.AutoScroll = true;
this.flowLayoutPanelPairs.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanelPairs.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanelPairs.Name = "flowLayoutPanelPairs";
this.flowLayoutPanelPairs.Size = new System.Drawing.Size(1470, 701);
this.flowLayoutPanelPairs.TabIndex = 1;
//
// gbBPBreedingMode
//
this.gbBPBreedingMode.Controls.Add(this.cbBPMutationLimitOnlyOnePartner);
this.gbBPBreedingMode.Controls.Add(this.cbBPOnlyOneSuggestionForFemales);
this.gbBPBreedingMode.Controls.Add(this.cbBPIncludeCryoCreatures);
this.gbBPBreedingMode.Controls.Add(this.nudBPMutationLimit);
this.gbBPBreedingMode.Controls.Add(this.label2);
this.gbBPBreedingMode.Controls.Add(this.cbBPIncludeCooldowneds);
this.gbBPBreedingMode.Controls.Add(this.rbBPTopStatsCn);
this.gbBPBreedingMode.Controls.Add(this.rbBPHighStats);
this.gbBPBreedingMode.Controls.Add(this.rbBPTopStats);
this.gbBPBreedingMode.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbBPBreedingMode.Location = new System.Drawing.Point(3, 551);
this.gbBPBreedingMode.Name = "gbBPBreedingMode";
this.gbBPBreedingMode.Size = new System.Drawing.Size(244, 209);
this.gbBPBreedingMode.TabIndex = 6;
this.gbBPBreedingMode.TabStop = false;
this.gbBPBreedingMode.Text = "Breeding-Mode";
//
// cbBPMutationLimitOnlyOnePartner
//
this.cbBPMutationLimitOnlyOnePartner.AutoSize = true;
this.cbBPMutationLimitOnlyOnePartner.Location = new System.Drawing.Point(29, 160);
this.cbBPMutationLimitOnlyOnePartner.Name = "cbBPMutationLimitOnlyOnePartner";
this.cbBPMutationLimitOnlyOnePartner.Size = new System.Drawing.Size(205, 17);
this.cbBPMutationLimitOnlyOnePartner.TabIndex = 8;
this.cbBPMutationLimitOnlyOnePartner.Text = "One partner may have more mutations";
this.cbBPMutationLimitOnlyOnePartner.UseVisualStyleBackColor = true;
this.cbBPMutationLimitOnlyOnePartner.CheckedChanged += new System.EventHandler(this.cbMutationLimitOnlyOnePartner_CheckedChanged);
//
// cbBPOnlyOneSuggestionForFemales
//
this.cbBPOnlyOneSuggestionForFemales.AutoSize = true;
this.cbBPOnlyOneSuggestionForFemales.Location = new System.Drawing.Point(6, 183);
this.cbBPOnlyOneSuggestionForFemales.Name = "cbBPOnlyOneSuggestionForFemales";
this.cbBPOnlyOneSuggestionForFemales.Size = new System.Drawing.Size(178, 17);
this.cbBPOnlyOneSuggestionForFemales.TabIndex = 7;
this.cbBPOnlyOneSuggestionForFemales.Text = "Only best suggestion for females";
this.cbBPOnlyOneSuggestionForFemales.UseVisualStyleBackColor = true;
this.cbBPOnlyOneSuggestionForFemales.CheckedChanged += new System.EventHandler(this.cbOnlyOneSuggestionForFemales_CheckedChanged);
//
// cbBPIncludeCryoCreatures
//
this.cbBPIncludeCryoCreatures.AutoSize = true;
this.cbBPIncludeCryoCreatures.Location = new System.Drawing.Point(6, 111);
this.cbBPIncludeCryoCreatures.Name = "cbBPIncludeCryoCreatures";
this.cbBPIncludeCryoCreatures.Size = new System.Drawing.Size(167, 17);
this.cbBPIncludeCryoCreatures.TabIndex = 6;
this.cbBPIncludeCryoCreatures.Text = "Include Creatures in Cryopods";
this.cbBPIncludeCryoCreatures.UseVisualStyleBackColor = true;
this.cbBPIncludeCryoCreatures.CheckedChanged += new System.EventHandler(this.cbBPIncludeCryoCreatures_CheckedChanged);
//
// nudBPMutationLimit
//
this.nudBPMutationLimit.ForeColor = System.Drawing.SystemColors.GrayText;
this.nudBPMutationLimit.Location = new System.Drawing.Point(162, 134);
this.nudBPMutationLimit.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.nudBPMutationLimit.Minimum = new decimal(new int[] {
1,
0,
0,
-2147483648});
this.nudBPMutationLimit.Name = "nudBPMutationLimit";
this.nudBPMutationLimit.NeutralNumber = new decimal(new int[] {
0,
0,
0,
0});
this.nudBPMutationLimit.Size = new System.Drawing.Size(50, 20);
this.nudBPMutationLimit.TabIndex = 4;
this.nudBPMutationLimit.ValueChanged += new System.EventHandler(this.nudMutationLimit_ValueChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 136);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(150, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Creatures with Mutations up to";
//
// cbBPIncludeCooldowneds
//
this.cbBPIncludeCooldowneds.AutoSize = true;
this.cbBPIncludeCooldowneds.Location = new System.Drawing.Point(6, 88);
this.cbBPIncludeCooldowneds.Name = "cbBPIncludeCooldowneds";
this.cbBPIncludeCooldowneds.Size = new System.Drawing.Size(181, 17);
this.cbBPIncludeCooldowneds.TabIndex = 3;
this.cbBPIncludeCooldowneds.Text = "Include Creatures with Cooldown";
this.cbBPIncludeCooldowneds.UseVisualStyleBackColor = true;
this.cbBPIncludeCooldowneds.CheckedChanged += new System.EventHandler(this.checkBoxIncludeCooldowneds_CheckedChanged);
//
// rbBPTopStatsCn
//
this.rbBPTopStatsCn.AutoSize = true;
this.rbBPTopStatsCn.Checked = true;
this.rbBPTopStatsCn.Location = new System.Drawing.Point(6, 19);
this.rbBPTopStatsCn.Name = "rbBPTopStatsCn";
this.rbBPTopStatsCn.Size = new System.Drawing.Size(115, 17);
this.rbBPTopStatsCn.TabIndex = 2;
this.rbBPTopStatsCn.TabStop = true;
this.rbBPTopStatsCn.Text = "Combine Top Stats";
this.rbBPTopStatsCn.UseVisualStyleBackColor = true;
this.rbBPTopStatsCn.CheckedChanged += new System.EventHandler(this.radioButtonBPTopStatsCn_CheckedChanged);
//
// rbBPHighStats
//
this.rbBPHighStats.AutoSize = true;
this.rbBPHighStats.Location = new System.Drawing.Point(6, 65);
this.rbBPHighStats.Name = "rbBPHighStats";
this.rbBPHighStats.Size = new System.Drawing.Size(126, 17);
this.rbBPHighStats.TabIndex = 1;
this.rbBPHighStats.Text = "Best Next Generation";
this.rbBPHighStats.UseVisualStyleBackColor = true;
this.rbBPHighStats.CheckedChanged += new System.EventHandler(this.radioButtonBPHighStats_CheckedChanged);
//
// rbBPTopStats
//
this.rbBPTopStats.AutoSize = true;
this.rbBPTopStats.Location = new System.Drawing.Point(6, 42);
this.rbBPTopStats.Name = "rbBPTopStats";
this.rbBPTopStats.Size = new System.Drawing.Size(86, 17);
this.rbBPTopStats.TabIndex = 0;
this.rbBPTopStats.Text = "Top Stats Lc";
this.rbBPTopStats.UseVisualStyleBackColor = true;
this.rbBPTopStats.CheckedChanged += new System.EventHandler(this.radioButtonBPTopStats_CheckedChanged);
//
// statWeighting1
//
this.statWeighting1.CustomWeightings = ((System.Collections.Generic.Dictionary<string, double[]>)(resources.GetObject("statWeighting1.CustomWeightings")));
this.statWeighting1.Dock = System.Windows.Forms.DockStyle.Fill;
this.statWeighting1.Location = new System.Drawing.Point(3, 766);
this.statWeighting1.Name = "statWeighting1";
this.statWeighting1.Size = new System.Drawing.Size(244, 254);
this.statWeighting1.TabIndex = 7;
this.statWeighting1.WeightValues = new double[] {
1D,
1D,
1D,
1D,
1D,
1D,
1D,
1D,
1D,
1D,
1D,
1D};
//
// BreedingPlan
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.Controls.Add(this.tableLayoutMain);
this.Name = "BreedingPlan";
this.Size = new System.Drawing.Size(1732, 1023);
this.tableLayoutMain.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPageBreedableSpecies.ResumeLayout(false);
this.tabPageTags.ResumeLayout(false);
this.tabPageTags.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.gbBPOffspring.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
this.panelCombinations.ResumeLayout(false);
this.gbBPBreedingMode.ResumeLayout(false);
this.gbBPBreedingMode.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudBPMutationLimit)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutMain;
private System.Windows.Forms.ListView listViewSpeciesBP;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.GroupBox gbBPBreedingMode;
private System.Windows.Forms.CheckBox cbBPIncludeCooldowneds;
private System.Windows.Forms.RadioButton rbBPTopStatsCn;
private System.Windows.Forms.RadioButton rbBPHighStats;
private System.Windows.Forms.RadioButton rbBPTopStats;
private StatWeighting statWeighting1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPageBreedableSpecies;
private System.Windows.Forms.TabPage tabPageTags;
private System.Windows.Forms.Label label1;
private uiControls.TagSelectorList tagSelectorList1;
private uiControls.Nud nudBPMutationLimit;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cbBPTagExcludeDefault;
private System.Windows.Forms.CheckBox cbServerFilterLibrary;
private System.Windows.Forms.CheckBox cbOwnerFilterLibrary;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label lbBreedingPlanHeader;
private PedigreeCreature pedigreeCreatureBestPossibleInSpecies;
private System.Windows.Forms.Button btShowAllCreatures;
private System.Windows.Forms.Panel panel1;
private PedigreeCreature pedigreeCreature1;
private System.Windows.Forms.Label lbBPBreedingScore;
private PedigreeCreature pedigreeCreature2;
private System.Windows.Forms.GroupBox gbBPOffspring;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Label labelBreedingInfos;
private System.Windows.Forms.ListView listViewRaisingTimes;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.Label lbBPBreedingTimes;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Label lbBPProbabilityBest;
private PedigreeCreature pedigreeCreatureBest;
private PedigreeCreature pedigreeCreatureWorst;
private System.Windows.Forms.Button btBPJustMated;
private OffspringPossibilities offspringPossibilities1;
private System.Windows.Forms.Panel panelCombinations;
private System.Windows.Forms.Label lbBreedingPlanInfo;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelPairs;
private System.Windows.Forms.CheckBox cbBPIncludeCryoCreatures;
private System.Windows.Forms.CheckBox cbBPOnlyOneSuggestionForFemales;
private System.Windows.Forms.CheckBox cbBPMutationLimitOnlyOnePartner;
private System.Windows.Forms.Label lbMutationProbability;
}
}
| 57.472401 | 180 | 0.65462 | [
"MIT"
] | EmkioA/ARKStatsExtractor | ARKBreedingStats/BreedingPlan.Designer.cs | 44,783 | C# |
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Openchain.Infrastructure;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Openchain.SqlServer
{
public class SqlServerLedger : SqlServerStorageEngine, ILedgerQueries, ILedgerIndexes
{
private readonly int instanceId;
public SqlServerLedger(string connectionString, int instanceId, TimeSpan commandTimeout)
: base(connectionString, instanceId, commandTimeout)
{
this.instanceId = instanceId;
}
public async Task<IReadOnlyList<Record>> GetKeyStartingFrom(ByteString prefix)
{
byte[] from = prefix.ToByteArray();
byte[] to = prefix.ToByteArray();
to[to.Length - 1]++;
return await ExecuteQuery<Record>(
"EXEC [Openchain].[GetRecordRange] @instance, @from, @to;",
reader => new Record(new ByteString((byte[])reader[0]), new ByteString((byte[])reader[1]), new ByteString((byte[])reader[2])),
new Dictionary<string, object>()
{
["instance"] = this.instanceId,
["from"] = from,
["to"] = to
});
}
public async Task<IReadOnlyList<ByteString>> GetRecordMutations(ByteString recordKey)
{
return await ExecuteQuery<ByteString>(
"EXEC [Openchain].[GetRecordMutations] @instance, @recordKey;",
reader => new ByteString((byte[])reader[0]),
new Dictionary<string, object>()
{
["instance"] = this.instanceId,
["recordKey"] = recordKey.ToByteArray()
});
}
public async Task<ByteString> GetTransaction(ByteString mutationHash)
{
IReadOnlyList<ByteString> result = await ExecuteQuery<ByteString>(
"EXEC [Openchain].[GetTransaction] @instance, @mutationHash;",
reader => new ByteString((byte[])reader[0]),
new Dictionary<string, object>()
{
["instance"] = this.instanceId,
["mutationHash"] = mutationHash.ToByteArray()
});
if (result.Count > 0)
return result[0];
else
return null;
}
public async Task<IReadOnlyList<Record>> GetAllRecords(RecordType type, string name)
{
return await ExecuteQuery<Record>(
"EXEC [Openchain].[GetAllRecords] @instance, @recordType, @recordName;",
reader => new Record(new ByteString((byte[])reader[0]), new ByteString((byte[])reader[1]), new ByteString((byte[])reader[2])),
new Dictionary<string, object>()
{
["instance"] = this.instanceId,
["recordType"] = (byte)type,
["recordName"] = name
});
}
protected override RecordKey ParseRecordKey(ByteString key)
{
return RecordKey.Parse(key);
}
}
}
| 38.319588 | 142 | 0.572774 | [
"Apache-2.0"
] | numerum-tech/openchain | src/Openchain.SqlServer/SqlServerLedger.cs | 3,719 | C# |
//
// $Id: InputFileTag.cs 8596 2010-11-29 21:33:06Z zeqiangma $
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Initial Developer of the DirecTag peptide sequence tagger is Matt Chambers.
// Contributor(s): Surendra Dasaris
//
// The Initial Developer of the ScanRanker GUI is Zeqiang Ma.
// Contributor(s):
//
// Copyright 2009 Vanderbilt University
//
// copy from IDPicker project to enable multifile selection in treeview
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace ScanRanker
{
public enum InputFileType
{
Unknown,
PepXML,
IdpXML
}
public class InputFileTag : ICloneable
{
private string typeDesc;
private bool allowSelection;
private string databasePath;
private string groupName;
private string fullPath;
private bool passedChecks;
private string errorMsg;
private InputFileType fileType;
/// <summary>
/// root, dir, group, file
/// </summary>
public string TypeDesc
{
get { return typeDesc; }
set { typeDesc = value; }
}
/// <summary>
/// The database path read from the input file (pepxml)
/// </summary>
public string DatabasePath
{
get { return databasePath; }
set { databasePath = value; }
}
/// <summary>
/// Used to filter checkability of nodes based on
/// some criteria..currently by selection of the database
/// </summary>
public bool AllowSelection
{
get { return allowSelection; }
set { allowSelection = value; }
}
/// <summary>
/// (Complete Path - Base Path).Replace("\\", "/")
/// Start with /, file name is currently not a group level
/// so last level of the group name is the bottom most dir
/// the file is in
/// </summary>
public string GroupName
{
get { return groupName; }
set { groupName = value; }
}
/// <summary>
/// The complete path (dir or file) associated with the node
/// </summary>
public string FullPath
{
get { return fullPath; }
set { fullPath = value; }
}
/// <summary>
/// Passed checks in (checkAndSetFileNode in RunReportForm)
/// </summary>
public bool PassedChecks
{
get { return passedChecks; }
set { passedChecks = value; }
}
/// <summary>
/// Error msg built for file nodes (checkAndSetFileNode in RunReportForm)
/// </summary>
public string ErrorMsg
{
get { return errorMsg; }
set { errorMsg = value; }
}
public InputFileType FileType
{
get { return fileType; }
set { fileType = value; }
}
public bool IsGroup
{
get
{
switch (TypeDesc.ToLower())
{
default:
return false;
case "group":
return true;
}
}
}
public bool IsRoot
{
get
{
switch (TypeDesc.ToLower())
{
default:
return false;
case "root":
return true;
}
}
}
public bool IsFile
{
get
{
switch (TypeDesc.ToLower())
{
default:
return false;
case "file":
return true;
}
}
}
public bool IsDir
{
get
{
switch (TypeDesc.ToLower())
{
default:
return false;
case "dir":
return true;
}
}
}
public InputFileTag(string typeDescription, string filePath, string groupPath, string dbFileName, bool allowSel)
{
FullPath = filePath;
GroupName = groupPath;
TypeDesc = typeDescription;
AllowSelection = allowSel;
DatabasePath = dbFileName;
PassedChecks = false;
}
public InputFileTag(string typeDescription, string path, bool allowSel)
{
TypeDesc = typeDescription;
FullPath = path;
AllowSelection = allowSel;
PassedChecks = false;
}
public InputFileTag()
{
PassedChecks = false;
}
public object Clone()
{
try
{
InputFileTag tag = new InputFileTag();
tag.TypeDesc = TypeDesc;
tag.AllowSelection = AllowSelection;
tag.DatabasePath = DatabasePath;
tag.GroupName = GroupName;
tag.FullPath = FullPath;
tag.PassedChecks = PassedChecks;
tag.ErrorMsg = ErrorMsg;
return tag;
}
catch (Exception exc)
{
throw exc;
}
}
}
}
| 27.5 | 121 | 0.469992 | [
"Apache-2.0"
] | shze/pwizard-deb | pwiz_tools/Bumbershoot/scanranker/GUI/InputFileTag.cs | 6,215 | C# |
namespace P01_BillsPaymentSystem.Data
{
public class Configuration
{
public const string ConnectionString = "Server=PIROMAN\\SQLEXPRESS;Database=BillsPaymentSystem;Integrated Security=True;";
}
} | 30.857143 | 130 | 0.75463 | [
"MIT"
] | pirocorp/Databases-Advanced---Entity-Framework | 06. Advanced Relations/Exercises/P01_BillsPaymentSystem/P01_BillsPaymentSystem.Data/Configuration.cs | 218 | C# |
using System;
using System.Text;
using UnityEditor.Graphing;
using UnityEngine;
namespace UnityEditor.ShaderGraph.Internal
{
[Serializable]
public abstract class VectorShaderProperty : AbstractShaderProperty<Vector4>
{
internal override bool isExposable => true;
internal override bool isRenamable => true;
internal override string GetPropertyBlockString()
{
return $"{hideTagString}{referenceName}(\"{displayName}\", Vector) = ({NodeUtils.FloatToShaderValueShaderLabSafe(value.x)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.y)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.z)}, {NodeUtils.FloatToShaderValueShaderLabSafe(value.w)})";
}
internal override string GetPropertyAsArgumentString()
{
return $"{concreteShaderValueType.ToShaderString(concretePrecision.ToShaderString())} {referenceName}";
}
}
}
| 37.88 | 300 | 0.705385 | [
"MIT"
] | ellcraig/RollABall | Roll-A-Ball/Library/PackageCache/com.unity.shadergraph@10.2.2/Editor/Data/Graphs/VectorShaderProperty.cs | 947 | C# |
using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.IO;
using System;
using System.Globalization;
using UnityEditor.SceneManagement;
using UnityEngine.Rendering;
using Object = UnityEngine.Object;
public class ExportStages
{
static string assetPath = "Assets/Stage.data.asset";
[MenuItem("gRally/Export Stage", false, 99)]
static void ExportStage()
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows);
StageData stage = (StageData)AssetDatabase.LoadAssetAtPath(assetPath, typeof(StageData));
string path = EditorUtility.OpenFolderPanel("Save Stage", stage.exportPath, "");
if (!string.IsNullOrEmpty(path))
{
stage.exportPath = path;
// 1: save scenes
for (int i = 0; i < SceneManager.sceneCount; i++)
{
EditorSceneManager.SaveScene(SceneManager.GetSceneAt(i));
}
// 2: clear old files
foreach (var item in Directory.GetFiles(path))
{
var fileName = Path.GetFileName(item).ToLower();
if (fileName.EndsWith(".manifest") ||
fileName == "stage.grpack" ||
fileName.StartsWith("layout") ||
fileName == Path.GetFileName(path).ToLower())
{
File.Delete(item);
}
}
EditorUtility.SetDirty(stage);
AssetDatabase.SaveAssets();
/* TODO: removed, no VertexPainter attached
// 3: apply vertex data
foreach (var item in Object.FindObjectsOfType<JBooth.VertexPainterPro.VertexInstanceStream>())
{
item.Apply();
}
*/
// 4: store xml data
// write data stages
gUtility.CXml stageXml = new gUtility.CXml(path + @"/stage.xml", true);
writeSurfaceSettings(ref stageXml, ref stage);
writeStageSettings(ref stageXml, ref stage);
writeLayoutSettings(ref stageXml);
writeMaterialSettings(ref stageXml, ref stage);
stageXml.Commit();
// 5: rollback the textures edited:
// not at the moment... rollbackEditTextures();
// 6: build stage!
BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.ForceRebuildAssetBundle, BuildTarget.StandaloneWindows64);
EditorUtility.DisplayDialog("Create Stage", "Stage created in\r\n" + path, "Ok!!");
}
else
{
EditorUtility.DisplayDialog("Create Stage", "no path selected!!", "Ok.. I'll try again");
}
}
static void writeSurfaceSettings(ref gUtility.CXml xml, ref StageData stage)
{
for (int i = 0; i < stage.surfaceList.Count; i++)
{
var s = stage.surfaceList[i];
var SURF = string.Format("SurfaceLibrary/Surface#{0}", i + 1);
xml.Settings[SURF].WriteString("type", s.Type.ToString());
xml.Settings[SURF].WriteString("name", s.Name);
xml.Settings[SURF].WriteString("color", c3(s.PhysColor));
var PHYS = string.Format("SurfaceLibrary/Surface#{0}/Phys", i + 1);
xml.Settings[PHYS].WriteFloat("usableGrip", s.UsableGrip);
xml.Settings[PHYS].WriteFloat("rolling", s.Rolling);
xml.Settings[PHYS].WriteFloat("drag", s.Drag);
xml.Settings[PHYS].WriteVector2("bump", v2(s.Bump));
var TRAILS = string.Format("SurfaceLibrary/Surface#{0}/Trails", i + 1);
xml.Settings[TRAILS].WriteString("trailColor", c4(s.TrailColor));
xml.Settings[TRAILS].WriteFloat("trailBump", s.TrailBump);
var SMOKE = string.Format("SurfaceLibrary/Surface#{0}/Smoke", i + 1);
xml.Settings[SMOKE].WriteVector2("lifeTime", v2(s.LifeTime));
xml.Settings[SMOKE].WriteVector2("size", v2(s.Size));
xml.Settings[SMOKE].WriteFloat("gravity", s.Gravity);
xml.Settings[SMOKE].WriteString("gradient", gradient(s.GradientColor));
}
}
static void writeStageSettings(ref gUtility.CXml xml, ref StageData stage)
{
xml.Settings["Stage/Geo"].WriteFloat("latitude", stage.latitude);
xml.Settings["Stage/Geo"].WriteFloat("longitude", stage.longitude);
xml.Settings["Stage/Geo"].WriteFloat("north", stage.north);
}
static void writeLayoutSettings(ref gUtility.CXml xml, int maxLayouts = 50)
{
for (int i = 0; i < maxLayouts; i++)
{
var scene = SceneManager.GetSceneByName("layout" + i.ToString());
if (scene.name == null)
{
break;
}
foreach (var item in scene.GetRootGameObjects())
{
var info = item.GetComponentInChildren<LayoutInfo>();
var startFinish = item.GetComponentInChildren<StartFinish>();
var path = item.GetComponentInChildren<LayoutPath>();
if (info != null)
{
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("name", info.Name);
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("description", info.Description);
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteBool("saveTimes", info.SaveTimes);
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("nation", info.GetCountryCode(true));
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("surfaces", info.GetSurfaces());
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("tags", info.Tags);
//break;
}
if (startFinish != null)
{
float realLength = startFinish.RealLength;
// calc points:
int allPoints = path.GetPointsCount();
// I want a point each 5 meters
float minDist = realLength / Convert.ToSingle(allPoints);
int eachPoint = 1;
if (minDist < 5.0f)
{
// less than 5 meters, use less points
int newPoints = Convert.ToInt32(Mathf.Ceil(realLength / 5.0f));
eachPoint = Convert.ToInt32(Mathf.Floor(allPoints / newPoints));
}
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteFloat("length", realLength);
if (path != null)
{
string pointExport = "";
for (int pt = 0; pt < path.GetPointsCount(); pt+=eachPoint)
{
var point = path.GetPoint(pt);
pointExport += string.Format("{0} {1} {2} ", point.x, point.y, point.z);
}
pointExport = pointExport.Trim();
xml.Settings[string.Format("Layouts/Layout{0}", i)].WriteString("points", pointExport);
}
}
}
}
}
static List<string> matExported;
static void writeMaterialSettings(ref gUtility.CXml xml, ref StageData stage)
{
int idMat = 0;
matExported = new List<string>();
var renderers = (Renderer[])Resources.FindObjectsOfTypeAll(typeof(Renderer));
foreach (Renderer renderer in renderers)
{
foreach (Material mat in renderer.sharedMaterials)
{
if (mat != null)
{
if (mat.shader.name.Contains("gRally/Phys"))
{
Texture tex = null;
Texture texWet = null;
Texture texPuddles = null;
float puddlesSize = 1.0f;
int shaderVer = 0;
if (mat.shader.name.EndsWith("1"))
{
shaderVer = 1;
tex = mat.GetTexture("_PhysMap");
texWet = mat.GetTexture("_MainTex");
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteFloat("maxDisplacement", 0.0f);
}
else if (mat.shader.name.EndsWith("2"))
{
shaderVer = 2;
tex = mat.GetTexture("_PhysicalTexture");
texWet = mat.GetTexture("_RSpecGTransparencyBAOAWetMap");
texPuddles = mat.GetTexture("_PuddlesTexture");
puddlesSize = mat.GetFloat("_PuddlesSize");
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteFloat("maxDisplacement", mat.GetFloat("_MaxDisplacementmeters"));
}
if (tex != null)
{
if (!matExported.Contains(mat.name))
{
getPhysicsData(idMat, tex as Texture2D, mat.name, ref xml, ref stage);
getWetData(idMat, texWet as Texture2D, 16, mat.name, ref xml);
if (texPuddles != null)
{
getPuddlesData(idMat, texPuddles as Texture2D, 32, mat.name, puddlesSize, ref xml);
}
idMat++;
matExported.Add(mat.name);
}
}
}
}
}
}
}
static void getWetData(int idMat, Texture2D tex, int wetSize, string materialName, ref gUtility.CXml xml)
{
if (tex == null)
{
return;
}
string path = AssetDatabase.GetAssetPath(tex);
TextureImporter A = (TextureImporter)AssetImporter.GetAtPath(path);
if (A == null)
{
return;
}
A.isReadable = true;
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
float[,] colors = new float[wetSize, wetSize];
// save the new texture
var debugTex = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 0, true);
Graphics.CopyTexture(tex, debugTex);
debugTex.Apply();
debugTex = scaleTexture(debugTex, wetSize, wetSize);
for (int y = 0; y < wetSize; y++)
{
for (int x = 0; x < wetSize; x++)
{
var color = debugTex.GetPixel(x, y);
var wet = color.a;
/*
if (shaderVersion == 2)
{
wet = 1.0f + wet * -1.0f;
}
*/
debugTex.SetPixel(x, y, new Color(wet, wet, wet, 1.0f));
colors[x, y] = wet;
}
}
debugTex.Apply();
var texName = string.Format("Assets/PhysTextures/wet_{0}.png", materialName);
if (!Directory.Exists("Assets/PhysTextures"))
{
Directory.CreateDirectory("Assets/PhysTextures");
}
if (File.Exists(texName))
{
File.Delete(texName);
}
byte[] bytes = debugTex.EncodeToPNG();
File.WriteAllBytes(texName, bytes);
string retWet = "";
for (int y = 0; y < wetSize; y++)
{
for (int x = 0; x < wetSize; x++)
{
retWet += colors[x, y].ToString() + " ";
}
}
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("wet", retWet.Trim());
}
static void getPuddlesData(int idMat, Texture2D tex, int wetSize, string materialName, float puddleSize, ref gUtility.CXml xml)
{
if (tex == null)
{
return;
}
string path = AssetDatabase.GetAssetPath(tex);
TextureImporter A = (TextureImporter)AssetImporter.GetAtPath(path);
if (A == null)
{
return;
}
A.isReadable = true;
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
float[,] colors = new float[wetSize * 2, wetSize * 2];
// save the new texture
var debugTexR = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 0, true);
Graphics.CopyTexture(tex, debugTexR);
debugTexR.Apply();
debugTexR = scaleTexture(debugTexR, wetSize, wetSize);
var debugTexG = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 0, true);
Graphics.CopyTexture(tex, debugTexG);
debugTexG.Apply();
debugTexG = scaleTexture(debugTexG, wetSize, wetSize);
var debugTexB = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 0, true);
Graphics.CopyTexture(tex, debugTexB);
debugTexB.Apply();
debugTexB = scaleTexture(debugTexB, wetSize, wetSize);
var debugTexA = new Texture2D(tex.width, tex.height, tex.format, tex.mipmapCount > 0, true);
Graphics.CopyTexture(tex, debugTexA);
debugTexA.Apply();
debugTexA = scaleTexture(debugTexA, wetSize, wetSize);
var debugTex = new Texture2D(wetSize * 2, wetSize * 2, TextureFormat.ARGB32, false);
/*
* |B|A|
* -----
* |R|G|
*/
for (int y = 0; y < wetSize * 2; y++)
{
for (int x = 0; x < wetSize * 2; x++)
{
if (x < wetSize)
{
if (y < wetSize)
{
// R
var color = debugTexR.GetPixel(x, y);
var wet = color.r;
debugTex.SetPixel(x, y, new Color(wet, wet, wet, 1.0f));
colors[x, y] = wet;
}
else
{
// B
var color = debugTexB.GetPixel(x, y - wetSize);
var wet = color.b;
debugTex.SetPixel(x, y, new Color(wet, wet, wet, 1.0f));
colors[x, y] = wet;
}
}
else
{
if (y < wetSize)
{
// G
var color = debugTexG.GetPixel(x - wetSize, y);
var wet = color.g;
debugTex.SetPixel(x, y, new Color(wet, wet, wet, 1.0f));
colors[x, y] = wet;
}
else
{
// A
var color = debugTexA.GetPixel(x - wetSize, y - wetSize);
var wet = color.a;
debugTex.SetPixel(x, y, new Color(wet, wet, wet, 1.0f));
colors[x, y] = wet;
}
}
}
}
debugTex.Apply();
if (!Directory.Exists("Assets/PhysTextures"))
{
Directory.CreateDirectory("Assets/PhysTextures");
}
var texName = string.Format("Assets/PhysTextures/puddles_{0}.png", materialName);
if (File.Exists(texName)) File.Delete(texName);
byte[] bytes = debugTex.EncodeToPNG();
File.WriteAllBytes(texName, bytes);
string retWet = "";
for (int y = 0; y < wetSize; y++)
{
for (int x = 0; x < wetSize; x++)
{
retWet += colors[x, y].ToString() + " ";
}
}
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteFloat("puddlesSize", puddleSize);
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("puddles", retWet.Trim());
}
static Texture2D scaleTexture(Texture2D source, int targetWidth, int targetHeight)
{
Texture2D result = new Texture2D(targetWidth, targetHeight);
Color[] rpixels = result.GetPixels();
float incX = ((float)1 / source.width) * ((float)source.width / targetWidth);
float incY = ((float)1 / source.height) * ((float)source.height / targetHeight);
for (int px = 0; px < rpixels.Length; px++)
{
rpixels[px] = source.GetPixelBilinear(incX * ((float)px % targetWidth), incY * Mathf.Floor((float)px / targetWidth));
}
result.SetPixels(rpixels);
result.Apply();
return result;
}
static void getPhysicsData(int idMat, Texture2D tex, string materialName, ref gUtility.CXml xml, ref StageData stage)
{
if (tex == null)
{
return;
}
string path = AssetDatabase.GetAssetPath(tex);
TextureImporter A = (TextureImporter)AssetImporter.GetAtPath(path);
if (A == null)
{
return;
}
A.sRGBTexture = true;
A.isReadable = true;
A.mipmapEnabled = false;
A.filterMode = FilterMode.Point;
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
Color32[,] colors = new Color32[16, 16];
int stepPx = tex.width / 16;
int firstPx = stepPx / 2;
for (int x = 0; x < 16; x++)
{
for (int y = 0; y < 16; y++)
{
colors[x, y] = tex.GetPixel(x * stepPx + firstPx, y * stepPx + firstPx);
}
}
bool singleColor = true;
bool singleColumns = true;
// check if is everything the same
var firstCol = colors[0, 0];
for (int x = 0; x < 16; x++)
{
for (int y = 0; y < 16; y++)
{
if (!equal(colors[x, y], firstCol))
{
singleColor = false;
break;
}
}
if (!singleColor)
{
break;
}
}
if (!singleColor)
{
// check if is by columns
for (int x = 0; x < 16; x++)
{
firstCol = colors[x, 0];
for (int y = 0; y < 16; y++)
{
if (!equal(colors[x, y], firstCol))
{
singleColumns = false;
break;
}
}
if (!singleColumns)
{
break;
}
}
}
if (singleColor)
{
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("name", materialName);
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("surface", getStageID(ref stage, colors[0, 0]).ToString());
}
else if (singleColumns)
{
string retID = "";
for (int x = 0; x < 16; x++)
{
retID += getStageID(ref stage, colors[x, 0]).ToString() + " ";
}
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("name", materialName);
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("surface", retID.Trim());
}
else
{
string retID = "";
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x++)
{
retID += getStageID(ref stage, colors[x, y]).ToString() + " ";
}
}
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("name", materialName);
xml.Settings[string.Format("Materials/Material#{0}", idMat + 1)].WriteString("surface", retID.Trim());
}
}
static void rollbackEditTextures()
{
var renderers = (Renderer[])Resources.FindObjectsOfTypeAll(typeof(Renderer));
foreach (Renderer renderer in renderers)
{
foreach (Material mat in renderer.sharedMaterials)
{
if (mat != null)
{
if (mat.shader.name.Contains("gRally/Phys"))
{
var mainTex = mat.GetTexture("_MainTex");
string path = AssetDatabase.GetAssetPath(mainTex);
TextureImporter A = (TextureImporter)AssetImporter.GetAtPath(path);
if (A == null)
{
return;
}
A.isReadable = false;
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
var texPhys = mat.GetTexture("_PhysMap");
if (texPhys != null)
{
path = AssetDatabase.GetAssetPath(texPhys);
A = (TextureImporter)AssetImporter.GetAtPath(path);
if (A == null)
{
return;
}
A.isReadable = false;
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
}
}
}
}
}
}
static bool equal(Color32 c1, Color32 c2, int diff = 2)
{
var diffR = Mathf.Abs(c1.r - c2.r);
var diffG = Mathf.Abs(c1.g - c2.g);
var diffB = Mathf.Abs(c1.b - c2.b);
var diffA = Mathf.Abs(c1.a - c2.a);
bool ret = diffR < diff && diffG < diff && diffB < diff && diffA < diff;
return ret;
}
static int getStageID(ref StageData stage, Color32 value)
{
for (int i = 0; i < stage.surfaceList.Count; i++)
{
if (equal(value, stage.surfaceList[i].PhysColor))
{
return i;
}
}
return -1;
}
static string c3(Color32 color)
{
return string.Format("{0:000} {1:000} {2:000}", color.r, color.g, color.b);
}
static string c4(Color32 color)
{
return string.Format("{0:000} {1:000} {2:000} {3:000}", color.r, color.g, color.b, color.a);
}
static gUtility.Vector2 v2(Vector2 value)
{
return new gUtility.Vector2(value.x, value.y);
}
static string gradient(Gradient color)
{
var ret = string.Format("{0};", color.colorKeys.Length);
foreach (var k in color.colorKeys)
{
ret += string.Format("{0}_{1};", c4(k.color), k.time.ToString(CultureInfo.InvariantCulture.NumberFormat));
}
ret = ret.Remove(ret.Length - 1);
ret += string.Format("|{0};", color.alphaKeys.Length);
foreach (var a in color.alphaKeys)
{
ret += string.Format("{0}_{1};", a.alpha.ToString(CultureInfo.InvariantCulture.NumberFormat), a.time.ToString(CultureInfo.InvariantCulture.NumberFormat));
}
ret = ret.Remove(ret.Length - 1);
ret += string.Format("|{0}", Convert.ToInt32(color.mode));
return ret;
}
}
| 38.158065 | 166 | 0.49273 | [
"MIT"
] | ghiboz/gStageEditor_Demo | Assets/gStageEditor/Export/Editor/ExportStage.cs | 23,660 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
#if !NO_PERF
using System;
using System.Collections.Generic;
using System.Threading;
namespace System.Reactive.Linq.ObservableImpl
{
class MostRecent<TSource> : PushToPullAdapter<TSource, TSource>
{
private readonly TSource _initialValue;
public MostRecent(IObservable<TSource> source, TSource initialValue)
: base(source)
{
_initialValue = initialValue;
}
protected override PushToPullSink<TSource, TSource> Run(IDisposable subscription)
{
return new _(_initialValue, subscription);
}
class _ : PushToPullSink<TSource, TSource>
{
public _(TSource initialValue, IDisposable subscription)
: base(subscription)
{
_kind = NotificationKind.OnNext;
_value = initialValue;
}
private volatile NotificationKind _kind;
private TSource _value;
private Exception _error;
public override void OnNext(TSource value)
{
_value = value;
_kind = NotificationKind.OnNext; // Write last!
}
public override void OnError(Exception error)
{
base.Dispose();
_error = error;
_kind = NotificationKind.OnError; // Write last!
}
public override void OnCompleted()
{
base.Dispose();
_kind = NotificationKind.OnCompleted; // Write last!
}
public override bool TryMoveNext(out TSource current)
{
//
// Notice the _kind field is marked volatile and read before the other fields.
//
// In case of a concurrent change, we may read a stale OnNext value, which is
// fine because this push-to-pull adapter is about sampling.
//
switch (_kind)
{
case NotificationKind.OnNext:
current = _value;
return true;
case NotificationKind.OnError:
_error.Throw();
break;
case NotificationKind.OnCompleted:
break;
}
current = default(TSource);
return false;
}
}
}
}
#endif
| 30.943182 | 94 | 0.525891 | [
"Apache-2.0"
] | LeeCampbell/Rx.NET | Rx.NET/Source/System.Reactive.Linq/Reactive/Linq/Observable/MostRecent.cs | 2,725 | C# |
using HelperProject.HelperLibrary.Exceptions;
using HelperProject.HelperLibrary.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace HelperProject.HelperLibrary
{
public class XMLBuild : XMLFile
{
public List<Task> tasks { get; private set; }
public XMLBuild(string path) : base(path)
{
populateTasks();
}
private void populateTasks()
{
List<XElement> elements;
try
{
elements = GetElements("Task");
}
catch (MissingElementException)
{
return;
}
finally
{
tasks = new List<Task>();
}
foreach (XElement element in elements)
{
List<Plugin> plugins = new List<Plugin>();
List<XElement> pluginElements = element.Descendants("Plugin").ToList();
string taskName = element.Attribute("Name").Value;
foreach (XElement pluginElement in pluginElements)
{
string name = pluginElement.Attribute("Name").Value;
List<XElement> inputElements = pluginElement.Descendants("Input").ToList();
Plugin plugin = new Plugin(name);
if (pluginElement.Attribute("Imported") != null)
{
if (pluginElement.Attribute("Imported").Value == "true")
{
plugin.importedPlugin = true;
}
}
foreach (XElement inputElement in inputElements)
{
string label = inputElement.Attribute("Label").Value;
string value = inputElement.Attribute("Value").Value;
InsertionValueHelper.InputType input = (InsertionValueHelper.InputType)Enum.Parse(typeof(InsertionValueHelper.InputType), inputElement.Attribute("Type").Value);
InsertionValueHelper insertion = new InsertionValueHelper(input, label);
plugin.valueDict[insertion] = value;
}
plugins.Add(plugin);
}
Task task = new Task(taskName);
task.plugins = plugins;
tasks.Add(task);
}
}
}
}
| 33.797297 | 184 | 0.506997 | [
"MIT"
] | dimabru/InstallationManager | Common/CommonTester/BaseView/HelperLibrary/XMLBuild.cs | 2,503 | C# |
/* MIT License
Copyright (c) 2011-2019 Markus Wendt (http://www.dodoni-project.net)
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Please see http://www.dodoni-project.net/ for more information concerning the Dodoni.net project.
*/
using System;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using ExcelDna.Integration;
using Dodoni.BasicComponents;
using Dodoni.BasicComponents.Utilities;
namespace Dodoni.XLBasicComponents
{
/// <summary>Represents some special functions needed to convert some Excel input into its regular data representation.
/// </summary>
public static class ExcelDataConverter
{
#region nested declarations
/// <summary>A function to convert an Excel cell into a specific type.
/// </summary>
/// <param name="excelCell">The excel cell value to convert.</param>
/// <param name="value">The converted <paramref name="excelCell"/> in its <see cref="System.Object"/> representation (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
public delegate bool TryGetExcelCellValue(object excelCell, out object value);
/// <summary>Represents the type of the output Range.
/// </summary>
public enum RangeOutputType
{
/// <summary>If the output can not be represented by a single Excel cell, a matrix function is assumed. Therefore it will be checked whether the selected Range is suitable for the output.
/// </summary>
Standard,
/// <summary>The output should be written below the cell where the specific UDF has been called ('similar to Bloomberg BDH function').
/// </summary>
BelowCallerCell
}
#endregion
#region private static members
/// <summary>For non-standard types a function used to convert an Excel cell into this type; the type is the key of the dictionary.
/// </summary>
private static Dictionary<Type, TryGetExcelCellValue> sm_ExcelCellConverter = new Dictionary<Type, TryGetExcelCellValue>();
#endregion
#region public static methods
#region cell value converter methods
/// <summary>Registers a function to convert an Excel cell value into a specific <see cref="System.Type"/>.
/// </summary>
/// <param name="type">The type of the Excel cell to convert to.</param>
/// <param name="tryGetExcelCellValue">The function which converts an Excel cell value into its <paramref name="type"/> representation.</param>
public static void RegisterTryGetExcelCellValueFunction(Type type, TryGetExcelCellValue tryGetExcelCellValue)
{
sm_ExcelCellConverter.Add(type, tryGetExcelCellValue);
}
/// <summary>Gets the value of a specific Excel cell.
/// </summary>
/// <typeparam name="TEnum">The type of the enumeration.</typeparam>
/// <param name="excelCell">The Excel cell.</param>
/// <param name="enumStringRepresentationUsage">The method how to compute the <see cref="System.String"/> representation of the enumeration <typeparamref name="TEnum"/>.</param>
/// <param name="value">The value of the <paramref name="excelCell"/> (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
/// <exception cref="ArgumentException">Thrown, if <typeparamref name="TEnum"/> does not represent a enumeration.</exception>
public static bool TryGetCellValue<TEnum>(object excelCell, EnumStringRepresentationUsage enumStringRepresentationUsage, out TEnum value)
where TEnum : struct, IComparable, IConvertible, IFormattable
{
if (typeof(TEnum).IsEnum)
{
string tableValue = ((string)excelCell);
return EnumString<TEnum>.TryParse(tableValue, out value, enumStringRepresentationUsage);
}
throw new ArgumentException(String.Format(ExceptionMessages.ArgumentIsInvalid, "EnumType: " + typeof(TEnum).ToString()), "TEnum");
}
/// <summary>Gets the value of a specific Excel cell.
/// </summary>
/// <typeparam name="T">The type of the value.</typeparam>
/// <param name="excelCell">The Excel cell.</param>
/// <returns>The value of the <paramref name="excelCell"/> in its <typeparamref name="T"/> representation.</returns>
/// <exception cref="ArgumentException">Thrown, <paramref name="excelCell"/> can not converted to an object of type <typeparamref name="T"/>.</exception>
public static T GetCellValue<T>(object excelCell)
{
T value;
if (TryGetCellValue<T>(excelCell, out value) == true)
{
return value;
}
throw new ArgumentException("Can not cast " + GetExcelCellRepresentation(excelCell) + " to " + typeof(T).Name + ".");
}
/// <summary>Gets the value of a specific Excel cell.
/// </summary>
/// <typeparam name="T">The type of the value.</typeparam>
/// <param name="excelCell">The Excel cell.</param>
/// <returns>The value of the <paramref name="excelCell"/> in its <typeparamref name="T"/> representation; <c>null</c> if <paramref name="excelCell"/> can not be cast to <typeparamref name="T"/>.</returns>
public static T? GetCellValueAsNullable<T>(object excelCell)
where T : struct
{
T value;
if (TryGetCellValue<T>(excelCell, out value) == true)
{
return value;
}
return null;
}
/// <summary>Gets the value of a specific Excel cell.
/// </summary>
/// <typeparam name="T">The type of the value.</typeparam>
/// <param name="excelCell">The Excel cell.</param>
/// <param name="value">The value of the <paramref name="excelCell"/> (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
/// <exception cref="ArgumentException">Thrown, if <typeparamref name="T"/> represents a enumeration or <paramref name="excelCell"/> can not converted to an object of type <typeparamref name="T"/>.</exception>
public static bool TryGetCellValue<T>(object excelCell, out T value)
{
if (typeof(T).IsEnum) // which enumStringRepresentationUsage? --> call an other method
{
throw new ArgumentException("Do not use these method [TryGetCellValue] for enumerations.");
}
if ((excelCell == null) || (excelCell is ExcelEmpty) || (excelCell is ExcelMissing))
{
value = default(T);
return false;
}
Type typeofT = typeof(T);
if (typeofT == typeof(string))
{
if (excelCell is String)
{
value = (T)(object)(string)excelCell;
return true;
}
else
{
value = (T)(object)excelCell.ToString();
return true;
}
}
else if (typeofT == typeof(Double))
{
double doubleValue;
if (ExcelDataConverter.TryGetDouble(excelCell, out doubleValue) == true)
{
value = (T)(object)doubleValue;
return true;
}
}
else if (typeofT == typeof(int))
{
int intValue;
if (TryGetInteger(excelCell, out intValue) == true)
{
value = (T)(object)(intValue);
return true;
}
}
else if (typeofT == typeof(DateTime))
{
DateTime dateTime;
if (TryGetDateTime(excelCell, out dateTime) == true)
{
value = (T)((object)dateTime);
return true;
}
}
else if (typeofT == typeof(bool))
{
if (excelCell is bool)
{
value = (T)(object)(bool)excelCell;
return true;
}
if (excelCell is string) // a fallback solution
{
IdentifierString stringRepresentation = new IdentifierString((string)excelCell);
if (IsTrueExcelCell(stringRepresentation))
{
value = (T)(object)(true);
return true;
}
else if (IsFalseExcelCell(stringRepresentation))
{
value = (T)(object)(false);
return true;
}
}
value = default(T);
return false;
}
else if (typeofT == typeof(IdentifierString))
{
if (excelCell is String)
{
value = (T)(object)new IdentifierString((string)excelCell);
return true;
}
else
{
value = (T)(object)new IdentifierString(excelCell.ToString());
return true;
}
}
else
{
TryGetExcelCellValue tryGetExcelCellValue;
if (sm_ExcelCellConverter.TryGetValue(typeofT, out tryGetExcelCellValue) == true)
{
object tempValue;
if (tryGetExcelCellValue(excelCell, out tempValue) == true)
{
value = (T)tempValue;
return true;
}
}
}
if (excelCell is T) // a fallback solution
{
value = (T)excelCell;
return true;
}
value = default(T);
return false;
}
#endregion
#region Excel range methods
/// <summary>Gets the excel range output, i.e. converts the output such that no '#NV' values are
/// shown and print an error message, if the given range is to small for the output.
/// </summary>
/// <param name="values">The values.</param>
/// <param name="rangeOutputType">A value indicating how the values should be presented in Excel.</param>
/// <returns>The range which contains <paramref name="values"/> or some error message.</returns>
public static object GetExcelRangeOutput(object[,] values, RangeOutputType rangeOutputType = RangeOutputType.Standard)
{
return GetExcelRangeOutput<object>(values, rangeOutputType);
}
/// <summary>Gets the excel range output, i.e. converts the output such that no '#NV' values are
/// shown and print an error message, if the given range is to small for the output.
/// </summary>
/// <typeparam name="T">The type of the values.</typeparam>
/// <param name="values">The values.</param>
/// <param name="rangeOutputType">A value indicating how the values should be presented in Excel.</param>
/// <returns>The range which contains <paramref name="values"/> or some error message.</returns>
public static object GetExcelRangeOutput<T>(T[,] values, RangeOutputType rangeOutputType = RangeOutputType.Standard)
{
int valueRowCount = values.GetLength(0);
int valueColumnCount = values.GetLength(1);
if (rangeOutputType == RangeOutputType.Standard)
{
int excelRangeRowCount, excelRangeColumnCount;
ExcelLowLevel.OutputRangeOrientation rangeOrientation;
ExcelLowLevel.GetRangeSize(out excelRangeRowCount, out excelRangeColumnCount, out rangeOrientation);
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Transposed) // swap the Excel Range size given by the user
{
int temp = excelRangeRowCount;
excelRangeRowCount = excelRangeColumnCount;
excelRangeColumnCount = temp;
}
object[,] returnValue = new object[excelRangeRowCount, excelRangeColumnCount];
for (int i = 0; i < excelRangeRowCount; i++)
{
for (int j = 0; j < excelRangeColumnCount; j++)
{
returnValue[i, j] = String.Empty;
}
}
if ((valueRowCount > excelRangeRowCount) || (valueColumnCount > excelRangeColumnCount))
{
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Regular)
{
returnValue[0, 0] = "ERROR: At least " + valueRowCount + " x " + valueColumnCount + " Range needed.";
}
else
{
returnValue[0, 0] = "ERROR: At least " + valueColumnCount + " x " + valueRowCount + " Range needed.";
}
return returnValue;
}
for (int i = 0; i < valueRowCount; i++)
{
for (int j = 0; j < valueColumnCount; j++)
{
returnValue[i, j] = values[i, j];
}
}
return returnValue;
}
else // write the result below the cell where the user has called the specified UDF
{
int firstRowIndex, firstColumnIndex;
var returnValue = ExcelLowLevel.GetCurrentRangePosition(out firstRowIndex, out firstColumnIndex);
ExcelAsyncUtil.QueueAsMacro(() =>
{
for (int i = 0; i < valueRowCount; i++)
{
for (int j = 0; j < valueColumnCount; j++)
{
var cellReference = new ExcelReference(firstRowIndex + i + 1, firstColumnIndex + j);
cellReference.SetValue(values[i, j]);
}
}
});
return String.Format("<Below result of> {0}", returnValue).ToTimeStampString();
}
}
/// <summary>Gets the excel range output, i.e. converts the output such that no '#NV' values are
/// shown and print an error message, if the given range is to small for the output.
/// </summary>
/// <typeparam name="T">The type of the values.</typeparam>
/// <param name="values">The values.</param>
/// <param name="rangeOutputType">A value indicating how the values should be presented in Excel.</param>
/// <returns>The range which contains <paramref name="values"/> or some error message.</returns>
public static object GetExcelRangeOutput<T>(T[][] values, RangeOutputType rangeOutputType = RangeOutputType.Standard)
{
int valueRowCount = values.GetLength(0);
int valueColumnCount = values[0].GetLength(0);
if (rangeOutputType == RangeOutputType.Standard)
{
ExcelLowLevel.OutputRangeOrientation rangeOrientation;
int excelRangeRowCount, excelRangeColumnCount;
ExcelLowLevel.GetRangeSize(out excelRangeRowCount, out excelRangeColumnCount, out rangeOrientation);
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Transposed) // swap the Excel Range size given by the user
{
int temp = excelRangeRowCount;
excelRangeRowCount = excelRangeColumnCount;
excelRangeColumnCount = temp;
}
object[,] returnValue = new object[excelRangeRowCount, excelRangeColumnCount];
for (int i = 0; i < excelRangeRowCount; i++)
{
for (int j = 0; j < excelRangeColumnCount; j++)
{
returnValue[i, j] = String.Empty;
}
}
if ((valueRowCount > excelRangeRowCount) || (valueColumnCount > excelRangeColumnCount))
{
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Regular)
{
returnValue[0, 0] = "ERROR: At least " + valueRowCount + " x " + valueColumnCount + " Range needed.";
}
else
{
returnValue[0, 0] = "ERROR: At least " + valueColumnCount + " x " + valueRowCount + " Range needed.";
}
return returnValue;
}
for (int i = 0; i < valueRowCount; i++)
{
for (int j = 0; j < valueColumnCount; j++)
{
returnValue[i, j] = values[i][j];
}
}
return returnValue;
}
else // write the result below the cell where the user has called the specified UDF
{
int firstRowIndex, firstColumnIndex;
var returnValue = ExcelLowLevel.GetCurrentRangePosition(out firstRowIndex, out firstColumnIndex);
ExcelAsyncUtil.QueueAsMacro(() =>
{
for (int i = 0; i < valueRowCount; i++)
{
for (int j = 0; j < valueColumnCount; j++)
{
var cellReference = new ExcelReference(firstRowIndex + i + 1, firstColumnIndex + j);
cellReference.SetValue(values[i][j]);
}
}
});
return String.Format("<Below result of> {0}", returnValue).ToTimeStampString();
}
}
/// <summary>Gets the Excel range output for a specific array.
/// </summary>
/// <typeparam name="T">The type of the values.</typeparam>
/// <param name="values">The collection of values.</param>
/// <param name="header">An optional header.</param>
/// <param name="rangeOutputType">A value indicating how the values should be presented in Excel.</param>
/// <returns>The Excel range which contains the <paramref name="values"/>.</returns>
public static object GetExcelRangeOutput<T>(IEnumerable<T> values, string header = null, RangeOutputType rangeOutputType = RangeOutputType.Standard)
{
if (rangeOutputType == RangeOutputType.Standard)
{
ExcelLowLevel.OutputRangeOrientation rangeOrientation;
int excelRangeRowCount, excelRangeColumnCount;
ExcelLowLevel.GetRangeSize(out excelRangeRowCount, out excelRangeColumnCount, out rangeOrientation);
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Transposed) // swap the Excel Range size given by the user
{
int temp = excelRangeRowCount;
excelRangeRowCount = excelRangeColumnCount;
excelRangeColumnCount = temp;
}
object[,] returnValue = new object[excelRangeRowCount, excelRangeColumnCount];
for (int i = 0; i < excelRangeRowCount; i++)
{
for (int j = 0; j < excelRangeColumnCount; j++)
{
returnValue[i, j] = String.Empty;
}
}
int valueRowCount = values.Count() + ((header != null) ? 1 : 0);
if (valueRowCount > excelRangeRowCount)
{
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Regular)
{
returnValue[0, 0] = "ERROR: At least " + valueRowCount + " x 1 Range needed.";
}
else
{
returnValue[0, 0] = "ERROR: At least 1 x " + valueRowCount + " Range needed.";
}
return returnValue;
}
int k = 0;
if (header != null)
{
returnValue[k++, 0] = header;
}
foreach (T value in values)
{
returnValue[k++, 0] = value;
}
return returnValue;
}
else // write the result below the cell where the user has called the specified UDF
{
int firstRowIndex, firstColumnIndex;
ExcelLowLevel.GetCurrentRangePosition(out firstRowIndex, out firstColumnIndex);
ExcelAsyncUtil.QueueAsMacro(() =>
{
int k = 0;
foreach (T value in values)
{
var cellReference = new ExcelReference(firstRowIndex + k + 1, firstColumnIndex);
cellReference.SetValue(value);
k++;
}
});
return ((header != null) ? header : "<unknown>");
}
}
/// <summary>Gets the Excel range output for a specific array.
/// </summary>
/// <typeparam name="T1">The type of the first item.</typeparam>
/// <typeparam name="T2">The type of the second item.</typeparam>
/// <param name="values">The collection of values.</param>
/// <param name="header1">An optional header for the first item.</param>
/// <param name="header2">An optional header for the second item.</param>
/// <returns>The Excel range which contains the <paramref name="values"/>.</returns>
public static object GetExcelRangeOutput<T1, T2>(IEnumerable<Tuple<T1, T2>> values, string header1 = null, string header2 = null, RangeOutputType rangeOutputType = RangeOutputType.Standard)
{
if (rangeOutputType == RangeOutputType.Standard)
{
ExcelLowLevel.OutputRangeOrientation rangeOrientation;
int excelRangeRowCount, excelRangeColumnCount;
ExcelLowLevel.GetRangeSize(out excelRangeRowCount, out excelRangeColumnCount, out rangeOrientation);
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Transposed) // swap the Excel Range size given by the user
{
int temp = excelRangeRowCount;
excelRangeRowCount = excelRangeColumnCount;
excelRangeColumnCount = temp;
}
object[,] returnValue = new object[excelRangeRowCount, excelRangeColumnCount];
for (int i = 0; i < excelRangeRowCount; i++)
{
for (int j = 0; j < excelRangeColumnCount; j++)
{
returnValue[i, j] = String.Empty;
}
}
bool containsHeader = (header1 != null) || (header2 != null);
int valueRowCount = values.Count() + (containsHeader == true ? 1 : 0);
if (valueRowCount > excelRangeRowCount)
{
if (rangeOrientation == ExcelLowLevel.OutputRangeOrientation.Regular)
{
returnValue[0, 0] = "ERROR: At least " + valueRowCount + " x 2 Range needed.";
}
else
{
returnValue[0, 0] = "ERROR: At least 2 x " + valueRowCount + " Range needed.";
}
return returnValue;
}
if (header1 != null)
{
returnValue[0, 0] = header1;
}
if (header2 != null)
{
returnValue[0, 1] = header2;
}
int k = 0 + (containsHeader == true ? 1 : 0);
foreach (var value in values)
{
returnValue[k, 0] = value.Item1;
returnValue[k++, 1] = value.Item2;
}
return returnValue;
}
else // write the result below the cell where the user has called the specified UDF
{
int firstRowIndex, firstColumnIndex;
ExcelLowLevel.GetCurrentRangePosition(out firstRowIndex, out firstColumnIndex);
ExcelAsyncUtil.QueueAsMacro(() =>
{
int k = 0;
foreach (var value in values)
{
var firstCellReference = new ExcelReference(firstRowIndex + k + 1, firstColumnIndex);
firstCellReference.SetValue(value.Item1);
var secondCellReference = new ExcelReference(firstRowIndex + k + 1, firstColumnIndex + 1);
secondCellReference.SetValue(value.Item2);
k++;
}
});
var returnValue = new object[1, 2];
if (header1 != null)
{
returnValue[0, 0] = header1;
}
if (header2 != null)
{
returnValue[0, 1] = header2;
}
return returnValue;
}
}
/// <summary>Gets the excel range error message.
/// </summary>
/// <param name="errorMessage">The error message.</param>
/// <returns>The <paramref name="errorMessage"/> as some Excel range output.</returns>
public static object GetExcelRangeErrorMessage(string errorMessage)
{
return GetExcelRangeMessage("Error! " + errorMessage);
}
/// <summary>Gets the excel range error message.
/// </summary>
/// <param name="exception">The <see cref="Exception"/> object.</param>
/// <returns>The exception message of <paramref name="exception"/> as some Excel range output.</returns>
public static object GetExcelRangeErrorMessage(Exception exception)
{
if (exception == null)
{
return GetExcelRangeMessage("Error! Unknown error, Exception object is null.");
}
return GetExcelRangeMessage("Error! " + exception.Message);
}
/// <summary>Gets a specific excel range message, i.e. convert a <see cref="System.String"/> into the Excel Range selected by the user as output of the user defined function.
/// </summary>
/// <param name="message">The message.</param>
/// <returns>The <paramref name="message"/> as some Excel range output.</returns>
public static object GetExcelRangeMessage(string message)
{
int excelRangeRowCount, excelRangeColumnCount;
ExcelLowLevel.GetRangeSize(out excelRangeRowCount, out excelRangeColumnCount);
if ((excelRangeRowCount == 1) && (excelRangeColumnCount == 1))
{
return message;
}
object[,] returnValue = new object[excelRangeRowCount, excelRangeColumnCount];
for (int i = 0; i < excelRangeRowCount; i++)
{
for (int j = 0; j < excelRangeColumnCount; j++)
{
returnValue[i, j] = String.Empty;
}
}
returnValue[0, 0] = message;
return returnValue;
}
#endregion
/// <summary>Determines whether a specific Excel cell is empty.
/// </summary>
/// <param name="xlCell">The Excel cell.</param>
/// <returns><c>true</c> if <paramref name="xlCell"/> represents an empty Excel cell; <c>false</c> otherwise.
/// </returns>
public static bool IsEmptyCell(object xlCell)
{
return ((xlCell == null) || (xlCell is ExcelEmpty) || (xlCell is ExcelMissing) || ((xlCell is String) && (((string)xlCell).Length == 0)));
}
/// <summary>Gets the Excel cell representation of a specific <see cref="System.Object"/>.
/// </summary>
/// <param name="value">The value to convert.</param>
/// <returns><paramref name="value"/> if <paramref name="value"/> is a standard type (i.e. boolean, integer, DateTime, double etc.); otherwise the <see cref="System.String"/> representation
/// of <paramref name="value"/> using the <c>ToString()</c> method.</returns>
public static object GetExcelCellRepresentation(object value)
{
if (IsEmptyCell(value) == true)
{
return "<empty>";
}
Type valueType = value.GetType();
if ((valueType.IsPrimitive == true) || (value is DateTime) || (value is string))
{
return value;
}
else if (valueType.IsEnum == true)
{
return EnumString.Create((Enum)value, EnumStringRepresentationUsage.StringAttribute);
}
return value.ToString();
}
#endregion
#region private methods
/// <summary>Gets a specific integer, i.e. converts some Excel cell input into its <see cref="System.Int32"/> representation.
/// </summary>
/// <param name="excelCell">The excel cell to convert.</param>
/// <param name="value">The <see cref="System.Int32"/> representation of <paramref name="excelCell"/> (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
private static bool TryGetInteger(object excelCell, out int value)
{
if (excelCell is double)
{
double dValue = (double)excelCell;
value = (int)dValue;
if (value == 0)
{
if (Math.Abs(dValue - value) < 1E-11)
{
value = 0;
return true;
}
}
else
{
if (Math.Abs((dValue - value) / value) < 1E-11)
{
return true;
}
}
value = value + Math.Sign(value);
return true;
}
else if (excelCell is int)
{
value = (int)excelCell;
return true;
}
else if (excelCell is string)
{
return Int32.TryParse(excelCell as string, out value);
}
value = 0;
return false;
}
/// <summary>Gets a specific double-precision floating-point number, i.e. converts some Excel cell input into its <see cref="System.Double"/> representation.
/// </summary>
/// <param name="excelCell">The excel cell.</param>
/// <param name="value">The <see cref="System.Double"/> representation of <paramref name="excelCell"/> (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
private static bool TryGetDouble(object excelCell, out double value)
{
if (excelCell is double)
{
value = (double)excelCell;
return true;
}
else if (excelCell is int)
{
value = (int)excelCell;
return true;
}
else if (excelCell is string)
{
return Double.TryParse(excelCell as string, out value);
}
value = Double.NaN;
return false;
}
/// <summary>Gets a specific <see cref="System.DateTime"/> object, i.e. converts some Excel cell input into its <see cref="System.DateTime"/> representation.
/// </summary>
/// <param name="excelCell">The excel cell.</param>
/// <param name="value">The <see cref="System.DateTime"/> representation of <paramref name="excelCell"/> (output).</param>
/// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
private static bool TryGetDateTime(object excelCell, out DateTime value)
{
if (excelCell is DateTime)
{
value = (DateTime)excelCell;
return true;
}
else if (excelCell is double)
{
value = DateTime.FromOADate((double)excelCell);
return true;
}
if (excelCell is string)
{
if (DateTime.TryParse(excelCell as string, out value) == true)
{
return true;
}
return DateTime.TryParse(excelCell as string, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out value);
}
value = DateTime.MinValue;
return false;
}
/// <summary>Determines whether the value of a specific Excel cell represents 'true'.
/// </summary>
/// <param name="idCellValue">The cell value in its <see cref="Dodoni.BasicComponents.IdentifierString"/> representation.</param>
/// <returns><c>true</c> if the specific Excel cell represents 'true'; otherwise, <c>false</c>.</returns>
private static bool IsTrueExcelCell(IdentifierString idCellValue)
{
return ExcelDataAdvice.Pool.m_BooleanAdvice.TrueString.Equals(idCellValue);
}
/// <summary>Determines whether the value of a specific Excel cell represents 'false'.
/// </summary>
/// <param name="idCellValue">The cell value in its <see cref="Dodoni.BasicComponents.IdentifierString"/> representation.</param>
/// <returns><c>true</c> if the specific Excel cell represents 'false'; otherwise, <c>false</c>.</returns>
private static bool IsFalseExcelCell(IdentifierString idCellValue)
{
return ExcelDataAdvice.Pool.m_BooleanAdvice.FalseString.Equals(idCellValue);
}
#endregion
}
} | 45.269521 | 217 | 0.539478 | [
"MIT"
] | dodoni/dodoni.net | XLBasicComponents/ExcelDataConverter.cs | 35,946 | C# |
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
namespace SixLabors.ImageSharp.Processing
{
/// <summary>
/// The function implements the Lanczos kernel algorithm as described on
/// <see href="https://en.wikipedia.org/wiki/Lanczos_resampling#Algorithm">Wikipedia</see>
/// with a radius of 3 pixels.
/// </summary>
public class Lanczos3Resampler : IResampler
{
/// <inheritdoc/>
public float Radius => 3;
/// <inheritdoc/>
public float GetValue(float x)
{
if (x < 0F)
{
x = -x;
}
if (x < 3F)
{
return ImageMaths.SinC(x) * ImageMaths.SinC(x / 3F);
}
return 0F;
}
}
}
| 24.757576 | 94 | 0.52754 | [
"Apache-2.0"
] | axunonb/ImageSharp | src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs | 819 | C# |
/*****************************************************************************
* ==> Class Find -----------------------------------------------------------*
* ***************************************************************************
* Description : Find form to allow find text operations. *
* Version : 1.0 *
* Developper : Jean-Milost Reymond *
*****************************************************************************/
using System;
using System.Resources;
using System.Windows.Forms;
namespace RichTextEditor.RichTextEditorForms
{
internal partial class Find : Form
{
#region Global variables
private RichTextEditor m_Owner = null;
private ResourceManager m_Resources = null;
#endregion
#region Construction/Destruction
/// <summary>
/// Default constructor
/// </summary>
public Find()
{
InitializeComponent();
}
/// <summary>
/// Overloaded constructor
/// </summary>
/// <param name="Owner">Ovner control</param>
public Find( RichTextEditor Owner )
{
InitializeComponent();
m_Owner = Owner;
}
#endregion
#region Message handling
#region No controls
/// <summary>
/// Function called when control is loading
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Find_Load( object sender, EventArgs e )
{
try
{
// Create resource manager
m_Resources = new ResourceManager( "RichTextEditor.Resources",
this.GetType().Assembly );
// Check if owner exists
if ( m_Owner == null )
{
// Cannot work with this form if owner not exists
throw new Exception( (string)m_Resources.GetObject( "err_OwnerIsNullException" ) );
}
}
catch ( Exception ex )
{
// Disable all buttons
tbSearch.Enabled = false;
btnFind.Enabled = false;
btnFindNext.Enabled = false;
cbxCaseSensitive.Enabled = false;
// If an error occurs, show it
MessageBox.Show( ex.Message.ToString(), "Error" );
}
}
#endregion
#region Buttons
/// <summary>
/// Function called when Find button is clicked
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFind_Click( object sender, System.EventArgs e )
{
try
{
int StartPosition;
StringComparison SearchType;
// Check if Case Sensitive button is checked
if ( cbxCaseSensitive.Checked == true )
{
// If Case Sensitive is checked, set case sensitive for searching
SearchType = StringComparison.Ordinal;
}
else
{
// Otherwise, ignore case sensitive for searching
SearchType = StringComparison.OrdinalIgnoreCase;
}
// Get first ocurence start position
StartPosition = m_Owner.rtbDocument.Text.IndexOf( tbSearch.Text, SearchType );
// Check if start position is valid
if ( StartPosition == -1 )
{
// If not, show not found info message
MessageBox.Show( (string)m_Resources.GetObject( "title_String" ) +
tbSearch.Text.ToString() +
(string)m_Resources.GetObject( "info_NotFound" ),
(string)m_Resources.GetObject( "title_Control" ),
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk );
return;
}
// Select first text ocurence into document, and focus it
m_Owner.rtbDocument.Select( StartPosition, tbSearch.Text.Length );
m_Owner.rtbDocument.ScrollToCaret();
m_Owner.Focus();
// Enable Find Next button
btnFindNext.Enabled = true;
}
catch ( Exception ex )
{
// If an error occurs, show it
MessageBox.Show( ex.Message.ToString(),
(string)m_Resources.GetObject( "title_Error" ) );
}
}
/// <summary>
/// Function called when Find Next button is clicked
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFindNext_Click( object sender, System.EventArgs e )
{
try
{
// Get text current start position
int StartPosition = m_Owner.rtbDocument.SelectionStart + 2;
StringComparison SearchType;
// Check if Case Sensitive button is checked
if ( cbxCaseSensitive.Checked == true )
{
// If Case Sensitive is checked, set case sensitive for searching
SearchType = StringComparison.Ordinal;
}
else
{
// Otherwise, ignore case sensitive for searching
SearchType = StringComparison.OrdinalIgnoreCase;
}
// Get next ocurence start position
StartPosition = m_Owner.rtbDocument.Text.IndexOf( tbSearch.Text,
StartPosition,
SearchType );
// Check if new start position is valid
if ( StartPosition == -1 )
{
// If not, show not found info message
MessageBox.Show( (string)m_Resources.GetObject( "title_String" ) +
tbSearch.Text.ToString() +
(string)m_Resources.GetObject( "info_NotFound" ),
(string)m_Resources.GetObject( "title_Control" ),
MessageBoxButtons.OK,
MessageBoxIcon.Asterisk );
return;
}
// Select next text ocurence into document, and focus it
m_Owner.rtbDocument.Select( StartPosition, tbSearch.Text.Length );
m_Owner.rtbDocument.ScrollToCaret();
m_Owner.Focus();
}
catch ( Exception ex )
{
// If an error occurs, show it
MessageBox.Show( ex.Message.ToString(),
(string)m_Resources.GetObject( "title_Error" ) );
}
}
#endregion
#region Text boxes
/// <summary>
/// Function called when text into tbSearch text box has changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tbSearch_TextChanged( object sender, EventArgs e )
{
// Disable Find Next button
btnFindNext.Enabled = false;
}
#endregion
#endregion
}
}
| 35.5 | 103 | 0.450577 | [
"MIT"
] | Jeanmilost/Visual-Mercutio | Tools/Visual Mercutio Reports manager/RichTextEditor/RichTextEditorForms/Find.cs | 7,883 | C# |
// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NodaTime.Calendars;
using NUnit.Framework;
namespace NodaTime.Test.Calendars
{
public class HebrewMonthConverterTest
{
private const int SampleLeapYear = 5502;
private const int SampleNonLeapYear = 5501;
[Test]
[TestCase(1, 7)] // Nisan
[TestCase(2, 8)] // Iyyar
[TestCase(3, 9)] // Sivan
[TestCase(4, 10)] // Tammuz
[TestCase(5, 11)] // Av
[TestCase(6, 12)] // Elul
[TestCase(7, 1)] // Tishri
[TestCase(8, 2)] // Heshvan
[TestCase(9, 3)] // Kislev
[TestCase(10, 4)] // Teveth
[TestCase(11, 5)] // Shevat
[TestCase(12, 6)] // Adar
public void NonLeapYear(int scriptural, int civil)
{
Assert.AreEqual(scriptural, HebrewMonthConverter.CivilToScriptural(SampleNonLeapYear, civil));
Assert.AreEqual(civil, HebrewMonthConverter.ScripturalToCivil(SampleNonLeapYear, scriptural));
}
[Test]
[TestCase(1, 8)] // Nisan
[TestCase(2, 9)] // Iyyar
[TestCase(3, 10)] // Sivan
[TestCase(4, 11)] // Tammuz
[TestCase(5, 12)] // Av
[TestCase(6, 13)] // Elul
[TestCase(7, 1)] // Tishri
[TestCase(8, 2)] // Heshvan
[TestCase(9, 3)] // Kislev
[TestCase(10, 4)] // Teveth
[TestCase(11, 5)] // Shevat
[TestCase(12, 6)] // Adar I
[TestCase(13, 7)] // Adar II
public void LeapYear(int scriptural, int civil)
{
Assert.AreEqual(scriptural, HebrewMonthConverter.CivilToScriptural(SampleLeapYear, civil));
Assert.AreEqual(civil, HebrewMonthConverter.ScripturalToCivil(SampleLeapYear, scriptural));
}
}
}
| 34.381818 | 106 | 0.585933 | [
"Apache-2.0"
] | 0xced/nodatime | src/NodaTime.Test/Calendars/HebrewMonthConverterTest.cs | 1,893 | C# |
using Akka.Actor;
using Akka.Actor.Internals;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Akka.Serialization
{
/// <summary>
/// Class NewtonSoftJsonSerializer.
/// </summary>
public class NewtonSoftJsonSerializer : Serializer
{
/// <summary>
/// The json serializer settings
/// </summary>
private static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All
};
/// <summary>
/// Initializes a new instance of the <see cref="NewtonSoftJsonSerializer" /> class.
/// </summary>
/// <param name="system">The system.</param>
public NewtonSoftJsonSerializer(ExtendedActorSystem system)
: base(system)
{
//TODO: we should use an instanced serializer to be threadsafe for other ActorSystems
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = new List<JsonConverter> { new ActorRefConverter() }
};
}
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>The identifier.</value>
/// Completely unique value to identify this implementation of Serializer, used to optimize network traffic
/// Values from 0 to 16 is reserved for Akka internal usage
public override int Identifier
{
get { return -3; }
}
/// <summary>
/// Gets a value indicating whether [include manifest].
/// </summary>
/// <value><c>true</c> if [include manifest]; otherwise, <c>false</c>.</value>
/// Returns whether this serializer needs a manifest in the fromBinary method
public override bool IncludeManifest
{
get { return false; }
}
/// <summary>
/// To the binary.
/// </summary>
/// <param name="obj">The object.</param>
/// <returns>System.Byte[][].</returns>
/// Serializes the given object into an Array of Byte
public override byte[] ToBinary(object obj)
{
Serialization.CurrentSystem = system;
string data = JsonConvert.SerializeObject(obj, Formatting.None, JsonSerializerSettings);
byte[] bytes = Encoding.Default.GetBytes(data);
return bytes;
}
/// <summary>
/// Froms the binary.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
/// Produces an object from an array of bytes, with an optional type;
public override object FromBinary(byte[] bytes, Type type)
{
Serialization.CurrentSystem = system;
string data = Encoding.Default.GetString(bytes);
return JsonConvert.DeserializeObject(data, JsonSerializerSettings);
}
/// <summary>
/// Class ActorRefConverter.
/// </summary>
public class ActorRefConverter : JsonConverter
{
/// <summary>
/// Determines whether this instance can convert the specified object type.
/// </summary>
/// <param name="objectType">Type of the object.</param>
/// <returns><c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>.</returns>
public override bool CanConvert(Type objectType)
{
return (typeof(ActorRef).IsAssignableFrom(objectType));
}
/// <summary>
/// Reads the JSON representation of the object.
/// </summary>
/// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param>
/// <param name="objectType">Type of the object.</param>
/// <param name="existingValue">The existing value of object being read.</param>
/// <param name="serializer">The calling serializer.</param>
/// <returns>The object value.</returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
JsonSerializer serializer)
{
var surrogate = serializer.Deserialize<ActorRefSurrogate>(reader);
return ((ActorSystemImpl) Serialization.CurrentSystem).Provider.ResolveActorRef(surrogate.Path);
}
/// <summary>
/// Writes the JSON representation of the object.
/// </summary>
/// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param>
/// <param name="value">The value.</param>
/// <param name="serializer">The calling serializer.</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var @ref = (ActorRef)value;
var surrogate = new ActorRefSurrogate(Serialization.SerializedActorPath(@ref));
serializer.Serialize(writer, surrogate);
}
}
}
}
| 40.126866 | 127 | 0.581365 | [
"Apache-2.0"
] | forki/akka.net | src/core/Akka/Serialization/NewtonSoftJsonSerializer.cs | 5,379 | C# |
using Google.Apis.Auth.OAuth2;
using Google.Apis.Calendar.v3;
using Google.Apis.Calendar.v3.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System;
using System.Threading;
namespace Lanina.Public.Web.Api.ThirdPartyClients.Google
{
public class GoogleCalendarClient
{
private readonly GoogleCalendarSettings _settings;
public GoogleCalendarClient(GoogleCalendarSettings settings)
{
_settings = settings;
}
public void CreateEvent(DateTime date, string roomName, string name, string phone, string email, string googleCredPath)
{
var myEventStart = new EventDateTime();
myEventStart.DateTime = date;
myEventStart.TimeZone = _settings.TimeZone;
var myEventEnd = new EventDateTime();
myEventEnd.DateTime = date.AddHours(1);
myEventEnd.TimeZone = _settings.TimeZone;
var reminders = new Event.RemindersData()
{
UseDefault = false,
Overrides = new EventReminder[] {
new EventReminder() { Method = "email", Minutes = 2 * 60 },
new EventReminder() { Method = "popup", Minutes = 60 }
}
};
var myEvent = new Event();
myEvent.Summary = $"Interview - {name}";
myEvent.Description = $"{name}, {email}, {phone}";
myEvent.Start = myEventStart;
myEvent.End = myEventEnd;
myEvent.Location = $"Kolektif House - Maslak, {roomName}";
myEvent.Reminders = reminders;
//File.AppendAllText("googleCalendar.txt", JsonConvert.SerializeObject(myEvent));
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets {
ClientId = _settings.ClientId,
ClientSecret = _settings.ClientSecret,
},
new[] { CalendarService.Scope.Calendar },
"user",
CancellationToken.None, new FileDataStore(googleCredPath)).Result;
var service = new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = _settings.ApplicationName,
});
EventsResource.InsertRequest request = service.Events.Insert(myEvent, _settings.CalendarId);
Event createdEvent = request.Execute();
}
}
}
| 36.785714 | 127 | 0.58835 | [
"MIT"
] | laninayazilim/LaNina.Public.Web.Api | ThirdPartyClients/Google/GoogleCalendarClient.cs | 2,577 | C# |
using Doctrina.ExperienceApi.Data.Json;
using Newtonsoft.Json.Linq;
namespace Doctrina.ExperienceApi.Data.InteractionTypes
{
public class InteractionComponent : JsonModel
{
public InteractionComponent() { }
public InteractionComponent(JsonString jsonString) : this(jsonString.ToJToken(), ApiVersion.GetLatest()) { }
public InteractionComponent(JToken jobj, ApiVersion version)
{
var id = jobj["id"];
if (id != null)
{
GuardType(id, JTokenType.String);
Id = id.Value<string>();
}
var description = jobj["description"];
if (description != null)
{
Description = new LanguageMap(description, version);
}
}
public string Id { get; set; }
public LanguageMap Description { get; set; }
public override JToken ToJToken(ApiVersion version, ResultFormat format)
{
var jobj = new JObject();
if (!string.IsNullOrEmpty(Id))
{
jobj["id"] = Id;
}
if (Description != null)
{
jobj["description"] = Description.ToJToken(version, format);
}
return jobj;
}
}
}
| 27.354167 | 116 | 0.534653 | [
"MIT"
] | bitflipping-net/experience-api | src/Data/InteractionTypes/InteractionComponent.cs | 1,315 | C# |
namespace NCop.IoC.Fluent
{
public interface ICastableRegistration<in TCastable> : IReuseStrategyRegistration
{
ICasted ToSelf();
ICasted From<TService>() where TService : TCastable, new();
}
}
| 22.4 | 85 | 0.678571 | [
"MIT"
] | sagifogel/NCop | NCop.IoC/Fluent/ICastableRegistration`1.cs | 226 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Configuration;
namespace SubtitlesMatcher.Infrastructure
{
public static class WebPageHelper
{
public static string RetrieveWebPageContent(string url, Encoding encoding)
{
string resposeUrl;
return RetrieveWebPageContent(url,encoding, out resposeUrl);
}
public static string RetrieveWebPageContent(string url,Encoding encoding,out string resposeUrl)
{
// *** Establish the request
HttpWebRequest loHttp =
(HttpWebRequest)WebRequest.Create(url);
string timeoutStr = ConfigurationManager.AppSettings["WebTimeout"];
int timeout;
if (!string.IsNullOrEmpty(timeoutStr) && int.TryParse(timeoutStr, out timeout))
{
loHttp.Timeout = timeout;
}
else
{
loHttp.Timeout = 10000;
}
// *** Retrieve request info headers
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
StreamReader loResponseStream =
new StreamReader(loWebResponse.GetResponseStream(), encoding);
string lcHtml = loResponseStream.ReadToEnd();
loWebResponse.Close();
loResponseStream.Close();
resposeUrl = loWebResponse.ResponseUri.AbsoluteUri;
return lcHtml;
}
}
}
| 27.22807 | 103 | 0.612113 | [
"MIT"
] | oshvartz/subsmatcher | Src/SubtitlesMatcher.Infrastructure/WebPageHelper.cs | 1,554 | C# |
////////////////////////////////////////////////////////////////////////////////
//NUnit tests for "EF Core Provider for LCPI OLE DB"
// IBProvider and Contributors. 04.12.2020.
using System;
using System.Data;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using xdb=lcpi.data.oledb;
namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Operators.SET_001.Subtract.Complete.Int16.Int16AsInt32{
////////////////////////////////////////////////////////////////////////////////
using T_DATA1 =System.Int16;
using T_DATA2 =System.Int16;
using T_DATA2_AS=System.Int32;
////////////////////////////////////////////////////////////////////////////////
//class TestSet_001__fields
public static class TestSet_001__fields
{
private const string c_NameOf__TABLE ="TEST_MODIFY_ROW2";
private const string c_NameOf__COL_DATA1 ="COL_SMALLINT";
private const string c_NameOf__COL_DATA2 ="COL2_SMALLINT";
private sealed class MyContext:TestBaseDbContext
{
[Table(c_NameOf__TABLE)]
public sealed class TEST_RECORD
{
[Key]
[Column("TEST_ID")]
public System.Int64? TEST_ID { get; set; }
[Column(c_NameOf__COL_DATA1)]
public T_DATA1 COL_DATA1 { get; set; }
[Column(c_NameOf__COL_DATA2)]
public T_DATA2 COL_DATA2 { get; set; }
};//class TEST_RECORD
//----------------------------------------------------------------------
public DbSet<TEST_RECORD> testTable { get; set; }
//----------------------------------------------------------------------
public MyContext(xdb.OleDbTransaction tr)
:base(tr)
{
}//MyContext
};//class MyContext
//-----------------------------------------------------------------------
[Test]
public static void Test_001()
{
using(var cn=LocalCnHelper.CreateCn())
{
cn.Open();
using(var tr=cn.BeginTransaction())
{
//insert new record in external transaction
using(var db=new MyContext(tr))
{
const T_DATA1 c_value1=7;
const T_DATA2 c_value2=4;
System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2);
Assert.AreEqual
(3,
c_value1-(T_DATA2_AS)c_value2);
var recs=db.testTable.Where(r => (r.COL_DATA1-(T_DATA2_AS)r.COL_DATA2)==3 && r.TEST_ID==testID);
int nRecs=0;
foreach(var r in recs)
{
Assert.AreEqual
(0,
nRecs);
++nRecs;
Assert.IsTrue
(r.TEST_ID.HasValue);
Assert.AreEqual
(testID,
r.TEST_ID.Value);
Assert.AreEqual
(c_value1,
r.COL_DATA1);
Assert.AreEqual
(c_value2,
r.COL_DATA2);
}//foreach r
var sqlt
=new TestSqlTemplate()
.T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL()
.T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL()
.T("WHERE ((").N("t",c_NameOf__COL_DATA1).T(" - ").N("t",c_NameOf__COL_DATA2).T(") = 3) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")");
db.CheckTextOfLastExecutedCommand
(sqlt);
Assert.AreEqual
(1,
nRecs);
}//using db
tr.Rollback();
}//using tr
}//using cn
}//Test_001
//Helper methods --------------------------------------------------------
private static System.Int64 Helper__InsertRow(MyContext db,
T_DATA1 valueForColData1,
T_DATA2 valueForColData2)
{
var newRecord=new MyContext.TEST_RECORD();
newRecord.COL_DATA1 =valueForColData1;
newRecord.COL_DATA2 =valueForColData2;
db.testTable.Add(newRecord);
db.SaveChanges();
db.CheckTextOfLastExecutedCommand
(new TestSqlTemplate()
.T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA1).T(", ").N(c_NameOf__COL_DATA2).T(")").EOL()
.T("VALUES (").P("p0").T(", ").P("p1").T(")").EOL()
.T("RETURNING ").N("TEST_ID").EOL()
.T("INTO ").P("p2").T(";"));
Assert.IsTrue
(newRecord.TEST_ID.HasValue);
Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value);
return newRecord.TEST_ID.Value;
}//Helper__InsertRow
};//class TestSet_001__fields
////////////////////////////////////////////////////////////////////////////////
}//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Operators.SET_001.Subtract.Complete.Int16.Int16AsInt32
| 28.923567 | 155 | 0.56155 | [
"MIT"
] | ibprovider/Lcpi.EFCore.LcpiOleDb | Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D3/Query/Operators/SET_001/Subtract/Complete/Int16/Int16AsInt32/TestSet_001__fields.cs | 4,543 | C# |
/**
* Autogenerated by Thrift Compiler (0.11.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
namespace Apache.Hive.Service.Rpc.Thrift
{
public enum TTypeId
{
BOOLEAN_TYPE = 0,
TINYINT_TYPE = 1,
SMALLINT_TYPE = 2,
INT_TYPE = 3,
BIGINT_TYPE = 4,
FLOAT_TYPE = 5,
DOUBLE_TYPE = 6,
STRING_TYPE = 7,
TIMESTAMP_TYPE = 8,
BINARY_TYPE = 9,
ARRAY_TYPE = 10,
MAP_TYPE = 11,
STRUCT_TYPE = 12,
UNION_TYPE = 13,
USER_DEFINED_TYPE = 14,
DECIMAL_TYPE = 15,
NULL_TYPE = 16,
DATE_TYPE = 17,
VARCHAR_TYPE = 18,
CHAR_TYPE = 19,
INTERVAL_YEAR_MONTH_TYPE = 20,
INTERVAL_DAY_TIME_TYPE = 21,
TIMESTAMPLOCALTZ_TYPE = 22,
}
}
| 20.135135 | 67 | 0.628188 | [
"Apache-2.0"
] | SamuelFisher/Airlock.Hive | lib/Apache.Hive.Service.Rpc.Thrift/TTypeId.cs | 745 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookStore.Business.Abstract;
using BookStore.Entity.Concrete;
using BookStore.DataAccess.Functions;
using System.Threading.Tasks;
namespace BookStore.Business.Functions
{
public class UserManager : IUserService
{
public List<User> users = new();
public bool AddUser(User user)
{
int userId = GetUsersList().Select(x => x.Id).LastOrDefault();
user.Id = userId == 0 ? 1 : userId + 1;
var status = UserFileManager.SaveUsers(user);
return status;
}
public User GetUserId(int userId)
{
return UserFileManager.GetUserId(userId);
}
public List<User> GetUsersList()
{
return users = UserFileManager.GetUsers();
}
public bool RemoveUser(User user)
{
var status = UserFileManager.RemoveUser(user);
return status;
}
public void UpdateUser(User userToUpdate)
{
UserFileManager.UpdateUser(userToUpdate);
}
}
}
| 25.4 | 74 | 0.604549 | [
"MIT"
] | berkili/BookStore | BookStore.Business/Functions/UserManager.cs | 1,145 | C# |
using System;
namespace Orleans.Versions.Compatibility
{
[Serializable]
public class AllVersionsCompatible : CompatibilityStrategy
{
public static AllVersionsCompatible Singleton { get; } = new AllVersionsCompatible();
private AllVersionsCompatible()
{ }
public override bool Equals(object obj)
{
return obj is AllVersionsCompatible;
}
public override int GetHashCode()
{
return GetType().GetHashCode();
}
}
}
| 21.958333 | 93 | 0.620493 | [
"MIT"
] | seralexeev/orleans | src/Orleans.Core.Abstractions/Versions/Compatibility/AllVersionsCompatible.cs | 529 | C# |
using System.Collections;
using Game;
namespace NPC_Behaviour
{
public class DropBehaviour : AgentBehaviour
{
private Item _item;
public DropBehaviour(Agent agent, Item item) : base(agent)
{
_item = item;
base.Init();
}
public override IEnumerator DoBehaviour()
{
Agent.IsOccupied = true;
IsFinished = false;
if(Agent.Inventory.Contains(_item))
Agent.DropItem(_item);
IsFinished = true;
Agent.IsOccupied = false;
yield return null;
}
public override IEnumerator InterruptBehaviour()
{
Agent.IsOccupied = false;
yield return null;
}
public override IEnumerator ResumeBehaviour()
{
Agent.IsOccupied = true;
yield return null;
}
public override bool IsBehaviourFinished()
=> IsFinished;
}
}
| 23.547619 | 66 | 0.54095 | [
"MIT"
] | doingitraith/Story-generation-with-mutli-agent-systems | Project/Information Flow Game Mechanic/Assets/Scripts/NPC Behaviour/DropBehaviour.cs | 989 | C# |
using LazZiya.ImageResize.Tools;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
namespace LazZiya.ImageResize
{
/// <summary>
/// Add text watermark over the image.
/// </summary>
public static class TextWatermark
{
/// <summary>
/// Add text watermark over the image.
/// </summary>
/// <param name="img"></param>
/// <param name="text"></param>
public static Image AddTextWatermark(this Image img, string text)
{
return AddTextWatermark(img, text, new TextWatermarkOptions());
}
/// <summary>
/// Add text watermark over the image.
/// </summary>
/// <param name="img"></param>
/// <param name="text">text to draw over the image</param>
/// <param name="ops">Text watermark options <see cref="TextWatermarkOptions"/></param>
public static Image AddTextWatermark(this Image img, string text, TextWatermarkOptions ops)
{
using (var graphics = Graphics.FromImage(img))
{
var bgPos = TextWatermarkPosition.SetBGPos(img.Width, img.Height, ops.FontSize, ops.Location, ops.Margin);
var sf = new StringFormat()
{
FormatFlags = StringFormatFlags.NoWrap
};
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
//graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
//graphics.TextContrast = 12;
//graphics.CompositingMode = CompositingMode.SourceOver;
//graphics.InterpolationMode = InterpolationMode.High;
// Draw background if not fully transparent
if (ops.BGColor.A > 0)
{
var bgBrush = new SolidBrush(ops.BGColor);
graphics.FillRectangle(bgBrush, bgPos);
}
// Set font to use
var ff = new FontFamily(ops.FontName);
var font = new Font(ff, ops.FontSize, ops.FontStyle, GraphicsUnit.Pixel);
// Measure text size
var textMetrics = graphics.MeasureString(text, font, img.Width, sf);
var beforeText = TextWatermarkPosition.SetTextAlign(textMetrics, img.Width, ops.Location);
var drawPoint = new PointF(beforeText, bgPos.Y + (bgPos.Height / 4));
var outlineBrush = new SolidBrush(ops.OutlineColor);
using (var pen = new Pen(outlineBrush, ops.OutlineWidth))
{
using (var p = new GraphicsPath())
{
p.AddString(text, ff, (int)ops.FontStyle, ops.FontSize, drawPoint, sf);
// Draw text outline if not fully transparent
if (ops.OutlineColor.A > 0)
{
graphics.DrawPath(pen, p);
}
// Draw text if not fully transparent
if (ops.TextColor.A > 0)
{
var textBrush = new SolidBrush(ops.TextColor);
graphics.FillPath(textBrush, p);
}
}
}
}
return img;
}
}
}
| 37.531915 | 122 | 0.525794 | [
"MIT"
] | LazZiya/ImageResize | LazZiya.ImageResize/TextWatermark.cs | 3,530 | C# |
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.Design;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Identity;
using Microsoft.IdentityModel.Tokens;
//using Microsoft.IdentityModel.Tokens.Jwt;
using EventCalendar.Identity;
using EventCalendar.Interfaces;
using Microsoft.AspNetCore.Authorization;
using Google.Apis.Auth;
namespace EventCalendar.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class AuthController : ControllerBase
{
private readonly UserManager<ApplicationUser> _userManager;
private readonly RoleManager<IdentityRole> _roleManager;
// private readonly SignInManager<IdentityUser> _signInManager;
private readonly IConfiguration _configuration;
private readonly IAuthentication _auth;
public AuthController(UserManager<ApplicationUser> userManager, RoleManager<IdentityRole> roleManager, IConfiguration configuration, IAuthentication auth)
{
_userManager = userManager;
_roleManager = roleManager;
_configuration = configuration;
_auth = auth;
// _signInManager = signInManager;
}
public class AuthenticateRequest
{
[Required]
public string IdToken { get; set; }
}
//Authenticate with Google
[AllowAnonymous]
[HttpPost("GoogleAuthenticate")]
public IActionResult Authenticate([FromBody] AuthenticateRequest data)
{
GoogleJsonWebSignature.ValidationSettings settings = new GoogleJsonWebSignature.ValidationSettings();
// Change this to your google client ID
settings.Audience = new List<string>() { _configuration["GoogleCloud:ClientId"] };
try
{
GoogleJsonWebSignature.Payload payload = GoogleJsonWebSignature.ValidateAsync(data.IdToken, settings).Result;
if (!payload.EmailVerified)
{
// return Ok(new {result = false});
return NotFound();
}
var tokenString = _auth.GenerateToken("Guest");
// var resultTrue = await _signInManager.PasswordSignInAsync(UserName, Password, false, false);
return Ok(new { Token = tokenString });
}
catch (InvalidJwtException)
{
return NotFound();
}
}
[HttpPost]
[Route("Login")]
public async Task<IActionResult> Login(string UserName, string Password)
{
ApplicationUser user = await _userManager.FindByNameAsync(UserName);
if (user is null)
{
return NotFound();
}
var result = await _userManager.CheckPasswordAsync(user, Password);
if (!result)
{
// return Ok(new { result = false });
return NotFound();
}
var role = "Guest";
var guestRoleResult = await _userManager.IsInRoleAsync(user, "Guest");
if (guestRoleResult)
{
role = "Guest";
}
var adminRoleResult = await _userManager.IsInRoleAsync(user, "Admin");
if (adminRoleResult)
{
role = "Admin";
}
var tokenString = _auth.GenerateToken(role);
return Ok(new { Token = tokenString });
// return Unauthorized();
}
[HttpPost]
[Route("Create")]
public async Task<IActionResult> Create(string UserName, string Password, string Role)
{
if (Role == null)
{
Role = "guest";
}
ApplicationUser user = new()
{
UserName = UserName,
Email = $"{UserName}@gmail.com",
EmailConfirmed = true
};
var result = await _userManager.CreateAsync(user, Password);
var newRole = await _roleManager.RoleExistsAsync(Role);
if (!newRole)
{
var roleResult = await _roleManager.CreateAsync(new IdentityRole(Role));
}
var role = await _userManager.AddToRoleAsync(user, Role);
return Ok(result);
}
[Authorize]
[HttpPost]
[Route("Logout")]
public async Task<IActionResult> Logout(string UserName)
{
/*
ApplicationUser user = await _userManager.FindByNameAsync(UserName);
if (user is null)
{
return NotFound();
}
SymmetricSecurityKey IssuerSigningKey =
new(Encoding.UTF8.GetBytes("CSUN590@8:59PM#cretKey"));
SigningCredentials signingCreds = new(IssuerSigningKey, SecurityAlgorithms.HmacSha256);
JwtSecurityToken tokenOptions = new JwtSecurityToken(
issuer: "https://www.eventcalendar-2.azurewebsites.net",
audience: "https://www.eventcalendar-2.azurewebsites.net",
claims: new List<Claim>(),
expires: DateTime.Now.AddMinutes(0),
signingCredentials: signingCreds
);
var tokenString = new JwtSecurityTokenHandler().WriteToken(tokenOptions);
return Ok(new { Token = tokenString });
*/
return Ok();
}
[Authorize]
[HttpPost]
[Route("CheckLoginState")]
public async Task<IActionResult> LoginState()
{
return Ok();
}
}
}
| 26.892377 | 162 | 0.572453 | [
"MIT"
] | joshuakristanto/EventsCalender | EventCalendarIntegrated/EventCalendar/EventCalendar/Controllers/AuthController.cs | 5,997 | C# |
using Newtonsoft.Json.Linq;
using System;
namespace BankingClientV1
{
static class User
{
private static string TAG, PIN, BALANCEINPUT, ERROR;
private static Boolean RECEIPT, WAITINGFORCARD;
private static double BALANCE;
public static Boolean inputBlocked, offline;
public static void SetValues(String XTAG, String XPIN, double XBALANCE)
{
TAG = XTAG;
PIN = XPIN;
}
public static void ClearUser()
{
TAG = "";
PIN = "";
BALANCEINPUT = "";
BALANCE = 0;
RECEIPT = false;
WAITINGFORCARD = false;
inputBlocked = false;
}
public static double GetBalance()
{
if (BALANCE != 0)
return BALANCE;
JObject json = new WebHandler().GetBalance();
String response = (String)json.GetValue("balance");
double money = double.Parse(response) / 100;
BALANCE = money;
return BALANCE;
}
public static Boolean GetReceipt()
{
return RECEIPT;
}
public static String GetError()
{
return ERROR;
}
public static String GetTag()
{
if (TAG == null)
TAG = "";
else if (TAG.StartsWith("AG"))
TAG = TAG.Replace("AG ", "");
return TAG;
}
public static String GetPin()
{
if (PIN == null)
PIN = "";
return PIN;
}
public static Boolean GetWaitingForCard()
{
return WAITINGFORCARD;
}
public static String GetBalanceInput()
{
if (BALANCEINPUT == null)
BALANCEINPUT = "";
return BALANCEINPUT;
}
public static void SetTag(String XTAG)
{
TAG = XTAG;
}
public static void SetReceipt(Boolean XTAG)
{
RECEIPT = XTAG;
}
public static void SetWaitingForCard(Boolean XWAITING)
{
WAITINGFORCARD = XWAITING;
}
public static void SetPin(String XPIN)
{
PIN = XPIN;
}
public static void SetError(String XERROR)
{
ERROR = XERROR;
}
public static void SetBalanceInput(String XBALANCEINPUT)
{
BALANCEINPUT = XBALANCEINPUT;
}
}
} | 22.368421 | 79 | 0.483922 | [
"MIT"
] | thomasvt1/BankingGUI | BankingClientV1/User.cs | 2,552 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ejercicio_15 : MonoBehaviour
{
//15. Existen dos reglas que identifican dos conjuntos de valores:
//- El número es de un solo dígito.
//- El número es impar.
//A partir de estas reglas, creá un algoritmo que asigne a las variables booleanas estaEnA, estaEnB, estaEnAmbos y noEstaEnNinguno el valor verdadero
//o falso, según corresponda, para indicar si el valor ingresado pertenece al primer conjunto, al segundo, a ambos o a ninguno, respectivamente.
//Definí un lote de prueba de varios números y probá el algoritmo, escribiendo los resultados.
public int numero;
void Start()
{
bool estaEnA;
bool estaEnAmbos;
bool noEstaEnNinguno;
bool estaEnB;
if (numero < 10 && numero > -10)
{
if (numero % 2 != 0)
{
estaEnAmbos = true;
Debug.Log("Está en ambos: " + estaEnAmbos);
}
else
{
estaEnA = true;
Debug.Log("Está en A: " + estaEnA);
}
}
else if (numero % 2 != 0)
{
estaEnB = true;
Debug.Log("Está en B: " + estaEnB);
}
else
{
noEstaEnNinguno = true;
Debug.Log("No está en ninguno: " + noEstaEnNinguno);
}
}
}
| 27.692308 | 153 | 0.560417 | [
"MIT"
] | NachoBerardo/Guia-de-Programacion-1 | Assets/Ejercicio_15.cs | 1,454 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal
{
/// <summary>
/// <para>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </para>
/// <para>
/// The service lifetime is <see cref="ServiceLifetime.Scoped"/> and multiple registrations
/// are allowed. This means that each <see cref="DbContext"/> instance will use its own
/// set of instances of this service.
/// The implementations may depend on other services registered with any lifetime.
/// The implementations do not need to be thread-safe.
/// </para>
/// </summary>
public class RuntimeConventionSetBuilder : IConventionSetBuilder
{
private readonly IProviderConventionSetBuilder _conventionSetBuilder;
private readonly IList<IConventionSetCustomizer> _customizers;
/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public RuntimeConventionSetBuilder(
[NotNull] IProviderConventionSetBuilder providerConventionSetBuilder,
[NotNull] IEnumerable<IConventionSetCustomizer> customizers)
{
_conventionSetBuilder = providerConventionSetBuilder;
_customizers = customizers.ToList();
}
/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
public virtual ConventionSet CreateConventionSet()
{
var conventionSet = _conventionSetBuilder.CreateConventionSet();
foreach (var customizer in _customizers)
{
conventionSet = customizer.ModifyConventions(conventionSet);
}
return conventionSet;
}
}
}
| 43.830508 | 111 | 0.668213 | [
"Apache-2.0"
] | MareevOleg/EntityFrameworkCore | src/EFCore/Metadata/Conventions/Internal/RuntimeConventionSetBuilder.cs | 2,586 | C# |
using System.Collections.Generic;
using VoteMonitor.Entities;
namespace VoteMonitor.Api.Form.Models
{
public class QuestionDTO
{
public QuestionDTO()
{
OptionsToQuestions = new List<OptionToQuestionDTO>();
}
public int Id { get; set; }
public string FormCode { get; set; }
public string Code { get; set; }
public int IdSection { get; set; }
public QuestionType QuestionType { get; set; }
public string Text { get; set; }
public string Hint { get; set; }
public IEnumerable<OptionToQuestionDTO> OptionsToQuestions { get; set; }
}
} | 28.086957 | 80 | 0.616099 | [
"MPL-2.0"
] | adascaliteiradu/monitorizare-vot | src/api/VoteMonitor.Api.Form/Models/QuestionDTO.cs | 648 | C# |
using Xunit;
namespace BusinessApp.Infrastructure.IntegrationTest
{
public class CommonFixture
{
public const string Name = "Common Fixture";
}
[CollectionDefinition(CommonFixture.Name)]
public class CommonCollectionFixture : ICollectionFixture<CommonFixture>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
}
| 27.666667 | 78 | 0.698795 | [
"MIT"
] | pinterweb/dotnet-solution-template | CSharp/src/BusinessApp.Infrastructure.IntegrationTest/CommonFixture.cs | 498 | C# |
using System;
using System.IO;
using Akka.Actor;
using Akka.Configuration;
namespace znode1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var configFile = File.ReadAllText("znode1.hcon");
var config = ConfigurationFactory.ParseString(configFile);
var actorSystem = ActorSystem.Create("zsys", config);
Console.ReadLine();
actorSystem.Dispose();
}
}
} | 23.958333 | 71 | 0.52 | [
"MIT"
] | mtmk/akkadotnetexamples | zcluster/znode1/Program.cs | 577 | C# |
/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
* for more information concerning the license and the contributors participating to this project.
*/
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OAuth;
namespace AspNet.Security.OAuth.Twitch
{
/// <summary>
/// Default values used by the Twitch authentication middleware.
/// </summary>
public static class TwitchAuthenticationDefaults
{
/// <summary>
/// Default value for <see cref="AuthenticationScheme.Name"/>.
/// </summary>
public const string AuthenticationScheme = "Twitch";
/// <summary>
/// Default value for <see cref="AuthenticationScheme.DisplayName"/>.
/// </summary>
public const string DisplayName = "Twitch";
/// <summary>
/// Default value for <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>.
/// </summary>
public const string Issuer = "Twitch";
/// <summary>
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>.
/// </summary>
public const string CallbackPath = "/signin-twitch";
/// <summary>
/// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
/// </summary>
public const string AuthorizationEndPoint = "https://id.twitch.tv/oauth2/authorize";
/// <summary>
/// Default value for <see cref="OAuthOptions.TokenEndpoint"/>.
/// </summary>
public const string TokenEndpoint = "https://id.twitch.tv/oauth2/token";
/// <summary>
/// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>.
/// </summary>
public const string UserInformationEndpoint = "https://api.twitch.tv/helix/users/";
}
}
| 36.716981 | 98 | 0.643371 | [
"Apache-2.0"
] | AaqibAhamed/AspNet.Security.OAuth.Providers | src/AspNet.Security.OAuth.Twitch/TwitchAuthenticationDefaults.cs | 1,948 | C# |
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace QuantumTask
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| 25.666667 | 70 | 0.645022 | [
"MIT"
] | farhadsoft/QuantumTask | QuantumTask/Program.cs | 693 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("01. Serialize String")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("01. Serialize String")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ee97aac0-1535-47f2-aaca-49de6539529e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.054054 | 84 | 0.746449 | [
"MIT"
] | vankatalp360/Programming-Fundamentals-2017 | Strings - More Exercise/01. Serialize String/Properties/AssemblyInfo.cs | 1,411 | C# |
namespace Discord
{
public enum TagHandling
{
Ignore = 0, //<@53905483156684800> -> <@53905483156684800>
Remove, //<@53905483156684800> ->
Name, //<@53905483156684800> -> @Voltana
NameNoPrefix, //<@53905483156684800> -> Voltana
FullName, //<@53905483156684800> -> @Voltana#8252
FullNameNoPrefix, //<@53905483156684800> -> Voltana#8252
Sanitize //<@53905483156684800> -> <@53905483156684800> (w/ nbsp)
}
}
| 38.428571 | 84 | 0.542751 | [
"MIT"
] | CaptainGlac1er/Discord.Net | src/Discord.Net.Core/Entities/Messages/TagHandling.cs | 540 | C# |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Dts.V20180330.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class DescribeSyncCheckJobRequest : AbstractModel
{
/// <summary>
/// 要查询的灾备同步任务ID
/// </summary>
[JsonProperty("JobId")]
public string JobId{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
public override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "JobId", this.JobId);
}
}
}
| 29.295455 | 81 | 0.657099 | [
"Apache-2.0"
] | kimii/tencentcloud-sdk-dotnet | TencentCloud/Dts/V20180330/Models/DescribeSyncCheckJobRequest.cs | 1,309 | C# |
using DotNetty.Buffers;
namespace DotNetty.Codecs.MqttFx.Packets
{
/// <summary>
/// 发布消息
/// </summary>
public sealed class PublishPacket : Packet
{
/// <summary>
/// 重发标志
/// 如果DUP标志被设置为0,表示这是客户端或服务端第一次请求发送这个PUBLISH报文。
/// 如果DUP标志被设置为1,表示这可能是一个早前报文请求的重发。
/// </summary>
public bool Dup { get; private set; }
/// <summary>
/// 服务质量等级
/// </summary>
public MqttQos Qos { get; private set; }
/// <summary>
/// 保留标志
/// </summary>
public bool Retain { get; private set; }
/// <summary>
/// 主题名(UTF-8编码的字符串)
/// </summary>
public string TopicName { get; set; }
/// <summary>
/// 报文标识符
/// 只有当QoS等级是1或2时,报文标识符(Packet Identifier)字段才能出现在PUBLISH报文中。
/// </summary>
public ushort PacketIdentifier { get; set; }
/// <summary>
/// 有效载荷
/// </summary>
public byte[] Payload { get; set; }
/// <summary>
/// 发布消息
/// </summary>
public PublishPacket()
: base(PacketType.PUBLISH) { }
/// <summary>
/// 发布消息
/// </summary>
/// <param name="qos">服务质量等级</param>
/// <param name="dup">重发标志</param>
/// <param name="retain">保留标志</param>
public PublishPacket(MqttQos qos = MqttQos.AtMostOnce, bool dup = false, bool retain = false) : this()
{
Qos = qos;
Dup = dup;
Retain = retain;
FixedHeader.Flags |= Dup.ToByte() << 3;
FixedHeader.Flags |= (byte)Qos << 1;
FixedHeader.Flags |= Retain.ToByte();
}
/// <summary>
/// 编码
/// </summary>
/// <param name="buffer"></param>
public override void Encode(IByteBuffer buffer)
{
var buf = Unpooled.Buffer();
try
{
buf.WriteString(TopicName);
if (Qos > MqttQos.AtMostOnce)
buf.WriteUnsignedShort(PacketIdentifier);
buf.WriteBytes(Payload, 0, Payload.Length);
FixedHeader.Encode(buffer, buf.ReadableBytes);
buffer.WriteBytes(buf);
}
finally
{
buf?.Release();
}
}
/// <summary>
/// 解码
/// </summary>
/// <param name="buffer"></param>
public override void Decode(IByteBuffer buffer)
{
Dup = (FixedHeader.Flags & 0x08) == 0x08;
Qos = (MqttQos)((FixedHeader.Flags & 0x06) >> 1);
Retain = (FixedHeader.Flags & 0x01) > 0;
//int remainingLength = fixedHeader.RemaingLength;
//TopicName = buffer.ReadString(ref remainingLength);
//if (fixedHeader.Qos > MqttQos.AtLeastOnce)
//{
// PacketIdentifier = buffer.ReadUnsignedShort(ref remainingLength);
// if (PacketIdentifier == 0)
// throw new DecoderException("[MQTT-2.3.1-1]");
//}
//if (FixedHeader.RemaingLength > 0)
//{
// Payload = new byte[FixedHeader.RemaingLength];
// buffer.ReadBytes(Payload, 0, FixedHeader.RemaingLength);
// FixedHeader.RemaingLength = 0;
//}
}
}
}
| 30.711712 | 110 | 0.486653 | [
"MIT"
] | linfx/MqttFx | src/DotNetty.Codecs.MqttFx/Packets/PublishPacket.cs | 3,707 | C# |
namespace ConsoleAsksFor;
/// <summary>
/// Options related to history.
/// </summary>
public sealed record HistoryOptions
{
/// <summary>
/// '.console\history.json'
/// </summary>
internal const string FilePath = @".console\history.json";
/// <summary>
/// Whether or not history is persisted between sessions. <br/>
/// When enabled; file located at <inheritdoc cref="FilePath"/>.<br/>
/// Default value: true.
/// </summary>
public bool HasPersistedHistory { get; init; } = true;
/// <summary>
/// Amount of answers of questions which are stored in history. <br/>
/// Before an answer can be given history is determined vor question. If you notice delays lowering this value could be useful. <br/>
/// After each given answer data is persisted to file. If you notice delays lowering this value could be useful. <br/>
/// Default value: <see cref="int.MaxValue" />.
/// </summary>
public int MaxSize { get; init; } = int.MaxValue;
/// <summary>
/// Default <see cref="HistoryOptions"/>.
/// </summary>
public static HistoryOptions Default { get; } = new();
/// <summary>
/// Disabled persistence of history.
/// </summary>
public static HistoryOptions NoPersistence { get; } = new()
{
HasPersistedHistory = false,
};
} | 33.575 | 137 | 0.631422 | [
"Apache-2.0"
] | Pjotrtje/ConsoleAsksFor | src/ConsoleAsksFor/Configuration/HistoryOptions.cs | 1,345 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
public class PerformanceCar : Car
{
private List<string> addOns;
public PerformanceCar(string brand, string model, int yearOfProduction, int horsepower, int acceleration, int suspension, int durability) : base(brand, model, yearOfProduction, horsepower + (horsepower * 50) / 100, acceleration, suspension - (suspension * 25) / 100, durability)
{
this.AddOns = new List<string>();
}
public List<string> AddOns
{
get { return addOns; }
set { addOns = value; }
}
public override string ToString()
{
var result = base.ToString() + Environment.NewLine;
if (this.AddOns.Any())
{
result += $"Add-ons: {string.Join(", ", this.AddOns)}";
}
else
{
result += $"Add-ons: None";
}
return result;
}
} | 26.057143 | 282 | 0.595395 | [
"MIT"
] | tanyta78/CSharpOOP | Exam Preparation/NeedForSpeed/SampleExam/Models/Cars/PerformanceCar.cs | 914 | C# |
using System.Collections.Generic;
using KontrolSystem.TO2.Binding;
namespace KontrolSystem.KSP.Runtime.KSPVessel {
public partial class KSPVesselModule {
[KSClass]
public class SimulatedVessel {
public List<SimulatedPart> parts = new List<SimulatedPart>();
private int count;
public double totalMass = 0;
private SimCurves simCurves;
public SimulatedVessel(Vessel v, SimCurves simCurves, double startTime, int limitChutesStage) {
totalMass = 0;
var oParts = v.Parts;
count = oParts.Count;
this.simCurves = simCurves;
if (parts.Capacity < count)
parts.Capacity = count;
for (int i = 0; i < count; i++) {
SimulatedPart simulatedPart = null;
bool special = false;
for (int j = 0; j < oParts[i].Modules.Count; j++) {
ModuleParachute mp = oParts[i].Modules[j] as ModuleParachute;
if (mp != null && v.mainBody.atmosphere) {
special = true;
simulatedPart = new SimulatedParachute(mp, simCurves, startTime, limitChutesStage);
}
}
if (!special) {
simulatedPart = new SimulatedPart(oParts[i], simCurves);
}
parts.Add(simulatedPart);
totalMass += simulatedPart.totalMass;
}
}
[KSMethod]
public Vector3d Drag(Vector3d localVelocity, double dynamicPressurekPa, double mach) {
Vector3d drag = Vector3d.zero;
double dragFactor = dynamicPressurekPa * PhysicsGlobals.DragCubeMultiplier * PhysicsGlobals.DragMultiplier;
for (int i = 0; i < count; i++) {
drag += parts[i].Drag(localVelocity, dragFactor, (float)mach);
}
return -localVelocity.normalized * drag.magnitude;
}
[KSMethod]
public Vector3d Lift(Vector3d localVelocity, double dynamicPressurekPa, double mach) {
Vector3d lift = Vector3d.zero;
double liftFactor = dynamicPressurekPa * simCurves.LiftMachCurve.Evaluate((float)mach);
for (int i = 0; i < count; i++) {
lift += parts[i].Lift(localVelocity, liftFactor);
}
return lift;
}
[KSMethod]
public bool WillChutesDeploy(double altAGL, double altASL, double probableLandingSiteASL, double pressure, double shockTemp, double t, double parachuteSemiDeployMultiplier) {
for (int i = 0; i < count; i++) {
if (parts[i].SimulateAndRollback(altAGL, altASL, probableLandingSiteASL, pressure, shockTemp, t, parachuteSemiDeployMultiplier)) {
return true;
}
}
return false;
}
[KSMethod]
public bool Simulate(double altATGL, double altASL, double endASL, double pressure, double shockTemp, double time, double semiDeployMultiplier) {
bool deploying = false;
for (int i = 0; i < count; i++) {
deploying |= parts[i].Simulate(altATGL, altASL, endASL, pressure, shockTemp, time, semiDeployMultiplier);
}
return deploying;
}
}
}
}
| 40.966292 | 186 | 0.523862 | [
"MIT"
] | untoldwind/KontrolSystem | KSPRuntime/KSPVessel/KSPVesselModule.SimulatedVessel.cs | 3,648 | C# |
namespace MagiCloud.Features
{
/// <summary>
/// 高亮方式类型
/// </summary>
public enum HighLightType
{
Shader,
Model
}
}
| 11.428571 | 29 | 0.5 | [
"MIT"
] | LiiiiiWr/MagiCloudSDK | Assets/MagiCloud/Expansion/Features/FeaturesType.cs | 174 | C# |
using System;
using System.Collections.Generic;
using NHapi.Base.Log;
using NHapi.Model.V24.Group;
using NHapi.Model.V24.Segment;
using NHapi.Model.V24.Datatype;
using NHapi.Base;
using NHapi.Base.Parser;
using NHapi.Base.Model;
namespace NHapi.Model.V24.Message
{
///<summary>
/// Represents a RQI_I01 message structure (see chapter 11). This structure contains the
/// following elements:
///<ol>
///<li>0: MSH (Message Header) </li>
///<li>1: RQI_I01_PROVIDER (a Group object) repeating</li>
///<li>2: PID (Patient identification) </li>
///<li>3: NK1 (Next of kin / associated parties) optional repeating</li>
///<li>4: RQI_I01_GUARANTOR_INSURANCE (a Group object) optional </li>
///<li>5: NTE (Notes and Comments) optional repeating</li>
///</ol>
///</summary>
[Serializable]
public class RQI_I01 : AbstractMessage {
///<summary>
/// Creates a new RQI_I01 Group with custom IModelClassFactory.
///</summary>
public RQI_I01(IModelClassFactory factory) : base(factory){
init(factory);
}
///<summary>
/// Creates a new RQI_I01 Group with DefaultModelClassFactory.
///</summary>
public RQI_I01() : base(new DefaultModelClassFactory()) {
init(new DefaultModelClassFactory());
}
///<summary>
/// initalize method for RQI_I01. This does the segment setup for the message.
///</summary>
private void init(IModelClassFactory factory) {
try {
this.add(typeof(MSH), true, false);
this.add(typeof(RQI_I01_PROVIDER), true, true);
this.add(typeof(PID), true, false);
this.add(typeof(NK1), false, true);
this.add(typeof(RQI_I01_GUARANTOR_INSURANCE), false, false);
this.add(typeof(NTE), false, true);
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RQI_I01 - this is probably a bug in the source code generator.", e);
}
}
public override string Version
{
get{
return Constants.VERSION;
}
}
///<summary>
/// Returns MSH (Message Header) - creates it if necessary
///</summary>
public MSH MSH {
get{
MSH ret = null;
try {
ret = (MSH)this.GetStructure("MSH");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of RQI_I01_PROVIDER (a Group object) - creates it if necessary
///</summary>
public RQI_I01_PROVIDER GetPROVIDER() {
RQI_I01_PROVIDER ret = null;
try {
ret = (RQI_I01_PROVIDER)this.GetStructure("PROVIDER");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of RQI_I01_PROVIDER
/// * (a Group object) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public RQI_I01_PROVIDER GetPROVIDER(int rep) {
return (RQI_I01_PROVIDER)this.GetStructure("PROVIDER", rep);
}
/**
* Returns the number of existing repetitions of RQI_I01_PROVIDER
*/
public int PROVIDERRepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("PROVIDER").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the RQI_I01_PROVIDER results
*/
public IEnumerable<RQI_I01_PROVIDER> PROVIDERs
{
get
{
for (int rep = 0; rep < PROVIDERRepetitionsUsed; rep++)
{
yield return (RQI_I01_PROVIDER)this.GetStructure("PROVIDER", rep);
}
}
}
///<summary>
///Adds a new RQI_I01_PROVIDER
///</summary>
public RQI_I01_PROVIDER AddPROVIDER()
{
return this.AddStructure("PROVIDER") as RQI_I01_PROVIDER;
}
///<summary>
///Removes the given RQI_I01_PROVIDER
///</summary>
public void RemovePROVIDER(RQI_I01_PROVIDER toRemove)
{
this.RemoveStructure("PROVIDER", toRemove);
}
///<summary>
///Removes the RQI_I01_PROVIDER at the given index
///</summary>
public void RemovePROVIDERAt(int index)
{
this.RemoveRepetition("PROVIDER", index);
}
///<summary>
/// Returns PID (Patient identification) - creates it if necessary
///</summary>
public PID PID {
get{
PID ret = null;
try {
ret = (PID)this.GetStructure("PID");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of NK1 (Next of kin / associated parties) - creates it if necessary
///</summary>
public NK1 GetNK1() {
NK1 ret = null;
try {
ret = (NK1)this.GetStructure("NK1");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of NK1
/// * (Next of kin / associated parties) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public NK1 GetNK1(int rep) {
return (NK1)this.GetStructure("NK1", rep);
}
/**
* Returns the number of existing repetitions of NK1
*/
public int NK1RepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("NK1").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the NK1 results
*/
public IEnumerable<NK1> NK1s
{
get
{
for (int rep = 0; rep < NK1RepetitionsUsed; rep++)
{
yield return (NK1)this.GetStructure("NK1", rep);
}
}
}
///<summary>
///Adds a new NK1
///</summary>
public NK1 AddNK1()
{
return this.AddStructure("NK1") as NK1;
}
///<summary>
///Removes the given NK1
///</summary>
public void RemoveNK1(NK1 toRemove)
{
this.RemoveStructure("NK1", toRemove);
}
///<summary>
///Removes the NK1 at the given index
///</summary>
public void RemoveNK1At(int index)
{
this.RemoveRepetition("NK1", index);
}
///<summary>
/// Returns RQI_I01_GUARANTOR_INSURANCE (a Group object) - creates it if necessary
///</summary>
public RQI_I01_GUARANTOR_INSURANCE GUARANTOR_INSURANCE {
get{
RQI_I01_GUARANTOR_INSURANCE ret = null;
try {
ret = (RQI_I01_GUARANTOR_INSURANCE)this.GetStructure("GUARANTOR_INSURANCE");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns first repetition of NTE (Notes and Comments) - creates it if necessary
///</summary>
public NTE GetNTE() {
NTE ret = null;
try {
ret = (NTE)this.GetStructure("NTE");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
///<summary>
///Returns a specific repetition of NTE
/// * (Notes and Comments) - creates it if necessary
/// throws HL7Exception if the repetition requested is more than one
/// greater than the number of existing repetitions.
///</summary>
public NTE GetNTE(int rep) {
return (NTE)this.GetStructure("NTE", rep);
}
/**
* Returns the number of existing repetitions of NTE
*/
public int NTERepetitionsUsed {
get{
int reps = -1;
try {
reps = this.GetAll("NTE").Length;
} catch (HL7Exception e) {
string message = "Unexpected error accessing data - this is probably a bug in the source code generator.";
HapiLogFactory.GetHapiLog(GetType()).Error(message, e);
throw new System.Exception(message);
}
return reps;
}
}
/**
* Enumerate over the NTE results
*/
public IEnumerable<NTE> NTEs
{
get
{
for (int rep = 0; rep < NTERepetitionsUsed; rep++)
{
yield return (NTE)this.GetStructure("NTE", rep);
}
}
}
///<summary>
///Adds a new NTE
///</summary>
public NTE AddNTE()
{
return this.AddStructure("NTE") as NTE;
}
///<summary>
///Removes the given NTE
///</summary>
public void RemoveNTE(NTE toRemove)
{
this.RemoveStructure("NTE", toRemove);
}
///<summary>
///Removes the NTE at the given index
///</summary>
public void RemoveNTEAt(int index)
{
this.RemoveRepetition("NTE", index);
}
}
}
| 27.997167 | 146 | 0.638976 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | afaonline/nHapi | src/NHapi.Model.V24/Message/RQI_I01.cs | 9,883 | C# |
/*******************************************************************************
* Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
* this file except in compliance with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file.
* This file 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.
* *****************************************************************************
*
* AWS Tools for Windows (TM) PowerShell (TM)
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using Amazon.PowerShell.Common;
using Amazon.Runtime;
using Amazon.GuardDuty;
using Amazon.GuardDuty.Model;
namespace Amazon.PowerShell.Cmdlets.GD
{
/// <summary>
/// Updates the filter specified by the filter name.
/// </summary>
[Cmdlet("Update", "GDFilter", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)]
[OutputType("System.String")]
[AWSCmdlet("Calls the Amazon GuardDuty UpdateFilter API operation.", Operation = new[] {"UpdateFilter"}, SelectReturnType = typeof(Amazon.GuardDuty.Model.UpdateFilterResponse))]
[AWSCmdletOutput("System.String or Amazon.GuardDuty.Model.UpdateFilterResponse",
"This cmdlet returns a System.String object.",
"The service call response (type Amazon.GuardDuty.Model.UpdateFilterResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack."
)]
public partial class UpdateGDFilterCmdlet : AmazonGuardDutyClientCmdlet, IExecutor
{
#region Parameter Action
/// <summary>
/// <para>
/// <para>Specifies the action that is to be applied to the findings that match the filter.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[AWSConstantClassSource("Amazon.GuardDuty.FilterAction")]
public Amazon.GuardDuty.FilterAction Action { get; set; }
#endregion
#region Parameter Description
/// <summary>
/// <para>
/// <para>The description of the filter.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.String Description { get; set; }
#endregion
#region Parameter DetectorId
/// <summary>
/// <para>
/// <para>The unique ID of the detector that specifies the GuardDuty service where you want
/// to update a filter.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)]
#else
[System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String DetectorId { get; set; }
#endregion
#region Parameter FilterName
/// <summary>
/// <para>
/// <para>The name of the filter.</para>
/// </para>
/// </summary>
#if !MODULAR
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
#else
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)]
[System.Management.Automation.AllowEmptyString]
[System.Management.Automation.AllowNull]
#endif
[Amazon.PowerShell.Common.AWSRequiredParameter]
public System.String FilterName { get; set; }
#endregion
#region Parameter FindingCriterion
/// <summary>
/// <para>
/// <para>Represents the criteria to be used in the filter for querying findings.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
[Alias("FindingCriteria")]
public Amazon.GuardDuty.Model.FindingCriteria FindingCriterion { get; set; }
#endregion
#region Parameter Rank
/// <summary>
/// <para>
/// <para>Specifies the position of the filter in the list of current filters. Also specifies
/// the order in which this filter is applied to the findings.</para>
/// </para>
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public System.Int32? Rank { get; set; }
#endregion
#region Parameter Select
/// <summary>
/// Use the -Select parameter to control the cmdlet output. The default value is 'Name'.
/// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.GuardDuty.Model.UpdateFilterResponse).
/// Specifying the name of a property of type Amazon.GuardDuty.Model.UpdateFilterResponse will result in that property being returned.
/// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public string Select { get; set; } = "Name";
#endregion
#region Parameter PassThru
/// <summary>
/// Changes the cmdlet behavior to return the value passed to the DetectorId parameter.
/// The -PassThru parameter is deprecated, use -Select '^DetectorId' instead. This parameter will be removed in a future version.
/// </summary>
[System.Obsolete("The -PassThru parameter is deprecated, use -Select '^DetectorId' instead. This parameter will be removed in a future version.")]
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter PassThru { get; set; }
#endregion
#region Parameter Force
/// <summary>
/// This parameter overrides confirmation prompts to force
/// the cmdlet to continue its operation. This parameter should always
/// be used with caution.
/// </summary>
[System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)]
public SwitchParameter Force { get; set; }
#endregion
protected override void ProcessRecord()
{
base.ProcessRecord();
var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.DetectorId), MyInvocation.BoundParameters);
if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Update-GDFilter (UpdateFilter)"))
{
return;
}
var context = new CmdletContext();
// allow for manipulation of parameters prior to loading into context
PreExecutionContextLoad(context);
#pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
if (ParameterWasBound(nameof(this.Select)))
{
context.Select = CreateSelectDelegate<Amazon.GuardDuty.Model.UpdateFilterResponse, UpdateGDFilterCmdlet>(Select) ??
throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select));
if (this.PassThru.IsPresent)
{
throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select));
}
}
else if (this.PassThru.IsPresent)
{
context.Select = (response, cmdlet) => this.DetectorId;
}
#pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute
context.Action = this.Action;
context.Description = this.Description;
context.DetectorId = this.DetectorId;
#if MODULAR
if (this.DetectorId == null && ParameterWasBound(nameof(this.DetectorId)))
{
WriteWarning("You are passing $null as a value for parameter DetectorId which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.FilterName = this.FilterName;
#if MODULAR
if (this.FilterName == null && ParameterWasBound(nameof(this.FilterName)))
{
WriteWarning("You are passing $null as a value for parameter FilterName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues.");
}
#endif
context.FindingCriterion = this.FindingCriterion;
context.Rank = this.Rank;
// allow further manipulation of loaded context prior to processing
PostExecutionContextLoad(context);
var output = Execute(context) as CmdletOutput;
ProcessOutput(output);
}
#region IExecutor Members
public object Execute(ExecutorContext context)
{
var cmdletContext = context as CmdletContext;
// create request
var request = new Amazon.GuardDuty.Model.UpdateFilterRequest();
if (cmdletContext.Action != null)
{
request.Action = cmdletContext.Action;
}
if (cmdletContext.Description != null)
{
request.Description = cmdletContext.Description;
}
if (cmdletContext.DetectorId != null)
{
request.DetectorId = cmdletContext.DetectorId;
}
if (cmdletContext.FilterName != null)
{
request.FilterName = cmdletContext.FilterName;
}
if (cmdletContext.FindingCriterion != null)
{
request.FindingCriteria = cmdletContext.FindingCriterion;
}
if (cmdletContext.Rank != null)
{
request.Rank = cmdletContext.Rank.Value;
}
CmdletOutput output;
// issue call
var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
try
{
var response = CallAWSServiceOperation(client, request);
object pipelineOutput = null;
pipelineOutput = cmdletContext.Select(response, this);
output = new CmdletOutput
{
PipelineOutput = pipelineOutput,
ServiceResponse = response
};
}
catch (Exception e)
{
output = new CmdletOutput { ErrorResponse = e };
}
return output;
}
public ExecutorContext CreateContext()
{
return new CmdletContext();
}
#endregion
#region AWS Service Operation Call
private Amazon.GuardDuty.Model.UpdateFilterResponse CallAWSServiceOperation(IAmazonGuardDuty client, Amazon.GuardDuty.Model.UpdateFilterRequest request)
{
Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon GuardDuty", "UpdateFilter");
try
{
#if DESKTOP
return client.UpdateFilter(request);
#elif CORECLR
return client.UpdateFilterAsync(request).GetAwaiter().GetResult();
#else
#error "Unknown build edition"
#endif
}
catch (AmazonServiceException exc)
{
var webException = exc.InnerException as System.Net.WebException;
if (webException != null)
{
throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
}
throw;
}
}
#endregion
internal partial class CmdletContext : ExecutorContext
{
public Amazon.GuardDuty.FilterAction Action { get; set; }
public System.String Description { get; set; }
public System.String DetectorId { get; set; }
public System.String FilterName { get; set; }
public Amazon.GuardDuty.Model.FindingCriteria FindingCriterion { get; set; }
public System.Int32? Rank { get; set; }
public System.Func<Amazon.GuardDuty.Model.UpdateFilterResponse, UpdateGDFilterCmdlet, object> Select { get; set; } =
(response, cmdlet) => response.Name;
}
}
}
| 43.984026 | 281 | 0.603036 | [
"Apache-2.0"
] | 5u5hma/aws-tools-for-powershell | modules/AWSPowerShell/Cmdlets/GuardDuty/Basic/Update-GDFilter-Cmdlet.cs | 13,767 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Playnite.Database;
using Playnite.SDK.Models;
using Playnite;
using Moq;
using NUnit.Framework;
using Playnite.Settings;
using Playnite.Common.System;
namespace PlayniteTests.Database
{
[TestFixture]
public class GameDatabaseTests
{
[OneTimeSetUp]
public void Init()
{
// Some test are reading resources, which cannot be access until pack:// namespace is initialized
// http://stackoverflow.com/questions/6005398/uriformatexception-invalid-uri-invalid-port-specified
string s = System.IO.Packaging.PackUriHelper.UriSchemePack;
}
[Test]
public void GetMigratedDbPathTest()
{
Assert.AreEqual(@"{PlayniteDir}\games", GameDatabase.GetMigratedDbPath(@"games.db"));
Assert.AreEqual(@"c:\games", GameDatabase.GetMigratedDbPath(@"c:\games.db"));
Assert.AreEqual(@"c:\test\games", GameDatabase.GetMigratedDbPath(@"c:\test\games.db"));
var appData = Environment.ExpandEnvironmentVariables("%AppData%");
Assert.AreEqual(@"%AppData%\playnite\games", GameDatabase.GetMigratedDbPath(Path.Combine(appData, "playnite", "games.db")));
}
[Test]
public void GetFullDbPathTest()
{
var appData = Environment.ExpandEnvironmentVariables("%AppData%");
var progPath = PlaynitePaths.ProgramPath;
Assert.AreEqual(Path.Combine(appData, @"playnite\games"), GameDatabase.GetFullDbPath(@"%AppData%\playnite\games"));
Assert.AreEqual(Path.Combine(progPath, "games"), GameDatabase.GetFullDbPath(@"{PlayniteDir}\games"));
Assert.AreEqual(@"c:\test\games", GameDatabase.GetFullDbPath(@"c:\test\games"));
Assert.AreEqual(@"games", GameDatabase.GetFullDbPath("games"));
}
[Test]
public void ListUpdateTest()
{
using (var temp = TempDirectory.Create())
{
var db = new GameDatabase(temp.TempPath);
db.OpenDatabase();
db.Games.Add(new Game()
{
GameId = "testid",
Name = "Test Game"
});
db.Games.Add(new Game()
{
GameId = "testid2",
Name = "Test Game 2"
});
Assert.AreEqual(2, db.Games.Count);
var games = db.Games.ToList();
games[1].Name = "Changed Name";
db.Games.Update(games[1]);
games = db.Games.ToList();
Assert.AreEqual("Changed Name", games[1].Name);
db.Games.Remove(games[1]);
Assert.AreEqual(1, db.Games.Count);
}
}
[Test]
public void DeleteGameImageCleanupTest()
{
using (var temp = TempDirectory.Create())
{
var db = new GameDatabase(temp.TempPath);
db.OpenDatabase();
var game = new Game("Test");
db.Games.Add(game);
game.Icon = db.AddFile(PlayniteTests.GenerateFakeFile(), game.Id);
game.BackgroundImage = db.AddFile(PlayniteTests.GenerateFakeFile(), game.Id);
game.CoverImage = db.AddFile(PlayniteTests.GenerateFakeFile(), game.Id);
Assert.IsNotEmpty(game.Icon);
Assert.IsNotEmpty(game.BackgroundImage);
Assert.IsNotEmpty(game.CoverImage);
var files = Directory.GetFiles(db.GetFileStoragePath(game.Id));
Assert.AreEqual(3, files.Count());
db.Games.Remove(game);
files = Directory.GetFiles(db.GetFileStoragePath(game.Id));
Assert.AreEqual(0, files.Count());
}
}
}
}
| 37.651376 | 140 | 0.552144 | [
"MIT"
] | ArashBaba/Playnite | source/PlayniteTests/Database/GameDatabaseTests.cs | 4,106 | C# |
using AltV.Net.Data;
using AltV.Net.NetworkingEntity;
using AltV.Net.NetworkingEntity.Elements.Entities;
using Entity;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace ResurrectionRP_Server.Entities
{
public class Entity
{
#region Private Fields
public INetworkingEntity NetworkEntity;
#endregion
#region Public Fields
public ulong ID
{
get
{
if (NetworkEntity != null && NetworkEntity.Exists)
return NetworkEntity.Id;
return 0;
}
}
public AltV.Net.Data.Position Position
{
get
{
if (NetworkEntity != null && NetworkEntity.Exists)
return new AltV.Net.Data.Position(NetworkEntity.Position.X, NetworkEntity.Position.Y, NetworkEntity.Position.Z);
return new AltV.Net.Data.Position();
}
set
{
if (NetworkEntity != null && NetworkEntity.Exists)
NetworkEntity.Position = value.ConvertToEntityPosition();
}
}
public int Dimension
{
get
{
if (NetworkEntity != null && NetworkEntity.Exists)
return NetworkEntity.Dimension;
return 0;
}
set
{
if (NetworkEntity != null && NetworkEntity.Exists)
NetworkEntity.Dimension = value;
}
}
public bool Exists
{
get
{
if (NetworkEntity != null && NetworkEntity.Exists)
return NetworkEntity.Exists;
return false;
}
}
#endregion
#region C4TOR
public Entity(AltV.Net.Data.Position position, int dimension)
{
datas = new ConcurrentDictionary<string, object>();
}
#endregion
#region Methods
public virtual async Task Destroy()
{
if (NetworkEntity != null && NetworkEntity.Exists)
await NetworkEntity.Remove();
}
public virtual Dictionary<string, object> Export()
{
return new Dictionary<string, object>();
}
#endregion
#region Datas
private ConcurrentDictionary<string, object> datas;
public bool SetData(string key, object data)
=> datas.TryAdd(key, data);
public object GetData(string key)
=> datas[key] ?? null;
#endregion
}
}
| 26.891089 | 132 | 0.522459 | [
"MIT"
] | PourrezJ/ResurrectionRP-Framework | ResurrectionRP_Server/Entities/Entity.cs | 2,718 | C# |
//using System;
//using System.Collections;
//using System.IO;
//using System.Runtime.Remoting;
//using System.Runtime.Remoting.Channels;
//using System.Runtime.Remoting.Messaging;
//using Zyan.Communication.Toolbox;
//TODO: Implement Null transport without .NET dependency.
//namespace Zyan.Communication.Protocols.Null
//{
// /// <summary>
// /// Client channel sink for the <see cref="NullChannel"/>.
// /// </summary>
// internal class NullClientChannelSink : IClientChannelSink, IMessageSink
// {
// /// <summary>
// /// Client channel sink provider for the <see cref="NullChannel"/>.
// /// </summary>
// public class Provider : IClientChannelSinkProvider
// {
// /// <summary>
// /// Creates the <see cref="NullClientChannelSink"/>.
// /// </summary>
// /// <param name="channel"><see cref="NullChannel"/> instance.</param>
// /// <param name="url">Object url.</param>
// /// <param name="remoteChannelData">Channel-specific data for the remote channel.</param>
// /// <returns><see cref="NullClientChannelSink"/> for the given url.</returns>
// public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
// {
// string objectUrl;
// string channelName = NullChannel.ParseUrl(url, out objectUrl);
// return new NullClientChannelSink(channelName);
// }
// /// <summary>
// /// Gets or sets the next <see cref="IClientChannelSinkProvider"/> in the chain.
// /// </summary>
// public IClientChannelSinkProvider Next { get; set; }
// }
// /// <summary>
// /// Ininitializes a new instance of the <see cref="NullChannel"/> class.
// /// </summary>
// /// <param name="channelName">Channel name.</param>
// public NullClientChannelSink(string channelName)
// {
// ChannelName = channelName;
// }
// private string ChannelName { get; set; }
// // =============== IClientChannelSink implementation ========================
// /// <summary>
// /// Request synchronous processing of a method call on the current sink.
// /// </summary>
// /// <param name="msg"><see cref="IMessage"/> to process.</param>
// /// <param name="requestHeaders">Request <see cref="ITransportHeaders"/>.</param>
// /// <param name="requestStream">Request <see cref="Stream"/>.</param>
// /// <param name="responseHeaders">Response <see cref="ITransportHeaders"/>.</param>
// /// <param name="responseStream">Response <see cref="Stream"/>.</param>
// public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream)
// {
// IMessage replyMsg;
// // process serialized message
// InternalProcessMessage(msg, requestHeaders, requestStream, out replyMsg, out responseHeaders, out responseStream);
// }
// /// <summary>
// /// Requests asynchronous processing of a method call on the current sink.
// /// </summary>
// /// <param name="sinkStack"><see cref="IClientChannelSinkStack"/> to process the request asynchronously.</param>
// /// <param name="msg"><see cref="IMessage"/> to process.</param>
// /// <param name="headers"><see cref="ITransportHeaders"/> for the message.</param>
// /// <param name="stream"><see cref="Stream"/> to serialize the message.</param>
// public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream)
// {
// // TODO
// throw new NotImplementedException();
// }
// /// <summary>
// /// Requests asynchronous processing of a response to a method call on the current sink.
// /// </summary>
// /// <param name="sinkStack"><see cref="IClientResponseChannelSinkStack"/> to process the response.</param>
// /// <param name="state">State object.</param>
// /// <param name="headers"><see cref="ITransportHeaders"/> of the response message.</param>
// /// <param name="stream"><see cref="Stream"/> with the serialized response message.</param>
// public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, Stream stream)
// {
// // we're the last sink in the chain, so we don't have to implement this
// throw new NotImplementedException();
// }
// /// <summary>
// /// Returns the <see cref="Stream"/> onto which the provided message is to be serialized.
// /// </summary>
// /// <param name="msg"><see cref="IMessage"/> to be serialized.</param>
// /// <param name="headers"><see cref="ITransportHeaders"/> for the message.</param>
// /// <returns>Request <see cref="Stream"/>.</returns>
// public Stream GetRequestStream(IMessage msg, ITransportHeaders headers)
// {
// // we don't need this
// return null;
// }
// /// <summary>
// /// Gets the next client channel sink in the client sink chain.
// /// </summary>
// public IClientChannelSink NextChannelSink
// {
// // we're the last sink in the chain
// get { return null; }
// }
// /// <summary>
// /// Gets a dictionary through which properties on the sink can be accessed.
// /// </summary>
// public IDictionary Properties
// {
// // we don't have any properties
// get { return null; }
// }
// // =============== IMessageSink implementation ========================
// /// <summary>
// /// Asynchronously processes the given message.
// /// </summary>
// /// <param name="msg">The message to process. </param>
// /// <param name="replySink">The reply sink for the reply message.</param>
// /// <returns>Returns an <see cref="IMessageCtrl"/> interface that provides a way to control asynchronous messages after they have been dispatched.</returns>
// public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
// {
// // TODO
// throw new NotImplementedException();
// }
// /// <summary>
// /// Gets the next message sink in the sink chain.
// /// </summary>
// public IMessageSink NextSink
// {
// // we're the last sink in the chain
// get { return null; }
// }
// /// <summary>
// /// Synchronously processes the given message.
// /// </summary>
// /// <param name="msg">The message to process. </param>
// /// <returns>Response message.</returns>
// public IMessage SyncProcessMessage(IMessage msg)
// {
// IMessage replyMsg;
// ITransportHeaders requestHeaders = new TransportHeaders();
// ITransportHeaders responseHeaders;
// Stream responseStream;
// // process non-serialized message
// InternalProcessMessage(msg, requestHeaders, null, out replyMsg, out responseHeaders, out responseStream);
// return replyMsg;
// }
// /// <summary>
// /// Processes the given method call message synchronously.
// /// </summary>
// private void InternalProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage replyMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
// {
// // add message Uri to the transport headers
// var mcm = (IMethodCallMessage)msg;
// requestHeaders[CommonTransportKeys.RequestUri] = mcm.Uri;
// requestHeaders["__CustomErrorsEnabled"] = CustomErrorsEnabled.Value;
// // create the request message
// var requestMessage = new NullMessages.RequestMessage
// {
// Message = msg,
// RequestHeaders = requestHeaders,
// RequestStream = requestStream
// };
// // process the request and receive the response message
// var responseMessage = NullMessages.ProcessRequest(ChannelName, requestMessage);
// // return processed message parts
// responseHeaders = responseMessage.ResponseHeaders;
// responseStream = responseMessage.ResponseStream;
// replyMsg = responseMessage.Message;
// }
// private Lazy<bool> CustomErrorsEnabled = new Lazy<bool>(() =>
// {
// if (MonoCheck.IsRunningOnMono)
// return false;
// return RemotingConfiguration.CustomErrorsMode == CustomErrorsModes.On;
// });
// }
//}
| 45.387255 | 205 | 0.571768 | [
"MIT"
] | ErrCode/Zyan.Core.LocalIPC | branches/withoutremoting/Zyan.Communication/Protocols/Null/NullClientChannelSink.cs | 9,261 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Search")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Search")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1ff244a9-c302-4073-8c87-fcf122f5ba4a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 37.297297 | 84 | 0.745652 | [
"MIT"
] | constantimi/Object-Oriented-Programming | csharp/2020-03-24-csharp-regular-expressions/Search/Properties/AssemblyInfo.cs | 1,383 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using VerifyTests;
static class ApplyScrubbers
{
static HashSet<string> currentDirectoryReplacements = new();
static string tempPath;
static string altTempPath;
static ApplyScrubbers()
{
var baseDirectory = CleanPath(AppDomain.CurrentDomain.BaseDirectory);
var altBaseDirectory = baseDirectory.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
currentDirectoryReplacements.Add(baseDirectory);
currentDirectoryReplacements.Add(altBaseDirectory);
var currentDirectory = CleanPath(Environment.CurrentDirectory);
var altCurrentDirectory = currentDirectory.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
currentDirectoryReplacements.Add(currentDirectory);
currentDirectoryReplacements.Add(altCurrentDirectory);
#if !NET5_0
if (CodeBaseLocation.CurrentDirectory != null)
{
var codeBaseLocation = CleanPath(CodeBaseLocation.CurrentDirectory);
var altCodeBaseLocation = codeBaseLocation.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
currentDirectoryReplacements.Add(codeBaseLocation);
currentDirectoryReplacements.Add(altCodeBaseLocation);
}
#endif
tempPath = CleanPath(Path.GetTempPath());
altTempPath = tempPath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
}
public static void Apply(string extension, StringBuilder target, VerifySettings settings)
{
foreach (var replace in currentDirectoryReplacements)
{
target.Replace(replace, "{CurrentDirectory}");
}
target.Replace(tempPath, "{TempPath}");
target.Replace(altTempPath, "{TempPath}");
foreach (var scrubber in settings.instanceScrubbers)
{
scrubber(target);
}
if (settings.extensionMappedInstanceScrubbers.TryGetValue(extension, out var extensionBasedInstanceScrubbers))
{
foreach (var scrubber in extensionBasedInstanceScrubbers)
{
scrubber(target);
}
}
if (VerifierSettings.ExtensionMappedGlobalScrubbers.TryGetValue(extension, out var extensionBasedScrubbers))
{
foreach (var scrubber in extensionBasedScrubbers)
{
scrubber(target);
}
}
foreach (var scrubber in VerifierSettings.GlobalScrubbers)
{
scrubber(target);
}
if (VerifierSettings.ExtensionMappedGlobalScrubbers.TryGetValue(extension, out extensionBasedScrubbers))
{
foreach (var scrubber in extensionBasedScrubbers)
{
scrubber(target);
}
}
target.FixNewlines();
}
static string CleanPath(string directory)
{
return directory.TrimEnd('/', '\\');
}
} | 35.632184 | 125 | 0.654516 | [
"MIT"
] | elnigno/Verify | src/Verify/Serialization/Scrubbers/ApplyScrubbers.cs | 3,016 | C# |
using System;
using DragonSpark.Sources.Parameterized;
namespace DragonSpark.Aspects.Validation
{
sealed class AutoValidationControllerFactory : ParameterizedSourceBase<IAutoValidationController>
{
public static IParameterizedSource<IAutoValidationController> Default { get; } = new AutoValidationControllerFactory().ToCache();
AutoValidationControllerFactory() : this( AdapterLocator.Default.Get, AspectHub.Default.Set ) {}
readonly Func<object, IParameterValidationAdapter> adapterSource;
readonly Action<object, IAspectHub> set;
AutoValidationControllerFactory( Func<object, IParameterValidationAdapter> adapterSource, Action<object, IAspectHub> set )
{
this.adapterSource = adapterSource;
this.set = set;
}
public override IAutoValidationController Get( object parameter )
{
var adapter = adapterSource( parameter );
var result = new AutoValidationController( adapter );
set( parameter, result );
return result;
}
}
} | 34.535714 | 131 | 0.784902 | [
"MIT"
] | DragonSpark/VoteReporter | Framework/DragonSpark/Aspects/Validation/AutoValidationControllerFactory.cs | 969 | C# |
/*
VDS.Common is licensed under the MIT License
Copyright (c) 2012-2015 Robert Vesse
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Linq;
using NUnit.Framework;
namespace VDS.Common.Trees
{
[TestFixture,Category("Trees")]
public class BinaryTreeDeleteTests
{
#region Tree Preparation
private void PrepareTree1(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with just a root
//
// (1)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 1, 1);
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int,int>, int>(tree);
}
private void PrepareTree2(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and a left child
//
// (2)
// /
// (1)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 1, 1);
root.LeftChild = leftChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree3(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and a left child
//
// (2)
// /
// (1)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 2, 2);
root.RightChild = rightChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree4(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and two children
//
// (2)
// / \
// (1) (3)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 3, 3);
root.LeftChild = leftChild;
root.RightChild = rightChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree5(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and two left children
//
// (3)
// /
// (2)
// /
//(1)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 3, 3);
BinaryTreeNode<int, int> leftInnerChild = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> leftLeafChild = new BinaryTreeNode<int, int>(null, 1, 1);
leftInnerChild.LeftChild = leftLeafChild;
root.LeftChild = leftInnerChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree6(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and a left child which has a right child
//
// (3)
// /
// (1)
// \
// (2)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 3, 3);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 2, 2);
leftChild.RightChild = rightChild;
root.LeftChild = leftChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree7(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and a right child which has a right child
//
// (1)
// \
// (2)
// \
// (3)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightInnerChild = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> rightLeafChild = new BinaryTreeNode<int, int>(null, 3, 3);
rightInnerChild.RightChild = rightLeafChild;
root.RightChild = rightInnerChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree8(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and a right child which has a left child
//
// (1)
// \
// (3)
// /
// (2)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 3, 3);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 2, 2);
rightChild.LeftChild = leftChild;
root.RightChild = rightChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree9(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and two children, left child has a left child
//
// (3)
// / \
// (2) (4)
// /
//(1)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 3, 3);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> leftLeafChild = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 4, 4);
leftChild.LeftChild = leftLeafChild;
root.LeftChild = leftChild;
root.RightChild = rightChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
private void PrepareTree10(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
//Tree with a root and two children, left child has a right child
//
// (3)
// / \
// (1) (4)
// \
// (2)
BinaryTreeNode<int, int> root = new BinaryTreeNode<int, int>(null, 3, 3);
BinaryTreeNode<int, int> leftChild = new BinaryTreeNode<int, int>(null, 1, 1);
BinaryTreeNode<int, int> rightLeafChild = new BinaryTreeNode<int, int>(null, 2, 2);
BinaryTreeNode<int, int> rightChild = new BinaryTreeNode<int, int>(null, 4, 4);
leftChild.RightChild = rightLeafChild;
root.LeftChild = leftChild;
root.RightChild = rightChild;
tree.Root = root;
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
}
#endregion
#region Tree Test Methods
private void TestTree1(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree1(tree);
//Remove Root
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int,int>, int>(tree);
//Should lead to empty tree
Assert.AreEqual(0, tree.Nodes.Count());
Assert.IsNull(tree.Root);
}
private void TestTree2a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree2(tree);
//Remove Root
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should lead to Left Child as Root
Assert.AreEqual(1, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNull(tree.Root.LeftChild);
}
private void TestTree2b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree2(tree);
//Remove Left Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should just leave Root
Assert.AreEqual(1, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNull(tree.Root.LeftChild);
}
private void TestTree3a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree3(tree);
//Remove Root
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should lead to Right Child as Root
Assert.AreEqual(1, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNull(tree.Root.RightChild);
}
private void TestTree3b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree3(tree);
//Remove Right Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should just leave Root
Assert.AreEqual(1, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNull(tree.Root.RightChild);
}
private void TestTree4a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree4(tree);
//Remove Root
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should lead to Left Child to Root with Right Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree4b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree4(tree);
//Remove Left Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Right Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree4c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree4(tree);
//Remove Right Child
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Left Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
}
private void TestTree5a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree5(tree);
//Remove Root
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Left Child to Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
}
private void TestTree5b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree5(tree);
//Remove Left Inner Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Leaf as Left Child of Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
}
private void TestTree5c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree5(tree);
//Remove Left Leaf Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Left Inner Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(2, tree.Root.LeftChild.Value);
}
private void TestTree6a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree6(tree);
//Remove Root
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should move right child of Left child to Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
}
private void TestTree6b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree6(tree);
//Remove Left Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should move right child of left child to left child
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(2, tree.Root.LeftChild.Value);
}
private void TestTree6c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree6(tree);
//Remove Right Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Left Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
}
private void TestTree7a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree7(tree);
//Remove Root
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should move Right Child to Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree7b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree7(tree);
//Remove Right Inner Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Leaf as Right Child of Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree7c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree7(tree);
//Remove Right Leaf Child
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Left Inner Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(2, tree.Root.RightChild.Value);
}
private void TestTree8a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree8(tree);
//Remove Root
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should move left child of right child to Root
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree8b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree8(tree);
//Remove Right Child
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should move left child of right child to right child
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(2, tree.Root.RightChild.Value);
}
private void TestTree8c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree8(tree);
//Remove Left Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Right Child as-is
Assert.AreEqual(2, tree.Nodes.Count());
Assert.AreEqual(1, tree.Root.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(3, tree.Root.RightChild.Value);
}
private void TestTree9a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree9(tree);
//Remove Root
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should lead to Left Child to Root with Right Child as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree9b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree9(tree);
//Remove Left Inner Child
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Right Child as-is, Left Leaf child should move up
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree9c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree9(tree);
//Remove Left Leaf Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and immediate children as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(2, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree9d(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree9(tree);
//Remove Right Child
tree.Remove(4);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and left sub-tree as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(2, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.LeftChild.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.LeftChild.Value);
}
private void TestTree10a(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree10(tree);
//Remove Root
tree.Remove(3);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should lead to Rightmost Child of Left subtree to Root with Right Child as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(2, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree10b(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree10(tree);
//Remove Left Inner Child
tree.Remove(1);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and Right Child as-is, Right Leaf of left subtree should move up
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(2, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree10c(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree10(tree);
//Remove Right Left of left subtree should leave root and immediate children as=is
tree.Remove(2);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and immediate children as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.RightChild);
Assert.AreEqual(4, tree.Root.RightChild.Value);
}
private void TestTree10d(ITree<IBinaryTreeNode<int, int>, int, int> tree)
{
this.PrepareTree10(tree);
//Remove Right Child
tree.Remove(4);
BinaryTreeTools.PrintBinaryTreeStructs<IBinaryTreeNode<int, int>, int>(tree);
//Should leave Root and left sub-tree as-is
Assert.AreEqual(3, tree.Nodes.Count());
Assert.AreEqual(3, tree.Root.Value);
Assert.IsNotNull(tree.Root.LeftChild);
Assert.AreEqual(1, tree.Root.LeftChild.Value);
Assert.IsNotNull(tree.Root.LeftChild.RightChild);
Assert.AreEqual(2, tree.Root.LeftChild.RightChild.Value);
}
#endregion
[Test]
public void BinaryTreeAVLDeleteValidation1()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree1(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation1()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree1(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation1()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree1(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation2a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree2a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation2b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree2b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation2a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree2a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation2b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree2b(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation2a()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree2a(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation2b()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree2b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation3a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree3a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation3b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree3b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation3a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree3a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation3b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree3b(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation3a()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree3a(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation3b()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree3b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation4a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree4a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation4b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree4b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation4c()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree4c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation4a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree4a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation4b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree4b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation4c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree4c(tree);
}
//Tree 7 tests are not run for Scapegoat Tree because they trigger a rebalance which
//means the tree will not be as we expect
//NB - Tree 4c, 5 and 6 tests also trigger the rebalance but they always leave the tree in the state
//we expect so they can be safely run
[Test]
public void BinaryTreeScapegoatDeleteValidation4c()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree4c(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation5a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree5a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation5b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree5b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation5c()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree5c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation5a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree5a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation5b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree5b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation5c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree5c(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation5a()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree5a(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation5b()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree5b(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation5c()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree5c(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation6a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree6a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation6b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree6b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation6c()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree6c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation6a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree6a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation6b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree6b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation6c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree6c(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation6a()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree6a(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation6b()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree6b(tree);
}
[Test]
public void BinaryTreeScapegoatDeleteValidation6c()
{
ScapegoatTree<int, int> tree = new ScapegoatTree<int, int>();
this.TestTree6c(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation7a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree7a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation7b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree7b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation7c()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree7c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation7a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree7a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation7b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree7b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation7c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree7c(tree);
}
//Tree 7 tests are not run for Scapegoat Tree because they trigger a rebalance which
//means the tree will not be as we expect
//NB - Tree 4c, 5 and 6 tests also trigger the rebalance but they always leave the tree in the state
//we expect so they can be safely run
[Test]
public void BinaryTreeAVLDeleteValidation8a()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree8a(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation8b()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree8b(tree);
}
[Test]
public void BinaryTreeAVLDeleteValidation8c()
{
AVLTree<int, int> tree = new AVLTree<int, int>();
this.TestTree8c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation8a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree8a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation8b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree8b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation8c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree8c(tree);
}
//Tree 8 tests are not run for Scapegoat Tree because they trigger a rebalance which
//means the tree will not be as we expect
//NB - Tree 4c, 5 and 6 tests also trigger the rebalance but they always leave the tree in the state
//we expect so they can be safely run
[Test]
public void BinaryTreeUnbalancedDeleteValidation9a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree9a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation9b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree9b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation9c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree9c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation9d()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree9d(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation10a()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree10a(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation10b()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree10b(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation10c()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree10c(tree);
}
[Test]
public void BinaryTreeUnbalancedDeleteValidation10d()
{
UnbalancedBinaryTree<int, int> tree = new UnbalancedBinaryTree<int, int>();
this.TestTree10d(tree);
}
}
}
| 36.090826 | 109 | 0.561529 | [
"MIT"
] | Piskopatmusa/vds-common | test/Trees/BinaryTreeDeleteTests.cs | 39,339 | C# |
using System.Web.Mvc;
namespace RockPaperScissors.Web
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
| 19.692308 | 80 | 0.65625 | [
"Apache-2.0"
] | jasondentler/RockPaperScissors | app/RockPaperScissors.Web/App_Start/FilterConfig.cs | 258 | C# |
// ----------------------------------------------------------------------
// <copyright file="LocalTableStructureOptionsBuilder.cs" company="Xavier Solau">
// Copyright © 2021 Xavier Solau.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
// </copyright>
// ----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using SoloX.TableModel.Options.Impl;
namespace SoloX.TableModel.Options.Builder.Impl
{
/// <summary>
/// Local table structure options builder implementation.
/// </summary>
/// <typeparam name="TData">Table data type.</typeparam>
/// <typeparam name="TId">Table Id type.</typeparam>
public class LocalTableStructureOptionsBuilder<TData, TId> : ATableStructureOptionsBuilder, ILocalTableStructureOptionsBuilder<TData, TId>
{
private readonly Action<ILocalTableStructureOptions<TData, TId>> tableStructureOptionsSetup;
private readonly List<ATableDecoratorOptions> tableDecoratorOptions = new List<ATableDecoratorOptions>();
/// <summary>
/// Get the Table Structure Id.
/// </summary>
public string TableStructureId { get; }
/// <summary>
/// Get the associated Decorator options.
/// </summary>
public IEnumerable<ATableDecoratorOptions> TableDecoratorOptions => this.tableDecoratorOptions;
/// <summary>
/// Setup Local table structure options builder with Id and setup delegate.
/// </summary>
/// <param name="tableStructureId">The table structure Id.</param>
/// <param name="tableStructureOptionsSetup">The setup delegate.</param>
public LocalTableStructureOptionsBuilder(string tableStructureId, Action<ILocalTableStructureOptions<TData, TId>> tableStructureOptionsSetup)
{
TableStructureId = tableStructureId;
this.tableStructureOptionsSetup = tableStructureOptionsSetup;
}
/// <inheritdoc/>
public override ATableStructureOptions Build()
{
var opt = new LocalTableStructureOptions<TData, TId>(TableStructureId, this.tableDecoratorOptions);
this.tableStructureOptionsSetup(opt);
return opt;
}
/// <inheritdoc/>
public ILocalTableStructureOptionsBuilder<TData, TId> WithDecorator<TDecorator>(string decoratorId, Action<ILocalTableDecoratorOptions<TData, TDecorator>> tableDecoratorOptionsSetup)
{
if (tableDecoratorOptionsSetup == null)
{
throw new ArgumentNullException(nameof(tableDecoratorOptionsSetup));
}
var decoratorOptions = new LocalTableDecoratorOptions<TData, TId, TDecorator>(TableStructureId, decoratorId);
tableDecoratorOptionsSetup(decoratorOptions);
this.tableDecoratorOptions.Add(decoratorOptions);
return this;
}
}
}
| 39.866667 | 190 | 0.652174 | [
"MIT"
] | xaviersolau/TableModel | src/libs/SoloX.TableModel/Options/Builder/Impl/LocalTableStructureOptionsBuilder.cs | 2,993 | C# |
using Micky5991.Samp.Net.Framework.Elements.TextDraws;
namespace Micky5991.Samp.Net.Framework.Constants
{
/// <summary>
/// Defines useful constants for screen related calculations.
/// </summary>
public class ScreenConstants
{
/// <summary>
/// Maximum screen width used for UI elements e.g. <see cref="TextDraw"/>.
/// </summary>
public const int MaxWidth = 640;
/// <summary>
/// Maximum screen height used for UI elements e.g. <see cref="TextDraw"/>.
/// </summary>
public const int MaxHeight = 480;
}
}
| 28.47619 | 83 | 0.608696 | [
"MIT"
] | Micky5991/samp-dotnet | src/dotnet/Micky5991.Samp.Net.Framework/Constants/ScreenConstants.cs | 598 | C# |
// 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 Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Etlx;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Tracing.Tests.Common;
namespace Microsoft.Diagnostics.Tools.RuntimeClient.Tests
{
class Program
{
static int Main(string[] args)
{
SendSmallerHeaderCommand();
SendInvalidDiagnosticsMessageTypeCommand();
SendInvalidInputData();
TestCollectEventPipeTracing();
return 100;
}
private static Process ThisProcess { get; } = Process.GetCurrentProcess();
private static void SendSmallerHeaderCommand()
{
Console.WriteLine("Send a small payload as header.");
ulong sessionId = 0;
try
{
byte[] bytes;
using (var stream = new MemoryStream())
{
using (var bw = new BinaryWriter(stream))
{
bw.Write((uint)DiagnosticsMessageType.StartEventPipeTracing);
bw.Flush();
stream.Position = 0;
bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
}
}
sessionId = EventPipeClient.SendCommand(ThisProcess.Id, bytes);
}
catch (EndOfStreamException)
{
Assert.Equal("EventPipe Session Id", sessionId, (ulong)0);
}
catch
{
Assert.True("Send command threw unexpected exception", false);
}
}
private static void SendInvalidDiagnosticsMessageTypeCommand()
{
Console.WriteLine("Send a wrong message type as the diagnostic header header.");
ulong sessionId = 0;
try
{
byte[] bytes;
using (var stream = new MemoryStream())
{
using (var bw = new BinaryWriter(stream))
{
bw.Write(uint.MaxValue);
bw.Write(ThisProcess.Id);
bw.Flush();
stream.Position = 0;
bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
}
}
sessionId = EventPipeClient.SendCommand(ThisProcess.Id, bytes);
}
catch (EndOfStreamException)
{
Assert.Equal("EventPipe Session Id", sessionId, (ulong)0);
}
catch
{
Assert.True("Send command threw unexpected exception", false);
}
}
private static byte[] Serialize(MessageHeader header, TestSessionConfiguration configuration, Stream stream)
{
using (var bw = new BinaryWriter(stream))
{
bw.Write((uint)header.RequestType);
bw.Write(header.Pid);
bw.Write(configuration.CircularBufferSizeInMB);
bw.WriteString(null);
if (configuration.Providers == null)
{
bw.Write(0);
}
else
{
bw.Write(configuration.Providers.Count());
foreach (var provider in configuration.Providers)
{
bw.Write(provider.Keywords);
bw.Write((uint)provider.EventLevel);
bw.WriteString(provider.Name);
bw.WriteString(provider.FilterData);
}
}
bw.Flush();
stream.Position = 0;
var bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
return bytes;
}
}
private static void SendInvalidInputData()
{
var configs = new TestSessionConfiguration[] {
new TestSessionConfiguration {
CircularBufferSizeInMB = 0,
TestName = "0 size circular buffer",
Providers = new TestProvider[] {
new TestProvider{
Name = "Microsoft-Windows-DotNETRuntime"
},
},
},
new TestSessionConfiguration {
CircularBufferSizeInMB = 64,
TestName = "null providers",
Providers = null,
},
new TestSessionConfiguration {
CircularBufferSizeInMB = 64,
TestName = "no providers",
Providers = new TestProvider[]{ },
},
new TestSessionConfiguration {
CircularBufferSizeInMB = 64,
TestName = "null provider name",
Providers = new TestProvider[]{ new TestProvider { Name = null, }, },
},
new TestSessionConfiguration {
CircularBufferSizeInMB = 64,
TestName = "empty provider name",
Providers = new TestProvider[]{ new TestProvider { Name = string.Empty, }, },
},
new TestSessionConfiguration {
CircularBufferSizeInMB = 64,
TestName = "white space provider name",
Providers = new TestProvider[]{ new TestProvider { Name = " ", }, },
},
};
foreach (var config in configs)
{
ulong sessionId = 0;
try
{
var header = new MessageHeader {
RequestType = DiagnosticsMessageType.CollectEventPipeTracing,
Pid = (uint)Process.GetCurrentProcess().Id,
};
byte[] bytes;
using (var stream = new MemoryStream())
bytes = Serialize(header, config, stream);
Console.WriteLine($"Test: {config.TestName}");
sessionId = EventPipeClient.SendCommand(ThisProcess.Id, bytes);
// Check that a session was created.
Assert.Equal("EventPipe Session Id", sessionId, (ulong)0);
}
catch (EndOfStreamException)
{
Assert.Equal("EventPipe Session Id", sessionId, (ulong)0);
}
catch
{
Assert.True("Send command threw unexpected exception", false);
}
}
}
private static void SendInvalidPayloadToCollectCommand()
{
Console.WriteLine("Send Invalid Payload To Collect Command.");
ulong sessionId = 0;
try
{
uint circularBufferSizeMB = 64;
var filePath = Path.Combine(
Directory.GetCurrentDirectory(),
$"dotnetcore-eventpipe-{ThisProcess.Id}.nettrace");
var providers = new[] {
new Provider(name: "Microsoft-Windows-DotNETRuntime"),
};
var configuration = new SessionConfiguration(circularBufferSizeMB, filePath, providers);
// Start session #1.
sessionId = EventPipeClient.StartTracingToFile(
processId: ThisProcess.Id,
configuration: configuration);
// Check that a session was created.
Assert.Equal("EventPipe Session Id", sessionId, (ulong)0);
}
finally
{
if (sessionId != 0)
EventPipeClient.StopTracing(ThisProcess.Id, sessionId);
}
}
private static void TestCollectEventPipeTracing()
{
ulong sessionId = 0;
try
{
uint circularBufferSizeMB = 64;
var filePath = Path.Combine(
Directory.GetCurrentDirectory(),
$"dotnetcore-eventpipe-{ThisProcess.Id}.nettrace");
var providers = new[] {
new Provider(name: "Microsoft-Windows-DotNETRuntime"),
};
var configuration = new SessionConfiguration(circularBufferSizeMB, filePath, providers);
Console.WriteLine("Start collecting.");
using (Stream stream = EventPipeClient.CollectTracing(
processId: ThisProcess.Id,
configuration: configuration,
sessionId: out sessionId))
{
// Check that a session was created.
Assert.NotEqual("EventPipe Session Id", sessionId, (ulong)0);
var collectingTask = new Task(() => {
using (var fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
while (true)
{
var buffer = new byte[16 * 1024];
int nBytesRead = stream.Read(buffer, 0, buffer.Length);
if (nBytesRead <= 0)
break;
fs.Write(buffer, 0, nBytesRead);
}
}
});
collectingTask.Start();
{ // Attempt to create another session, and verify that is not possible.
Console.WriteLine("Attempt to create another session.");
ulong sessionId2 = 0;
try
{
using (var stream2 = EventPipeClient.CollectTracing(
processId: ThisProcess.Id,
configuration: configuration,
sessionId: out sessionId2))
{
var buffer = new byte[16 * 1024];
int nBytesRead = stream.Read(buffer, 0, buffer.Length);
}
}
catch (EndOfStreamException)
{
}
catch
{
Assert.True("EventPipeClient.CollectTracing threw unexpected exception", false);
}
Assert.Equal("EventPipe Session Id", sessionId2, (ulong)0);
}
Console.WriteLine("Doing some work.");
Workload.DoWork(10);
var ret = EventPipeClient.StopTracing(ThisProcess.Id, sessionId);
Assert.Equal("Expect return value to be the disabled session Id", sessionId, ret);
collectingTask.Wait();
sessionId = 0; // Reset session Id, we do not need to disable it later.
Assert.Equal("EventPipe output file", File.Exists(filePath), true);
// Check file is valid.
Console.WriteLine("Validating nettrace file.");
ValidateNetTrace(filePath);
}
}
finally
{
if (sessionId != 0)
EventPipeClient.StopTracing(ThisProcess.Id, sessionId);
}
}
private static void ValidateNetTrace(string filePath)
{
var nEventPipeResults = 0;
using (var trace = new TraceLog(TraceLog.CreateFromEventPipeDataFile(filePath)).Events.GetSource())
{
trace.Dynamic.All += (TraceEvent data) => {
++nEventPipeResults;
};
trace.Process();
}
// Assert there were events in the file.
Assert.NotEqual("Found events in trace file", nEventPipeResults, 0);
}
[Conditional("DEBUG")]
private static void DumpNetTrace(string filePath)
{
using (var trace = new TraceLog(TraceLog.CreateFromEventPipeDataFile(filePath)).Events.GetSource())
{
trace.Dynamic.All += (TraceEvent e) => {
if (!string.IsNullOrWhiteSpace(e.ProviderName) && !string.IsNullOrWhiteSpace(e.EventName))
{
Debug.WriteLine($"Event Provider: {e.ProviderName}");
Debug.WriteLine($" Event Name: {e.EventName}");
}
};
trace.Process();
}
}
}
}
| 37.097222 | 116 | 0.46739 | [
"MIT"
] | Sean-Driscoll/diagnostics | src/tests/Microsoft.Diagnostics.Tools.RuntimeClient/Program.cs | 13,357 | C# |
using Dapper;
using Microsoft.Extensions.Logging;
using System.Data.Common;
using System.Threading.Tasks;
using YesSql.Collections;
namespace YesSql.Commands
{
public sealed class DeleteDocumentCommand : DocumentCommand
{
private readonly string _tablePrefix;
public override int ExecutionOrder { get; } = 4;
public DeleteDocumentCommand(Document document, string tablePrefix) : base(document)
{
_tablePrefix = tablePrefix;
}
public override Task ExecuteAsync(DbConnection connection, DbTransaction transaction, ISqlDialect dialect, ILogger logger)
{
var documentTable = CollectionHelper.Current.GetPrefixedName(Store.DocumentTable);
var deleteCmd = "delete from " + dialect.QuoteForTableName(_tablePrefix + documentTable) + " where " + dialect.QuoteForColumnName("Id") + " = @Id;";
logger.LogTrace(deleteCmd);
return connection.ExecuteAsync(deleteCmd, Document, transaction);
}
}
}
| 36.5 | 160 | 0.696673 | [
"MIT"
] | ThisNetWorks/yessql | src/YesSql.Core/Commands/DeleteDocumentCommand.cs | 1,022 | C# |
// -------------------------------------------------------------------------
// Copyright © 2019 Province of British Columbia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// -------------------------------------------------------------------------
namespace HealthGateway.Admin.Services
{
using HealthGateway.Admin.Models.Support;
using HealthGateway.Common.Models;
using HealthGateway.Common.Models.CDogs;
/// <summary>
/// Service that provides Covid Support functionality.
/// </summary>
public interface ICovidSupportService
{
/// <summary>
/// Gets the patient and immunization information.
/// </summary>
/// <param name="phn">The personal health number that matches the person to retrieve.</param>
/// <returns>The covid ionformation wrapped in a RequestResult.</returns>
RequestResult<CovidInformation> GetCovidInformation(string phn);
/// <summary>
/// Gets all the emails in the system up to the pageSize.
/// </summary>
/// <param name="request">The request information to retrieve patient information.</param>
/// <returns>A RequestResult with True if the request was sucessfull.</returns>
PrimitiveRequestResult<bool> MailDocument(MailDocumentRequest request);
/// <summary>
/// Gets all the emails in the system up to the pageSize.
/// </summary>
/// <param name="phn">The personal health number that matches the person to retrieve.</param>
/// <returns>The encoded document.</returns>
RequestResult<ReportModel> RetrieveDocument(string phn);
}
} | 45.0625 | 101 | 0.63754 | [
"Apache-2.0"
] | WadeBarnes/healthgateway | Apps/AdminWebClient/src/Server/Services/ICovidSupportService.cs | 2,166 | C# |
using GamepadSemester.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// Документацию по шаблону элемента "Основная страница" см. по адресу http://go.microsoft.com/fwlink/?LinkID=390556
namespace GamepadSemester
{
/// <summary>
/// Пустая страница, которую можно использовать саму по себе или для перехода внутри фрейма.
/// </summary>
public sealed partial class SettingsPage : Page
{
private NavigationHelper navigationHelper;
private ObservableDictionary defaultViewModel = new ObservableDictionary();
public SettingsPage()
{
this.InitializeComponent();
this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
}
/// <summary>
/// Получает объект <see cref="NavigationHelper"/>, связанный с данным объектом <see cref="Page"/>.
/// </summary>
public NavigationHelper NavigationHelper
{
get { return this.navigationHelper; }
}
/// <summary>
/// Получает модель представлений для данного объекта <see cref="Page"/>.
/// Эту настройку можно изменить на модель строго типизированных представлений.
/// </summary>
public ObservableDictionary DefaultViewModel
{
get { return this.defaultViewModel; }
}
/// <summary>
/// Заполняет страницу содержимым, передаваемым в процессе навигации. Также предоставляется любое сохраненное состояние
/// при повторном создании страницы из предыдущего сеанса.
/// </summary>
/// <param name="sender">
/// Источник события; как правило, <see cref="NavigationHelper"/>
/// </param>
/// <param name="e">Данные события, предоставляющие параметр навигации, который передается
/// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы и
/// словарь состояний, сохраненных этой страницей в ходе предыдущего
/// сеанса. Это состояние будет равно NULL при первом посещении страницы.</param>
private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
{
}
/// <summary>
/// Сохраняет состояние, связанное с данной страницей, в случае приостановки приложения или
/// удаления страницы из кэша навигации. Значения должны соответствовать требованиям сериализации
/// <see cref="SuspensionManager.SessionState"/>.
/// </summary>
/// <param name="sender">Источник события; как правило, <see cref="NavigationHelper"/></param>
/// <param name="e">Данные события, которые предоставляют пустой словарь для заполнения
/// сериализуемым состоянием.</param>
private void NavigationHelper_SaveState(object sender, SaveStateEventArgs e)
{
}
#region Регистрация NavigationHelper
/// <summary>
/// Методы, предоставленные в этом разделе, используются исключительно для того, чтобы
/// NavigationHelper для отклика на методы навигации страницы.
/// <para>
/// Логика страницы должна быть размещена в обработчиках событий для
/// <see cref="NavigationHelper.LoadState"/>
/// и <see cref="NavigationHelper.SaveState"/>.
/// Параметр навигации доступен в методе LoadState
/// в дополнение к состоянию страницы, сохраненному в ходе предыдущего сеанса.
/// </para>
/// </summary>
/// <param name="e">Предоставляет данные для методов навигации и обработчики
/// событий, которые не могут отменить запрос навигации.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.navigationHelper.OnNavigatedTo(e);
string currentlyUsedIPAddress = "";
string currentlyUsedPort = "";
Mediator.getCurrentlyUsedIPAddressAndPort(out currentlyUsedIPAddress, out currentlyUsedPort);
IPAddressBox.Text = currentlyUsedIPAddress;
PortBox.Text = currentlyUsedPort;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
this.navigationHelper.OnNavigatedFrom(e);
}
#endregion
private void TurnPage(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(GamepadPage));
}
private void ChangeButtonsAmount(object sender, TextChangedEventArgs e)
{
TextBox box = (TextBox)sender;
Mediator.ButtonsAmountHasChanged(box.Text);
}
private void ConnectionButtonClick(object sender, RoutedEventArgs e)
{
StatusBox.Text = Mediator.SetConnection(IPAddressBox.Text, PortBox.Text);
}
}
}
| 39.279412 | 128 | 0.665855 | [
"Apache-2.0"
] | GudoshnikovaAnna/qreal | plugins/appFamily/Joystick/SettingsPage.xaml.cs | 6,631 | C# |
namespace OpenTibiaUnity.Core.Store
{
public class StoreOpenParameters
{
StoreOpenParameterAction _openAction;
OpenParameters.IStoreOpenParamater _openParamater = default;
public StoreOpenParameterAction OpenAction { get => _openAction; }
public OpenParameters.IStoreOpenParamater OpenParamater { get => _openParamater; }
public StoreOpenParameters(StoreOpenParameterAction openAction, OpenParameters.IStoreOpenParamater openParam) {
_openAction = openAction;
_openParamater = openParam;
}
public void WriteTo(Communication.Internal.CommunicationStream message) {
message.WriteEnum(_openAction);
if (_openParamater != null)
_openParamater.WriteTo(message);
// unknown bytes (but are likely to be enums)
message.WriteUnsignedByte(0);
message.WriteUnsignedByte(0);
}
}
}
| 35.185185 | 119 | 0.674737 | [
"MIT"
] | DwarvenSoft/OpenTibia-Unity | OpenTibia/Assets/Scripts/Core/Store/StoreOpenParameters.cs | 952 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Databricks.Inputs
{
public sealed class ClusterLibraryCranArgs : Pulumi.ResourceArgs
{
[Input("messages")]
public Input<string>? Messages { get; set; }
[Input("package")]
public Input<string>? Package { get; set; }
[Input("repo")]
public Input<string>? Repo { get; set; }
[Input("status")]
public Input<string>? Status { get; set; }
public ClusterLibraryCranArgs()
{
}
}
}
| 25.3125 | 88 | 0.635802 | [
"ECL-2.0",
"Apache-2.0"
] | XBeg9/pulumi-databricks | sdk/dotnet/Inputs/ClusterLibraryCranArgs.cs | 810 | C# |
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Factories;
using Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Models;
using Nop.Web.Framework.Components;
namespace Nop.Plugin.MultiFactorAuth.GoogleAuthenticator.Components
{
/// <summary>
/// Represents view component for setting GoogleAuthenticator
/// </summary>
[ViewComponent(Name = GoogleAuthenticatorDefaults.VIEW_COMPONENT_NAME)]
public class GAAuthenticationViewComponent : NopViewComponent
{
#region Fields
private readonly AuthenticationModelFactory _authenticationModelFactory;
#endregion
#region Ctor
public GAAuthenticationViewComponent(AuthenticationModelFactory authenticationModelFactory)
{
_authenticationModelFactory = authenticationModelFactory;
}
#endregion
#region Methods
/// <summary>
/// Invoke view component
/// </summary>
/// <param name="widgetZone">Widget zone name</param>
/// <param name="additionalData">Additional data</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the view component result
/// </returns>
public async Task<IViewComponentResult> InvokeAsync(string widgetZone, object additionalData)
{
var model = new AuthModel();
model = await _authenticationModelFactory.PrepareAuthModel(model);
return View("~/Plugins/MultiFactorAuth.GoogleAuthenticator/Views/Customer/GAAuthentication.cshtml", model);
}
#endregion
}
}
| 32.653846 | 119 | 0.691402 | [
"CC0-1.0"
] | peterthomet/BioPuur | nopCommerce 4.4/src/Plugins/Nop.Plugin.MultiFactorAuth.GoogleAuthenticator/Components/GAAuthenticationViewComponent.cs | 1,700 | C# |
namespace ETModel
{
public class NumericWatcherAttribute : BaseAttribute
{
public NumericType NumericType { get; }
public NumericWatcherAttribute(NumericType type)
{
this.NumericType = type;
}
}
} | 17.666667 | 53 | 0.740566 | [
"MIT"
] | 13294029724/ET | Unity/Assets/Model/Module/Numeric/NumericWatcherAttribute.cs | 214 | C# |
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Gov.Lclb.Cllb.Interfaces
{
using Microsoft.Rest;
using Models;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Objectidadoxiofederalreportexport operations.
/// </summary>
public partial interface IObjectidadoxiofederalreportexport
{
/// <summary>
/// Get objectid_adoxio_federalreportexport from
/// principalobjectattributeaccessset
/// </summary>
/// <param name='principalobjectattributeaccessid'>
/// key: principalobjectattributeaccessid of
/// principalobjectattributeaccess
/// </param>
/// <param name='select'>
/// Select properties to be returned
/// </param>
/// <param name='expand'>
/// Expand related entities
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.HttpOperationException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.SerializationException">
/// Thrown when unable to deserialize the response
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
Task<HttpOperationResponse<MicrosoftDynamicsCRMadoxioFederalreportexport>> GetWithHttpMessagesAsync(string principalobjectattributeaccessid, IList<string> select = default(IList<string>), IList<string> expand = default(IList<string>), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
| 40.226415 | 364 | 0.658537 | [
"Apache-2.0"
] | BrendanBeachBC/jag-lcrb-carla-public | cllc-interfaces/Dynamics-Autorest/IObjectidadoxiofederalreportexport.cs | 2,132 | C# |
using System.IO;
using System.Runtime.Serialization;
using WolvenKit.CR2W.Reflection;
using FastMember;
using static WolvenKit.CR2W.Types.Enums;
namespace WolvenKit.CR2W.Types
{
[DataContract(Namespace = "")]
[REDMeta]
public class CBTTaskRidingManagerPlayerHorseDismount : CBTTaskRidingManagerHorseDismount
{
public CBTTaskRidingManagerPlayerHorseDismount(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name){ }
public static new CVariable Create(CR2WFile cr2w, CVariable parent, string name) => new CBTTaskRidingManagerPlayerHorseDismount(cr2w, parent, name);
public override void Read(BinaryReader file, uint size) => base.Read(file, size);
public override void Write(BinaryWriter file) => base.Write(file);
}
} | 33.695652 | 151 | 0.769032 | [
"MIT"
] | DerinHalil/CP77Tools | CP77.CR2W/Types/W3/RTTIConvert/CBTTaskRidingManagerPlayerHorseDismount.cs | 753 | C# |
// Copyright 2007-2018 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
namespace MassTransit.Clients
{
using System;
using Pipeline;
/// <summary>
/// The client factory context, which contains multiple interfaces and properties used by clients
/// </summary>
public interface ClientFactoryContext :
IRequestPipeConnector,
ISendEndpointProvider
{
/// <summary>
/// Default timeout for requests
/// </summary>
RequestTimeout DefaultTimeout { get; }
/// <summary>
/// The address used for responses to messages sent by this client
/// </summary>
Uri ResponseAddress { get; }
/// <summary>
/// Return the publish endpoint for the client factory
/// </summary>
/// <value></value>
IPublishEndpoint PublishEndpoint { get; }
}
} | 34.238095 | 101 | 0.662031 | [
"ECL-2.0",
"Apache-2.0"
] | AOrlov/MassTransit | src/MassTransit/Clients/ClientFactoryContext.cs | 1,440 | C# |
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Table;
namespace AccidentalFish.Foundations.Resources.Azure.TableStorage
{
public interface IAsyncTableStorageRepositoryFactory
{
Task<IAsyncTableStorageRepository<T>> CreateAsync<T>(string tableName) where T : ITableEntity, new();
}
}
| 29.545455 | 109 | 0.781538 | [
"MIT"
] | JTOne123/AccidentalFish.Foundations | Source/AccidentalFish.Foundations.Resources.Azure/TableStorage/IAsyncTableStorageRepositoryFactory.cs | 327 | C# |
//----------------------
// <auto-generated>
// This file was automatically generated. Any changes to it will be lost if and when the file is regenerated.
// </auto-generated>
//----------------------
#pragma warning disable
using System;
using SQEX.Luminous.Core.Object;
using System.Collections.Generic;
using CodeDom = System.CodeDom;
namespace Black.Sequence.Actor
{
[Serializable, CodeDom.Compiler.GeneratedCode("Luminaire", "0.1")]
public partial class SequenceActionActorSetMoveController : Black.Sequence.Actor.SequenceActionActorBase
{
new public static ObjectType ObjectType { get; private set; }
private static PropertyContainer fieldProperties;
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerInputPin start_= new SQEX.Ebony.Framework.Node.GraphTriggerInputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerInputPin stop_= new SQEX.Ebony.Framework.Node.GraphTriggerInputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphTriggerOutputPin out_= new SQEX.Ebony.Framework.Node.GraphTriggerOutputPin();
[UnityEngine.SerializeReference] public SQEX.Ebony.Framework.Node.GraphVariableInputPin setActor_= new SQEX.Ebony.Framework.Node.GraphVariableInputPin();
public int controllerType_;
new public static void SetupObjectType()
{
if (ObjectType != null)
{
return;
}
var dummy = new SequenceActionActorSetMoveController();
var properties = dummy.GetFieldProperties();
ObjectType = new ObjectType("Black.Sequence.Actor.SequenceActionActorSetMoveController", 0, Black.Sequence.Actor.SequenceActionActorSetMoveController.ObjectType, Construct, properties, 0, 568);
}
public override ObjectType GetObjectType()
{
return ObjectType;
}
protected override PropertyContainer GetFieldProperties()
{
if (fieldProperties != null)
{
return fieldProperties;
}
fieldProperties = new PropertyContainer("Black.Sequence.Actor.SequenceActionActorSetMoveController", base.GetFieldProperties(), -2141785226, 1055017110);
fieldProperties.AddIndirectlyProperty(new Property("refInPorts_", 1035088696, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 24, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("refOutPorts_", 283683627, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 40, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("triInPorts_", 291734708, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 96, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("triOutPorts_", 3107891487, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin*, MEMORY_CATEGORY_FRAMEWORK >", 112, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)4));
fieldProperties.AddIndirectlyProperty(new Property("Isolated_", 56305607, "bool", 168, 1, 1, Property.PrimitiveType.Bool, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("start_.pinName_", 898319567, "Base.String", 192, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("start_.name_", 2336428458, "Base.String", 208, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("start_.connections_", 2500938024, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 224, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("start_.delayType_", 1828337454, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 256, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("start_.delayTime_", 673303785, "float", 260, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("start_.delayMaxTime_", 240013909, "float", 264, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("stop_.pinName_", 183528169, "Base.String", 288, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("stop_.name_", 2815449908, "Base.String", 304, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("stop_.connections_", 2986689162, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 320, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("stop_.delayType_", 2766128696, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 352, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("stop_.delayTime_", 1614578803, "float", 356, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("stop_.delayMaxTime_", 2505467947, "float", 360, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.pinName_", 1137295951, "Base.String", 384, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.name_", 2182257194, "Base.String", 400, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.connections_", 2048532136, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 416, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayType_", 124432558, "SQEX.Ebony.Framework.Node.GraphPin.DelayType", 448, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayTime_", 3264366185, "float", 452, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("out_.delayMaxTime_", 456551125, "float", 456, 4, 1, Property.PrimitiveType.Float, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("setActor_.pinName_", 1604898516, "Base.String", 480, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("setActor_.name_", 3008574255, "Base.String", 496, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddIndirectlyProperty(new Property("setActor_.connections_", 1601827647, "SQEX.Ebony.Std.DynamicArray< SQEX.Ebony.Framework.Node.GraphPin* >", 512, 16, 1, Property.PrimitiveType.PointerArray, 0, (char)1));
fieldProperties.AddIndirectlyProperty(new Property("setActor_.pinValueType_", 2115901106, "Base.String", 544, 16, 1, Property.PrimitiveType.String, 0, (char)0));
fieldProperties.AddProperty(new Property("start_", 3266844032, "SQEX.Ebony.Framework.Node.GraphTriggerInputPin", 184, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("stop_", 3454812878, "SQEX.Ebony.Framework.Node.GraphTriggerInputPin", 280, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("out_", 1514340864, "SQEX.Ebony.Framework.Node.GraphTriggerOutputPin", 376, 96, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("setActor_", 116721733, "SQEX.Ebony.Framework.Node.GraphVariableInputPin", 472, 88, 1, Property.PrimitiveType.ClassField, 0, (char)0));
fieldProperties.AddProperty(new Property("controllerType_", 3222919810, "Black.Actor.Move.ControllerType", 560, 4, 1, Property.PrimitiveType.Enum, 0, (char)0));
return fieldProperties;
}
private static BaseObject Construct()
{
return new SequenceActionActorSetMoveController();
}
}
} | 81.524752 | 241 | 0.747875 | [
"MIT"
] | Gurrimo/Luminaire | Assets/Editor/Generated/Black/Sequence/Actor/SequenceActionActorSetMoveController.generated.cs | 8,234 | C# |
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Dorisoy.Pan.Data
{
public class DocumentVersion: BaseEntity
{
public Guid Id { get; set; }
public Guid DocumentId { get; set; }
public string Path { get; set; }
public string Message { get; set; }
public long Size { get; set; }
[ForeignKey("DocumentId")]
public Document Document { get; set; }
[ForeignKey("CreatedBy")]
public User CreatedByUser { get; set; }
[ForeignKey("ModifiedBy")]
public User ModifiedByUser { get; set; }
[ForeignKey("DeletedBy")]
public User DeletedByUser { get; set; }
}
}
| 30.086957 | 51 | 0.608382 | [
"MIT"
] | dorisoy/-Dorisoy.Pan | SourceCode/Src/Dorisoy.Pan.Data/Entities/DocumentVersion.cs | 694 | C# |
// Copyright 2020 Confluent Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Refer to LICENSE for more information.
using Confluent.Kafka;
namespace Confluent.SchemaRegistry
{
/// <summary>
/// Construct the subject name under which a referenced schema
/// should be registered in Schema Registry.
/// </summary>
/// <param name="context">
/// The serialization context.
/// </param>
/// <param name="referenceName">
/// The name used to reference the schema.
/// </param>
public delegate string ReferenceSubjectNameStrategyDelegate(SerializationContext context, string referenceName);
/// <summary>
/// Subject name strategy for referenced schemas.
/// </summary>
public enum ReferenceSubjectNameStrategy
{
/// <summary>
/// (default): Use the reference name as the subject name.
/// </summary>
ReferenceName
}
/// <summary>
/// Extension methods for the ReferenceSubjectNameStrategy type.
/// </summary>
public static class ReferenceSubjectNameStrategyExtensions
{
/// <summary>
/// Provide a functional implementation corresponding to the enum value.
/// </summary>
public static ReferenceSubjectNameStrategyDelegate ToDelegate(this ReferenceSubjectNameStrategy strategy)
=> (context, referenceName) => referenceName;
}
}
| 33.084746 | 116 | 0.672643 | [
"Apache-2.0"
] | 3schwartz/confluent-kafka-dotnet | src/Confluent.SchemaRegistry/ReferenceSubjectNameStrategy.cs | 1,952 | C# |
using System;
using System.Collections.Generic;
namespace Crt.Data.Database.Entities
{
/// <summary>
/// Role to Permission associative table for assignment of permissions to parent roles.
/// </summary>
public partial class CrtRolePermission
{
/// <summary>
/// Unique identifier for a record
/// </summary>
public decimal RolePermissionId { get; set; }
/// <summary>
/// Unique idenifier for related role
/// </summary>
public decimal RoleId { get; set; }
/// <summary>
/// Unique idenifier for related permission
/// </summary>
public decimal PermissionId { get; set; }
/// <summary>
/// Date record was deactivated
/// </summary>
public DateTime? EndDate { get; set; }
/// <summary>
/// Record under edit indicator used for optomisitc record contention management. If number differs from start of edit, then user will be prompted to that record has been updated by someone else.
/// </summary>
public long ConcurrencyControlNumber { get; set; }
/// <summary>
/// Unique idenifier of user who created record
/// </summary>
public string AppCreateUserid { get; set; }
/// <summary>
/// Date and time of record creation
/// </summary>
public DateTime AppCreateTimestamp { get; set; }
/// <summary>
/// Unique idenifier of user who created record
/// </summary>
public Guid AppCreateUserGuid { get; set; }
/// <summary>
/// Unique idenifier of user who last updated record
/// </summary>
public string AppLastUpdateUserid { get; set; }
/// <summary>
/// Date and time of last record update
/// </summary>
public DateTime AppLastUpdateTimestamp { get; set; }
/// <summary>
/// Unique idenifier of user who last updated record
/// </summary>
public Guid AppLastUpdateUserGuid { get; set; }
/// <summary>
/// Named database user who created record
/// </summary>
public string DbAuditCreateUserid { get; set; }
/// <summary>
/// Date and time record created in the database
/// </summary>
public DateTime DbAuditCreateTimestamp { get; set; }
/// <summary>
/// Named database user who last updated record
/// </summary>
public string DbAuditLastUpdateUserid { get; set; }
/// <summary>
/// Date and time record was last updated in the database.
/// </summary>
public DateTime DbAuditLastUpdateTimestamp { get; set; }
public virtual CrtPermission Permission { get; set; }
public virtual CrtRole Role { get; set; }
}
}
| 37.328947 | 204 | 0.582658 | [
"Apache-2.0"
] | ychung-mot/net6 | api/Crt.Data/Database/Entities/CrtRolePermission.cs | 2,839 | C# |
namespace OrdBase.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class TranslationDb : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.Clients",
c => new
{
Name = c.String(nullable: false, maxLength: 32),
ApiKey = c.String(maxLength: 64),
LastAccess = c.DateTime(),
RequestCount = c.Int(),
})
.PrimaryKey(t => t.Name)
.Index(t => t.ApiKey, unique: true);
CreateTable(
"dbo.Languages",
c => new
{
ShortName = c.String(nullable: false, maxLength: 7),
Name = c.String(nullable: false, maxLength: 32),
})
.PrimaryKey(t => t.ShortName)
.Index(t => t.Name, unique: true);
CreateTable(
"dbo.Translations",
c => new
{
ClientName = c.String(nullable: false, maxLength: 32),
LanguageShortName = c.String(nullable: false, maxLength: 7),
Container = c.String(nullable: false, maxLength: 32),
AccessKey = c.String(nullable: false, maxLength: 32),
Text = c.String(nullable: false, maxLength: 2048),
IsComplete = c.Boolean(nullable: false),
})
.PrimaryKey(t => new { t.ClientName, t.LanguageShortName, t.Container, t.AccessKey })
.ForeignKey("dbo.Clients", t => t.ClientName)
.ForeignKey("dbo.Languages", t => t.LanguageShortName)
.Index(t => t.ClientName)
.Index(t => t.LanguageShortName);
}
public override void Down()
{
DropForeignKey("dbo.Translations", "LanguageShortName", "dbo.Languages");
DropForeignKey("dbo.Translations", "ClientName", "dbo.Clients");
DropIndex("dbo.Translations", new[] { "LanguageShortName" });
DropIndex("dbo.Translations", new[] { "ClientName" });
DropIndex("dbo.Languages", new[] { "Name" });
DropIndex("dbo.Clients", new[] { "ApiKey" });
DropTable("dbo.Translations");
DropTable("dbo.Languages");
DropTable("dbo.Clients");
}
}
}
| 40.061538 | 101 | 0.462366 | [
"MIT"
] | Arxcis/OrdBaseNetStandard | OrdBase/Migrations/201706211043478_TranslationDb.cs | 2,604 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v1/resources/hotel_performance_view.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Ads.GoogleAds.V1.Resources {
/// <summary>Holder for reflection information generated from google/ads/googleads/v1/resources/hotel_performance_view.proto</summary>
public static partial class HotelPerformanceViewReflection {
#region Descriptor
/// <summary>File descriptor for google/ads/googleads/v1/resources/hotel_performance_view.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static HotelPerformanceViewReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Cj5nb29nbGUvYWRzL2dvb2dsZWFkcy92MS9yZXNvdXJjZXMvaG90ZWxfcGVy",
"Zm9ybWFuY2Vfdmlldy5wcm90bxIhZ29vZ2xlLmFkcy5nb29nbGVhZHMudjEu",
"cmVzb3VyY2VzGhxnb29nbGUvYXBpL2Fubm90YXRpb25zLnByb3RvIi0KFEhv",
"dGVsUGVyZm9ybWFuY2VWaWV3EhUKDXJlc291cmNlX25hbWUYASABKAlChgIK",
"JWNvbS5nb29nbGUuYWRzLmdvb2dsZWFkcy52MS5yZXNvdXJjZXNCGUhvdGVs",
"UGVyZm9ybWFuY2VWaWV3UHJvdG9QAVpKZ29vZ2xlLmdvbGFuZy5vcmcvZ2Vu",
"cHJvdG8vZ29vZ2xlYXBpcy9hZHMvZ29vZ2xlYWRzL3YxL3Jlc291cmNlczty",
"ZXNvdXJjZXOiAgNHQUGqAiFHb29nbGUuQWRzLkdvb2dsZUFkcy5WMS5SZXNv",
"dXJjZXPKAiFHb29nbGVcQWRzXEdvb2dsZUFkc1xWMVxSZXNvdXJjZXPqAiVH",
"b29nbGU6OkFkczo6R29vZ2xlQWRzOjpWMTo6UmVzb3VyY2VzYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Api.AnnotationsReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Ads.GoogleAds.V1.Resources.HotelPerformanceView), global::Google.Ads.GoogleAds.V1.Resources.HotelPerformanceView.Parser, new[]{ "ResourceName" }, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
/// A hotel performance view.
/// </summary>
public sealed partial class HotelPerformanceView : pb::IMessage<HotelPerformanceView> {
private static readonly pb::MessageParser<HotelPerformanceView> _parser = new pb::MessageParser<HotelPerformanceView>(() => new HotelPerformanceView());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<HotelPerformanceView> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Ads.GoogleAds.V1.Resources.HotelPerformanceViewReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HotelPerformanceView() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HotelPerformanceView(HotelPerformanceView other) : this() {
resourceName_ = other.resourceName_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public HotelPerformanceView Clone() {
return new HotelPerformanceView(this);
}
/// <summary>Field number for the "resource_name" field.</summary>
public const int ResourceNameFieldNumber = 1;
private string resourceName_ = "";
/// <summary>
/// The resource name of the hotel performance view.
/// Hotel performance view resource names have the form:
///
/// `customers/{customer_id}/hotelPerformanceView`
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string ResourceName {
get { return resourceName_; }
set {
resourceName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as HotelPerformanceView);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(HotelPerformanceView other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (ResourceName != other.ResourceName) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (ResourceName.Length != 0) {
output.WriteRawTag(10);
output.WriteString(ResourceName);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (ResourceName.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ResourceName);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(HotelPerformanceView other) {
if (other == null) {
return;
}
if (other.ResourceName.Length != 0) {
ResourceName = other.ResourceName;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ResourceName = input.ReadString();
break;
}
}
}
}
}
#endregion
}
#endregion Designer generated code
| 37.305263 | 227 | 0.702455 | [
"Apache-2.0"
] | chrisdunelm/google-ads-dotnet | src/V1/Stubs/HotelPerformanceView.cs | 7,088 | C# |
namespace EasySql.Databases.TypeMappings
{
public class DecimalTypeMapping : TypeMappingBase
{
public DecimalTypeMapping() : base(typeof(decimal), System.Data.DbType.Decimal)
{
}
}
}
| 22 | 87 | 0.659091 | [
"MIT"
] | jxnkwlp/EasySql | src/EasySql.Core/Databases/TypeMappings/DecimalTypeMapping.cs | 222 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace DllUtils.Exceptions
{
public class MemoryAllocationException : InjectionException
{
public MemoryAllocationException()
{
}
public MemoryAllocationException(string message) : base(message)
{
}
public MemoryAllocationException(string message, Exception innerException) : base(message, innerException)
{
}
protected MemoryAllocationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
| 23.931034 | 115 | 0.688761 | [
"MIT"
] | Rutherther/csharp-dll-injector | DllUtils/Exceptions/MemoryAllocationException.cs | 696 | C# |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// <auto-generated/>
// Template Source: Templates\CSharp\Requests\IMethodRequestBuilder.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
/// <summary>
/// The interface IServicePrincipalCreatePasswordSingleSignOnCredentialsRequestBuilder.
/// </summary>
public partial interface IServicePrincipalCreatePasswordSingleSignOnCredentialsRequestBuilder
{
/// <summary>
/// Builds the request.
/// </summary>
/// <param name="options">The query and header options for the request.</param>
/// <returns>The built request.</returns>
IServicePrincipalCreatePasswordSingleSignOnCredentialsRequest Request(IEnumerable<Option> options = null);
}
}
| 40.551724 | 153 | 0.619898 | [
"MIT"
] | OfficeGlobal/msgraph-beta-sdk-dotnet | src/Microsoft.Graph/Requests/Generated/IServicePrincipalCreatePasswordSingleSignOnCredentialsRequestBuilder.cs | 1,176 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace Mpdn.RenderScript
{
namespace Mpdn.ImageProcessor
{
public partial class ImageProcessorConfigDialog : ImageProcessorConfigDialogBase
{
private string m_ShaderPath;
public ImageProcessorConfigDialog()
{
InitializeComponent();
var descs = EnumHelpers.GetDescriptions<ImageProcessorUsage>();
foreach (var desc in descs)
{
comboBoxUsage.Items.Add(desc);
}
comboBoxUsage.SelectedIndex = 0;
}
protected override void LoadSettings()
{
m_ShaderPath = Settings.FullShaderPath;
Add(Settings.ShaderFileNames);
if (listBox.Items.Count > 0)
{
listBox.SelectedIndex = 0;
}
comboBoxUsage.SelectedIndex = (int) Settings.ImageProcessorUsage;
}
protected override void SaveSettings()
{
Settings.ShaderFileNames = listBox.Items.Cast<string>().ToArray();
Settings.ImageProcessorUsage = (ImageProcessorUsage)comboBoxUsage.SelectedIndex;
}
private void ButtonAddClick(object sender, EventArgs e)
{
openFileDialog.InitialDirectory = m_ShaderPath;
if (openFileDialog.ShowDialog(this) != DialogResult.OK)
return;
Add(openFileDialog.FileNames);
UpdateButtons();
}
private void ButtonRemoveClick(object sender, EventArgs e)
{
RemoveItem();
UpdateButtons();
}
private void ButtonClearClick(object sender, EventArgs e)
{
listBox.Items.Clear();
UpdateButtons();
}
private void ButtonUpClick(object sender, EventArgs e)
{
MoveItem((int) Direction.Up);
UpdateButtons();
}
private void ButtonDownClick(object sender, EventArgs e)
{
MoveItem((int) Direction.Down);
UpdateButtons();
}
private void RemoveItem()
{
var index = listBox.SelectedIndex;
listBox.Items.RemoveAt(index);
listBox.SelectedIndex = index < listBox.Items.Count ? index : listBox.Items.Count - 1;
}
private void MoveItem(int direction)
{
var index = listBox.SelectedIndex;
var item = listBox.Items[index];
listBox.Items.RemoveAt(index);
listBox.Items.Insert(index + direction, item);
listBox.SelectedIndex = index + direction;
}
private void Add(IEnumerable<string> fileNames)
{
foreach (var fileName in fileNames)
{
listBox.Items.Add(GetRelativePath(m_ShaderPath, fileName));
}
}
private void ListBoxSelectedIndexChanged(object sender, EventArgs e)
{
UpdateButtons();
}
private void UpdateButtons()
{
var index = listBox.SelectedIndex;
var count = listBox.Items.Count;
buttonRemove.Enabled = index >= 0;
buttonUp.Enabled = index > 0;
buttonDown.Enabled = index >= 0 && index < count - 1;
buttonClear.Enabled = count > 0;
}
private static string GetRelativePath(string rootPath, string filename)
{
if (!Path.IsPathRooted(filename))
return filename;
if (!filename.StartsWith(rootPath))
throw new InvalidOperationException("Unable to include an external shader file");
return filename.Remove(0, rootPath.Length + 1);
}
private enum Direction
{
Up = -1,
Down = 1
}
}
public class ImageProcessorConfigDialogBase : ScriptConfigDialog<ImageProcessor>
{
}
}
} | 30.909722 | 102 | 0.513817 | [
"MIT"
] | Shiandow/RenderScripts | RenderScripts/Mpdn.ImageProcessor.ConfigDialog.cs | 4,453 | C# |
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Hbms.Mes.Common
{
/// <summary>
/// RedisBase类,是redis操作的基类,继承自IDisposable接口,主要用于释放内存
/// </summary>
public abstract class RedisBase : IDisposable
{
public static IRedisClient Core { get; private set; }
private bool _disposed = false;
/// <summary>
/// 静态属性Core被调用时、会先调用此静态构造函数
/// </summary>
static RedisBase()
{
Core = RedisManage.GetClient();
}
protected virtual void Dispose(bool disposing)
{
if (!this._disposed)
{
if (disposing)
{
Core.Dispose();
Core = null;
}
}
this._disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// 保存数据DB文件到硬盘
/// </summary>
public void Save()
{
Core.Save();
}
/// <summary>
/// 异步保存数据DB文件到硬盘
/// </summary>
public void SaveAsync()
{
Core.SaveAsync();
}
}
}
| 23.192982 | 61 | 0.481846 | [
"Apache-2.0"
] | huangming771314520/Mes | Hbms.Mes.Common/RedisCache/RedisBase.cs | 1,450 | C# |
using UnityEngine;
using UnityEngine.UI;
namespace GameData.ScoreBoards
{
public class LeaderBoardUI : MonoBehaviour
{
[SerializeField] private Text entryPositionText = null;
[SerializeField] private Text entryNameText = null;
[SerializeField] private Text entryScoreText = null;
public void Initialised(HighScoreBoard highScoreBoard)
{
entryNameText.text = highScoreBoard.entryPosition.ToString();
entryNameText.text = highScoreBoard.entryScore.ToString();
entryNameText.text = highScoreBoard.entryName;
}
}
} | 26.541667 | 74 | 0.659341 | [
"MIT"
] | hr18aba/The-Endless-Crucifix | LeaderBoardUI.cs | 639 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ExtractSentencesByKeyword")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtractSentencesByKeyword")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0b68510c-b21c-4e00-93c8-9429f0eb97a4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.459459 | 84 | 0.749824 | [
"MIT"
] | pkindalov/beginner_exercises | StringsDictionnriesLambdaAndLinQ/ExtractSentencesByKeyword/Properties/AssemblyInfo.cs | 1,426 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace STNDB
{
using System;
using System.Collections.Generic;
public partial class landownercontact
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public landownercontact()
{
this.sites = new HashSet<site>();
}
public int landownercontactid { get; set; }
public string fname { get; set; }
public string lname { get; set; }
public string address { get; set; }
public string city { get; set; }
public string state { get; set; }
public string zip { get; set; }
public string primaryphone { get; set; }
public string secondaryphone { get; set; }
public string email { get; set; }
public string title { get; set; }
public Nullable<System.DateTime> last_updated { get; set; }
public Nullable<int> last_updated_by { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<site> sites { get; set; }
}
}
| 38.95122 | 128 | 0.579837 | [
"CC0-1.0"
] | USGS-WiM/STNServices2 | STNDB/landownercontact.cs | 1,597 | C# |
/****************************************************************************
While the underlying libraries are covered by LGPL, this sample is released
as public domain. It 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.
*****************************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Data;
namespace DxPlay
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnPause;
private System.Windows.Forms.Button btnSnap;
private System.Windows.Forms.TextBox tbFileName;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
// Make sure to release the DxPlay object to avoid hanging
if (m_play != null)
{
m_play.Dispose();
}
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tbFileName = new System.Windows.Forms.TextBox();
this.btnStart = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.btnPause = new System.Windows.Forms.Button();
this.btnSnap = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// tbFileName
//
this.tbFileName.Location = new System.Drawing.Point(72, 8);
this.tbFileName.Name = "tbFileName";
this.tbFileName.Size = new System.Drawing.Size(208, 20);
this.tbFileName.TabIndex = 9;
this.tbFileName.Text = "c:\\test.avi";
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(16, 40);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(64, 32);
this.btnStart.TabIndex = 1;
this.btnStart.Text = "Start";
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 2;
this.label1.Text = "FileName";
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(8, 88);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(320, 240);
this.panel1.TabIndex = 10;
//
// btnPause
//
this.btnPause.Enabled = false;
this.btnPause.Location = new System.Drawing.Point(96, 40);
this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(56, 32);
this.btnPause.TabIndex = 11;
this.btnPause.Text = "Pause";
this.btnPause.Click += new System.EventHandler(this.btnPause_Click);
//
// btnSnap
//
this.btnSnap.Enabled = false;
this.btnSnap.Location = new System.Drawing.Point(192, 40);
this.btnSnap.Name = "btnSnap";
this.btnSnap.Size = new System.Drawing.Size(56, 32);
this.btnSnap.TabIndex = 12;
this.btnSnap.Text = "Snap";
this.btnSnap.Click += new System.EventHandler(this.btnSnap_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(336, 338);
this.Controls.Add(this.btnSnap);
this.Controls.Add(this.btnPause);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnStart);
this.Controls.Add(this.tbFileName);
this.Name = "Form1";
this.Text = "DxPlay";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
enum State
{
Uninit,
Stopped,
Paused,
Playing
}
State m_State = State.Uninit;
DxPlay m_play = null;
private void btnStart_Click(object sender, System.EventArgs e)
{
// If necessary, close the old file
if (m_State == State.Stopped)
{
// Did the filename change?
if (tbFileName.Text != m_play.FileName)
{
// File name changed, close the old file
m_play.Dispose();
m_play = null;
m_State = State.Uninit;
btnSnap.Enabled = false;
}
}
// If we have no file open
if (m_play == null)
{
try
{
// Open the file, provide a handle to play it in
m_play = new DxPlay(panel1, tbFileName.Text);
// Let us know when the file is finished playing
m_play.StopPlay += new DxPlay.DxPlayEvent(m_play_StopPlay);
m_State = State.Stopped;
}
catch(COMException ce)
{
MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
// If we were stopped, start
if (m_State == State.Stopped)
{
btnStart.Text = "Stop";
m_play.Start();
btnSnap.Enabled = true;
btnPause.Enabled = true;
tbFileName.Enabled = false;
m_State = State.Playing;
}
// If we are playing or paused, stop
else if (m_State == State.Playing || m_State == State.Paused)
{
m_play.Stop();
btnPause.Enabled = false;
tbFileName.Enabled = true;
btnStart.Text = "Start";
btnPause.Text = "Pause";
m_State = State.Stopped;
}
}
private void btnPause_Click(object sender, System.EventArgs e)
{
// If we are playing, pause
if (m_State == State.Playing)
{
m_play.Pause();
btnPause.Text = "Resume";
m_State = State.Paused;
}
// If we are paused, start
else
{
m_play.Start();
btnPause.Text = "Pause";
m_State = State.Playing;
}
}
private void btnSnap_Click(object sender, System.EventArgs e)
{
// Grab a copy of the current bitmap. Graph can be paused, playing, or stopped
IntPtr ip = m_play.SnapShot();
try
{
// Turn the raw pixels into a Bitmap
Bitmap bmp = m_play.IPToBmp(ip);
// Save the bitmap to a file
bmp.Save(@"c:\tryme.bmp");
}
finally
{
// Free the raw pixels
Marshal.FreeCoTaskMem(ip);
}
}
// Called when the video is finished playing
private void m_play_StopPlay(Object sender)
{
// This isn't the right way to do this, but heck, it's only a sample
CheckForIllegalCrossThreadCalls = false;
btnPause.Enabled = false;
tbFileName.Enabled = true;
btnStart.Text = "Start";
btnPause.Text = "Pause";
CheckForIllegalCrossThreadCalls = true;
m_State = State.Stopped;
// Rewind clip to beginning to allow DxPlay.Start to work again.
m_play.Rewind();
}
}
}
| 33.922261 | 133 | 0.503021 | [
"MIT"
] | d3x0r/xperdex | DirectShowLibV2/Samples/Players/DxPlay/Form1.cs | 9,600 | C# |
using System.Collections.Generic;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Tx.ToolBox.Wpf.SampleApp;
using Tx.ToolBox.Wpf.Tools;
namespace Tx.ToolBox.Wpf.Tests.Demo.Tools
{
class ToolBarSample : SampleBase
{
public ToolBarSample()
{
Name = "Toolbar Sample";
}
protected override IEnumerable<IWindsorInstaller> CreateInstallers()
{
yield return new ToolBarInstaller();
}
}
}
| 22.136364 | 76 | 0.655031 | [
"MIT"
] | Telliax/Tx.ToolBox | Tx.ToolBox.Wpf.Tests/Demo/Tools/ToolBarSample.cs | 489 | C# |
//
// Copyright (c) 2011-2014 Exxeleron GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
namespace qSharp.Sample
{
internal class TickSubscriber
{
private static void Main(string[] args)
{
var q = new QCallbackConnection((args.Length >= 1) ? args[0] : "localhost",
(args.Length >= 2) ? int.Parse(args[1]) : 17010);
try
{
q.DataReceived += OnData;
q.ErrorOccured += OnError;
q.Open();
Console.WriteLine("conn: " + q + " protocol: " + q.ProtocolVersion);
Console.WriteLine("Press <ENTER> to close application");
var response = q.Sync(".u.sub", "trade", ""); // subscribe to tick
var model = (QTable) ((object[]) response)[1]; // get table model
q.StartListener();
Console.ReadLine();
q.StopListener();
}
catch (Exception e)
{
Console.Error.WriteLine("Error occured: " + e);
Console.ReadLine();
}
finally
{
q.Close();
}
}
private static void OnData(object sender, QMessageEvent message)
{
var data = message.Message.Data;
if (data is object[])
{
// unpack upd message
var args = ((object[]) data);
if (args.Length == 3 && args[0].Equals("upd") && args[2] is QTable)
{
var table = (QTable) args[2];
foreach (QTable.Row row in table)
{
Console.WriteLine(row);
}
}
}
}
private static void OnError(object sender, QErrorEvent error)
{
Console.Error.WriteLine("Error received via callback: " + error.Cause.Message);
}
}
} | 33.434211 | 91 | 0.511216 | [
"Apache-2.0"
] | exxeleron/qSharp | TickSubscriber/TickSubscriber.cs | 2,543 | C# |
using System;
using System.Linq.Expressions;
using FluentValidation;
using FluentValidation.Internal;
using FluentValidation.TestHelper;
namespace Miru.Testing
{
public static class ValidationTestExtensions
{
public static void SetValue<TRequest, TProperty>(
this TRequest model,
Expression<Func<TRequest, TProperty>> expression,
TProperty value)
{
// TODO: move to some appropriate class, like reflection
new MemberAccessor<TRequest, TProperty>(expression, true).Set(model, value);
}
public static void ShouldBeValid<TModel>(this TestFixture fixture, TModel model) where TModel : class, new()
{
// var result = fixture.FindValidatorFor<TModel>().Validate(model);
// if (result.IsValid == false)
// throw new ValidationException(result.Errors);
}
public static void ShouldBeValid<TModel, TProperty>(
this TestFixture fixture,
TModel validModel,
Expression<Func<TModel, TProperty>> expression,
TProperty validValue) where TModel : class, new()
{
validModel.SetValue(expression, validValue);
// fixture.FindValidatorFor<TModel>().ShouldNotHaveValidationErrorFor(expression, validModel);
}
public static void ShouldBeInvalid<TModel, TProperty>(
this TestFixture fixture,
TModel validModel,
Expression<Func<TModel, TProperty>> expression,
TProperty invalidValue) where TModel : class, new()
{
validModel.SetValue(expression, invalidValue);
// fixture.FindValidatorFor<TModel>().ShouldHaveValidationErrorFor(expression, validModel);
}
public static IValidator<TRequest> FindValidatorFor<TRequest>(this ScopedServices scope)
{
var validatorType = typeof(IValidator<>).MakeGenericType(typeof(TRequest));
var validator = scope.Get(validatorType) as IValidator<TRequest>;
if (validator == null)
throw new MiruException(
$"Could not find a Validator of type {validatorType} for request of type {typeof(TRequest)}. Check if the Validators are being registered in the Container");
return validator;
}
public static void ShouldBeValid<TModel>(
this IValidator<TModel> validator,
TModel request) where TModel : class, new()
{
var result = validator.Validate(request);
if (result.IsValid == false)
throw new ValidationException(result.Errors);
}
public static void ShouldBeValid<TModel, TProperty>(
this IValidator<TModel> validator,
TModel request,
Expression<Func<TModel, TProperty>> expression,
TProperty validValue) where TModel : class, new()
{
request.SetValue(expression, validValue);
validator.ShouldNotHaveValidationErrorFor(expression, request);
}
public static void ShouldBeInvalid<TModel, TProperty>(
this IValidator<TModel> validator,
TModel request,
Expression<Func<TModel, TProperty>> expression,
TProperty validValue) where TModel : class, new()
{
request.SetValue(expression, validValue);
validator.ShouldHaveValidationErrorFor(expression, request);
}
}
} | 38.305263 | 177 | 0.608134 | [
"MIT"
] | MiruFx/Miru | src/Miru.Testing/ValidationTestExtensions.cs | 3,639 | C# |
namespace Nest
{
public interface IQueryVisitor
{
/// <summary>
/// The current depth of the node being visited
/// </summary>
int Depth { get; set; }
/// <summary>
/// Hints the relation with the parent, i,e queries inside a Must clause will have VisitorScope.Must set.
/// </summary>
VisitorScope Scope { get; set; }
/// <summary>
/// Visit the query container just before we dispatch into the query it holds
/// </summary>
/// <param name="queryDescriptor"></param>
void Visit(IQueryContainer queryDescriptor);
/// <summary>
/// Visit every query item just before they are visited by their specialized Visit() implementation
/// </summary>
/// <param name="query">The IQuery object that will be visited</param>
void Visit(IQuery query);
void Visit(IBoolQuery query);
void Visit(IBoostingQuery query);
void Visit(ICommonTermsQuery query);
void Visit(IConstantScoreQuery query);
void Visit(IDisMaxQuery query);
void Visit(IFunctionScoreQuery query);
void Visit(IFuzzyQuery query);
void Visit(IFuzzyNumericQuery query);
void Visit(IFuzzyDateQuery query);
void Visit(IFuzzyStringQuery query);
void Visit(IHasChildQuery query);
void Visit(IHasParentQuery query);
void Visit(IIdsQuery query);
void Visit(IIntervalsQuery query);
void Visit(IMatchQuery query);
void Visit(IMatchPhraseQuery query);
void Visit(IMatchPhrasePrefixQuery query);
void Visit(IMatchAllQuery query);
void Visit(IMatchNoneQuery query);
void Visit(IMoreLikeThisQuery query);
void Visit(IMultiMatchQuery query);
void Visit(INestedQuery query);
void Visit(IPrefixQuery query);
void Visit(IQueryStringQuery query);
void Visit(IRangeQuery query);
void Visit(IRegexpQuery query);
void Visit(ISimpleQueryStringQuery query);
void Visit(ITermQuery query);
void Visit(IWildcardQuery query);
void Visit(ITermsQuery query);
void Visit(IScriptQuery query);
void Visit(IScriptScoreQuery query);
void Visit(IGeoPolygonQuery query);
void Visit(IGeoDistanceQuery query);
void Visit(IGeoBoundingBoxQuery query);
void Visit(IExistsQuery query);
void Visit(IDateRangeQuery query);
void Visit(INumericRangeQuery query);
void Visit(ILongRangeQuery query);
void Visit(ITermRangeQuery query);
void Visit(ISpanFirstQuery query);
void Visit(ISpanNearQuery query);
void Visit(ISpanNotQuery query);
void Visit(ISpanOrQuery query);
void Visit(ISpanTermQuery query);
void Visit(ISpanQuery query);
void Visit(ISpanSubQuery query);
void Visit(ISpanContainingQuery query);
void Visit(ISpanWithinQuery query);
void Visit(ISpanMultiTermQuery query);
void Visit(ISpanFieldMaskingQuery query);
void Visit(IGeoShapeQuery query);
void Visit(IRawQuery query);
void Visit(IPercolateQuery query);
void Visit(IParentIdQuery query);
void Visit(ITermsSetQuery query);
}
public class QueryVisitor : IQueryVisitor
{
public int Depth { get; set; }
public VisitorScope Scope { get; set; }
public virtual void Visit(IQueryContainer query) { }
public virtual void Visit(IQuery query) { }
public virtual void Visit(IBoolQuery query) { }
public virtual void Visit(IBoostingQuery query) { }
public virtual void Visit(ICommonTermsQuery query) { }
public virtual void Visit(IConstantScoreQuery query) { }
public virtual void Visit(IDisMaxQuery query) { }
public virtual void Visit(ISpanContainingQuery query) { }
public virtual void Visit(ISpanWithinQuery query) { }
public virtual void Visit(IDateRangeQuery query) { }
public virtual void Visit(INumericRangeQuery query) { }
public virtual void Visit(ILongRangeQuery query) { }
public virtual void Visit(ITermRangeQuery query) { }
public virtual void Visit(IFunctionScoreQuery query) { }
public virtual void Visit(IFuzzyQuery query) { }
public virtual void Visit(IFuzzyStringQuery query) { }
public virtual void Visit(IFuzzyNumericQuery query) { }
public virtual void Visit(IFuzzyDateQuery query) { }
public virtual void Visit(IGeoShapeQuery query) { }
public virtual void Visit(IHasChildQuery query) { }
public virtual void Visit(IHasParentQuery query) { }
public virtual void Visit(IIdsQuery query) { }
public virtual void Visit(IIntervalsQuery query) { }
public virtual void Visit(IMatchQuery query) { }
public virtual void Visit(IMatchPhraseQuery query) { }
public virtual void Visit(IMatchPhrasePrefixQuery query) { }
public virtual void Visit(IMatchAllQuery query) { }
public virtual void Visit(IMatchNoneQuery query) { }
public virtual void Visit(IMoreLikeThisQuery query) { }
public virtual void Visit(IMultiMatchQuery query) { }
public virtual void Visit(INestedQuery query) { }
public virtual void Visit(IPrefixQuery query) { }
public virtual void Visit(IQueryStringQuery query) { }
public virtual void Visit(IRangeQuery query) { }
public virtual void Visit(IRegexpQuery query) { }
public virtual void Visit(ISimpleQueryStringQuery query) { }
public virtual void Visit(ISpanFirstQuery query) { }
public virtual void Visit(ISpanNearQuery query) { }
public virtual void Visit(ISpanNotQuery query) { }
public virtual void Visit(ISpanOrQuery query) { }
public virtual void Visit(ISpanTermQuery query) { }
public virtual void Visit(ISpanSubQuery query) { }
public virtual void Visit(ISpanMultiTermQuery query) { }
public virtual void Visit(ISpanFieldMaskingQuery query) { }
public virtual void Visit(ITermQuery query) { }
public virtual void Visit(IWildcardQuery query) { }
public virtual void Visit(ITermsQuery query) { }
public virtual void Visit(IScriptQuery query) { }
public virtual void Visit(IScriptScoreQuery query) { }
public virtual void Visit(IGeoPolygonQuery query) { }
public virtual void Visit(IGeoDistanceQuery query) { }
public virtual void Visit(ISpanQuery query) { }
public virtual void Visit(IGeoBoundingBoxQuery query) { }
public virtual void Visit(IExistsQuery query) { }
public virtual void Visit(IRawQuery query) { }
public virtual void Visit(IPercolateQuery query) { }
public virtual void Visit(IParentIdQuery query) { }
public virtual void Visit(ITermsSetQuery query) { }
public virtual void Visit(IQueryVisitor visitor) { }
}
}
| 23.849057 | 107 | 0.742722 | [
"Apache-2.0"
] | niemyjski/elasticsearch-net | src/Nest/QueryDsl/Visitor/QueryVisitor.cs | 6,322 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class Advapi32
{
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
internal static partial int ConvertStringSidToSid(
string stringSid,
out IntPtr ByteArray);
}
}
| 34 | 165 | 0.730104 | [
"MIT"
] | DarkBullNull/runtime | src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ConvertStringSidToSid.cs | 578 | C# |
// Copyright (c) 2019, WebsitePanel-Support.net.
// Distributed by websitepanel-support.net
// Build and fixed by Key4ce - IT Professionals
// https://www.key4ce.com
//
// Original source:
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
using WebsitePanel.Providers;
namespace WebsitePanel.Providers.HostedSolution
{
public class ExchangeDomain : ServiceProviderItem
{
}
}
| 44.446809 | 84 | 0.732408 | [
"BSD-3-Clause"
] | Key4ce/Websitepanel | WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ExchangeDomain.cs | 2,089 | C# |
using SSRD.CommonUtils.Result;
using SSRD.IdentityUI.Admin.Areas.GroupAdmin.Models.Invite;
using System.Threading.Tasks;
namespace SSRD.IdentityUI.Admin.Areas.GroupAdmin.Interfaces
{
public interface IGroupAdminInviteDataService
{
Task<Result<GroupAdminInviteViewModel>> GetInviteViewModel(string groupId);
}
}
| 27.75 | 83 | 0.792793 | [
"MIT"
] | faizu-619/IdentityUI | src/IdentityUI.Admin/Areas/GroupAdmin/Interfaces/IGroupAdminInviteDataService.cs | 335 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharedForms.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharedForms.Android")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
| 36.714286 | 84 | 0.757198 | [
"MIT"
] | XamYu/XamarinExamples | SharedForms/SharedForms/SharedForms.Android/Properties/AssemblyInfo.cs | 1,288 | C# |
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using DesignScriptStudio.Graph.Core;
namespace DesignScriptStudio.Graph.Ui
{
class LibraryTreeViewModel
{
ObservableCollection<LibraryItemViewModel> rootItems;
LibraryItemViewModel libary;
LibraryView libraryView;
public LibraryTreeViewModel(LibraryItem libary, LibraryView libraryView)
{
this.libraryView = libraryView;
this.libary = new LibraryItemViewModel(libary, libraryView);
rootItems = new ObservableCollection<LibraryItemViewModel>();
foreach (LibraryItem rootItem in libary.Children)
{
rootItems.Add(new LibraryItemViewModel(rootItem, libraryView));
}
if (rootItems[0].DisplayText == Configurations.NoResultMessage)
rootItems[0].Visibility = Visibility.Collapsed;
}
public ObservableCollection<LibraryItemViewModel> RootItems
{
get { return this.rootItems; }
}
}
class LibraryItemViewModel : INotifyPropertyChanged
{
#region Data
ObservableCollection<LibraryItemViewModel> children;
LibraryItemViewModel parent;
LibraryItem libraryItem;
LibraryView libraryView;
bool isExpanded;
bool isSelected;
Visibility visibility;
bool isChildVisible;
//List<LibraryView.DecoratedString> header;
string prePiece, highlightPiece, postPiece;
#endregion
#region Constructors
public LibraryItemViewModel(LibraryItem libraryItem, LibraryView libraryView)
: this(libraryItem, null, libraryView)
{
}
private LibraryItemViewModel(LibraryItem libraryItem, LibraryItemViewModel parent, LibraryView libraryView)
{
this.libraryView = libraryView;
this.libraryItem = libraryItem;
this.parent = parent;
this.children = new ObservableCollection<LibraryItemViewModel>();
this.isExpanded = false;
this.isSelected = false;
this.visibility = Visibility.Visible;
//this.header = new List<LibraryView.DecoratedString>();
//LibraryView.DecoratedString item = new LibraryView.DecoratedString();
//item.isHilighted = false;
//item.text = this.libraryItem.DisplayText;
//this.header.Add(item);
this.prePiece = this.libraryItem.DisplayText;
this.highlightPiece = string.Empty;
this.postPiece = string.Empty;
if (this.libraryItem.Children != null && this.libraryItem.Children.Count > 0)
{
foreach (LibraryItem childItem in libraryItem.Children)
{
this.children.Add(new LibraryItemViewModel(childItem, this, libraryView));
}
}
}
#endregion
#region LibraryItem Properties
public ObservableCollection<LibraryItemViewModel> Children
{
get { return this.children; }
}
public int Level
{
get { return this.libraryItem.Level; }
}
public string DisplayText
{
get { return this.libraryItem.DisplayText; }
}
public bool IsOverloaded
{
get
{
if (this.libraryItem.Children != null && this.libraryItem.Children.Count > 0)
return this.libraryItem.Children[0].IsOverloaded;
else
return false;
}
}
public LibraryItem LibraryItem
{
get { return this.libraryItem; }
}
#endregion
#region Presentation Members
public bool IsExpanded
{
get { return this.isExpanded; }
set
{
if (value != this.isExpanded)
{
this.isExpanded = value;
this.UpdateIsChildVisible();
this.OnPropertyChanged("IsExpanded");
}
}
}
public bool IsSelected
{
get { return this.isSelected; }
set
{
if (value != this.isSelected)
{
this.isSelected = value;
this.OnPropertyChanged("IsSelected");
}
}
}
public Visibility Visibility
{
get { return this.visibility; }
set
{
if (value != this.visibility)
{
this.visibility = value;
if (this.parent != null)
this.parent.UpdateIsChildVisible();
this.OnPropertyChanged("Visibility");
}
}
}
public bool IsChildVisible
{
get { return this.isChildVisible; }
set
{
if (value != this.isChildVisible)
{
this.isChildVisible = value;
this.OnPropertyChanged("IsChildVisible");
}
}
}
public string PrePiece
{
get { return this.prePiece; }
set
{
if (value != this.prePiece)
{
this.prePiece = value;
this.OnPropertyChanged("PrePiece");
}
}
}
public string HighlightPiece
{
get { return this.highlightPiece; }
set
{
if (value != this.highlightPiece)
{
this.highlightPiece = value;
this.OnPropertyChanged("HighlightPiece");
}
}
}
public string PostPiece
{
get { return this.postPiece; }
set
{
if (value != this.postPiece)
{
this.postPiece = value;
this.OnPropertyChanged("PostPiece");
}
}
}
//public List<LibraryView.DecoratedString> Header
//{
// get { return this.header; }
// set
// {
// if (value != this.header)
// {
// this.header = value;
// this.OnPropertyChanged("Header");
// }
// }
//}
public ContextMenu CM
{
get
{
if (this.children.Count < 1)
return this.libraryView.ItemMenu;
else if (this.libraryItem.Level == 0 && this.libraryItem.IsExternal)
return this.libraryView.ExternalFolderMenu;
else
return this.libraryView.FolderMenu;
}
}
public LibraryItemViewModel Parent
{
get { return this.parent; }
}
#endregion
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
internal void UpdateIsChildVisible()
{
if (this.children.Count < 1 || !this.isExpanded)
{
this.IsChildVisible = false;
return;
}
foreach (LibraryItemViewModel childItem in this.children)
{
if (childItem.Visibility != Visibility.Visible)
{
this.IsChildVisible = false;
return;
}
}
this.IsChildVisible = true;
}
}
}
| 27.864865 | 115 | 0.508729 | [
"Apache-2.0"
] | junmendoza/DesignScriptStudio | UIs/Studio/DesignScriptStudio.Graph.Ui/LibraryTreeViewModel.cs | 8,250 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Labs.Controls;
using Xamarin.Forms.Labs.iOS.Controls;
using Xamarin.Forms.Labs.Sample.iOS;
[assembly: ExportRenderer(typeof(DynamicListView<object>), typeof(BasicListRenderer))]
namespace Xamarin.Forms.Labs.Sample.iOS
{
public class BasicListRenderer : DynamicUITableViewRenderer<object>
{
protected override UITableViewCell GetCell(UITableView tableView, object item)
{
if (item is string)
{
return base.GetCell(tableView, item);
}
if (item is DateTime)
{
var cell = new UITableViewCell(UITableViewCellStyle.Value1, this.GetType().Name);
cell.TextLabel.Text = ((DateTime)item).ToShortDateString();
cell.DetailTextLabel.Text = ((DateTime)item).ToShortTimeString();
return cell;
}
throw new NotImplementedException();
}
public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
{
var item = this.Element.Data[indexPath.Item];
if (item is string)
{
return base.GetHeightForRow(tableView, indexPath);
}
else if (item is DateTime)
{
return 44f;
}
throw new NotImplementedException();
}
}
} | 30.433962 | 98 | 0.587105 | [
"Apache-2.0"
] | Applifting/Xamarin-Forms-Labs | samples/Xamarin.Forms.Labs.Sample.iOS/DynamicListView/BasicListRenderer.cs | 1,613 | C# |
namespace Ahk.Grader
{
public enum GradingOutcomes
{
Graded,
FailedToGrade,
Inconclusive
}
}
| 13 | 31 | 0.569231 | [
"MIT"
] | akosdudas/ahk-cli | src/Graders/Ahk.Grader.Domain/GradingOutcomes.cs | 132 | C# |
using System.Web;
using System.Web.Optimization;
namespace UserManagement.API
{
public class BundleConfig
{
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
| 38.321429 | 113 | 0.590867 | [
"MIT"
] | devshsakariya/AddWebTask | UserManagement.API/App_Start/BundleConfig.cs | 1,075 | C# |
using DCL.Interface;
using UnityEngine;
using UnityEngine.UI;
namespace DCL.HelpAndSupportHUD
{
public class HelpAndSupportHUDView : MonoBehaviour
{
public bool isOpen { get; private set; } = false;
public event System.Action OnClose;
private const string PATH = "HelpAndSupportHUD";
private const string VIEW_OBJECT_NAME = "_HelpAndSupportHUD";
private const string JOIN_DISCORD_URL = "https://dcl.gg/discord";
private const string FAQ_URL = "https://docs.decentraland.org/decentraland/faq/";
[SerializeField] private ShowHideAnimator helpAndSupportAnimator;
[SerializeField] private Button joinDiscordButton;
[SerializeField] private Button visitFAQButton;
[SerializeField] private Button closeButton;
[SerializeField] internal InputAction_Trigger closeAction;
private InputAction_Trigger.Triggered closeActionDelegate;
private void Awake() { closeActionDelegate = (x) => SetVisibility(false); }
private void Initialize()
{
gameObject.name = VIEW_OBJECT_NAME;
joinDiscordButton.onClick.AddListener(() =>
{
WebInterface.OpenURL(JOIN_DISCORD_URL);
});
visitFAQButton.onClick.AddListener(() =>
{
WebInterface.OpenURL(FAQ_URL);
});
closeButton.onClick.AddListener(() =>
{
SetVisibility(false);
});
}
public static HelpAndSupportHUDView Create()
{
HelpAndSupportHUDView view = Instantiate(Resources.Load<GameObject>(PATH)).GetComponent<HelpAndSupportHUDView>();
view.Initialize();
return view;
}
public void SetVisibility(bool visible)
{
closeAction.OnTriggered -= closeActionDelegate;
if (visible)
{
helpAndSupportAnimator.Show();
closeAction.OnTriggered += closeActionDelegate;
}
else
helpAndSupportAnimator.Hide();
if (!visible && isOpen)
OnClose?.Invoke();
isOpen = visible;
}
}
} | 31.041667 | 125 | 0.601342 | [
"Apache-2.0"
] | JuanMartinSalice/unity-renderer | unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/HelpAndSupportHUD/HelpAndSupportHUDView.cs | 2,235 | C# |
namespace Nortwind.WebFormsUI
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dgwProduct = new System.Windows.Forms.DataGridView();
this.gbxCategory = new System.Windows.Forms.GroupBox();
this.gbxProductName = new System.Windows.Forms.GroupBox();
this.lblCategory = new System.Windows.Forms.Label();
this.lblProductName = new System.Windows.Forms.Label();
this.cbxCategory = new System.Windows.Forms.ComboBox();
this.tbxProductName = new System.Windows.Forms.TextBox();
this.gbxProductAdd = new System.Windows.Forms.GroupBox();
this.lblProductName2 = new System.Windows.Forms.Label();
this.lblCategoryID = new System.Windows.Forms.Label();
this.lblUnitPrice = new System.Windows.Forms.Label();
this.lblStock = new System.Windows.Forms.Label();
this.lblQuantityPerUnit = new System.Windows.Forms.Label();
this.tbxProductName2 = new System.Windows.Forms.TextBox();
this.cbxCategory2 = new System.Windows.Forms.ComboBox();
this.tbxUnitPrice = new System.Windows.Forms.TextBox();
this.tbxStock = new System.Windows.Forms.TextBox();
this.tbxQuantityPerUnit = new System.Windows.Forms.TextBox();
this.btnAdd = new System.Windows.Forms.Button();
this.gbxProductUpdate = new System.Windows.Forms.GroupBox();
this.btnUpdate = new System.Windows.Forms.Button();
this.tbxQuantityPerUnitUpdate = new System.Windows.Forms.TextBox();
this.tbxUnitsInStockUpdate = new System.Windows.Forms.TextBox();
this.tbxUnitPriceUpdate = new System.Windows.Forms.TextBox();
this.cbxCategoryIdUpdate = new System.Windows.Forms.ComboBox();
this.tbxUpdateProductName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.btnRemove = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgwProduct)).BeginInit();
this.gbxCategory.SuspendLayout();
this.gbxProductName.SuspendLayout();
this.gbxProductAdd.SuspendLayout();
this.gbxProductUpdate.SuspendLayout();
this.SuspendLayout();
//
// dgwProduct
//
this.dgwProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgwProduct.Location = new System.Drawing.Point(13, 137);
this.dgwProduct.Name = "dgwProduct";
this.dgwProduct.Size = new System.Drawing.Size(776, 193);
this.dgwProduct.TabIndex = 0;
this.dgwProduct.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgwProduct_CellClick);
//
// gbxCategory
//
this.gbxCategory.Controls.Add(this.cbxCategory);
this.gbxCategory.Controls.Add(this.lblCategory);
this.gbxCategory.Location = new System.Drawing.Point(12, 12);
this.gbxCategory.Name = "gbxCategory";
this.gbxCategory.Size = new System.Drawing.Size(776, 57);
this.gbxCategory.TabIndex = 1;
this.gbxCategory.TabStop = false;
this.gbxCategory.Text = "Kategoriye göre ara";
//
// gbxProductName
//
this.gbxProductName.Controls.Add(this.tbxProductName);
this.gbxProductName.Controls.Add(this.lblProductName);
this.gbxProductName.Location = new System.Drawing.Point(12, 75);
this.gbxProductName.Name = "gbxProductName";
this.gbxProductName.Size = new System.Drawing.Size(776, 56);
this.gbxProductName.TabIndex = 2;
this.gbxProductName.TabStop = false;
this.gbxProductName.Text = "Ürün adına göre ara";
//
// lblCategory
//
this.lblCategory.AutoSize = true;
this.lblCategory.Location = new System.Drawing.Point(20, 29);
this.lblCategory.Name = "lblCategory";
this.lblCategory.Size = new System.Drawing.Size(55, 13);
this.lblCategory.TabIndex = 0;
this.lblCategory.Text = "Kategori : ";
//
// lblProductName
//
this.lblProductName.AutoSize = true;
this.lblProductName.Location = new System.Drawing.Point(20, 29);
this.lblProductName.Name = "lblProductName";
this.lblProductName.Size = new System.Drawing.Size(57, 13);
this.lblProductName.TabIndex = 1;
this.lblProductName.Text = "Ürün Adı : ";
//
// cbxCategory
//
this.cbxCategory.FormattingEnabled = true;
this.cbxCategory.Location = new System.Drawing.Point(73, 26);
this.cbxCategory.Name = "cbxCategory";
this.cbxCategory.Size = new System.Drawing.Size(202, 21);
this.cbxCategory.TabIndex = 1;
this.cbxCategory.SelectedIndexChanged += new System.EventHandler(this.cbxCategory_SelectedIndexChanged);
//
// tbxProductName
//
this.tbxProductName.Location = new System.Drawing.Point(73, 26);
this.tbxProductName.Name = "tbxProductName";
this.tbxProductName.Size = new System.Drawing.Size(202, 20);
this.tbxProductName.TabIndex = 2;
this.tbxProductName.TextChanged += new System.EventHandler(this.tbxProductName_TextChanged);
//
// gbxProductAdd
//
this.gbxProductAdd.Controls.Add(this.btnAdd);
this.gbxProductAdd.Controls.Add(this.tbxQuantityPerUnit);
this.gbxProductAdd.Controls.Add(this.tbxStock);
this.gbxProductAdd.Controls.Add(this.tbxUnitPrice);
this.gbxProductAdd.Controls.Add(this.cbxCategory2);
this.gbxProductAdd.Controls.Add(this.tbxProductName2);
this.gbxProductAdd.Controls.Add(this.lblQuantityPerUnit);
this.gbxProductAdd.Controls.Add(this.lblStock);
this.gbxProductAdd.Controls.Add(this.lblUnitPrice);
this.gbxProductAdd.Controls.Add(this.lblCategoryID);
this.gbxProductAdd.Controls.Add(this.lblProductName2);
this.gbxProductAdd.Location = new System.Drawing.Point(13, 336);
this.gbxProductAdd.Name = "gbxProductAdd";
this.gbxProductAdd.Size = new System.Drawing.Size(775, 112);
this.gbxProductAdd.TabIndex = 3;
this.gbxProductAdd.TabStop = false;
this.gbxProductAdd.Text = "Yeni ürün ekle";
//
// lblProductName2
//
this.lblProductName2.AutoSize = true;
this.lblProductName2.Location = new System.Drawing.Point(7, 20);
this.lblProductName2.Name = "lblProductName2";
this.lblProductName2.Size = new System.Drawing.Size(57, 13);
this.lblProductName2.TabIndex = 0;
this.lblProductName2.Text = "Ürün Adı : ";
//
// lblCategoryID
//
this.lblCategoryID.AutoSize = true;
this.lblCategoryID.Location = new System.Drawing.Point(7, 43);
this.lblCategoryID.Name = "lblCategoryID";
this.lblCategoryID.Size = new System.Drawing.Size(55, 13);
this.lblCategoryID.TabIndex = 1;
this.lblCategoryID.Text = "Kategori : ";
//
// lblUnitPrice
//
this.lblUnitPrice.AutoSize = true;
this.lblUnitPrice.Location = new System.Drawing.Point(7, 65);
this.lblUnitPrice.Name = "lblUnitPrice";
this.lblUnitPrice.Size = new System.Drawing.Size(35, 13);
this.lblUnitPrice.TabIndex = 2;
this.lblUnitPrice.Text = "Fiyat :";
//
// lblStock
//
this.lblStock.AutoSize = true;
this.lblStock.Location = new System.Drawing.Point(406, 20);
this.lblStock.Name = "lblStock";
this.lblStock.Size = new System.Drawing.Size(65, 13);
this.lblStock.TabIndex = 3;
this.lblStock.Text = "Stok Adedi :";
//
// lblQuantityPerUnit
//
this.lblQuantityPerUnit.AutoSize = true;
this.lblQuantityPerUnit.Location = new System.Drawing.Point(406, 43);
this.lblQuantityPerUnit.Name = "lblQuantityPerUnit";
this.lblQuantityPerUnit.Size = new System.Drawing.Size(65, 13);
this.lblQuantityPerUnit.TabIndex = 4;
this.lblQuantityPerUnit.Text = "Birim Adedi :";
//
// tbxProductName2
//
this.tbxProductName2.Location = new System.Drawing.Point(91, 17);
this.tbxProductName2.Name = "tbxProductName2";
this.tbxProductName2.Size = new System.Drawing.Size(100, 20);
this.tbxProductName2.TabIndex = 5;
//
// cbxCategory2
//
this.cbxCategory2.FormattingEnabled = true;
this.cbxCategory2.Location = new System.Drawing.Point(91, 40);
this.cbxCategory2.Name = "cbxCategory2";
this.cbxCategory2.Size = new System.Drawing.Size(121, 21);
this.cbxCategory2.TabIndex = 6;
//
// tbxUnitPrice
//
this.tbxUnitPrice.Location = new System.Drawing.Point(91, 62);
this.tbxUnitPrice.Name = "tbxUnitPrice";
this.tbxUnitPrice.Size = new System.Drawing.Size(100, 20);
this.tbxUnitPrice.TabIndex = 7;
//
// tbxStock
//
this.tbxStock.Location = new System.Drawing.Point(477, 17);
this.tbxStock.Name = "tbxStock";
this.tbxStock.Size = new System.Drawing.Size(100, 20);
this.tbxStock.TabIndex = 8;
//
// tbxQuantityPerUnit
//
this.tbxQuantityPerUnit.Location = new System.Drawing.Point(477, 40);
this.tbxQuantityPerUnit.Name = "tbxQuantityPerUnit";
this.tbxQuantityPerUnit.Size = new System.Drawing.Size(100, 20);
this.tbxQuantityPerUnit.TabIndex = 9;
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(477, 80);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(100, 23);
this.btnAdd.TabIndex = 10;
this.btnAdd.Text = "Ekle";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// gbxProductUpdate
//
this.gbxProductUpdate.Controls.Add(this.btnRemove);
this.gbxProductUpdate.Controls.Add(this.btnUpdate);
this.gbxProductUpdate.Controls.Add(this.tbxQuantityPerUnitUpdate);
this.gbxProductUpdate.Controls.Add(this.tbxUnitsInStockUpdate);
this.gbxProductUpdate.Controls.Add(this.tbxUnitPriceUpdate);
this.gbxProductUpdate.Controls.Add(this.cbxCategoryIdUpdate);
this.gbxProductUpdate.Controls.Add(this.tbxUpdateProductName);
this.gbxProductUpdate.Controls.Add(this.label1);
this.gbxProductUpdate.Controls.Add(this.label2);
this.gbxProductUpdate.Controls.Add(this.label3);
this.gbxProductUpdate.Controls.Add(this.label4);
this.gbxProductUpdate.Controls.Add(this.label5);
this.gbxProductUpdate.Location = new System.Drawing.Point(13, 454);
this.gbxProductUpdate.Name = "gbxProductUpdate";
this.gbxProductUpdate.Size = new System.Drawing.Size(775, 112);
this.gbxProductUpdate.TabIndex = 4;
this.gbxProductUpdate.TabStop = false;
this.gbxProductUpdate.Text = "Ürün güncelle veya Sil";
//
// btnUpdate
//
this.btnUpdate.Location = new System.Drawing.Point(477, 80);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(100, 23);
this.btnUpdate.TabIndex = 10;
this.btnUpdate.Text = "Güncelle";
this.btnUpdate.UseVisualStyleBackColor = true;
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// tbxQuantityPerUnitUpdate
//
this.tbxQuantityPerUnitUpdate.Location = new System.Drawing.Point(477, 40);
this.tbxQuantityPerUnitUpdate.Name = "tbxQuantityPerUnitUpdate";
this.tbxQuantityPerUnitUpdate.Size = new System.Drawing.Size(100, 20);
this.tbxQuantityPerUnitUpdate.TabIndex = 9;
//
// tbxUnitsInStockUpdate
//
this.tbxUnitsInStockUpdate.Location = new System.Drawing.Point(477, 17);
this.tbxUnitsInStockUpdate.Name = "tbxUnitsInStockUpdate";
this.tbxUnitsInStockUpdate.Size = new System.Drawing.Size(100, 20);
this.tbxUnitsInStockUpdate.TabIndex = 8;
//
// tbxUnitPriceUpdate
//
this.tbxUnitPriceUpdate.Location = new System.Drawing.Point(91, 62);
this.tbxUnitPriceUpdate.Name = "tbxUnitPriceUpdate";
this.tbxUnitPriceUpdate.Size = new System.Drawing.Size(100, 20);
this.tbxUnitPriceUpdate.TabIndex = 7;
//
// cbxCategoryIdUpdate
//
this.cbxCategoryIdUpdate.FormattingEnabled = true;
this.cbxCategoryIdUpdate.Location = new System.Drawing.Point(91, 40);
this.cbxCategoryIdUpdate.Name = "cbxCategoryIdUpdate";
this.cbxCategoryIdUpdate.Size = new System.Drawing.Size(121, 21);
this.cbxCategoryIdUpdate.TabIndex = 6;
//
// tbxUpdateProductName
//
this.tbxUpdateProductName.Location = new System.Drawing.Point(91, 17);
this.tbxUpdateProductName.Name = "tbxUpdateProductName";
this.tbxUpdateProductName.Size = new System.Drawing.Size(100, 20);
this.tbxUpdateProductName.TabIndex = 5;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(406, 43);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 13);
this.label1.TabIndex = 4;
this.label1.Text = "Birim Adedi :";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(406, 20);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Stok Adedi :";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(7, 65);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Fiyat :";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 43);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 13);
this.label4.TabIndex = 1;
this.label4.Text = "Kategori : ";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(7, 20);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(57, 13);
this.label5.TabIndex = 0;
this.label5.Text = "Ürün Adı : ";
//
// btnRemove
//
this.btnRemove.Location = new System.Drawing.Point(694, 14);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(75, 23);
this.btnRemove.TabIndex = 11;
this.btnRemove.Text = "Sil";
this.btnRemove.UseVisualStyleBackColor = true;
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 571);
this.Controls.Add(this.gbxProductUpdate);
this.Controls.Add(this.gbxProductAdd);
this.Controls.Add(this.gbxProductName);
this.Controls.Add(this.gbxCategory);
this.Controls.Add(this.dgwProduct);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dgwProduct)).EndInit();
this.gbxCategory.ResumeLayout(false);
this.gbxCategory.PerformLayout();
this.gbxProductName.ResumeLayout(false);
this.gbxProductName.PerformLayout();
this.gbxProductAdd.ResumeLayout(false);
this.gbxProductAdd.PerformLayout();
this.gbxProductUpdate.ResumeLayout(false);
this.gbxProductUpdate.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dgwProduct;
private System.Windows.Forms.GroupBox gbxCategory;
private System.Windows.Forms.ComboBox cbxCategory;
private System.Windows.Forms.Label lblCategory;
private System.Windows.Forms.GroupBox gbxProductName;
private System.Windows.Forms.TextBox tbxProductName;
private System.Windows.Forms.Label lblProductName;
private System.Windows.Forms.GroupBox gbxProductAdd;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.TextBox tbxQuantityPerUnit;
private System.Windows.Forms.TextBox tbxStock;
private System.Windows.Forms.TextBox tbxUnitPrice;
private System.Windows.Forms.ComboBox cbxCategory2;
private System.Windows.Forms.TextBox tbxProductName2;
private System.Windows.Forms.Label lblQuantityPerUnit;
private System.Windows.Forms.Label lblStock;
private System.Windows.Forms.Label lblUnitPrice;
private System.Windows.Forms.Label lblCategoryID;
private System.Windows.Forms.Label lblProductName2;
private System.Windows.Forms.GroupBox gbxProductUpdate;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.TextBox tbxQuantityPerUnitUpdate;
private System.Windows.Forms.TextBox tbxUnitsInStockUpdate;
private System.Windows.Forms.TextBox tbxUnitPriceUpdate;
private System.Windows.Forms.ComboBox cbxCategoryIdUpdate;
private System.Windows.Forms.TextBox tbxUpdateProductName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btnRemove;
}
}
| 48.319444 | 128 | 0.600987 | [
"MIT"
] | ozguncan/NLayeredApp | NLayeredAppDemo/Nortwind.WebFormsUI/Form1.Designer.cs | 20,896 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.