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 Elastic.Xunit.XunitPlumbing; using Elasticsearch.Net; using FluentAssertions; using Nest; using Tests.Core.Client; using Tests.Domain; using Tests.Framework; using static Nest.Indices; namespace Tests.ClientConcepts.HighLevel.Inference { public class IndicesPaths : DocumentationTestBase { /**[[indices-paths]] * === Indices paths * * Some APIs in Elasticsearch take an index name, a collection of index names, * or the special `_all` marker (used to specify all indices), in the URI path of the request, to specify the indices that * the request should execute against. * * In NEST, these index names can be specified using the `Indices` type. * * ==== Implicit Conversion * * To make working with `Indices` easier, several types implicitly convert to it: * * - `string` * - comma separated `string` * - `string` array * - a CLR type, <<index-name-inference, where a default index name or index name for the type has been specified on `ConnectionSettings`>> * - `IndexName` * - `IndexName` array * * Here are some examples of how implicit conversions can be used to specify index names */ [U] public void ImplicitConversions() { Nest.Indices singleIndexFromString = "name"; Nest.Indices multipleIndicesFromString = "name1, name2"; Nest.Indices multipleIndicesFromStringArray = new [] { "name1", "name2" }; Nest.Indices allFromString = "_all"; Nest.Indices allWithOthersFromString = "_all, name2"; //<1> `_all` will override any specific index names here Nest.Indices singleIndexFromType = typeof(Project); //<2> The `Project` type has been mapped to a specific index name using <<index-name-type-mapping,`.DefaultMappingFor<Project>`>> Nest.Indices singleIndexFromIndexName = IndexName.From<Project>(); singleIndexFromString.Match( all => all.Should().BeNull(), many => many.Indices.Should().HaveCount(1).And.Contain("name") ); multipleIndicesFromString.Match( all => all.Should().BeNull(), many => many.Indices.Should().HaveCount(2).And.Contain("name2") ); allFromString.Match( all => all.Should().NotBeNull(), many => many.Indices.Should().BeNull() ); allWithOthersFromString.Match( all => all.Should().NotBeNull(), many => many.Indices.Should().BeNull() ); multipleIndicesFromStringArray.Match( all => all.Should().BeNull(), many => many.Indices.Should().HaveCount(2).And.Contain("name2") ); singleIndexFromType.Match( all => all.Should().BeNull(), many => many.Indices.Should().HaveCount(1).And.Contain(typeof(Project)) ); singleIndexFromIndexName.Match( all => all.Should().BeNull(), many => many.Indices.Should().HaveCount(1).And.Contain(typeof(Project)) ); } /** * [[nest-indices]] *==== Using Nest.Indices methods * To make creating `IndexName` or `Indices` instances easier, `Nest.Indices` also contains several static methods * that can be used to construct them. * *===== Single index * * A single index can be specified using a CLR type or a string, and the `.Index()` method. * * [TIP] * ==== * This example uses the static import `using static Nest.Indices;` in the using directives to shorthand `Nest.Indices.Index()` * to simply `Index()`. Be sure to include this static import if copying any of these examples. * ==== */ [U] public void UsingStaticPropertyField() { var client = TestClient.Default; var singleString = Index("name1"); // <1> specifying a single index using a string var singleTyped = Index<Project>(); //<2> specifying a single index using a type ISearchRequest singleStringRequest = new SearchDescriptor<Project>().Index(singleString); ISearchRequest singleTypedRequest = new SearchDescriptor<Project>().Index(singleTyped); ((IUrlParameter)singleStringRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("name1"); ((IUrlParameter)singleTypedRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("project"); var invalidSingleString = Index("name1, name2"); //<3> an **invalid** single index name } /**===== Multiple indices * * Similarly to a single index, multiple indices can be specified using multiple CLR types or multiple strings */ [U] public void MultipleIndices() { var manyStrings = Index("name1", "name2"); //<1> specifying multiple indices using strings var manyTypes = Index<Project>().And<Developer>(); //<2> specifying multiple indices using types var client = TestClient.Default; ISearchRequest manyStringRequest = new SearchDescriptor<Project>().Index(manyStrings); ISearchRequest manyTypedRequest = new SearchDescriptor<Project>().Index(manyTypes); ((IUrlParameter)manyStringRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("name1,name2"); ((IUrlParameter)manyTypedRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("project,devs"); // <3> The index names here come from the Connection Settings passed to `TestClient`. See the documentation on <<index-name-inference, Index Name Inference>> for more details. manyStringRequest = new SearchDescriptor<Project>().Index(new[] { "name1", "name2" }); ((IUrlParameter)manyStringRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("name1,name2"); } /**===== All Indices * * Elasticsearch allows searching across multiple indices using the special `_all` marker. * * NEST exposes the `_all` marker with `Indices.All` and `Indices.AllIndices`. Why expose it in two ways, you ask? * Well, you may be using both `Nest.Indices` and `Nest.Types` in the same file and you may also be using C#6 * static imports too; in this scenario, the `All` property becomes ambiguous between `Indices.All` and `Types.All`, so the * `_all` marker for indices is exposed as `Indices.AllIndices`, to alleviate this ambiguity */ [U] public void IndicesAllAndAllIndicesSpecifiedWhenUsingStaticUsingDirective() { var indicesAll = All; var allIndices = AllIndices; ISearchRequest indicesAllRequest = new SearchDescriptor<Project>().Index(indicesAll); ISearchRequest allIndicesRequest = new SearchDescriptor<Project>().Index(allIndices); ((IUrlParameter)indicesAllRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("_all"); ((IUrlParameter)allIndicesRequest.Index).GetString(this.Client.ConnectionSettings).Should().Be("_all"); } } }
40.099379
289
0.717162
[ "Apache-2.0" ]
591094733/elasticsearch-net
src/Tests/Tests/ClientConcepts/HighLevel/Inference/IndicesPaths.doc.cs
6,458
C#
using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading; using Foundation; using Toggl.Daneel.Cells; using Toggl.Daneel.Views; using Toggl.Foundation.MvvmCross.Collections; using Toggl.Multivac.Extensions; using UIKit; namespace Toggl.Daneel.ViewSources { public class ReactiveTableViewBinder<TModel, TCell> : IDisposable where TCell : BaseTableViewCell<TModel> { private readonly object animationLock = new object(); private CompositeDisposable disposeBag = new CompositeDisposable(); private ReactiveSectionedListTableViewSource<TModel, TCell> dataSource; private UITableView tableView; public ReactiveTableViewBinder(UITableView tableView, ReactiveSectionedListTableViewSource<TModel, TCell> dataSource) { this.tableView = tableView; this.dataSource = dataSource; tableView.Source = dataSource; dataSource.CollectionChanges .ObserveOn(SynchronizationContext.Current) .Subscribe(handleCollectionChanges) .DisposedBy(disposeBag); } public void handleCollectionChanges(IEnumerable<CollectionChange> changes) { lock (animationLock) { if (changes.Any(c => c.Type == CollectionChangeType.Reload)) { tableView.ReloadData(); return; } tableView.BeginUpdates(); foreach (var change in changes) { NSIndexPath indexPath = NSIndexPath.FromRowSection(change.Index.Row, change.Index.Section); NSIndexPath[] indexPaths = {indexPath}; NSMutableIndexSet indexSet = (NSMutableIndexSet) NSIndexSet.FromIndex(change.Index.Section).MutableCopy(); switch (change.Type) { case CollectionChangeType.AddRow: tableView.InsertRows(indexPaths, UITableViewRowAnimation.Automatic); break; case CollectionChangeType.RemoveRow: tableView.DeleteRows(indexPaths, UITableViewRowAnimation.Automatic); break; case CollectionChangeType.UpdateRow: tableView.ReloadRows(indexPaths, UITableViewRowAnimation.Automatic); break; case CollectionChangeType.MoveRow: if (change.OldIndex.HasValue) { NSIndexPath oldIndexPath = NSIndexPath.FromRowSection(change.OldIndex.Value.Row, change.OldIndex.Value.Section); tableView.MoveRow(oldIndexPath, indexPath); dataSource.RefreshHeader(tableView, change.OldIndex.Value.Section); } break; case CollectionChangeType.AddSection: tableView.InsertSections(indexSet, UITableViewRowAnimation.Automatic); break; case CollectionChangeType.RemoveSection: tableView.DeleteSections(indexSet, UITableViewRowAnimation.Automatic); break; } dataSource.RefreshHeader(tableView, change.Index.Section); } tableView.EndUpdates(); } } public void Dispose() { disposeBag?.Dispose(); dataSource?.Dispose(); tableView?.Dispose(); } } }
37.095238
144
0.56534
[ "BSD-3-Clause" ]
HectorRPC/Toggl2Excel
Toggl.Daneel/Extensions/Binders/ReactiveTableViewBinder.cs
3,897
C#
// Copyright (c) 2020-2021 Vladimir Popov zor1994@gmail.com https://github.com/ZorPastaman/Random-Generators using System; using System.Runtime.CompilerServices; using JetBrains.Annotations; namespace Zor.RandomGenerators.ContinuousDistributions { /// <summary> /// Exponential Random Generator using <see cref="WeibullDistribution.Generate(Func{float},float,float)"/>. /// </summary> public sealed class WeibullGeneratorFunc : IWeibullGenerator { [NotNull] private Func<float> m_iidFunc; private float m_alpha; private float m_beta; /// <summary> /// Creates a <see cref="WeibullGenerator"/> with the specified parameters. /// </summary> /// <param name="iidFunc"> /// Function that returns an independent and identically distributed random value in range [0, 1). /// </param> /// <param name="alpha">Shape. Must be non-zero.</param> /// <param name="beta">Scale.</param> public WeibullGeneratorFunc([NotNull] Func<float> iidFunc, float alpha, float beta) { m_iidFunc = iidFunc; m_alpha = alpha; m_beta = beta; } /// <summary> /// Copy constructor. /// </summary> /// <param name="other"></param> public WeibullGeneratorFunc([NotNull] WeibullGeneratorFunc other) { m_iidFunc = other.m_iidFunc; m_alpha = other.m_alpha; m_beta = other.m_beta; } /// <summary> /// Function that returns an independent and identically distributed random value in range [0, 1). /// </summary> [NotNull] public Func<float> iidFunc { [MethodImpl(MethodImplOptions.AggressiveInlining), Pure] get => m_iidFunc; [MethodImpl(MethodImplOptions.AggressiveInlining)] set => m_iidFunc = value; } /// <summary> /// Shape. Must be non-zero. /// </summary> public float alpha { [MethodImpl(MethodImplOptions.AggressiveInlining), Pure] get => m_alpha; [MethodImpl(MethodImplOptions.AggressiveInlining)] set => m_alpha = value; } /// <inheritdoc/> public float beta { [MethodImpl(MethodImplOptions.AggressiveInlining), Pure] get => m_beta; [MethodImpl(MethodImplOptions.AggressiveInlining)] set => m_beta = value; } /// <inheritdoc/> [MethodImpl(MethodImplOptions.AggressiveInlining), Pure] public float Generate() { return WeibullDistribution.Generate(m_iidFunc, m_alpha, m_beta); } } }
27.511905
109
0.698399
[ "MIT" ]
ZorPastaman/Random-Generators
Runtime/ContinuousDistributions/WeibullDistribution/Generators/WeibullGeneratorFunc.cs
2,313
C#
using System; namespace Rebalanser.Core { public class RebalanserException : Exception { public RebalanserException(string message) : base(message) { } public RebalanserException(string message, Exception ex) : base(message, ex) { } } }
16.3
64
0.564417
[ "MIT" ]
Rebalanser/rebalanser-net
src/Rebalanser.Core/RebalanserException.cs
328
C#
using System.Collections.Generic; using DynamodbTraining.V1.Controllers; using DynamodbTraining.V1.Infrastructure; using FluentAssertions; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Routing; using NUnit.Framework; using Xunit; namespace DynamodbTraining.Tests.V1.Controllers { public class BaseControllerTests { private BaseController _sut; private ControllerContext _controllerContext; private HttpContext _stubHttpContext; public BaseControllerTests() { _stubHttpContext = new DefaultHttpContext(); _controllerContext = new ControllerContext(new ActionContext(_stubHttpContext, new RouteData(), new ControllerActionDescriptor())); _sut = new BaseController(); _sut.ControllerContext = _controllerContext; } [Fact] public void GetCorrelationShouldThrowExceptionIfCorrelationHeaderUnavailable() { // Arrange + Act + Assert _sut.Invoking(x => x.GetCorrelationId()) .Should().Throw<KeyNotFoundException>() .WithMessage("Request is missing a correlationId"); } [Fact] public void GetCorrelationShouldReturnCorrelationIdWhenExists() { // Arrange _stubHttpContext.Request.Headers.Add(Constants.CorrelationId, "123"); // Act var result = _sut.GetCorrelationId(); // Assert result.Should().BeEquivalentTo("123"); } } }
31
143
0.665012
[ "MIT" ]
LBHackney-IT/dynamodb-training
DynamodbTraining.Tests/V1/Controllers/BaseControllerTests.cs
1,612
C#
using Duende.IdentityServer; using Duende.IdentityServer.Models; namespace IdentityServer; public static class Config { public static IEnumerable<IdentityResource> IdentityResources => new IdentityResource[] { new IdentityResources.OpenId(), new IdentityResources.Email(), }; public static IEnumerable<ApiScope> ApiScopes => Array.Empty<ApiScope>(); public static IEnumerable<Client> Clients => new[] { new Client { ClientId = "spa", RequireClientSecret = false, AllowedGrantTypes = GrantTypes.Code, AllowedCorsOrigins = { "http://localhost:2001" }, PostLogoutRedirectUris = { "http://localhost:2001/logged-out" }, RedirectUris = { "http://localhost:2001/success-auth" }, AllowOfflineAccess = true, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Email, IdentityServerConstants.StandardScopes.OfflineAccess } }, }; }
29.780488
80
0.567568
[ "MIT" ]
GUPY-Team/ITF
server/Services/Identity/IdentityServer/Config.cs
1,223
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using Microsoft.Win32; using MyCathedra.Controls.Tile; using MyCathedra.DataManager; using FileInfo = MyCathedra.FileManager.FileInfo; namespace MyCathedra { public partial class MainWindow { private readonly FileManager.FileManager _fileManager; private readonly DbManager _dbManager; private readonly PasswordService _passwordService; private Guid _userId; private string _currentPath; private string _search; private string TitlePath { get => _currentPath; set { _search = null; Title = $"Путь: {value}".Replace('\\', '/'); _currentPath = value; } } public MainWindow() { _passwordService = new PasswordService(); _search = null; _fileManager = new FileManager.FileManager(); _dbManager = new DbManager(_passwordService); InitializeComponent(); Autorization(); InitWindow(); } private void Autorization() { var autoBox = new AutoBox(_dbManager, _passwordService); if (autoBox.ShowDialog() == false) Application.Current.Shutdown(); _userId = autoBox.UserId; } private void InitWindow() { var directories = _fileManager.GetBaseDirectories(); foreach (var directory in directories) { var stackPanel = CreateStackPanel(); foreach (var directoryChildren in _fileManager.GetChildren(directory)) { var item = GetNewItem(directoryChildren.Name, TileMenuItem_Click); stackPanel.Children.Add(item); } AddExpander(stackPanel, directory); } } private void AddExpander(StackPanel stackPanel, string header) { var menuItem = GetNewItem("Добавить", AddMenuItem_Click, false); stackPanel.Children.Add(menuItem); var contextMenu = new ContextMenu(); var item = new MenuItem { Header = "Переименовать" }; item.Click += RenameBaseFolder; contextMenu.Items.Add(item); item = new MenuItem { Header = "Удалить" }; item.Click += DeleteBaseFolder; contextMenu.Items.Add(item); var element = new Expander { Content = stackPanel, Header = header, Margin = new Thickness(0.8), FontSize = 17, FontWeight = FontWeights.DemiBold, ContextMenu = contextMenu }; element.Expanded += Expander_Expanded; BasePanal.Children.Add(element); } private static StackPanel CreateStackPanel() { return new StackPanel {Background = new BrushConverter().ConvertFrom("#FFE5E5E5") as Brush}; } private void AddMenuItem_Click(object sender, RoutedEventArgs e) { var inputBox = new InputBox("Введите имя:"); if (inputBox.ShowDialog() != true) return; var tileMenuItem = sender as TileMenuItem; var stackPanel = tileMenuItem?.Parent as StackPanel; var expander = stackPanel?.Parent as Expander; var header = expander?.Header.ToString(); if (header == null) return; var answer = inputBox.Answer; _fileManager.CreateFolder(header, answer); var item = GetNewItem(answer, TileMenuItem_Click); stackPanel.Children.Insert(stackPanel.Children.Count - 1, item); } private void AddBaseFolder_Click(object sender, RoutedEventArgs e) { var inputBox = new InputBox("Введите имя:"); if (inputBox.ShowDialog() != true) return; var answer = inputBox.Answer; _fileManager.CreateFolder(answer, string.Empty); var stackPanel = CreateStackPanel(); AddExpander(stackPanel, answer); } private TileMenuItem GetNewItem(string title, RoutedEventHandler action, bool isContextMenu = true) { RoutedEventHandler delete = null; RoutedEventHandler rename = null; if (isContextMenu) { delete = DeleteTileMenu; rename = RenameTileMenu; } var item = new TileMenuItem(rename, delete) { Text = title, Style = FindResource("TileMenuItem") as Style, FontSize = 15 }; item.Click += action; return item; } private void DeleteBaseFolder(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; var contextMenu = menuItem?.Parent as ContextMenu; var expander = contextMenu?.PlacementTarget as Expander; var header = expander?.Header.ToString(); if (header == null) return; _fileManager.DeleteFolder(header); BasePanal.Children.Remove(expander); } private void RenameBaseFolder(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; var contextMenu = menuItem?.Parent as ContextMenu; var expander = contextMenu?.PlacementTarget as Expander; var header = expander?.Header.ToString(); if (header == null) return; var inputBox = new InputBox("Введите имя:", header); if (inputBox.ShowDialog() != true) return; var answer = inputBox.Answer; _fileManager.MoveFolder(header, answer); expander.Header = answer; } private void DeleteTileMenu(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; var contextMenu = menuItem?.Parent as ContextMenu; var tileMenuItem = contextMenu?.PlacementTarget as TileMenuItem; var stackPanel = tileMenuItem?.Parent as StackPanel; var expander = stackPanel?.Parent as Expander; var header = expander?.Header.ToString(); if (header == null) return; _fileManager.DeleteFolder($"{header}/{tileMenuItem.Text}"); stackPanel.Children.Remove(tileMenuItem); } private void RenameTileMenu(object sender, RoutedEventArgs e) { var menuItem = sender as MenuItem; var contextMenu = menuItem?.Parent as ContextMenu; var tileMenuItem = contextMenu?.PlacementTarget as TileMenuItem; var stackPanel = tileMenuItem?.Parent as StackPanel; var expander = stackPanel?.Parent as Expander; var header = expander?.Header.ToString(); if (header == null) return; var inputBox = new InputBox("Введите имя:", tileMenuItem.Text); if (inputBox.ShowDialog() != true) return; var newName = _fileManager.MoveFolder($"{header}/{tileMenuItem.Text}", inputBox.Answer); tileMenuItem.Text = newName; } private void Expander_Expanded(object sender, RoutedEventArgs e) { var currentExpander = sender as Expander; foreach (var children in BasePanal.Children) { if (children is Expander expander && expander.Header.ToString() != currentExpander?.Header.ToString()) { expander.IsExpanded = false; } } } private void TileMenuItem_Click(object sender, RoutedEventArgs e) { var tileMenuItem = sender as TileMenuItem; var stackPanel = tileMenuItem?.Parent as StackPanel; var expander = stackPanel?.Parent as Expander; var header = expander?.Header.ToString(); var path = $"{header}/{tileMenuItem?.Text}"; TitlePath = path; var fileInfos = _fileManager.GetChildren(path); DataGridUpdate(fileInfos); } private async void Row_DoubleClick(object sender, MouseButtonEventArgs e) { var row = sender as DataGridRow; if (!(row?.Item is FileInfo rowItem)) return; if (rowItem.IsFle) { var isOpen = _fileManager.OpenFile(rowItem); if (isOpen) await _dbManager.InsertActivity(_userId, rowItem.Path, ActivityType.Open); } else { TitlePath = rowItem.Path; var fileInfos = _fileManager.GetChildren(rowItem.Path); DataGridUpdate(fileInfos); } } private void Back(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(TitlePath)) return; IEnumerable<FileInfo> fileInfos; if (_search != null) { _search = null; fileInfos = _fileManager.GetChildren(TitlePath); } else { var path = _fileManager.GetParentPath(TitlePath); if (string.IsNullOrWhiteSpace(path)) return; TitlePath = path; fileInfos = _fileManager.GetChildren(path); } DataGridUpdate(fileInfos); } private void Duplicate(object sender, RoutedEventArgs e) { if (!(DataGrid.CurrentItem is FileInfo fileInfo)) return; var inputBox = new InputBox("Новое имя", fileInfo.Name); if (inputBox.ShowDialog() != true || inputBox.Answer == fileInfo.Name) return; _fileManager.Duplicate(fileInfo, inputBox.Answer, _dbManager, _userId); DataGridUpdate(); } private async void Rename(object sender, RoutedEventArgs e) { if (!(DataGrid.CurrentItem is FileInfo fileInfo)) return; var inputBox = new InputBox("Переименовать?", fileInfo.Name); if (inputBox.ShowDialog() != true) return; var newPath = _fileManager.Move(fileInfo, inputBox.Answer); if (fileInfo.IsFle) await _dbManager.InsertActivity(_userId, fileInfo.Path, ActivityType.Rename, newPath); DataGridUpdate(); } private void CreateFolder(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(TitlePath)) return; var inputBox = new InputBox("Имя папки"); if (inputBox.ShowDialog() != true) return; _fileManager.CreateFolder(TitlePath, inputBox.Answer); DataGridUpdate(); } private void Delete(object sender, RoutedEventArgs e) { if (!(DataGrid.CurrentItem is FileInfo fileInfo)) return; var messageBoxResult = MessageBox.Show($@"Удалить ""{fileInfo.Name}""?", "Удаление!", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (messageBoxResult != MessageBoxResult.Yes) return; _fileManager.Delete(fileInfo, _dbManager, _userId); // _dbManager.InsertActivity(_userId, fileInfo.Path, ActivityType.Delete); DataGridUpdate(); } private async void Add(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(TitlePath)) return; var fileDialog = new OpenFileDialog { InitialDirectory = "c:\\", Multiselect = false, Filter = "Документы |*.doc;*.xls;*.ppt;*.txt;*.pdf;*.docx | Все файлы (*.*)|*.*", RestoreDirectory = true }; var showDialog = fileDialog.ShowDialog(); if (showDialog == null || !showDialog.Value) return; var file = fileDialog.FileName; await AddFile(file); // var path = _fileManager.AddFile(file, TitlePath); // await _dbManager.InsertActivity(_userId, path, ActivityType.Create); DataGridUpdate(); } private async void DataGrid_Drop(object sender, DragEventArgs e) { if (string.IsNullOrWhiteSpace(TitlePath)) return; if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return; var files = (string[]) e.Data.GetData(DataFormats.FileDrop); if (files == null || !files.Any()) return; foreach (var file in files) { await AddFile(file); } DataGridUpdate(); } private async Task AddFile(string file) { try { var filePath = _fileManager.AddFile(file, TitlePath); await _dbManager.InsertActivity(_userId, filePath, ActivityType.Create); } catch (IOException) { MessageBox.Show($@"Файл ""{file}"" уже существует.", "Файл уже существует.", MessageBoxButton.OK, MessageBoxImage.Error); } } private void Search(object sender, RoutedEventArgs e) { var searcText = SearcText.Text; _search = searcText; DataGridUpdate(); } private void DataGridUpdate() { IEnumerable<FileInfo> fileInfos; if (_search != null) { var isAll = SearcCb.IsChecked != null && SearcCb.IsChecked.Value; var path = string.IsNullOrWhiteSpace(TitlePath) || isAll ? string.Empty //поиск в негде : TitlePath; fileInfos = _fileManager.Search(path, _search); } else { fileInfos = _fileManager.GetChildren(TitlePath); } DataGridUpdate(fileInfos); } private async void DataGridUpdate(IEnumerable<FileInfo> fileInfos) { fileInfos = fileInfos.ToArray(); var paths = fileInfos.Select(f => f.Path).ToArray(); var userActivities = await _dbManager.GetUserActivity(paths); fileInfos = fileInfos.Select(f => { f.ShowPath = f.Path.Replace('\\', '/'); var activity = userActivities.SingleOrDefault(a => a.Path == f.ShowPath); if (activity != null) { f.UserName = activity.UserName; f.UpdateUtc = (f.UpdateUtc > activity.Data ? f.UpdateUtc : activity.Data).ToLocalTime(); } return f; }); DataGrid.ItemsSource = fileInfos; } private void LogShow(object sender, RoutedEventArgs e) { var logForm = new LogForm(_dbManager); logForm.Show(); } private void LogOut(object sender, RoutedEventArgs e) { Autorization(); } } }
34.72912
118
0.559246
[ "Apache-2.0" ]
Milochka69/MyCathedra
MyCathedra/MainWindow.xaml.cs
15,565
C#
using Prism.Events; namespace Sandbox.Events { public class MessageSentEvent : PrismEvent<string> { } }
13.111111
54
0.686441
[ "Apache-2.0" ]
drcarver/prism
Samples/Sandbox/Sandbox/Sandbox/Events/MessageSentEvent.cs
120
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.EntityFrameworkCore.Query { public class GearsOfWarFromSqlQuerySqliteTest : GearsOfWarFromSqlQueryTestBase<GearsOfWarQuerySqliteFixture> { public GearsOfWarFromSqlQuerySqliteTest(GearsOfWarQuerySqliteFixture fixture) : base(fixture) { } } }
31.928571
112
0.742729
[ "MIT" ]
CameronAavik/efcore
test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarFromSqlQuerySqliteTest.cs
447
C#
using Microsoft.EntityFrameworkCore.Migrations; namespace BookSiteAPI.Migrations { public partial class OrderUpdateCreate2 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<int>( name: "BookId", table: "Order", nullable: false, oldClrType: typeof(string), oldType: "nvarchar(max)"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn<string>( name: "BookId", table: "Order", type: "nvarchar(max)", nullable: false, oldClrType: typeof(int)); } } }
28.464286
71
0.543287
[ "MIT" ]
faisalkhan91/BookWebStore
BookSiteAPI/BookSiteAPI/Migrations/20200106162448_OrderUpdateCreate2.cs
799
C#
using EasyDeploy.Core.Model; using System; using System.Windows; using System.Windows.Controls; namespace EasyDeploy.GUI.Selector { public class DeployActionTemplateSelector : DataTemplateSelector { public DataTemplate CopyFileDeployActionTemplate { get; set; } public DataTemplate RemoveFileDeployActionTemplate { get; set; } public DataTemplate ExecuteFileDeployActionTemplate { get; set; } public DataTemplate UnzipDeployActionTemplate { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (item is CopyFileDeployAction) { return CopyFileDeployActionTemplate; } else if (item is RemoveFileDeployAction) { return RemoveFileDeployActionTemplate; } else if (item is ExecuteFileDeployAction) { return ExecuteFileDeployActionTemplate; } else if (item is UnzipDeployAction) { return UnzipDeployActionTemplate; } if (item != null) { throw new ArgumentException($"Unknown deploy action type {item.GetType()}"); } return base.SelectTemplate(item, container); } } }
29.5
92
0.606485
[ "MIT" ]
frostieDE/easy-deploy
EasyDeploy.GUI/Selector/DeployActionTemplateSelector.cs
1,359
C#
namespace Kinetix.Search.Model { /// <summary> /// Facette de portefeuille. /// </summary> public class PortfolioFacet : BooleanFacet { } }
18.888889
49
0.582353
[ "Apache-2.0" ]
KleeGroup/kinetix
Kinetix/Kinetix.Search/Model/PortfolioFacet.cs
172
C#
using GroupDocs.Search.Options; using GroupDocs.Search.Results; namespace GroupDocs.Search.Examples.CSharp.AdvancedUsage.Indexing { class StoringTextOfIndexedDocuments { public static void Run() { string indexFolder = @".\AdvancedUsage\Indexing\StoringTextOfIndexedDocuments"; string documentsFolder = Utils.DocumentsPath; // Creating an index settings instance IndexSettings settings = new IndexSettings(); settings.TextStorageSettings = new TextStorageSettings(Compression.High); // Setting high compression ratio for the index text storage // Creating an index in the specified folder Index index = new Index(indexFolder, settings); // Indexing documents index.Add(documentsFolder); // Now the index contains the text of all indexed documents, // so the operations of getting the text of documents and highlighting occurrences are faster. // Searching string query = "Lorem"; SearchResult result = index.Search(query); Utils.TraceResult(query, result); } } }
34.882353
146
0.653457
[ "MIT" ]
groupdocs-search/GroupDocs.Search-for-.NET
Examples/GroupDocs.Search.Examples.CSharp/AdvancedUsage/Indexing/StoringTextOfIndexedDocuments.cs
1,188
C#
using System; using System.ComponentModel; using EfsTools.Attributes; using EfsTools.Utils; using Newtonsoft.Json; namespace EfsTools.Items.Nv { [Serializable] [NvItemId(2527)] [Attributes(9)] public class GsmAmamMasterTblSeg7F1 { [ElementsCount(64)] [ElementType("uint16")] [Description("")] public ushort[] Value { get; set; } } }
19.952381
44
0.606205
[ "MIT" ]
HomerSp/EfsTools
EfsTools/Items/Nv/GsmAmamMasterTblSeg7F1I.cs
419
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 Xunit; namespace System.Composition.AttributeModel.Tests { public class PartNotDiscoverableAttributeTests { [Fact] public void Ctor_Default() { var attribute = new PartNotDiscoverableAttribute(); Assert.Equal(typeof(PartNotDiscoverableAttribute), attribute.TypeId); } } }
29.052632
81
0.695652
[ "MIT" ]
06needhamt/runtime
src/libraries/System.Composition.AttributedModel/tests/PartNotDiscoverableAttributeTests.cs
554
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class tcg : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } }
15.157895
52
0.614583
[ "MIT" ]
zfy1045056938/THDN_Script
SHENSHAN/tcg.cs
290
C#
namespace MoreMatchTypes { partial class EliminationForm { /// <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.groupBox2 = new System.Windows.Forms.GroupBox(); this.el_redControl = new System.Windows.Forms.CheckBox(); this.el_redTeamName = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.el_removeAllRed = new System.Windows.Forms.Button(); this.el_removeOneRed = new System.Windows.Forms.Button(); this.el_redList = new System.Windows.Forms.ListBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.el_blueControl = new System.Windows.Forms.CheckBox(); this.el_blueTeamName = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.el_removeOneBlue = new System.Windows.Forms.Button(); this.el_removeAllBlue = new System.Windows.Forms.Button(); this.el_blueList = new System.Windows.Forms.ListBox(); this.panel1 = new System.Windows.Forms.Panel(); this.el_addBtn = new System.Windows.Forms.Button(); this.el_refresh = new System.Windows.Forms.Button(); this.rb_allRed = new System.Windows.Forms.RadioButton(); this.rb_allBlue = new System.Windows.Forms.RadioButton(); this.rb_singleRed = new System.Windows.Forms.RadioButton(); this.rb_singleBlue = new System.Windows.Forms.RadioButton(); this.label3 = new System.Windows.Forms.Label(); this.el_resultList = new System.Windows.Forms.ComboBox(); this.el_promotionList = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.el_searchBtn = new System.Windows.Forms.Button(); this.el_searchInput = new System.Windows.Forms.TextBox(); this.panel3 = new System.Windows.Forms.Panel(); this.el_refereeList = new System.Windows.Forms.ComboBox(); this.btn_matchStart = new System.Windows.Forms.Button(); this.label11 = new System.Windows.Forms.Label(); this.el_difficulty = new System.Windows.Forms.ComboBox(); this.el_venueList = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.el_bgm = new System.Windows.Forms.ComboBox(); this.el_ringList = new System.Windows.Forms.ComboBox(); this.el_gameSpeed = new System.Windows.Forms.ComboBox(); this.label9 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.formClose = new System.Windows.Forms.Button(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // groupBox2 // this.groupBox2.Controls.Add(this.el_redControl); this.groupBox2.Controls.Add(this.el_redTeamName); this.groupBox2.Controls.Add(this.label5); this.groupBox2.Controls.Add(this.el_removeAllRed); this.groupBox2.Controls.Add(this.el_removeOneRed); this.groupBox2.Controls.Add(this.el_redList); this.groupBox2.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox2.Location = new System.Drawing.Point(431, 217); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(417, 268); this.groupBox2.TabIndex = 24; this.groupBox2.TabStop = false; this.groupBox2.Text = "Red Team"; // // el_redControl // this.el_redControl.AutoSize = true; this.el_redControl.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_redControl.Location = new System.Drawing.Point(124, 16); this.el_redControl.Name = "el_redControl"; this.el_redControl.Size = new System.Drawing.Size(101, 19); this.el_redControl.TabIndex = 5; this.el_redControl.Text = "Player Control?"; this.el_redControl.UseVisualStyleBackColor = true; this.el_redControl.Visible = false; // // el_redTeamName // this.el_redTeamName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.el_redTeamName.Location = new System.Drawing.Point(6, 36); this.el_redTeamName.Name = "el_redTeamName"; this.el_redTeamName.Size = new System.Drawing.Size(407, 20); this.el_redTeamName.TabIndex = 4; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point(7, 20); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(99, 15); this.label5.TabIndex = 3; this.label5.Text = "Red Team Name"; // // el_removeAllRed // this.el_removeAllRed.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_removeAllRed.Location = new System.Drawing.Point(241, 235); this.el_removeAllRed.Name = "el_removeAllRed"; this.el_removeAllRed.Size = new System.Drawing.Size(163, 23); this.el_removeAllRed.TabIndex = 2; this.el_removeAllRed.Text = "Remove All"; this.el_removeAllRed.UseVisualStyleBackColor = true; this.el_removeAllRed.Click += new System.EventHandler(this.el_removeAllRed_Click); // // el_removeOneRed // this.el_removeOneRed.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_removeOneRed.Location = new System.Drawing.Point(6, 235); this.el_removeOneRed.Name = "el_removeOneRed"; this.el_removeOneRed.Size = new System.Drawing.Size(161, 23); this.el_removeOneRed.TabIndex = 1; this.el_removeOneRed.Text = "Remove Selected"; this.el_removeOneRed.UseVisualStyleBackColor = true; this.el_removeOneRed.Click += new System.EventHandler(this.el_removeOneRed_Click); // // el_redList // this.el_redList.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_redList.FormattingEnabled = true; this.el_redList.Location = new System.Drawing.Point(6, 69); this.el_redList.Name = "el_redList"; this.el_redList.ScrollAlwaysVisible = true; this.el_redList.Size = new System.Drawing.Size(415, 160); this.el_redList.TabIndex = 0; // // groupBox1 // this.groupBox1.Controls.Add(this.el_blueControl); this.groupBox1.Controls.Add(this.el_blueTeamName); this.groupBox1.Controls.Add(this.label4); this.groupBox1.Controls.Add(this.el_removeOneBlue); this.groupBox1.Controls.Add(this.el_removeAllBlue); this.groupBox1.Controls.Add(this.el_blueList); this.groupBox1.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.Location = new System.Drawing.Point(22, 217); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(384, 268); this.groupBox1.TabIndex = 23; this.groupBox1.TabStop = false; this.groupBox1.Text = "Blue Team"; // // el_blueControl // this.el_blueControl.AutoSize = true; this.el_blueControl.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_blueControl.Location = new System.Drawing.Point(130, 16); this.el_blueControl.Name = "el_blueControl"; this.el_blueControl.Size = new System.Drawing.Size(101, 19); this.el_blueControl.TabIndex = 15; this.el_blueControl.Text = "Player Control?"; this.el_blueControl.UseVisualStyleBackColor = true; this.el_blueControl.Visible = false; // // el_blueTeamName // this.el_blueTeamName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.el_blueTeamName.Location = new System.Drawing.Point(11, 37); this.el_blueTeamName.Name = "el_blueTeamName"; this.el_blueTeamName.Size = new System.Drawing.Size(367, 20); this.el_blueTeamName.TabIndex = 14; // // label4 // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point(7, 20); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(103, 15); this.label4.TabIndex = 13; this.label4.Text = "Blue Team Name"; // // el_removeOneBlue // this.el_removeOneBlue.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_removeOneBlue.Location = new System.Drawing.Point(11, 236); this.el_removeOneBlue.Name = "el_removeOneBlue"; this.el_removeOneBlue.Size = new System.Drawing.Size(130, 23); this.el_removeOneBlue.TabIndex = 1; this.el_removeOneBlue.Text = "Remove Selected"; this.el_removeOneBlue.UseVisualStyleBackColor = true; this.el_removeOneBlue.Click += new System.EventHandler(this.el_removeOneBlue_Click); // // el_removeAllBlue // this.el_removeAllBlue.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_removeAllBlue.Location = new System.Drawing.Point(218, 236); this.el_removeAllBlue.Name = "el_removeAllBlue"; this.el_removeAllBlue.Size = new System.Drawing.Size(160, 23); this.el_removeAllBlue.TabIndex = 12; this.el_removeAllBlue.Text = "Remove All"; this.el_removeAllBlue.UseVisualStyleBackColor = true; this.el_removeAllBlue.Click += new System.EventHandler(this.el_removeAllBlue_Click); // // el_blueList // this.el_blueList.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_blueList.FormattingEnabled = true; this.el_blueList.Location = new System.Drawing.Point(7, 68); this.el_blueList.Name = "el_blueList"; this.el_blueList.ScrollAlwaysVisible = true; this.el_blueList.Size = new System.Drawing.Size(371, 160); this.el_blueList.TabIndex = 0; // // panel1 // this.panel1.Controls.Add(this.el_addBtn); this.panel1.Controls.Add(this.el_refresh); this.panel1.Controls.Add(this.rb_allRed); this.panel1.Controls.Add(this.rb_allBlue); this.panel1.Controls.Add(this.rb_singleRed); this.panel1.Controls.Add(this.rb_singleBlue); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.el_resultList); this.panel1.Controls.Add(this.el_promotionList); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.el_searchBtn); this.panel1.Controls.Add(this.el_searchInput); this.panel1.Location = new System.Drawing.Point(20, 77); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(828, 119); this.panel1.TabIndex = 22; // // el_addBtn // this.el_addBtn.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_addBtn.Location = new System.Drawing.Point(741, 87); this.el_addBtn.Name = "el_addBtn"; this.el_addBtn.Size = new System.Drawing.Size(75, 23); this.el_addBtn.TabIndex = 13; this.el_addBtn.Text = "Add"; this.el_addBtn.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.el_addBtn.UseVisualStyleBackColor = true; this.el_addBtn.Click += new System.EventHandler(this.el_addBtn_Click); // // el_refresh // this.el_refresh.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_refresh.Location = new System.Drawing.Point(741, 57); this.el_refresh.Name = "el_refresh"; this.el_refresh.Size = new System.Drawing.Size(75, 23); this.el_refresh.TabIndex = 11; this.el_refresh.Text = "Refresh"; this.el_refresh.UseVisualStyleBackColor = true; this.el_refresh.Click += new System.EventHandler(this.el_refresh_Click); // // rb_allRed // this.rb_allRed.AutoSize = true; this.rb_allRed.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rb_allRed.Location = new System.Drawing.Point(536, 80); this.rb_allRed.Name = "rb_allRed"; this.rb_allRed.Size = new System.Drawing.Size(156, 19); this.rb_allRed.TabIndex = 10; this.rb_allRed.TabStop = true; this.rb_allRed.Text = "Add All Results (Red Team)"; this.rb_allRed.UseVisualStyleBackColor = true; // // rb_allBlue // this.rb_allBlue.AutoSize = true; this.rb_allBlue.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rb_allBlue.Location = new System.Drawing.Point(536, 56); this.rb_allBlue.Name = "rb_allBlue"; this.rb_allBlue.Size = new System.Drawing.Size(159, 19); this.rb_allBlue.TabIndex = 9; this.rb_allBlue.TabStop = true; this.rb_allBlue.Text = "Add All Results (Blue Team)"; this.rb_allBlue.UseVisualStyleBackColor = true; // // rb_singleRed // this.rb_singleRed.AutoSize = true; this.rb_singleRed.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rb_singleRed.Location = new System.Drawing.Point(362, 79); this.rb_singleRed.Name = "rb_singleRed"; this.rb_singleRed.Size = new System.Drawing.Size(168, 19); this.rb_singleRed.TabIndex = 8; this.rb_singleRed.TabStop = true; this.rb_singleRed.Text = "Add Single Result (Red Team)"; this.rb_singleRed.UseVisualStyleBackColor = true; // // rb_singleBlue // this.rb_singleBlue.AutoSize = true; this.rb_singleBlue.Checked = true; this.rb_singleBlue.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rb_singleBlue.Location = new System.Drawing.Point(361, 56); this.rb_singleBlue.Name = "rb_singleBlue"; this.rb_singleBlue.Size = new System.Drawing.Size(171, 19); this.rb_singleBlue.TabIndex = 7; this.rb_singleBlue.TabStop = true; this.rb_singleBlue.Text = "Add Single Result (Blue Team)"; this.rb_singleBlue.UseVisualStyleBackColor = true; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.Location = new System.Drawing.Point(3, 53); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(93, 15); this.label3.TabIndex = 6; this.label3.Text = "Search Results"; // // el_resultList // this.el_resultList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_resultList.FormattingEnabled = true; this.el_resultList.Location = new System.Drawing.Point(6, 72); this.el_resultList.Name = "el_resultList"; this.el_resultList.Size = new System.Drawing.Size(336, 21); this.el_resultList.Sorted = true; this.el_resultList.TabIndex = 5; // // el_promotionList // this.el_promotionList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_promotionList.FormattingEnabled = true; this.el_promotionList.Location = new System.Drawing.Point(361, 27); this.el_promotionList.Name = "el_promotionList"; this.el_promotionList.Size = new System.Drawing.Size(374, 21); this.el_promotionList.Sorted = true; this.el_promotionList.TabIndex = 4; this.el_promotionList.SelectedIndexChanged += new System.EventHandler(this.el_promotionList_SelectedIndexChanged); // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(358, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(92, 15); this.label2.TabIndex = 3; this.label2.Text = "Promotion List"; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(3, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(99, 15); this.label1.TabIndex = 2; this.label1.Text = "Wrestler Search"; // // el_searchBtn // this.el_searchBtn.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.el_searchBtn.Location = new System.Drawing.Point(741, 27); this.el_searchBtn.Name = "el_searchBtn"; this.el_searchBtn.Size = new System.Drawing.Size(75, 23); this.el_searchBtn.TabIndex = 1; this.el_searchBtn.Text = "Search"; this.el_searchBtn.UseVisualStyleBackColor = true; this.el_searchBtn.Click += new System.EventHandler(this.el_searchBtn_Click); // // el_searchInput // this.el_searchInput.Location = new System.Drawing.Point(6, 27); this.el_searchInput.Name = "el_searchInput"; this.el_searchInput.Size = new System.Drawing.Size(336, 20); this.el_searchInput.TabIndex = 0; // // panel3 // this.panel3.Controls.Add(this.el_refereeList); this.panel3.Controls.Add(this.btn_matchStart); this.panel3.Controls.Add(this.label11); this.panel3.Controls.Add(this.el_difficulty); this.panel3.Controls.Add(this.el_venueList); this.panel3.Controls.Add(this.label10); this.panel3.Controls.Add(this.label7); this.panel3.Controls.Add(this.el_bgm); this.panel3.Controls.Add(this.el_ringList); this.panel3.Controls.Add(this.el_gameSpeed); this.panel3.Controls.Add(this.label9); this.panel3.Controls.Add(this.label8); this.panel3.Location = new System.Drawing.Point(22, 12); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(826, 41); this.panel3.TabIndex = 21; // // el_refereeList // this.el_refereeList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_refereeList.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.el_refereeList.FormattingEnabled = true; this.el_refereeList.Location = new System.Drawing.Point(4, 17); this.el_refereeList.Name = "el_refereeList"; this.el_refereeList.Size = new System.Drawing.Size(120, 21); this.el_refereeList.TabIndex = 8; // // btn_matchStart // this.btn_matchStart.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btn_matchStart.Location = new System.Drawing.Point(740, 15); this.btn_matchStart.Name = "btn_matchStart"; this.btn_matchStart.Size = new System.Drawing.Size(75, 23); this.btn_matchStart.TabIndex = 7; this.btn_matchStart.Text = "Play"; this.btn_matchStart.UseVisualStyleBackColor = true; this.btn_matchStart.Click += new System.EventHandler(this.btn_matchStart_Click); // // label11 // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label11.Location = new System.Drawing.Point(691, -3); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(59, 15); this.label11.TabIndex = 18; this.label11.Text = "Difficulty"; // // el_difficulty // this.el_difficulty.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_difficulty.FormattingEnabled = true; this.el_difficulty.Location = new System.Drawing.Point(691, 17); this.el_difficulty.Name = "el_difficulty"; this.el_difficulty.Size = new System.Drawing.Size(43, 21); this.el_difficulty.TabIndex = 19; // // el_venueList // this.el_venueList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_venueList.FormattingEnabled = true; this.el_venueList.Location = new System.Drawing.Point(130, 17); this.el_venueList.Name = "el_venueList"; this.el_venueList.Size = new System.Drawing.Size(120, 21); this.el_venueList.TabIndex = 9; // // label10 // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label10.Location = new System.Drawing.Point(464, -3); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(72, 15); this.label10.TabIndex = 17; this.label10.Text = "Match BGM"; // // label7 // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label7.Location = new System.Drawing.Point(153, -3); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(42, 15); this.label7.TabIndex = 12; this.label7.Text = "Venue"; // // el_bgm // this.el_bgm.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_bgm.FormattingEnabled = true; this.el_bgm.Location = new System.Drawing.Point(462, 17); this.el_bgm.Name = "el_bgm"; this.el_bgm.Size = new System.Drawing.Size(223, 21); this.el_bgm.TabIndex = 16; // // el_ringList // this.el_ringList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_ringList.FormattingEnabled = true; this.el_ringList.Location = new System.Drawing.Point(255, 17); this.el_ringList.Name = "el_ringList"; this.el_ringList.Size = new System.Drawing.Size(144, 21); this.el_ringList.TabIndex = 10; // // el_gameSpeed // this.el_gameSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.el_gameSpeed.FormattingEnabled = true; this.el_gameSpeed.Location = new System.Drawing.Point(405, 17); this.el_gameSpeed.Name = "el_gameSpeed"; this.el_gameSpeed.Size = new System.Drawing.Size(52, 21); this.el_gameSpeed.TabIndex = 14; // // label9 // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.Location = new System.Drawing.Point(410, -3); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(42, 15); this.label9.TabIndex = 15; this.label9.Text = "Speed"; // // label8 // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.Location = new System.Drawing.Point(264, -3); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(33, 15); this.label8.TabIndex = 13; this.label8.Text = "Ring"; // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.Location = new System.Drawing.Point(29, 9); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(52, 15); this.label6.TabIndex = 11; this.label6.Text = "Referee"; // // formClose // this.formClose.Font = new System.Drawing.Font("Franklin Gothic Medium", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.formClose.Location = new System.Drawing.Point(369, 491); this.formClose.Name = "formClose"; this.formClose.Size = new System.Drawing.Size(87, 27); this.formClose.TabIndex = 52; this.formClose.Text = "Close"; this.formClose.UseVisualStyleBackColor = true; this.formClose.Click += new System.EventHandler(this.formClose_Click); // // EliminationForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.SkyBlue; this.ClientSize = new System.Drawing.Size(860, 524); this.Controls.Add(this.formClose); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.panel1); this.Controls.Add(this.label6); this.Controls.Add(this.panel3); this.Name = "EliminationForm"; this.Text = "Extended Elimination Configuration"; this.Load += new System.EventHandler(this.EliminationForm_Load); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox2; public System.Windows.Forms.CheckBox el_redControl; public System.Windows.Forms.TextBox el_redTeamName; private System.Windows.Forms.Label label5; private System.Windows.Forms.Button el_removeAllRed; private System.Windows.Forms.Button el_removeOneRed; public System.Windows.Forms.ListBox el_redList; private System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.CheckBox el_blueControl; public System.Windows.Forms.TextBox el_blueTeamName; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button el_removeOneBlue; private System.Windows.Forms.Button el_removeAllBlue; public System.Windows.Forms.ListBox el_blueList; private System.Windows.Forms.Panel panel1; public System.Windows.Forms.Button el_addBtn; public System.Windows.Forms.Button el_refresh; public System.Windows.Forms.RadioButton rb_allRed; public System.Windows.Forms.RadioButton rb_allBlue; public System.Windows.Forms.RadioButton rb_singleRed; public System.Windows.Forms.RadioButton rb_singleBlue; private System.Windows.Forms.Label label3; public System.Windows.Forms.ComboBox el_resultList; public System.Windows.Forms.ComboBox el_promotionList; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; public System.Windows.Forms.Button el_searchBtn; public System.Windows.Forms.TextBox el_searchInput; private System.Windows.Forms.Panel panel3; public System.Windows.Forms.ComboBox el_refereeList; public System.Windows.Forms.Button btn_matchStart; private System.Windows.Forms.Label label11; public System.Windows.Forms.ComboBox el_difficulty; private System.Windows.Forms.Label label6; public System.Windows.Forms.ComboBox el_venueList; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label7; public System.Windows.Forms.ComboBox el_bgm; public System.Windows.Forms.ComboBox el_ringList; public System.Windows.Forms.ComboBox el_gameSpeed; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.Button formClose; } }
54.130781
178
0.612198
[ "MIT" ]
timcanpy/MoreMatchTypes
MoreMatchTypes/EliminationForm.Designer.cs
33,942
C#
 public enum OperationCode : byte { Test = 0, QueuingRequest = 11, } public enum EventCode : byte { Receive_PreRoomMessages = 12, Receive_GamingRoomMessages =13, }
16.363636
35
0.688889
[ "Apache-2.0" ]
frank12001/ENEOnline
Client/Script/Parameters.cs
182
C#
using EducationProcess.DataAccess.Entities; using EducationProcess.DataAccess.Repositories.Interfaces; namespace EducationProcess.DataAccess.Repositories { public class EmployeeRepository : RepositoryBase<Employee>, IEmployeeRepository { private readonly EducationProcessContext _context; public EmployeeRepository(EducationProcessContext context) : base(context) { _context = context; } } }
30.533333
83
0.731441
[ "MIT" ]
NotKohtpojiep/EducationProcess
src/Api/EducationProcess.DataAccess/Repositories/EmployeeRepository.cs
460
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Diagnostics; using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.Identity.Client; using Microsoft.Identity.Client.Extensibility; using Microsoft.Identity.Test.Common; using Microsoft.Identity.Test.Common.Core.Helpers; using Microsoft.Identity.Test.Integration.Infrastructure; using Microsoft.Identity.Test.LabInfrastructure; using Microsoft.Identity.Test.UIAutomation.Infrastructure; using Microsoft.Identity.Test.Unit; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Microsoft.Identity.Test.Integration.SeleniumTests { [TestClass] public partial class InteractiveFlowTests { private readonly TimeSpan _interactiveAuthTimeout = TimeSpan.FromMinutes(5); private static readonly string[] s_scopes = new[] { "user.read" }; #region MSTest Hooks /// <summary> /// Initialized by MSTest (do not make private or readonly) /// </summary> public TestContext TestContext { get; set; } [ClassInitialize] public static void ClassInitialize(TestContext context) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; } [TestInitialize] public void TestInitialize() { TestCommon.ResetInternalStaticCaches(); } #endregion [TestMethod] public async Task Interactive_AADAsync() { // Arrange LabResponse labResponse = await LabUserHelper.GetDefaultUserAsync().ConfigureAwait(false); await RunTestForUserAsync(labResponse).ConfigureAwait(false); } #if DESKTOP // no point in running these tests on NetCore - the code path is similar [TestMethod] public async Task Interactive_AdfsV3_FederatedAsync() { LabResponse labResponse = await LabUserHelper.GetAdfsUserAsync(FederationProvider.AdfsV3, true).ConfigureAwait(false); await RunTestForUserAsync(labResponse).ConfigureAwait(false); } [TestMethod] public async Task Interactive_AdfsV2_FederatedAsync() { LabResponse labResponse = await LabUserHelper.GetAdfsUserAsync(FederationProvider.AdfsV2, true).ConfigureAwait(false); await RunTestForUserAsync(labResponse).ConfigureAwait(false); } [TestMethod] public async Task Interactive_AdfsV4_FederatedAsync() { LabResponse labResponse = await LabUserHelper.GetAdfsUserAsync(FederationProvider.AdfsV4, true).ConfigureAwait(false); await RunTestForUserAsync(labResponse).ConfigureAwait(false); } [TestMethod] public async Task InteractiveConsentPromptAsync() { var labResponse = await LabUserHelper.GetDefaultUserAsync().ConfigureAwait(false); await RunPromptTestForUserAsync(labResponse, Prompt.Consent, true).ConfigureAwait(false); await RunPromptTestForUserAsync(labResponse, Prompt.Consent, false).ConfigureAwait(false); } [TestMethod] public async Task Interactive_AdfsV2019_FederatedAsync() { LabResponse labResponse = await LabUserHelper.GetAdfsUserAsync(FederationProvider.ADFSv2019, true).ConfigureAwait(false); await RunTestForUserAsync(labResponse).ConfigureAwait(false); } #endif [TestMethod] public async Task Interactive_AdfsV2019_DirectAsync() { LabResponse labResponse = await LabUserHelper.GetAdfsUserAsync(FederationProvider.ADFSv2019, true).ConfigureAwait(false); await RunTestForUserAsync(labResponse, true).ConfigureAwait(false); } [TestMethod] [Ignore("Lab needs a way to provide multiple account types(AAD, ADFS, MSA) that can sign into the same client id")] public async Task MultiUserCacheCompatabilityTestAsync() { // Arrange //Acquire AT for default lab account LabResponse labResponseDefault = await LabUserHelper.GetDefaultUserAsync().ConfigureAwait(false); AuthenticationResult defaultAccountResult = await RunTestForUserAsync(labResponseDefault).ConfigureAwait(false); //Acquire AT for ADFS 2019 account LabResponse labResponseFederated = await LabUserHelper.GetAdfsUserAsync(FederationProvider.ADFSv2019, true).ConfigureAwait(false); var federatedAccountResult = await RunTestForUserAsync(labResponseFederated, false).ConfigureAwait(false); //Acquire AT for MSA account LabResponse labResponseMsa = await LabUserHelper.GetB2CMSAAccountAsync().ConfigureAwait(false); labResponseMsa.App.AppId = LabApiConstants.MSAOutlookAccountClientID; var msaAccountResult = await RunTestForUserAsync(labResponseMsa).ConfigureAwait(false); PublicClientApplication pca = PublicClientApplicationBuilder.Create(labResponseDefault.App.AppId).BuildConcrete(); AuthenticationResult authResult = await pca.AcquireTokenSilent(new[] { CoreUiTestConstants.DefaultScope }, defaultAccountResult.Account) .ExecuteAsync() .ConfigureAwait(false); Assert.IsNotNull(authResult); Assert.IsNotNull(authResult.AccessToken); Assert.IsNotNull(authResult.IdToken); pca = PublicClientApplicationBuilder.Create(labResponseFederated.App.AppId).BuildConcrete(); authResult = await pca.AcquireTokenSilent(new[] { CoreUiTestConstants.DefaultScope }, federatedAccountResult.Account) .ExecuteAsync() .ConfigureAwait(false); Assert.IsNotNull(authResult); Assert.IsNotNull(authResult.AccessToken); Assert.IsNull(authResult.IdToken); pca = PublicClientApplicationBuilder.Create(LabApiConstants.MSAOutlookAccountClientID).BuildConcrete(); authResult = await pca.AcquireTokenSilent(new[] { CoreUiTestConstants.DefaultScope }, msaAccountResult.Account) .ExecuteAsync() .ConfigureAwait(false); Assert.IsNotNull(authResult); Assert.IsNotNull(authResult.AccessToken); Assert.IsNull(authResult.IdToken); } private async Task<AuthenticationResult> RunTestForUserAsync(LabResponse labResponse, bool directToAdfs = false) { IPublicClientApplication pca; if (directToAdfs) { pca = PublicClientApplicationBuilder .Create(Adfs2019LabConstants.PublicClientId) .WithRedirectUri(Adfs2019LabConstants.ClientRedirectUri) .WithAdfsAuthority(Adfs2019LabConstants.Authority) .Build(); } else { pca = PublicClientApplicationBuilder .Create(labResponse.App.AppId) .WithRedirectUri(SeleniumWebUI.FindFreeLocalhostRedirectUri()) .Build(); } var userCacheAccess = pca.UserTokenCache.RecordAccess(); Trace.WriteLine("Part 1 - Acquire a token interactively, no login hint"); AuthenticationResult result = await pca .AcquireTokenInteractive(s_scopes) .WithCustomWebUi(CreateSeleniumCustomWebUI(labResponse.User, Prompt.SelectAccount, false, directToAdfs)) .ExecuteAsync(new CancellationTokenSource(_interactiveAuthTimeout).Token) .ConfigureAwait(false); userCacheAccess.AssertAccessCounts(0, 1); IAccount account = await MsalAssert.AssertSingleAccountAsync(labResponse, pca, result).ConfigureAwait(false); userCacheAccess.AssertAccessCounts(1, 1); // the assert calls GetAccounts Trace.WriteLine("Part 2 - Clear the cache"); await pca.RemoveAsync(account).ConfigureAwait(false); userCacheAccess.AssertAccessCounts(1, 2); Assert.IsFalse((await pca.GetAccountsAsync().ConfigureAwait(false)).Any()); userCacheAccess.AssertAccessCounts(2, 2); Trace.WriteLine("Part 3 - Acquire a token interactively again, with login hint"); result = await pca .AcquireTokenInteractive(s_scopes) .WithCustomWebUi(CreateSeleniumCustomWebUI(labResponse.User, Prompt.ForceLogin, true, directToAdfs)) .WithPrompt(Prompt.ForceLogin) .WithLoginHint(labResponse.User.Upn) .ExecuteAsync(new CancellationTokenSource(_interactiveAuthTimeout).Token) .ConfigureAwait(false); userCacheAccess.AssertAccessCounts(2, 3); account = await MsalAssert.AssertSingleAccountAsync(labResponse, pca, result).ConfigureAwait(false); userCacheAccess.AssertAccessCounts(3, 3); Trace.WriteLine("Part 4 - Acquire a token silently"); result = await pca .AcquireTokenSilent(s_scopes, account) .ExecuteAsync(CancellationToken.None) .ConfigureAwait(false); await MsalAssert.AssertSingleAccountAsync(labResponse, pca, result).ConfigureAwait(false); return result; } private async Task RunPromptTestForUserAsync(LabResponse labResponse, Prompt prompt, bool useLoginHint) { var pca = PublicClientApplicationBuilder .Create(labResponse.App.AppId) .WithRedirectUri(SeleniumWebUI.FindFreeLocalhostRedirectUri()) .Build(); AcquireTokenInteractiveParameterBuilder builder = pca .AcquireTokenInteractive(s_scopes) .WithPrompt(prompt) .WithCustomWebUi(CreateSeleniumCustomWebUI(labResponse.User, prompt, useLoginHint)); if (useLoginHint) { builder = builder.WithLoginHint(labResponse.User.Upn); } AuthenticationResult result = await builder .ExecuteAsync(new CancellationTokenSource(_interactiveAuthTimeout).Token) .ConfigureAwait(false); await MsalAssert.AssertSingleAccountAsync(labResponse, pca, result).ConfigureAwait(false); } private SeleniumWebUI CreateSeleniumCustomWebUI(LabUser user, Prompt prompt, bool withLoginHint = false, bool adfsOnly = false) { return new SeleniumWebUI((driver) => { Trace.WriteLine("Starting Selenium automation"); driver.PerformLogin(user, prompt, withLoginHint, adfsOnly); }, TestContext); } } }
45.310484
149
0.646525
[ "MIT" ]
vijayraavi/microsoft-authentication-library-for-dotnet
tests/Microsoft.Identity.Test.Integration.net45/SeleniumTests/InteractiveFlowTests.cs
11,239
C#
using Natasha.CSharp; using NMS.Leo.Builder; using System; using NMS.Leo.Core; namespace NMS.Leo { public static unsafe class HashDictOperator { public static delegate* managed<Type, DictBase> CreateFromString; static HashDictOperator() { HashDictBuilder.Ctor(typeof(NullClass)); } public static DictBase CreateFromType(Type type) { return CreateFromString(type); } } public static unsafe class HashDictOperator<T> { public static readonly delegate* managed<DictBase> Create; static HashDictOperator() { var dynamicType = DictBuilder.InitType(typeof(T), AlgorithmKind.Hash); Create = (delegate * managed<DictBase>)(NInstance.Creator(dynamicType).Method.MethodHandle.GetFunctionPointer()); } } }
26.060606
125
0.645349
[ "MIT" ]
alexinea/Leo
src/NMS.Leo/DictOperator.Hash.cs
862
C#
using System.ComponentModel.DataAnnotations; using Abp.Auditing; using Abp.Authorization.Users; namespace evitoriav2.Models.TokenAuth { public class AuthenticateModel { [Required] [StringLength(AbpUserBase.MaxEmailAddressLength)] public string UserNameOrEmailAddress { get; set; } [Required] [StringLength(AbpUserBase.MaxPlainPasswordLength)] [DisableAuditing] public string Password { get; set; } public bool RememberClient { get; set; } } }
24.904762
58
0.688337
[ "MIT" ]
ntgentil/evitoria
aspnet-core/src/evitoriav2.Web.Core/Models/TokenAuth/AuthenticateModel.cs
525
C#
using System; using System.Security.Principal; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Web.Http.Filters; using DotNetMessenger.Logger; using DotNetMessenger.WebApi.Extensions; using DotNetMessenger.WebApi.Results; namespace DotNetMessenger.WebApi.Filters.Authentication { /// <inheritdoc cref="IAuthenticationFilter"/> /// <summary> /// Reads Base64 string, converts it to username and password pair and executes /// <see cref="M:DotNetMessenger.WebApi.Filters.Authentication.BasicAuthenticationAttribute.Authenticate(System.String,System.String,System.Threading.CancellationToken)" /> method /// for further authentication /// </summary> public abstract class BasicAuthenticationAttribute : Attribute, IAuthenticationFilter { public string Realm { get; set; } public bool AllowMultiple => false; public async Task AuthenticateAsync(HttpAuthenticationContext context, CancellationToken cancellationToken) { var request = context.Request; var authorization = request.Headers.Authorization; //NLogger.Logger.Debug("Authentication starting"); if (authorization == null) { //NLogger.Logger.Warn("No authorization header included in the request. Skipping"); return; } if (authorization.Scheme != "Basic") { NLogger.Logger.Warn("Auth scheme is not {0}. Skipping", "Basic"); return; } if (string.IsNullOrEmpty(authorization.Parameter)) { NLogger.Logger.Error("Credentials missing in the header. Forbidden"); context.ErrorResult = new AuthenticationFailureResult("Missing credentials", request); return; } var userNameAndPassword = ExtractUserNameAndPassword(authorization.Parameter); if (userNameAndPassword == null) { NLogger.Logger.Error("Invalid format of credentials. Forbidden"); context.ErrorResult = new AuthenticationFailureResult("Invalid credentials", request); return; } var username = userNameAndPassword.Item1; var password = userNameAndPassword.Item2; var principal = await Authenticate(username, password, cancellationToken); if (principal == null) { NLogger.Logger.Error("Invalid username or password. Forbidden"); context.ErrorResult = new AuthenticationFailureResult("Invalid username or password", request); } else { //NLogger.Logger.Debug("Successfully authenticated user. Username: \"{0}\"", principal.Identity.Name); HttpContext.Current.User = principal; context.Principal = principal; Thread.CurrentPrincipal = principal; } } protected abstract Task<IPrincipal> Authenticate(string userName, string password, CancellationToken cancellationToken); public Task ChallengeAsync(HttpAuthenticationChallengeContext context, CancellationToken cancellationToken) { //NLogger.Logger.Debug("Adding challenge to response"); Challenge(context); //NLogger.Logger.Debug("Added challenge to response"); return Task.FromResult(0); } private void Challenge(HttpAuthenticationChallengeContext context) { string parameter; if (string.IsNullOrEmpty(Realm)) { parameter = null; } else { // A correct implementation should verify that Realm does not contain a quote character unless properly // escaped (precededed by a backslash that is not itself escaped). parameter = "realm=\"" + Realm + "\""; } context.ChallengeWith("Basic", parameter); } private static Tuple<string, string> ExtractUserNameAndPassword(string authorizationParameter) { var decodedCredentials = authorizationParameter.FromBase64ToString(); //NLogger.Logger.Debug("Credentials decoded from base64"); if (string.IsNullOrEmpty(decodedCredentials)) { //NLogger.Logger.Debug("Credentials are empty"); return null; } //NLogger.Logger.Debug("Splitting username from password"); var colonIndex = decodedCredentials.IndexOf(':'); if (colonIndex == -1) { NLogger.Logger.Warn("No delimeter found"); return null; } var userName = decodedCredentials.Substring(0, colonIndex); var password = decodedCredentials.Substring(colonIndex + 1); //NLogger.Logger.Debug("Successfully extracted username and password"); return new Tuple<string, string>(userName, password); } } }
38.744361
183
0.613623
[ "MIT" ]
d32f123/DotNetMessenger
DotNetMessenger.WebApi/Filters/Authentication/BasicAuthenticationAttribute.cs
5,155
C#
// // Copyright (c) [Name]. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; using System.Windows.Forms; namespace BrainSimulator.Modules { public partial class ModuleImageFileDlg : ModuleBaseDlg { string defaultDirectory = ""; public ModuleImageFileDlg() { InitializeComponent(); } public override bool Draw(bool checkDrawTimer) { //this has a timer so that no matter how often you might call draw, the dialog //only updates 10x per second if (!base.Draw(checkDrawTimer)) return false; ModuleImageFile parent = (ModuleImageFile)base.ParentModule; if (File.Exists(parent.filePath)) textBoxPath.Text = parent.filePath; cbNameIsDescription.IsChecked = parent.useDescription; //use a line like this to gain access to the parent's public variables //ModuleEmpty parent = (ModuleEmpty)base.Parent1; //here are some other possibly-useful items //theCanvas.Children.Clear(); //Point windowSize = new Point(theCanvas.ActualWidth, theCanvas.ActualHeight); //Point windowCenter = new Point(windowSize.X / 2, windowSize.Y / 2); //float scale = (float)Math.Min(windowSize.X, windowSize.Y) / 12; //if (scale == 0) return false; return true; } private void TheCanvas_SizeChanged(object sender, SizeChangedEventArgs e) { Draw(true); } private void Button_Browse_Click(object sender, RoutedEventArgs e) { if (defaultDirectory == "") { defaultDirectory = System.IO.Path.GetDirectoryName(MainWindow.currentFileName); } OpenFileDialog openFileDialog1 = new OpenFileDialog { Filter = "Image Files| *.png", Title = "Select an image file", Multiselect = true, InitialDirectory = defaultDirectory, }; // Show the Dialog. // If the user clicked OK in the dialog DialogResult result = openFileDialog1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { defaultDirectory = System.IO.Path.GetDirectoryName(openFileDialog1.FileName); ModuleImageFile parent = (ModuleImageFile)base.ParentModule; textBoxPath.Text = openFileDialog1.FileName; List<string> fileList; string curPath; if (openFileDialog1.FileNames.Length > 1) { fileList = openFileDialog1.FileNames.ToList(); curPath = fileList[0]; } else { fileList = GetFileList(openFileDialog1.FileName); curPath = openFileDialog1.FileName; } parent.SetParameters(fileList, curPath, (bool)cbAutoCycle.IsChecked, (bool)cbNameIsDescription.IsChecked); } } private List<string> GetFileList(string filePath) { SearchOption subFolder = SearchOption.AllDirectories; if (!(bool)cbUseSubfolders.IsChecked) subFolder = SearchOption.TopDirectoryOnly; string dir = filePath; FileAttributes attr = File.GetAttributes(filePath); if ((attr & FileAttributes.Directory) != FileAttributes.Directory) dir = System.IO.Path.GetDirectoryName(filePath); return new List<string>(Directory.EnumerateFiles(dir, "*.png", subFolder)); } private void Button_Cancel_Click(object sender, RoutedEventArgs e) { Close(); } private void Button_OK_Click(object sender, RoutedEventArgs e) { ModuleImageFile parent = (ModuleImageFile)base.ParentModule; parent.SetParameters(null,textBoxPath.Text, (bool)cbAutoCycle.IsChecked, (bool)cbNameIsDescription.IsChecked); } private void Button_Click_Next(object sender, RoutedEventArgs e) { ModuleImageFile parent = (ModuleImageFile)base.ParentModule; cbAutoCycle.IsChecked = false; parent.NextFile(); } private void Button_Click_Prev(object sender, RoutedEventArgs e) { ModuleImageFile parent = (ModuleImageFile)base.ParentModule; cbAutoCycle.IsChecked = false; parent.PrevFile(); } private void CheckBoxChanged(object sender, RoutedEventArgs e) { ModuleImageFile parent = (ModuleImageFile)base.ParentModule; parent.SetParameters(null,"", (bool)cbAutoCycle.IsChecked, (bool)cbNameIsDescription.IsChecked); } private void ButtonDescr_Click(object sender, RoutedEventArgs e) { ModuleImageFile parent = (ModuleImageFile)base.ParentModule; parent.ResendDescription(); } } }
37.884892
122
0.600266
[ "MIT" ]
FutureAIGuru/BrainSimII
BrainSimulator/Modules/ModuleImageFileDlg.xaml.cs
5,268
C#
using System; namespace TwitchTokenGeneratorNET.Models.GetAuthWorkflow { public interface IResponse { } }
14.222222
56
0.6875
[ "MIT" ]
swiftyspiffy/TwitchTokenGeneratorNET
TwitchTokenGeneratorNET/TwitchTokenGeneratorNET/Models/GetAuthWorkflow/IResponse.cs
130
C#
using Bolt.Models; using System.Linq; using System.IO; namespace Bolt.Readers { internal class JsonBooleanReader : JsonReader { private static readonly char[] false_chars = new char[] { 'f', 'a', 'l', 's', 'e' }; private static readonly char[] true_chars = new char[] { 't', 'r', 'u', 'e' }; public JsonBooleanReader(StringReader json) : base(json) { } public override IJsonValue Read() { if(this._json.Peek() == 't') { char[] buffer = new char[4]; int readCount = this._json.Read(buffer, 0, 4); if(readCount == 4 && buffer.SequenceEqual(true_chars)) { return new JsonBoolean(true); } else { throw new JsonFormatException("Expected to read 'true'"); } } else { char[] buffer = new char[5]; int readCount = this._json.Read(buffer, 0, 5); if(readCount == 5 && buffer.SequenceEqual(false_chars)) { return new JsonBoolean(false); } else { throw new JsonFormatException("Expected to read 'false'"); } } } } }
32.454545
88
0.583567
[ "MIT" ]
rhemm23/bolt
Json/Readers/JsonBooleanReader.cs
1,073
C#
namespace Project.Application.Configuration.Constants { public static class Number { public const double FactorPerUnitLiterConsume = 0.003; public const int RoundNumberDecimal = 2; public const double MaxDistanceHomeToleranceKm = 50; public const int PreviousNumberHoursWithLocations = 4; } }
30.727273
62
0.718935
[ "MIT" ]
henrygustavo/cqrs-api
Project.Application/Configuration/Constants/Number.cs
340
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IDTO.RouteAggregationLibrary.OpenTripPlanner.Model { public class EncodedPolylineBean { public string points { get; set; } public string levels { get; set; } public int length { get; set; } } }
22.375
60
0.698324
[ "Apache-2.0" ]
OSADP/IDTO
IDTO Azure Hosted Systems/IDTO.RouteAggregationLibrary/OpenTripPlanner/Model/EncodedPolylineBean.cs
360
C#
using Business.Abstract; using Business.Constants; using Core.Utilities; using Core.Utilities.Business; using Core.Utilities.Helpers; using DataAccess.Abstract; using Entities.Concrete; using Microsoft.AspNetCore.Http; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace Business.Concrete { public class CarImageManager : ICarImageService { ICarImageDal _carImageDal; public CarImageManager(ICarImageDal carImageDal) { _carImageDal = carImageDal; } public IResult Add(IFormFile file, CarImage carImage) { IResult result = BusinessRules.Run(CheckIfImageLimitExceded(carImage.CarId), CheckIfImageExtensionValid(file)); if (result != null) { return result; } carImage.ImagePath = FileHelper.Add(file); carImage.Date = DateTime.Now; _carImageDal.Add(carImage); return new SuccessResult(Messages.CarImageAdded); } public IResult Delete(CarImage carImage) { string oldPath = GetById(carImage.Id).Data.ImagePath; FileHelper.Delete(oldPath); _carImageDal.Delete(carImage); return new SuccessResult(Messages.CarImageDeleted); } public IDataResult<List<CarImage>> GetAll() { return new SuccessDataResult<List<CarImage>>(_carImageDal.GetAll()); } public IDataResult<CarImage> GetById(int id) { return new SuccessDataResult<CarImage>(_carImageDal.Get(x => x.CarId == id)); } public IDataResult<List<CarImage>> GetImagesByCarId(int id) { return new SuccessDataResult<List<CarImage>>(CheckIfCarImageNull(id)); } public IResult Update(IFormFile file, CarImage carImage) { var result = BusinessRules.Run( CheckIfImageExtensionValid(file)); if (result != null) { return result; } CarImage oldCarImage = GetById(carImage.Id).Data; carImage.ImagePath = FileHelper.Update(file, oldCarImage.ImagePath); carImage.Date = DateTime.Now; carImage.CarId = oldCarImage.CarId; _carImageDal.Update(carImage); return new SuccessResult(Messages.CarImageUpdated); } public IResult CheckIfImageLimitExceded(int id) { var result = _carImageDal.GetAll(c => c.CarId == id).Count; if (result >= 5) { return new ErrorResult(Messages.CarImageLimitExceded); } return new SuccessResult(); } private List<CarImage> CheckIfCarImageNull(int id) { string path = @"Images\Logo.png"; var result = _carImageDal.GetAll(c => c.CarId == id).Any(); if (!result) { return new List<CarImage> { new CarImage { CarId = id, ImagePath = path, Date = DateTime.Now } }; } return _carImageDal.GetAll(p => p.CarId == id); } private IResult CheckIfImageExtensionValid(IFormFile file) { string[] validImageFileTypes = { ".JPG", ".JPEG", ".PNG", ".TIF", ".TIFF", ".GIF", ".BMP", ".ICO", ".WEBP" }; var result = validImageFileTypes.Any(t => t == Path.GetExtension(file.FileName).ToUpper()); if (!result) { return new ErrorResult("Geçersiz uzantı"); } return new SuccessResult(); } } }
31.350427
123
0.583969
[ "MIT" ]
hlmclgl/RentaCarProject
Business/Concrete/CarImageManager.cs
3,672
C#
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Description; using MOE.Common.Business.Bins; using MOE.Common.Business.WCFServiceLibrary; using MOE.Common.Models; using MOE.Common.Models.Repositories; namespace MOE.Common.Business.DataAggregation { public abstract class AggregationByApproach { protected List<ApproachEventCountAggregation> ApproachEventCountAggregations { get; set; } public double Total { get { return BinsContainers.Sum(c => c.SumValue); } } public Approach Approach { get; } public List<BinsContainer> BinsContainers { get; set; } = new List<BinsContainer>(); public int Average { get { if (BinsContainers.Count > 1) return Convert.ToInt32(Math.Round(BinsContainers.Average(b => b.SumValue))); double numberOfBins = 0; foreach (var binsContainer in BinsContainers) numberOfBins += binsContainer.Bins.Count; return numberOfBins > 0 ? Convert.ToInt32(Math.Round(Total / numberOfBins)) : 0; } } public AggregationByApproach(Approach approach, ApproachAggregationMetricOptions options, DateTime startDate, DateTime endDate, bool getProtectedPhase, AggregatedDataType dataType) { BinsContainers = BinFactory.GetBins(options.TimeOptions); Approach = approach; if (options.ShowEventCount) { ApproachEventCountAggregations = GetApproachEventCountAggregations(options, approach, true); if (approach.PermissivePhaseNumber != null) { ApproachEventCountAggregations.AddRange(GetApproachEventCountAggregations(options, approach, false)); } } LoadBins(approach, options, getProtectedPhase, dataType); } protected List<ApproachEventCountAggregation> GetApproachEventCountAggregations(ApproachAggregationMetricOptions options, Approach approach, bool getProtectedPhase) { var approachEventCountAggregationRepository = MOE.Common.Models.Repositories.ApproachEventCountAggregationRepositoryFactory.Create(); return approachEventCountAggregationRepository.GetPhaseEventCountAggregationByPhaseIdAndDateRange( Approach.ApproachID, options.TimeOptions.Start, options.TimeOptions.End, getProtectedPhase); } protected abstract void LoadBins(Approach approach, ApproachAggregationMetricOptions options, bool getProtectedPhase, AggregatedDataType dataType); } }
40.823529
172
0.663184
[ "Apache-2.0" ]
AndreRSanchez/ATSPM
MOE.Common/Business/DataAggregation/AggregationByApproach.cs
2,778
C#
using System; using System.Collections.Generic; using System.Text; using ServiceStack.Model; using ServiceStack.Text; namespace ServiceStack.Validation { /// <summary> /// The exception which is thrown when a validation error occurred. /// This validation is serialized in a extra clean and human-readable way by ServiceStack. /// </summary> public class ValidationError : ArgumentException, IResponseStatusConvertible { private readonly string errorCode; public string ErrorMessage { get; private set; } public ValidationError(string errorCode) : this(errorCode, errorCode.SplitCamelCase()) { } public ValidationError(ValidationErrorResult validationResult) : base(validationResult.ErrorMessage) { this.errorCode = validationResult.ErrorCode; this.ErrorMessage = validationResult.ErrorMessage; this.Violations = validationResult.Errors; } public ValidationError(ValidationErrorField validationError) : this(validationError.ErrorCode, validationError.ErrorMessage) { this.Violations.Add(validationError); } public ValidationError(string errorCode, string errorMessage) : base(errorMessage) { this.errorCode = errorCode; this.ErrorMessage = errorMessage; this.Violations = new List<ValidationErrorField>(); } /// <summary> /// Returns the first error code /// </summary> /// <value>The error code.</value> public string ErrorCode { get { return this.errorCode; } } public override string Message { get { //If there is only 1 validation error than we just show the error message if (this.Violations.Count == 0) return this.ErrorMessage; if (this.Violations.Count == 1) return this.ErrorMessage ?? this.Violations[0].ErrorMessage; var sb = new StringBuilder(this.ErrorMessage).AppendLine(); foreach (var error in this.Violations) { if (!string.IsNullOrEmpty(error.ErrorMessage)) { var fieldLabel = error.FieldName != null ? string.Format(" [{0}]", error.FieldName) : null; sb.AppendFormat("\n - {0}{1}", error.ErrorMessage, fieldLabel); } else { var fieldLabel = error.FieldName != null ? ": " + error.FieldName : null; sb.AppendFormat("\n - {0}{1}", error.ErrorCode, fieldLabel); } } return sb.ToString(); } } public IList<ValidationErrorField> Violations { get; private set; } /// <summary> /// Used if we need to serialize this exception to XML /// </summary> /// <returns></returns> public string ToXml() { var sb = new StringBuilder(); sb.Append("<ValidationException>"); foreach (ValidationErrorField error in this.Violations) { sb.Append("<ValidationError>") .AppendFormat("<Code>{0}</Code>", error.ErrorCode) .AppendFormat("<Field>{0}</Field>", error.FieldName) .AppendFormat("<Message>{0}</Message>", error.ErrorMessage) .Append("</ValidationError>"); } sb.Append("</ValidationException>"); return sb.ToString(); } public static ValidationError CreateException(Enum errorCode) { return new ValidationError(errorCode.ToString()); } public static ValidationError CreateException(Enum errorCode, string errorMessage) { return new ValidationError(errorCode.ToString(), errorMessage); } public static ValidationError CreateException(Enum errorCode, string errorMessage, string fieldName) { return CreateException(errorCode.ToString(), errorMessage, fieldName); } public static ValidationError CreateException(string errorCode) { return new ValidationError(errorCode); } public static ValidationError CreateException(string errorCode, string errorMessage) { return new ValidationError(errorCode, errorMessage); } public static ValidationError CreateException(string errorCode, string errorMessage, string fieldName) { var error = new ValidationErrorField(errorCode, fieldName, errorMessage); return new ValidationError(new ValidationErrorResult(new List<ValidationErrorField> { error })); } public static ValidationError CreateException(ValidationErrorField error) { return new ValidationError(error); } public static void ThrowIfNotValid(ValidationErrorResult validationResult) { if (!validationResult.IsValid) { throw new ValidationError(validationResult); } } public ResponseStatus ToResponseStatus() { return ResponseStatusUtils.CreateResponseStatus(ErrorCode, Message, Violations); } } }
35.401274
115
0.577546
[ "Apache-2.0" ]
Chris-Kim/ServiceStack
src/ServiceStack.Client/Validation/ValidationError.cs
5,558
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CryptoSteganography.Core.Byte")] [assembly: AssemblyDescription("A condition in which the information contained in a readable data is not understood by the unwanted parties; Methods of converting a file, message, image, or video by hiding it in a file, message, image, or video.s")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("azmisahin.com")] [assembly: AssemblyProduct("CryptoSteganography.Core.Byte")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a2676748-fb4b-4b0a-a33a-24f846252012")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
56.066667
249
0.782402
[ "MIT" ]
azmisahin/azmisahin-software-cryptography-steganography-net
src/Core/CryptoSteganography.Core.Byte/Properties/AssemblyInfo.cs
844
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpawnBacteriaFood : MonoBehaviour { [SerializeField] private GameObject bacteriaFoodPrefab; [SerializeField] private int xmax = 1024; [SerializeField] private int ymax = 764; [SerializeField] private float spacing = 1; [SerializeField] private float ySpacing = 4; public List<GameObject> SpawnFood() { List<GameObject> food = new List<GameObject>(); for(int x = 0; x < Mathf.Sqrt(xmax); x++) { for(int z = 0; z < Mathf.Sqrt(ymax); z++) { GameObject foodClone = GameObject.Instantiate(bacteriaFoodPrefab, new Vector3(x * spacing, Random.Range(-ySpacing, ySpacing), -z * spacing), Quaternion.identity); RotateAroundY foodRotate = foodClone.GetComponentInChildren<RotateAroundY>(); foodRotate.transform.rotation = Random.rotation; food.Add(foodClone); } } return food; } }
30.333333
166
0.727473
[ "MIT" ]
Reality-Virtually-Hackathon/biofield
MIT_Unity/Symbio/Assets/SpawnBacteriaFood.cs
912
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _05.BooleanVariable { class BooleanVariable { static void Main() { string input = Console.ReadLine().ToLower(); bool isTrue = Convert.ToBoolean(input); if (isTrue) { Console.WriteLine("Yes"); } else { Console.WriteLine("No"); } } } }
18.857143
56
0.50947
[ "MIT" ]
ShadyObeyd/ProgrammingFundamentals-Homeworks
06.DataTypesAndVariables-Exercises/05.BooleanVariable/BooleanVariable.cs
530
C#
using System; using System.Net; namespace IntegrationTests.Services.Catalog { using System.Threading.Tasks; using Xunit; public class CatalogScenarios : CatalogScenarioBase { [Fact] public async Task Get_get_all_catalogitems_and_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.Items()); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_catalogitem_by_id_and_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.ItemById(1)); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_catalogitem_by_id_and_response_bad_request_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.ItemById(int.MinValue)); Assert.Equal(response.StatusCode, HttpStatusCode.BadRequest); } } [Fact] public async Task Get_get_catalogitem_by_id_and_response_not_found_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.ItemById(int.MaxValue)); Assert.Equal(response.StatusCode, HttpStatusCode.NotFound); } } [Fact] public async Task Get_get_catalogitem_by_name_and_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.ItemByName(".NET")); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_paginated_catalogitem_by_name_and_response_ok_status_code() { using (var server = CreateServer()) { const bool paginated = true; var response = await server.CreateClient() .GetAsync(Get.ItemByName(".NET", paginated)); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_paginated_catalog_items_and_response_ok_status_code() { using (var server = CreateServer()) { const bool paginated = true; var response = await server.CreateClient() .GetAsync(Get.Items(paginated)); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_filtered_catalog_items_and_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.Filtered(1, 1)); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_get_paginated_filtered_catalog_items_and_response_ok_status_code() { using (var server = CreateServer()) { const bool paginated = true; var response = await server.CreateClient() .GetAsync(Get.Filtered(1, 1, paginated)); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_catalog_types_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.Types); response.EnsureSuccessStatusCode(); } } [Fact] public async Task Get_catalog_brands_response_ok_status_code() { using (var server = CreateServer()) { var response = await server.CreateClient() .GetAsync(Get.Brands); response.EnsureSuccessStatusCode(); } } } }
29.554054
96
0.535208
[ "MIT" ]
AkshayKothari440/eShopOnContainers-final
test/Services/IntegrationTests/Services/Catalog/CatalogScenarios.cs
4,376
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; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; namespace Microsoft.AspNet.Mvc.ModelBinding { /// <summary> /// Represents a <see cref="IValueProvider"/> whose values come from a collection of <see cref="IValueProvider"/>s. /// </summary> public class CompositeValueProvider : Collection<IValueProvider>, IEnumerableValueProvider, IBindingSourceValueProvider { /// <summary> /// Initializes a new instance of <see cref="CompositeValueProvider"/>. /// </summary> public CompositeValueProvider() : base() { } /// <summary> /// Initializes a new instance of <see cref="CompositeValueProvider"/>. /// </summary> /// <param name="valueProviders">The sequence of <see cref="IValueProvider"/> to add to this instance of /// <see cref="CompositeValueProvider"/>.</param> public CompositeValueProvider(IList<IValueProvider> valueProviders) : base(valueProviders) { } /// <inheritdoc /> public virtual bool ContainsPrefix(string prefix) { for (var i = 0; i < Count; i++) { if (this[i].ContainsPrefix(prefix)) { return true; } } return false; } /// <inheritdoc /> public virtual ValueProviderResult GetValue(string key) { // Performance-sensitive // Caching the count is faster for IList<T> var itemCount = Items.Count; for (var i = 0; i < itemCount; i++) { var valueProvider = Items[i]; var result = valueProvider.GetValue(key); if (result != ValueProviderResult.None) { return result; } } return ValueProviderResult.None; } /// <inheritdoc /> public virtual IDictionary<string, string> GetKeysFromPrefix(string prefix) { foreach (var valueProvider in this) { var enumeratedProvider = valueProvider as IEnumerableValueProvider; if (enumeratedProvider != null) { var result = enumeratedProvider.GetKeysFromPrefix(prefix); if (result != null && result.Count > 0) { return result; } } } return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } /// <inheritdoc /> protected override void InsertItem(int index, IValueProvider item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } base.InsertItem(index, item); } /// <inheritdoc /> protected override void SetItem(int index, IValueProvider item) { if (item == null) { throw new ArgumentNullException(nameof(item)); } base.SetItem(index, item); } /// <inheritdoc /> public IValueProvider Filter(BindingSource bindingSource) { if (bindingSource == null) { throw new ArgumentNullException(nameof(bindingSource)); } var filteredValueProviders = new List<IValueProvider>(); foreach (var valueProvider in this.OfType<IBindingSourceValueProvider>()) { var result = valueProvider.Filter(bindingSource); if (result != null) { filteredValueProviders.Add(result); } } if (filteredValueProviders.Count == 0) { // Do not create an empty CompositeValueProvider. return null; } if (filteredValueProviders.Count == Count) { // No need for a new CompositeValueProvider. return this; } return new CompositeValueProvider(filteredValueProviders); } } }
31.468531
119
0.524
[ "Apache-2.0" ]
corefan/Mvc
src/Microsoft.AspNet.Mvc.Core/ModelBinding/CompositeValueProvider.cs
4,500
C#
using System.Collections.Generic; using System.Linq; using FilterCore.Entry; using FilterCore.FilterComponents.Tags; using FilterDomain.LineStrategy; namespace FilterCore.Commands.EntryCommands { public class RaresUpEntryCommand : GenerationTag, IEntryGenerationCommand { public RaresUpEntryCommand(FilterEntry target) : base(target) {} public IEnumerable<IFilterEntry> NewEntries { get; set; } public override void Execute(int? strictness = null, int? consoleStrictness = null) { var newEntry = this.Target.Clone(); newEntry.Header.TierTags.AppendUpSuffixToTierTag(); var textLine = newEntry.Content.Content["SetTextColor"].Single(); var levelLine = newEntry.Content.Content["ItemLevel"].Single(); if (textLine.Value is ColorValueContainer color) { color.R = 255; color.G = 190; color.B = 0; color.O = 255; } if (levelLine.Value is NumericValueContainer val) { val.Value = "75"; } this.NewEntries = new List<IFilterEntry> { newEntry }; } public override GenerationTag Clone() { return new DisableEntryCommand(this.Target) { Value = this.Value, Strictness = this.Strictness }; } } }
31.170213
91
0.576109
[ "MIT" ]
KOSAdm684/FilterPolishZ
FilterCore/Commands/EntryCommands/RaresUpEntryCommand.cs
1,465
C#
using System; using System.Collections.Generic; namespace ContosoUniversity.Models { public class User { public int ID { get; set; } public string LastName { get; set; } public string FirstMidName { get; set; } public DateTime EnrollmentDate { get; set; } } }
24.307692
53
0.613924
[ "Apache-2.0" ]
HafidOD/CRUD-C-
Models/user.cs
316
C#
using System.Collections.Generic; using OpenDreamRuntime.Objects; using OpenDreamShared.Dream; using OpenDreamShared.Json; using Robust.Shared.Maths; namespace OpenDreamRuntime { interface IDreamMapManager { public Vector2i Size { get; } public int Levels { get; } public void Initialize(); public void LoadMaps(List<DreamMapJson> maps); public void SetTurf(int x, int y, int z, DreamObject turf, bool replace = true); public void SetArea(int x, int y, int z, DreamObject area); public DreamObject GetTurf(int x, int y, int z); public DreamObject GetArea(DreamPath type); public DreamObject GetAreaAt(int x, int y, int z); public void SetZLevels(int levels); } }
34.272727
88
0.687003
[ "MIT" ]
DamianX/OpenDream
OpenDreamRuntime/IDreamMapManager.cs
756
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace HelloWorldDemo { 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>().UseWebRoot("MyRoot"); }); } }
26.555556
74
0.64993
[ "MIT" ]
mourice-oduor/C--ASP.NET-CORE
ASP.NET-CORE/1.0 HelloWorldDemo/HelloWorldDemo/Program.cs
717
C#
using System; namespace Flow.Launcher.Plugin { public class PluginInitContext { public PluginMetadata CurrentPluginMetadata { get; internal set; } /// <summary> /// Public APIs for plugin invocation /// </summary> public IPublicAPI API { get; set; } } }
20.6
74
0.61165
[ "MIT" ]
JohnTheGr8/Flow.Launcher
Flow.Launcher.Plugin/PluginInitContext.cs
311
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace SG { public class EnemyWeaponSlotManager : MonoBehaviour { WeaponHolderSlot leftHandSlot; WeaponHolderSlot rightHandSlot; public List<WeaponItem> rightWeapon; public List<WeaponItem> leftWeapon; DamageCollider leftHandDamageCollider; DamageCollider rightHandDamageCollider; Animator animator; // //QuickSlotsUI quickSlotsUI; // //PlayerStates playerStates; // //public WeaponItem attackingWeapon; private void Awake() { //quickSlotsUI = FindObjectOfType<QuickSlotsUI>(); //playerStates = GetComponentInParent<PlayerStates>(); animator = GetComponent<Animator>(); WeaponHolderSlot[] weaponHolderSlots = GetComponentsInChildren<WeaponHolderSlot>(); foreach (WeaponHolderSlot weaponSlot in weaponHolderSlots) { if (weaponSlot.isLeftHandSlot) { leftHandSlot = weaponSlot; } else if (weaponSlot.isRightHandSlot) { rightHandSlot = weaponSlot; } } } private void Start() { LoadWeaponOnSlot(leftWeapon[0],true); LoadWeaponOnSlot(rightWeapon[0],false); } public void LoadWeaponOnSlot(WeaponItem weapon, bool isLeft) { if (isLeft) { leftHandSlot.currentWeaponItem = weapon; leftHandSlot.LoadWeaponModel(weapon); LoadLeftWeaponDamageCollider(); animator.CrossFade(weapon.left_hand_idle,0.2f); } else { rightHandSlot.currentWeaponItem = weapon; rightHandSlot.LoadWeaponModel(weapon); LoadRightWeaponDamageCollider(); animator.CrossFade(weapon.right_hand_idle,0.2f); } } #region Handle Weapon's Damage Collider public void OpenDamageCollider() { bool isLeft = animator.GetBool("isLeft"); bool isRight = animator.GetBool("isRight"); if(isRight) { OpenRightDamageCollider(); } else if(isLeft) { OpenLeftDamageCollider(); } } public void CloseDamageCollider() { bool isLeft = animator.GetBool("isLeft"); bool isRight = animator.GetBool("isRight"); if(isRight) { CloseRightHandDamageCollider(); } else if(isLeft) { CloseLeftHandDamageCollider(); } } private void LoadLeftWeaponDamageCollider() { leftHandDamageCollider = leftHandSlot.currentWeaponModel.GetComponentInChildren<DamageCollider>(); } private void LoadRightWeaponDamageCollider() { rightHandDamageCollider = rightHandSlot.currentWeaponModel.GetComponentInChildren<DamageCollider>(); } public void OpenRightDamageCollider() { rightHandDamageCollider.EnableDamageCollider(); } public void OpenLeftDamageCollider() { leftHandDamageCollider.EnableDamageCollider(); } public void CloseRightHandDamageCollider() { rightHandDamageCollider.DisableDamageCollider(); } public void CloseLeftHandDamageCollider() { leftHandDamageCollider.DisableDamageCollider(); } #endregion #region Handle Weapon's Stamina Drainage public void DrainStaminaLightAttack() { //playerStates.TakeStaminaDamage(Mathf.RoundToInt(attackingWeapon.baseStamina * attackingWeapon.lightAttackMultiplier)); } public void DrainStaminaHeavyAttack() { //playerStates.TakeStaminaDamage(Mathf.RoundToInt(attackingWeapon.baseStamina * attackingWeapon.heavyAttackMultiplier)); } #endregion } }
34.752066
132
0.580975
[ "Apache-2.0" ]
yslinwe/Dark_Soul
Assets/Sricpt/Enemy/EnemyWeaponSlotManager.cs
4,207
C#
using System.Runtime.Serialization; using Newtonsoft.Json; namespace Beyova.JPush.V3 { /// <summary> /// Enum PushTypeV3 /// </summary> public enum PushTypeV3 { /// <summary> /// The value indicating it is none /// </summary> None = 0, /// <summary> /// The value indicating it is broadcast /// </summary> Broadcast = 1, /// <summary> /// The value indicating it is by tag in OR operation. /// </summary> ByTagWithinOr = 2, /// <summary> /// The value indicating it is by tag in AND operation. /// </summary> ByTagWithinAnd = 4, /// <summary> /// The value indicating it is by alias /// </summary> ByAlias = 8, /// <summary> /// The value indicating it is by registration unique identifier /// </summary> ByRegistrationId = 0x10 } }
25.810811
72
0.518325
[ "MIT" ]
rynnwang/JPush.NET
Beyova.JPush/V3/PushTypeV3.cs
957
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Subjects; using MiningCore.Util; using NLog; namespace MiningCore.Messaging { /// <summary> /// MessageBus represents an object that can act as a "Message Bus", a /// simple way for ViewModels and other objects to communicate with each /// other in a loosely coupled way. /// Specifying which messages go where is done via a combination of the Type /// of the message as well as an additional "Contract" parameter; this is a /// unique string used to distinguish between messages of the same Type, and /// is arbitrarily set by the client. /// </summary> public class MessageBus : IMessageBus { private readonly Dictionary<Tuple<Type, string>, NotAWeakReference> messageBus = new Dictionary<Tuple<Type, string>, NotAWeakReference>(); private readonly IDictionary<Tuple<Type, string>, IScheduler> schedulerMappings = new Dictionary<Tuple<Type, string>, IScheduler>(); private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); /// <summary> /// Gets or sets the Current MessageBus. /// </summary> public static IMessageBus Current { get; set; } = new MessageBus(); /// <summary> /// Registers a scheduler for the type, which may be specified at runtime, and the contract. /// </summary> /// <remarks> /// If a scheduler is already registered for the specified runtime and contract, this will overrwrite the existing /// registration. /// </remarks> /// <typeparam name="T">The type of the message to listen to.</typeparam> /// <param name="scheduler"> /// The scheduler on which to post the /// notifications for the specified type and contract. CurrentThreadScheduler by default. /// </param> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> public void RegisterScheduler<T>(IScheduler scheduler, string contract = null) { schedulerMappings[new Tuple<Type, string>(typeof(T), contract)] = scheduler; } /// <summary> /// Listen provides an Observable that will fire whenever a Message is /// provided for this object via RegisterMessageSource or SendMessage. /// </summary> /// <typeparam name="T">The type of the message to listen to.</typeparam> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> /// <returns> /// An Observable representing the notifications posted to the /// message bus. /// </returns> public IObservable<T> Listen<T>(string contract = null) { logger.Debug("Listening to {0}:{1}", typeof(T), contract); return setupSubjectIfNecessary<T>(contract).Skip(1); } /// <summary> /// Listen provides an Observable that will fire whenever a Message is /// provided for this object via RegisterMessageSource or SendMessage. /// </summary> /// <typeparam name="T">The type of the message to listen to.</typeparam> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> /// <returns> /// An Observable representing the notifications posted to the /// message bus. /// </returns> public IObservable<T> ListenIncludeLatest<T>(string contract = null) { logger.Debug("Listening to {0}:{1}", typeof(T), contract); return setupSubjectIfNecessary<T>(contract); } /// <summary> /// Determines if a particular message Type is registered. /// </summary> /// <param name="type">The Type of the message to listen to.</param> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> /// <returns>True if messages have been posted for this message Type.</returns> public bool IsRegistered(Type type, string contract = null) { var ret = false; withMessageBus(type, contract, (mb, tuple) => { ret = mb.ContainsKey(tuple) && mb[tuple].IsAlive; }); return ret; } /// <summary> /// Registers an Observable representing the stream of messages to send. /// Another part of the code can then call Listen to retrieve this /// Observable. /// </summary> /// <typeparam name="T">The type of the message to listen to.</typeparam> /// <param name="source"> /// An Observable that will be subscribed to, and a /// message sent out for each value provided. /// </param> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> public IDisposable RegisterMessageSource<T>( IObservable<T> source, string contract = null) { return source.Subscribe(setupSubjectIfNecessary<T>(contract)); } /// <summary> /// Sends a single message using the specified Type and contract. /// Consider using RegisterMessageSource instead if you will be sending /// messages in response to other changes such as property changes /// or events. /// </summary> /// <typeparam name="T">The type of the message to send.</typeparam> /// <param name="message">The actual message to send</param> /// <param name="contract"> /// A unique string to distinguish messages with /// identical types (i.e. "MyCoolViewModel") - if the message type is /// only used for one purpose, leave this as null. /// </param> public void SendMessage<T>(T message, string contract = null) { setupSubjectIfNecessary<T>(contract).OnNext(message); } private ISubject<T> setupSubjectIfNecessary<T>(string contract) { ISubject<T> ret = null; withMessageBus(typeof(T), contract, (mb, tuple) => { if (mb.TryGetValue(tuple, out var subjRef) && subjRef.IsAlive) { ret = (ISubject<T>) subjRef.Target; return; } ret = new ScheduledSubject<T>(getScheduler(tuple), null, new BehaviorSubject<T>(default(T))); mb[tuple] = new NotAWeakReference(ret); }); return ret; } private void withMessageBus( Type type, string contract, Action<Dictionary<Tuple<Type, string>, NotAWeakReference>, Tuple<Type, string>> block) { lock (messageBus) { var tuple = new Tuple<Type, string>(type, contract); block(messageBus, tuple); if (messageBus.ContainsKey(tuple) && !messageBus[tuple].IsAlive) messageBus.Remove(tuple); } } private IScheduler getScheduler(Tuple<Type, string> tuple) { schedulerMappings.TryGetValue(tuple, out var scheduler); return scheduler ?? CurrentThreadScheduler.Instance; } } internal class NotAWeakReference { public NotAWeakReference(object target) { Target = target; } public object Target { get; } public bool IsAlive => true; } } // vim: tw=120 ts=4 sw=4 et :
42.2723
127
0.57108
[ "MIT" ]
BitcoinGold-mining/miningcore
src/MiningCore/Messaging/MessageBus.cs
9,006
C#
using BannerKings.Populations; using TaleWorlds.CampaignSystem; namespace BannerKings.Models { public interface IGrowthModel : IBannerKingsModel { public ExplainedNumber CalculateEffect(Settlement settlement, PopulationData data); } }
21.5
91
0.775194
[ "BSD-3-Clause" ]
R-Vaccari/bannerlord-banner-kings
BannerKings/Models/IGrowthModel.cs
260
C#
///////////////////////////////////////////////////////////////////////////////// // // vp_RigidbodyFX.cs // © Opsive. All Rights Reserved. // https://twitter.com/Opsive // http://www.opsive.com // // description: this script can be placed on a RIGIDBODY object to make it spawn // SurfaceEffects and object sounds upon collision with external surfaces. // // the general recommendation is to have target surfaces emit GENERIC FX, // and for rigidbodies to emit their own SPECIFIC SOUNDS. // in other words: all rigidbodies should have the same (or a limited range of) // ImpactEvent(s) resulting in GENERIC impact particles + sounds for every target // surface (fx that ANY object would make when hitting the surface), and use the // CollisionSounds list to trigger impact sounds that are SPECIFIC to a certain // type of physics object, allowing for a massive range of combinatory effects. // // USAGE: // 1) make sure the gameobject has a Rigidbody component, or effects won't // play on collision. EXCEPTION: if the object has a vp_PlayerItemDropper // component, the effects will play when its animated bounce triggers // 2) assign an ImpactEvent. this is the type of impact that the object // will impose on other objects. it will determine what type of // SURFACE SOUNDS AND PARTICLE FX are emanated from the surfaces // we hit. the default ImpactEvent used on all rigidbodies in the UFPS // demo scenes is 'ObjectCollision'. in turn, this ImpactEvent is // represented in all SurfaceType objects with suitable effects assigned. // for example: an 'ObjectCollision' hitting rock will make the terrain // eject dust and pebble particles, along with a gravely sound, while an // 'ObjectCollision' hitting metal will make the metal clang, but there // are very subtle particle effects (if any). if ImpactEvent is left blank, // the SurfaceManager will try and come up with fallback effects that may // or may not make sense // 3) define what OBJECT SOUNDS this object should make upon collision // with a defined range of world surfaces. these are the sounds // that will emanate from the object itself upon collision. // for example: a wooden crate might make a hard, rattly sound when // hitting rock, but a softer, muffled sound when bouncing on grass // // NOTE: this component does NOT determine what decals and sounds to attach to the // OBJECT'S SURFACE when hit by something else (like bullets, or footsteps). // for that functionality, attach a SurfaceIdentifier to the object and assign // the SurfaceType. for a wooden crate: 'Wood' // ///////////////////////////////////////////////////////////////////////////////// using UnityEngine; using System.Collections; using System.Collections.Generic; public class vp_RigidbodyFX : MonoBehaviour { public vp_ImpactEvent ImpactEvent; // for sending an impact to the other collider #if UNITY_EDITOR [vp_HelpBox("'ImpactEvent' determines what type of impact the object will impose upon other rigidbody objects on collision.", UnityEditor.MessageType.None, null, null, false, vp_PropertyDrawerUtility.Space.Nothing)] public float impactEventHelp; #endif [Range(1, 100)] public float ImpactThreshold = 1.0f; // collisions below this force will be ignored [Range(1, 100)] public float MinCameraDistance = 20.0f; // collisions beyond this distance from the main camera will be ignored [SerializeField] public List<SurfaceFXInfo> CollisionSounds = new List<SurfaceFXInfo>(); // list of surfaces and corresponding sounds that will be emanated from this object on collision // internal state protected static float nextAllowedPlayEffectTime = 0.0f; protected bool m_HaveRigidbody = false; protected bool m_HaveObjectSounds = false; protected bool m_HaveSurfaceManager = false; // rigidbody of the gameobject. this is a required component protected Rigidbody m_RigidBody = null; public Rigidbody Rigidbody { get { if (m_RigidBody == null) { m_RigidBody = GetComponent<Rigidbody>(); if (m_RigidBody != null) m_HaveRigidbody = true; } return m_RigidBody; } } // constants protected const float STARTUP_MUTE_DELAY = 2.0f; protected const float SURFACE_DETECTION_RAYCAST_DISTANCE = 0.4f; protected const float MIN_GLOBAL_FX_INTERVAL = 0.2f; // main audio source. this will be the one found on the transform. // if none is found, one will be auto-added. NOTE: if the audio // source is used by other scripts for playing sounds, any sounds // resulting from the ImpactEvent upon the target surface will be // muted protected AudioSource m_Audio = null; protected AudioSource Audio { get { if (m_Audio == null) m_Audio = GetComponent<AudioSource>(); if (m_Audio == null) m_Audio = gameObject.AddComponent<AudioSource>(); return m_Audio; } } // auto-created second audio source. this is needed so we can play // sounds from the surface and from the object simultaneously protected AudioSource m_Audio2 = null; protected AudioSource Audio2 { get { if (m_Audio2 == null) { m_Audio2 = gameObject.AddComponent<AudioSource>(); // copy some parameters from the main audio source // TIP: add more parameters to copy here as needed m_Audio2.rolloffMode = Audio.rolloffMode; m_Audio2.minDistance = Audio.minDistance; m_Audio2.maxDistance = Audio.maxDistance; m_Audio2.spatialBlend = 1.0f; } return m_Audio2; } } // this struct is used to declare certain SurfaceEffects to spawn // upon collision with certain SurfaceTypes [System.Serializable] public struct SurfaceFXInfo { public SurfaceFXInfo(bool init) { SurfaceType = null; Sound = null; } public vp_SurfaceType SurfaceType; public AudioClip Sound; } /// <summary> /// /// </summary> protected virtual void Start() { if (Rigidbody) { } // just reference this property to set things up if ((CollisionSounds != null) && (CollisionSounds.Count > 0)) { for(int v = CollisionSounds.Count - 1; v > -1; v--) { if ((CollisionSounds[v].SurfaceType == null) || (CollisionSounds[v].Sound == null)) CollisionSounds.RemoveAt(v); } if (CollisionSounds.Count > 0) m_HaveObjectSounds = true; } m_HaveSurfaceManager = (vp_SurfaceManager.Instance != null); } /// <summary> /// returns true if the system is ready to play another collision effect, /// false if not. this is used to limit the 'spamminess' of collision fx /// </summary> public bool CanPlayFX { get { // this prevents a ton of effects going off on scene startup due to slightly // hovering rigidbodies if (Time.realtimeSinceStartup < STARTUP_MUTE_DELAY) return false; // this effectively prevents the system from playing too many sounds at once, // to avoid spammy sound crescendos, and weird doppler effects when two identical // sounds play at the same time // NOTE: this is global (not another vp_RigidBodyFX in the world will be able to play a // sound until time's up) but since this system is only active within a certain range // of the main camera, this is hardly detectable and usually an acceptable tradeoff if (Time.time < nextAllowedPlayEffectTime) return false; // this prevents effects from being played far off in the distance where we can't // reasonably see or hear them if ((Camera.main != null) && Vector3.Distance(Camera.main.transform.position, transform.position) > MinCameraDistance) return false; return true; } } /// <summary> /// extracts surface information from the object we collided with by raycasting /// to it, and attempts to play an effect based on the raycasthit /// </summary> protected virtual void OnCollisionEnter(Collision collision) { // don't waste resources on raycasting if we can't even play effects yet if (!CanPlayFX) return; // this method requires a RigidBody. without it, collision FX won't work if (!m_HaveRigidbody) return; if (Rigidbody.IsSleeping()) return; if (collision.relativeVelocity.sqrMagnitude < ImpactThreshold) return; RaycastHit hit = new RaycastHit(); // raycast to get a raycasthit, which is required for the SurfaceManager // NOTE: this is a bit crude and not suited for small (or long and thin) objects Vector3 dir = (collision.contacts[0].point - transform.position).normalized; // direction from center of object to the collision point if (!Physics.Raycast( new Ray(collision.contacts[0].point - (dir * (SURFACE_DETECTION_RAYCAST_DISTANCE * 0.5f)), dir), // raycast to the collision point from a 2dm (default) distance out hit, SURFACE_DETECTION_RAYCAST_DISTANCE, // raycast for a 4 dm (default) distance vp_Layer.Mask.ExternalBlockers)) // ignore player and all non-solids return; //Debug.Log("raycast success"); // DEBUG: if this line fails to print: the raycast failed, possibly because the object hit itself or missed because it was too small / thin // if we get here, we can play a collision effect! TryPlayFX(hit); } /// <summary> /// plays surface FX on based on a RaycastHit + the ImpactEvent of the surface /// identifier on the same transform as this component, and plays an impact sound /// emanated from this object depending on the detected SurfaceType /// </summary> public bool TryPlayFX(RaycastHit hit) { if (!CanPlayFX) return false; nextAllowedPlayEffectTime = (Time.time + MIN_GLOBAL_FX_INTERVAL); // --- spawn fx (including sounds) emanated from / on the SURFACE WE HIT in this collision --- bool mainAudioSourceTaken = Audio.isPlaying; vp_SurfaceManager.SpawnEffect(hit, ImpactEvent, (!mainAudioSourceTaken ? Audio : null)); // fallback in case of no object sounds, and if the surface effect above didn't play a sound if (!m_HaveObjectSounds) { if (m_HaveSurfaceManager && mainAudioSourceTaken) { if (ImpactEvent == null) vp_SurfaceManager.SpawnEffect(hit, vp_SurfaceManager.Instance.Fallbacks.ImpactEvent, Audio2); else vp_SurfaceManager.SpawnEffect(hit, ImpactEvent, Audio2); } return false; } // --- play sound (no particles) emanated from THIS OBJECT due to the collision --- TryPlaySound(vp_SurfaceManager.GetSurfaceType(hit)); return true; } /// <summary> /// tries to play the sound related to this object and 'surfaceType'. /// if none found, reverts to fallbacks /// </summary> public bool TryPlaySound(vp_SurfaceType surfaceType) { if (surfaceType == null) return false; if (Audio2 == null) return false; // don't allow audiosources in 'Logarithmic Rolloff' mode to be audible // beyond their max distance (Unity bug?) if (Vector3.Distance(transform.position, UnityEngine.Camera.main.transform.position) > Audio2.maxDistance) return false; if (!vp_Utility.IsActive(gameObject)) return false; bool playedSound = false; int fallback = -1; for (int v = CollisionSounds.Count - 1; v > -1; v--) { if (surfaceType == CollisionSounds[v].SurfaceType) { DoPlaySound(CollisionSounds[v].Sound); playedSound = true; } else if (m_HaveSurfaceManager && (CollisionSounds[v].SurfaceType == vp_SurfaceManager.Instance.Fallbacks.SurfaceType)) fallback = v; } if (!playedSound && (fallback >= 0)) DoPlaySound(CollisionSounds[fallback].Sound); return true; } /// <summary> /// plays 'sound' on the auto-created, second audio source /// </summary> void DoPlaySound(AudioClip sound) { if (sound == null) return; Audio2.pitch = vp_TimeUtility.AdjustedTimeScale; Audio2.clip = sound; Audio2.Stop(); Audio2.Play(); } }
32.730556
216
0.706611
[ "MIT" ]
PotentialGames/Cal-tEspa-l
BRGAME/Assets/UFPS/Base/Scripts/Effects/vp_RigidbodyFX.cs
11,786
C#
using System; using System.Linq; using System.Reflection; /// <summary> /// Methods which help bridge and contain the differences between Type and TypeInfo. /// </summary> static class NewReflectionExtensions { // New methods public static Assembly GetAssembly(this Type type) { #if PLATFORM_DOTNET return type.GetTypeInfo().Assembly; #else return type.Assembly; #endif } public static Attribute[] GetCustomAttributes(this Assembly assembly) { #if PLATFORM_DOTNET return assembly.GetCustomAttributes<Attribute>().ToArray(); #else return assembly.GetCustomAttributes(false).Cast<Attribute>().ToArray(); #endif } public static bool IsEnum(this Type type) { #if PLATFORM_DOTNET return type.GetTypeInfo().IsEnum; #else return type.IsEnum; #endif } public static bool IsFromLocalAssembly(this Type type) { var assemblyName = type.GetAssembly().GetName().Name; try { #if PLATFORM_DOTNET Assembly.Load(new AssemblyName { Name = assemblyName }); #else Assembly.Load(assemblyName); #endif return true; } catch { return false; } } public static bool IsGenericType(this Type type) { #if PLATFORM_DOTNET return type.GetTypeInfo().IsGenericType; #else return type.IsGenericType; #endif } public static bool IsGenericTypeDefinition(this Type type) { #if PLATFORM_DOTNET return type.GetTypeInfo().IsGenericTypeDefinition; #else return type.IsGenericTypeDefinition; #endif } public static bool IsNullableEnum(this Type type) { return type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(Nullable<>) && type.GetGenericArguments()[0].IsEnum(); } public static bool IsValueType(this Type type) { #if PLATFORM_DOTNET return type.GetTypeInfo().IsValueType; #else return type.IsValueType; #endif } public static Type UnwrapNullable(this Type type) { if (!type.IsGenericType()) return type; if (type.GetGenericTypeDefinition() != typeof(Nullable<>)) return type; return type.GetGenericArguments()[0]; } // Existing methods #if PLATFORM_DOTNET public static Type[] GetGenericArguments(this Type type) { return type.GetTypeInfo().GenericTypeArguments; } public static bool IsAssignableFrom(this Type type, Type otherType) { return type.GetTypeInfo().IsAssignableFrom(otherType.GetTypeInfo()); } #endif }
23.168142
135
0.657754
[ "Apache-2.0" ]
ErikSchierboom/xunit
src/common/NewReflectionExtensions.cs
2,618
C#
using System; using System.Collections.Generic; using System.Linq; class ForumTopics { static void Main(string[] args) { Dictionary<string, HashSet<string>> dataForum = new Dictionary<string, HashSet<string>>(); string[] inputTokens = Console.ReadLine() .Split(new string[] { " -> " }, StringSplitOptions .RemoveEmptyEntries); while (inputTokens[0] != "filter") { string keyWord = inputTokens[0]; List<string> valueWords = inputTokens[1] .Split(new string[] { ", " }, StringSplitOptions .RemoveEmptyEntries) .ToList(); if (!dataForum.ContainsKey(keyWord)) { dataForum.Add(keyWord, new HashSet<string>()); } foreach (var word in valueWords) { dataForum[keyWord].Add(word); } inputTokens = Console.ReadLine() .Split(new string[] { " -> " }, StringSplitOptions .RemoveEmptyEntries); } string[] searchInput = Console.ReadLine() .Split(new string[] { ", " }, StringSplitOptions .RemoveEmptyEntries); int length = searchInput.Length; foreach (var data in dataForum) { string key = data.Key; HashSet<string> values = data.Value; int count = 0; foreach (var search in searchInput) { foreach (var value in values) { if (value == search) { count++; if (count == length) { Console.WriteLine( $"{key} | #{string.Join(", #", values)}"); } } } } } } }
27.712329
98
0.43302
[ "MIT" ]
vesy53/SoftUni
Tech Module/Extended-Programming-Fundamentals/ExtendedNestedDictionariesExercises/p06ForumTopics/ForumTopics.cs
2,025
C#
using Blazor.Skeleton.Server.Data; namespace Blazor.Skeleton.Server.Services.PokemonService { public class PokemonServiceProd : IPokemonService { private readonly DataContext _dataContext; public PokemonServiceProd(DataContext dataContext) { _dataContext = dataContext; } public async Task<List<Pokemon>> GetAll() { var pokemons = await _dataContext.Pokemons.ToListAsync(); return pokemons; } public async Task<Pokemon> GetPokemon(int id) { var pokemon = await _dataContext.Pokemons.SingleOrDefaultAsync(p => p.Id == id); return pokemon; } } }
24.241379
92
0.618777
[ "MIT" ]
kasuken/Blazor.Skeleton
src/Blazor.Skeleton/Server/Services/PokemonService/PokemonServiceProd.cs
705
C#
/* * athenahealth More Disruption Please (MDP) API * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: 2.0.0 * * Generated by: https://github.com/swagger-api/swagger-codegen.git */ using System; using System.Linq; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.ComponentModel.DataAnnotations; using SwaggerDateConverter = Jacrys.AthenaSharp.Client.SwaggerDateConverter; namespace Jacrys.AthenaSharp.Model { /// <summary> /// Patient /// </summary> [DataContract] public partial class Patient : IEquatable<Patient>, IValidatableObject { /// <summary> /// Initializes a new instance of the <see cref="Patient" /> class. /// </summary> /// <param name="homeboundyn">If the patient is homebound, this is true..</param> /// <param name="assignedsexatbirth">Sex that this patient was assigned at birth..</param> /// <param name="altfirstname">Alternate first name that differs from legal name..</param> /// <param name="ethnicitycode">Ethnicity of the patient, using the 2.16.840.1.113883.5.50 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. .</param> /// <param name="industrycode">Industry of the patient, using the US Census industry code (code system 2.16.840.1.113883.6.310). \&quot;other\&quot; can be used as well..</param> /// <param name="language6392code">Language of the patient, using the ISO 639.2 code. (http://www.loc.gov/standards/iso639-2/php/code_list.php; \&quot;T\&quot; or terminology code) Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. .</param> /// <param name="localpatientid">Given showlocalpatientid is true, comma separated local patient id will be returned, if patient id is enterprise id else given patient id will be displayed..</param> /// <param name="deceaseddate">If present, the date on which a patient died..</param> /// <param name="firstappointment">The first appointment for this patient, excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi).</param> /// <param name="primaryproviderid">The \&quot;primary\&quot; provider for this patient, if set..</param> /// <param name="genderidentityother">If a patient does not identify with any prescribed gender identity choice, this field stores the patient-provided description of gender identity..</param> /// <param name="portalstatus">Portal status details. See /patients/{patientid}/portalstatus for details..</param> /// <param name="preferredpronouns">Pronoun this patient uses..</param> /// <param name="lastappointment">The last appointment for this patient (before today), excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi).</param> /// <param name="allpatientstatuses">message.</param> /// <param name="donotcallyn">Warning! This patient will not receive any communication from the practice if this field is set to true..</param> /// <param name="primarydepartmentid">The patient&#x27;s \&quot;current\&quot; department. This field is not always set by the practice..</param> /// <param name="status">The \&quot;status\&quot; of the patient, one of active, inactive, prospective, or deleted..</param> /// <param name="balances">List of balances owed by the patient, broken down by provider (financial) group..</param> /// <param name="lastemail">The last email for this patient on file..</param> /// <param name="racecode">The patient race hierarchical code as specified in Race &amp; Ethnicity - CDC * (2.16.840.1.113883.1.11.14914).</param> /// <param name="sexualorientation">Sexual orientation of this patient..</param> /// <param name="genderidentity">Gender with which this patient identifies..</param> /// <param name="emailexistsyn">True if email exists. False if patient declined. Null if status is unknown..</param> /// <param name="occupationcode">Occupation of the patient, using the US Census occupation code (code system 2.16.840.1.113883.6.240). \&quot;other\&quot; can be used as well..</param> /// <param name="race">The patient race, using the 2.16.840.1.113883.5.104 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. Multiple values or a tab-seperated list of codes is acceptable for multiple races for input. The first race will be considered \&quot;primary\&quot;. Note: you must update all values at once if you update any. .</param> /// <param name="sexualorientationother">If a patient does not identify with any prescribed sexual orientation choice, this field stores the patient-provided description of sexual orientation..</param> /// <param name="patientid">Please remember to never disclose this ID to patients since it may result in inadvertant disclosure that a patient exists in a practice already..</param> /// <param name="firstname">Patient&#x27;s first name.</param> /// <param name="middlename">Patient&#x27;s middle name.</param> /// <param name="lastname">Patient&#x27;s last name.</param> /// <param name="suffix">Patient&#x27;s name suffix.</param> /// <param name="preferredname">The patient&#x27;s preferred name (i.e. nickname)..</param> /// <param name="address1">Patient&#x27;s address - 1st line.</param> /// <param name="address2">Patient&#x27;s address - 2nd line.</param> /// <param name="city">Patient&#x27;s city.</param> /// <param name="state">Patient&#x27;s state (2 letter abbreviation).</param> /// <param name="zip">Patient&#x27;s zip. Matching occurs on first 5 characters..</param> /// <param name="countrycode">Patient&#x27;s country code.</param> /// <param name="countrycode3166">Patient&#x27;s country code (ISO 3166-1).</param> /// <param name="homephone">The patient&#x27;s home phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="mobilephone">The patient&#x27;s mobile phone number. On input, &#x27;declined&#x27; can be used to indicate no number. (Alternatively, hasmobile can also be set to false. \&quot;declined\&quot; simply does this for you.) Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="hasmobileyn">Set to false if a client has declined a phone number..</param> /// <param name="workphone">The patient&#x27;s work phone number. Generally not used to contact a patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="email">Patient&#x27;s email address. &#x27;declined&#x27; can be used to indicate just that..</param> /// <param name="ssn">The patient&#x27;s SSN.</param> /// <param name="racename">The patient&#x27;s primary race name. See race for more complete details..</param> /// <param name="sex">Patient&#x27;s sex (M/F).</param> /// <param name="dob">Patient&#x27;s DOB (mm/dd/yyyy).</param> /// <param name="maritalstatus">Marital Status (D&#x3D;Divorced, M&#x3D;Married, S&#x3D;Single, U&#x3D;Unknown, W&#x3D;Widowed, X&#x3D;Separated, P&#x3D;Partner).</param> /// <param name="contactpreference">The MU-required field for \&quot;preferred contact method\&quot;. This is not used by any automated systems..</param> /// <param name="contactname">The name of the (emergency) person to contact about the patient. The contactname, contactrelationship, contacthomephone, and contactmobilephone fields are all related to the emergency contact for the patient. They are NOT related to the contractpreference_* fields. .</param> /// <param name="contactrelationship">Emergency contact relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER).</param> /// <param name="contacthomephone">Emergency contact home phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="contactmobilephone">Emergency contact mobile phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="nextkinname">The full name of the next of kin..</param> /// <param name="nextkinrelationship">The next of kin relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER).</param> /// <param name="nextkinphone">The next of kin phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="guardianfirstname">The first name of the patient&#x27;s guardian..</param> /// <param name="guardianmiddlename">The middle name of the patient&#x27;s guardian..</param> /// <param name="guardianlastname">The last name of the patient&#x27;s guardian..</param> /// <param name="guardiansuffix">The suffix of the patient&#x27;s guardian..</param> /// <param name="guarantorfirstname">Guarantor&#x27;s first name.</param> /// <param name="guarantormiddlename">Guarantor&#x27;s middle name.</param> /// <param name="guarantorlastname">Guarantor&#x27;s last name.</param> /// <param name="guarantorsuffix">Guarantor&#x27;s name suffix.</param> /// <param name="guarantoraddress1">Guarantor&#x27;s address.</param> /// <param name="guarantoraddress2">Guarantor&#x27;s address - line 2.</param> /// <param name="guarantorcity">Guarantor&#x27;s city.</param> /// <param name="guarantorstate">Guarantor&#x27;s state (2 letter abbreviation).</param> /// <param name="guarantorzip">Guarantor&#x27;s zip.</param> /// <param name="guarantorcountrycode">Guarantor&#x27;s country code.</param> /// <param name="guarantorcountrycode3166">Guarantor&#x27;s country code (ISO 3166-1).</param> /// <param name="guarantordob">Guarantor&#x27;s DOB (mm/dd/yyyy).</param> /// <param name="guarantorssn">Guarantor&#x27;s SSN.</param> /// <param name="guarantoremail">Guarantor&#x27;s email address.</param> /// <param name="guarantorphone">Guarantor&#x27;s phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="guarantorrelationshiptopatient">The guarantor&#x27;s relationship to the patient.</param> /// <param name="guarantoraddresssameaspatient">The address of the guarantor is the same as the patient..</param> /// <param name="registrationdate">Date the patient was registered..</param> /// <param name="departmentid">Primary (registration) department ID..</param> /// <param name="portaltermsonfile">Flag determining whether or not the patient has accepted the Terms and Conditions for the patient portal..</param> /// <param name="portalsignatureonfile">This flag is set if the patient&#x27;s signature is on file.</param> /// <param name="privacyinformationverified">This flag is set if the patient&#x27;s privacy information has been verified. Privacy information returns True if all of the items referenced in GET /patients/{patientid}/privacyinformationverified are true. Privacy information returns false if any of the items referenced in the GET /patients/{patientid}/privacyinformationverified API are false or expired. .</param> /// <param name="medicationhistoryconsentverified">Medication history consent status. If a practice doesn&#x27;t have RXHub or Surescripts enabled, this will be null.</param> /// <param name="maritalstatusname">The long version of the marital status..</param> /// <param name="employerid">The patient&#x27;s employer&#x27;s ID (from /employers call).</param> /// <param name="employerphone">The patient&#x27;s employer&#x27;s phone number. Normally, this is set by setting employerid. However, setting this value can be used to override this on an individual patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. .</param> /// <param name="guarantoremployerid">The guaranror&#x27;s employer&#x27;s ID (from /employers call).</param> /// <param name="employername">The patient&#x27;s employer&#x27;s name..</param> /// <param name="employeraddress">The patient&#x27;s employer&#x27;s address..</param> /// <param name="employercity">The patient&#x27;s employer&#x27;s city..</param> /// <param name="portalaccessgiven">This flag is set if the patient has been given access to the portal. This may be set by the API user if a patient has been given access to the portal \&quot;by providing a preprinted brochure or flyer showing the URL where patients can access their Patient Care Summaries.\&quot; The practiceinfo endpoint can provide the portal URL. While technically allowed, it would be very unusual to set this to false via the API. .</param> public Patient(bool? homeboundyn = default(bool?), string assignedsexatbirth = default(string), string altfirstname = default(string), string ethnicitycode = default(string), int? industrycode = default(int?), string language6392code = default(string), string localpatientid = default(string), string deceaseddate = default(string), string firstappointment = default(string), int? primaryproviderid = default(int?), string genderidentityother = default(string), List<PatientPortalStatus> portalstatus = default(List<PatientPortalStatus>), string preferredpronouns = default(string), string lastappointment = default(string), List<PatientDeparmentStatus> allpatientstatuses = default(List<PatientDeparmentStatus>), bool? donotcallyn = default(bool?), int? primarydepartmentid = default(int?), string status = default(string), List<PatientBalance> balances = default(List<PatientBalance>), string lastemail = default(string), string racecode = default(string), string sexualorientation = default(string), string genderidentity = default(string), bool? emailexistsyn = default(bool?), int? occupationcode = default(int?), List<string> race = default(List<string>), string sexualorientationother = default(string), int? patientid = default(int?), string firstname = default(string), string middlename = default(string), string lastname = default(string), string suffix = default(string), string preferredname = default(string), string address1 = default(string), string address2 = default(string), string city = default(string), string state = default(string), string zip = default(string), string countrycode = default(string), string countrycode3166 = default(string), string homephone = default(string), string mobilephone = default(string), bool? hasmobileyn = default(bool?), string workphone = default(string), string email = default(string), string ssn = default(string), string racename = default(string), string sex = default(string), string dob = default(string), string maritalstatus = default(string), string contactpreference = default(string), string contactname = default(string), string contactrelationship = default(string), string contacthomephone = default(string), string contactmobilephone = default(string), string nextkinname = default(string), string nextkinrelationship = default(string), string nextkinphone = default(string), string guardianfirstname = default(string), string guardianmiddlename = default(string), string guardianlastname = default(string), string guardiansuffix = default(string), string guarantorfirstname = default(string), string guarantormiddlename = default(string), string guarantorlastname = default(string), string guarantorsuffix = default(string), string guarantoraddress1 = default(string), string guarantoraddress2 = default(string), string guarantorcity = default(string), string guarantorstate = default(string), string guarantorzip = default(string), string guarantorcountrycode = default(string), string guarantorcountrycode3166 = default(string), string guarantordob = default(string), string guarantorssn = default(string), string guarantoremail = default(string), string guarantorphone = default(string), int? guarantorrelationshiptopatient = default(int?), bool? guarantoraddresssameaspatient = default(bool?), string registrationdate = default(string), int? departmentid = default(int?), bool? portaltermsonfile = default(bool?), bool? portalsignatureonfile = default(bool?), bool? privacyinformationverified = default(bool?), bool? medicationhistoryconsentverified = default(bool?), string maritalstatusname = default(string), int? employerid = default(int?), string employerphone = default(string), int? guarantoremployerid = default(int?), string employername = default(string), string employeraddress = default(string), string employercity = default(string), bool? portalaccessgiven = default(bool?)) { this.Homeboundyn = homeboundyn; this.Assignedsexatbirth = assignedsexatbirth; this.Altfirstname = altfirstname; this.Ethnicitycode = ethnicitycode; this.Industrycode = industrycode; this.Language6392code = language6392code; this.Localpatientid = localpatientid; this.Deceaseddate = deceaseddate; this.Firstappointment = firstappointment; this.Primaryproviderid = primaryproviderid; this.Genderidentityother = genderidentityother; this.Portalstatus = portalstatus; this.Preferredpronouns = preferredpronouns; this.Lastappointment = lastappointment; this.Allpatientstatuses = allpatientstatuses; this.Donotcallyn = donotcallyn; this.Primarydepartmentid = primarydepartmentid; this.Status = status; this.Balances = balances; this.Lastemail = lastemail; this.Racecode = racecode; this.Sexualorientation = sexualorientation; this.Genderidentity = genderidentity; this.Emailexistsyn = emailexistsyn; this.Occupationcode = occupationcode; this.Race = race; this.Sexualorientationother = sexualorientationother; this.Patientid = patientid; this.Firstname = firstname; this.Middlename = middlename; this.Lastname = lastname; this.Suffix = suffix; this.Preferredname = preferredname; this.Address1 = address1; this.Address2 = address2; this.City = city; this.State = state; this.Zip = zip; this.Countrycode = countrycode; this.Countrycode3166 = countrycode3166; this.Homephone = homephone; this.Mobilephone = mobilephone; this.Hasmobileyn = hasmobileyn; this.Workphone = workphone; this.Email = email; this.Ssn = ssn; this.Racename = racename; this.Sex = sex; this.Dob = dob; this.Maritalstatus = maritalstatus; this.Contactpreference = contactpreference; this.Contactname = contactname; this.Contactrelationship = contactrelationship; this.Contacthomephone = contacthomephone; this.Contactmobilephone = contactmobilephone; this.Nextkinname = nextkinname; this.Nextkinrelationship = nextkinrelationship; this.Nextkinphone = nextkinphone; this.Guardianfirstname = guardianfirstname; this.Guardianmiddlename = guardianmiddlename; this.Guardianlastname = guardianlastname; this.Guardiansuffix = guardiansuffix; this.Guarantorfirstname = guarantorfirstname; this.Guarantormiddlename = guarantormiddlename; this.Guarantorlastname = guarantorlastname; this.Guarantorsuffix = guarantorsuffix; this.Guarantoraddress1 = guarantoraddress1; this.Guarantoraddress2 = guarantoraddress2; this.Guarantorcity = guarantorcity; this.Guarantorstate = guarantorstate; this.Guarantorzip = guarantorzip; this.Guarantorcountrycode = guarantorcountrycode; this.Guarantorcountrycode3166 = guarantorcountrycode3166; this.Guarantordob = guarantordob; this.Guarantorssn = guarantorssn; this.Guarantoremail = guarantoremail; this.Guarantorphone = guarantorphone; this.Guarantorrelationshiptopatient = guarantorrelationshiptopatient; this.Guarantoraddresssameaspatient = guarantoraddresssameaspatient; this.Registrationdate = registrationdate; this.Departmentid = departmentid; this.Portaltermsonfile = portaltermsonfile; this.Portalsignatureonfile = portalsignatureonfile; this.Privacyinformationverified = privacyinformationverified; this.Medicationhistoryconsentverified = medicationhistoryconsentverified; this.Maritalstatusname = maritalstatusname; this.Employerid = employerid; this.Employerphone = employerphone; this.Guarantoremployerid = guarantoremployerid; this.Employername = employername; this.Employeraddress = employeraddress; this.Employercity = employercity; this.Portalaccessgiven = portalaccessgiven; } /// <summary> /// If the patient is homebound, this is true. /// </summary> /// <value>If the patient is homebound, this is true.</value> [DataMember(Name="homeboundyn", EmitDefaultValue=false)] public bool? Homeboundyn { get; set; } /// <summary> /// Sex that this patient was assigned at birth. /// </summary> /// <value>Sex that this patient was assigned at birth.</value> [DataMember(Name="assignedsexatbirth", EmitDefaultValue=false)] public string Assignedsexatbirth { get; set; } /// <summary> /// Alternate first name that differs from legal name. /// </summary> /// <value>Alternate first name that differs from legal name.</value> [DataMember(Name="altfirstname", EmitDefaultValue=false)] public string Altfirstname { get; set; } /// <summary> /// Ethnicity of the patient, using the 2.16.840.1.113883.5.50 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. /// </summary> /// <value>Ethnicity of the patient, using the 2.16.840.1.113883.5.50 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. </value> [DataMember(Name="ethnicitycode", EmitDefaultValue=false)] public string Ethnicitycode { get; set; } /// <summary> /// Industry of the patient, using the US Census industry code (code system 2.16.840.1.113883.6.310). \&quot;other\&quot; can be used as well. /// </summary> /// <value>Industry of the patient, using the US Census industry code (code system 2.16.840.1.113883.6.310). \&quot;other\&quot; can be used as well.</value> [DataMember(Name="industrycode", EmitDefaultValue=false)] public int? Industrycode { get; set; } /// <summary> /// Language of the patient, using the ISO 639.2 code. (http://www.loc.gov/standards/iso639-2/php/code_list.php; \&quot;T\&quot; or terminology code) Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. /// </summary> /// <value>Language of the patient, using the ISO 639.2 code. (http://www.loc.gov/standards/iso639-2/php/code_list.php; \&quot;T\&quot; or terminology code) Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. </value> [DataMember(Name="language6392code", EmitDefaultValue=false)] public string Language6392code { get; set; } /// <summary> /// Given showlocalpatientid is true, comma separated local patient id will be returned, if patient id is enterprise id else given patient id will be displayed. /// </summary> /// <value>Given showlocalpatientid is true, comma separated local patient id will be returned, if patient id is enterprise id else given patient id will be displayed.</value> [DataMember(Name="localpatientid", EmitDefaultValue=false)] public string Localpatientid { get; set; } /// <summary> /// If present, the date on which a patient died. /// </summary> /// <value>If present, the date on which a patient died.</value> [DataMember(Name="deceaseddate", EmitDefaultValue=false)] public string Deceaseddate { get; set; } /// <summary> /// The first appointment for this patient, excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi) /// </summary> /// <value>The first appointment for this patient, excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi)</value> [DataMember(Name="firstappointment", EmitDefaultValue=false)] public string Firstappointment { get; set; } /// <summary> /// The \&quot;primary\&quot; provider for this patient, if set. /// </summary> /// <value>The \&quot;primary\&quot; provider for this patient, if set.</value> [DataMember(Name="primaryproviderid", EmitDefaultValue=false)] public int? Primaryproviderid { get; set; } /// <summary> /// If a patient does not identify with any prescribed gender identity choice, this field stores the patient-provided description of gender identity. /// </summary> /// <value>If a patient does not identify with any prescribed gender identity choice, this field stores the patient-provided description of gender identity.</value> [DataMember(Name="genderidentityother", EmitDefaultValue=false)] public string Genderidentityother { get; set; } /// <summary> /// Portal status details. See /patients/{patientid}/portalstatus for details. /// </summary> /// <value>Portal status details. See /patients/{patientid}/portalstatus for details.</value> [DataMember(Name="portalstatus", EmitDefaultValue=false)] public List<PatientPortalStatus> Portalstatus { get; set; } /// <summary> /// Pronoun this patient uses. /// </summary> /// <value>Pronoun this patient uses.</value> [DataMember(Name="preferredpronouns", EmitDefaultValue=false)] public string Preferredpronouns { get; set; } /// <summary> /// The last appointment for this patient (before today), excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi) /// </summary> /// <value>The last appointment for this patient (before today), excluding cancelled or no-show appointments. (mm/dd/yyyy h24:mi)</value> [DataMember(Name="lastappointment", EmitDefaultValue=false)] public string Lastappointment { get; set; } /// <summary> /// message /// </summary> /// <value>message</value> [DataMember(Name="allpatientstatuses", EmitDefaultValue=false)] public List<PatientDeparmentStatus> Allpatientstatuses { get; set; } /// <summary> /// Warning! This patient will not receive any communication from the practice if this field is set to true. /// </summary> /// <value>Warning! This patient will not receive any communication from the practice if this field is set to true.</value> [DataMember(Name="donotcallyn", EmitDefaultValue=false)] public bool? Donotcallyn { get; set; } /// <summary> /// The patient&#x27;s \&quot;current\&quot; department. This field is not always set by the practice. /// </summary> /// <value>The patient&#x27;s \&quot;current\&quot; department. This field is not always set by the practice.</value> [DataMember(Name="primarydepartmentid", EmitDefaultValue=false)] public int? Primarydepartmentid { get; set; } /// <summary> /// The \&quot;status\&quot; of the patient, one of active, inactive, prospective, or deleted. /// </summary> /// <value>The \&quot;status\&quot; of the patient, one of active, inactive, prospective, or deleted.</value> [DataMember(Name="status", EmitDefaultValue=false)] public string Status { get; set; } /// <summary> /// List of balances owed by the patient, broken down by provider (financial) group. /// </summary> /// <value>List of balances owed by the patient, broken down by provider (financial) group.</value> [DataMember(Name="balances", EmitDefaultValue=false)] public List<PatientBalance> Balances { get; set; } /// <summary> /// The last email for this patient on file. /// </summary> /// <value>The last email for this patient on file.</value> [DataMember(Name="lastemail", EmitDefaultValue=false)] public string Lastemail { get; set; } /// <summary> /// The patient race hierarchical code as specified in Race &amp; Ethnicity - CDC * (2.16.840.1.113883.1.11.14914) /// </summary> /// <value>The patient race hierarchical code as specified in Race &amp; Ethnicity - CDC * (2.16.840.1.113883.1.11.14914)</value> [DataMember(Name="racecode", EmitDefaultValue=false)] public string Racecode { get; set; } /// <summary> /// Sexual orientation of this patient. /// </summary> /// <value>Sexual orientation of this patient.</value> [DataMember(Name="sexualorientation", EmitDefaultValue=false)] public string Sexualorientation { get; set; } /// <summary> /// Gender with which this patient identifies. /// </summary> /// <value>Gender with which this patient identifies.</value> [DataMember(Name="genderidentity", EmitDefaultValue=false)] public string Genderidentity { get; set; } /// <summary> /// True if email exists. False if patient declined. Null if status is unknown. /// </summary> /// <value>True if email exists. False if patient declined. Null if status is unknown.</value> [DataMember(Name="emailexistsyn", EmitDefaultValue=false)] public bool? Emailexistsyn { get; set; } /// <summary> /// Occupation of the patient, using the US Census occupation code (code system 2.16.840.1.113883.6.240). \&quot;other\&quot; can be used as well. /// </summary> /// <value>Occupation of the patient, using the US Census occupation code (code system 2.16.840.1.113883.6.240). \&quot;other\&quot; can be used as well.</value> [DataMember(Name="occupationcode", EmitDefaultValue=false)] public int? Occupationcode { get; set; } /// <summary> /// The patient race, using the 2.16.840.1.113883.5.104 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. Multiple values or a tab-seperated list of codes is acceptable for multiple races for input. The first race will be considered \&quot;primary\&quot;. Note: you must update all values at once if you update any. /// </summary> /// <value>The patient race, using the 2.16.840.1.113883.5.104 codeset. See http://www.hl7.org/implement/standards/fhir/terminologies-v3.html Special case: use \&quot;declined\&quot; to indicate that the patient declined to answer. Multiple values or a tab-seperated list of codes is acceptable for multiple races for input. The first race will be considered \&quot;primary\&quot;. Note: you must update all values at once if you update any. </value> [DataMember(Name="race", EmitDefaultValue=false)] public List<string> Race { get; set; } /// <summary> /// If a patient does not identify with any prescribed sexual orientation choice, this field stores the patient-provided description of sexual orientation. /// </summary> /// <value>If a patient does not identify with any prescribed sexual orientation choice, this field stores the patient-provided description of sexual orientation.</value> [DataMember(Name="sexualorientationother", EmitDefaultValue=false)] public string Sexualorientationother { get; set; } /// <summary> /// Please remember to never disclose this ID to patients since it may result in inadvertant disclosure that a patient exists in a practice already. /// </summary> /// <value>Please remember to never disclose this ID to patients since it may result in inadvertant disclosure that a patient exists in a practice already.</value> [DataMember(Name="patientid", EmitDefaultValue=false)] public int? Patientid { get; set; } /// <summary> /// Patient&#x27;s first name /// </summary> /// <value>Patient&#x27;s first name</value> [DataMember(Name="firstname", EmitDefaultValue=false)] public string Firstname { get; set; } /// <summary> /// Patient&#x27;s middle name /// </summary> /// <value>Patient&#x27;s middle name</value> [DataMember(Name="middlename", EmitDefaultValue=false)] public string Middlename { get; set; } /// <summary> /// Patient&#x27;s last name /// </summary> /// <value>Patient&#x27;s last name</value> [DataMember(Name="lastname", EmitDefaultValue=false)] public string Lastname { get; set; } /// <summary> /// Patient&#x27;s name suffix /// </summary> /// <value>Patient&#x27;s name suffix</value> [DataMember(Name="suffix", EmitDefaultValue=false)] public string Suffix { get; set; } /// <summary> /// The patient&#x27;s preferred name (i.e. nickname). /// </summary> /// <value>The patient&#x27;s preferred name (i.e. nickname).</value> [DataMember(Name="preferredname", EmitDefaultValue=false)] public string Preferredname { get; set; } /// <summary> /// Patient&#x27;s address - 1st line /// </summary> /// <value>Patient&#x27;s address - 1st line</value> [DataMember(Name="address1", EmitDefaultValue=false)] public string Address1 { get; set; } /// <summary> /// Patient&#x27;s address - 2nd line /// </summary> /// <value>Patient&#x27;s address - 2nd line</value> [DataMember(Name="address2", EmitDefaultValue=false)] public string Address2 { get; set; } /// <summary> /// Patient&#x27;s city /// </summary> /// <value>Patient&#x27;s city</value> [DataMember(Name="city", EmitDefaultValue=false)] public string City { get; set; } /// <summary> /// Patient&#x27;s state (2 letter abbreviation) /// </summary> /// <value>Patient&#x27;s state (2 letter abbreviation)</value> [DataMember(Name="state", EmitDefaultValue=false)] public string State { get; set; } /// <summary> /// Patient&#x27;s zip. Matching occurs on first 5 characters. /// </summary> /// <value>Patient&#x27;s zip. Matching occurs on first 5 characters.</value> [DataMember(Name="zip", EmitDefaultValue=false)] public string Zip { get; set; } /// <summary> /// Patient&#x27;s country code /// </summary> /// <value>Patient&#x27;s country code</value> [DataMember(Name="countrycode", EmitDefaultValue=false)] public string Countrycode { get; set; } /// <summary> /// Patient&#x27;s country code (ISO 3166-1) /// </summary> /// <value>Patient&#x27;s country code (ISO 3166-1)</value> [DataMember(Name="countrycode3166", EmitDefaultValue=false)] public string Countrycode3166 { get; set; } /// <summary> /// The patient&#x27;s home phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>The patient&#x27;s home phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="homephone", EmitDefaultValue=false)] public string Homephone { get; set; } /// <summary> /// The patient&#x27;s mobile phone number. On input, &#x27;declined&#x27; can be used to indicate no number. (Alternatively, hasmobile can also be set to false. \&quot;declined\&quot; simply does this for you.) Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>The patient&#x27;s mobile phone number. On input, &#x27;declined&#x27; can be used to indicate no number. (Alternatively, hasmobile can also be set to false. \&quot;declined\&quot; simply does this for you.) Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="mobilephone", EmitDefaultValue=false)] public string Mobilephone { get; set; } /// <summary> /// Set to false if a client has declined a phone number. /// </summary> /// <value>Set to false if a client has declined a phone number.</value> [DataMember(Name="hasmobileyn", EmitDefaultValue=false)] public bool? Hasmobileyn { get; set; } /// <summary> /// The patient&#x27;s work phone number. Generally not used to contact a patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>The patient&#x27;s work phone number. Generally not used to contact a patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="workphone", EmitDefaultValue=false)] public string Workphone { get; set; } /// <summary> /// Patient&#x27;s email address. &#x27;declined&#x27; can be used to indicate just that. /// </summary> /// <value>Patient&#x27;s email address. &#x27;declined&#x27; can be used to indicate just that.</value> [DataMember(Name="email", EmitDefaultValue=false)] public string Email { get; set; } /// <summary> /// The patient&#x27;s SSN /// </summary> /// <value>The patient&#x27;s SSN</value> [DataMember(Name="ssn", EmitDefaultValue=false)] public string Ssn { get; set; } /// <summary> /// The patient&#x27;s primary race name. See race for more complete details. /// </summary> /// <value>The patient&#x27;s primary race name. See race for more complete details.</value> [DataMember(Name="racename", EmitDefaultValue=false)] public string Racename { get; set; } /// <summary> /// Patient&#x27;s sex (M/F) /// </summary> /// <value>Patient&#x27;s sex (M/F)</value> [DataMember(Name="sex", EmitDefaultValue=false)] public string Sex { get; set; } /// <summary> /// Patient&#x27;s DOB (mm/dd/yyyy) /// </summary> /// <value>Patient&#x27;s DOB (mm/dd/yyyy)</value> [DataMember(Name="dob", EmitDefaultValue=false)] public string Dob { get; set; } /// <summary> /// Marital Status (D&#x3D;Divorced, M&#x3D;Married, S&#x3D;Single, U&#x3D;Unknown, W&#x3D;Widowed, X&#x3D;Separated, P&#x3D;Partner) /// </summary> /// <value>Marital Status (D&#x3D;Divorced, M&#x3D;Married, S&#x3D;Single, U&#x3D;Unknown, W&#x3D;Widowed, X&#x3D;Separated, P&#x3D;Partner)</value> [DataMember(Name="maritalstatus", EmitDefaultValue=false)] public string Maritalstatus { get; set; } /// <summary> /// The MU-required field for \&quot;preferred contact method\&quot;. This is not used by any automated systems. /// </summary> /// <value>The MU-required field for \&quot;preferred contact method\&quot;. This is not used by any automated systems.</value> [DataMember(Name="contactpreference", EmitDefaultValue=false)] public string Contactpreference { get; set; } /// <summary> /// The name of the (emergency) person to contact about the patient. The contactname, contactrelationship, contacthomephone, and contactmobilephone fields are all related to the emergency contact for the patient. They are NOT related to the contractpreference_* fields. /// </summary> /// <value>The name of the (emergency) person to contact about the patient. The contactname, contactrelationship, contacthomephone, and contactmobilephone fields are all related to the emergency contact for the patient. They are NOT related to the contractpreference_* fields. </value> [DataMember(Name="contactname", EmitDefaultValue=false)] public string Contactname { get; set; } /// <summary> /// Emergency contact relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER) /// </summary> /// <value>Emergency contact relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER)</value> [DataMember(Name="contactrelationship", EmitDefaultValue=false)] public string Contactrelationship { get; set; } /// <summary> /// Emergency contact home phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>Emergency contact home phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="contacthomephone", EmitDefaultValue=false)] public string Contacthomephone { get; set; } /// <summary> /// Emergency contact mobile phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>Emergency contact mobile phone. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="contactmobilephone", EmitDefaultValue=false)] public string Contactmobilephone { get; set; } /// <summary> /// The full name of the next of kin. /// </summary> /// <value>The full name of the next of kin.</value> [DataMember(Name="nextkinname", EmitDefaultValue=false)] public string Nextkinname { get; set; } /// <summary> /// The next of kin relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER) /// </summary> /// <value>The next of kin relationship (one of SPOUSE, PARENT, CHILD, SIBLING, FRIEND, COUSIN, GUARDIAN, OTHER)</value> [DataMember(Name="nextkinrelationship", EmitDefaultValue=false)] public string Nextkinrelationship { get; set; } /// <summary> /// The next of kin phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>The next of kin phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="nextkinphone", EmitDefaultValue=false)] public string Nextkinphone { get; set; } /// <summary> /// The first name of the patient&#x27;s guardian. /// </summary> /// <value>The first name of the patient&#x27;s guardian.</value> [DataMember(Name="guardianfirstname", EmitDefaultValue=false)] public string Guardianfirstname { get; set; } /// <summary> /// The middle name of the patient&#x27;s guardian. /// </summary> /// <value>The middle name of the patient&#x27;s guardian.</value> [DataMember(Name="guardianmiddlename", EmitDefaultValue=false)] public string Guardianmiddlename { get; set; } /// <summary> /// The last name of the patient&#x27;s guardian. /// </summary> /// <value>The last name of the patient&#x27;s guardian.</value> [DataMember(Name="guardianlastname", EmitDefaultValue=false)] public string Guardianlastname { get; set; } /// <summary> /// The suffix of the patient&#x27;s guardian. /// </summary> /// <value>The suffix of the patient&#x27;s guardian.</value> [DataMember(Name="guardiansuffix", EmitDefaultValue=false)] public string Guardiansuffix { get; set; } /// <summary> /// Guarantor&#x27;s first name /// </summary> /// <value>Guarantor&#x27;s first name</value> [DataMember(Name="guarantorfirstname", EmitDefaultValue=false)] public string Guarantorfirstname { get; set; } /// <summary> /// Guarantor&#x27;s middle name /// </summary> /// <value>Guarantor&#x27;s middle name</value> [DataMember(Name="guarantormiddlename", EmitDefaultValue=false)] public string Guarantormiddlename { get; set; } /// <summary> /// Guarantor&#x27;s last name /// </summary> /// <value>Guarantor&#x27;s last name</value> [DataMember(Name="guarantorlastname", EmitDefaultValue=false)] public string Guarantorlastname { get; set; } /// <summary> /// Guarantor&#x27;s name suffix /// </summary> /// <value>Guarantor&#x27;s name suffix</value> [DataMember(Name="guarantorsuffix", EmitDefaultValue=false)] public string Guarantorsuffix { get; set; } /// <summary> /// Guarantor&#x27;s address /// </summary> /// <value>Guarantor&#x27;s address</value> [DataMember(Name="guarantoraddress1", EmitDefaultValue=false)] public string Guarantoraddress1 { get; set; } /// <summary> /// Guarantor&#x27;s address - line 2 /// </summary> /// <value>Guarantor&#x27;s address - line 2</value> [DataMember(Name="guarantoraddress2", EmitDefaultValue=false)] public string Guarantoraddress2 { get; set; } /// <summary> /// Guarantor&#x27;s city /// </summary> /// <value>Guarantor&#x27;s city</value> [DataMember(Name="guarantorcity", EmitDefaultValue=false)] public string Guarantorcity { get; set; } /// <summary> /// Guarantor&#x27;s state (2 letter abbreviation) /// </summary> /// <value>Guarantor&#x27;s state (2 letter abbreviation)</value> [DataMember(Name="guarantorstate", EmitDefaultValue=false)] public string Guarantorstate { get; set; } /// <summary> /// Guarantor&#x27;s zip /// </summary> /// <value>Guarantor&#x27;s zip</value> [DataMember(Name="guarantorzip", EmitDefaultValue=false)] public string Guarantorzip { get; set; } /// <summary> /// Guarantor&#x27;s country code /// </summary> /// <value>Guarantor&#x27;s country code</value> [DataMember(Name="guarantorcountrycode", EmitDefaultValue=false)] public string Guarantorcountrycode { get; set; } /// <summary> /// Guarantor&#x27;s country code (ISO 3166-1) /// </summary> /// <value>Guarantor&#x27;s country code (ISO 3166-1)</value> [DataMember(Name="guarantorcountrycode3166", EmitDefaultValue=false)] public string Guarantorcountrycode3166 { get; set; } /// <summary> /// Guarantor&#x27;s DOB (mm/dd/yyyy) /// </summary> /// <value>Guarantor&#x27;s DOB (mm/dd/yyyy)</value> [DataMember(Name="guarantordob", EmitDefaultValue=false)] public string Guarantordob { get; set; } /// <summary> /// Guarantor&#x27;s SSN /// </summary> /// <value>Guarantor&#x27;s SSN</value> [DataMember(Name="guarantorssn", EmitDefaultValue=false)] public string Guarantorssn { get; set; } /// <summary> /// Guarantor&#x27;s email address /// </summary> /// <value>Guarantor&#x27;s email address</value> [DataMember(Name="guarantoremail", EmitDefaultValue=false)] public string Guarantoremail { get; set; } /// <summary> /// Guarantor&#x27;s phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>Guarantor&#x27;s phone number. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="guarantorphone", EmitDefaultValue=false)] public string Guarantorphone { get; set; } /// <summary> /// The guarantor&#x27;s relationship to the patient /// </summary> /// <value>The guarantor&#x27;s relationship to the patient</value> [DataMember(Name="guarantorrelationshiptopatient", EmitDefaultValue=false)] public int? Guarantorrelationshiptopatient { get; set; } /// <summary> /// The address of the guarantor is the same as the patient. /// </summary> /// <value>The address of the guarantor is the same as the patient.</value> [DataMember(Name="guarantoraddresssameaspatient", EmitDefaultValue=false)] public bool? Guarantoraddresssameaspatient { get; set; } /// <summary> /// Date the patient was registered. /// </summary> /// <value>Date the patient was registered.</value> [DataMember(Name="registrationdate", EmitDefaultValue=false)] public string Registrationdate { get; set; } /// <summary> /// Primary (registration) department ID. /// </summary> /// <value>Primary (registration) department ID.</value> [DataMember(Name="departmentid", EmitDefaultValue=false)] public int? Departmentid { get; set; } /// <summary> /// Flag determining whether or not the patient has accepted the Terms and Conditions for the patient portal. /// </summary> /// <value>Flag determining whether or not the patient has accepted the Terms and Conditions for the patient portal.</value> [DataMember(Name="portaltermsonfile", EmitDefaultValue=false)] public bool? Portaltermsonfile { get; set; } /// <summary> /// This flag is set if the patient&#x27;s signature is on file /// </summary> /// <value>This flag is set if the patient&#x27;s signature is on file</value> [DataMember(Name="portalsignatureonfile", EmitDefaultValue=false)] public bool? Portalsignatureonfile { get; set; } /// <summary> /// This flag is set if the patient&#x27;s privacy information has been verified. Privacy information returns True if all of the items referenced in GET /patients/{patientid}/privacyinformationverified are true. Privacy information returns false if any of the items referenced in the GET /patients/{patientid}/privacyinformationverified API are false or expired. /// </summary> /// <value>This flag is set if the patient&#x27;s privacy information has been verified. Privacy information returns True if all of the items referenced in GET /patients/{patientid}/privacyinformationverified are true. Privacy information returns false if any of the items referenced in the GET /patients/{patientid}/privacyinformationverified API are false or expired. </value> [DataMember(Name="privacyinformationverified", EmitDefaultValue=false)] public bool? Privacyinformationverified { get; set; } /// <summary> /// Medication history consent status. If a practice doesn&#x27;t have RXHub or Surescripts enabled, this will be null /// </summary> /// <value>Medication history consent status. If a practice doesn&#x27;t have RXHub or Surescripts enabled, this will be null</value> [DataMember(Name="medicationhistoryconsentverified", EmitDefaultValue=false)] public bool? Medicationhistoryconsentverified { get; set; } /// <summary> /// The long version of the marital status. /// </summary> /// <value>The long version of the marital status.</value> [DataMember(Name="maritalstatusname", EmitDefaultValue=false)] public string Maritalstatusname { get; set; } /// <summary> /// The patient&#x27;s employer&#x27;s ID (from /employers call) /// </summary> /// <value>The patient&#x27;s employer&#x27;s ID (from /employers call)</value> [DataMember(Name="employerid", EmitDefaultValue=false)] public int? Employerid { get; set; } /// <summary> /// The patient&#x27;s employer&#x27;s phone number. Normally, this is set by setting employerid. However, setting this value can be used to override this on an individual patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. /// </summary> /// <value>The patient&#x27;s employer&#x27;s phone number. Normally, this is set by setting employerid. However, setting this value can be used to override this on an individual patient. Invalid numbers in a GET/PUT will be ignored. Patient phone numbers and other data may change, and one phone number may be associated with multiple patients. You are responsible for taking additional steps to verify patient identity and for using this data in accordance with applicable law, including HIPAA. Invalid numbers in a POST will be ignored, possibly resulting in an error. </value> [DataMember(Name="employerphone", EmitDefaultValue=false)] public string Employerphone { get; set; } /// <summary> /// The guaranror&#x27;s employer&#x27;s ID (from /employers call) /// </summary> /// <value>The guaranror&#x27;s employer&#x27;s ID (from /employers call)</value> [DataMember(Name="guarantoremployerid", EmitDefaultValue=false)] public int? Guarantoremployerid { get; set; } /// <summary> /// The patient&#x27;s employer&#x27;s name. /// </summary> /// <value>The patient&#x27;s employer&#x27;s name.</value> [DataMember(Name="employername", EmitDefaultValue=false)] public string Employername { get; set; } /// <summary> /// The patient&#x27;s employer&#x27;s address. /// </summary> /// <value>The patient&#x27;s employer&#x27;s address.</value> [DataMember(Name="employeraddress", EmitDefaultValue=false)] public string Employeraddress { get; set; } /// <summary> /// The patient&#x27;s employer&#x27;s city. /// </summary> /// <value>The patient&#x27;s employer&#x27;s city.</value> [DataMember(Name="employercity", EmitDefaultValue=false)] public string Employercity { get; set; } /// <summary> /// This flag is set if the patient has been given access to the portal. This may be set by the API user if a patient has been given access to the portal \&quot;by providing a preprinted brochure or flyer showing the URL where patients can access their Patient Care Summaries.\&quot; The practiceinfo endpoint can provide the portal URL. While technically allowed, it would be very unusual to set this to false via the API. /// </summary> /// <value>This flag is set if the patient has been given access to the portal. This may be set by the API user if a patient has been given access to the portal \&quot;by providing a preprinted brochure or flyer showing the URL where patients can access their Patient Care Summaries.\&quot; The practiceinfo endpoint can provide the portal URL. While technically allowed, it would be very unusual to set this to false via the API. </value> [DataMember(Name="portalaccessgiven", EmitDefaultValue=false)] public bool? Portalaccessgiven { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class Patient {\n"); sb.Append(" Homeboundyn: ").Append(Homeboundyn).Append("\n"); sb.Append(" Assignedsexatbirth: ").Append(Assignedsexatbirth).Append("\n"); sb.Append(" Altfirstname: ").Append(Altfirstname).Append("\n"); sb.Append(" Ethnicitycode: ").Append(Ethnicitycode).Append("\n"); sb.Append(" Industrycode: ").Append(Industrycode).Append("\n"); sb.Append(" Language6392code: ").Append(Language6392code).Append("\n"); sb.Append(" Localpatientid: ").Append(Localpatientid).Append("\n"); sb.Append(" Deceaseddate: ").Append(Deceaseddate).Append("\n"); sb.Append(" Firstappointment: ").Append(Firstappointment).Append("\n"); sb.Append(" Primaryproviderid: ").Append(Primaryproviderid).Append("\n"); sb.Append(" Genderidentityother: ").Append(Genderidentityother).Append("\n"); sb.Append(" Portalstatus: ").Append(Portalstatus).Append("\n"); sb.Append(" Preferredpronouns: ").Append(Preferredpronouns).Append("\n"); sb.Append(" Lastappointment: ").Append(Lastappointment).Append("\n"); sb.Append(" Allpatientstatuses: ").Append(Allpatientstatuses).Append("\n"); sb.Append(" Donotcallyn: ").Append(Donotcallyn).Append("\n"); sb.Append(" Primarydepartmentid: ").Append(Primarydepartmentid).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Balances: ").Append(Balances).Append("\n"); sb.Append(" Lastemail: ").Append(Lastemail).Append("\n"); sb.Append(" Racecode: ").Append(Racecode).Append("\n"); sb.Append(" Sexualorientation: ").Append(Sexualorientation).Append("\n"); sb.Append(" Genderidentity: ").Append(Genderidentity).Append("\n"); sb.Append(" Emailexistsyn: ").Append(Emailexistsyn).Append("\n"); sb.Append(" Occupationcode: ").Append(Occupationcode).Append("\n"); sb.Append(" Race: ").Append(Race).Append("\n"); sb.Append(" Sexualorientationother: ").Append(Sexualorientationother).Append("\n"); sb.Append(" Patientid: ").Append(Patientid).Append("\n"); sb.Append(" Firstname: ").Append(Firstname).Append("\n"); sb.Append(" Middlename: ").Append(Middlename).Append("\n"); sb.Append(" Lastname: ").Append(Lastname).Append("\n"); sb.Append(" Suffix: ").Append(Suffix).Append("\n"); sb.Append(" Preferredname: ").Append(Preferredname).Append("\n"); sb.Append(" Address1: ").Append(Address1).Append("\n"); sb.Append(" Address2: ").Append(Address2).Append("\n"); sb.Append(" City: ").Append(City).Append("\n"); sb.Append(" State: ").Append(State).Append("\n"); sb.Append(" Zip: ").Append(Zip).Append("\n"); sb.Append(" Countrycode: ").Append(Countrycode).Append("\n"); sb.Append(" Countrycode3166: ").Append(Countrycode3166).Append("\n"); sb.Append(" Homephone: ").Append(Homephone).Append("\n"); sb.Append(" Mobilephone: ").Append(Mobilephone).Append("\n"); sb.Append(" Hasmobileyn: ").Append(Hasmobileyn).Append("\n"); sb.Append(" Workphone: ").Append(Workphone).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" Ssn: ").Append(Ssn).Append("\n"); sb.Append(" Racename: ").Append(Racename).Append("\n"); sb.Append(" Sex: ").Append(Sex).Append("\n"); sb.Append(" Dob: ").Append(Dob).Append("\n"); sb.Append(" Maritalstatus: ").Append(Maritalstatus).Append("\n"); sb.Append(" Contactpreference: ").Append(Contactpreference).Append("\n"); sb.Append(" Contactname: ").Append(Contactname).Append("\n"); sb.Append(" Contactrelationship: ").Append(Contactrelationship).Append("\n"); sb.Append(" Contacthomephone: ").Append(Contacthomephone).Append("\n"); sb.Append(" Contactmobilephone: ").Append(Contactmobilephone).Append("\n"); sb.Append(" Nextkinname: ").Append(Nextkinname).Append("\n"); sb.Append(" Nextkinrelationship: ").Append(Nextkinrelationship).Append("\n"); sb.Append(" Nextkinphone: ").Append(Nextkinphone).Append("\n"); sb.Append(" Guardianfirstname: ").Append(Guardianfirstname).Append("\n"); sb.Append(" Guardianmiddlename: ").Append(Guardianmiddlename).Append("\n"); sb.Append(" Guardianlastname: ").Append(Guardianlastname).Append("\n"); sb.Append(" Guardiansuffix: ").Append(Guardiansuffix).Append("\n"); sb.Append(" Guarantorfirstname: ").Append(Guarantorfirstname).Append("\n"); sb.Append(" Guarantormiddlename: ").Append(Guarantormiddlename).Append("\n"); sb.Append(" Guarantorlastname: ").Append(Guarantorlastname).Append("\n"); sb.Append(" Guarantorsuffix: ").Append(Guarantorsuffix).Append("\n"); sb.Append(" Guarantoraddress1: ").Append(Guarantoraddress1).Append("\n"); sb.Append(" Guarantoraddress2: ").Append(Guarantoraddress2).Append("\n"); sb.Append(" Guarantorcity: ").Append(Guarantorcity).Append("\n"); sb.Append(" Guarantorstate: ").Append(Guarantorstate).Append("\n"); sb.Append(" Guarantorzip: ").Append(Guarantorzip).Append("\n"); sb.Append(" Guarantorcountrycode: ").Append(Guarantorcountrycode).Append("\n"); sb.Append(" Guarantorcountrycode3166: ").Append(Guarantorcountrycode3166).Append("\n"); sb.Append(" Guarantordob: ").Append(Guarantordob).Append("\n"); sb.Append(" Guarantorssn: ").Append(Guarantorssn).Append("\n"); sb.Append(" Guarantoremail: ").Append(Guarantoremail).Append("\n"); sb.Append(" Guarantorphone: ").Append(Guarantorphone).Append("\n"); sb.Append(" Guarantorrelationshiptopatient: ").Append(Guarantorrelationshiptopatient).Append("\n"); sb.Append(" Guarantoraddresssameaspatient: ").Append(Guarantoraddresssameaspatient).Append("\n"); sb.Append(" Registrationdate: ").Append(Registrationdate).Append("\n"); sb.Append(" Departmentid: ").Append(Departmentid).Append("\n"); sb.Append(" Portaltermsonfile: ").Append(Portaltermsonfile).Append("\n"); sb.Append(" Portalsignatureonfile: ").Append(Portalsignatureonfile).Append("\n"); sb.Append(" Privacyinformationverified: ").Append(Privacyinformationverified).Append("\n"); sb.Append(" Medicationhistoryconsentverified: ").Append(Medicationhistoryconsentverified).Append("\n"); sb.Append(" Maritalstatusname: ").Append(Maritalstatusname).Append("\n"); sb.Append(" Employerid: ").Append(Employerid).Append("\n"); sb.Append(" Employerphone: ").Append(Employerphone).Append("\n"); sb.Append(" Guarantoremployerid: ").Append(Guarantoremployerid).Append("\n"); sb.Append(" Employername: ").Append(Employername).Append("\n"); sb.Append(" Employeraddress: ").Append(Employeraddress).Append("\n"); sb.Append(" Employercity: ").Append(Employercity).Append("\n"); sb.Append(" Portalaccessgiven: ").Append(Portalaccessgiven).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public virtual string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as Patient); } /// <summary> /// Returns true if Patient instances are equal /// </summary> /// <param name="input">Instance of Patient to be compared</param> /// <returns>Boolean</returns> public bool Equals(Patient input) { if (input == null) return false; return ( this.Homeboundyn == input.Homeboundyn || (this.Homeboundyn != null && this.Homeboundyn.Equals(input.Homeboundyn)) ) && ( this.Assignedsexatbirth == input.Assignedsexatbirth || (this.Assignedsexatbirth != null && this.Assignedsexatbirth.Equals(input.Assignedsexatbirth)) ) && ( this.Altfirstname == input.Altfirstname || (this.Altfirstname != null && this.Altfirstname.Equals(input.Altfirstname)) ) && ( this.Ethnicitycode == input.Ethnicitycode || (this.Ethnicitycode != null && this.Ethnicitycode.Equals(input.Ethnicitycode)) ) && ( this.Industrycode == input.Industrycode || (this.Industrycode != null && this.Industrycode.Equals(input.Industrycode)) ) && ( this.Language6392code == input.Language6392code || (this.Language6392code != null && this.Language6392code.Equals(input.Language6392code)) ) && ( this.Localpatientid == input.Localpatientid || (this.Localpatientid != null && this.Localpatientid.Equals(input.Localpatientid)) ) && ( this.Deceaseddate == input.Deceaseddate || (this.Deceaseddate != null && this.Deceaseddate.Equals(input.Deceaseddate)) ) && ( this.Firstappointment == input.Firstappointment || (this.Firstappointment != null && this.Firstappointment.Equals(input.Firstappointment)) ) && ( this.Primaryproviderid == input.Primaryproviderid || (this.Primaryproviderid != null && this.Primaryproviderid.Equals(input.Primaryproviderid)) ) && ( this.Genderidentityother == input.Genderidentityother || (this.Genderidentityother != null && this.Genderidentityother.Equals(input.Genderidentityother)) ) && ( this.Portalstatus == input.Portalstatus || this.Portalstatus != null && input.Portalstatus != null && this.Portalstatus.SequenceEqual(input.Portalstatus) ) && ( this.Preferredpronouns == input.Preferredpronouns || (this.Preferredpronouns != null && this.Preferredpronouns.Equals(input.Preferredpronouns)) ) && ( this.Lastappointment == input.Lastappointment || (this.Lastappointment != null && this.Lastappointment.Equals(input.Lastappointment)) ) && ( this.Allpatientstatuses == input.Allpatientstatuses || this.Allpatientstatuses != null && input.Allpatientstatuses != null && this.Allpatientstatuses.SequenceEqual(input.Allpatientstatuses) ) && ( this.Donotcallyn == input.Donotcallyn || (this.Donotcallyn != null && this.Donotcallyn.Equals(input.Donotcallyn)) ) && ( this.Primarydepartmentid == input.Primarydepartmentid || (this.Primarydepartmentid != null && this.Primarydepartmentid.Equals(input.Primarydepartmentid)) ) && ( this.Status == input.Status || (this.Status != null && this.Status.Equals(input.Status)) ) && ( this.Balances == input.Balances || this.Balances != null && input.Balances != null && this.Balances.SequenceEqual(input.Balances) ) && ( this.Lastemail == input.Lastemail || (this.Lastemail != null && this.Lastemail.Equals(input.Lastemail)) ) && ( this.Racecode == input.Racecode || (this.Racecode != null && this.Racecode.Equals(input.Racecode)) ) && ( this.Sexualorientation == input.Sexualorientation || (this.Sexualorientation != null && this.Sexualorientation.Equals(input.Sexualorientation)) ) && ( this.Genderidentity == input.Genderidentity || (this.Genderidentity != null && this.Genderidentity.Equals(input.Genderidentity)) ) && ( this.Emailexistsyn == input.Emailexistsyn || (this.Emailexistsyn != null && this.Emailexistsyn.Equals(input.Emailexistsyn)) ) && ( this.Occupationcode == input.Occupationcode || (this.Occupationcode != null && this.Occupationcode.Equals(input.Occupationcode)) ) && ( this.Race == input.Race || this.Race != null && input.Race != null && this.Race.SequenceEqual(input.Race) ) && ( this.Sexualorientationother == input.Sexualorientationother || (this.Sexualorientationother != null && this.Sexualorientationother.Equals(input.Sexualorientationother)) ) && ( this.Patientid == input.Patientid || (this.Patientid != null && this.Patientid.Equals(input.Patientid)) ) && ( this.Firstname == input.Firstname || (this.Firstname != null && this.Firstname.Equals(input.Firstname)) ) && ( this.Middlename == input.Middlename || (this.Middlename != null && this.Middlename.Equals(input.Middlename)) ) && ( this.Lastname == input.Lastname || (this.Lastname != null && this.Lastname.Equals(input.Lastname)) ) && ( this.Suffix == input.Suffix || (this.Suffix != null && this.Suffix.Equals(input.Suffix)) ) && ( this.Preferredname == input.Preferredname || (this.Preferredname != null && this.Preferredname.Equals(input.Preferredname)) ) && ( this.Address1 == input.Address1 || (this.Address1 != null && this.Address1.Equals(input.Address1)) ) && ( this.Address2 == input.Address2 || (this.Address2 != null && this.Address2.Equals(input.Address2)) ) && ( this.City == input.City || (this.City != null && this.City.Equals(input.City)) ) && ( this.State == input.State || (this.State != null && this.State.Equals(input.State)) ) && ( this.Zip == input.Zip || (this.Zip != null && this.Zip.Equals(input.Zip)) ) && ( this.Countrycode == input.Countrycode || (this.Countrycode != null && this.Countrycode.Equals(input.Countrycode)) ) && ( this.Countrycode3166 == input.Countrycode3166 || (this.Countrycode3166 != null && this.Countrycode3166.Equals(input.Countrycode3166)) ) && ( this.Homephone == input.Homephone || (this.Homephone != null && this.Homephone.Equals(input.Homephone)) ) && ( this.Mobilephone == input.Mobilephone || (this.Mobilephone != null && this.Mobilephone.Equals(input.Mobilephone)) ) && ( this.Hasmobileyn == input.Hasmobileyn || (this.Hasmobileyn != null && this.Hasmobileyn.Equals(input.Hasmobileyn)) ) && ( this.Workphone == input.Workphone || (this.Workphone != null && this.Workphone.Equals(input.Workphone)) ) && ( this.Email == input.Email || (this.Email != null && this.Email.Equals(input.Email)) ) && ( this.Ssn == input.Ssn || (this.Ssn != null && this.Ssn.Equals(input.Ssn)) ) && ( this.Racename == input.Racename || (this.Racename != null && this.Racename.Equals(input.Racename)) ) && ( this.Sex == input.Sex || (this.Sex != null && this.Sex.Equals(input.Sex)) ) && ( this.Dob == input.Dob || (this.Dob != null && this.Dob.Equals(input.Dob)) ) && ( this.Maritalstatus == input.Maritalstatus || (this.Maritalstatus != null && this.Maritalstatus.Equals(input.Maritalstatus)) ) && ( this.Contactpreference == input.Contactpreference || (this.Contactpreference != null && this.Contactpreference.Equals(input.Contactpreference)) ) && ( this.Contactname == input.Contactname || (this.Contactname != null && this.Contactname.Equals(input.Contactname)) ) && ( this.Contactrelationship == input.Contactrelationship || (this.Contactrelationship != null && this.Contactrelationship.Equals(input.Contactrelationship)) ) && ( this.Contacthomephone == input.Contacthomephone || (this.Contacthomephone != null && this.Contacthomephone.Equals(input.Contacthomephone)) ) && ( this.Contactmobilephone == input.Contactmobilephone || (this.Contactmobilephone != null && this.Contactmobilephone.Equals(input.Contactmobilephone)) ) && ( this.Nextkinname == input.Nextkinname || (this.Nextkinname != null && this.Nextkinname.Equals(input.Nextkinname)) ) && ( this.Nextkinrelationship == input.Nextkinrelationship || (this.Nextkinrelationship != null && this.Nextkinrelationship.Equals(input.Nextkinrelationship)) ) && ( this.Nextkinphone == input.Nextkinphone || (this.Nextkinphone != null && this.Nextkinphone.Equals(input.Nextkinphone)) ) && ( this.Guardianfirstname == input.Guardianfirstname || (this.Guardianfirstname != null && this.Guardianfirstname.Equals(input.Guardianfirstname)) ) && ( this.Guardianmiddlename == input.Guardianmiddlename || (this.Guardianmiddlename != null && this.Guardianmiddlename.Equals(input.Guardianmiddlename)) ) && ( this.Guardianlastname == input.Guardianlastname || (this.Guardianlastname != null && this.Guardianlastname.Equals(input.Guardianlastname)) ) && ( this.Guardiansuffix == input.Guardiansuffix || (this.Guardiansuffix != null && this.Guardiansuffix.Equals(input.Guardiansuffix)) ) && ( this.Guarantorfirstname == input.Guarantorfirstname || (this.Guarantorfirstname != null && this.Guarantorfirstname.Equals(input.Guarantorfirstname)) ) && ( this.Guarantormiddlename == input.Guarantormiddlename || (this.Guarantormiddlename != null && this.Guarantormiddlename.Equals(input.Guarantormiddlename)) ) && ( this.Guarantorlastname == input.Guarantorlastname || (this.Guarantorlastname != null && this.Guarantorlastname.Equals(input.Guarantorlastname)) ) && ( this.Guarantorsuffix == input.Guarantorsuffix || (this.Guarantorsuffix != null && this.Guarantorsuffix.Equals(input.Guarantorsuffix)) ) && ( this.Guarantoraddress1 == input.Guarantoraddress1 || (this.Guarantoraddress1 != null && this.Guarantoraddress1.Equals(input.Guarantoraddress1)) ) && ( this.Guarantoraddress2 == input.Guarantoraddress2 || (this.Guarantoraddress2 != null && this.Guarantoraddress2.Equals(input.Guarantoraddress2)) ) && ( this.Guarantorcity == input.Guarantorcity || (this.Guarantorcity != null && this.Guarantorcity.Equals(input.Guarantorcity)) ) && ( this.Guarantorstate == input.Guarantorstate || (this.Guarantorstate != null && this.Guarantorstate.Equals(input.Guarantorstate)) ) && ( this.Guarantorzip == input.Guarantorzip || (this.Guarantorzip != null && this.Guarantorzip.Equals(input.Guarantorzip)) ) && ( this.Guarantorcountrycode == input.Guarantorcountrycode || (this.Guarantorcountrycode != null && this.Guarantorcountrycode.Equals(input.Guarantorcountrycode)) ) && ( this.Guarantorcountrycode3166 == input.Guarantorcountrycode3166 || (this.Guarantorcountrycode3166 != null && this.Guarantorcountrycode3166.Equals(input.Guarantorcountrycode3166)) ) && ( this.Guarantordob == input.Guarantordob || (this.Guarantordob != null && this.Guarantordob.Equals(input.Guarantordob)) ) && ( this.Guarantorssn == input.Guarantorssn || (this.Guarantorssn != null && this.Guarantorssn.Equals(input.Guarantorssn)) ) && ( this.Guarantoremail == input.Guarantoremail || (this.Guarantoremail != null && this.Guarantoremail.Equals(input.Guarantoremail)) ) && ( this.Guarantorphone == input.Guarantorphone || (this.Guarantorphone != null && this.Guarantorphone.Equals(input.Guarantorphone)) ) && ( this.Guarantorrelationshiptopatient == input.Guarantorrelationshiptopatient || (this.Guarantorrelationshiptopatient != null && this.Guarantorrelationshiptopatient.Equals(input.Guarantorrelationshiptopatient)) ) && ( this.Guarantoraddresssameaspatient == input.Guarantoraddresssameaspatient || (this.Guarantoraddresssameaspatient != null && this.Guarantoraddresssameaspatient.Equals(input.Guarantoraddresssameaspatient)) ) && ( this.Registrationdate == input.Registrationdate || (this.Registrationdate != null && this.Registrationdate.Equals(input.Registrationdate)) ) && ( this.Departmentid == input.Departmentid || (this.Departmentid != null && this.Departmentid.Equals(input.Departmentid)) ) && ( this.Portaltermsonfile == input.Portaltermsonfile || (this.Portaltermsonfile != null && this.Portaltermsonfile.Equals(input.Portaltermsonfile)) ) && ( this.Portalsignatureonfile == input.Portalsignatureonfile || (this.Portalsignatureonfile != null && this.Portalsignatureonfile.Equals(input.Portalsignatureonfile)) ) && ( this.Privacyinformationverified == input.Privacyinformationverified || (this.Privacyinformationverified != null && this.Privacyinformationverified.Equals(input.Privacyinformationverified)) ) && ( this.Medicationhistoryconsentverified == input.Medicationhistoryconsentverified || (this.Medicationhistoryconsentverified != null && this.Medicationhistoryconsentverified.Equals(input.Medicationhistoryconsentverified)) ) && ( this.Maritalstatusname == input.Maritalstatusname || (this.Maritalstatusname != null && this.Maritalstatusname.Equals(input.Maritalstatusname)) ) && ( this.Employerid == input.Employerid || (this.Employerid != null && this.Employerid.Equals(input.Employerid)) ) && ( this.Employerphone == input.Employerphone || (this.Employerphone != null && this.Employerphone.Equals(input.Employerphone)) ) && ( this.Guarantoremployerid == input.Guarantoremployerid || (this.Guarantoremployerid != null && this.Guarantoremployerid.Equals(input.Guarantoremployerid)) ) && ( this.Employername == input.Employername || (this.Employername != null && this.Employername.Equals(input.Employername)) ) && ( this.Employeraddress == input.Employeraddress || (this.Employeraddress != null && this.Employeraddress.Equals(input.Employeraddress)) ) && ( this.Employercity == input.Employercity || (this.Employercity != null && this.Employercity.Equals(input.Employercity)) ) && ( this.Portalaccessgiven == input.Portalaccessgiven || (this.Portalaccessgiven != null && this.Portalaccessgiven.Equals(input.Portalaccessgiven)) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.Homeboundyn != null) hashCode = hashCode * 59 + this.Homeboundyn.GetHashCode(); if (this.Assignedsexatbirth != null) hashCode = hashCode * 59 + this.Assignedsexatbirth.GetHashCode(); if (this.Altfirstname != null) hashCode = hashCode * 59 + this.Altfirstname.GetHashCode(); if (this.Ethnicitycode != null) hashCode = hashCode * 59 + this.Ethnicitycode.GetHashCode(); if (this.Industrycode != null) hashCode = hashCode * 59 + this.Industrycode.GetHashCode(); if (this.Language6392code != null) hashCode = hashCode * 59 + this.Language6392code.GetHashCode(); if (this.Localpatientid != null) hashCode = hashCode * 59 + this.Localpatientid.GetHashCode(); if (this.Deceaseddate != null) hashCode = hashCode * 59 + this.Deceaseddate.GetHashCode(); if (this.Firstappointment != null) hashCode = hashCode * 59 + this.Firstappointment.GetHashCode(); if (this.Primaryproviderid != null) hashCode = hashCode * 59 + this.Primaryproviderid.GetHashCode(); if (this.Genderidentityother != null) hashCode = hashCode * 59 + this.Genderidentityother.GetHashCode(); if (this.Portalstatus != null) hashCode = hashCode * 59 + this.Portalstatus.GetHashCode(); if (this.Preferredpronouns != null) hashCode = hashCode * 59 + this.Preferredpronouns.GetHashCode(); if (this.Lastappointment != null) hashCode = hashCode * 59 + this.Lastappointment.GetHashCode(); if (this.Allpatientstatuses != null) hashCode = hashCode * 59 + this.Allpatientstatuses.GetHashCode(); if (this.Donotcallyn != null) hashCode = hashCode * 59 + this.Donotcallyn.GetHashCode(); if (this.Primarydepartmentid != null) hashCode = hashCode * 59 + this.Primarydepartmentid.GetHashCode(); if (this.Status != null) hashCode = hashCode * 59 + this.Status.GetHashCode(); if (this.Balances != null) hashCode = hashCode * 59 + this.Balances.GetHashCode(); if (this.Lastemail != null) hashCode = hashCode * 59 + this.Lastemail.GetHashCode(); if (this.Racecode != null) hashCode = hashCode * 59 + this.Racecode.GetHashCode(); if (this.Sexualorientation != null) hashCode = hashCode * 59 + this.Sexualorientation.GetHashCode(); if (this.Genderidentity != null) hashCode = hashCode * 59 + this.Genderidentity.GetHashCode(); if (this.Emailexistsyn != null) hashCode = hashCode * 59 + this.Emailexistsyn.GetHashCode(); if (this.Occupationcode != null) hashCode = hashCode * 59 + this.Occupationcode.GetHashCode(); if (this.Race != null) hashCode = hashCode * 59 + this.Race.GetHashCode(); if (this.Sexualorientationother != null) hashCode = hashCode * 59 + this.Sexualorientationother.GetHashCode(); if (this.Patientid != null) hashCode = hashCode * 59 + this.Patientid.GetHashCode(); if (this.Firstname != null) hashCode = hashCode * 59 + this.Firstname.GetHashCode(); if (this.Middlename != null) hashCode = hashCode * 59 + this.Middlename.GetHashCode(); if (this.Lastname != null) hashCode = hashCode * 59 + this.Lastname.GetHashCode(); if (this.Suffix != null) hashCode = hashCode * 59 + this.Suffix.GetHashCode(); if (this.Preferredname != null) hashCode = hashCode * 59 + this.Preferredname.GetHashCode(); if (this.Address1 != null) hashCode = hashCode * 59 + this.Address1.GetHashCode(); if (this.Address2 != null) hashCode = hashCode * 59 + this.Address2.GetHashCode(); if (this.City != null) hashCode = hashCode * 59 + this.City.GetHashCode(); if (this.State != null) hashCode = hashCode * 59 + this.State.GetHashCode(); if (this.Zip != null) hashCode = hashCode * 59 + this.Zip.GetHashCode(); if (this.Countrycode != null) hashCode = hashCode * 59 + this.Countrycode.GetHashCode(); if (this.Countrycode3166 != null) hashCode = hashCode * 59 + this.Countrycode3166.GetHashCode(); if (this.Homephone != null) hashCode = hashCode * 59 + this.Homephone.GetHashCode(); if (this.Mobilephone != null) hashCode = hashCode * 59 + this.Mobilephone.GetHashCode(); if (this.Hasmobileyn != null) hashCode = hashCode * 59 + this.Hasmobileyn.GetHashCode(); if (this.Workphone != null) hashCode = hashCode * 59 + this.Workphone.GetHashCode(); if (this.Email != null) hashCode = hashCode * 59 + this.Email.GetHashCode(); if (this.Ssn != null) hashCode = hashCode * 59 + this.Ssn.GetHashCode(); if (this.Racename != null) hashCode = hashCode * 59 + this.Racename.GetHashCode(); if (this.Sex != null) hashCode = hashCode * 59 + this.Sex.GetHashCode(); if (this.Dob != null) hashCode = hashCode * 59 + this.Dob.GetHashCode(); if (this.Maritalstatus != null) hashCode = hashCode * 59 + this.Maritalstatus.GetHashCode(); if (this.Contactpreference != null) hashCode = hashCode * 59 + this.Contactpreference.GetHashCode(); if (this.Contactname != null) hashCode = hashCode * 59 + this.Contactname.GetHashCode(); if (this.Contactrelationship != null) hashCode = hashCode * 59 + this.Contactrelationship.GetHashCode(); if (this.Contacthomephone != null) hashCode = hashCode * 59 + this.Contacthomephone.GetHashCode(); if (this.Contactmobilephone != null) hashCode = hashCode * 59 + this.Contactmobilephone.GetHashCode(); if (this.Nextkinname != null) hashCode = hashCode * 59 + this.Nextkinname.GetHashCode(); if (this.Nextkinrelationship != null) hashCode = hashCode * 59 + this.Nextkinrelationship.GetHashCode(); if (this.Nextkinphone != null) hashCode = hashCode * 59 + this.Nextkinphone.GetHashCode(); if (this.Guardianfirstname != null) hashCode = hashCode * 59 + this.Guardianfirstname.GetHashCode(); if (this.Guardianmiddlename != null) hashCode = hashCode * 59 + this.Guardianmiddlename.GetHashCode(); if (this.Guardianlastname != null) hashCode = hashCode * 59 + this.Guardianlastname.GetHashCode(); if (this.Guardiansuffix != null) hashCode = hashCode * 59 + this.Guardiansuffix.GetHashCode(); if (this.Guarantorfirstname != null) hashCode = hashCode * 59 + this.Guarantorfirstname.GetHashCode(); if (this.Guarantormiddlename != null) hashCode = hashCode * 59 + this.Guarantormiddlename.GetHashCode(); if (this.Guarantorlastname != null) hashCode = hashCode * 59 + this.Guarantorlastname.GetHashCode(); if (this.Guarantorsuffix != null) hashCode = hashCode * 59 + this.Guarantorsuffix.GetHashCode(); if (this.Guarantoraddress1 != null) hashCode = hashCode * 59 + this.Guarantoraddress1.GetHashCode(); if (this.Guarantoraddress2 != null) hashCode = hashCode * 59 + this.Guarantoraddress2.GetHashCode(); if (this.Guarantorcity != null) hashCode = hashCode * 59 + this.Guarantorcity.GetHashCode(); if (this.Guarantorstate != null) hashCode = hashCode * 59 + this.Guarantorstate.GetHashCode(); if (this.Guarantorzip != null) hashCode = hashCode * 59 + this.Guarantorzip.GetHashCode(); if (this.Guarantorcountrycode != null) hashCode = hashCode * 59 + this.Guarantorcountrycode.GetHashCode(); if (this.Guarantorcountrycode3166 != null) hashCode = hashCode * 59 + this.Guarantorcountrycode3166.GetHashCode(); if (this.Guarantordob != null) hashCode = hashCode * 59 + this.Guarantordob.GetHashCode(); if (this.Guarantorssn != null) hashCode = hashCode * 59 + this.Guarantorssn.GetHashCode(); if (this.Guarantoremail != null) hashCode = hashCode * 59 + this.Guarantoremail.GetHashCode(); if (this.Guarantorphone != null) hashCode = hashCode * 59 + this.Guarantorphone.GetHashCode(); if (this.Guarantorrelationshiptopatient != null) hashCode = hashCode * 59 + this.Guarantorrelationshiptopatient.GetHashCode(); if (this.Guarantoraddresssameaspatient != null) hashCode = hashCode * 59 + this.Guarantoraddresssameaspatient.GetHashCode(); if (this.Registrationdate != null) hashCode = hashCode * 59 + this.Registrationdate.GetHashCode(); if (this.Departmentid != null) hashCode = hashCode * 59 + this.Departmentid.GetHashCode(); if (this.Portaltermsonfile != null) hashCode = hashCode * 59 + this.Portaltermsonfile.GetHashCode(); if (this.Portalsignatureonfile != null) hashCode = hashCode * 59 + this.Portalsignatureonfile.GetHashCode(); if (this.Privacyinformationverified != null) hashCode = hashCode * 59 + this.Privacyinformationverified.GetHashCode(); if (this.Medicationhistoryconsentverified != null) hashCode = hashCode * 59 + this.Medicationhistoryconsentverified.GetHashCode(); if (this.Maritalstatusname != null) hashCode = hashCode * 59 + this.Maritalstatusname.GetHashCode(); if (this.Employerid != null) hashCode = hashCode * 59 + this.Employerid.GetHashCode(); if (this.Employerphone != null) hashCode = hashCode * 59 + this.Employerphone.GetHashCode(); if (this.Guarantoremployerid != null) hashCode = hashCode * 59 + this.Guarantoremployerid.GetHashCode(); if (this.Employername != null) hashCode = hashCode * 59 + this.Employername.GetHashCode(); if (this.Employeraddress != null) hashCode = hashCode * 59 + this.Employeraddress.GetHashCode(); if (this.Employercity != null) hashCode = hashCode * 59 + this.Employercity.GetHashCode(); if (this.Portalaccessgiven != null) hashCode = hashCode * 59 + this.Portalaccessgiven.GetHashCode(); return hashCode; } } /// <summary> /// To validate all properties of the instance /// </summary> /// <param name="validationContext">Validation context</param> /// <returns>Validation Result</returns> IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { yield break; } } }
63.354019
3,874
0.608573
[ "MIT" ]
gitter-badger/athenasharp
src/Jacrys.AthenaSharp/Model/Patient.cs
107,195
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. //////////////////////////////////////////////////////////////////////////////// // MulticastNotSupportedException // This is thrown when you add multiple callbacks to a non-multicast delegate. //////////////////////////////////////////////////////////////////////////////// using System.Runtime.Serialization; namespace System { public sealed class MulticastNotSupportedException : SystemException { public MulticastNotSupportedException() : base(SR.Arg_MulticastNotSupportedException) { HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } public MulticastNotSupportedException(String message) : base(message) { HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } public MulticastNotSupportedException(String message, Exception inner) : base(message, inner) { HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } } }
33.742857
80
0.595258
[ "MIT" ]
Acidburn0zzz/coreclr
src/mscorlib/shared/System/MulticastNotSupportedException.cs
1,181
C#
using System; [global::System.Serializable] public class IDReference { public string GetID() { return this.itsID; } public void SetID(string theID) { this.itsID = theID; this.itsEmpty = false; } public bool GetHasValue() { return !this.itsEmpty; } public void SetEmpty() { this.itsEmpty = true; } public override string ToString() { return this.GetID(); } public bool GetCanBeDeleted() { return this.itsCanBeDeleted; } public void SetCanBeDeleted(bool theCanBeDeleted) { this.itsCanBeDeleted = theCanBeDeleted; } public string itsID = string.Empty; public bool itsEmpty = true; public bool itsCanBeDeleted; }
13.75
50
0.704545
[ "CC0-1.0" ]
FreyaFreed/mordheim
Assembly-CSharp/IDReference.cs
662
C#
using System; using System.Collections.Generic; using System.Text; namespace Restaurant { public class Food : Product { public double Grams { get; set; } public Food(string name, decimal price, double grams) : base(name, price) { Grams = grams; } } }
18.235294
81
0.596774
[ "MIT" ]
Alexxx2207/CSharpAdvanced
Inheritance-Ex/Restaurant/Food.cs
312
C#
 using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web; using System.Windows.Forms; using System.Xml; using DigitalPlatform; using DigitalPlatform.CirculationClient; using DigitalPlatform.CommonControl; using DigitalPlatform.LibraryClient; using DigitalPlatform.LibraryServer.Reporting; namespace TestReporting { public partial class Form1 : Form { // 主要的通道池,用于当前服务器 public LibraryChannelPool _channelPool = new LibraryChannelPool(); FloatingMessageForm _floatingMessage = null; CancellationTokenSource _cancel = new CancellationTokenSource(); public Form1() { ClientInfo.ProgramName = "fingerprintcenter"; ClientInfo.MainForm = this; InitializeComponent(); { _floatingMessage = new FloatingMessageForm(this); _floatingMessage.Font = new System.Drawing.Font(this.Font.FontFamily, this.Font.Size * 2, FontStyle.Bold); _floatingMessage.Opacity = 0.7; _floatingMessage.RectColor = Color.Green; _floatingMessage.Show(this); } } public string UiState { get { List<object> controls = new List<object> { this.tabControl_main, this.textBox_cfg_dp2LibraryServerUrl, this.textBox_cfg_userName, new SavePassword(this.textBox_cfg_password, this.checkBox_cfg_savePasswordLong), this.textBox_cfg_location, new ControlWrapper(this.checkBox_cfg_savePasswordLong, true), }; return GuiState.GetUiState(controls); } set { List<object> controls = new List<object> { this.tabControl_main, this.textBox_cfg_dp2LibraryServerUrl, this.textBox_cfg_userName, new SavePassword(this.textBox_cfg_password, this.checkBox_cfg_savePasswordLong), this.textBox_cfg_location, new ControlWrapper(this.checkBox_cfg_savePasswordLong, true), }; GuiState.SetUiState(controls, value); } } public void ShowMessage(string strMessage, string strColor = "", bool bClickClose = false) { if (this._floatingMessage == null) return; Color color = Color.FromArgb(80, 80, 80); if (strColor == "red") // 出错 color = Color.DarkRed; else if (strColor == "yellow") // 成功,提醒 color = Color.DarkGoldenrod; else if (strColor == "green") // 成功 color = Color.Green; else if (strColor == "progress") // 处理过程 color = Color.FromArgb(80, 80, 80); this._floatingMessage.SetMessage(strMessage, color, bClickClose); } public void ClearMessage() { this.ShowMessage(""); } private void Form1_Load(object sender, EventArgs e) { ClientInfo.Initial("testreporting"); this.UiState = ClientInfo.Config.Get("global", "ui_state", ""); // Properties.Settings.Default.ui_state; this.textBox_replicationStart.Text = ClientInfo.Config.Get("global", "replication_start", ""); // Properties.Settings.Default.repPlan; ClearHtml(); // 显示版本号 this.OutputHistory($"版本号: {ClientInfo.ClientVersion}"); this._channelPool.BeforeLogin += new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin); this._channelPool.AfterLogin += new AfterLoginEventHandle(Channel_AfterLogin); this.LoadTaskDom(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { SaveSettings(); SaveTaskDom(); } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { _cancel?.Cancel(); _cancel?.Dispose(); this._channelPool.BeforeLogin -= new DigitalPlatform.LibraryClient.BeforeLoginEventHandle(Channel_BeforeLogin); this._channelPool.AfterLogin -= new AfterLoginEventHandle(Channel_AfterLogin); } void SaveSettings() { if (this.checkBox_cfg_savePasswordLong.Checked == false) this.textBox_cfg_password.Text = ""; ClientInfo.Config?.Set("global", "ui_state", this.UiState); ClientInfo.Config?.Set("global", "replication_start", this.textBox_replicationStart.Text); ClientInfo.Finish(); } internal void Channel_BeforeLogin(object sender, DigitalPlatform.LibraryClient.BeforeLoginEventArgs e) { if (e.FirstTry == true) { // string strPhoneNumber = ""; { e.UserName = this.textBox_cfg_userName.Text; // e.Password = this.DecryptPasssword(e.Password); e.Password = this.textBox_cfg_password.Text; bool bIsReader = false; string strLocation = this.textBox_cfg_location.Text; e.Parameters = "location=" + strLocation; if (bIsReader == true) e.Parameters += ",type=reader"; } // 2014/9/13 // e.Parameters += ",mac=" + StringUtil.MakePathList(SerialCodeForm.GetMacAddress(), "|"); e.Parameters += ",client=testreporting|" + ClientInfo.ClientVersion; if (String.IsNullOrEmpty(e.UserName) == false) return; // 立即返回, 以便作第一次 不出现 对话框的自动登录 else { e.ErrorInfo = "尚未配置 dp2library 服务器用户名"; e.Cancel = true; } } // e.ErrorInfo = "尚未配置 dp2library 服务器用户名"; e.Cancel = true; } string _currentUserName = ""; public string ServerUID = ""; public string ServerVersion = ""; internal void Channel_AfterLogin(object sender, AfterLoginEventArgs e) { LibraryChannel channel = sender as LibraryChannel; _currentUserName = channel.UserName; } List<LibraryChannel> _channelList = new List<LibraryChannel>(); public void AbortAllChannel() { foreach (LibraryChannel channel in _channelList) { if (channel != null) channel.Abort(); } } // parameters: // style 风格。如果为 GUI,表示会自动添加 Idle 事件,并在其中执行 Application.DoEvents public LibraryChannel GetChannel() { string strServerUrl = this.textBox_cfg_dp2LibraryServerUrl.Text; string strUserName = this.textBox_cfg_userName.Text; LibraryChannel channel = this._channelPool.GetChannel(strServerUrl, strUserName); _channelList.Add(channel); // TODO: 检查数组是否溢出 return channel; } public void ReturnChannel(LibraryChannel channel) { this._channelPool.ReturnChannel(channel); _channelList.Remove(channel); } #region 浏览器控件 public void ClearHtml() { string strCssUrl = Path.Combine(ClientInfo.DataDir, "history.css"); string strLink = "<link href='" + strCssUrl + "' type='text/css' rel='stylesheet' />"; string strJs = ""; { HtmlDocument doc = this.webBrowser1.Document; if (doc == null) { this.webBrowser1.Navigate("about:blank"); doc = this.webBrowser1.Document; } doc = doc.OpenNew(true); } WriteHtml(this.webBrowser1, "<html><head>" + strLink + strJs + "</head><body>"); } delegate void Delegate_AppendHtml(string strText); public void AppendHtml(string strText) { if (this.webBrowser1.InvokeRequired) { Delegate_AppendHtml d = new Delegate_AppendHtml(AppendHtml); this.webBrowser1.BeginInvoke(d, new object[] { strText }); return; } WriteHtml(this.webBrowser1, strText); // Global.ScrollToEnd(this.WebBrowser); // 因为HTML元素总是没有收尾,其他有些方法可能不奏效 this.webBrowser1.Document.Window.ScrollTo(0, this.webBrowser1.Document.Body.ScrollRectangle.Height); } public static void WriteHtml(WebBrowser webBrowser, string strHtml) { HtmlDocument doc = webBrowser.Document; if (doc == null) { // webBrowser.Navigate("about:blank"); Navigate(webBrowser, "about:blank"); doc = webBrowser.Document; } // doc = doc.OpenNew(true); doc.Write(strHtml); // 保持末行可见 // ScrollToEnd(webBrowser); } // 2015/7/28 // 能处理异常的 Navigate internal static void Navigate(WebBrowser webBrowser, string urlString) { int nRedoCount = 0; REDO: try { webBrowser.Navigate(urlString); } catch (System.Runtime.InteropServices.COMException ex) { /* System.Runtime.InteropServices.COMException (0x800700AA): 请求的资源在使用中。 (异常来自 HRESULT:0x800700AA) 在 System.Windows.Forms.UnsafeNativeMethods.IWebBrowser2.Navigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers) 在 System.Windows.Forms.WebBrowser.PerformNavigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers) 在 System.Windows.Forms.WebBrowser.Navigate(String urlString) 在 dp2Circulation.QuickChargingForm._setReaderRenderString(String strText) 位置 F:\cs4.0\dp2Circulation\Charging\QuickChargingForm.cs:行号 394 * */ if ((uint)ex.ErrorCode == 0x800700AA) { nRedoCount++; if (nRedoCount < 5) { Application.DoEvents(); // 2015/8/13 Thread.Sleep(200); goto REDO; } } throw ex; } } public static void SetHtmlString(WebBrowser webBrowser, string strHtml, string strDataDir, string strTempFileType) { // StopWebBrowser(webBrowser); strHtml = strHtml.Replace("%datadir%", strDataDir); strHtml = strHtml.Replace("%mappeddir%", Path.Combine(strDataDir, "servermapped")); string strTempFilename = Path.Combine(strDataDir, "~temp_" + strTempFileType + ".html"); using (StreamWriter sw = new StreamWriter(strTempFilename, false, Encoding.UTF8)) { sw.Write(strHtml); } // webBrowser.Navigate(strTempFilename); Navigate(webBrowser, strTempFilename); // 2015/7/28 } public static void SetHtmlString(WebBrowser webBrowser, string strHtml) { webBrowser.DocumentText = strHtml; } /// <summary> /// 向控制台输出 HTML /// </summary> /// <param name="strHtml">要输出的 HTML 字符串</param> public void OutputHtml(string strHtml) { AppendHtml(strHtml); } public void OutputHistory(string strText, int nWarningLevel = 0) { OutputText(DateTime.Now.ToLongTimeString() + " " + strText, nWarningLevel); } // parameters: // nWarningLevel 0 正常文本(白色背景) 1 警告文本(黄色背景) >=2 错误文本(红色背景) /// <summary> /// 向控制台输出纯文本 /// </summary> /// <param name="strText">要输出的纯文本字符串</param> /// <param name="nWarningLevel">警告级别。0 正常文本(白色背景) 1 警告文本(黄色背景) >=2 错误文本(红色背景)</param> public void OutputText(string strText, int nWarningLevel = 0) { string strClass = "normal"; if (nWarningLevel == 1) strClass = "warning"; else if (nWarningLevel >= 2) strClass = "error"; AppendHtml("<div class='debug " + strClass + "'>" + HttpUtility.HtmlEncode(strText).Replace("\r\n", "<br/>") + "</div>"); } #endregion private void toolStripButton_cfg_setHongnibaServer_Click(object sender, EventArgs e) { if (this.textBox_cfg_dp2LibraryServerUrl.Text != ServerDlg.HnbUrl) { this.textBox_cfg_dp2LibraryServerUrl.Text = ServerDlg.HnbUrl; this.textBox_cfg_userName.Text = ""; this.textBox_cfg_password.Text = ""; } } private void toolStripButton_cfg_setXeServer_Click(object sender, EventArgs e) { if (this.textBox_cfg_dp2LibraryServerUrl.Text != "net.pipe://localhost/dp2library/xe") { this.textBox_cfg_dp2LibraryServerUrl.Text = "net.pipe://localhost/dp2library/xe"; this.textBox_cfg_userName.Text = "supervisor"; this.textBox_cfg_password.Text = ""; } } void Begin() { if (_cancel != null) _cancel.Dispose(); _cancel = new CancellationTokenSource(); this.toolStripButton_stop.Enabled = true; } void End() { this.toolStripButton_stop.Enabled = false; } private async void MenuItem_buildPlan_Click(object sender, EventArgs e) { Begin(); var result = await Replication(_cancel.Token); End(); if (result.Value == -1) MessageBox.Show(this, result.ErrorInfo); else MessageBox.Show(this, "OK"); } XmlDocument _taskDom = null; void SaveTaskDom() { string filename = Path.Combine(ClientInfo.UserDir, "task.xml"); if (_taskDom == null) File.Delete(filename); else _taskDom.Save(filename); } void LoadTaskDom() { string filename = Path.Combine(ClientInfo.UserDir, "task.xml"); if (File.Exists(filename)) { _taskDom = new XmlDocument(); _taskDom.Load(filename); } else _taskDom = null; } Task<NormalResult> Replication(CancellationToken token) { return Task<NormalResult>.Run(() => { Replication replication = new Replication(); LibraryChannel channel = this.GetChannel(); try { int nRet = replication.Initialize(channel, out string strError); if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; nRet = replication.BuildFirstPlan("*", channel, (message) => { OutputHistory(message); }, out XmlDocument task_dom, out strError); _taskDom = task_dom; if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; nRet = replication.RunFirstPlan( channel, ref task_dom, (message) => { OutputHistory(message); }, token, out strError); if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; return new NormalResult(); } finally { this.ReturnChannel(channel); } }); } private async void MenuItem_continueExcutePlan_Click(object sender, EventArgs e) { string strError = ""; if (_taskDom == null) { strError = "尚未首次执行"; goto ERROR1; } Begin(); var result = await ContinueExcutePlan(_taskDom, _cancel.Token); End(); if (result.Value == -1) { strError = result.ErrorInfo; goto ERROR1; } MessageBox.Show(this, "OK"); return; ERROR1: MessageBox.Show(this, strError); } Task<NormalResult> ContinueExcutePlan(XmlDocument task_dom, CancellationToken token) { return Task<NormalResult>.Run(() => { Replication replication = new Replication(); LibraryChannel channel = this.GetChannel(); try { int nRet = replication.Initialize(channel, out string strError); if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; nRet = replication.RunFirstPlan( channel, ref task_dom, (message) => { OutputHistory(message); }, token, out strError); if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; return new NormalResult(); } finally { this.ReturnChannel(channel); } }); } private void MenuItem_testCreateReport_Click(object sender, EventArgs e) { BuildReportDialog1 dlg = new BuildReportDialog1(); dlg.DataDir = Path.Combine(ClientInfo.DataDir, "report_def"); dlg.UiState = ClientInfo.Config.Get( "BuildReportDialog", "uiState", ""); dlg.ShowDialog(this); ClientInfo.Config.Set( "BuildReportDialog", "uiState", dlg.UiState); if (dlg.DialogResult == DialogResult.Cancel) return; string defFileName = Path.Combine(ClientInfo.DataDir, $"report_def\\{dlg.ReportType}.xml"); ReportWriter writer = new ReportWriter(); int nRet = writer.Initial(defFileName, out string strError); if (nRet == -1) goto ERROR1; writer.Algorithm = dlg.ReportType; string strOutputFileName = Path.Combine(ClientInfo.UserDir, "test.rml"); string strOutputHtmlFileName = Path.Combine(ClientInfo.UserDir, "test.html"); DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; Hashtable param_table = dlg.SelectedParamTable; using (var context = new LibraryContext()) { Report.BuildReport(context, param_table, // dlg.Parameters, writer, strOutputFileName); } // RML 格式转换为 HTML 文件 // parameters: // strCssTemplate CSS 模板。里面 %columns% 代表各列的样式 nRet = DigitalPlatform.dp2.Statis.Report.RmlToHtml(strOutputFileName, strOutputHtmlFileName, "", out strError); if (nRet == -1) goto ERROR1; // Process.Start("notepad", strOutputFileName); ReportViewerForm viewer = new ReportViewerForm(); viewer.DataDir = ClientInfo.UserTempDir; viewer.SetXmlFile(strOutputFileName); viewer.SetHtmlFile(strOutputHtmlFileName); viewer.ShowDialog(this); return; ERROR1: MessageBox.Show(this, strError); } private void toolStripButton_stop_Click(object sender, EventArgs e) { _cancel.Cancel(); this.toolStripButton_stop.Enabled = false; } private void MenuItem_runAllTest_Click(object sender, EventArgs e) { DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; using (var context = new LibraryContext()) { test.TestAll(context); } MessageBox.Show(this, "OK"); } private void MenuItem_testDeleteBiblioRecord_Click(object sender, EventArgs e) { DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; using (var context = new LibraryContext()) { // test.TestLeftJoinKeys(context); } } private async void MenuItem_testReplication_Click(object sender, EventArgs e) { string strError = ""; Begin(); var result = await TestLogReplication(_cancel.Token); End(); if (result.Value == -1) { strError = result.ErrorInfo; goto ERROR1; } MessageBox.Show(this, "OK"); return; ERROR1: MessageBox.Show(this, strError); } Task<NormalResult> TestLogReplication(CancellationToken token) { return Task<NormalResult>.Run(() => { Replication replication = new Replication(); LibraryChannel channel = this.GetChannel(); try { int nRet = replication.Initialize(channel, out string strError); if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; var context = new LibraryContext(); try { nRet = replication.DoCreateOperLogTable( ref context, channel, -1, "19990101", "20201231", LogType.OperLog, true, (message) => { OutputHistory(message); }, token, out string strLastDate, out long last_index, out strError); /* nRet = replication.DoReplication( ref context, channel, "19990101", "20201231", LogType.OperLog, (message) => { OutputHistory(message); }, token, out string strLastDate, out long last_index, out strError); */ if (nRet == -1) return new NormalResult { Value = -1, ErrorInfo = strError }; return new NormalResult(); } finally { if (context != null) context.Dispose(); } } finally { this.ReturnChannel(channel); } }); } private void MenuItem_recreateBlankDatabase_Click(object sender, EventArgs e) { DatabaseConfig.ServerName = "localhost"; DatabaseConfig.DatabaseName = "testrep"; DatabaseConfig.UserName = "root"; DatabaseConfig.Password = "test"; using (var context = new LibraryContext()) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); } MessageBox.Show(this, "OK"); } } }
33.17037
156
0.494417
[ "Apache-2.0" ]
zgren/dp2
TestReporting/Form1.cs
27,426
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** 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.AzureNative.ContainerService.V20210201.Outputs { /// <summary> /// Private endpoint which a connection belongs to. /// </summary> [OutputType] public sealed class PrivateEndpointResponse { /// <summary> /// The resource Id for private endpoint /// </summary> public readonly string? Id; [OutputConstructor] private PrivateEndpointResponse(string? id) { Id = id; } } }
25.483871
81
0.649367
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/ContainerService/V20210201/Outputs/PrivateEndpointResponse.cs
790
C#
using System; using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Text; namespace WalletWasabi.Logging { public class BenchmarkLogger : IDisposable { private bool _disposedValue = false; // To detect redundant calls private BenchmarkLogger(LogLevel logLevel = LogLevel.Info, [CallerMemberName] string operationName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1) { LogLevel = logLevel; OperationName = operationName; CallerFilePath = callerFilePath; CallerLineNumber = callerLineNumber; Stopwatch = Stopwatch.StartNew(); } private LogLevel LogLevel { get; } public Stopwatch Stopwatch { get; } public string OperationName { get; } public string CallerFilePath { get; } public int CallerLineNumber { get; } /// <summary> /// Logs the time between the creation of the class and the disposing of the class. /// Example usage: using(BenchmarkLogger.Measure()){} /// </summary> /// <param name="operationName">Which operation to measure. Default is the caller function name.</param> public static IDisposable Measure(LogLevel logLevel = LogLevel.Info, [CallerMemberName] string operationName = "", [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1) { return new BenchmarkLogger(logLevel, operationName, callerFilePath, callerLineNumber); } #region IDisposable Support protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { Stopwatch.Stop(); var min = Stopwatch.Elapsed.TotalMinutes; var sec = Stopwatch.Elapsed.TotalSeconds; string message; if (min > 1) { message = $"{OperationName} finished in {(int)min} minutes."; } else if (sec > 1) { message = $"{OperationName} finished in {(int)sec} seconds."; } else { message = $"{OperationName} finished in {Stopwatch.ElapsedMilliseconds} milliseconds."; } Logger.Log(LogLevel, message, callerFilePath: CallerFilePath, callerLineNumber: CallerLineNumber); } _disposedValue = true; } } // This code added to correctly implement the disposable pattern. public void Dispose() { // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); } #endregion IDisposable Support } }
29.313253
207
0.704891
[ "MIT" ]
Groestlcoin/WalletWasabi
WalletWasabi/Logging/BenchmarkLogger.cs
2,433
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace HobbyRadarAPI.Models { public class Tag { public int TagId { get; set; } public string Name { get; set; } } }
17.642857
40
0.663968
[ "MIT" ]
rnandon/HobbyRadarAPI
HobbyRadarAPI/Models/Tag.cs
249
C#
#region License /* * Copyright 2002-2010 the original author or authors. * * 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. */ #endregion namespace Spring.Objects.Factory.Config { /// <summary> /// A generic implementation of an <see cref="IObjectFactoryPostProcessor"/>, that delegates post processing to a passed delegate /// </summary> /// <remarks> /// This comes in handy when you want to perform specific tasks on an object factory, e.g. doing special initialization. /// </remarks> /// <example> /// The example below is taken from a unit test. The snippet causes 'someObject' to be registered each time <see cref="Spring.Context.Support.AbstractApplicationContext.Refresh"/> is called on /// the context instance: /// <code> /// IConfigurableApplicationContext ctx = new XmlApplicationContext(false, &quot;name&quot;, false, null); /// ctx.AddObjectFactoryPostProcessor(new DelegateObjectFactoryConfigurer( of =&gt; /// { /// of.RegisterSingleton(&quot;someObject&quot;, someObject); /// })); /// </code> /// </example> /// <author>Erich Eichinger</author> public class DelegateObjectFactoryConfigurer : IObjectFactoryPostProcessor { public delegate void ObjectFactoryConfigurationHandler(IConfigurableListableObjectFactory objectFactory); private ObjectFactoryConfigurationHandler _configurationHandler; /// <summary> /// Get or Set the handler to delegate configuration to /// </summary> public ObjectFactoryConfigurationHandler ConfigurationHandler { get { return _configurationHandler; } set { _configurationHandler = value; } } public DelegateObjectFactoryConfigurer() { } public DelegateObjectFactoryConfigurer(ObjectFactoryConfigurationHandler configurationHandler) { _configurationHandler = configurationHandler; } public void PostProcessObjectFactory(IConfigurableListableObjectFactory factory) { if (_configurationHandler != null) { _configurationHandler(factory); } } } }
38.638889
198
0.669662
[ "Apache-2.0" ]
Magicianred/spring-net
src/Spring/Spring.Core/Objects/Factory/Config/DelegateObjectFactoryConfigurer.cs
2,782
C#
using System; namespace Flepper.QueryBuilder { /// <summary> /// Comparison Operator Interface /// </summary> public interface IComparisonOperators : IQueryCommand, ISortCommand { /// <summary> /// Equal Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators EqualTo<T>(T value); /// <summary> /// Equal Null Comparison Operator Contract /// </summary> /// <returns></returns> IComparisonOperators EqualNull(); /// <summary> /// Greater Than Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators GreaterThan<T>(T value); /// <summary> /// Less Than Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators LessThan<T>(T value); /// <summary> /// Greater Than Or Equal Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators GreaterThanOrEqualTo<T>(T value); /// <summary> /// Less Than Or Equal Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators LessThanOrEqualTo<T>(T value); /// <summary> /// Not equal Comparison Operator Contract /// </summary> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators NotEqualTo<T>(T value); /// <summary> /// Contains /// </summary> /// <typeparam name="T"></typeparam> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators Contains<T>(T value); /// <summary> /// StartsWith /// </summary> /// <typeparam name="T"></typeparam> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators StartsWith<T>(T value); /// <summary> /// EndsWith /// </summary> /// <typeparam name="T"></typeparam> /// <param name="value">Value used to compare</param> /// <returns></returns> IComparisonOperators EndsWith<T>(T value); /// <summary> /// /// </summary> /// <typeparam name="TFrom"></typeparam> /// <typeparam name="TTo"></typeparam> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> IComparisonOperators Between<TFrom, TTo>(TFrom from, TTo to); /// <summary> /// /// </summary> /// <param name="values"></param> /// <returns></returns> IComparisonOperators In(params object[] values); /// <summary> /// /// </summary> /// <param name="values"></param> /// <returns></returns> IComparisonOperators NotIn(params object[] values); /// <summary> /// /// </summary> /// <param name="query"></param> /// <returns></returns> IComparisonOperators In(Func<IQueryCommand, IQueryCommand> query); /// <summary> /// /// </summary> /// <param name="query"></param> /// <returns></returns> IComparisonOperators NotIn(Func<IQueryCommand, IQueryCommand> query); } }
31.057377
77
0.535234
[ "MIT" ]
Flepper/flepper
Flepper.QueryBuilder/Operators/Comparison/Interfaces/IComparisonOperators.cs
3,791
C#
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // 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 Microsoft.Azure.Management.WebSites.Models { using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// <summary> /// Class representing certificate reissue request. /// </summary> [Rest.Serialization.JsonTransformation] public partial class ReissueCertificateOrderRequest : Resource { /// <summary> /// Initializes a new instance of the ReissueCertificateOrderRequest /// class. /// </summary> public ReissueCertificateOrderRequest() { CustomInit(); } /// <summary> /// Initializes a new instance of the ReissueCertificateOrderRequest /// class. /// </summary> /// <param name="location">Resource Location.</param> /// <param name="id">Resource Id.</param> /// <param name="name">Resource Name.</param> /// <param name="kind">Kind of resource.</param> /// <param name="type">Resource type.</param> /// <param name="tags">Resource tags.</param> /// <param name="keySize">Certificate Key Size.</param> /// <param name="delayExistingRevokeInHours">Delay in hours to revoke /// existing certificate after the new certificate is issued.</param> /// <param name="csr">Csr to be used for re-key operation.</param> /// <param name="isPrivateKeyExternal">Should we change the ASC type /// (from managed private key to external private key and vice /// versa).</param> public ReissueCertificateOrderRequest(string location, string id = default(string), string name = default(string), string kind = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), int? keySize = default(int?), int? delayExistingRevokeInHours = default(int?), string csr = default(string), bool? isPrivateKeyExternal = default(bool?)) : base(location, id, name, kind, type, tags) { KeySize = keySize; DelayExistingRevokeInHours = delayExistingRevokeInHours; Csr = csr; IsPrivateKeyExternal = isPrivateKeyExternal; CustomInit(); } /// <summary> /// An initialization method that performs custom operations like setting defaults /// </summary> partial void CustomInit(); /// <summary> /// Gets or sets certificate Key Size. /// </summary> [JsonProperty(PropertyName = "properties.keySize")] public int? KeySize { get; set; } /// <summary> /// Gets or sets delay in hours to revoke existing certificate after /// the new certificate is issued. /// </summary> [JsonProperty(PropertyName = "properties.delayExistingRevokeInHours")] public int? DelayExistingRevokeInHours { get; set; } /// <summary> /// Gets or sets csr to be used for re-key operation. /// </summary> [JsonProperty(PropertyName = "properties.csr")] public string Csr { get; set; } /// <summary> /// Gets or sets should we change the ASC type (from managed private /// key to external private key and vice versa). /// </summary> [JsonProperty(PropertyName = "properties.isPrivateKeyExternal")] public bool? IsPrivateKeyExternal { get; set; } /// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public override void Validate() { base.Validate(); } } }
39.561905
411
0.62157
[ "MIT" ]
216Giorgiy/azure-sdk-for-net
src/SDKs/WebSites/Management.Websites/Generated/Models/ReissueCertificateOrderRequest.cs
4,154
C#
using Microsoft.VisualStudio.TestTools.UnitTesting; using NeoFS.API.v2.Cryptography.Tz; namespace NeoFS.API.v2.UnitTests.TestCryptography.Tz { [TestClass] public class UT_SL2 { private SL2 Random() { var r = new SL2(); r[0][0] = GF127.Random(); r[0][1] = GF127.Random(); r[1][0] = GF127.Random(); // d = a^-1 * (1 + b*c) r[1][1] = GF127.Inv(r[0][0]) * (r[0][1] * r[1][0] + new GF127(1, 0)); return r; } [TestMethod] public void TestInv() { for (int i = 0; i < 5; i++) { var a = Random(); var b = SL2.Inv(a); var c = a * b; Assert.AreEqual(SL2.ID, c); } } [TestMethod] public void TestMulA() { var t = Random(); var r1 = t.MulA(); var r2 = t * SL2.A; Assert.AreEqual(r2, r1); } [TestMethod] public void TestMulB() { var t = Random(); var r1 = t.MulB(); var r2 = t * SL2.B; Assert.AreEqual(r2, r1); } } }
24
81
0.404412
[ "MIT" ]
nspcc-dev/neofs-api-csharp
tests/api.UnitTests/Cryptography/TzHash/UT_SL2.cs
1,226
C#
using System; using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using Poker; namespace PokerTest { [TestClass] public class HandOrderHandTest { [TestMethod] public void TestOrderHand() { Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds); Card cardTwo = new Card(CardFace.Jack, CardSuit.Hearts); Card cardThree = new Card(CardFace.Five, CardSuit.Spades); Card cardFour = new Card(CardFace.Ace, CardSuit.Clubs); Card cardFive = new Card(CardFace.Ten, CardSuit.Clubs); IList<ICard> cards = new List<ICard>(); cards.Add(cardOne); cards.Add(cardTwo); cards.Add(cardThree); cards.Add(cardFour); cards.Add(cardFive); Hand hand = new Hand(cards); ICard[] array = hand.OrderHand(); Assert.AreEqual(cardOne.Face, array[0].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardThree.Face, array[1].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardFive.Face, array[2].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardTwo.Face, array[3].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardFour.Face, array[4].Face, "OrderHand() method in class Hand is not working correctly."); } [TestMethod] public void TestOrderHandSameCards() { Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds); Card cardTwo = new Card(CardFace.Jack, CardSuit.Hearts); Card cardThree = new Card(CardFace.Five, CardSuit.Spades); Card cardFour = new Card(CardFace.Ace, CardSuit.Clubs); Card cardFive = new Card(CardFace.Ace, CardSuit.Diamonds); IList<ICard> cards = new List<ICard>(); cards.Add(cardOne); cards.Add(cardTwo); cards.Add(cardThree); cards.Add(cardFour); cards.Add(cardFive); Hand hand = new Hand(cards); ICard[] array = hand.OrderHand(); Assert.AreEqual(cardOne.Face, array[0].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardThree.Face, array[1].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardTwo.Face, array[2].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardFour.Face, array[3].Face, "OrderHand() method in class Hand is not working correctly."); Assert.AreEqual(cardFour.Face, array[4].Face, "OrderHand() method in class Hand is not working correctly."); } [TestMethod] public void TestOrderHandOneCard() { Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds); IList<ICard> cards = new List<ICard>(); cards.Add(cardOne); Hand hand = new Hand(cards); ICard[] array = hand.OrderHand(); Assert.AreEqual(cardOne.Face, array[0].Face, "OrderHand() method in class Hand is not working correctly."); } } }
48.823529
121
0.617169
[ "MIT" ]
NayaIT/TelerikAcademyOnline
High-Quality-Code/TestDrivenDevelopmentTDD/PokerTest/HandOrderHandTest.cs
3,322
C#
using Oogi2.AspNetCore3.Identity.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; namespace Oogi2.AspNetCore3.Identity { public static class BuilderExtensions { public static IdentityBuilder AddDocumentDbStores(this IdentityBuilder builder) { builder.Services.AddSingleton( typeof(IRoleStore<>).MakeGenericType(builder.RoleType), typeof(DocumentDbRoleStore<>).MakeGenericType(builder.RoleType)); builder.Services.AddSingleton( typeof(IUserStore<>).MakeGenericType(builder.UserType), typeof(DocumentDbUserStore<,>).MakeGenericType(builder.UserType, builder.RoleType)); builder.Services.AddTransient<ILookupNormalizer, LookupNormalizer>(); return builder; } } }
35.666667
100
0.692757
[ "MIT" ]
goto10hq/Oogi2.AspNetCore.3.Identity
Oogi2.AspNetCore3.Identity/BuilderExtensions.cs
858
C#
using System; using base_kcp; using DotNetty.Transport.Channels; using DotNetty.Transport.Channels.Sockets; using dotNetty_kcp.thread; using DotNetty.Buffers; using fec; using fec.fec; namespace dotNetty_kcp { public class ServerChannelHandler:ChannelHandlerAdapter { private readonly IChannelManager _channelManager; private readonly ChannelConfig _channelConfig ; private readonly IExecutorPool _executorPool; private readonly KcpListener _kcpListener; private readonly IScheduleThread _scheduleThread; public ServerChannelHandler(IChannelManager channelManager, ChannelConfig channelConfig, IExecutorPool executorPool, KcpListener kcpListener, IScheduleThread scheduleThread) { _channelManager = channelManager; _channelConfig = channelConfig; _executorPool = executorPool; _kcpListener = kcpListener; _scheduleThread = scheduleThread; } public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) { Console.WriteLine(exception); } public override void ChannelRead(IChannelHandlerContext context, object message) { var msg = (DatagramPacket) message; var channel = context.Channel; var ukcp = _channelManager.get(msg); var content = msg.Content; User user; if (ukcp != null) { user = ukcp.user(); //每次收到消息重绑定地址 user.RemoteAddress = msg.Sender; ukcp.read(content); return; } //如果是新连接第一个包的sn必须为0 var sn = getSn(content,_channelConfig); if(sn!=0) { msg.Release(); return; } var messageExecutor = _executorPool.GetAutoMessageExecutor(); KcpOutput kcpOutput = new KcpOutPutImp(); ReedSolomon reedSolomon = null; if(_channelConfig.FecDataShardCount!=0&&_channelConfig.FecParityShardCount!=0){ reedSolomon = ReedSolomon.create(_channelConfig.FecDataShardCount,_channelConfig.FecParityShardCount); } ukcp = new Ukcp(kcpOutput,_kcpListener,messageExecutor,reedSolomon,_channelConfig); user = new User(channel,msg.Sender,msg.Recipient); ukcp.user(user); _channelManager.New(msg.Sender,ukcp,msg); messageExecutor.execute(new ConnectTask(ukcp, _kcpListener)); ukcp.read(content); var scheduleTask = new ScheduleTask(_channelManager,ukcp,_scheduleThread); _scheduleThread.schedule(scheduleTask, TimeSpan.FromMilliseconds(ukcp.getInterval())); } private int getSn(IByteBuffer byteBuf,ChannelConfig channelConfig){ var headerSize = 0; if (channelConfig.Crc32Check) { headerSize+=Ukcp.HEADER_CRC; } if(channelConfig.FecDataShardCount!=0&&channelConfig.FecParityShardCount!=0){ headerSize+= Fec.fecHeaderSizePlus2; } var sn = byteBuf.GetIntLE(byteBuf.ReaderIndex+Kcp.IKCP_SN_OFFSET+headerSize); return sn; } } }
33.264706
181
0.6145
[ "Apache-2.0" ]
l42111996/csharp-kcp
dotNetty-kcp/ServerChannelHandler.cs
3,443
C#
using System.Collections.Generic; using HoneydewCore.Logging; using HoneydewExtractors.Core.Metrics.Visitors; using HoneydewExtractors.Core.Metrics.Visitors.Classes; using HoneydewExtractors.Core.Metrics.Visitors.Properties; using HoneydewExtractors.CSharp.Metrics; using HoneydewExtractors.CSharp.Metrics.Extraction.Class; using HoneydewExtractors.CSharp.Metrics.Extraction.Class.Relations; using HoneydewExtractors.CSharp.Metrics.Extraction.CompilationUnit; using HoneydewExtractors.CSharp.Metrics.Extraction.Property; using HoneydewExtractors.CSharp.Metrics.Iterators; using HoneydewModels.Types; using Moq; using Xunit; namespace HoneydewExtractorsTests.CSharp.Metrics.Extraction.ClassLevel.RelationMetric { public class CSharpPropertiesRelationMetricTests { private readonly PropertiesRelationVisitor _sut; private readonly CSharpFactExtractor _factExtractor; private readonly ClassTypePropertyIterator _classTypePropertyIterator; private readonly Mock<ILogger> _loggerMock = new(); private readonly CSharpSyntacticModelCreator _syntacticModelCreator = new(); private readonly CSharpSemanticModelCreator _semanticModelCreator = new(new CSharpCompilationMaker()); public CSharpPropertiesRelationMetricTests() { _sut = new PropertiesRelationVisitor(); var compositeVisitor = new CompositeVisitor(); compositeVisitor.Add(new ClassSetterCompilationUnitVisitor(new List<ICSharpClassVisitor> { new BaseInfoClassVisitor(), new PropertySetterClassVisitor(new List<IPropertyVisitor> { new PropertyInfoVisitor() }) })); compositeVisitor.Accept(new LoggerSetterVisitor(_loggerMock.Object)); _factExtractor = new CSharpFactExtractor(compositeVisitor); _classTypePropertyIterator = new ClassTypePropertyIterator(new List<IModelVisitor<IClassType>> { _sut }); } [Fact] public void PrettyPrint_ShouldReturnReturnValueDependency() { Assert.Equal("Properties Dependency", _sut.PrettyPrint()); } [Theory] [InlineData("class")] [InlineData("interface")] [InlineData("record")] [InlineData("struct")] public void Extract_ShouldHavePrimitiveProperties_WhenClassHasPropertiesOfPrimitiveTypes(string classType) { var fileContent = $@"using System; namespace App {{ {classType} MyClass {{ public int Foo {{get;set;}} public float Bar {{get;private set;}} public int Zoo {{set;}} public string Goo {{get;set;}} }} }}"; var syntaxTree = _syntacticModelCreator.Create(fileContent); var semanticModel = _semanticModelCreator.Create(syntaxTree); var classTypes = _factExtractor.Extract(syntaxTree, semanticModel).ClassTypes; foreach (var model in classTypes) { _classTypePropertyIterator.Iterate(model); } Assert.Equal(1, classTypes[0].Metrics.Count); Assert.Equal("HoneydewExtractors.CSharp.Metrics.Extraction.Class.Relations.PropertiesRelationVisitor", classTypes[0].Metrics[0].ExtractorName); Assert.Equal("System.Collections.Generic.Dictionary`2[System.String,System.Int32]", classTypes[0].Metrics[0].ValueType); var dependencies = (Dictionary<string, int>)classTypes[0].Metrics[0].Value; Assert.Equal(3, dependencies.Count); Assert.Equal(2, dependencies["int"]); Assert.Equal(1, dependencies["float"]); Assert.Equal(1, dependencies["string"]); } [Theory] [InlineData("class")] [InlineData("interface")] [InlineData("record")] [InlineData("struct")] public void Extract_ShouldHavePrimitiveProperties_WhenClassHasEventPropertiesOfPrimitiveTypes(string classType) { var fileContent = $@"using System; namespace App {{ {classType} MyClass {{ public event Func<int> Foo {{add{{}}remove{{}}}} public event Action<string> Bar {{add{{}}remove{{}}}} }} }}"; var syntaxTree = _syntacticModelCreator.Create(fileContent); var semanticModel = _semanticModelCreator.Create(syntaxTree); var classTypes = _factExtractor.Extract(syntaxTree, semanticModel).ClassTypes; foreach (var model in classTypes) { _classTypePropertyIterator.Iterate(model); } Assert.Equal(1, classTypes[0].Metrics.Count); Assert.Equal("HoneydewExtractors.CSharp.Metrics.Extraction.Class.Relations.PropertiesRelationVisitor", classTypes[0].Metrics[0].ExtractorName); Assert.Equal("System.Collections.Generic.Dictionary`2[System.String,System.Int32]", classTypes[0].Metrics[0].ValueType); var dependencies = (Dictionary<string, int>)classTypes[0].Metrics[0].Value; Assert.Equal(2, dependencies.Count); Assert.Equal(1, dependencies["System.Func<int>"]); Assert.Equal(1, dependencies["System.Action<string>"]); } [Theory] [InlineData("class")] [InlineData("interface")] [InlineData("record")] [InlineData("struct")] public void Extract_ShouldHaveDependenciesProperties_WhenClassHasProperties(string classType) { var fileContent = $@"using System; using HoneydewCore.Extractors; using HoneydewCore.Extractors.Metrics; using HoneydewCore.Extractors.Metrics.SemanticMetrics; namespace App {{ public {classType} IInterface {{ public CSharpMetricExtractor Foo {{get;}} public CSharpMetricExtractor Foo2 {{get; private set;}} public IFactExtractor Bar {{get;}} }} }}"; var syntaxTree = _syntacticModelCreator.Create(fileContent); var semanticModel = _semanticModelCreator.Create(syntaxTree); var classTypes = _factExtractor.Extract(syntaxTree, semanticModel).ClassTypes; foreach (var model in classTypes) { _classTypePropertyIterator.Iterate(model); } Assert.Equal(1, classTypes[0].Metrics.Count); Assert.Equal("HoneydewExtractors.CSharp.Metrics.Extraction.Class.Relations.PropertiesRelationVisitor", classTypes[0].Metrics[0].ExtractorName); Assert.Equal("System.Collections.Generic.Dictionary`2[System.String,System.Int32]", classTypes[0].Metrics[0].ValueType); var dependencies = (Dictionary<string, int>)classTypes[0].Metrics[0].Value; Assert.Equal(2, dependencies.Count); Assert.Equal(2, dependencies["CSharpMetricExtractor"]); Assert.Equal(1, dependencies["IFactExtractor"]); } [Theory] [InlineData("class")] [InlineData("interface")] [InlineData("record")] [InlineData("struct")] public void Extract_ShouldHaveDependenciesEventProperties_WhenClassHasEventProperties(string classType) { var fileContent = $@"using System; using HoneydewCore.Extractors; using HoneydewCore.Extractors.Metrics; namespace App {{ public {classType} IInterface {{ public event Func<CSharpMetricExtractor> Foo {{add{{}} remove{{}}}} public event Action<IFactExtractor> Bar {{add{{}} remove{{}}}} public event Func<IFactExtractor,CSharpMetricExtractor> Goo {{add{{}} remove{{}}}} }} }}"; var syntaxTree = _syntacticModelCreator.Create(fileContent); var semanticModel = _semanticModelCreator.Create(syntaxTree); var classTypes = _factExtractor.Extract(syntaxTree, semanticModel).ClassTypes; foreach (var model in classTypes) { _classTypePropertyIterator.Iterate(model); } Assert.Equal(1, classTypes[0].Metrics.Count); Assert.Equal("HoneydewExtractors.CSharp.Metrics.Extraction.Class.Relations.PropertiesRelationVisitor", classTypes[0].Metrics[0].ExtractorName); Assert.Equal("System.Collections.Generic.Dictionary`2[System.String,System.Int32]", classTypes[0].Metrics[0].ValueType); var dependencies = (Dictionary<string, int>)classTypes[0].Metrics[0].Value; Assert.Equal(3, dependencies.Count); Assert.Equal(1, dependencies["System.Func<CSharpMetricExtractor>"]); Assert.Equal(1, dependencies["System.Action<IFactExtractor>"]); Assert.Equal(1, dependencies["System.Func<IFactExtractor, CSharpMetricExtractor>"]); } } }
45.897872
127
0.541628
[ "Apache-2.0" ]
dxworks/honeydew
HoneydewExtractorsTests/CSharp/Metrics/Extraction/ClassLevel/RelationMetric/CSharpPropertiesRelationMetricTests.cs
10,788
C#
namespace River.Orqa.Editor.Syntax { using System; public enum CodeCompletionType { // Fields CodeTemplates = 5, CompleteWord = 1, ListMembers = 2, None = 0, ParameterInfo = 3, QuickInfo = 4 } }
15.823529
34
0.531599
[ "MIT" ]
stevencohn/Orqa
River.Orqa.Editor/Syntax/CodeCompletionType.cs
269
C#
// The MIT License (MIT) // Copyright (c) 1994-2018 Sage Software, Inc. 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. #region Namespace using System; using System.ComponentModel.DataAnnotations; using Sage.CA.SBS.ERP.Sage300.Common.Models; using Sage.CA.SBS.ERP.Sage300.Common.Models.Attributes; using Sage.CA.SBS.ERP.Sage300.Common.Resources; using ValuedPartner.TU.Models.Enums; using ValuedPartner.TU.Resources.Forms; #endregion namespace ValuedPartner.TU.Models { /// <summary> /// Partial class for ReceiptHeader /// </summary> public partial class ReceiptHeader : ModelBase { /// <summary> /// This constructor initializes EnumerableResponses/Lists to be empty. /// This avoids the problem of serializing null collections. /// </summary> public ReceiptHeader() { ReceiptDetail = new EnumerableResponse<ReceiptDetail>(); ReceiptOptionalField = new EnumerableResponse<ReceiptOptionalField>(); ReceiptDetailOptionalField = new EnumerableResponse<ReceiptDetailOptionalField>(); // Casts from List to IList. } /// <summary> /// Gets or sets SequenceNumber /// </summary> [Key] [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "SequenceNumber", ResourceType = typeof (ReceiptHeaderResx))] public long SequenceNumber { get; set; } /// <summary> /// Gets or sets Description /// </summary> [StringLength(60, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "Description", ResourceType = typeof (ReceiptHeaderResx))] public string Description { get; set; } /// <summary> /// Gets or sets ReceiptDate /// </summary> [ValidateDateFormat(ErrorMessageResourceName="DateFormat", ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "ReceiptDate", ResourceType = typeof (ReceiptHeaderResx))] public DateTime ReceiptDate { get; set; } /// <summary> /// Gets or sets FiscalYear /// </summary> [StringLength(4, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "FiscalYear", ResourceType = typeof (ReceiptHeaderResx))] public string FiscalYear { get; set; } /// <summary> /// Gets or sets FiscalPeriod /// </summary> [Display(Name = "FiscalPeriod", ResourceType = typeof (ReceiptHeaderResx))] public Enums.FiscalPeriod FiscalPeriod { get; set; } /// <summary> /// Gets or sets PurchaseOrderNumber /// </summary> [StringLength(22, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "PurchaseOrderNumber", ResourceType = typeof (ReceiptHeaderResx))] public string PurchaseOrderNumber { get; set; } /// <summary> /// Gets or sets Reference /// </summary> [StringLength(60, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "Reference", ResourceType = typeof (ReceiptHeaderResx))] public string Reference { get; set; } /// <summary> /// Gets or sets ReceiptType /// </summary> [Display(Name = "ReceiptType", ResourceType = typeof (ReceiptHeaderResx))] public ReceiptType ReceiptType { get; set; } /// <summary> /// Gets or sets RateOperation /// </summary> [Display(Name = "RateOperation", ResourceType = typeof (ReceiptHeaderResx))] public RateOperation RateOperation { get; set; } /// <summary> /// Gets or sets VendorNumber /// </summary> [StringLength(12, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "VendorNumber", ResourceType = typeof (ReceiptHeaderResx))] public string VendorNumber { get; set; } /// <summary> /// Gets or sets ReceiptCurrency /// </summary> [StringLength(3, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "ReceiptCurrency", ResourceType = typeof (ReceiptHeaderResx))] public string ReceiptCurrency { get; set; } /// <summary> /// Gets or sets ExchangeRate /// </summary> [Display(Name = "ExchangeRate", ResourceType = typeof (ReceiptHeaderResx))] public decimal ExchangeRate { get; set; } /// <summary> /// Gets or sets RateType /// </summary> [StringLength(2, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "RateType", ResourceType = typeof (ReceiptHeaderResx))] public string RateType { get; set; } /// <summary> /// Gets or sets RateDate /// </summary> [ValidateDateFormat(ErrorMessageResourceName="DateFormat", ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "RateDate", ResourceType = typeof (ReceiptHeaderResx))] public DateTime RateDate { get; set; } /// <summary> /// Gets or sets RateOverride /// </summary> [Display(Name = "RateOverride", ResourceType = typeof (ReceiptHeaderResx))] public RateOverride RateOverride { get; set; } /// <summary> /// Gets or sets AdditionalCost /// </summary> [Display(Name = "AdditionalCost", ResourceType = typeof (ReceiptHeaderResx))] public decimal AdditionalCost { get; set; } /// <summary> /// Gets or sets OrigAdditionalCostFunc /// </summary> [Display(Name = "OrigAdditionalCostFunc", ResourceType = typeof (ReceiptHeaderResx))] public decimal OrigAdditionalCostFunc { get; set; } /// <summary> /// Gets or sets OrigAdditionalCostSource /// </summary> [Display(Name = "OrigAdditionalCostSource", ResourceType = typeof (ReceiptHeaderResx))] public decimal OrigAdditionalCostSource { get; set; } /// <summary> /// Gets or sets AdditionalCostCurrency /// </summary> [StringLength(3, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "AdditionalCostCurrency", ResourceType = typeof (ReceiptHeaderResx))] public string AdditionalCostCurrency { get; set; } /// <summary> /// Gets or sets TotalExtendedCostFunctional /// </summary> [Display(Name = "TotalExtendedCostFunctional", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalExtendedCostFunctional { get; set; } /// <summary> /// Gets or sets TotalExtendedCostSource /// </summary> [Display(Name = "TotalExtendedCostSource", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalExtendedCostSource { get; set; } /// <summary> /// Gets or sets TotalExtendedCostAdjusted /// </summary> [Display(Name = "TotalExtendedCostAdjusted", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalExtendedCostAdjusted { get; set; } /// <summary> /// Gets or sets TotalAdjustedCostFunctional /// </summary> [Display(Name = "TotalAdjustedCostFunctional", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalAdjustedCostFunctional { get; set; } /// <summary> /// Gets or sets TotalReturnCost /// </summary> [Display(Name = "TotalReturnCost", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalReturnCost { get; set; } /// <summary> /// Gets or sets NumberOfDetailswithCost /// </summary> [Display(Name = "NumberOfDetailswithCost", ResourceType = typeof (ReceiptHeaderResx))] public int NumberOfDetailswithCost { get; set; } /// <summary> /// Gets or sets RequireLabels /// </summary> [Display(Name = "RequireLabels", ResourceType = typeof (ReceiptHeaderResx))] public RequireLabels RequireLabels { get; set; } /// <summary> /// Gets or sets AdditionalCostAllocationType /// </summary> [Display(Name = "AdditionalCostAllocationType", ResourceType = typeof (ReceiptHeaderResx))] public AdditionalCostAllocationType AdditionalCostAllocationType { get; set; } /// <summary> /// Gets or sets Complete /// </summary> [Display(Name = "Complete", ResourceType = typeof (ReceiptHeaderResx))] public Complete Complete { get; set; } /// <summary> /// Gets or sets OriginalTotalCostSource /// </summary> [Display(Name = "OriginalTotalCostSource", ResourceType = typeof (ReceiptHeaderResx))] public decimal OriginalTotalCostSource { get; set; } /// <summary> /// Gets or sets OriginalTotalCostFunctional /// </summary> [Display(Name = "OriginalTotalCostFunctional", ResourceType = typeof (ReceiptHeaderResx))] public decimal OriginalTotalCostFunctional { get; set; } /// <summary> /// Gets or sets AdditionalCostFunctional /// </summary> [Display(Name = "AdditionalCostFunctional", ResourceType = typeof (ReceiptHeaderResx))] public decimal AdditionalCostFunctional { get; set; } /// <summary> /// Gets or sets TotalCostReceiptAdditional /// </summary> [Display(Name = "TotalCostReceiptAdditional", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalCostReceiptAdditional { get; set; } /// <summary> /// Gets or sets TotalAdjCostReceiptAddl /// </summary> [Display(Name = "TotalAdjCostReceiptAddl", ResourceType = typeof (ReceiptHeaderResx))] public decimal TotalAdjCostReceiptAddl { get; set; } /// <summary> /// Gets or sets ReceiptCurrencyDecimals /// </summary> [Display(Name = "ReceiptCurrencyDecimals", ResourceType = typeof (ReceiptHeaderResx))] public int ReceiptCurrencyDecimals { get; set; } /// <summary> /// Gets or sets VendorShortName /// </summary> [StringLength(10, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "VendorShortName", ResourceType = typeof (ReceiptHeaderResx))] public string VendorShortName { get; set; } /// <summary> /// Gets or sets ICUniqueDocumentNumber /// </summary> [Display(Name = "ICUniqueDocumentNumber", ResourceType = typeof (ReceiptHeaderResx))] public decimal ICUniqueDocumentNumber { get; set; } /// <summary> /// Gets or sets VendorExists /// </summary> [Display(Name = "VendorExists", ResourceType = typeof (ReceiptHeaderResx))] public VendorExists VendorExists { get; set; } /// <summary> /// Gets or sets RecordDeleted /// </summary> [Display(Name = "RecordDeleted", ResourceType = typeof (ReceiptHeaderResx))] public RecordDeleted RecordDeleted { get; set; } /// <summary> /// Gets or sets TransactionNumber /// </summary> [Display(Name = "TransactionNumber", ResourceType = typeof (ReceiptHeaderResx))] public decimal TransactionNumber { get; set; } /// <summary> /// Gets or sets RecordStatus /// </summary> [Display(Name = "RecordStatus", ResourceType = typeof (ReceiptHeaderResx))] public RecordStatus RecordStatus { get; set; } /// <summary> /// Gets or sets ReceiptNumber /// </summary> [StringLength(22, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "ReceiptNumber", ResourceType = typeof (ReceiptHeaderResx))] public string ReceiptNumber { get; set; } /// <summary> /// Gets or sets NextDetailLineNumber /// </summary> [Display(Name = "NextDetailLineNumber", ResourceType = typeof (ReceiptHeaderResx))] public int NextDetailLineNumber { get; set; } /// <summary> /// Gets or sets RecordPrinted /// </summary> [Display(Name = "RecordPrinted", ResourceType = typeof (ReceiptHeaderResx))] public RecordPrinted RecordPrinted { get; set; } /// <summary> /// Gets or sets PostSequenceNumber /// </summary> [Display(Name = "PostSequenceNumber", ResourceType = typeof (ReceiptHeaderResx))] public long PostSequenceNumber { get; set; } /// <summary> /// Gets or sets OptionalFields /// </summary> [Display(Name = "OptionalFields", ResourceType = typeof (ReceiptHeaderResx))] public long OptionalFields { get; set; } /// <summary> /// Gets or sets ProcessCommand /// </summary> [Display(Name = "ProcessCommand", ResourceType = typeof (ReceiptHeaderResx))] public ProcessCommand ProcessCommand { get; set; } /// <summary> /// Gets or sets VendorName /// </summary> [StringLength(60, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "VendorName", ResourceType = typeof (ReceiptHeaderResx))] public string VendorName { get; set; } /// <summary> /// Gets or sets EnteredBy /// </summary> [StringLength(8, ErrorMessageResourceName = "MaxLength",ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "EnteredBy", ResourceType = typeof (ReceiptHeaderResx))] public string EnteredBy { get; set; } /// <summary> /// Gets or sets PostingDate /// </summary> [ValidateDateFormat(ErrorMessageResourceName="DateFormat", ErrorMessageResourceType = typeof(AnnotationsResx))] [Display(Name = "PostingDate", ResourceType = typeof (ReceiptHeaderResx))] public DateTime PostingDate { get; set; } /// <summary> /// Gets Use ReceiptType string value /// </summary> [IgnoreExportImport] public string ReceiptTypeInText { get { return EnumUtility.GetStringValue(ReceiptType); } } /// <summary> /// Gets or sets Home currency /// </summary> [IgnoreExportImport] public string HomeCurrency { get; set; } [IgnoreExportImport] public EnumerableResponse<ReceiptDetail> ReceiptDetail { get; set; } /// <summary> /// Gets or sets ReceiptOptionalField /// </summary> [IgnoreExportImport] public EnumerableResponse<ReceiptOptionalField> ReceiptOptionalField { get; set; } /// <summary> /// Gets or sets ReceiptDetailOptionalField /// </summary> [IgnoreExportImport] public EnumerableResponse<ReceiptDetailOptionalField> ReceiptDetailOptionalField { get; set; } /// <summary> /// IsOptionalFields is for validating the OptionalFields checkbox /// </summary> [IgnoreExportImport] public bool IsOptionalFields { get; set; } /// <summary> /// IsRequireLabel is for validating the RequireLabels checkbox /// </summary> [IgnoreExportImport] public bool IsRequireLabel { get; set; } /// <summary> /// Gets or sets IsHeader /// </summary> [IgnoreExportImport] public bool IsHeader { get; set; } /// <summary> /// TotalCostReceiptAdditionalDecimal /// </summary> public int TotalCostReceiptAdditionalDecimal { get; set; } /// <summary> /// TotalReturnCostDecimal /// </summary> public int TotalReturnCostDecimal { get; set; } #region UI Strings /// <summary> /// Gets FiscalPeriod string value /// </summary> public string FiscalPeriodString { get { return EnumUtility.GetStringValue(FiscalPeriod); } } /// <summary> /// Gets ReceiptType string value /// </summary> public string ReceiptTypeString { get { return EnumUtility.GetStringValue(ReceiptType); } } /// <summary> /// Gets RateOperation string value /// </summary> public string RateOperationString { get { return EnumUtility.GetStringValue(RateOperation); } } /// <summary> /// Gets RateOverride string value /// </summary> public string RateOverrideString { get { return EnumUtility.GetStringValue(RateOverride); } } /// <summary> /// Gets RequireLabels string value /// </summary> public string RequireLabelsString { get { return EnumUtility.GetStringValue(RequireLabels); } } /// <summary> /// Gets AdditionalCostAllocationType string value /// </summary> public string AdditionalCostAllocationTypeString { get { return EnumUtility.GetStringValue(AdditionalCostAllocationType); } } /// <summary> /// Gets Complete string value /// </summary> public string CompleteString { get { return EnumUtility.GetStringValue(Complete); } } /// <summary> /// Gets VendorExists string value /// </summary> public string VendorExistsString { get { return EnumUtility.GetStringValue(VendorExists); } } /// <summary> /// Gets RecordDeleted string value /// </summary> public string RecordDeletedString { get { return EnumUtility.GetStringValue(RecordDeleted); } } /// <summary> /// Gets RecordStatus string value /// </summary> public string RecordStatusString { get { return EnumUtility.GetStringValue(RecordStatus); } } /// <summary> /// Gets RecordPrinted string value /// </summary> public string RecordPrintedString { get { return EnumUtility.GetStringValue(RecordPrinted); } } /// <summary> /// Gets ProcessCommand string value /// </summary> public string ProcessCommandString { get { return EnumUtility.GetStringValue(ProcessCommand); } } #endregion } }
38.310345
119
0.622512
[ "MIT" ]
Sage-DanielJ/Sage300-SDK
samples/Receipt/ValuedPartner.TU.Models/ReceiptHeader.cs
19,998
C#
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI; 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; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 namespace AccentColorChangeHandling { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { /// <summary> /// UI settings instance /// Keep reference so that the events are properly delivered /// </summary> private readonly UISettings _uiSettings = new UISettings(); public MainPage() { this.InitializeComponent(); _uiSettings.ColorValuesChanged += ColorValuesChanged; } public ObservableCollection<ChangeLogItem> ChangeLog { get; } = new ObservableCollection<ChangeLogItem>(); private void ColorValuesChanged(UISettings sender, object args) { var accentColor = sender.GetColorValue(UIColorType.Accent); //OR //Color accentColor = (Color)Resources["SystemAccentColor"]; var backgroundColor = sender.GetColorValue(UIColorType.Background); var isDarkMode = backgroundColor == Colors.Black; ChangeLog.Insert(0, new ChangeLogItem(accentColor, isDarkMode, DateTimeOffset.Now)); //Example - update title bar UpdateTitleBar(accentColor); } private static void UpdateTitleBar(Color accentColor) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; titleBar.BackgroundColor = accentColor; titleBar.ButtonBackgroundColor = accentColor; titleBar.InactiveBackgroundColor = accentColor; titleBar.ButtonInactiveBackgroundColor = accentColor; //do not forget Mobile :-) ! if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { var statusBar = StatusBar.GetForCurrentView(); statusBar.BackgroundColor = accentColor; } } } }
34.76
112
0.671653
[ "MIT" ]
MartinZikmund/blog-2017
AccentColorChangeHandling/AccentColorChangeHandling/MainPage.xaml.cs
2,609
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using BuildXL.Cache.Monitor.App.Notifications; namespace BuildXL.Cache.Monitor.Library.Notifications { public class MockNotifier<T> : INotifier<T> { public IReadOnlyList<T> Results => _results; private readonly List<T> _results = new List<T>(); public void Emit(T notification) => _results.Add(notification); } }
26.666667
72
0.683333
[ "MIT" ]
BearerPipelineTest/BuildXL
Public/Src/Cache/Monitor/Test/MockNotifier.cs
482
C#
 /** テスト。 */ #define FEE_JSON /** Simple */ namespace Simple { /** 最小値。 */ public class Test_02 { /** Item */ public class Item { public bool value_bool; public sbyte value_sbyte; public byte value_byte; public short value_short; public ushort value_ushort; public int value_int; public uint value_uint; public long value_long; public ulong value_ulong; public char value_char; public float value_float; public double value_double; public decimal value_decimal; public decimal value_decimal_min; } /** チェック。 */ public static bool Check(Item a_from,Item a_to) { if(a_to == null){ UnityEngine.Debug.LogWarning("mismatch : null"); return false; } bool t_result = true; t_result &= Simple.Check_Bool( "value_bool", a_from.value_bool, a_to.value_bool); t_result &= Simple.Check_Sbyte( "value_sbyte", a_from.value_sbyte, a_to.value_sbyte); t_result &= Simple.Check_Byte( "value_byte", a_from.value_byte, a_to.value_byte); t_result &= Simple.Check_Short( "value_short", a_from.value_short, a_to.value_short); t_result &= Simple.Check_Ushort( "value_ushort", a_from.value_ushort, a_to.value_ushort); t_result &= Simple.Check_Int( "value_int", a_from.value_int, a_to.value_int); t_result &= Simple.Check_Uint( "value_uint", a_from.value_uint, a_to.value_uint); t_result &= Simple.Check_Long( "value_long", a_from.value_long, a_to.value_long); t_result &= Simple.Check_Ulong( "value_ulong", a_from.value_ulong, a_to.value_ulong); t_result &= Simple.Check_Char( "value_char", a_from.value_char, a_to.value_char); t_result &= Simple.Check_Float( "value_float", a_from.value_float, a_to.value_float); t_result &= Simple.Check_Double( "value_double", a_from.value_double, a_to.value_double); t_result &= Simple.Check_Decimal( "value_decimal", a_from.value_decimal, a_to.value_decimal); t_result &= Simple.Check_Decimal( "value_decimal_min", a_from.value_decimal_min, a_to.value_decimal_min); return t_result; } /** 更新。 */ public static void Main(string a_label = nameof(Test_02)) { UnityEngine.Debug.Log("----- " + a_label + " -----"); try{ Item t_item_from = new Item(); { t_item_from.value_bool = false; t_item_from.value_sbyte = sbyte.MinValue; t_item_from.value_byte = byte.MinValue; t_item_from.value_short = short.MinValue; t_item_from.value_ushort = ushort.MinValue; t_item_from.value_int = int.MinValue; t_item_from.value_uint = uint.MinValue; t_item_from.value_long = long.MinValue; t_item_from.value_ulong = ulong.MinValue; t_item_from.value_char = char.MinValue; t_item_from.value_float = float.MinValue; t_item_from.value_double = double.MinValue; t_item_from.value_decimal = decimal.MinValue; t_item_from.value_decimal_min = 0.0000000000000000000000000001m; } //オブジェクト ==> JSONITEM。 #if(FEE_JSON) Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem<Item>(t_item_from); #endif //JSONITEM ==> JSON文字列。 #if(FEE_JSON) string t_jsonstring = t_jsonitem.ConvertToJsonString(); #else string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from); #endif //JSON文字列 ==> オブジェクト。 #if(FEE_JSON) Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject<Item>(t_jsonstring); #else Item t_item_to = UnityEngine.JsonUtility.FromJson<Item>(t_jsonstring); #endif //ログ。 UnityEngine.Debug.Log(a_label + " : " + t_jsonstring); //チェック。 if(Check(t_item_from,t_item_to) == false){ UnityEngine.Debug.LogError("mismatch"); } }catch(System.Exception t_exception){ UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message); } } } }
31.276423
108
0.695867
[ "MIT" ]
bluebackblue/jsontest
unity_jsontest/Assets/Simple/Test_02.cs
3,987
C#
namespace QIQO.Common.Contracts { public interface IBusinessEngine { } }
12.285714
36
0.674419
[ "MIT" ]
FSharpCSharp/QIQO.Business.Services.Solution
QIQO.Common.Contracts/IBusinessEngine.cs
88
C#
using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using ShopDN.Data.Models; using ShopDN.Data.Models.Shop; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ShopDN.PortalWWW.Models.BusinessLogic { public class CartB { private readonly ShopDNContext _context; private string CartSessionId; public CartB(ShopDNContext context, HttpContext httpContext) { _context = context; CartSessionId = getCartSessionId(httpContext); } private string getCartSessionId(HttpContext httpContext) { if (httpContext.Session.GetString("CartSessionId") == null) { if (!String.IsNullOrWhiteSpace(httpContext.User.Identity.Name)) { httpContext.Session.SetString("CartSessionId", httpContext.User.Identity.Name); } else { httpContext.Session.SetString("CartSessionId", Guid.NewGuid().ToString()); } } return httpContext.Session.GetString("CartSessionId").ToString(); } public void AddToCart(Product product, int count) { var cartElement = ( from element in _context.CartElement where element.SessionId == this.CartSessionId && element.ProductId == product.Id select element ).FirstOrDefault(); if (cartElement == null) { cartElement = new CartElement() { SessionId = this.CartSessionId, ProductId = product.Id, Count = count, CreatedAt = DateTime.Now }; _context.CartElement.Add(cartElement); } else { cartElement.Count += count; } _context.SaveChanges(); } public void RemoveFromCart(Product product) { var cartElement = ( from element in _context.CartElement where element.SessionId == this.CartSessionId && element.ProductId == product.Id select element ).FirstOrDefault(); _context.CartElement.Remove(cartElement); _context.SaveChanges(); } public void ClearCart() { _context.RemoveRange(_context.CartElement.Where(e => e.SessionId == CartSessionId)); _context.SaveChanges(); } public async Task<List<CartElement>> GetCartElements() { return await _context.CartElement .Where(e => e.SessionId == this.CartSessionId) .Include(e => e.Product) .ToListAsync(); } public async Task<int> GetCartElementsCount() { return (await this.GetCartElements()).Count(); } public async Task<decimal> GetCartSum() { return await ( from element in _context.CartElement where element.SessionId == this.CartSessionId select element.Product.Price * element.Count ).SumAsync(); } } }
30.353982
99
0.530612
[ "MIT" ]
dam6pl/csharp-shop
ShopDN.PortalWWW/Models/BusinessLogic/CartB.cs
3,432
C#
namespace Responsible.State { /// <summary> /// Represents the type of a test operation state transition. /// </summary> public enum TestOperationStateTransition { /// <summary> /// The operation was started. /// </summary> Started, /// <summary> /// The operation was completed successfully, with an error, or canceled. /// </summary> Finished, } }
19.631579
75
0.662198
[ "MIT" ]
YousicianGit/Responsible
com.beatwaves.responsible/Runtime/State/TestOperationStateTransition.cs
373
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ // Copyright (c) 2007-2008 // Available under the terms of the // Eclipse Public License with GPL exception // See enclosed license file for more information namespace PhysX.NET { using System; using System.Runtime.InteropServices; [System.Flags()] public enum NxWheelShapeFlags : uint { NX_WF_WHEEL_AXIS_CONTACT_NORMAL = 1 << 0, NX_WF_INPUT_LAT_SLIPVELOCITY = 1 << 1, NX_WF_INPUT_LNG_SLIPVELOCITY = 1 << 2, NX_WF_UNSCALED_SPRING_BEHAVIOR = 1 << 3, NX_WF_AXLE_SPEED_OVERRIDE = 1 << 4, NX_WF_EMULATE_LEGACY_WHEEL = 1 << 5, NX_WF_CLAMPED_FRICTION = 1 << 6, } }
25.8
81
0.564922
[ "MIT" ]
d3x0r/xperdex
games/PhysX.NET/NxWheelShapeFlags.cs
1,032
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** 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.AzureNative.Cdn.V20190415.Outputs { /// <summary> /// Defines the parameters for RemoteAddress match conditions /// </summary> [OutputType] public sealed class RemoteAddressMatchConditionParametersResponse { /// <summary> /// Match values to match against. The operator will apply to each value in here with OR semantics. If any of them match the variable with the given operator this match condition is considered a match. /// </summary> public readonly ImmutableArray<string> MatchValues; /// <summary> /// Describes if this is negate condition or not /// </summary> public readonly bool? NegateCondition; public readonly string OdataType; /// <summary> /// Describes operator to be matched /// </summary> public readonly string Operator; /// <summary> /// List of transforms /// </summary> public readonly ImmutableArray<string> Transforms; [OutputConstructor] private RemoteAddressMatchConditionParametersResponse( ImmutableArray<string> matchValues, bool? negateCondition, string odataType, string @operator, ImmutableArray<string> transforms) { MatchValues = matchValues; NegateCondition = negateCondition; OdataType = odataType; Operator = @operator; Transforms = transforms; } } }
32.052632
209
0.638752
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/Cdn/V20190415/Outputs/RemoteAddressMatchConditionParametersResponse.cs
1,827
C#
using System; using System.Diagnostics; using System.IO; using System.Text; namespace MemoryClean.Lib { public sealed class ScriptBuilder { private FileInfo ScriptFile { get; } public ScriptBuilder() { ScriptFile = new FileInfo(Path.Combine(Environment.CurrentDirectory, "clear.bat")); if (ScriptFile.Exists) ScriptFile.Delete(); } private void SaveToPath(string path) { try { byte[] array = new byte[9728] { 77, 90, 144, 0, 3, 0, 0, 0, 4, 0, 0, 0, byte.MaxValue, byte.MaxValue, 0, 0, 184, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, 14, 31, 186, 14, 0, 180, 9, 205, 33, 184, 1, 76, 205, 33, 84, 104, 105, 115, 32, 112, 114, 111, 103, 114, 97, 109, 32, 99, 97, 110, 110, 111, 116, 32, 98, 101, 32, 114, 117, 110, 32, 105, 110, 32, 68, 79, 83, 32, 109, 111, 100, 101, 46, 13, 13, 10, 36, 0, 0, 0, 0, 0, 0, 0, 155, 137, 56, 99, 223, 232, 86, 48, 223, 232, 86, 48, 223, 232, 86, 48, 92, 224, 89, 48, 222, 232, 86, 48, 92, 224, 11, 48, 208, 232, 86, 48, 223, 232, 87, 48, 142, 232, 86, 48, 81, 224, 9, 48, 205, 232, 86, 48, 92, 224, 8, 48, 222, 232, 86, 48, 92, 224, 12, 48, 222, 232, 86, 48, 82, 105, 99, 104, 223, 232, 86, 48, 0, 0, 0, 0, 0, 0, 0, 0, 80, 69, 0, 0, 76, 1, 3, 0, 79, 161, 160, 62, 0, 0, 0, 0, 0, 0, 0, 0, 224, 0, 15, 1, 11, 1, 7, 10, 0, 26, 0, 0, 0, 8, 45, 0, 0, 0, 0, 0, 137, 24, 0, 0, 0, 16, 0, 0, 0, 48, 0, 0, 0, 0, 0, 1, 0, 16, 0, 0, 0, 2, 0, 0, 5, 0, 2, 0, 5, 0, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 80, 45, 0, 0, 4, 0, 0, 159, 62, 0, 0, 3, 0, 0, 128, 0, 0, 4, 0, 0, 32, 0, 0, 0, 0, 16, 0, 0, 16, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 33, 0, 0, 120, 0, 0, 0, 0, 64, 45, 0, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 17, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 20, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 116, 101, 120, 116, 0, 0, 0, 60, 24, 0, 0, 0, 16, 0, 0, 0, 26, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 96, 46, 100, 97, 116, 97, 0, 0, 0, 156, 1, 45, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 192, 46, 114, 115, 114, 99, 0, 0, 0, 8, 4, 0, 0, 0, 64, 45, 0, 0, 6, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 38, 0, 0, 70, 38, 0, 0, 94, 38, 0, 0, 0, 0, 0, 0, 212, 35, 0, 0, 234, 35, 0, 0, 190, 35, 0, 0, 24, 36, 0, 0, 44, 36, 0, 0, 174, 35, 0, 0, 148, 35, 0, 0, 128, 35, 0, 0, 110, 35, 0, 0, 4, 36, 0, 0, 92, 35, 0, 0, 204, 37, 0, 0, 176, 37, 0, 0, 162, 37, 0, 0, 148, 37, 0, 0, 132, 37, 0, 0, 118, 37, 0, 0, 102, 37, 0, 0, 0, 0, 0, 0, 146, 39, 0, 0, 132, 39, 0, 0, 104, 39, 0, 0, 92, 39, 0, 0, 74, 39, 0, 0, 56, 39, 0, 0, 40, 39, 0, 0, 14, 39, 0, 0, 250, 38, 0, 0, 228, 38, 0, 0, 202, 38, 0, 0, 186, 38, 0, 0, 166, 38, 0, 0, 150, 38, 0, 0, 128, 38, 0, 0, 162, 39, 0, 0, 0, 0, 0, 0, 252, 37, 0, 0, 6, 38, 0, 0, 16, 38, 0, 0, 26, 38, 0, 0, 36, 38, 0, 0, 242, 37, 0, 0, 128, 36, 0, 0, 118, 36, 0, 0, 108, 36, 0, 0, 98, 36, 0, 0, 88, 36, 0, 0, 232, 37, 0, 0, 148, 36, 0, 0, 156, 36, 0, 0, 170, 36, 0, 0, 180, 36, 0, 0, 188, 36, 0, 0, 200, 36, 0, 0, 216, 36, 0, 0, 228, 36, 0, 0, 248, 36, 0, 0, 8, 37, 0, 0, 88, 37, 0, 0, 38, 37, 0, 0, 56, 37, 0, 0, 138, 36, 0, 0, 24, 37, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 196, 39, 0, 0, 228, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 161, 160, 62, 0, 0, 0, 0, 2, 0, 0, 0, 26, 0, 0, 0, 112, 20, 0, 0, 112, 8, 0, 0, 99, 111, 117, 108, 100, 32, 110, 111, 116, 32, 101, 109, 112, 116, 121, 32, 119, 111, 114, 107, 105, 110, 103, 32, 115, 101, 116, 32, 102, 111, 114, 32, 112, 114, 111, 99, 101, 115, 115, 32, 35, 37, 100, 32, 91, 37, 115, 93, 10, 0, 0, 0, 99, 111, 117, 108, 100, 32, 110, 111, 116, 32, 101, 109, 112, 116, 121, 32, 119, 111, 114, 107, 105, 110, 103, 32, 115, 101, 116, 32, 102, 111, 114, 32, 112, 114, 111, 99, 101, 115, 115, 32, 35, 37, 100, 10, 0, 0, 0, 0, 85, 83, 65, 71, 69, 58, 32, 101, 109, 112, 116, 121, 46, 101, 120, 101, 32, 123, 112, 105, 100, 32, 124, 32, 116, 97, 115, 107, 45, 110, 97, 109, 101, 125, 10, 0, 109, 105, 115, 115, 105, 110, 103, 32, 112, 105, 100, 32, 111, 114, 32, 116, 97, 115, 107, 32, 110, 97, 109, 101, 10, 0, 0, 0, 85, 110, 104, 97, 110, 100, 108, 101, 100, 69, 120, 99, 101, 112, 116, 105, 111, 110, 70, 105, 108, 116, 101, 114, 0, 0, 0, 0, 107, 101, 114, 110, 101, 108, 51, 50, 46, 100, 108, 108, 0, 0, 0, 0, 0, 0, 0, 0, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, 213, 25, 0, 1, 233, 25, 0, 1, 44, 0, 0, 0, 83, 121, 115, 116, 101, 109, 32, 80, 114, 111, 99, 101, 115, 115, 0, 0, 65, 100, 106, 117, 115, 116, 84, 111, 107, 101, 110, 80, 114, 105, 118, 105, 108, 101, 103, 101, 115, 32, 102, 97, 105, 108, 101, 100, 32, 119, 105, 116, 104, 32, 37, 100, 10, 0, 0, 0, 76, 111, 111, 107, 117, 112, 80, 114, 105, 118, 105, 108, 101, 103, 101, 86, 97, 108, 117, 101, 32, 102, 97, 105, 108, 101, 100, 32, 119, 105, 116, 104, 32, 37, 100, 10, 0, 0, 0, 0, 83, 101, 68, 101, 98, 117, 103, 80, 114, 105, 118, 105, 108, 101, 103, 101, 0, 0, 0, 0, 79, 112, 101, 110, 80, 114, 111, 99, 101, 115, 115, 84, 111, 107, 101, 110, 32, 102, 97, 105, 108, 101, 100, 32, 119, 105, 116, 104, 32, 37, 100, 10, 0, 0, 0, 0, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, 157, 32, 0, 1, 161, 32, 0, 1, 177, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 178, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 179, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 180, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 181, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 182, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 183, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 184, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 185, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 186, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 193, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 187, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 188, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 190, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 191, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 192, 174, 171, 236, 25, 127, 210, 17, 151, 142, 0, 0, 248, 117, 126, 42, 243, 42, 55, 81, 231, 202, 207, 17, 190, 129, 0, 170, 0, 162, 250, 37, 60, 31, 78, 123, 2, 167, 210, 17, 163, 54, 0, 192, 79, 121, 120, 224, 62, 15, 233, 65, 193, 86, 51, 70, 129, 195, 110, 139, 172, 139, 221, 112, 62, 15, 233, 65, 193, 86, 51, 70, 129, 195, 110, 139, 172, 139, 221, 112, 241, 179, 212, 2, 136, 253, 209, 17, 150, 13, 0, 128, 95, 199, 146, 53, 130, 79, 23, 215, 184, 54, 168, 74, 128, 10, 233, 99, 171, 45, 250, 185, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 48, 0, 1, 176, 20, 0, 1, 1, 0, 0, 0, 78, 66, 49, 48, 0, 0, 0, 0, 79, 161, 160, 62, 1, 0, 0, 0, 101, 109, 112, 116, 121, 46, 112, 100, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 26, 0, 0, 85, 139, 236, 51, 192, 57, 69, 12, 117, 7, 184, 87, 0, 7, 128, 235, 38, 139, 85, 8, 86, 139, 117, 16, 138, 14, 132, 201, 116, 9, 136, 10, 66, 70, byte.MaxValue, 77, 12, 117, 241, 131, 125, 12, 0, 94, 117, 6, 74, 184, 122, 0, 7, 128, 198, 2, 0, 93, 194, 12, 0, 81, 131, 37, 128, 49, 45, 1, 0, 83, 85, 86, 87, 199, 68, 36, 16, 96, 48, 0, 1, 198, 5, 96, 48, 0, 1, 0, byte.MaxValue, 21, 56, 16, 0, 1, 139, 240, 138, 30, 70, 128, 251, 32, 116, 9, 128, 251, 9, 116, 4, 132, 219, 117, 239, 139, 61, 192, 16, 0, 1, 235, 3, 138, 30, 70, 15, 182, 195, 80, byte.MaxValue, 215, 133, 192, 89, 117, 242, 139, 45, 196, 16, 0, 1, 15, 182, 251, 87, byte.MaxValue, 213, 133, 192, 89, 116, 44, 235, 23, 161, 128, 49, 45, 1, 141, 4, 128, 141, 68, 71, 208, 163, 128, 49, 45, 1, 138, 6, 70, 15, 182, 248, 87, byte.MaxValue, 213, 133, 192, 89, 117, 225, 235, 31, byte.MaxValue, 68, 36, 16, 136, 24, 138, 30, 70, 132, 219, 139, 68, 36, 16, 117, 239, 104, 96, 48, 0, 1, 136, 24, byte.MaxValue, 21, 200, 16, 0, 1, 89, 95, 94, 93, 91, 89, 195, 129, 236, 160, 0, 0, 0, 161, 28, 48, 0, 1, 131, 36, 36, 0, 83, 137, 132, 36, 160, 0, 0, 0, 232, 65, byte.MaxValue, byte.MaxValue, byte.MaxValue, 131, 61, 128, 49, 45, 1, 0, 117, 76, 138, 29, 96, 48, 0, 1, 132, 219, 117, 13, 104, 196, 17, 0, 1, byte.MaxValue, 21, 184, 16, 0, 1, 235, 95, 184, 96, 48, 0, 1, 141, 80, 1, 138, 8, 64, 132, 201, 117, 249, 43, 194, 131, 248, 2, 117, 31, 128, 251, 45, 116, 5, 128, 251, 47, 117, 21, 128, 61, 97, 48, 0, 1, 63, 117, 12, 104, 160, 17, 0, 1, byte.MaxValue, 21, 184, 16, 0, 1, 89, 232, 19, 7, 0, 0, 161, 128, 49, 45, 1, 133, 192, 116, 44, 80, 232, 21, 9, 0, 0, 133, 192, 117, 27, byte.MaxValue, 53, 128, 49, 45, 1, 104, 112, 17, 0, 1, byte.MaxValue, 21, 184, 16, 0, 1, 89, 51, 192, 89, 64, 233, 28, 1, 0, 0, 51, 192, 233, 21, 1, 0, 0, 85, 86, 87, 104, 0, 4, 0, 0, 190, 128, 49, 0, 1, 86, 232, 182, 6, 0, 0, 139, 216, 141, 68, 36, 24, 80, 137, 116, 36, 28, 137, 92, 36, 32, 232, 78, 11, 0, 0, 133, 219, 118, 125, 191, 144, 49, 0, 1, 137, 92, 36, 20, 141, 111, 16, 85, 104, 128, 0, 0, 0, 141, 68, 36, 52, 80, 232, 48, 254, byte.MaxValue, byte.MaxValue, 141, 68, 36, 44, 106, 46, 80, byte.MaxValue, 21, 188, 16, 0, 1, 133, 192, 89, 89, 116, 3, 198, 0, 0, 106, 0, 190, 96, 48, 0, 1, 86, 141, 68, 36, 52, 80, 232, 112, 7, 0, 0, 133, 192, 117, 30, 80, 86, 85, 232, 100, 7, 0, 0, 133, 192, 117, 18, 80, 86, 129, 197, 128, 0, 0, 0, 85, 232, 82, 7, 0, 0, 133, 192, 116, 6, 199, 7, 1, 0, 0, 0, 129, 199, 64, 11, 0, 0, byte.MaxValue, 76, 36, 20, 117, 145, 190, 128, 49, 0, 1, 133, 219, 189, 60, 17, 0, 1, 118, 50, 141, 126, 32, 131, 127, 240, 0, 116, 32, byte.MaxValue, 54, 232, 46, 8, 0, 0, 133, 192, 117, 21, 87, byte.MaxValue, 54, 85, byte.MaxValue, 21, 184, 16, 0, 1, 131, 196, 12, 199, 68, 36, 16, 1, 0, 0, 0, 129, 198, 64, 11, 0, 0, 75, 117, 206, 106, 0, 104, 96, 48, 0, 1, 190, 20, 48, 0, 1, 86, 232, 234, 6, 0, 0, 133, 192, 116, 21, 232, 66, 8, 0, 0, 133, 192, 117, 12, 86, 80, 85, byte.MaxValue, 21, 184, 16, 0, 1, 131, 196, 12, 139, 68, 36, 16, 95, 94, 93, 91, 139, 140, 36, 156, 0, 0, 0, 129, 196, 160, 0, 0, 0, 233, 134, 0, 0, 0, 85, 139, 236, 131, 236, 16, 161, 28, 48, 0, 1, 133, 192, 116, 7, 61, 78, 230, 64, 187, 117, 110, 86, 141, 69, 248, 80, byte.MaxValue, 21, 20, 16, 0, 1, 139, 117, 252, 51, 117, 248, byte.MaxValue, 21, 16, 16, 0, 1, 51, 240, byte.MaxValue, 21, 24, 16, 0, 1, 51, 240, byte.MaxValue, 21, 36, 16, 0, 1, 51, 240, 141, 69, 240, 80, byte.MaxValue, 21, 40, 16, 0, 1, 139, 69, 244, 51, 69, 240, 51, 240, 137, 53, 28, 48, 0, 1, 117, 10, 199, 5, 28, 48, 0, 1, 78, 230, 64, 187, 104, 252, 17, 0, 1, byte.MaxValue, 21, 44, 16, 0, 1, 133, 192, 94, 116, 17, 104, 224, 17, 0, 1, 80, byte.MaxValue, 21, 48, 16, 0, 1, 163, 136, 49, 45, 1, 201, 195, 59, 13, 28, 48, 0, 1, 117, 1, 195, 233, 0, 0, 0, 0, 85, 141, 172, 36, 88, 253, byte.MaxValue, byte.MaxValue, 129, 236, 40, 3, 0, 0, 161, 28, 48, 0, 1, 137, 133, 164, 2, 0, 0, 161, 132, 49, 45, 1, 133, 192, 116, 2, byte.MaxValue, 208, 131, 61, 136, 49, 45, 1, 0, 116, 62, 87, 51, 192, 33, 69, 216, 106, 19, 89, 141, 125, 132, 243, 171, 185, 178, 0, 0, 0, 141, 125, 220, 243, 171, 141, 69, 128, 137, 69, 208, 141, 69, 216, 106, 0, 199, 69, 128, 9, 4, 0, 192, 137, 69, 212, byte.MaxValue, 21, 32, 16, 0, 1, 141, 69, 208, 80, byte.MaxValue, 21, 136, 49, 45, 1, 95, 104, 2, 5, 0, 0, byte.MaxValue, 21, 28, 16, 0, 1, 80, byte.MaxValue, 21, 52, 16, 0, 1, 139, 141, 164, 2, 0, 0, 232, 106, byte.MaxValue, byte.MaxValue, byte.MaxValue, 129, 197, 168, 2, 0, 0, 201, 195, 106, 40, 104, 16, 18, 0, 1, 232, 155, 1, 0, 0, 102, 129, 61, 0, 0, 0, 1, 77, 90, 117, 40, 161, 60, 0, 0, 1, 129, 184, 0, 0, 0, 1, 80, 69, 0, 0, 117, 23, 15, 183, 136, 24, 0, 0, 1, 129, 249, 11, 1, 0, 0, 116, 33, 129, 249, 11, 2, 0, 0, 116, 6, 131, 101, 228, 0, 235, 42, 131, 184, 132, 0, 0, 1, 14, 118, 241, 51, 201, 57, 136, 248, 0, 0, 1, 235, 17, 131, 184, 116, 0, 0, 1, 14, 118, 222, 51, 201, 57, 136, 232, 0, 0, 1, 15, 149, 193, 137, 77, 228, 131, 101, 252, 0, 106, 1, byte.MaxValue, 21, 252, 16, 0, 1, 89, 131, 13, 140, 49, 45, 1, byte.MaxValue, 131, 13, 144, 49, 45, 1, byte.MaxValue, byte.MaxValue, 21, 8, 17, 0, 1, 139, 13, 76, 48, 0, 1, 137, 8, byte.MaxValue, 21, 244, 16, 0, 1, 139, 13, 72, 48, 0, 1, 137, 8, 161, 240, 16, 0, 1, 139, 0, 163, 148, 49, 45, 1, 232, 236, 0, 0, 0, 131, 61, 32, 48, 0, 1, 0, 117, 12, 104, 44, 26, 0, 1, byte.MaxValue, 21, 236, 16, 0, 1, 89, 232, 192, 0, 0, 0, 104, 16, 48, 0, 1, 104, 12, 48, 0, 1, 232, 171, 0, 0, 0, 161, 68, 48, 0, 1, 137, 69, 220, 141, 69, 220, 80, byte.MaxValue, 53, 64, 48, 0, 1, 141, 69, 224, 80, 141, 69, 216, 80, 141, 69, 212, 80, byte.MaxValue, 21, 228, 16, 0, 1, 137, 69, 204, 104, 8, 48, 0, 1, 104, 0, 48, 0, 1, 232, 117, 0, 0, 0, 139, 69, 224, 139, 13, 224, 16, 0, 1, 137, 1, byte.MaxValue, 117, 224, byte.MaxValue, 117, 216, byte.MaxValue, 117, 212, 232, 218, 251, byte.MaxValue, byte.MaxValue, 131, 196, 48, 139, 240, 137, 117, 200, 131, 125, 228, 0, 117, 7, 86, byte.MaxValue, 21, 220, 16, 0, 1, byte.MaxValue, 21, 216, 16, 0, 1, 235, 45, 139, 69, 236, 139, 8, 139, 9, 137, 77, 208, 80, 81, 232, 40, 0, 0, 0, 89, 89, 195, 139, 101, 232, 139, 117, 208, 131, 125, 228, 0, 117, 7, 86, byte.MaxValue, 21, 208, 16, 0, 1, byte.MaxValue, 21, 4, 17, 0, 1, 131, 77, 252, byte.MaxValue, 139, 198, 232, 94, 0, 0, 0, 195, byte.MaxValue, 37, 212, 16, 0, 1, byte.MaxValue, 37, 232, 16, 0, 1, 104, 0, 0, 3, 0, 104, 0, 0, 1, 0, 232, 89, 0, 0, 0, 89, 89, 195, 51, 192, 195, 204, 104, 124, 26, 0, 1, 100, 161, 0, 0, 0, 0, 80, 139, 68, 36, 16, 137, 108, 36, 16, 141, 108, 36, 16, 43, 224, 83, 86, 87, 139, 69, 248, 137, 101, 232, 80, 139, 69, 252, 199, 69, 252, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, 137, 69, 248, 141, 69, 240, 100, 163, 0, 0, 0, 0, 195, 139, 77, 240, 100, 137, 13, 0, 0, 0, 0, 89, 95, 94, 91, 201, 81, 195, byte.MaxValue, 37, 0, 17, 0, 1, byte.MaxValue, 37, 248, 16, 0, 1, 85, 139, 236, 131, 236, 32, 161, 152, 49, 45, 1, 83, 51, 219, 137, 93, 236, 59, 195, 117, 29, 106, 4, 104, 0, 16, 0, 0, byte.MaxValue, 53, 36, 48, 0, 1, 83, byte.MaxValue, 21, 76, 16, 0, 1, 59, 195, 163, 152, 49, 45, 1, 116, 60, 83, byte.MaxValue, 53, 36, 48, 0, 1, 80, 106, 5, byte.MaxValue, 21, 24, 17, 0, 1, 61, 4, 0, 0, 192, 117, 44, 129, 5, 36, 48, 0, 1, 0, 32, 0, 0, 104, 0, 128, 0, 0, 83, byte.MaxValue, 53, 152, 49, 45, 1, byte.MaxValue, 21, 80, 16, 0, 1, 51, 192, 163, 152, 49, 45, 1, 235, 163, 51, 192, 233, 4, 2, 0, 0, 86, 139, 117, 8, 87, 139, 61, 152, 49, 45, 1, 137, 93, 244, 137, 93, 228, 57, 95, 60, 116, 53, 106, 1, 141, 71, 56, 80, 141, 69, 224, 80, byte.MaxValue, 21, 20, 17, 0, 1, 57, 93, 228, 116, 25, 106, 92, byte.MaxValue, 117, 228, byte.MaxValue, 21, 164, 16, 0, 1, 59, 195, 89, 89, 116, 3, 64, 235, 17, 139, 69, 228, 235, 12, 184, 47, 18, 0, 1, 235, 5, 184, 32, 18, 0, 1, 104, 128, 0, 0, 0, 80, 141, 70, 32, 80, byte.MaxValue, 21, 160, 16, 0, 1, 198, 134, 159, 0, 0, 0, 0, 137, 94, 16, 139, 71, 68, 137, 6, 139, 71, 72, 137, 70, 4, 139, 71, 32, 137, 70, 8, 139, 71, 36, 137, 70, 12, 139, 71, 88, 137, 134, 32, 1, 0, 0, 139, 71, 92, 137, 134, 36, 1, 0, 0, 139, 71, 96, 137, 134, 40, 1, 0, 0, 139, 71, 100, 137, 134, 44, 1, 0, 0, 139, 71, 104, 137, 134, 48, 1, 0, 0, 139, 71, 4, 131, 196, 12, 57, 93, 16, 137, 134, 52, 1, 0, 0, 116, 60, 193, 224, 3, 80, byte.MaxValue, 21, 204, 16, 0, 1, 59, 195, 89, 137, 134, 56, 1, 0, 0, 116, 45, 139, 142, 52, 1, 0, 0, 59, 203, 139, 208, 116, 33, 141, 135, 220, 0, 0, 0, 139, 88, 16, 137, 26, 139, 24, 137, 90, 4, 131, 194, 8, 131, 192, 64, 73, 117, 237, 235, 6, 137, 158, 56, 1, 0, 0, 198, 134, 60, 5, 0, 0, 0, 139, 71, 80, 137, 134, 60, 9, 0, 0, 51, 192, 57, 69, 20, 141, 158, 60, 1, 0, 0, 198, 134, 64, 9, 0, 0, 0, 198, 3, 0, 15, 132, 169, 0, 0, 0, 199, 69, 240, 1, 0, 0, 0, 199, 69, 8, byte.MaxValue, 3, 0, 0, 137, 69, 248, 15, 134, 146, 0, 0, 0, 139, 69, 24, 137, 69, 252, 139, 14, 59, 72, 36, 117, 112, 139, 8, 139, 193, 141, 80, 1, 137, 85, 232, 138, 16, 64, 132, 210, 117, 249, 43, 69, 232, 131, 125, 240, 0, 137, 69, 232, 116, 27, byte.MaxValue, 117, 8, 131, 101, 240, 0, 81, 83, byte.MaxValue, 21, 160, 16, 0, 1, 139, 69, 8, 131, 196, 12, 198, 4, 3, 0, 235, 42, 131, 125, 8, 1, 118, 36, byte.MaxValue, 117, 8, 104, 28, 18, 0, 1, 83, byte.MaxValue, 21, 180, 16, 0, 1, byte.MaxValue, 77, 8, byte.MaxValue, 117, 8, 139, 69, 252, byte.MaxValue, 48, 83, byte.MaxValue, 21, 180, 16, 0, 1, 131, 196, 24, 139, 69, 232, 57, 69, 8, 114, 27, 41, 69, 8, 139, 69, 252, byte.MaxValue, 69, 248, 139, 77, 248, 131, 192, 44, 59, 77, 20, 137, 69, 252, 15, 130, 116, byte.MaxValue, byte.MaxValue, byte.MaxValue, 139, 69, 236, 129, 198, 64, 11, 0, 0, 64, 59, 69, 12, 137, 69, 236, 116, 27, 139, 63, 133, byte.MaxValue, 116, 21, 1, 125, 244, 161, 152, 49, 45, 1, 139, 77, 244, 141, 60, 8, 51, 219, 233, 12, 254, byte.MaxValue, byte.MaxValue, 95, 94, 91, 201, 194, 20, 0, 51, 192, 80, 80, 80, byte.MaxValue, 116, 36, 20, byte.MaxValue, 116, 36, 20, 232, 112, 253, byte.MaxValue, byte.MaxValue, 194, 8, 0, 85, 139, 236, 131, 236, 28, 141, 69, 252, 80, 106, 40, byte.MaxValue, 21, 28, 16, 0, 1, 80, byte.MaxValue, 21, 8, 16, 0, 1, 133, 192, 117, 14, byte.MaxValue, 21, 84, 16, 0, 1, 80, 104, 148, 18, 0, 1, 235, 98, 141, 69, 244, 80, 104, 128, 18, 0, 1, 106, 0, byte.MaxValue, 21, 4, 16, 0, 1, 133, 192, 117, 14, byte.MaxValue, 21, 84, 16, 0, 1, 80, 104, 88, 18, 0, 1, 235, 63, 139, 69, 244, 106, 0, 137, 69, 232, 139, 69, 248, 106, 0, 106, 16, 137, 69, 236, 141, 69, 228, 80, 106, 0, byte.MaxValue, 117, 252, 199, 69, 228, 1, 0, 0, 0, 199, 69, 240, 2, 0, 0, 0, byte.MaxValue, 21, 0, 16, 0, 1, 133, 192, 117, 24, byte.MaxValue, 21, 84, 16, 0, 1, 80, 104, 48, 18, 0, 1, byte.MaxValue, 21, 184, 16, 0, 1, 89, 89, 51, 192, 201, 195, 51, 192, 64, 201, 195, 86, 51, 246, 106, 0, 106, 0, 86, 106, 253, byte.MaxValue, 21, 116, 16, 0, 1, 139, 240, 133, 246, 116, 13, byte.MaxValue, 116, 36, 12, 86, byte.MaxValue, 84, 36, 16, 133, 192, 117, 224, 51, 192, 64, 94, 194, 8, 0, 86, 139, 53, 188, 16, 0, 1, 87, 139, 124, 36, 12, 106, 42, 87, byte.MaxValue, 214, 133, 192, 89, 89, 116, 5, 51, 192, 64, 235, 24, 106, 63, 87, byte.MaxValue, 214, 133, 192, 89, 89, 117, 240, 106, 91, 87, byte.MaxValue, 214, 247, 216, 89, 27, 192, 89, 247, 216, 95, 94, 194, 4, 0, 83, 139, 92, 36, 8, 86, 139, 116, 36, 16, 87, 131, 124, 36, 24, 0, 116, 60, 86, 232, 175, byte.MaxValue, byte.MaxValue, byte.MaxValue, 133, 192, 117, 50, 86, 83, byte.MaxValue, 21, 172, 16, 0, 1, 133, 192, 89, 89, 116, 36, 141, 80, 1, 138, 8, 64, 132, 201, 117, 249, 43, 194, 139, 206, 139, 248, 141, 81, 1, 138, 1, 65, 132, 192, 117, 249, 43, 202, 59, 249, 15, 132, 176, 0, 0, 0, 15, 182, 62, 70, 133, byte.MaxValue, 15, 132, 169, 0, 0, 0, 131, byte.MaxValue, 42, 15, 132, 140, 0, 0, 0, 131, byte.MaxValue, 63, 116, 108, 15, 182, 3, 67, 131, byte.MaxValue, 91, 116, 19, 80, byte.MaxValue, 21, 168, 16, 0, 1, 59, 199, 89, 116, 209, 51, 192, 233, 134, 0, 0, 0, 133, 192, 116, 245, 80, byte.MaxValue, 21, 168, 16, 0, 1, 89, 51, 210, 235, 36, 131, 249, 93, 116, 228, 131, 249, 45, 117, 20, 15, 182, 14, 133, 201, 116, 216, 131, 249, 93, 116, 211, 59, 194, 124, 4, 59, 193, 126, 25, 59, 193, 139, 209, 116, 19, 15, 182, 14, 70, 133, 201, 117, 212, 235, 9, 131, 249, 93, 116, 135, 15, 182, 14, 70, 133, 201, 117, 243, 233, 122, byte.MaxValue, byte.MaxValue, byte.MaxValue, 138, 3, 67, 132, 192, 15, 133, 111, byte.MaxValue, byte.MaxValue, byte.MaxValue, 235, 156, 106, 0, 86, 83, 232, 22, byte.MaxValue, byte.MaxValue, byte.MaxValue, 67, 133, 192, 117, 15, 128, 59, 0, 117, 237, 131, 100, 36, 24, 0, 233, 13, byte.MaxValue, byte.MaxValue, byte.MaxValue, 51, 192, 64, 235, 7, 51, 192, 56, 3, 15, 148, 192, 95, 94, 91, 194, 12, 0, 85, 139, 236, 81, 86, 87, byte.MaxValue, 117, 8, 51, byte.MaxValue, 87, 104, byte.MaxValue, 15, 31, 0, byte.MaxValue, 21, 68, 16, 0, 1, 139, 240, 59, 247, 117, 4, 51, 192, 235, 42, 141, 69, 8, 80, 141, 69, 252, 80, 86, byte.MaxValue, 21, 60, 16, 0, 1, 133, 192, 116, 14, 106, byte.MaxValue, 106, byte.MaxValue, 86, byte.MaxValue, 21, 64, 16, 0, 1, 51, byte.MaxValue, 71, 86, byte.MaxValue, 21, 72, 16, 0, 1, 139, 199, 95, 94, 201, 194, 4, 0, 85, 139, 236, 131, 236, 36, 131, 77, 232, byte.MaxValue, 131, 77, 236, byte.MaxValue, 106, 36, 141, 69, 220, 80, 106, 21, byte.MaxValue, 21, 16, 17, 0, 1, 51, 201, 133, 192, 15, 157, 193, 139, 193, 201, 195, 104, 156, 0, 0, 0, 104, 184, 18, 0, 1, 232, 125, 250, byte.MaxValue, byte.MaxValue, 161, 28, 48, 0, 1, 137, 69, 228, 51, 246, 137, 181, 92, byte.MaxValue, byte.MaxValue, byte.MaxValue, 139, 125, 12, 139, 31, 139, 71, 4, 137, 133, 88, byte.MaxValue, byte.MaxValue, byte.MaxValue, 137, 117, 252, 141, 133, 92, byte.MaxValue, byte.MaxValue, byte.MaxValue, 80, byte.MaxValue, 117, 8, byte.MaxValue, 21, 100, 16, 0, 1, 133, 192, 15, 132, 184, 0, 0, 0, 106, 4, byte.MaxValue, 117, 8, byte.MaxValue, 21, 104, 16, 0, 1, 133, 192, 15, 133, 165, 0, 0, 0, 106, 240, byte.MaxValue, 117, 8, byte.MaxValue, 21, 108, 16, 0, 1, 169, 0, 0, 0, 16, 117, 9, 57, 119, 16, 15, 133, 138, 0, 0, 0, 137, 181, 96, byte.MaxValue, byte.MaxValue, byte.MaxValue, 139, 133, 96, byte.MaxValue, byte.MaxValue, byte.MaxValue, 59, 133, 88, byte.MaxValue, byte.MaxValue, byte.MaxValue, 115, 118, 105, 192, 64, 11, 0, 0, 141, 52, 24, 139, 6, 59, 133, 92, byte.MaxValue, byte.MaxValue, byte.MaxValue, 117, 84, 131, 127, 16, 0, 117, 6, 131, 126, 20, 0, 117, 72, 139, 69, 8, 137, 70, 20, 139, 71, 8, 137, 70, 24, 139, 71, 12, 137, 70, 28, 191, 128, 0, 0, 0, 87, 141, 133, 100, byte.MaxValue, byte.MaxValue, byte.MaxValue, 80, byte.MaxValue, 118, 20, byte.MaxValue, 21, 112, 16, 0, 1, 133, 192, 116, 43, 141, 133, 100, byte.MaxValue, byte.MaxValue, byte.MaxValue, 80, 87, 129, 198, 160, 0, 0, 0, 86, 232, 39, 244, byte.MaxValue, byte.MaxValue, 137, 133, 84, byte.MaxValue, byte.MaxValue, byte.MaxValue, 235, 15, byte.MaxValue, 133, 96, byte.MaxValue, byte.MaxValue, byte.MaxValue, 235, 131, 51, 192, 64, 195, 139, 101, 232, 131, 77, 252, byte.MaxValue, 51, 192, 64, 139, 77, 228, 232, 56, 247, byte.MaxValue, byte.MaxValue, 232, 179, 249, byte.MaxValue, byte.MaxValue, 194, 8, 0, 81, 85, 104, 0, 0, 0, 2, 106, 0, 106, 0, byte.MaxValue, 116, 36, 24, byte.MaxValue, 21, 136, 16, 0, 1, 139, 232, 133, 237, 116, 118, 83, 86, 87, byte.MaxValue, 21, 24, 16, 0, 1, 80, byte.MaxValue, 21, 124, 16, 0, 1, 85, 137, 68, 36, 20, byte.MaxValue, 21, 140, 16, 0, 1, byte.MaxValue, 116, 36, 24, byte.MaxValue, 21, 176, 16, 0, 1, 139, 116, 36, 32, 139, 29, 96, 16, 0, 1, 89, 86, 191, 164, 31, 0, 1, 87, 137, 70, 12, 199, 70, 16, 1, 0, 0, 0, byte.MaxValue, 211, 86, 87, 232, 153, 252, byte.MaxValue, byte.MaxValue, 131, 102, 16, 0, 86, 87, byte.MaxValue, 211, 86, 87, 232, 138, 252, byte.MaxValue, byte.MaxValue, 59, 108, 36, 16, 95, 94, 91, 116, 17, byte.MaxValue, 116, 36, 4, byte.MaxValue, 21, 140, 16, 0, 1, 85, byte.MaxValue, 21, 144, 16, 0, 1, 51, 192, 64, 93, 89, 194, 8, 0, 87, 104, 0, 0, 0, 2, 106, 0, byte.MaxValue, 116, 36, 16, byte.MaxValue, 21, 128, 16, 0, 1, 139, 248, 133, byte.MaxValue, 116, 69, 83, 86, byte.MaxValue, 21, 120, 16, 0, 1, 139, 53, 132, 16, 0, 1, 87, 139, 216, byte.MaxValue, 214, byte.MaxValue, 116, 36, 16, byte.MaxValue, 21, 176, 16, 0, 1, 89, 139, 76, 36, 20, 81, 104, 187, 32, 0, 1, 87, 137, 65, 8, byte.MaxValue, 21, 92, 16, 0, 1, 59, 251, 116, 10, 83, byte.MaxValue, 214, 87, byte.MaxValue, 21, 148, 16, 0, 1, 51, 192, 94, 64, 91, 95, 194, 8, 0, byte.MaxValue, 116, 36, 4, 104, 81, 33, 0, 1, byte.MaxValue, 21, 152, 16, 0, 1, 194, 4, 0, 76, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 36, 0, 0, 16, 16, 0, 0, 220, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 37, 0, 0, 160, 16, 0, 0, 60, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 114, 38, 0, 0, 0, 16, 0, 0, 152, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 184, 39, 0, 0, 92, 16, 0, 0, 76, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 40, 0, 0, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 38, 0, 0, 70, 38, 0, 0, 94, 38, 0, 0, 0, 0, 0, 0, 212, 35, 0, 0, 234, 35, 0, 0, 190, 35, 0, 0, 24, 36, 0, 0, 44, 36, 0, 0, 174, 35, 0, 0, 148, 35, 0, 0, 128, 35, 0, 0, 110, 35, 0, 0, 4, 36, 0, 0, 92, 35, 0, 0, 204, 37, 0, 0, 176, 37, 0, 0, 162, 37, 0, 0, 148, 37, 0, 0, 132, 37, 0, 0, 118, 37, 0, 0, 102, 37, 0, 0, 0, 0, 0, 0, 146, 39, 0, 0, 132, 39, 0, 0, 104, 39, 0, 0, 92, 39, 0, 0, 74, 39, 0, 0, 56, 39, 0, 0, 40, 39, 0, 0, 14, 39, 0, 0, 250, 38, 0, 0, 228, 38, 0, 0, 202, 38, 0, 0, 186, 38, 0, 0, 166, 38, 0, 0, 150, 38, 0, 0, 128, 38, 0, 0, 162, 39, 0, 0, 0, 0, 0, 0, 252, 37, 0, 0, 6, 38, 0, 0, 16, 38, 0, 0, 26, 38, 0, 0, 36, 38, 0, 0, 242, 37, 0, 0, 128, 36, 0, 0, 118, 36, 0, 0, 108, 36, 0, 0, 98, 36, 0, 0, 88, 36, 0, 0, 232, 37, 0, 0, 148, 36, 0, 0, 156, 36, 0, 0, 170, 36, 0, 0, 180, 36, 0, 0, 188, 36, 0, 0, 200, 36, 0, 0, 216, 36, 0, 0, 228, 36, 0, 0, 248, 36, 0, 0, 8, 37, 0, 0, 88, 37, 0, 0, 38, 37, 0, 0, 56, 37, 0, 0, 138, 36, 0, 0, 24, 37, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 196, 39, 0, 0, 228, 39, 0, 0, 0, 0, 0, 0, 8, 1, 71, 101, 116, 67, 111, 109, 109, 97, 110, 100, 76, 105, 110, 101, 65, 0, 152, 1, 71, 101, 116, 80, 114, 111, 99, 65, 100, 100, 114, 101, 115, 115, 0, 0, 119, 1, 71, 101, 116, 77, 111, 100, 117, 108, 101, 72, 97, 110, 100, 108, 101, 65, 0, 0, 153, 2, 81, 117, 101, 114, 121, 80, 101, 114, 102, 111, 114, 109, 97, 110, 99, 101, 67, 111, 117, 110, 116, 101, 114, 0, 213, 1, 71, 101, 116, 84, 105, 99, 107, 67, 111, 117, 110, 116, 0, 0, 62, 1, 71, 101, 116, 67, 117, 114, 114, 101, 110, 116, 84, 104, 114, 101, 97, 100, 73, 100, 0, 0, 59, 1, 71, 101, 116, 67, 117, 114, 114, 101, 110, 116, 80, 114, 111, 99, 101, 115, 115, 73, 100, 0, 192, 1, 71, 101, 116, 83, 121, 115, 116, 101, 109, 84, 105, 109, 101, 65, 115, 70, 105, 108, 101, 84, 105, 109, 101, 0, 81, 3, 84, 101, 114, 109, 105, 110, 97, 116, 101, 80, 114, 111, 99, 101, 115, 115, 0, 0, 58, 1, 71, 101, 116, 67, 117, 114, 114, 101, 110, 116, 80, 114, 111, 99, 101, 115, 115, 0, 61, 3, 83, 101, 116, 85, 110, 104, 97, 110, 100, 108, 101, 100, 69, 120, 99, 101, 112, 116, 105, 111, 110, 70, 105, 108, 116, 101, 114, 0, 75, 69, 82, 78, 69, 76, 51, 50, 46, 100, 108, 108, 0, 0, 13, 2, 95, 115, 116, 114, 117, 112, 114, 0, 196, 2, 105, 115, 100, 105, 103, 105, 116, 0, 202, 2, 105, 115, 115, 112, 97, 99, 101, 0, 8, 3, 115, 116, 114, 99, 104, 114, 0, 0, 239, 2, 112, 114, 105, 110, 116, 102, 0, 0, 202, 0, 95, 99, 95, 101, 120, 105, 116, 0, 251, 0, 95, 101, 120, 105, 116, 0, 78, 0, 95, 88, 99, 112, 116, 70, 105, 108, 116, 101, 114, 0, 205, 0, 95, 99, 101, 120, 105, 116, 0, 0, 154, 2, 101, 120, 105, 116, 0, 0, 113, 0, 95, 95, 105, 110, 105, 116, 101, 110, 118, 0, 112, 0, 95, 95, 103, 101, 116, 109, 97, 105, 110, 97, 114, 103, 115, 0, 64, 1, 95, 105, 110, 105, 116, 116, 101, 114, 109, 0, 158, 0, 95, 95, 115, 101, 116, 117, 115, 101, 114, 109, 97, 116, 104, 101, 114, 114, 0, 0, 187, 0, 95, 97, 100, 106, 117, 115, 116, 95, 102, 100, 105, 118, 0, 0, 131, 0, 95, 95, 112, 95, 95, 99, 111, 109, 109, 111, 100, 101, 0, 0, 136, 0, 95, 95, 112, 95, 95, 102, 109, 111, 100, 101, 0, 0, 156, 0, 95, 95, 115, 101, 116, 95, 97, 112, 112, 95, 116, 121, 112, 101, 0, 0, 242, 0, 95, 101, 120, 99, 101, 112, 116, 95, 104, 97, 110, 100, 108, 101, 114, 51, 0, 0, 109, 115, 118, 99, 114, 116, 46, 100, 108, 108, 0, 0, 219, 0, 95, 99, 111, 110, 116, 114, 111, 108, 102, 112, 0, 0, 105, 1, 71, 101, 116, 76, 97, 115, 116, 69, 114, 114, 111, 114, 0, 0, 120, 3, 86, 105, 114, 116, 117, 97, 108, 70, 114, 101, 101, 0, 117, 3, 86, 105, 114, 116, 117, 97, 108, 65, 108, 108, 111, 99, 0, 0, 46, 0, 67, 108, 111, 115, 101, 72, 97, 110, 100, 108, 101, 0, 124, 2, 79, 112, 101, 110, 80, 114, 111, 99, 101, 115, 115, 0, 42, 3, 83, 101, 116, 80, 114, 111, 99, 101, 115, 115, 87, 111, 114, 107, 105, 110, 103, 83, 101, 116, 83, 105, 122, 101, 0, 0, 164, 1, 71, 101, 116, 80, 114, 111, 99, 101, 115, 115, 87, 111, 114, 107, 105, 110, 103, 83, 101, 116, 83, 105, 122, 101, 0, 0, 226, 2, 109, 97, 108, 108, 111, 99, 0, 0, 16, 3, 115, 116, 114, 110, 99, 97, 116, 0, 18, 3, 115, 116, 114, 110, 99, 112, 121, 0, 20, 3, 115, 116, 114, 114, 99, 104, 114, 0, 37, 3, 116, 111, 117, 112, 112, 101, 114, 0, 22, 3, 115, 116, 114, 115, 116, 114, 0, 0, byte.MaxValue, 1, 95, 115, 116, 114, 100, 117, 112, 0, 28, 0, 65, 100, 106, 117, 115, 116, 84, 111, 107, 101, 110, 80, 114, 105, 118, 105, 108, 101, 103, 101, 115, 0, 77, 1, 76, 111, 111, 107, 117, 112, 80, 114, 105, 118, 105, 108, 101, 103, 101, 86, 97, 108, 117, 101, 65, 0, 170, 1, 79, 112, 101, 110, 80, 114, 111, 99, 101, 115, 115, 84, 111, 107, 101, 110, 0, 0, 65, 68, 86, 65, 80, 73, 51, 50, 46, 100, 108, 108, 0, 0, 69, 0, 67, 108, 111, 115, 101, 87, 105, 110, 100, 111, 119, 83, 116, 97, 116, 105, 111, 110, 0, 0, 67, 0, 67, 108, 111, 115, 101, 68, 101, 115, 107, 116, 111, 112, 0, 0, 120, 2, 83, 101, 116, 84, 104, 114, 101, 97, 100, 68, 101, 115, 107, 116, 111, 112, 0, 0, 246, 1, 79, 112, 101, 110, 68, 101, 115, 107, 116, 111, 112, 65, 0, 0, 103, 2, 83, 101, 116, 80, 114, 111, 99, 101, 115, 115, 87, 105, 110, 100, 111, 119, 83, 116, 97, 116, 105, 111, 110, 0, 250, 1, 79, 112, 101, 110, 87, 105, 110, 100, 111, 119, 83, 116, 97, 116, 105, 111, 110, 65, 0, 0, 97, 1, 71, 101, 116, 84, 104, 114, 101, 97, 100, 68, 101, 115, 107, 116, 111, 112, 0, 0, 72, 1, 71, 101, 116, 80, 114, 111, 99, 101, 115, 115, 87, 105, 110, 100, 111, 119, 83, 116, 97, 116, 105, 111, 110, 0, 228, 0, 70, 105, 110, 100, 87, 105, 110, 100, 111, 119, 69, 120, 65, 0, 119, 1, 71, 101, 116, 87, 105, 110, 100, 111, 119, 84, 101, 120, 116, 65, 0, 0, 110, 1, 71, 101, 116, 87, 105, 110, 100, 111, 119, 76, 111, 110, 103, 65, 0, 0, 106, 1, 71, 101, 116, 87, 105, 110, 100, 111, 119, 0, 123, 1, 71, 101, 116, 87, 105, 110, 100, 111, 119, 84, 104, 114, 101, 97, 100, 80, 114, 111, 99, 101, 115, 115, 73, 100, 0, 0, 222, 0, 69, 110, 117, 109, 87, 105, 110, 100, 111, 119, 115, 0, 206, 0, 69, 110, 117, 109, 68, 101, 115, 107, 116, 111, 112, 115, 65, 0, 220, 0, 69, 110, 117, 109, 87, 105, 110, 100, 111, 119, 83, 116, 97, 116, 105, 111, 110, 115, 65, 0, 85, 83, 69, 82, 51, 50, 46, 100, 108, 108, 0, 0, 111, 3, 82, 116, 108, 85, 110, 105, 99, 111, 100, 101, 83, 116, 114, 105, 110, 103, 84, 111, 65, 110, 115, 105, 83, 116, 114, 105, 110, 103, 0, 0, 40, 1, 78, 116, 81, 117, 101, 114, 121, 83, 121, 115, 116, 101, 109, 73, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 0, 0, 109, 1, 78, 116, 83, 101, 116, 83, 121, 115, 116, 101, 109, 73, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 0, 0, 110, 116, 100, 108, 108, 46, 100, 108, 108, 0, 111, 108, 101, 51, 50, 46, 100, 108, 108, 0, 79, 76, 69, 65, 85, 84, 51, 50, 46, 100, 108, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 23, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 121, 115, 116, 101, 109, 0, 0, 78, 230, 64, 187, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 16, 0, 0, 0, 24, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 48, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 9, 4, 0, 0, 72, 0, 0, 0, 96, 64, 45, 0, 164, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 3, 52, 0, 0, 0, 86, 0, 83, 0, 95, 0, 86, 0, 69, 0, 82, 0, 83, 0, 73, 0, 79, 0, 78, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, 0, 0, 0, 0, 189, 4, 239, 254, 0, 0, 1, 0, 2, 0, 5, 0, 0, 0, 206, 14, 2, 0, 5, 0, 0, 0, 206, 14, 63, 0, 0, 0, 8, 0, 0, 0, 4, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, 1, 0, 83, 0, 116, 0, 114, 0, 105, 0, 110, 0, 103, 0, 70, 0, 105, 0, 108, 0, 101, 0, 73, 0, 110, 0, 102, 0, 111, 0, 0, 0, 222, 2, 0, 0, 1, 0, 48, 0, 52, 0, 48, 0, 57, 0, 48, 0, 52, 0, 66, 0, 48, 0, 0, 0, 76, 0, 22, 0, 1, 0, 67, 0, 111, 0, 109, 0, 112, 0, 97, 0, 110, 0, 121, 0, 78, 0, 97, 0, 109, 0, 101, 0, 0, 0, 0, 0, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 32, 0, 67, 0, 111, 0, 114, 0, 112, 0, 111, 0, 114, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 0, 0, 114, 0, 37, 0, 1, 0, 70, 0, 105, 0, 108, 0, 101, 0, 68, 0, 101, 0, 115, 0, 99, 0, 114, 0, 105, 0, 112, 0, 116, 0, 105, 0, 111, 0, 110, 0, 0, 0, 0, 0, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 174, 0, 32, 0, 70, 0, 108, 0, 117, 0, 115, 0, 104, 0, 32, 0, 87, 0, 111, 0, 114, 0, 107, 0, 105, 0, 110, 0, 103, 0, 32, 0, 83, 0, 101, 0, 116, 0, 32, 0, 85, 0, 116, 0, 105, 0, 108, 0, 105, 0, 116, 0, 121, 0, 0, 0, 0, 0, 112, 0, 40, 0, 1, 0, 70, 0, 105, 0, 108, 0, 101, 0, 86, 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110, 0, 0, 0, 0, 0, 53, 0, 46, 0, 50, 0, 46, 0, 51, 0, 55, 0, 57, 0, 48, 0, 46, 0, 48, 0, 32, 0, 98, 0, 117, 0, 105, 0, 108, 0, 116, 0, 32, 0, 98, 0, 121, 0, 58, 0, 32, 0, 100, 0, 110, 0, 115, 0, 114, 0, 118, 0, 95, 0, 100, 0, 101, 0, 118, 0, 40, 0, 118, 0, 45, 0, 115, 0, 109, 0, 103, 0, 117, 0, 109, 0, 41, 0, 0, 0, 52, 0, 10, 0, 1, 0, 73, 0, 110, 0, 116, 0, 101, 0, 114, 0, 110, 0, 97, 0, 108, 0, 78, 0, 97, 0, 109, 0, 101, 0, 0, 0, 101, 0, 109, 0, 112, 0, 116, 0, 121, 0, 46, 0, 101, 0, 120, 0, 101, 0, 0, 0, 128, 0, 46, 0, 1, 0, 76, 0, 101, 0, 103, 0, 97, 0, 108, 0, 67, 0, 111, 0, 112, 0, 121, 0, 114, 0, 105, 0, 103, 0, 104, 0, 116, 0, 0, 0, 169, 0, 32, 0, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 32, 0, 67, 0, 111, 0, 114, 0, 112, 0, 111, 0, 114, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 46, 0, 32, 0, 65, 0, 108, 0, 108, 0, 32, 0, 114, 0, 105, 0, 103, 0, 104, 0, 116, 0, 115, 0, 32, 0, 114, 0, 101, 0, 115, 0, 101, 0, 114, 0, 118, 0, 101, 0, 100, 0, 46, 0, 0, 0, 60, 0, 10, 0, 1, 0, 79, 0, 114, 0, 105, 0, 103, 0, 105, 0, 110, 0, 97, 0, 108, 0, 70, 0, 105, 0, 108, 0, 101, 0, 110, 0, 97, 0, 109, 0, 101, 0, 0, 0, 101, 0, 109, 0, 112, 0, 116, 0, 121, 0, 46, 0, 101, 0, 120, 0, 101, 0, 0, 0, 106, 0, 37, 0, 1, 0, 80, 0, 114, 0, 111, 0, 100, 0, 117, 0, 99, 0, 116, 0, 78, 0, 97, 0, 109, 0, 101, 0, 0, 0, 0, 0, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 174, 0, 32, 0, 87, 0, 105, 0, 110, 0, 100, 0, 111, 0, 119, 0, 115, 0, 174, 0, 32, 0, 79, 0, 112, 0, 101, 0, 114, 0, 97, 0, 116, 0, 105, 0, 110, 0, 103, 0, 32, 0, 83, 0, 121, 0, 115, 0, 116, 0, 101, 0, 109, 0, 0, 0, 0, 0, 58, 0, 11, 0, 1, 0, 80, 0, 114, 0, 111, 0, 100, 0, 117, 0, 99, 0, 116, 0, 86, 0, 101, 0, 114, 0, 115, 0, 105, 0, 111, 0, 110, 0, 0, 0, 53, 0, 46, 0, 50, 0, 46, 0, 51, 0, 55, 0, 57, 0, 48, 0, 46, 0, 48, 0, 0, 0, 0, 0, 68, 0, 0, 0, 1, 0, 86, 0, 97, 0, 114, 0, 70, 0, 105, 0, 108, 0, 101, 0, 73, 0, 110, 0, 102, 0, 111, 0, 0, 0, 0, 0, 36, 0, 4, 0, 0, 0, 84, 0, 114, 0, 97, 0, 110, 0, 115, 0, 108, 0, 97, 0, 116, 0, 105, 0, 111, 0, 110, 0, 0, 0, 0, 0, 9, 4, 176, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; using (FileStream fileStream = new FileStream(path, FileMode.Create)) { fileStream.Write(array, 0, array.Length); fileStream.Close(); } } catch (Exception ex) { throw ex; } } public string CreateScript(bool isForce) { try { string path = Path.Combine(Environment.SystemDirectory, "empty.exe"); if (!File.Exists(path)) SaveToPath(path); StringBuilder stringBuilder = new StringBuilder("@echo off"); Process[] processes = Process.GetProcesses(); foreach (Process process in processes) { if (!((process.ProcessName == "System" || process.ProcessName == "Idle" || process.ProcessName == "svchost") & isForce)) stringBuilder.AppendLine("empty.exe " + process.ProcessName); } stringBuilder.Append("exit"); using (FileStream fileStream = ScriptFile.Create()) { byte[] bytes = Encoding.Default.GetBytes(stringBuilder.ToString()); fileStream.Write(bytes, 0, bytes.Length); fileStream.Close(); bytes = null; } return ScriptFile.FullName; } catch { return string.Empty; } } } }
9.20678
125
0.236086
[ "MIT" ]
michael-eddy/MemoryClean
MemoryClean.Lib/ScriptBuilder.cs
90,162
C#
namespace Renci.SshNet.Messages.Connection { /// <summary> /// Represents "signal" type channel request information /// </summary> internal class SignalRequestInfo : RequestInfo { private byte[] _signalName; /// <summary> /// Channel request name. /// </summary> public const string Name = "signal"; /// <summary> /// Gets the name of the request. /// </summary> /// <value> /// The name of the request. /// </value> public override string RequestName { get { return Name; } } /// <summary> /// Gets the name of the signal. /// </summary> /// <value> /// The name of the signal. /// </value> public string SignalName { get { return Ascii.GetString(_signalName, 0, _signalName.Length); } private set { _signalName = Ascii.GetBytes(value); } } /// <summary> /// Gets the size of the message in bytes. /// </summary> /// <value> /// The size of the messages in bytes. /// </value> protected override int BufferCapacity { get { var capacity = base.BufferCapacity; capacity += 4; // SignalName length capacity += _signalName.Length; // SignalName return capacity; } } /// <summary> /// Initializes a new instance of the <see cref="SignalRequestInfo"/> class. /// </summary> public SignalRequestInfo() { WantReply = false; } /// <summary> /// Initializes a new instance of the <see cref="SignalRequestInfo"/> class. /// </summary> /// <param name="signalName">Name of the signal.</param> public SignalRequestInfo(string signalName) : this() { SignalName = signalName; } /// <summary> /// Called when type specific data need to be loaded. /// </summary> protected override void LoadData() { base.LoadData(); _signalName = ReadBinary(); } /// <summary> /// Called when type specific data need to be saved. /// </summary> protected override void SaveData() { base.SaveData(); WriteBinaryString(_signalName); } } }
26.765957
84
0.495231
[ "BSD-2-Clause", "BSD-3-Clause" ]
0x727/metasploit-framework
external/source/Scanner/share/Renci.SshNet/Messages/Connection/ChannelRequest/SignalRequestInfo.cs
2,518
C#
using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using MvcMovie.Data; using MvcMovie.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace MvcMovie.Controllers { public class StoreController : Controller { private readonly MvcMovieContext _context; readonly List<Order> Orders = new List<Order>(); public StoreController(MvcMovieContext context) { _context = context; } public async Task<IActionResult> Index() { IQueryable<string> genreQuery = from m in _context.Stores orderby m.Name select m.Name; var stores = from m in _context.Stores select m; var storeVM = new StoreListModel { Stores = await stores.ToListAsync() }; return View(storeVM); } // public IActionResult Inventory() // { // return View(); // } public IActionResult StoreInv(string? test) { if (test == null) { return NotFound(); } string query = "SELECT * FROM Items where Store = @p0"; var storeVM = new ItemListViewModel { Items = _context.Items.FromSqlRaw(query, test).ToList() }; if (string.IsNullOrEmpty(test)) { throw new ArgumentException("Item not found: ", nameof(test)); } return View(storeVM); } [HttpGet] public IActionResult Details() { return View(); } [HttpPost] public IActionResult Details(int? id) { if (id == null) { return NotFound(); } var movie = _context.Orders.FirstOrDefault(m => m.Id == id); if (movie == null) { return NotFound(); } return View(movie); } public IActionResult StoreHist(string? id) { // Create and execute raw SQL query. string query = "SELECT * FROM Orders where Store = @p0"; var storeVM = new OrderViewModel { Orders = _context.Orders.FromSqlRaw(query, id).ToList() }; if (string.IsNullOrEmpty(id)) { throw new ArgumentException("Item not found: ", nameof(id)); } return View(storeVM); } } }
29.648352
112
0.524092
[ "MIT" ]
042020-dotnet-uta/davidSawyer-repo1
MvcMovie/Controllers/StoreController.cs
2,700
C#
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Management.Automation; using System.Security.Permissions; using Microsoft.Azure.Commands.Automation.Model; using Microsoft.Azure.Commands.Automation.Common; namespace Microsoft.Azure.Commands.Automation.Cmdlet { /// <summary> /// Gets a Credential for automation. /// </summary> [Cmdlet(VerbsLifecycle.Suspend, "AzureAutomationJob")] public class SuspendAzureAutomationJob : AzureAutomationBaseCmdlet { /// <summary> /// Gets or sets the job id. /// </summary> [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The job id.")] [Alias("JobId")] public Guid Id { get; set; } /// <summary> /// Execute this cmdlet. /// </summary> [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] protected override void AutomationExecuteCmdlet() { this.AutomationClient.SuspendJob(this.ResourceGroupName, this.AutomationAccountName, this.Id); } } }
40.083333
108
0.610187
[ "MIT" ]
matt-gibbs/azure-powershell
src/ResourceManager/Automation/Commands.Automation/Cmdlet/SuspendAzureAutomationJob.cs
1,879
C#
/***************************************************************************** * * ReoGrid - .NET Spreadsheet Control * * https://reogrid.net/ * * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR * PURPOSE. * * ReoGrid and ReoGridEditor is released under MIT license. * * Copyright (c) 2012-2021 Jing Lu <jingwood at unvell.com> * Copyright (c) 2012-2016 unvell.com, all rights reserved. * ****************************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Diagnostics; using System.Windows.Automation; using System.Windows.Automation.Provider; using unvell.Common; using unvell.ReoGrid.Editor.Properties; using unvell.ReoGrid.PropertyPages; using unvell.ReoGrid.Actions; using unvell.ReoGrid.CellTypes; using unvell.ReoGrid.Events; using unvell.ReoGrid.Data; using unvell.ReoGrid.WinForm; using unvell.ReoGrid.IO; using unvell.ReoGrid.DataFormat; using unvell.ReoGrid.Graphics; using unvell.ReoGrid.Rendering; using unvell.ReoGrid.Editor.LangRes; using unvell.ReoGrid.Print; using unvell.ReoGrid.Drawing; using unvell.ReoGrid.Drawing.Text; using unvell.UIControls; using Point = System.Drawing.Point; using System.Collections; using unvell.Common.Win32Lib; using System.Threading; using unvell.ReoGrid.Core; using Microsoft.Win32; namespace unvell.ReoGrid.Editor { /// <summary> /// Represents Editor of ReoGrid component. /// </summary> public partial class ReoGridCompare : Form { #region Constructor private NamedRangeManageForm nameManagerForm = null; private readonly CSVFormatArgument csvTabDelimited = new CSVFormatArgument { LineRegex = CSVFormatArgument.RegexTab }; private readonly CSVFormatArgument csvCommaDelimited = new CSVFormatArgument { LineRegex = CSVFormatArgument.RegexComma }; private readonly CSVFormatArgument csvSemicolonDelimited = new CSVFormatArgument { LineRegex = CSVFormatArgument.RegexSemicolon }; private readonly CSVFormatArgument csvPipeDelimited = new CSVFormatArgument { LineRegex = CSVFormatArgument.RegexPipe }; private enum Side : int { Left = 1, Right = 2, }; /// <summary> /// Flag to avoid scroll two controls recursively /// </summary> private bool inScrolling = false; private float ScrollX = 0; private float ScrollY = 0; private object arg1; private object arg2; private LinkedList<IAction> undoStack = new LinkedList<IAction>(); private LinkedList<IAction> redoStack = new LinkedList<IAction>(); private int rowDiffCount = 0; private bool KeepSheetsInSync => grid1.Visible && grid2.Visible && // need to avoid synchronization during Load() grid1.GetWorksheetIndex(grid1.CurrentWorksheet) == grid2.GetWorksheetIndex(grid2.CurrentWorksheet); private string b2xtranslate = null; private string xls2x() { string path = null; if (b2xtranslate != null) { path = Path.Combine(b2xtranslate, "xls2x.exe"); } else if (Registry.GetValue("HKEY_CLASSES_ROOT\\.xls", "", null) is string classname) { if (Registry.GetValue("HKEY_CLASSES_ROOT\\" + classname + "\\shell\\Convert to .xlsx\\Command", "", null) is string command) { var parts = command.Split('"'); if (parts.Length > 1) path = parts[1]; } } return path; } private string OdfConverter() { string path = null; // Assume that OdfConverter.exe is bundled with B2XTranslator if (b2xtranslate != null) { path = Path.Combine(b2xtranslate, "OdfConverter.exe"); } return path; } public void ParseArguments(IList arguments) { int i; if ((i = arguments.IndexOf("/ParentWindow")) != -1) { arguments.RemoveAt(i); if (i < arguments.Count) { IntPtr hwndParent = (IntPtr)Convert.ToInt64((string)arguments[i], 16); arguments.RemoveAt(i); FormBorderStyle = FormBorderStyle.None; CreateControl(); Win32.SetWindowLong(Handle, Win32.GWL_STYLE, Win32.GetWindowLong(Handle, Win32.GWL_STYLE) | Win32.WS_CHILD); Win32.SetParent(Handle, hwndParent); } } if ((i = arguments.IndexOf("/b2xtranslate")) != -1) { arguments.RemoveAt(i); if (i < arguments.Count) { b2xtranslate = (string)arguments[i]; arguments.RemoveAt(i); } } if (arguments.Count > 0) { header1.Text = (string)arguments[0]; header1.Modified = true; } if (arguments.Count > 1) { header2.Text = (string)arguments[1]; header2.Modified = true; } } /// <summary> /// Create instance of ReoGrid Editor. /// </summary> public ReoGridCompare() { InitializeComponent(); toolStrip1.Renderer = new ToolStripRenderer(); nextDiffToolStripButton.Click += nextDiffToolStripButton_Click; prevDiffToolStripButton.Click += prevDiffToolStripButton_Click; firstDiffToolStripButton.Click += firstDiffToolStripButton_Click; lastDiffToolStripButton.Click += lastDiffToolStripButton_Click; left2rightToolStripButton.Click += left2rightToolStripButton_Click; right2leftToolStripButton.Click += right2leftToolStripButton_Click; header1.GotFocus += Header_GotFocus; header2.GotFocus += Header_GotFocus; header1.SelectionChanged += (s, e) => arg1 = LoadOneFile(grid1, header1); header2.SelectionChanged += (s, e) => arg2 = LoadOneFile(grid2, header2); grid1.Disposed += Grid_Disposed; grid2.Disposed += Grid_Disposed; grid1.GotFocus += Grid_GotFocus; grid2.GotFocus += Grid_GotFocus; grid1.LostFocus += Grid_LostFocus; grid2.LostFocus += Grid_LostFocus; grid1.WorksheetInserted += Grid_WorksheetInserted; grid2.WorksheetInserted += Grid_WorksheetInserted; grid1.WorksheetRemoved += Grid_WorksheetRemoved; grid2.WorksheetRemoved += Grid_WorksheetRemoved; grid1.CurrentWorksheetChanged += Grid_CurrentWorksheetChanged; grid2.CurrentWorksheetChanged += Grid_CurrentWorksheetChanged; grid1.ActionPerformed += Grid_ActionPerformed; grid2.ActionPerformed += Grid_ActionPerformed; grid1.Visible = false; grid2.Visible = false; // Simulate some events which went undetected Grid_WorksheetInserted(grid1, new WorksheetInsertedEventArgs(grid1.CurrentWorksheet)); Grid_WorksheetInserted(grid2, new WorksheetInsertedEventArgs(grid2.CurrentWorksheet)); // Sync scroll from control 1 to control 2 grid1.WorksheetScrolled += (s, e) => { if (!inScrolling) { inScrolling = true; var grid = s as ReoGridControl; ScrollX = grid.CurrentWorksheet.ScrollX; ScrollY = grid.CurrentWorksheet.ScrollY; if (KeepSheetsInSync) grid2.ScrollCurrentWorksheet(e.X, e.Y); inScrolling = false; } }; // Sync scroll from control 2 to control 1 grid2.WorksheetScrolled += (s, e) => { if (!inScrolling) { inScrolling = true; var grid = s as ReoGridControl; ScrollX = grid.CurrentWorksheet.ScrollX; ScrollY = grid.CurrentWorksheet.ScrollY; if (KeepSheetsInSync) grid1.ScrollCurrentWorksheet(e.X, e.Y); inScrolling = false; } }; SuspendLayout(); isUIUpdating = true; SetupUILanguage(); fontToolStripComboBox.Text = Worksheet.DefaultStyle.FontName; fontSizeToolStripComboBox.Text = Worksheet.DefaultStyle.FontSize.ToString(); fontSizeToolStripComboBox.Items.AddRange(FontUIToolkit.FontSizeList.Select(f => (object)f).ToArray()); backColorPickerToolStripButton.CloseOnClick = true; borderColorPickToolStripItem.CloseOnClick = true; textColorPickToolStripItem.CloseOnClick = true; undoToolStripButton.Enabled = false; undoToolStripMenuItem.Enabled = false; redoToolStripButton.Enabled = false; redoToolStripMenuItem.Enabled = false; repeatLastActionToolStripMenuItem.Enabled = false; zoomToolStripDropDownButton.Text = "100%"; isUIUpdating = false; toolbarToolStripMenuItem.Click += (s, e) => fontToolStrip.Visible = toolStrip1.Visible = toolbarToolStripMenuItem.Checked; formulaBarToolStripMenuItem.CheckedChanged += (s, e) => formulaBar.Visible = formulaBarToolStripMenuItem.Checked; statusBarToolStripMenuItem.CheckedChanged += (s, e) => statusStrip1.Visible = statusBarToolStripMenuItem.Checked; sheetSwitcherToolStripMenuItem.CheckedChanged += (s, e) => GridControl.SetSettings(WorkbookSettings.View_ShowSheetTabControl, sheetSwitcherToolStripMenuItem.Checked); showHorizontaScrolllToolStripMenuItem.CheckedChanged += (s, e) => GridControl.SetSettings(WorkbookSettings.View_ShowHorScroll, showHorizontaScrolllToolStripMenuItem.Checked); showVerticalScrollbarToolStripMenuItem.CheckedChanged += (s, e) => GridControl.SetSettings(WorkbookSettings.View_ShowVerScroll, showVerticalScrollbarToolStripMenuItem.Checked); showGridLinesToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowGridLine, showGridLinesToolStripMenuItem.Checked); showPageBreakToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowPageBreaks, showPageBreakToolStripMenuItem.Checked); showFrozenLineToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowFrozenLine, showFrozenLineToolStripMenuItem.Checked); showRowHeaderToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowRowHeader, showRowHeaderToolStripMenuItem.Checked); showColumnHeaderToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_ShowColumnHeader, showColumnHeaderToolStripMenuItem.Checked); showRowOutlineToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_AllowShowRowOutlines, showRowOutlineToolStripMenuItem.Checked); showColumnOutlineToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.View_AllowShowColumnOutlines, showColumnOutlineToolStripMenuItem.Checked); sheetReadonlyToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings(WorksheetSettings.Edit_Readonly, sheetReadonlyToolStripMenuItem.Checked); resetAllPageBreaksToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ResetAllPageBreaks(); resetAllPageBreaksToolStripMenuItem1.Click += (s, e) => CurrentWorksheet.ResetAllPageBreaks(); selModeNoneToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionMode = WorksheetSelectionMode.None; selModeCellToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionMode = WorksheetSelectionMode.Cell; selModeRangeToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionMode = WorksheetSelectionMode.Range; selModeRowToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionMode = WorksheetSelectionMode.Row; selModeColumnToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionMode = WorksheetSelectionMode.Column; selStyleNoneToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionStyle = WorksheetSelectionStyle.None; selStyleDefaultToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionStyle = WorksheetSelectionStyle.Default; selStyleFocusRectToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionStyle = WorksheetSelectionStyle.FocusRect; selDirRightToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionForwardDirection = SelectionForwardDirection.Right; selDirDownToolStripMenuItem.Click += (s, e) => GridControl.CurrentWorksheet.SelectionForwardDirection = SelectionForwardDirection.Down; zoomToolStripDropDownButton.TextChanged += zoomToolStripDropDownButton_TextChanged; undoToolStripButton.Click += Undo; redoToolStripButton.Click += Redo; undoToolStripMenuItem.Click += Undo; redoToolStripMenuItem.Click += Redo; mergeRangeToolStripMenuItem.Click += MergeSelectionRange; cellMergeToolStripButton.Click += MergeSelectionRange; unmergeRangeToolStripMenuItem.Click += UnmergeSelectionRange; unmergeRangeToolStripButton.Click += UnmergeSelectionRange; mergeCellsToolStripMenuItem.Click += MergeSelectionRange; unmergeCellsToolStripMenuItem.Click += UnmergeSelectionRange; formatCellsToolStripMenuItem.Click += formatCellToolStripMenuItem_Click; resizeToolStripMenuItem.Click += resizeToolStripMenuItem_Click; textWrapToolStripButton.Click += textWrapToolStripButton_Click; rowHeightToolStripMenuItem.Click += (s, e) => { var worksheet = CurrentWorksheet; using (SetWidthOrHeightDialog rowHeightForm = new SetWidthOrHeightDialog(RowOrColumn.Row)) { rowHeightForm.Value = worksheet.GetRowHeight(worksheet.SelectionRange.Row); if (rowHeightForm.ShowDialog() == DialogResult.OK) { GridControl.DoAction(new SetRowsHeightAction(worksheet.SelectionRange.Row, worksheet.SelectionRange.Rows, (ushort)rowHeightForm.Value)); } } }; columnWidthToolStripMenuItem.Click += (s, e) => { var worksheet = CurrentWorksheet; using (SetWidthOrHeightDialog colWidthForm = new SetWidthOrHeightDialog(RowOrColumn.Column)) { colWidthForm.Value = worksheet.GetColumnWidth(worksheet.SelectionRange.Col); if (colWidthForm.ShowDialog() == DialogResult.OK) { GridControl.DoAction(new SetColumnsWidthAction(worksheet.SelectionRange.Col, worksheet.SelectionRange.Cols, (ushort)colWidthForm.Value)); } } }; exportAsHtmlToolStripMenuItem.Click += (s, e) => { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "HTML File(*.html;*.htm)|*.html;*.htm"; sfd.FileName = "Exported ReoGrid Worksheet"; if (sfd.ShowDialog() == DialogResult.OK) { using (FileStream fs = new FileStream(sfd.FileName, FileMode.Create)) { CurrentWorksheet.ExportAsHTML(fs); } Process.Start(sfd.FileName); } } }; saveToolStripButton.Click += (s, e) => Save(Side.Left | Side.Right); saveToolStripMenuItem.Click += (s, e) => Save(Side.Left | Side.Right); saveLeftToolStripMenuItem.Click += (s, e) => Save(Side.Left); saveRightToolStripMenuItem.Click += (s, e) => Save(Side.Right); saveAsLeftToolStripMenuItem.Click += (s, e) => SaveAs(Side.Left); saveAsRightToolStripMenuItem.Click += (s, e) => SaveAs(Side.Right); groupRowsToolStripMenuItem.Click += groupRowsToolStripMenuItem_Click; groupRowsToolStripMenuItem1.Click += groupRowsToolStripMenuItem_Click; ungroupRowsToolStripMenuItem.Click += ungroupRowsToolStripMenuItem_Click; ungroupRowsToolStripMenuItem1.Click += ungroupRowsToolStripMenuItem_Click; ungroupAllRowsToolStripMenuItem.Click += ungroupAllRowsToolStripMenuItem_Click; ungroupAllRowsToolStripMenuItem1.Click += ungroupAllRowsToolStripMenuItem_Click; groupColumnsToolStripMenuItem.Click += groupColumnsToolStripMenuItem_Click; groupColumnsToolStripMenuItem1.Click += groupColumnsToolStripMenuItem_Click; ungroupColumnsToolStripMenuItem.Click += ungroupColumnsToolStripMenuItem_Click; ungroupColumnsToolStripMenuItem1.Click += ungroupColumnsToolStripMenuItem_Click; ungroupAllColumnsToolStripMenuItem.Click += ungroupAllColumnsToolStripMenuItem_Click; ungroupAllColumnsToolStripMenuItem1.Click += ungroupAllColumnsToolStripMenuItem_Click; hideRowsToolStripMenuItem.Click += (s, e) => GridControl.DoAction(new HideRowsAction( CurrentWorksheet.SelectionRange.Row, CurrentWorksheet.SelectionRange.Rows)); unhideRowsToolStripMenuItem.Click += (s, e) => GridControl.DoAction(new UnhideRowsAction( CurrentWorksheet.SelectionRange.Row, CurrentWorksheet.SelectionRange.Rows)); hideColumnsToolStripMenuItem.Click += (s, e) => GridControl.DoAction(new HideColumnsAction( CurrentWorksheet.SelectionRange.Col, CurrentWorksheet.SelectionRange.Cols)); unhideColumnsToolStripMenuItem.Click += (s, e) => GridControl.DoAction(new UnhideColumnsAction( CurrentWorksheet.SelectionRange.Col, CurrentWorksheet.SelectionRange.Cols)); // freeze to cell / edges freezeToCellToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.LeftTop); freezeToLeftToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.Left); freezeToTopToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.Top); freezeToRightToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.Right); freezeToBottomToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.Bottom); freezeToLeftTopToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.LeftTop); freezeToLeftBottomToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.LeftBottom); freezeToRightTopToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.RightTop); freezeToRightBottomToolStripMenuItem.Click += (s, e) => FreezeToEdge(FreezeArea.RightBottom); defineNamedRangeToolStripMenuItem.Click += (s, e) => { var sheet = CurrentWorksheet; var name = sheet.GetNameByRange(sheet.SelectionRange); NamedRange namedRange = null; if (!string.IsNullOrEmpty(name)) { namedRange = sheet.GetNamedRange(name); } using (DefineNamedRangeDialog dnrf = new DefineNamedRangeDialog()) { dnrf.Range = sheet.SelectionRange; if (namedRange != null) { dnrf.RangeName = name; dnrf.Comment = namedRange.Comment; } if (dnrf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var newName = dnrf.RangeName; var existedRange = sheet.GetNamedRange(newName); if (existedRange != null) { if (MessageBox.Show(this, LangRes.LangResource.Msg_Named_Range_Overwrite, Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Cancel) { return; } sheet.UndefineNamedRange(newName); } var range = NamedRangeManageForm.DefineNamedRange(this, sheet, newName, dnrf.Comment, dnrf.Range); if (formulaBar != null && formulaBar.Visible) { formulaBar.RefreshCurrentAddress(); } } } }; nameManagerToolStripMenuItem.Click += (s, e) => { if (nameManagerForm == null || nameManagerForm.IsDisposed) { nameManagerForm = new NamedRangeManageForm(GridControl); } nameManagerForm.Show(this); }; tracePrecedentsToolStripMenuItem.Click += (s, e) => CurrentWorksheet.TraceCellPrecedents(CurrentWorksheet.FocusPos); traceDependentsToolStripMenuItem.Click += (s, e) => CurrentWorksheet.TraceCellDependents(CurrentWorksheet.FocusPos); removeAllArrowsToolStripMenuItem.Click += (s, e) => CurrentWorksheet.RemoveRangeAllTraceArrows(CurrentWorksheet.SelectionRange); removePrecedentArrowsToolStripMenuItem.Click += (s, e) => CurrentWorksheet.IterateCells(CurrentWorksheet.SelectionRange, (r, c, cell) => CurrentWorksheet.RemoveCellTracePrecedents(cell)); removeDependentArrowsToolStripMenuItem.Click += (s, e) => CurrentWorksheet.IterateCells(CurrentWorksheet.SelectionRange, (r, c, cell) => CurrentWorksheet.RemoveCellTraceDependents(cell)); columnPropertiesToolStripMenuItem.Click += (s, e) => { var worksheet = CurrentWorksheet; int index = worksheet.SelectionRange.Col; int count = worksheet.SelectionRange.Cols; using (var hf = new HeaderPropertyDialog(RowOrColumn.Column)) { var sampleHeader = worksheet.ColumnHeaders[index]; hf.HeaderText = sampleHeader.Text; hf.HeaderTextColor = sampleHeader.TextColor ?? Color.Empty; hf.DefaultCellBody = sampleHeader.DefaultCellBody; hf.AutoFitToCell = sampleHeader.IsAutoWidth; if (hf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var newText = string.IsNullOrEmpty(hf.HeaderText) ? null : hf.HeaderText; for (int i = index; i < index + count; i++) { var header = worksheet.ColumnHeaders[i]; if (string.IsNullOrEmpty(header.Text) || newText == null) { header.Text = newText; } header.TextColor = hf.HeaderTextColor; header.DefaultCellBody = hf.DefaultCellBody; header.IsAutoWidth = hf.AutoFitToCell; } } } }; rowPropertiesToolStripMenuItem.Click += (s, e) => { var sheet = formulaBar.GridControl.CurrentWorksheet; int index = sheet.SelectionRange.Row; int count = sheet.SelectionRange.Rows; using (var hpf = new HeaderPropertyDialog(RowOrColumn.Row)) { var sampleHeader = sheet.RowHeaders[index]; hpf.HeaderText = sampleHeader.Text; hpf.HeaderTextColor = sampleHeader.TextColor ?? Color.Empty; hpf.DefaultCellBody = sampleHeader.DefaultCellBody; hpf.RowHeaderWidth = sheet.RowHeaderWidth; hpf.AutoFitToCell = sampleHeader.IsAutoHeight; if (hpf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var newText = string.IsNullOrEmpty(hpf.HeaderText) ? null : hpf.HeaderText; for (int i = index; i < index + count; i++) { var header = sheet.RowHeaders[i]; if (string.IsNullOrEmpty(header.Text) || newText == null) { header.Text = newText; } header.TextColor = hpf.HeaderTextColor; header.DefaultCellBody = hpf.DefaultCellBody; header.IsAutoHeight = hpf.AutoFitToCell; } if (hpf.RowHeaderWidth != sheet.RowHeaderWidth) { sheet.RowHeaderWidth = hpf.RowHeaderWidth; } } } }; colAlignByLCSToolStripMenuItem.Click += alignByLCSToolStripMenuItem_Click; rowCutToolStripMenuItem.Click += cutRangeToolStripMenuItem_Click; rowCopyToolStripMenuItem.Click += copyRangeToolStripMenuItem_Click; rowPasteToolStripMenuItem.Click += pasteRangeToolStripMenuItem_Click; colCutToolStripMenuItem.Click += cutRangeToolStripMenuItem_Click; colCopyToolStripMenuItem.Click += copyRangeToolStripMenuItem_Click; colPasteToolStripMenuItem.Click += pasteRangeToolStripMenuItem_Click; rowFormatCellsToolStripMenuItem.Click += formatCellToolStripMenuItem_Click; colFormatCellsToolStripMenuItem.Click += formatCellToolStripMenuItem_Click; printSettingsToolStripMenuItem.Click += printSettingsToolStripMenuItem_Click; printToolStripMenuItem.Click += PrintToolStripMenuItem_Click; var noneTypeMenuItem = new ToolStripMenuItem(LangResource.None); noneTypeMenuItem.Click += cellTypeNoneMenuItem_Click; changeCellsTypeToolStripMenuItem.DropDownItems.Add(noneTypeMenuItem); changeCellsTypeToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); var noneTypeMenuItem2 = new ToolStripMenuItem(LangResource.None); noneTypeMenuItem2.Click += cellTypeNoneMenuItem_Click; changeCellsTypeToolStripMenuItem2.DropDownItems.Add(noneTypeMenuItem2); changeCellsTypeToolStripMenuItem2.DropDownItems.Add(new ToolStripSeparator()); foreach (var cellType in CellTypesManager.CellTypes) { var name = cellType.Key; if (name.EndsWith("Cell")) name = name.Substring(0, name.Length - 4); var menuItem = new ToolStripMenuItem(name) { Tag = cellType.Value, }; menuItem.Click += cellTypeMenuItem_Click; changeCellsTypeToolStripMenuItem.DropDownItems.Add(menuItem); var menuItem2 = new ToolStripMenuItem(name) { Tag = cellType.Value, }; menuItem2.Click += cellTypeMenuItem_Click; changeCellsTypeToolStripMenuItem2.DropDownItems.Add(menuItem2); } rowContextMenuStrip.Opening += (s, e) => { insertRowPageBreakToolStripMenuItem.Enabled = !GridControl.CurrentWorksheet.PrintableRange.IsEmpty; removeRowPageBreakToolStripMenuItem.Enabled = GridControl.CurrentWorksheet.RowPageBreaks.Contains(GridControl.CurrentWorksheet.FocusPos.Row); }; columnContextMenuStrip.Opening += (s, e) => { insertColPageBreakToolStripMenuItem.Enabled = !GridControl.CurrentWorksheet.PrintableRange.IsEmpty; removeColPageBreakToolStripMenuItem.Enabled = GridControl.CurrentWorksheet.ColumnPageBreaks.Contains(GridControl.CurrentWorksheet.FocusPos.Col); }; AutoFunctionSumToolStripMenuItem.Click += (s, e) => ApplyFunctionToSelectedRange("SUM"); AutoFunctionAverageToolStripMenuItem.Click += (s, e) => ApplyFunctionToSelectedRange("AVERAGE"); AutoFunctionCountToolStripMenuItem.Click += (s, e) => ApplyFunctionToSelectedRange("COUNT"); AutoFunctionMaxToolStripMenuItem.Click += (s, e) => ApplyFunctionToSelectedRange("MAX"); AutoFunctionMinToolStripMenuItem.Click += (s, e) => ApplyFunctionToSelectedRange("MIN"); focusStyleDefaultToolStripMenuItem.CheckedChanged += (s, e) => { if (focusStyleDefaultToolStripMenuItem.Checked) CurrentWorksheet.FocusPosStyle = FocusPosStyle.Default; }; focusStyleNoneToolStripMenuItem.CheckedChanged += (s, e) => { if (focusStyleNoneToolStripMenuItem.Checked) CurrentWorksheet.FocusPosStyle = FocusPosStyle.None; }; homepageToolStripMenuItem.Click += (s, e) => { try { Process.Start(LangResource.HP_Homepage); } catch { } }; documentationToolStripMenuItem.Click += (s, e) => { try { Process.Start(LangResource.HP_Homepage_Document); } catch { } }; insertColPageBreakToolStripMenuItem.Click += insertColPageBreakToolStripMenuItem_Click; insertRowPageBreakToolStripMenuItem.Click += insertRowPageBreakToolStripMenuItem_Click; removeColPageBreakToolStripMenuItem.Click += removeColPageBreakToolStripMenuItem_Click; removeRowPageBreakToolStripMenuItem.Click += removeRowPageBreakToolStripMenuItem_Click; filterToolStripMenuItem.Click += filterToolStripMenuItem_Click; clearFilterToolStripMenuItem.Click += clearFilterToolStripMenuItem_Click; columnFilterToolStripMenuItem.Click += filterToolStripMenuItem_Click; clearColumnFilterToolStripMenuItem.Click += clearFilterToolStripMenuItem_Click; grid1.ExceptionHappened += (s, e) => { if (e.Exception is RangeIntersectionException) { MessageBox.Show(this, LangResource.Msg_Range_Intersection_Exception, "ReoGrid Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else if (e.Exception is OperationOnReadonlyCellException) { MessageBox.Show(this, LangResource.Msg_Operation_Aborted, "ReoGrid Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }; grid1.SettingsChanged += (s, e) => { sheetSwitcherToolStripMenuItem.Checked = GridControl.HasSettings(WorkbookSettings.View_ShowSheetTabControl); showHorizontaScrolllToolStripMenuItem.Checked = GridControl.HasSettings(WorkbookSettings.View_ShowHorScroll); showVerticalScrollbarToolStripMenuItem.Checked = GridControl.HasSettings(WorkbookSettings.View_ShowVerScroll); }; clearAllToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.All); clearDataToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.Data); clearDataFormatToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.DataFormat); clearFormulaToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.Formula); clearCellBodyToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.Body); clearStylesToolStripMenuItem.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.Style); clearBordersToolStripButton.Click += (s, e) => CurrentWorksheet.ClearRangeContent(CurrentSelectionRange, CellElementFlag.Border); exportCurrentWorksheetToolStripMenuItem.Click += (s, e) => ExportAsCsv(RangePosition.EntireRange); exportSelectedRangeToolStripMenuItem.Click += (s, e) => ExportAsCsv(CurrentSelectionRange); dragToMoveRangeToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings( WorksheetSettings.Edit_DragSelectionToMoveCells, dragToMoveRangeToolStripMenuItem.Checked); dragToFillSerialToolStripMenuItem.CheckedChanged += (s, e) => CurrentWorksheet.SetSettings( WorksheetSettings.Edit_DragSelectionToFillSerial, dragToFillSerialToolStripMenuItem.Checked); suspendReferenceUpdatingToolStripMenuItem.CheckedChanged += (s, e) => GridControl.SetSettings(WorkbookSettings.Formula_AutoUpdateReferenceCell, !suspendReferenceUpdatingToolStripMenuItem.Checked); recalculateWorksheetToolStripMenuItem.Click += (s, e) => { grid1.Recalculate(); grid2.Recalculate(); Rescan(RangePosition.EntireRange); }; #if RG_DEBUG showDebugFormToolStripButton.Click += new System.EventHandler(showDebugFormToolStripButton_Click); #region Debug Validation Events grid1.Undid += (s, e) => _Debug_Auto_Validate_All(((BaseWorksheetAction)e.Action).Worksheet); grid1.Redid += (s, e) => _Debug_Auto_Validate_All(((BaseWorksheetAction)e.Action).Worksheet); grid2.Undid += (s, e) => _Debug_Auto_Validate_All(((BaseWorksheetAction)e.Action).Worksheet); grid2.Redid += (s, e) => _Debug_Auto_Validate_All(((BaseWorksheetAction)e.Action).Worksheet); showDebugInfoToolStripMenuItem.Click += (s, e) => { showDebugFormToolStripButton.PerformClick(); showDebugInfoToolStripMenuItem.Checked = showDebugFormToolStripButton.Checked; }; validateBorderSpanToolStripMenuItem.Click += (s, e) => _Debug_Validate_BorderSpan(CurrentWorksheet, true); validateMergedRangeToolStripMenuItem.Click += (s, e) => _Debug_Validate_Merged_Cell(CurrentWorksheet, true); validateAllToolStripMenuItem.Click += (s, e) => _Debug_Validate_All(CurrentWorksheet, true); #endregion // Debug Validation Events #endif // RG_DEBUG ResumeLayout(); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.F6: // Switch between panes (header1.Active ? grid2 : grid1).Focus(); return true; case Keys.Alt | Keys.Down: nextDiffToolStripButton.PerformClick(); return true; case Keys.Alt | Keys.Up: prevDiffToolStripButton.PerformClick(); return true; case Keys.Alt | Keys.Home: firstDiffToolStripButton.PerformClick(); return true; case Keys.Alt | Keys.End: lastDiffToolStripButton.PerformClick(); return true; case Keys.Alt | Keys.Right: left2rightToolStripButton.PerformClick(); return true; case Keys.Alt | Keys.Left: right2leftToolStripButton.PerformClick(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void toolStripButton_EnabledChanged(object sender, EventArgs e) { AutomationEventArgs args = new AutomationEventArgs(InvokePatternIdentifiers.InvokedEvent); var provider = AutomationInteropProvider.HostProviderFromHandle(toolStrip1.Handle); AutomationInteropProvider.RaiseAutomationEvent(InvokePatternIdentifiers.InvokedEvent, provider, args); } private void ExportAsCsv(RangePosition range) { using (SaveFileDialog dlg = new SaveFileDialog()) { dlg.Filter = LangResource.Filter_Export_As_CSV; dlg.FileName = Path.GetFileNameWithoutExtension(CurrentFilePath); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { using (FileStream fs = new FileStream(dlg.FileName, FileMode.Create, FileAccess.Write, FileShare.Read)) { CurrentWorksheet.ExportAsCSV(fs, range); } #if DEBUG Process.Start(dlg.FileName); #endif } }; } void worksheet_SelectionModeChanged(object sender, EventArgs e) { UpdateSelectionModeAndStyle(); } void worksheet_SelectionForwardDirectionChanged(object sender, EventArgs e) { UpdateSelectionForwardDirection(); } void worksheet_Resetted(object sender, EventArgs e) { statusToolStripStatusLabel.Text = string.Empty; } void worksheet_SettingsChanged(object sender, SettingsChangedEventArgs e) { var worksheet = sender as Worksheet; if (worksheet != null) UpdateWorksheetSettings(worksheet); } void UpdateWorksheetSettings(Worksheet sheet) { bool visible = false; visible = sheet.HasSettings(WorksheetSettings.View_ShowGridLine); if (showGridLinesToolStripMenuItem.Checked != visible) showGridLinesToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_ShowPageBreaks); if (showPageBreakToolStripMenuItem.Checked != visible) showPageBreakToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_ShowFrozenLine); if (showFrozenLineToolStripMenuItem.Checked != visible) showFrozenLineToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_ShowRowHeader); if (showRowHeaderToolStripMenuItem.Checked != visible) showRowHeaderToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_ShowColumnHeader); if (showColumnHeaderToolStripMenuItem.Checked != visible) showColumnHeaderToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_AllowShowRowOutlines); if (showRowOutlineToolStripMenuItem.Checked != visible) showRowOutlineToolStripMenuItem.Checked = visible; visible = sheet.HasSettings(WorksheetSettings.View_AllowShowColumnOutlines); if (showColumnOutlineToolStripMenuItem.Checked != visible) showColumnOutlineToolStripMenuItem.Checked = visible; var check = sheet.HasSettings(WorksheetSettings.Edit_DragSelectionToMoveCells); if (dragToMoveRangeToolStripMenuItem.Checked != check) dragToMoveRangeToolStripMenuItem.Checked = check; check = sheet.HasSettings(WorksheetSettings.Edit_DragSelectionToFillSerial); if (dragToFillSerialToolStripMenuItem.Checked != check) dragToFillSerialToolStripMenuItem.Checked = check; check = !GridControl.HasSettings(WorkbookSettings.Formula_AutoUpdateReferenceCell); if (suspendReferenceUpdatingToolStripMenuItem.Checked != check) suspendReferenceUpdatingToolStripMenuItem.Checked = check; sheetReadonlyToolStripMenuItem.Checked = sheet.HasSettings(WorksheetSettings.Edit_Readonly); } void cellTypeNoneMenuItem_Click(object sender, EventArgs e) { var worksheet = CurrentWorksheet; if (worksheet != null) { worksheet.IterateCells(worksheet.SelectionRange, false, (r, c, cell) => { if (cell != null) cell.Body = null; return true; }); } } void cellTypeMenuItem_Click(object sender, EventArgs e) { var worksheet = CurrentWorksheet; var menuItem = sender as ToolStripMenuItem; if (menuItem != null && menuItem.Tag is Type && worksheet != null) { foreach (var cell in worksheet.Ranges[worksheet.SelectionRange].Cells) { cell.Body = System.Activator.CreateInstance((Type)menuItem.Tag) as ICellBody; } } } void textWrapToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentSelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.TextWrap, TextWrapMode = textWrapToolStripButton.Checked ? TextWrapMode.WordBreak : TextWrapMode.NoWrap, })); } void worksheet_GridScaled(object sender, EventArgs e) { var worksheet = sender as Worksheet; // Don't synchronize with a hidden grid if (grid1.GetWorksheetIndex(worksheet) != -1 && grid1.Visible || grid2.GetWorksheetIndex(worksheet) != -1 && grid2.Visible) { float scale = (float)Math.Round(worksheet.ScaleFactor, 1); zoomToolStripDropDownButton.Text = string.Format("{0:F0}%", scale * 100); } } void worksheet_ColumnsWidthChanged(object sender, ColumnsWidthChangedEventArgs e) { if (KeepSheetsInSync) { var worksheet = sender != grid1.CurrentWorksheet ? grid1.CurrentWorksheet : grid2.CurrentWorksheet; worksheet.ColumnsWidthChanged -= worksheet_ColumnsWidthChanged; worksheet.SetColumnsWidth(e.Index, e.Count, e.WidthGetter); worksheet.ColumnsWidthChanged += worksheet_ColumnsWidthChanged; } } void worksheet_RowsHeightChanged(object sender, RowsHeightChangedEventArgs e) { if (KeepSheetsInSync) { var worksheet = sender != grid1.CurrentWorksheet ? grid1.CurrentWorksheet : grid2.CurrentWorksheet; worksheet.RowsHeightChanged -= worksheet_RowsHeightChanged; worksheet.SetRowsHeight(e.Row, e.Count, e.HeightGetter); worksheet.RowsHeightChanged += worksheet_RowsHeightChanged; } } #endregion // Constructor #region Utility #if RG_DEBUG #region Debug Validations /// <summary> /// Use for Debug mode. Check for border span is valid. /// </summary> /// <param name="showSuccessMsg"></param> /// <returns></returns> bool _Debug_Validate_BorderSpan(Worksheet sheet, bool showSuccessMsg) { bool rs = sheet._Debug_Validate_BorderSpan(); if (rs) { if (showSuccessMsg) ShowStatus("Border span validation ok."); } else { ShowError("Border span test failed."); if (!showDebugInfoToolStripMenuItem.Checked) { showDebugInfoToolStripMenuItem.PerformClick(); } } return rs; } bool _Debug_Validate_Merged_Cell(Worksheet sheet, bool showSuccessMsg) { bool rs = sheet._Debug_Validate_MergedCells(); if (rs) { if (showSuccessMsg) ShowStatus("Merged range validation ok."); } else { ShowError("Merged range validation failed."); if (!showDebugInfoToolStripMenuItem.Checked) { showDebugInfoToolStripMenuItem.PerformClick(); } } return rs; } bool _Debug_Validate_Unmerged_Range(Worksheet sheet, bool showSuccessMsg, RangePosition range) { bool rs = sheet._Debug_Validate_Unmerged_Range(range); if (rs) { if (showSuccessMsg) ShowStatus("Unmerged range validation ok."); } else { ShowError("Unmerged range validation failed."); if (!showDebugInfoToolStripMenuItem.Checked) { showDebugInfoToolStripMenuItem.PerformClick(); } } return rs; } bool _Debug_Validate_All(Worksheet sheet, bool showSuccessMsg) { return _Debug_Validate_All(sheet, showSuccessMsg, RangePosition.EntireRange); } bool _Debug_Validate_All(Worksheet sheet, RangePosition range) { return _Debug_Validate_All(sheet, false, range); } bool _Debug_Validate_All(Worksheet sheet, bool showSuccessMsg, RangePosition range) { bool rs = _Debug_Validate_BorderSpan(sheet, showSuccessMsg); if (rs) rs = _Debug_Validate_Merged_Cell(sheet, showSuccessMsg); if (rs) rs = _Debug_Validate_Unmerged_Range(sheet, showSuccessMsg, range); return rs; } bool _Debug_Auto_Validate_All(Worksheet sheet) { return _Debug_Validate_All(sheet, false); } bool _Debug_Auto_Validate_All(Worksheet sheet, RangePosition range) { return _Debug_Validate_All(sheet, range); } #endregion // Debug Validations #endif // RG_DEBUG private static bool IsFileType(string file, string patterns) { string ext = Path.GetExtension(file); int dot = patterns.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase); return dot != -1 && patterns[(dot + ext.Length) % patterns.Length] == '.'; } private static bool IsFileTypeExcel2003(string file) => IsFileType(file, ".xls.xlt"); private static bool IsFileTypeExcel2007(string file) => IsFileType(file, ".xlsx.xlsm.xltx.xltm"); public ReoGridControl GridControl { get { return formulaBar.GridControl; } } public Worksheet CurrentWorksheet { get { return GridControl.CurrentWorksheet; } } public RangePosition CurrentSelectionRange { get { return CurrentWorksheet.SelectionRange; } set { CurrentWorksheet.SelectionRange = value; } } internal void ShowStatus(string msg) { ShowStatus(msg, false); } internal void ShowStatus(string msg, bool error) { statusToolStripStatusLabel.Text = msg; statusToolStripStatusLabel.ForeColor = error ? Color.Red : SystemColors.WindowText; } public void ShowError(string msg) { ShowStatus(msg, true); } private void UpdateMenuAndToolStripsWhenAction(object sender, EventArgs e) { if (sender == GridControl) UpdateMenuAndToolStrips(); } private void Undo(object sender, EventArgs e) { var action = undoStack.Last(); undoStack.RemoveLast(); redoStack.AddLast(action); if (grid1.CanUndo(action)) { grid1.Undo(); } else if (grid2.CanUndo(action)) { grid2.Undo(); } } private void Redo(object sender, EventArgs e) { var action = redoStack.Last(); redoStack.RemoveLast(); undoStack.AddLast(action); if (grid1.CanRedo(action)) { grid1.Redo(); } else if (grid2.CanRedo(action)) { grid2.Redo(); } } void zoomToolStripDropDownButton_TextChanged(object sender, EventArgs e) { if (isUIUpdating) return; if (zoomToolStripDropDownButton.Text.Length > 0) { float scale = 0; if (float.TryParse(zoomToolStripDropDownButton.Text.Replace("%", "E-2"), out scale)) { zoomToolStripDropDownButton.TextChanged -= zoomToolStripDropDownButton_TextChanged; grid1.CurrentWorksheet.SetScale(scale); grid2.CurrentWorksheet.SetScale(scale); zoomToolStripDropDownButton.TextChanged += zoomToolStripDropDownButton_TextChanged; } } } void grid_SelectionRangeChanged(object sender, RangeEventArgs e) { // get event source worksheet var worksheet = sender as Worksheet; // if source worksheet is current worksheet, update menus and tool strips if (worksheet == CurrentWorksheet) { if (worksheet.SelectionRange == RangePosition.Empty) { rangeInfoToolStripStatusLabel.Text = "Selection None"; } else { rangeInfoToolStripStatusLabel.Text = string.Format("{0} {1} x {2}", worksheet.SelectionRange.ToString(), worksheet.SelectionRange.Rows, worksheet.SelectionRange.Cols); } UpdateMenuAndToolStrips(); } } #endregion // Utility #region Language void SetupUILanguage() { #region Menu // File fileToolStripMenuItem.Text = LangResource.Menu_File; saveToolStripMenuItem.Text = LangResource.Menu_File_Save; exportAsHtmlToolStripMenuItem.Text = LangResource.Menu_File_Export_As_HTML; exportAsCSVToolStripMenuItem.Text = LangResource.Menu_File_Export_As_CSV; exportSelectedRangeToolStripMenuItem.Text = LangResource.Menu_File_Export_As_CSV_Selected_Range; exportCurrentWorksheetToolStripMenuItem.Text = LangResource.Menu_File_Export_As_CSV_Current_Worksheet; printPreviewToolStripMenuItem.Text = LangResource.Menu_File_Print_Preview; printSettingsToolStripMenuItem.Text = LangResource.Menu_File_Print_Settings; printToolStripMenuItem.Text = LangResource.Menu_File_Print; exitToolStripMenuItem.Text = LangResource.Menu_File_Exit; // Edit editToolStripMenuItem.Text = LangResource.Menu_Edit; undoToolStripMenuItem.Text = LangResource.Menu_Undo; redoToolStripMenuItem.Text = LangResource.Menu_Redo; repeatLastActionToolStripMenuItem.Text = LangResource.Menu_Edit_Repeat_Last_Action; cutToolStripMenuItem.Text = LangResource.Menu_Cut; copyToolStripMenuItem.Text = LangResource.Menu_Copy; pasteToolStripMenuItem.Text = LangResource.Menu_Paste; clearToolStripMenuItem.Text = LangResource.Menu_Edit_Clear; clearAllToolStripMenuItem.Text = LangResource.All; clearDataToolStripMenuItem.Text = LangResource.Data; clearDataFormatToolStripMenuItem.Text = LangResource.Data_Format; clearFormulaToolStripMenuItem.Text = LangResource.Formula; clearCellBodyToolStripMenuItem.Text = LangResource.CellBody; clearStylesToolStripMenuItem.Text = LangResource.Style; clearBordersToolStripMenuItem.Text = LangResource.Border; focusCellStyleToolStripMenuItem.Text = LangResource.Menu_Edit_Focus_Cell_Style; focusStyleDefaultToolStripMenuItem.Text = LangResource.Default; focusStyleNoneToolStripMenuItem.Text = LangResource.None; selectionToolStripMenuItem.Text = LangResource.Menu_Edit_Selection; dragToMoveRangeToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Drag_To_Move_Content; dragToFillSerialToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Drag_To_Fill_Serial; selectionStyleToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Style; selStyleDefaultToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Style_Default; selStyleFocusRectToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Style_Focus_Rect; selStyleNoneToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Style_None; selectionModeToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode; selModeNoneToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode_None; selModeCellToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode_Cell; selModeRangeToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode_Range; selModeRowToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode_Row; selModeColumnToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Mode_Column; selectionMoveDirectionToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Move_Direction; selDirRightToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Move_Direction_Right; selDirDownToolStripMenuItem.Text = LangResource.Menu_Edit_Selection_Move_Direction_Down; selectAllToolStripMenuItem.Text = LangResource.Menu_Edit_Select_All; // View viewToolStripMenuItem.Text = LangResource.Menu_View; componentsToolStripMenuItem.Text = LangResource.Menu_View_Components; toolbarToolStripMenuItem.Text = LangResource.Menu_View_Components_Toolbar; formulaBarToolStripMenuItem.Text = LangResource.Menu_View_Components_FormulaBar; statusBarToolStripMenuItem.Text = LangResource.Menu_View_Components_StatusBar; visibleToolStripMenuItem.Text = LangResource.Menu_View_Visible; showGridLinesToolStripMenuItem.Text = LangResource.Menu_View_Visible_Grid_Lines; showPageBreakToolStripMenuItem.Text = LangResource.Menu_View_Visible_Page_Breaks; showFrozenLineToolStripMenuItem.Text = LangResource.Menu_View_Visible_Forzen_Line; sheetSwitcherToolStripMenuItem.Text = LangResource.Menu_View_Visible_Sheet_Tab; showHorizontaScrolllToolStripMenuItem.Text = LangResource.Menu_View_Visible_Horizontal_ScrollBar; showVerticalScrollbarToolStripMenuItem.Text = LangResource.Menu_View_Visible_Vertical_ScrollBar; showRowHeaderToolStripMenuItem.Text = LangResource.Menu_View_Visible_Row_Header; showColumnHeaderToolStripMenuItem.Text = LangResource.Menu_View_Visible_Column_Header; showRowOutlineToolStripMenuItem.Text = LangResource.Menu_View_Visible_Row_Outline_Panel; showColumnOutlineToolStripMenuItem.Text = LangResource.Menu_View_Visible_Column_Outline_Panel; resetAllPageBreaksToolStripMenuItem.Text = LangResource.Menu_Reset_All_Page_Breaks; freezeToCellToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Cell; freezeToSpecifiedEdgeToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges; freezeToLeftToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Left; freezeToRightToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Right; freezeToTopToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Top; freezeToBottomToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Bottom; freezeToLeftTopToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Top_Left; freezeToLeftBottomToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Bottom_Left; freezeToRightTopToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Top_Right; freezeToRightBottomToolStripMenuItem.Text = LangResource.Menu_View_Freeze_To_Edges_Bottom_Right; unfreezeToolStripMenuItem.Text = LangResource.Menu_View_Unfreeze; // Cells cellsToolStripMenuItem.Text = LangResource.Menu_Cells; mergeCellsToolStripMenuItem.Text = LangResource.Menu_Cells_Merge_Cells; unmergeCellsToolStripMenuItem.Text = LangResource.Menu_Cells_Unmerge_Cells; changeCellsTypeToolStripMenuItem.Text = LangResource.Menu_Change_Cells_Type; formatCellsToolStripMenuItem.Text = LangResource.Menu_Format_Cells; // Sheet sheetToolStripMenuItem.Text = LangResource.Menu_Sheet; filterToolStripMenuItem.Text = LangResource.Menu_Sheet_Filter; clearFilterToolStripMenuItem.Text = LangResource.Menu_Sheet_Clear_Filter; groupToolStripMenuItem.Text = LangResource.Menu_Sheet_Group; groupRowsToolStripMenuItem.Text = LangResource.Menu_Sheet_Group_Rows; groupColumnsToolStripMenuItem.Text = LangResource.Menu_Sheet_Group_Columns; ungroupToolStripMenuItem.Text = LangResource.Menu_Sheet_Ungroup; ungroupRowsToolStripMenuItem.Text = LangResource.Menu_Sheet_Ungroup_Selection_Rows; ungroupAllRowsToolStripMenuItem.Text = LangResource.Menu_Sheet_Ungroup_All_Rows; ungroupColumnsToolStripMenuItem.Text = LangResource.Menu_Sheet_Ungroup_Selection_Columns; ungroupAllColumnsToolStripMenuItem.Text = LangResource.Menu_Sheet_Ungroup_All_Columns; insertToolStripMenuItem.Text = LangResource.Menu_Sheet_Insert; resizeToolStripMenuItem.Text = LangResource.Menu_Sheet_Resize; sheetReadonlyToolStripMenuItem.Text = LangResource.Menu_Edit_Readonly; // Formula formulaToolStripMenuItem.Text = LangResource.Menu_Formula; autoFunctionToolStripMenuItem.Text = LangResource.Menu_Formula_Auto_Function; defineNamedRangeToolStripMenuItem.Text = LangResource.Menu_Formula_Define_Name; nameManagerToolStripMenuItem.Text = LangResource.Menu_Formula_Name_Manager; tracePrecedentsToolStripMenuItem.Text = LangResource.Menu_Formula_Trace_Precedents; traceDependentsToolStripMenuItem.Text = LangResource.Menu_Formula_Trace_Dependents; removeArrowsToolStripMenuItem.Text = LangResource.Menu_Formula_Remove_Trace_Arrows; removeAllArrowsToolStripMenuItem.Text = LangResource.Menu_Formula_Remove_Trace_Arrows_Remove_All_Arrows; removePrecedentArrowsToolStripMenuItem.Text = LangResource.Menu_Formula_Remove_Trace_Arrows_Remove_Precedent_Arrows; removeDependentArrowsToolStripMenuItem.Text = LangResource.Menu_Formula_Remove_Trace_Arrows_Remove_Dependent_Arrows; suspendReferenceUpdatingToolStripMenuItem.Text = LangResource.Menu_Formula_Suspend_Reference_Updates; recalculateWorksheetToolStripMenuItem.Text = LangResource.Menu_Formula_Recalculate_Worksheet; // Tools toolsToolStripMenuItem.Text = LangResource.Menu_Tools; controlStyleToolStripMenuItem.Text = LangResource.Menu_Tools_Control_Appearance; helpToolStripMenuItem.Text = LangResource.Menu_Help; homepageToolStripMenuItem.Text = LangResource.Menu_Help_Homepage; documentationToolStripMenuItem.Text = LangResource.Menu_Help_Documents; aboutToolStripMenuItem.Text = LangResource.Menu_Help_About; // Column Context Menu colCutToolStripMenuItem.Text = LangResource.Menu_Cut; colCopyToolStripMenuItem.Text = LangResource.Menu_Copy; colPasteToolStripMenuItem.Text = LangResource.Menu_Paste; insertColToolStripMenuItem.Text = LangResource.CtxMenu_Col_Insert_Columns; deleteColumnToolStripMenuItem.Text = LangResource.CtxMenu_Col_Delete_Columns; resetToDefaultWidthToolStripMenuItem.Text = LangResource.CtxMenu_Col_Reset_To_Default_Width; columnWidthToolStripMenuItem.Text = LangResource.CtxMenu_Col_Column_Width; hideColumnsToolStripMenuItem.Text = LangResource.Menu_Hide; unhideColumnsToolStripMenuItem.Text = LangResource.Menu_Unhide; columnFilterToolStripMenuItem.Text = LangResource.CtxMenu_Col_Filter; clearColumnFilterToolStripMenuItem.Text = LangResource.CtxMenu_Col_Clear_Filter; groupColumnsToolStripMenuItem1.Text = LangResource.Menu_Group; ungroupColumnsToolStripMenuItem1.Text = LangResource.Menu_Ungroup; ungroupAllColumnsToolStripMenuItem1.Text = LangResource.Menu_Ungroup_All; insertColPageBreakToolStripMenuItem.Text = LangResource.Menu_Insert_Page_Break; removeColPageBreakToolStripMenuItem.Text = LangResource.Menu_Remove_Page_Break; columnPropertiesToolStripMenuItem.Text = LangResource.Menu_Property; colFormatCellsToolStripMenuItem.Text = LangResource.Menu_Format_Cells; // Row Context Menu rowCutToolStripMenuItem.Text = LangResource.Menu_Cut; rowCopyToolStripMenuItem.Text = LangResource.Menu_Copy; rowPasteToolStripMenuItem.Text = LangResource.Menu_Paste; insertRowToolStripMenuItem.Text = LangResource.CtxMenu_Row_Insert_Rows; deleteRowsToolStripMenuItem.Text = LangResource.CtxMenu_Row_Delete_Rows; resetToDefaultHeightToolStripMenuItem.Text = LangResource.CtxMenu_Row_Reset_to_Default_Height; rowHeightToolStripMenuItem.Text = LangResource.CtxMenu_Row_Row_Height; hideRowsToolStripMenuItem.Text = LangResource.Menu_Hide; unhideRowsToolStripMenuItem.Text = LangResource.Menu_Unhide; groupRowsToolStripMenuItem1.Text = LangResource.Menu_Group; ungroupRowsToolStripMenuItem1.Text = LangResource.Menu_Ungroup; ungroupAllRowsToolStripMenuItem1.Text = LangResource.Menu_Ungroup_All; insertRowPageBreakToolStripMenuItem.Text = LangResource.Menu_Insert_Page_Break; removeRowPageBreakToolStripMenuItem.Text = LangResource.Menu_Remove_Page_Break; rowPropertiesToolStripMenuItem.Text = LangResource.Menu_Property; rowFormatCellsToolStripMenuItem.Text = LangResource.Menu_Format_Cells; // Cell Context Menu cutRangeToolStripMenuItem.Text = LangResource.Menu_Cut; copyRangeToolStripMenuItem.Text = LangResource.Menu_Copy; pasteRangeToolStripMenuItem.Text = LangResource.Menu_Paste; mergeRangeToolStripMenuItem.Text = LangResource.CtxMenu_Cell_Merge; unmergeRangeToolStripMenuItem.Text = LangResource.CtxMenu_Cell_Unmerge; changeCellsTypeToolStripMenuItem2.Text = LangResource.Menu_Change_Cells_Type; formatCellToolStripMenuItem.Text = LangResource.Menu_Format_Cells; // Lead Header Context Menu resetAllPageBreaksToolStripMenuItem1.Text = LangResource.Menu_Reset_All_Page_Breaks; #endregion // Menu header1.SetupUILanguage(); header2.SetupUILanguage(); } void ChangeLanguage(string culture) { Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture); SetupUILanguage(); } void englishenUSToolStripMenuItem_Click(object sender, EventArgs e) { ChangeLanguage("en-US"); } void japanesejpJPToolStripMenuItem_Click(object sender, EventArgs e) { ChangeLanguage("ja-JP"); } void simplifiedChinesezhCNToolStripMenuItem_Click(object sender, EventArgs e) { ChangeLanguage("zh-CN"); } void germandeDEToolStripMenuItem_Click(object sender, EventArgs e) { ChangeLanguage("de-DE"); } #endregion // Langauge #region Update Menus & Toolbars private bool isUIUpdating = false; private void UpdateMenuAndToolStrips() { if (isUIUpdating) return; isUIUpdating = true; var worksheet = CurrentWorksheet; WorksheetRangeStyle style = worksheet.GetCellStyles(worksheet.SelectionRange.StartPos); if (style != null) { // cross-thread exception Action set = () => { fontToolStripComboBox.Text = style.FontName; fontSizeToolStripComboBox.Text = style.FontSize.ToString(); boldToolStripButton.Checked = style.Bold; italicToolStripButton.Checked = style.Italic; strikethroughToolStripButton.Checked = style.Strikethrough; underlineToolStripButton.Checked = style.Underline; textColorPickToolStripItem.SolidColor = style.TextColor; backColorPickerToolStripButton.SolidColor = style.BackColor; textAlignLeftToolStripButton.Checked = style.HAlign == ReoGridHorAlign.Left; textAlignCenterToolStripButton.Checked = style.HAlign == ReoGridHorAlign.Center; textAlignRightToolStripButton.Checked = style.HAlign == ReoGridHorAlign.Right; distributedIndentToolStripButton.Checked = style.HAlign == ReoGridHorAlign.DistributedIndent; textAlignTopToolStripButton.Checked = style.VAlign == ReoGridVerAlign.Top; textAlignMiddleToolStripButton.Checked = style.VAlign == ReoGridVerAlign.Middle; textAlignBottomToolStripButton.Checked = style.VAlign == ReoGridVerAlign.Bottom; textWrapToolStripButton.Checked = style.TextWrapMode != TextWrapMode.NoWrap; RangeBorderInfoSet borderInfo = worksheet.GetRangeBorders(worksheet.SelectionRange); if (borderInfo.Left != null) { borderColorPickToolStripItem.SolidColor = borderInfo.Left.Color; } else if (borderInfo.Right != null) { borderColorPickToolStripItem.SolidColor = borderInfo.Right.Color; } else if (borderInfo.Top != null) { borderColorPickToolStripItem.SolidColor = borderInfo.Top.Color; } else if (borderInfo.Bottom != null) { borderColorPickToolStripItem.SolidColor = borderInfo.Bottom.Color; } else if (borderInfo.InsideHorizontal != null) { borderColorPickToolStripItem.SolidColor = borderInfo.InsideHorizontal.Color; } else if (borderInfo.InsideVertical != null) { borderColorPickToolStripItem.SolidColor = borderInfo.InsideVertical.Color; } else { borderColorPickToolStripItem.SolidColor = Color.Black; } UpdateUndoRedoCmdUI(); var canAlign = KeepSheetsInSync; colAlignByLCSToolStripMenuItem.Enabled = canAlign; cutToolStripButton.Enabled = cutToolStripMenuItem.Enabled = rowCutToolStripMenuItem.Enabled = colCutToolStripMenuItem.Enabled = worksheet.CanCut(); copyToolStripButton.Enabled = copyToolStripMenuItem.Enabled = rowCopyToolStripMenuItem.Enabled = colCopyToolStripMenuItem.Enabled = worksheet.CanCopy(); pasteToolStripButton.Enabled = pasteToolStripMenuItem.Enabled = rowPasteToolStripMenuItem.Enabled = colPasteToolStripMenuItem.Enabled = worksheet.CanPaste(); unfreezeToolStripMenuItem.Enabled = worksheet.IsFrozen; isUIUpdating = false; toolStripButton_EnabledChanged(this, EventArgs.Empty); }; if (InvokeRequired) Invoke(set); else set(); } #if !DEBUG debugToolStripMenuItem.Enabled = false; #endif // DEBUG } private bool settingSelectionMode = false; private void UpdateSelectionModeAndStyle() { if (settingSelectionMode) return; settingSelectionMode = true; selModeNoneToolStripMenuItem.Checked = false; selModeCellToolStripMenuItem.Checked = false; selModeRangeToolStripMenuItem.Checked = false; selModeRowToolStripMenuItem.Checked = false; selModeColumnToolStripMenuItem.Checked = false; switch (CurrentWorksheet.SelectionMode) { case WorksheetSelectionMode.None: selModeNoneToolStripMenuItem.Checked = true; break; case WorksheetSelectionMode.Cell: selModeCellToolStripMenuItem.Checked = true; break; default: case WorksheetSelectionMode.Range: selModeRangeToolStripMenuItem.Checked = true; break; case WorksheetSelectionMode.Row: selModeRowToolStripMenuItem.Checked = true; break; case WorksheetSelectionMode.Column: selModeColumnToolStripMenuItem.Checked = true; break; } selStyleNoneToolStripMenuItem.Checked = false; selStyleDefaultToolStripMenuItem.Checked = false; selStyleFocusRectToolStripMenuItem.Checked = false; switch (CurrentWorksheet.SelectionStyle) { case WorksheetSelectionStyle.None: selStyleNoneToolStripMenuItem.Checked = true; break; default: case WorksheetSelectionStyle.Default: selStyleDefaultToolStripMenuItem.Checked = true; break; case WorksheetSelectionStyle.FocusRect: selStyleFocusRectToolStripMenuItem.Checked = true; break; } focusStyleDefaultToolStripMenuItem.Checked = false; focusStyleNoneToolStripMenuItem.Checked = false; switch (CurrentWorksheet.FocusPosStyle) { default: case FocusPosStyle.Default: focusStyleDefaultToolStripMenuItem.Checked = true; break; case FocusPosStyle.None: focusStyleNoneToolStripMenuItem.Checked = true; break; } settingSelectionMode = false; } private void UpdateSelectionForwardDirection() { switch (CurrentWorksheet.SelectionForwardDirection) { default: case SelectionForwardDirection.Right: selDirRightToolStripMenuItem.Checked = true; selDirDownToolStripMenuItem.Checked = false; break; case SelectionForwardDirection.Down: selDirRightToolStripMenuItem.Checked = false; selDirDownToolStripMenuItem.Checked = true; break; } } #endregion #region Document public FilePathBar CurrentHeader { get => GridControl == grid1 ? header1 : header2; } public string CurrentFilePath { get => CurrentHeader.Text; } private bool SaveOneFile(ReoGridControl grid, string path, object arg) { var dirty = true; FileFormat fm = FileFormat._Auto; if (IsFileTypeExcel2007(path)) { fm = FileFormat.Excel2007; } else if (path.EndsWith(".rgf", StringComparison.CurrentCultureIgnoreCase)) { fm = FileFormat.ReoGridFormat; } else if (arg as CSVFormatArgument != null) { fm = FileFormat.CSV; } try { grid.Save(path, fm, arg); dirty = false; } catch (Exception ex) { MessageBox.Show(this, "Save error: " + ex.Message, "Save Workbook", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return dirty; } private void SaveOneFile(ReoGridControl grid, FilePathBar header, object arg) { if (header.Dirty) header.Dirty = SaveOneFile(grid, header.Text, arg); } private void RemoveUndoRedoActions(ReoGridControl grid) { var node = undoStack.First; while (node != null) { var next = node.Next; if (grid.CanUndo(node.Value)) undoStack.Remove(node); node = next; } node = redoStack.First; while (node != null) { var next = node.Next; if (grid.CanRedo(node.Value)) redoStack.Remove(node); node = next; } } private object LoadOneFile(ReoGridControl grid, FilePathBar header) { object arg = null; Cursor = Cursors.WaitCursor; try { RemoveUndoRedoActions(grid); grid.Visible = false; grid.Reset(); switch (header.Selection) { case FilePathBar.SeletionType.TabDelimited: arg = grid.Load(header.Text, IO.FileFormat.CSV, Encoding.Default, csvTabDelimited); break; case FilePathBar.SeletionType.CommaDelimited: arg = grid.Load(header.Text, IO.FileFormat.CSV, Encoding.Default, csvCommaDelimited); break; case FilePathBar.SeletionType.SemicolonDelimited: arg = grid.Load(header.Text, IO.FileFormat.CSV, Encoding.Default, csvSemicolonDelimited); break; case FilePathBar.SeletionType.PipeDelimited: arg = grid.Load(header.Text, IO.FileFormat.CSV, Encoding.Default, csvPipeDelimited); break; case FilePathBar.SeletionType.AutoDetect: var loadFrom = header.Text; if (IsFileType(loadFrom, ".tsv")) goto case FilePathBar.SeletionType.TabDelimited; if (IsFileType(loadFrom, ".psv")) goto case FilePathBar.SeletionType.PipeDelimited; if (IsFileTypeExcel2003(loadFrom)) { var exe = xls2x(); if (exe != null) { var name = Guid.NewGuid().ToString() + ".*"; var temp = Path.GetTempPath(); var path = Path.Combine(temp, name); var psi = new ProcessStartInfo(exe, "\"" + loadFrom + "\" -o \"" + path + "\"") { CreateNoWindow = true, UseShellExecute = false, }; var process = Process.Start(psi); process.WaitForExit(); process.Close(); foreach (var file in Directory.GetFiles(temp, name)) { path = file; } arg = grid.Load(path, IO.FileFormat.Excel2007, Encoding.Default); File.Delete(path); header.Text = Path.ChangeExtension(loadFrom, Path.GetExtension(path)); } } else if ((IsFileType(loadFrom, ".ods") ? ".xlsx" : IsFileType(loadFrom, ".ots") ? ".xltx" : null) is string ext) { var exe = OdfConverter(); if (exe != null) { var name = Guid.NewGuid().ToString() + ext; var temp = Path.GetTempPath(); var path = Path.Combine(temp, name); var psi = new ProcessStartInfo(exe, "/ODS2XLSX /I \"" + loadFrom + "\" /O \"" + path + "\"") { CreateNoWindow = true, UseShellExecute = false, }; var process = Process.Start(psi); process.WaitForExit(); process.Close(); arg = grid.Load(path, IO.FileFormat.Excel2007, Encoding.Default); File.Delete(path); header.Text = Path.ChangeExtension(loadFrom, Path.GetExtension(path)); } } else { arg = grid.Load(loadFrom, IO.FileFormat._Auto, Encoding.Default); } break; } } catch (FileNotFoundException ex) { MessageBox.Show(LangResource.Msg_File_Not_Found + ex.FileName, "ReoGrid Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop); } catch (Exception ex) { MessageBox.Show(LangResource.Msg_Load_File_Failed + ex.Message, "ReoGrid Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Cursor = Cursors.Default; } if (header.Selection < FilePathBar.SeletionType.Clear) { grid.Visible = true; header.Modified = false; Rescan(RangePosition.EntireRange); } return arg; } private bool RescanCells(Cell cell1, Cell cell2) { var finding = !Equals(cell1?.Data, cell2?.Data); if (cell1 != null) { cell1.DiffFlag = !finding || cell1.Data == null ? 0 : cell2?.Data == null ? DiffFlag.DiffInsert : DiffFlag.DiffChange; } if (cell2 != null) { cell2.DiffFlag = !finding || cell2.Data == null ? 0 : cell1?.Data == null ? DiffFlag.DiffInsert : DiffFlag.DiffChange; } return finding; } private bool RescanCurrentSheet(RangePosition roi) { var sheet1 = grid1.CurrentWorksheet; var sheet2 = grid2.CurrentWorksheet; sheet1.SuspendUIUpdates(); sheet2.SuspendUIUpdates(); int o, n, m; if (roi == RangePosition.EntireRange) { n = Math.Max(sheet1.RowCount, sheet2.RowCount); m = Math.Max(sheet1.ColumnCount, sheet2.ColumnCount); sheet1.RowCount = n; sheet2.RowCount = n; sheet1.ColumnCount = m; sheet2.ColumnCount = m; sheet1.ColumnsWidthChanged -= worksheet_ColumnsWidthChanged; sheet2.ColumnsWidthChanged -= worksheet_ColumnsWidthChanged; sheet1.RowsHeightChanged -= worksheet_RowsHeightChanged; sheet2.RowsHeightChanged -= worksheet_RowsHeightChanged; // Align column widths and row heights on both sides sheet1.SetColumnsWidth(0, m, c => Math.Max(sheet1.GetColumnWidth(c), sheet2.GetColumnWidth(c))); sheet2.SetColumnsWidth(0, m, c => sheet1.GetColumnWidth(c)); sheet1.SetRowsHeight(0, n, r => Math.Max(sheet1.GetRowHeight(r), sheet2.GetRowHeight(r))); sheet2.SetRowsHeight(0, n, r => sheet1.GetRowHeight(r)); // Clear row differences rowDiffCount = 0; for (var i = 0; i < n; ++i) { sheet1.GetRowHeader(i).TextColor = Graphics.SolidColor.Transparent; sheet2.GetRowHeader(i).TextColor = Graphics.SolidColor.Transparent; } sheet1.ColumnsWidthChanged += worksheet_ColumnsWidthChanged; sheet2.ColumnsWidthChanged += worksheet_ColumnsWidthChanged; sheet1.RowsHeightChanged += worksheet_RowsHeightChanged; sheet2.RowsHeightChanged += worksheet_RowsHeightChanged; // Scan all rows which have some content o = 0; n = Math.Max(sheet1.MaxContentRow, sheet2.MaxContentRow) + 1; } else { // Scan only the rows which intersect the range of interest o = roi.Row; n = o + roi.Rows; } m = Math.Max(sheet1.MaxContentCol, sheet2.MaxContentCol) + 1; // Colorize the differences for (var i = o; i < n; ++i) { var finding = false; for (var j = 0; j < m; ++j) { var cell1 = sheet1.GetCell(i, j); var cell2 = sheet2.GetCell(i, j); if (RescanCells(cell1, cell2)) { finding = true; } } var rowhdr1 = sheet1.GetRowHeader(i); var rowhdr2 = sheet2.GetRowHeader(i); if (finding) { if (rowhdr1.TextColor == Graphics.SolidColor.Transparent) { ++rowDiffCount; rowhdr1.TextColor = Graphics.SolidColor.Red; rowhdr2.TextColor = Graphics.SolidColor.Red; } } else { if (rowhdr1.TextColor != Graphics.SolidColor.Transparent) { --rowDiffCount; rowhdr1.TextColor = Graphics.SolidColor.Transparent; rowhdr2.TextColor = Graphics.SolidColor.Transparent; } } } inScrolling = true; grid1.ScrollCurrentWorksheet(ScrollX, ScrollY); grid2.ScrollCurrentWorksheet(ScrollX, ScrollY); inScrolling = false; sheet1.ResumeUIUpdates(); sheet2.ResumeUIUpdates(); return rowDiffCount != 0; } private void Rescan(RangePosition roi) { var findings = false; if (KeepSheetsInSync) { Cursor = Cursors.WaitCursor; try { findings = RescanCurrentSheet(roi); } finally { Cursor = Cursors.Default; } compareInfoToolStripStatusLabel.Text = rowDiffCount != 0 ? string.Format(LangRes.LangResource.DifferencesInHowManyRows, rowDiffCount) : LangRes.LangResource.SheetsAreIdentical; } else { compareInfoToolStripStatusLabel.Text = string.Empty; } // Diff navigation commands nextDiffToolStripButton.Enabled = findings; prevDiffToolStripButton.Enabled = findings; firstDiffToolStripButton.Enabled = findings; lastDiffToolStripButton.Enabled = findings; left2rightToolStripButton.Enabled = findings; right2leftToolStripButton.Enabled = findings; // Save commands UpdateSaveCmdUI(); saveAsLeftToolStripMenuItem.Enabled = grid1.Visible; saveAsRightToolStripMenuItem.Enabled = grid2.Visible; toolStripButton_EnabledChanged(this, EventArgs.Empty); } private void UpdateSaveCmdUI() { saveLeftToolStripMenuItem.Enabled = header1.Dirty; saveRightToolStripMenuItem.Enabled = header2.Dirty; bool dirty = header1.Dirty || header2.Dirty; saveToolStripMenuItem.Enabled = dirty; saveToolStripButton.Enabled = dirty; } private void UpdateUndoRedoCmdUI() { var canUndo = undoStack.Count() != 0; var canRedo = redoStack.Count() != 0; undoToolStripButton.Enabled = canUndo; undoToolStripMenuItem.Enabled = canUndo; redoToolStripButton.Enabled = canRedo; redoToolStripMenuItem.Enabled = canRedo; repeatLastActionToolStripMenuItem.Enabled = canUndo || canRedo; } /// <summary> /// Save current document /// </summary> private void Save(Side which) { if ((which & Side.Left) != 0) { SaveOneFile(grid1, header1, arg1); } if ((which & Side.Right) != 0) { SaveOneFile(grid2, header2, arg2); } UpdateSaveCmdUI(); toolStripButton_EnabledChanged(this, EventArgs.Empty); } /// <summary> /// Save current document by specifying new file path /// </summary> /// <returns>true if operation is successful, otherwise false</returns> private void SaveAs(Side which) { using (SaveFileDialog sfd = new SaveFileDialog()) { var header = which == Side.Left ? header1 : header2; sfd.Filter = LangResource.Filter_Save_File; var path = header.Text; if (!string.IsNullOrEmpty(path)) { sfd.FileName = Path.GetFileNameWithoutExtension(path); var ext = Path.GetExtension(path); var pos = sfd.Filter.LastIndexOf(ext); if (pos != -1) { pos -= sfd.Filter.Substring(0, pos).Replace("|", "").Length; sfd.FilterIndex = (pos + 1) / 2; } } if (sfd.ShowDialog(this) == DialogResult.OK) { SaveOneFile(which == Side.Left ? grid1 : grid2, sfd.FileName, which == Side.Left ? arg1 : arg2); header.Text = sfd.FileName; header.Dirty = false; } } UpdateSaveCmdUI(); toolStripButton_EnabledChanged(this, EventArgs.Empty); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridControl.Focus(); } protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); #if DEBUG // Uncomment out the code below to allow autosave. // Only RGF(ReoGrid Format, *.rgf) is supported. // CurrentWorksheet.Save("..\\..\\autosave.rgf"); #endif // DEBUG } #endregion #region Alignment private void textLeftToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.HorizontalAlign, HAlign = ReoGridHorAlign.Left, })); } private void textCenterToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.HorizontalAlign, HAlign = ReoGridHorAlign.Center, })); } private void textRightToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.HorizontalAlign, HAlign = ReoGridHorAlign.Right, })); } private void distributedIndentToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.HorizontalAlign, HAlign = ReoGridHorAlign.DistributedIndent, })); } private void textAlignTopToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.VerticalAlign, VAlign = ReoGridVerAlign.Top, })); } private void textAlignMiddleToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.VerticalAlign, VAlign = ReoGridVerAlign.Middle, })); } private void textAlignBottomToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.VerticalAlign, VAlign = ReoGridVerAlign.Bottom, })); } #endregion #region Border Settings #region Outside Borders private void SetSelectionBorder(BorderPositions borderPos, BorderLineStyle style) { GridControl.DoAction(new SetRangeBorderAction(CurrentWorksheet.SelectionRange, borderPos, new RangeBorderStyle { Color = borderColorPickToolStripItem.SolidColor, Style = style })); } private void boldOutlineToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Outside, BorderLineStyle.BoldSolid); } private void dottedOutlineToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Outside, BorderLineStyle.Dotted); } private void boundsSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Outside, BorderLineStyle.Solid); } private void solidOutlineToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Outside, BorderLineStyle.Solid); } private void dashedOutlineToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Outside, BorderLineStyle.Dashed); } #endregion // Outside Borders #region Inside Borders private void insideSolidToolStripSplitButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.InsideAll, BorderLineStyle.Solid); } private void insideSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.InsideAll, BorderLineStyle.Solid); } private void insideBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.InsideAll, BorderLineStyle.BoldSolid); } private void insideDottedToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.InsideAll, BorderLineStyle.Dotted); } private void insideDashedToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.InsideAll, BorderLineStyle.Dashed); } #endregion // Inside Borders #region Left & Right Borders private void leftRightSolidToolStripSplitButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.LeftRight, BorderLineStyle.Solid); } private void leftRightSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.LeftRight, BorderLineStyle.Solid); } private void leftRightBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.LeftRight, BorderLineStyle.BoldSolid); } private void leftRightDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.LeftRight, BorderLineStyle.Dotted); } private void leftRightDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.LeftRight, BorderLineStyle.Dashed); } #endregion // Left & Right Borders #region Top & Bottom Borders private void topBottomSolidToolStripSplitButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.TopBottom, BorderLineStyle.Solid); } private void topBottomSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.TopBottom, BorderLineStyle.Solid); } private void topBottomBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.TopBottom, BorderLineStyle.BoldSolid); } private void topBottomDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.TopBottom, BorderLineStyle.Dotted); } private void topBottomDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.TopBottom, BorderLineStyle.Dashed); } #endregion // Top & Bottom Borders #region All Borders private void allSolidToolStripSplitButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.All, BorderLineStyle.Solid); } private void allSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.All, BorderLineStyle.Solid); } private void allBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.All, BorderLineStyle.BoldSolid); } private void allDottedToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.All, BorderLineStyle.Dotted); } private void allDashedToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.All, BorderLineStyle.Dashed); } #endregion // All Borders #region Left Border private void leftSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Left, BorderLineStyle.Solid); } private void leftSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Left, BorderLineStyle.Solid); } private void leftBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Left, BorderLineStyle.BoldSolid); } private void leftDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Left, BorderLineStyle.Dotted); } private void leftDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Left, BorderLineStyle.Dashed); } #endregion // Left Border #region Top Border private void topSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Top, BorderLineStyle.Solid); } private void topSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Top, BorderLineStyle.Solid); } private void topBlodToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Top, BorderLineStyle.BoldSolid); } private void topDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Top, BorderLineStyle.Dotted); } private void topDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Top, BorderLineStyle.Dashed); } #endregion // Top Border #region Bottom Border private void bottomToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Bottom, BorderLineStyle.Solid); } private void bottomSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Bottom, BorderLineStyle.Solid); } private void bottomBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Bottom, BorderLineStyle.BoldSolid); } private void bottomDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Bottom, BorderLineStyle.Dotted); } private void bottomDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Bottom, BorderLineStyle.Dashed); } #endregion // Bottom Border #region Right Border private void rightSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Right, BorderLineStyle.Solid); } private void rightSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Right, BorderLineStyle.Solid); } private void rightBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Right, BorderLineStyle.BoldSolid); } private void rightDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Right, BorderLineStyle.Dotted); } private void rightDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Right, BorderLineStyle.Dashed); } #endregion // Right Border #region Slash private void slashRightSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Slash, BorderLineStyle.Solid); } private void slashRightSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Slash, BorderLineStyle.Solid); } private void slashRightBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Slash, BorderLineStyle.BoldSolid); } private void slashRightDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Slash, BorderLineStyle.Dotted); } private void slashRightDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Slash, BorderLineStyle.Dashed); } #endregion // Slash #region Backslash private void slashLeftSolidToolStripButton_ButtonClick(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Backslash, BorderLineStyle.Solid); } private void slashLeftSolidToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Backslash, BorderLineStyle.Solid); } private void slashLeftBoldToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Backslash, BorderLineStyle.BoldSolid); } private void slashLeftDotToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Backslash, BorderLineStyle.Dotted); } private void slashLeftDashToolStripMenuItem_Click(object sender, EventArgs e) { SetSelectionBorder(BorderPositions.Backslash, BorderLineStyle.Dashed); } #endregion // Backslash #region Clear Borders private void clearBordersToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeBorderAction(CurrentWorksheet.SelectionRange, BorderPositions.All, new RangeBorderStyle { Color = Color.Empty, Style = BorderLineStyle.None })); } #endregion // Clear Borders #endregion // Border Settings #region Style private void backColorPickerToolStripButton_ColorPicked(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle() { Flag = PlainStyleFlag.BackColor, BackColor = backColorPickerToolStripButton.SolidColor, })); } private void textColorPickToolStripItem_ColorPicked(object sender, EventArgs e) { var color = textColorPickToolStripItem.SolidColor; if (color.IsEmpty) { GridControl.DoAction(new RemoveRangeStyleAction(CurrentWorksheet.SelectionRange, PlainStyleFlag.TextColor)); } else { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.TextColor, TextColor = color, })); } } private void boldToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontStyleBold, Bold = boldToolStripButton.Checked, })); } private void italicToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontStyleItalic, Italic = italicToolStripButton.Checked, })); } private void underlineToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontStyleUnderline, Underline = underlineToolStripButton.Checked, })); } private void strikethroughToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontStyleStrikethrough, Strikethrough = strikethroughToolStripButton.Checked, })); } private void styleBrushToolStripButton_Click(object sender, EventArgs e) { CurrentWorksheet.StartPickRangeAndCopyStyle(); } private void enlargeFontToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new StepRangeFontSizeAction(CurrentWorksheet.SelectionRange, true)); UpdateMenuAndToolStrips(); } private void fontSmallerToolStripButton_Click(object sender, EventArgs e) { GridControl.DoAction(new StepRangeFontSizeAction(CurrentWorksheet.SelectionRange, false)); UpdateMenuAndToolStrips(); } private void fontToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (isUIUpdating) return; GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontName, FontName = fontToolStripComboBox.Text, })); } private void fontSizeToolStripComboBox_TextChanged(object sender, EventArgs e) { SetGridFontSize(); } private void SetGridFontSize() { if (isUIUpdating) return; float size = 9; float.TryParse(fontSizeToolStripComboBox.Text, out size); if (size <= 0) size = 1f; GridControl.DoAction(new SetRangeStyleAction(CurrentWorksheet.SelectionRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.FontSize, FontSize = size, })); } #endregion #region Cell & Range private void MergeSelectionRange(object sender, EventArgs e) { try { GridControl.DoAction(new MergeRangeAction(CurrentWorksheet.SelectionRange)); } catch (RangeTooSmallException) { } catch (RangeIntersectionException) { MessageBox.Show(LangResource.Msg_Range_Intersection_Exception, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void UnmergeSelectionRange(object sender, EventArgs e) { GridControl.DoAction(new UnmergeRangeAction(CurrentWorksheet.SelectionRange)); } void resizeToolStripMenuItem_Click(object sender, EventArgs e) { var worksheet = CurrentWorksheet; using (var rgf = new ResizeGridDialog()) { rgf.Rows = worksheet.RowCount; rgf.Cols = worksheet.ColumnCount; if (rgf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { WorksheetActionGroup ag = new WorksheetActionGroup(); if (rgf.Rows < worksheet.RowCount) { ag.Actions.Add(new RemoveRowsAction(rgf.Rows, worksheet.RowCount - rgf.Rows)); } else if (rgf.Rows > worksheet.RowCount) { ag.Actions.Add(new InsertRowsAction(worksheet.RowCount, rgf.Rows - worksheet.RowCount)); } if (rgf.Cols < worksheet.ColumnCount) { ag.Actions.Add(new RemoveColumnsAction(rgf.Cols, worksheet.ColumnCount - rgf.Cols)); } else if (rgf.Cols > worksheet.ColumnCount) { ag.Actions.Add(new InsertColumnsAction(worksheet.ColumnCount, rgf.Cols - worksheet.ColumnCount)); } if (ag.Actions.Count > 0) { Cursor = Cursors.WaitCursor; try { GridControl.DoAction(ag); } finally { Cursor = Cursors.Default; } } } } } void ApplyFunctionToSelectedRange(string funName) { var sheet = CurrentWorksheet; var range = CurrentSelectionRange; // fill bottom rows if (range.Rows > 1) { for (int c = range.Col; c <= range.EndCol; c++) { var cell = sheet.Cells[range.EndRow, c]; if (string.IsNullOrEmpty(cell.DisplayText)) { cell.Formula = string.Format("{0}({1})", funName, RangePosition.FromCellPosition(range.Row, range.Col, range.EndRow - 1, c).ToAddress()); break; } } } // fill right columns if (range.Cols > 1) { for (int r = range.Row; r <= range.EndRow; r++) { var cell = sheet.Cells[r, range.EndCol]; if (string.IsNullOrEmpty(cell.DisplayText)) { cell.Formula = string.Format("{0}({1})", funName, RangePosition.FromCellPosition(range.Row, range.Col, r, range.EndCol - 1).ToAddress()); break; } } } } #endregion #region Context Menu private void insertColToolStripMenuItem_Click(object sender, EventArgs e) { if (CurrentSelectionRange.Cols >= 1) { GridControl.DoAction(new InsertColumnsAction(CurrentSelectionRange.Col, CurrentSelectionRange.Cols)); } } private void insertRowToolStripMenuItem_Click(object sender, EventArgs e) { if (CurrentSelectionRange.Rows >= 1) { GridControl.DoAction(new InsertRowsAction(CurrentSelectionRange.Row, CurrentSelectionRange.Rows)); } } private void deleteColumnToolStripMenuItem_Click(object sender, EventArgs e) { if (CurrentSelectionRange.Cols >= 1) { GridControl.DoAction(new RemoveColumnsAction(CurrentSelectionRange.Col, CurrentSelectionRange.Cols)); } } private void deleteRowsToolStripMenuItem_Click(object sender, EventArgs e) { if (CurrentSelectionRange.Rows >= 1) { GridControl.DoAction(new RemoveRowsAction(CurrentSelectionRange.Row, CurrentSelectionRange.Rows)); } } private void resetToDefaultWidthToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.DoAction(new SetColumnsWidthAction(CurrentSelectionRange.Col, CurrentSelectionRange.Cols, Worksheet.InitDefaultColumnWidth)); } private void resetToDefaultHeightToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.DoAction(new SetRowsHeightAction(CurrentSelectionRange.Row, CurrentSelectionRange.Rows, Worksheet.InitDefaultRowHeight)); } #endregion #region Debug Form #if DEBUG private DebugForm cellDebugForm = null; private DebugForm borderDebugForm = null; private void showDebugFormToolStripButton_Click(object sender, EventArgs e) { if (cellDebugForm == null) { cellDebugForm = new DebugForm(); cellDebugForm.VisibleChanged += (ss, se) => showDebugFormToolStripButton.Checked = cellDebugForm.Visible; } else if (cellDebugForm.Visible) { cellDebugForm.Visible = false; borderDebugForm.Visible = false; return; } cellDebugForm.Grid = CurrentWorksheet; if (!cellDebugForm.Visible) { cellDebugForm.InitTabType = DebugForm.InitTab.Grid; cellDebugForm.Show(this); } if (borderDebugForm == null) { borderDebugForm = new DebugForm(); borderDebugForm.Grid = CurrentWorksheet; } if (!borderDebugForm.Visible) { borderDebugForm.InitTabType = DebugForm.InitTab.Border; borderDebugForm.Show(this); } if (cellDebugForm.Visible || borderDebugForm.Visible) ResetDebugFormLocation(); } #endif // DEBUG protected override void OnShown(EventArgs eventArgs) { if (FormBorderStyle == FormBorderStyle.None) { languageToolStripMenuItem.DropDownItems.Clear(); languageToolStripMenuItem.Click += (s, e) => SetupUILanguage(); menuStrip1.Visible = false; toolStrip1.Visible = false; WindowState = FormWindowState.Maximized; header1.AllowDrop = false; header2.AllowDrop = false; } if (header2.Modified) header2.Selection = FilePathBar.SeletionType.AutoDetect; if (header1.Modified) header1.Selection = FilePathBar.SeletionType.AutoDetect; base.OnShown(eventArgs); } protected override void OnMove(EventArgs e) { base.OnMove(e); #if DEBUG ResetDebugFormLocation(); #endif // DEBUG } #if DEBUG private void ResetDebugFormLocation() { if (cellDebugForm != null && cellDebugForm.Visible) { cellDebugForm.Location = new Point(Right, Top); } if (borderDebugForm != null && borderDebugForm.Visible) { borderDebugForm.Location = new Point(cellDebugForm.Left, cellDebugForm.Bottom); } } #endif // DEBUG #endregion // Debug Form #region LCS alignment private void alignByLCSToolStripMenuItem_Click(object sender, EventArgs e) { AlignByLCS(); } private void AlignByLCS() { var range = CurrentSelectionRange; var sheet1 = grid1.CurrentWorksheet; var sheet2 = grid2.CurrentWorksheet; var lines1 = new string[range.Rows]; var lines2 = new string[range.Rows]; for (int r = range.Row; r <= range.EndRow; r++) { for (int c = range.Col; c <= range.EndCol; c++) { Cell cell; if (lines1[r] == null) lines1[r] = string.Empty; else lines1[r] += "\t"; if ((cell = sheet1.Cells[r, c]) != null) if (!string.IsNullOrEmpty(cell.DisplayText)) lines1[r] += cell.DisplayText; if (lines2[r] == null) lines2[r] = string.Empty; else lines2[r] += "\t"; if ((cell = sheet2.Cells[r, c]) != null) if (!string.IsNullOrEmpty(cell.DisplayText)) lines2[r] += cell.DisplayText; } } var items = my.utils.Diff.DiffText(lines1, lines2); var i = items.Length; if (i != 0) { // Undo/redo across LCS alignment is currently unsupported grid1.ClearActionHistory(); grid2.ClearActionHistory(); undoStack.Clear(); redoStack.Clear(); UpdateUndoRedoCmdUI(); do { var item = items[--i]; if (item.deletedA > item.insertedB) sheet2.InsertRows(item.StartB, item.deletedA - item.insertedB); if (item.insertedB > item.deletedA) sheet1.InsertRows(item.StartA, item.insertedB - item.deletedA); } while (i > 0); Rescan(RangePosition.EntireRange); } } #endregion #region Editing private void cutRangeToolStripMenuItem_Click(object sender, EventArgs e) { Cut(); } private void copyRangeToolStripMenuItem_Click(object sender, EventArgs e) { Copy(); } private void pasteRangeToolStripMenuItem_Click(object sender, EventArgs e) { Paste(); } private void Cut() { // Cut method will always perform action to do cut try { CurrentWorksheet.Cut(); } catch (RangeIntersectionException) { MessageBox.Show(LangResource.Msg_Range_Intersection_Exception); } catch { MessageBox.Show(LangResource.Msg_Operation_Aborted); } } private void Copy() { try { CurrentWorksheet.Copy(); } catch (RangeIntersectionException) { MessageBox.Show(LangResource.Msg_Range_Intersection_Exception); } catch { MessageBox.Show(LangResource.Msg_Operation_Aborted); } } private void Paste() { try { CurrentWorksheet.Paste(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void cutToolStripMenuItem_Click(object sender, EventArgs e) { cutToolStripButton.PerformClick(); } private void copyToolStripMenuItem_Click(object sender, EventArgs e) { copyToolStripButton.PerformClick(); } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { pasteToolStripButton.PerformClick(); } private void repeatLastActionToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.RepeatLastAction(CurrentWorksheet.SelectionRange); } private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) { CurrentWorksheet.SelectAll(); } private void FindNextDiff(int i, int j) { var sheet1 = grid1.CurrentWorksheet; var sheet2 = grid2.CurrentWorksheet; var n = Math.Max(sheet1.MaxContentRow, sheet2.MaxContentRow) + 1; var m = Math.Max(sheet1.MaxContentCol, sheet2.MaxContentCol) + 1; Cell cell, cell1, cell2; do { if (++i >= m) { i = 0; do { if (++j >= n) return; } while (sheet1.GetRowHeight(j) == 0 && sheet2.GetRowHeight(j) == 0); } cell1 = sheet1.GetCell(j, i); cell2 = sheet2.GetCell(j, i); cell = header1.Active ? cell1 : cell2; } while (cell != null && !cell.IsValidCell || Equals(cell1?.Data, cell2?.Data)); var pos = new CellPosition(j, i); grid1.CurrentWorksheet.FocusPos = pos; grid2.CurrentWorksheet.FocusPos = pos; } private void FindPrevDiff(int i, int j) { var sheet1 = grid1.CurrentWorksheet; var sheet2 = grid2.CurrentWorksheet; var n = Math.Max(sheet1.MaxContentRow, sheet2.MaxContentRow) + 1; var m = Math.Max(sheet1.MaxContentCol, sheet2.MaxContentCol) + 1; if (j == -1) j = n; Cell cell, cell1, cell2; do { if (i == 0) { do { if (j == 0) return; --j; } while (sheet1.GetRowHeight(j) == 0 && sheet2.GetRowHeight(j) == 0); i = m; } --i; cell1 = sheet1.GetCell(j, i); cell2 = sheet2.GetCell(j, i); cell = header1.Active ? cell1 : cell2; } while (cell != null && !cell.IsValidCell || Equals(cell1?.Data, cell2?.Data)); var pos = new CellPosition(j, i); grid1.CurrentWorksheet.FocusPos = pos; grid2.CurrentWorksheet.FocusPos = pos; } private void nextDiffToolStripButton_Click(object sender, EventArgs e) { FindNextDiff(GridControl.CurrentWorksheet.FocusPos.Col, GridControl.CurrentWorksheet.FocusPos.Row); } private void prevDiffToolStripButton_Click(object sender, EventArgs e) { FindPrevDiff(GridControl.CurrentWorksheet.FocusPos.Col, GridControl.CurrentWorksheet.FocusPos.Row); } private void firstDiffToolStripButton_Click(object sender, EventArgs e) { FindNextDiff(-1, 0); } private void lastDiffToolStripButton_Click(object sender, EventArgs e) { FindPrevDiff(0, -1); } private bool HasDifferences(RangePosition range) { var sheet1 = grid1.CurrentWorksheet; var sheet2 = grid2.CurrentWorksheet; for (var i = 0; i < range.Rows; ++i) { for (var j = 0; j < range.Cols; ++j) { var cell1 = sheet1.GetCell(range.Row + i, range.Col + j); var cell2 = sheet2.GetCell(range.Row + i, range.Col + j); if (cell1?.DiffFlag != 0 || cell2?.DiffFlag != 0) return true; } } return false; } private void left2rightToolStripButton_Click(object sender, EventArgs e) { var sheet = grid1.CurrentWorksheet; var currentCopingRange = sheet.SelectionRange; if (HasDifferences(currentCopingRange)) { var partialGrid = sheet.GetPartialGrid(currentCopingRange); grid2.DoAction(new SetPartialGridAction(currentCopingRange, partialGrid)); } } private void right2leftToolStripButton_Click(object sender, EventArgs e) { var sheet = grid2.CurrentWorksheet; var currentCopingRange = sheet.SelectionRange; if (HasDifferences(currentCopingRange)) { var partialGrid = sheet.GetPartialGrid(currentCopingRange); grid1.DoAction(new SetPartialGridAction(currentCopingRange, partialGrid)); } } #endregion // Editing #region Window private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Close(); } private void styleEditorToolStripMenuItem_Click(object sender, EventArgs e) { ControlAppearanceEditorForm styleEditor = new ControlAppearanceEditorForm(); styleEditor.Grid = GridControl; styleEditor.Show(this); } #endregion // Window #region View & Print private void formatCellToolStripMenuItem_Click(object sender, EventArgs e) { using (PropertyForm form = new PropertyForm(GridControl)) { form.ShowDialog(this); GridControl.Focus(); } } private void printPreviewToolStripMenuItem_Click(object sender, EventArgs e) { printPreviewToolStripButton.PerformClick(); } private void printPreviewToolStripButton_Click(object sender, EventArgs e) { try { GridControl.CurrentWorksheet.AutoSplitPage(); GridControl.CurrentWorksheet.EnableSettings(WorksheetSettings.View_ShowPageBreaks); } catch (Exception ex) { MessageBox.Show(this, ex.Message, Application.ProductName + " " + Application.ProductVersion, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (var session = GridControl.CurrentWorksheet.CreatePrintSession()) { using (PrintPreviewDialog ppd = new PrintPreviewDialog()) { ppd.Document = session.PrintDocument; ppd.SetBounds(200, 200, 1024, 768); ppd.PrintPreviewControl.Zoom = 1d; ppd.ShowDialog(this); } } } private void PrintToolStripMenuItem_Click(object sender, EventArgs e) { PrintSession session = null; try { session = CurrentWorksheet.CreatePrintSession(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (var pd = new System.Windows.Forms.PrintDialog()) { pd.Document = session.PrintDocument; pd.UseEXDialog = true; if (pd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { session.Print(); } } if (session != null) session.Dispose(); } void removeRowPageBreakToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.CurrentWorksheet.RemoveRowPageBreak(GridControl.CurrentWorksheet.FocusPos.Row); } void printSettingsToolStripMenuItem_Click(object sender, EventArgs e) { using (PrintSettingsDialog psf = new PrintSettingsDialog()) { var sheet = GridControl.CurrentWorksheet; if (sheet.PrintSettings == null) { sheet.PrintSettings = new PrintSettings(); } psf.PrintSettings = (PrintSettings)sheet.PrintSettings.Clone(); if (psf.ShowDialog() == System.Windows.Forms.DialogResult.OK) { sheet.PrintSettings = psf.PrintSettings; sheet.AutoSplitPage(); sheet.EnableSettings(WorksheetSettings.View_ShowPageBreaks); } } } void removeColPageBreakToolStripMenuItem_Click(object sender, EventArgs e) { try { GridControl.CurrentWorksheet.RemoveColumnPageBreak(GridControl.CurrentWorksheet.FocusPos.Col); } catch (Exception ex) { MessageBox.Show(ex.Message); } } void insertRowPageBreakToolStripMenuItem_Click(object sender, EventArgs e) { try { CurrentWorksheet.RowPageBreaks.Add(CurrentWorksheet.FocusPos.Row); } catch (Exception ex) { MessageBox.Show(ex.Message); } } void insertColPageBreakToolStripMenuItem_Click(object sender, EventArgs e) { CurrentWorksheet.ColumnPageBreaks.Add(CurrentWorksheet.FocusPos.Col); } #endregion // View & Print #region Freeze private void FreezeToEdge(FreezeArea freezePos) { var worksheet = CurrentWorksheet; if (!worksheet.SelectionRange.IsEmpty) { worksheet.FreezeToCell(worksheet.FocusPos, freezePos); UpdateMenuAndToolStrips(); } } private void unfreezeToolStripMenuItem_Click(object sender, EventArgs e) { CurrentWorksheet.Unfreeze(); UpdateMenuAndToolStrips(); } #endregion // Freeze #region Help private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { new AboutForm().ShowDialog(this); } #endregion #region Outline void groupRowsToolStripMenuItem_Click(object sender, EventArgs e) { try { GridControl.DoAction(new AddOutlineAction(RowOrColumn.Row, CurrentSelectionRange.Row, CurrentSelectionRange.Rows)); } catch (OutlineOutOfRangeException) { MessageBox.Show(LangResource.Msg_Outline_Out_Of_Range); } catch (OutlineAlreadyDefinedException) { MessageBox.Show(LangResource.Msg_Outline_Already_Exist); } catch (OutlineIntersectedException) { MessageBox.Show(LangResource.Msg_Outline_Intersected); } catch (OutlineTooMuchException) { MessageBox.Show(LangResource.Msg_Outline_Too_Much); } } void ungroupRowsToolStripMenuItem_Click(object sender, EventArgs e) { var removeOutlineAction = new RemoveOutlineAction(RowOrColumn.Row, CurrentSelectionRange.Row, CurrentSelectionRange.Rows); try { GridControl.DoAction(removeOutlineAction); } catch { } if (removeOutlineAction.RemovedOutline == null) { MessageBox.Show(LangResource.Msg_Outline_Not_Found); } } void groupColumnsToolStripMenuItem_Click(object sender, EventArgs e) { var worksheet = CurrentWorksheet; try { GridControl.DoAction(new AddOutlineAction(RowOrColumn.Column, CurrentSelectionRange.Col, CurrentSelectionRange.Cols)); } catch (OutlineOutOfRangeException) { MessageBox.Show(LangResource.Msg_Outline_Out_Of_Range); } catch (OutlineAlreadyDefinedException) { MessageBox.Show(LangResource.Msg_Outline_Already_Exist); } catch (OutlineIntersectedException) { MessageBox.Show(LangResource.Msg_Outline_Intersected); } catch (OutlineTooMuchException) { MessageBox.Show(LangResource.Msg_Outline_Too_Much); } } void ungroupColumnsToolStripMenuItem_Click(object sender, EventArgs e) { var removeOutlineAction = new RemoveOutlineAction(RowOrColumn.Column, CurrentSelectionRange.Col, CurrentSelectionRange.Cols); try { GridControl.DoAction(removeOutlineAction); } catch { } if (removeOutlineAction.RemovedOutline == null) { MessageBox.Show(LangResource.Msg_Outline_Not_Found); } } void ungroupAllRowsToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.DoAction(new ClearOutlineAction(RowOrColumn.Row)); } void ungroupAllColumnsToolStripMenuItem_Click(object sender, EventArgs e) { GridControl.DoAction(new ClearOutlineAction(RowOrColumn.Column)); } #endregion // Outline #region Filter private AutoColumnFilter columnFilter; void filterToolStripMenuItem_Click(object sender, EventArgs e) { if (columnFilter != null) { columnFilter.Detach(); } CreateAutoFilterAction action = new CreateAutoFilterAction(CurrentWorksheet.SelectionRange); GridControl.DoAction(action); columnFilter = action.AutoColumnFilter; } void clearFilterToolStripMenuItem_Click(object sender, EventArgs e) { if (columnFilter != null) { columnFilter.Detach(); } } #endregion // Filter private void Grid_Disposed(object sender, EventArgs e) { var grid = sender as ReoGridControl; grid.GotFocus -= Grid_GotFocus; grid.LostFocus -= Grid_LostFocus; grid.WorksheetInserted -= Grid_WorksheetInserted; grid.WorksheetRemoved -= Grid_WorksheetRemoved; grid.CurrentWorksheetChanged -= Grid_CurrentWorksheetChanged; grid.ActionPerformed -= Grid_ActionPerformed; grid.Disposed -= Grid_Disposed; } private void Grid_ActionPerformed(object sender, ActionEventArgs e) { var grid = sender as ReoGridControl; if (e.Behavior == ActionBehavior.Do) { redoStack.Clear(); undoStack.AddLast(e.Action); if (undoStack.Count() > 30) undoStack.RemoveFirst(); } else { grid.Focus(); } // TODO: Which actions are worth marking documents as dirty? if (e.Action as SetColumnsWidthAction == null && e.Action as SetRowsHeightAction == null && e.Action as CreateAutoFilterAction == null) { if (sender == grid1) { header1.Dirty = true; saveLeftToolStripMenuItem.Enabled = true; saveToolStripMenuItem.Enabled = true; saveToolStripButton.Enabled = true; } else if (sender == grid2) { header2.Dirty = true; saveRightToolStripMenuItem.Enabled = true; saveToolStripMenuItem.Enabled = true; saveToolStripButton.Enabled = true; } var roi = RangePosition.EntireRange; if (arg1 != null && arg2 != null) { // With CSV-alike files, assume no formula-driven changes // outside the range directly involved in this action. if (e.Action is SetCellDataAction setCellDataAction) { roi = new RangePosition(setCellDataAction.Row, setCellDataAction.Col, 1, 1); } else if (e.Action is WorksheetReusableAction reusableAction && reusableAction as InsertColumnsAction == null && reusableAction as RemoveColumnsAction == null && reusableAction as InsertRowsAction == null && reusableAction as RemoveRowsAction == null) { roi = reusableAction.Range; } } else if (grid.HasSettings(WorkbookSettings.Formula_AutoUpdateReferenceCell)) { grid.Recalculate(); } Rescan(roi); } UpdateMenuAndToolStrips(); } private void Grid_WorksheetInserted(object sender, WorksheetInsertedEventArgs e) { var worksheet = e.Worksheet; worksheet.SelectionRangeChanged += grid_SelectionRangeChanged; worksheet.SelectionModeChanged += worksheet_SelectionModeChanged; worksheet.SelectionStyleChanged += worksheet_SelectionModeChanged; worksheet.SelectionForwardDirectionChanged += worksheet_SelectionForwardDirectionChanged; worksheet.FocusPosStyleChanged += worksheet_SelectionModeChanged; worksheet.CellsFrozen += UpdateMenuAndToolStripsWhenAction; worksheet.Resetted += worksheet_Resetted; worksheet.SettingsChanged += worksheet_SettingsChanged; worksheet.Scaled += worksheet_GridScaled; worksheet.RowsHeightChanged += worksheet_RowsHeightChanged; worksheet.ColumnsWidthChanged += worksheet_ColumnsWidthChanged; grid_SelectionRangeChanged(worksheet, new RangeEventArgs(worksheet.SelectionRange)); } private void Grid_WorksheetRemoved(object sender, WorksheetRemovedEventArgs e) { var worksheet = e.Worksheet; worksheet.SelectionRangeChanged -= grid_SelectionRangeChanged; worksheet.SelectionModeChanged -= worksheet_SelectionModeChanged; worksheet.SelectionStyleChanged -= worksheet_SelectionModeChanged; worksheet.SelectionForwardDirectionChanged -= worksheet_SelectionForwardDirectionChanged; worksheet.FocusPosStyleChanged -= worksheet_SelectionModeChanged; worksheet.CellsFrozen -= UpdateMenuAndToolStripsWhenAction; worksheet.Resetted -= worksheet_Resetted; worksheet.SettingsChanged -= worksheet_SettingsChanged; worksheet.Scaled -= worksheet_GridScaled; worksheet.RowsHeightChanged -= worksheet_RowsHeightChanged; worksheet.ColumnsWidthChanged -= worksheet_ColumnsWidthChanged; } private void Grid_CurrentWorksheetChanged(object sender, System.EventArgs e) { var owner = sender as ReoGridControl; owner.CurrentWorksheet.SelectionStyle = owner.Focused ? WorksheetSelectionStyle.Hybrid : WorksheetSelectionStyle.Default; if (sender == GridControl) { grid_SelectionRangeChanged(CurrentWorksheet, new RangeEventArgs(CurrentWorksheet.SelectionRange)); worksheet_GridScaled(CurrentWorksheet, e); UpdateWorksheetSettings(CurrentWorksheet); UpdateSelectionModeAndStyle(); UpdateSelectionForwardDirection(); } Rescan(RangePosition.EntireRange); } private void Header_GotFocus(object sender, System.EventArgs e) { Grid_GotFocus(sender == header1 ? grid1 : grid2, e); } private void Grid_GotFocus(object sender, System.EventArgs e) { var owner = sender as ReoGridControl; if (formulaBar.GridControl != owner) { if (nameManagerForm != null) { nameManagerForm.Dispose(); nameManagerForm = null; } } // Reassign even if already assigned to keep the formulaBar updated formulaBar.GridControl = owner; header1.Active = GridControl == grid1; header2.Active = GridControl == grid2; UpdateGridFocus(sender); grid_SelectionRangeChanged(CurrentWorksheet, new RangeEventArgs(CurrentWorksheet.SelectionRange)); worksheet_GridScaled(CurrentWorksheet, e); UpdateWorksheetSettings(CurrentWorksheet); UpdateSelectionModeAndStyle(); UpdateSelectionForwardDirection(); } private void Grid_LostFocus(object sender, System.EventArgs e) { UpdateGridFocus(sender); toolStripButton_EnabledChanged(this, EventArgs.Empty); } private void UpdateGridFocus(object sender) { var owner = sender as ReoGridControl; owner.CurrentWorksheet.SelectionStyle = owner.Focused ? WorksheetSelectionStyle.Hybrid : WorksheetSelectionStyle.Default; var enable = owner.Focused; cutToolStripButton.Enabled = enable; cutToolStripMenuItem.Enabled = enable; pasteToolStripButton.Enabled = enable; pasteToolStripMenuItem.Enabled = enable; copyToolStripButton.Enabled = enable; copyToolStripMenuItem.Enabled = enable; undoToolStripButton.Enabled = enable; undoToolStripMenuItem.Enabled = enable; redoToolStripButton.Enabled = enable; redoToolStripMenuItem.Enabled = enable; repeatLastActionToolStripMenuItem.Enabled = enable; rowCutToolStripMenuItem.Enabled = enable; rowCopyToolStripMenuItem.Enabled = enable; rowPasteToolStripMenuItem.Enabled = enable; colCutToolStripMenuItem.Enabled = enable; colCopyToolStripMenuItem.Enabled = enable; colPasteToolStripMenuItem.Enabled = enable; } #if DEBUG private void ForTest() { var sheet = GridControl.CurrentWorksheet; } #endif // DEBUG } }
33.884071
148
0.745445
[ "BSD-3-Clause", "Apache-2.0", "MIT" ]
datadiode/ReoGrid
Compare/ReoGridCompare.cs
114,869
C#
/* * Copyright 2010-2014 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. */ /* * Do not modify this file. This file is generated from the codestar-notifications-2019-10-15.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Xml.Serialization; using Amazon.CodeStarNotifications.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.CodeStarNotifications.Model.Internal.MarshallTransformations { /// <summary> /// ListEventTypes Request Marshaller /// </summary> public class ListEventTypesRequestMarshaller : IMarshaller<IRequest, ListEventTypesRequest> , IMarshaller<IRequest,AmazonWebServiceRequest> { /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="input"></param> /// <returns></returns> public IRequest Marshall(AmazonWebServiceRequest input) { return this.Marshall((ListEventTypesRequest)input); } /// <summary> /// Marshaller the request object to the HTTP request. /// </summary> /// <param name="publicRequest"></param> /// <returns></returns> public IRequest Marshall(ListEventTypesRequest publicRequest) { IRequest request = new DefaultRequest(publicRequest, "Amazon.CodeStarNotifications"); request.Headers["Content-Type"] = "application/json"; request.Headers[Amazon.Util.HeaderKeys.XAmzApiVersion] = "2019-10-15"; request.HttpMethod = "POST"; request.ResourcePath = "/listEventTypes"; request.MarshallerVersion = 2; using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); var context = new JsonMarshallerContext(request, writer); if(publicRequest.IsSetFilters()) { context.Writer.WritePropertyName("Filters"); context.Writer.WriteArrayStart(); foreach(var publicRequestFiltersListValue in publicRequest.Filters) { context.Writer.WriteObjectStart(); var marshaller = ListEventTypesFilterMarshaller.Instance; marshaller.Marshall(publicRequestFiltersListValue, context); context.Writer.WriteObjectEnd(); } context.Writer.WriteArrayEnd(); } if(publicRequest.IsSetMaxResults()) { context.Writer.WritePropertyName("MaxResults"); context.Writer.Write(publicRequest.MaxResults); } if(publicRequest.IsSetNextToken()) { context.Writer.WritePropertyName("NextToken"); context.Writer.Write(publicRequest.NextToken); } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return request; } private static ListEventTypesRequestMarshaller _instance = new ListEventTypesRequestMarshaller(); internal static ListEventTypesRequestMarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static ListEventTypesRequestMarshaller Instance { get { return _instance; } } } }
36.168
143
0.609157
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/CodeStarNotifications/Generated/Model/Internal/MarshallTransformations/ListEventTypesRequestMarshaller.cs
4,521
C#
using System; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Text; using ILRuntime.Runtime.Enviorment; namespace ILRuntime.Runtime.CLRBinding { static class BindingGeneratorExtensions { internal static bool ShouldSkipField(this Type type, FieldInfo i) { if (i.IsPrivate) return true; //EventHandler is currently not supported if (i.IsSpecialName) { return true; } if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0) return true; return false; } internal static bool ShouldSkipMethod(this Type type, MethodBase i) { if (i.IsPrivate) return true; if (i.IsGenericMethodDefinition) return true; //EventHandler is currently not supported var param = i.GetParameters(); if (i.IsSpecialName) { string[] t = i.Name.Split('_'); if (t[0] == "add" || t[0] == "remove") return true; if (t[0] == "get" || t[0] == "set") { Type[] ts; if (t[1] == "Item") { var cnt = t[0] == "set" ? param.Length - 1 : param.Length; ts = new Type[cnt]; for (int j = 0; j < cnt; j++) { ts[j] = param[j].ParameterType; } } else ts = new Type[0]; var prop = type.GetProperty(t[1], ts); if (prop == null) { return true; } if (prop.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0) return true; } } if (i.GetCustomAttributes(typeof(ObsoleteAttribute), true).Length > 0) return true; foreach (var j in param) { if (j.ParameterType.IsPointer) return true; } return false; } internal static void AppendParameters(this ParameterInfo[] param, StringBuilder sb, bool isMultiArr = false, int skipLast = 0) { bool first = true; for (int i = 0; i < param.Length - skipLast; i++) { if (first) first = false; else sb.Append(", "); var j = param[i]; if (j.IsOut && j.ParameterType.IsByRef) sb.Append("out "); else if (j.ParameterType.IsByRef) sb.Append("ref "); if (isMultiArr) { sb.Append("a"); sb.Append(i + 1); } else { sb.Append("@"); sb.Append(j.Name); } } } internal static string GetRetrieveValueCode(this Type type, string realClsName) { if (type.IsByRef) type = type.GetElementType(); if (type.IsPrimitive) { if (type == typeof(int)) { return "ptr_of_this_method->Value"; } else if (type == typeof(long)) { return "*(long*)&ptr_of_this_method->Value"; } else if (type == typeof(short)) { return "(short)ptr_of_this_method->Value"; } else if (type == typeof(bool)) { return "ptr_of_this_method->Value == 1"; } else if (type == typeof(ushort)) { return "(ushort)ptr_of_this_method->Value"; } else if (type == typeof(float)) { return "*(float*)&ptr_of_this_method->Value"; } else if (type == typeof(double)) { return "*(double*)&ptr_of_this_method->Value"; } else if (type == typeof(byte)) { return "(byte)ptr_of_this_method->Value"; } else if (type == typeof(sbyte)) { return "(sbyte)ptr_of_this_method->Value"; } else if (type == typeof(uint)) { return "(uint)ptr_of_this_method->Value"; } else if (type == typeof(char)) { return "(char)ptr_of_this_method->Value"; } else if (type == typeof(ulong)) { return "*(ulong*)&ptr_of_this_method->Value"; } else throw new NotImplementedException(); } else { return string.Format("({0})typeof({0}).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack))", realClsName); } } internal static void GetRefWriteBackValueCode(this Type type, StringBuilder sb, string paramName) { if (type.IsPrimitive) { if (type == typeof(int)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(long)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Long;"); sb.Append(" *(long*)&___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(short)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(bool)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName + " ? 1 : 0;"); sb.AppendLine(";"); } else if (type == typeof(ushort)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(float)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Float;"); sb.Append(" *(float*)&___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(double)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Double;"); sb.Append(" *(double*)&___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(byte)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(sbyte)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = " + paramName); sb.AppendLine(";"); } else if (type == typeof(uint)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = (int)" + paramName); sb.AppendLine(";"); } else if (type == typeof(char)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Integer;"); sb.Append(" ___dst->Value = (int)" + paramName); sb.AppendLine(";"); } else if (type == typeof(ulong)) { sb.AppendLine(" ___dst->ObjectType = ObjectTypes.Long;"); sb.Append(" *(ulong*)&___dst->Value = " + paramName); sb.AppendLine(";"); } else throw new NotImplementedException(); } else { sb.Append(@" object ___obj = "); sb.Append(paramName); sb.AppendLine(";"); sb.AppendLine(@" if (___dst->ObjectType >= ObjectTypes.Object) { if (___obj is CrossBindingAdaptorType) ___obj = ((CrossBindingAdaptorType)___obj).ILInstance; __mStack[___dst->Value] = ___obj; } else { ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain); }"); /*if (!type.IsValueType) { sb.Append(@" object ___obj = "); sb.Append(paramName); sb.AppendLine(";"); sb.AppendLine(@" if (___obj is CrossBindingAdaptorType) ___obj = ((CrossBindingAdaptorType)___obj).ILInstance; __mStack[___dst->Value] = ___obj; "); } else { sb.Append(" __mStack[___dst->Value] = "); sb.Append(paramName); sb.AppendLine(";"); }*/ } } internal static void GetReturnValueCode(this Type type, StringBuilder sb) { if (type.IsPrimitive) { if (type == typeof(int)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method;"); } else if (type == typeof(long)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Long;"); sb.AppendLine(" *(long*)&__ret->Value = result_of_this_method;"); } else if (type == typeof(short)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method;"); } else if (type == typeof(bool)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method ? 1 : 0;"); } else if (type == typeof(ushort)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method;"); } else if (type == typeof(float)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Float;"); sb.AppendLine(" *(float*)&__ret->Value = result_of_this_method;"); } else if (type == typeof(double)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Double;"); sb.AppendLine(" *(double*)&__ret->Value = result_of_this_method;"); } else if (type == typeof(byte)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method;"); } else if (type == typeof(sbyte)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = result_of_this_method;"); } else if (type == typeof(uint)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = (int)result_of_this_method;"); } else if (type == typeof(char)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Integer;"); sb.AppendLine(" __ret->Value = (int)result_of_this_method;"); } else if (type == typeof(ulong)) { sb.AppendLine(" __ret->ObjectType = ObjectTypes.Long;"); sb.AppendLine(" *(ulong*)&__ret->Value = result_of_this_method;"); } else throw new NotImplementedException(); sb.AppendLine(" return __ret + 1;"); } else { string isBox; if (type == typeof(object)) isBox = ", true"; else isBox = ""; if (!type.IsSealed && type != typeof(ILRuntime.Runtime.Intepreter.ILTypeInstance)) { sb.Append(@" object obj_result_of_this_method = result_of_this_method; if(obj_result_of_this_method is CrossBindingAdaptorType) { return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance"); sb.Append(isBox); sb.AppendLine(@"); }"); } sb.AppendLine(string.Format(" return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method{0});", isBox)); } } } }
42.237705
146
0.391811
[ "MIT" ]
AlunWorker/ET-
Unity/Assets/ThirdParty/ILRuntime/ILRuntime/Runtime/CLRBinding/BindingGeneratorExtensions.cs
15,461
C#
/* Copyright 2017 James Craig 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 FileCurator.Formats.Data.Interfaces; using FileCurator.Formats.Interfaces; using System.IO; using System.Text; using System.Threading.Tasks; namespace FileCurator.Formats.Delimited { /// <summary> /// Delimited file writer /// </summary> /// <seealso cref="IGenericFileWriter"/> public class DelimitedWriter : IGenericFileWriter { /// <summary> /// Writes the file to the specified writer. /// </summary> /// <param name="writer">The writer.</param> /// <param name="file">The file.</param> /// <returns>True if it writes successfully, false otherwise.</returns> public bool Write(Stream writer, IGenericFile file) { if (writer is null || file is null) return false; var Builder = new StringBuilder(); if (file is ITable FileTable) { Builder.Append(CreateFromTable(FileTable)); } else { Builder.Append(CreateFromFile(file)); } var ByteData = Encoding.UTF8.GetBytes(Builder.ToString()); try { writer.Write(ByteData, 0, ByteData.Length); } catch { return false; } return true; } /// <summary> /// Writes the file to the specified writer. /// </summary> /// <param name="writer">The writer.</param> /// <param name="file">The file.</param> /// <returns>True if it writes successfully, false otherwise.</returns> public async Task<bool> WriteAsync(Stream writer, IGenericFile file) { if (writer is null || file is null) return false; var Builder = new StringBuilder(); if (file is ITable FileTable) { Builder.Append(CreateFromTable(FileTable)); } else { Builder.Append(CreateFromFile(file)); } var ByteData = Encoding.UTF8.GetBytes(Builder.ToString()); try { await writer.WriteAsync(ByteData, 0, ByteData.Length).ConfigureAwait(false); } catch { return false; } return true; } private string CreateFromFile(IGenericFile file) => "\"" + file?.ToString().Replace("\"", "") + "\""; /// <summary> /// Creates from table. /// </summary> /// <param name="fileTable">The file table.</param> /// <returns>The file data from a table object</returns> private string CreateFromTable(ITable fileTable) { var Builder = new StringBuilder(); var Seperator = ""; if (fileTable.Columns.Count > 0) { foreach (var HeaderColumn in fileTable.Columns) { Builder.Append(Seperator).Append("\"").Append(HeaderColumn?.Replace("\"", "") ?? "").Append("\""); Seperator = ","; } Builder.AppendLine(); } foreach (var Row in fileTable.Rows) { Seperator = ""; foreach (var CurrentCell in Row.Cells) { Builder.Append(Seperator).Append("\"").Append(CurrentCell.Content?.Replace("\"", "") ?? "").Append("\""); Seperator = ","; } Builder.AppendLine(); } return Builder.ToString(); } } }
34.611111
126
0.516166
[ "Apache-2.0" ]
JaCraig/FileCurator
src/FileCurator/Formats/Delimited/DelimitedWriter.cs
4,363
C#
/* * Copyright 2010-2014 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. */ /* * Do not modify this file. This file is generated from the workspaces-2015-04-08.normal.json service model. */ using System; using System.Runtime.ExceptionServices; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Amazon.WorkSpaces.Model; using Amazon.WorkSpaces.Model.Internal.MarshallTransformations; using Amazon.WorkSpaces.Internal; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Auth; using Amazon.Runtime.Internal.Transform; namespace Amazon.WorkSpaces { /// <summary> /// Implementation for accessing WorkSpaces /// /// Amazon WorkSpaces Service /// <para> /// Amazon WorkSpaces enables you to provision virtual, cloud-based Microsoft Windows /// and Amazon Linux desktops for your users. /// </para> /// </summary> public partial class AmazonWorkSpacesClient : AmazonServiceClient, IAmazonWorkSpaces { private static IServiceMetadata serviceMetadata = new AmazonWorkSpacesMetadata(); #region Constructors #if CORECLR /// <summary> /// Constructs AmazonWorkSpacesClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> public AmazonWorkSpacesClient() : base(FallbackCredentialsFactory.GetCredentials(), new AmazonWorkSpacesConfig()) { } /// <summary> /// Constructs AmazonWorkSpacesClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> /// <param name="region">The region to connect.</param> public AmazonWorkSpacesClient(RegionEndpoint region) : base(FallbackCredentialsFactory.GetCredentials(), new AmazonWorkSpacesConfig{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWorkSpacesClient with the credentials loaded from the application's /// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. /// /// Example App.config with credentials set. /// <code> /// &lt;?xml version="1.0" encoding="utf-8" ?&gt; /// &lt;configuration&gt; /// &lt;appSettings&gt; /// &lt;add key="AWSProfileName" value="AWS Default"/&gt; /// &lt;/appSettings&gt; /// &lt;/configuration&gt; /// </code> /// /// </summary> /// <param name="config">The AmazonWorkSpacesClient Configuration Object</param> public AmazonWorkSpacesClient(AmazonWorkSpacesConfig config) : base(FallbackCredentialsFactory.GetCredentials(), config) { } #endif /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Credentials /// </summary> /// <param name="credentials">AWS Credentials</param> public AmazonWorkSpacesClient(AWSCredentials credentials) : this(credentials, new AmazonWorkSpacesConfig()) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Credentials /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="region">The region to connect.</param> public AmazonWorkSpacesClient(AWSCredentials credentials, RegionEndpoint region) : this(credentials, new AmazonWorkSpacesConfig{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Credentials and an /// AmazonWorkSpacesClient Configuration object. /// </summary> /// <param name="credentials">AWS Credentials</param> /// <param name="clientConfig">The AmazonWorkSpacesClient Configuration Object</param> public AmazonWorkSpacesClient(AWSCredentials credentials, AmazonWorkSpacesConfig clientConfig) : base(credentials, clientConfig) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonWorkSpacesConfig()) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="region">The region to connect.</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonWorkSpacesConfig() {RegionEndpoint=region}) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID, AWS Secret Key and an /// AmazonWorkSpacesClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="clientConfig">The AmazonWorkSpacesClient Configuration Object</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonWorkSpacesConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWorkSpacesConfig()) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID and AWS Secret Key /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="region">The region to connect.</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonWorkSpacesConfig{RegionEndpoint = region}) { } /// <summary> /// Constructs AmazonWorkSpacesClient with AWS Access Key ID, AWS Secret Key and an /// AmazonWorkSpacesClient Configuration object. /// </summary> /// <param name="awsAccessKeyId">AWS Access Key ID</param> /// <param name="awsSecretAccessKey">AWS Secret Access Key</param> /// <param name="awsSessionToken">AWS Session Token</param> /// <param name="clientConfig">The AmazonWorkSpacesClient Configuration Object</param> public AmazonWorkSpacesClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonWorkSpacesConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { } #endregion #region Overrides /// <summary> /// Creates the signer for the service. /// </summary> protected override AbstractAWSSigner CreateSigner() { return new AWS4Signer(); } /// <summary> /// Capture metadata for the service. /// </summary> protected override IServiceMetadata ServiceMetadata { get { return serviceMetadata; } } #endregion #region Dispose /// <summary> /// Disposes the service client. /// </summary> protected override void Dispose(bool disposing) { base.Dispose(disposing); } #endregion #region AssociateIpGroups internal virtual AssociateIpGroupsResponse AssociateIpGroups(AssociateIpGroupsRequest request) { var marshaller = AssociateIpGroupsRequestMarshaller.Instance; var unmarshaller = AssociateIpGroupsResponseUnmarshaller.Instance; return Invoke<AssociateIpGroupsRequest,AssociateIpGroupsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the AssociateIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AssociateIpGroups operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AssociateIpGroups">REST API Reference for AssociateIpGroups Operation</seealso> public virtual Task<AssociateIpGroupsResponse> AssociateIpGroupsAsync(AssociateIpGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = AssociateIpGroupsRequestMarshaller.Instance; var unmarshaller = AssociateIpGroupsResponseUnmarshaller.Instance; return InvokeAsync<AssociateIpGroupsRequest,AssociateIpGroupsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region AuthorizeIpRules internal virtual AuthorizeIpRulesResponse AuthorizeIpRules(AuthorizeIpRulesRequest request) { var marshaller = AuthorizeIpRulesRequestMarshaller.Instance; var unmarshaller = AuthorizeIpRulesResponseUnmarshaller.Instance; return Invoke<AuthorizeIpRulesRequest,AuthorizeIpRulesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the AuthorizeIpRules operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the AuthorizeIpRules operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/AuthorizeIpRules">REST API Reference for AuthorizeIpRules Operation</seealso> public virtual Task<AuthorizeIpRulesResponse> AuthorizeIpRulesAsync(AuthorizeIpRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = AuthorizeIpRulesRequestMarshaller.Instance; var unmarshaller = AuthorizeIpRulesResponseUnmarshaller.Instance; return InvokeAsync<AuthorizeIpRulesRequest,AuthorizeIpRulesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region CreateIpGroup internal virtual CreateIpGroupResponse CreateIpGroup(CreateIpGroupRequest request) { var marshaller = CreateIpGroupRequestMarshaller.Instance; var unmarshaller = CreateIpGroupResponseUnmarshaller.Instance; return Invoke<CreateIpGroupRequest,CreateIpGroupResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the CreateIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateIpGroup operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateIpGroup">REST API Reference for CreateIpGroup Operation</seealso> public virtual Task<CreateIpGroupResponse> CreateIpGroupAsync(CreateIpGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = CreateIpGroupRequestMarshaller.Instance; var unmarshaller = CreateIpGroupResponseUnmarshaller.Instance; return InvokeAsync<CreateIpGroupRequest,CreateIpGroupResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region CreateTags internal virtual CreateTagsResponse CreateTags(CreateTagsRequest request) { var marshaller = CreateTagsRequestMarshaller.Instance; var unmarshaller = CreateTagsResponseUnmarshaller.Instance; return Invoke<CreateTagsRequest,CreateTagsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the CreateTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTags operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateTags">REST API Reference for CreateTags Operation</seealso> public virtual Task<CreateTagsResponse> CreateTagsAsync(CreateTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = CreateTagsRequestMarshaller.Instance; var unmarshaller = CreateTagsResponseUnmarshaller.Instance; return InvokeAsync<CreateTagsRequest,CreateTagsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region CreateWorkspaces internal virtual CreateWorkspacesResponse CreateWorkspaces(CreateWorkspacesRequest request) { var marshaller = CreateWorkspacesRequestMarshaller.Instance; var unmarshaller = CreateWorkspacesResponseUnmarshaller.Instance; return Invoke<CreateWorkspacesRequest,CreateWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the CreateWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/CreateWorkspaces">REST API Reference for CreateWorkspaces Operation</seealso> public virtual Task<CreateWorkspacesResponse> CreateWorkspacesAsync(CreateWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = CreateWorkspacesRequestMarshaller.Instance; var unmarshaller = CreateWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<CreateWorkspacesRequest,CreateWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DeleteIpGroup internal virtual DeleteIpGroupResponse DeleteIpGroup(DeleteIpGroupRequest request) { var marshaller = DeleteIpGroupRequestMarshaller.Instance; var unmarshaller = DeleteIpGroupResponseUnmarshaller.Instance; return Invoke<DeleteIpGroupRequest,DeleteIpGroupResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DeleteIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteIpGroup operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteIpGroup">REST API Reference for DeleteIpGroup Operation</seealso> public virtual Task<DeleteIpGroupResponse> DeleteIpGroupAsync(DeleteIpGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DeleteIpGroupRequestMarshaller.Instance; var unmarshaller = DeleteIpGroupResponseUnmarshaller.Instance; return InvokeAsync<DeleteIpGroupRequest,DeleteIpGroupResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DeleteTags internal virtual DeleteTagsResponse DeleteTags(DeleteTagsRequest request) { var marshaller = DeleteTagsRequestMarshaller.Instance; var unmarshaller = DeleteTagsResponseUnmarshaller.Instance; return Invoke<DeleteTagsRequest,DeleteTagsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DeleteTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteTags operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteTags">REST API Reference for DeleteTags Operation</seealso> public virtual Task<DeleteTagsResponse> DeleteTagsAsync(DeleteTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DeleteTagsRequestMarshaller.Instance; var unmarshaller = DeleteTagsResponseUnmarshaller.Instance; return InvokeAsync<DeleteTagsRequest,DeleteTagsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DeleteWorkspaceImage internal virtual DeleteWorkspaceImageResponse DeleteWorkspaceImage(DeleteWorkspaceImageRequest request) { var marshaller = DeleteWorkspaceImageRequestMarshaller.Instance; var unmarshaller = DeleteWorkspaceImageResponseUnmarshaller.Instance; return Invoke<DeleteWorkspaceImageRequest,DeleteWorkspaceImageResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DeleteWorkspaceImage operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteWorkspaceImage operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DeleteWorkspaceImage">REST API Reference for DeleteWorkspaceImage Operation</seealso> public virtual Task<DeleteWorkspaceImageResponse> DeleteWorkspaceImageAsync(DeleteWorkspaceImageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DeleteWorkspaceImageRequestMarshaller.Instance; var unmarshaller = DeleteWorkspaceImageResponseUnmarshaller.Instance; return InvokeAsync<DeleteWorkspaceImageRequest,DeleteWorkspaceImageResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeAccount internal virtual DescribeAccountResponse DescribeAccount(DescribeAccountRequest request) { var marshaller = DescribeAccountRequestMarshaller.Instance; var unmarshaller = DescribeAccountResponseUnmarshaller.Instance; return Invoke<DescribeAccountRequest,DescribeAccountResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeAccount operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAccount operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccount">REST API Reference for DescribeAccount Operation</seealso> public virtual Task<DescribeAccountResponse> DescribeAccountAsync(DescribeAccountRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeAccountRequestMarshaller.Instance; var unmarshaller = DescribeAccountResponseUnmarshaller.Instance; return InvokeAsync<DescribeAccountRequest,DescribeAccountResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeAccountModifications internal virtual DescribeAccountModificationsResponse DescribeAccountModifications(DescribeAccountModificationsRequest request) { var marshaller = DescribeAccountModificationsRequestMarshaller.Instance; var unmarshaller = DescribeAccountModificationsResponseUnmarshaller.Instance; return Invoke<DescribeAccountModificationsRequest,DescribeAccountModificationsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeAccountModifications operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAccountModifications operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeAccountModifications">REST API Reference for DescribeAccountModifications Operation</seealso> public virtual Task<DescribeAccountModificationsResponse> DescribeAccountModificationsAsync(DescribeAccountModificationsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeAccountModificationsRequestMarshaller.Instance; var unmarshaller = DescribeAccountModificationsResponseUnmarshaller.Instance; return InvokeAsync<DescribeAccountModificationsRequest,DescribeAccountModificationsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeClientProperties internal virtual DescribeClientPropertiesResponse DescribeClientProperties(DescribeClientPropertiesRequest request) { var marshaller = DescribeClientPropertiesRequestMarshaller.Instance; var unmarshaller = DescribeClientPropertiesResponseUnmarshaller.Instance; return Invoke<DescribeClientPropertiesRequest,DescribeClientPropertiesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeClientProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeClientProperties operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeClientProperties">REST API Reference for DescribeClientProperties Operation</seealso> public virtual Task<DescribeClientPropertiesResponse> DescribeClientPropertiesAsync(DescribeClientPropertiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeClientPropertiesRequestMarshaller.Instance; var unmarshaller = DescribeClientPropertiesResponseUnmarshaller.Instance; return InvokeAsync<DescribeClientPropertiesRequest,DescribeClientPropertiesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeIpGroups internal virtual DescribeIpGroupsResponse DescribeIpGroups(DescribeIpGroupsRequest request) { var marshaller = DescribeIpGroupsRequestMarshaller.Instance; var unmarshaller = DescribeIpGroupsResponseUnmarshaller.Instance; return Invoke<DescribeIpGroupsRequest,DescribeIpGroupsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeIpGroups operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeIpGroups">REST API Reference for DescribeIpGroups Operation</seealso> public virtual Task<DescribeIpGroupsResponse> DescribeIpGroupsAsync(DescribeIpGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeIpGroupsRequestMarshaller.Instance; var unmarshaller = DescribeIpGroupsResponseUnmarshaller.Instance; return InvokeAsync<DescribeIpGroupsRequest,DescribeIpGroupsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeTags internal virtual DescribeTagsResponse DescribeTags(DescribeTagsRequest request) { var marshaller = DescribeTagsRequestMarshaller.Instance; var unmarshaller = DescribeTagsResponseUnmarshaller.Instance; return Invoke<DescribeTagsRequest,DescribeTagsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeTags operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeTags operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeTags">REST API Reference for DescribeTags Operation</seealso> public virtual Task<DescribeTagsResponse> DescribeTagsAsync(DescribeTagsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeTagsRequestMarshaller.Instance; var unmarshaller = DescribeTagsResponseUnmarshaller.Instance; return InvokeAsync<DescribeTagsRequest,DescribeTagsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeWorkspaceBundles internal virtual DescribeWorkspaceBundlesResponse DescribeWorkspaceBundles(DescribeWorkspaceBundlesRequest request) { var marshaller = DescribeWorkspaceBundlesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceBundlesResponseUnmarshaller.Instance; return Invoke<DescribeWorkspaceBundlesRequest,DescribeWorkspaceBundlesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Retrieves a list that describes the available WorkSpace bundles. /// /// /// <para> /// You can filter the results using either bundle ID or owner, but not both. /// </para> /// </summary> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeWorkspaceBundles service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> public virtual Task<DescribeWorkspaceBundlesResponse> DescribeWorkspaceBundlesAsync(System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new DescribeWorkspaceBundlesRequest(); return DescribeWorkspaceBundlesAsync(request, cancellationToken); } /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceBundles operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceBundles operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceBundles">REST API Reference for DescribeWorkspaceBundles Operation</seealso> public virtual Task<DescribeWorkspaceBundlesResponse> DescribeWorkspaceBundlesAsync(DescribeWorkspaceBundlesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeWorkspaceBundlesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceBundlesResponseUnmarshaller.Instance; return InvokeAsync<DescribeWorkspaceBundlesRequest,DescribeWorkspaceBundlesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeWorkspaceDirectories internal virtual DescribeWorkspaceDirectoriesResponse DescribeWorkspaceDirectories(DescribeWorkspaceDirectoriesRequest request) { var marshaller = DescribeWorkspaceDirectoriesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceDirectoriesResponseUnmarshaller.Instance; return Invoke<DescribeWorkspaceDirectoriesRequest,DescribeWorkspaceDirectoriesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Describes the available AWS Directory Service directories that are registered with /// Amazon WorkSpaces. /// </summary> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeWorkspaceDirectories service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> public virtual Task<DescribeWorkspaceDirectoriesResponse> DescribeWorkspaceDirectoriesAsync(System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new DescribeWorkspaceDirectoriesRequest(); return DescribeWorkspaceDirectoriesAsync(request, cancellationToken); } /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceDirectories operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceDirectories operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceDirectories">REST API Reference for DescribeWorkspaceDirectories Operation</seealso> public virtual Task<DescribeWorkspaceDirectoriesResponse> DescribeWorkspaceDirectoriesAsync(DescribeWorkspaceDirectoriesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeWorkspaceDirectoriesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceDirectoriesResponseUnmarshaller.Instance; return InvokeAsync<DescribeWorkspaceDirectoriesRequest,DescribeWorkspaceDirectoriesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeWorkspaceImages internal virtual DescribeWorkspaceImagesResponse DescribeWorkspaceImages(DescribeWorkspaceImagesRequest request) { var marshaller = DescribeWorkspaceImagesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceImagesResponseUnmarshaller.Instance; return Invoke<DescribeWorkspaceImagesRequest,DescribeWorkspaceImagesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaceImages operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaceImages operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaceImages">REST API Reference for DescribeWorkspaceImages Operation</seealso> public virtual Task<DescribeWorkspaceImagesResponse> DescribeWorkspaceImagesAsync(DescribeWorkspaceImagesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeWorkspaceImagesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspaceImagesResponseUnmarshaller.Instance; return InvokeAsync<DescribeWorkspaceImagesRequest,DescribeWorkspaceImagesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeWorkspaces internal virtual DescribeWorkspacesResponse DescribeWorkspaces(DescribeWorkspacesRequest request) { var marshaller = DescribeWorkspacesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspacesResponseUnmarshaller.Instance; return Invoke<DescribeWorkspacesRequest,DescribeWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Describes the specified WorkSpaces. /// /// /// <para> /// You can filter the results by using the bundle identifier, directory identifier, or /// owner, but you can specify only one filter at a time. /// </para> /// </summary> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeWorkspaces service method, as returned by WorkSpaces.</returns> /// <exception cref="Amazon.WorkSpaces.Model.InvalidParameterValuesException"> /// One or more parameter values are not valid. /// </exception> /// <exception cref="Amazon.WorkSpaces.Model.ResourceUnavailableException"> /// The specified resource is not available. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> public virtual Task<DescribeWorkspacesResponse> DescribeWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new DescribeWorkspacesRequest(); return DescribeWorkspacesAsync(request, cancellationToken); } /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspaces">REST API Reference for DescribeWorkspaces Operation</seealso> public virtual Task<DescribeWorkspacesResponse> DescribeWorkspacesAsync(DescribeWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeWorkspacesRequestMarshaller.Instance; var unmarshaller = DescribeWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<DescribeWorkspacesRequest,DescribeWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DescribeWorkspacesConnectionStatus internal virtual DescribeWorkspacesConnectionStatusResponse DescribeWorkspacesConnectionStatus(DescribeWorkspacesConnectionStatusRequest request) { var marshaller = DescribeWorkspacesConnectionStatusRequestMarshaller.Instance; var unmarshaller = DescribeWorkspacesConnectionStatusResponseUnmarshaller.Instance; return Invoke<DescribeWorkspacesConnectionStatusRequest,DescribeWorkspacesConnectionStatusResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DescribeWorkspacesConnectionStatus operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeWorkspacesConnectionStatus operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DescribeWorkspacesConnectionStatus">REST API Reference for DescribeWorkspacesConnectionStatus Operation</seealso> public virtual Task<DescribeWorkspacesConnectionStatusResponse> DescribeWorkspacesConnectionStatusAsync(DescribeWorkspacesConnectionStatusRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DescribeWorkspacesConnectionStatusRequestMarshaller.Instance; var unmarshaller = DescribeWorkspacesConnectionStatusResponseUnmarshaller.Instance; return InvokeAsync<DescribeWorkspacesConnectionStatusRequest,DescribeWorkspacesConnectionStatusResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region DisassociateIpGroups internal virtual DisassociateIpGroupsResponse DisassociateIpGroups(DisassociateIpGroupsRequest request) { var marshaller = DisassociateIpGroupsRequestMarshaller.Instance; var unmarshaller = DisassociateIpGroupsResponseUnmarshaller.Instance; return Invoke<DisassociateIpGroupsRequest,DisassociateIpGroupsResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the DisassociateIpGroups operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DisassociateIpGroups operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/DisassociateIpGroups">REST API Reference for DisassociateIpGroups Operation</seealso> public virtual Task<DisassociateIpGroupsResponse> DisassociateIpGroupsAsync(DisassociateIpGroupsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = DisassociateIpGroupsRequestMarshaller.Instance; var unmarshaller = DisassociateIpGroupsResponseUnmarshaller.Instance; return InvokeAsync<DisassociateIpGroupsRequest,DisassociateIpGroupsResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ImportWorkspaceImage internal virtual ImportWorkspaceImageResponse ImportWorkspaceImage(ImportWorkspaceImageRequest request) { var marshaller = ImportWorkspaceImageRequestMarshaller.Instance; var unmarshaller = ImportWorkspaceImageResponseUnmarshaller.Instance; return Invoke<ImportWorkspaceImageRequest,ImportWorkspaceImageResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ImportWorkspaceImage operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ImportWorkspaceImage operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ImportWorkspaceImage">REST API Reference for ImportWorkspaceImage Operation</seealso> public virtual Task<ImportWorkspaceImageResponse> ImportWorkspaceImageAsync(ImportWorkspaceImageRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ImportWorkspaceImageRequestMarshaller.Instance; var unmarshaller = ImportWorkspaceImageResponseUnmarshaller.Instance; return InvokeAsync<ImportWorkspaceImageRequest,ImportWorkspaceImageResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ListAvailableManagementCidrRanges internal virtual ListAvailableManagementCidrRangesResponse ListAvailableManagementCidrRanges(ListAvailableManagementCidrRangesRequest request) { var marshaller = ListAvailableManagementCidrRangesRequestMarshaller.Instance; var unmarshaller = ListAvailableManagementCidrRangesResponseUnmarshaller.Instance; return Invoke<ListAvailableManagementCidrRangesRequest,ListAvailableManagementCidrRangesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ListAvailableManagementCidrRanges operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListAvailableManagementCidrRanges operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ListAvailableManagementCidrRanges">REST API Reference for ListAvailableManagementCidrRanges Operation</seealso> public virtual Task<ListAvailableManagementCidrRangesResponse> ListAvailableManagementCidrRangesAsync(ListAvailableManagementCidrRangesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ListAvailableManagementCidrRangesRequestMarshaller.Instance; var unmarshaller = ListAvailableManagementCidrRangesResponseUnmarshaller.Instance; return InvokeAsync<ListAvailableManagementCidrRangesRequest,ListAvailableManagementCidrRangesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ModifyAccount internal virtual ModifyAccountResponse ModifyAccount(ModifyAccountRequest request) { var marshaller = ModifyAccountRequestMarshaller.Instance; var unmarshaller = ModifyAccountResponseUnmarshaller.Instance; return Invoke<ModifyAccountRequest,ModifyAccountResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ModifyAccount operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyAccount operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyAccount">REST API Reference for ModifyAccount Operation</seealso> public virtual Task<ModifyAccountResponse> ModifyAccountAsync(ModifyAccountRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ModifyAccountRequestMarshaller.Instance; var unmarshaller = ModifyAccountResponseUnmarshaller.Instance; return InvokeAsync<ModifyAccountRequest,ModifyAccountResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ModifyClientProperties internal virtual ModifyClientPropertiesResponse ModifyClientProperties(ModifyClientPropertiesRequest request) { var marshaller = ModifyClientPropertiesRequestMarshaller.Instance; var unmarshaller = ModifyClientPropertiesResponseUnmarshaller.Instance; return Invoke<ModifyClientPropertiesRequest,ModifyClientPropertiesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ModifyClientProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyClientProperties operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyClientProperties">REST API Reference for ModifyClientProperties Operation</seealso> public virtual Task<ModifyClientPropertiesResponse> ModifyClientPropertiesAsync(ModifyClientPropertiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ModifyClientPropertiesRequestMarshaller.Instance; var unmarshaller = ModifyClientPropertiesResponseUnmarshaller.Instance; return InvokeAsync<ModifyClientPropertiesRequest,ModifyClientPropertiesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ModifyWorkspaceProperties internal virtual ModifyWorkspacePropertiesResponse ModifyWorkspaceProperties(ModifyWorkspacePropertiesRequest request) { var marshaller = ModifyWorkspacePropertiesRequestMarshaller.Instance; var unmarshaller = ModifyWorkspacePropertiesResponseUnmarshaller.Instance; return Invoke<ModifyWorkspacePropertiesRequest,ModifyWorkspacePropertiesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceProperties operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceProperties operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceProperties">REST API Reference for ModifyWorkspaceProperties Operation</seealso> public virtual Task<ModifyWorkspacePropertiesResponse> ModifyWorkspacePropertiesAsync(ModifyWorkspacePropertiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ModifyWorkspacePropertiesRequestMarshaller.Instance; var unmarshaller = ModifyWorkspacePropertiesResponseUnmarshaller.Instance; return InvokeAsync<ModifyWorkspacePropertiesRequest,ModifyWorkspacePropertiesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region ModifyWorkspaceState internal virtual ModifyWorkspaceStateResponse ModifyWorkspaceState(ModifyWorkspaceStateRequest request) { var marshaller = ModifyWorkspaceStateRequestMarshaller.Instance; var unmarshaller = ModifyWorkspaceStateResponseUnmarshaller.Instance; return Invoke<ModifyWorkspaceStateRequest,ModifyWorkspaceStateResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the ModifyWorkspaceState operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyWorkspaceState operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/ModifyWorkspaceState">REST API Reference for ModifyWorkspaceState Operation</seealso> public virtual Task<ModifyWorkspaceStateResponse> ModifyWorkspaceStateAsync(ModifyWorkspaceStateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ModifyWorkspaceStateRequestMarshaller.Instance; var unmarshaller = ModifyWorkspaceStateResponseUnmarshaller.Instance; return InvokeAsync<ModifyWorkspaceStateRequest,ModifyWorkspaceStateResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region RebootWorkspaces internal virtual RebootWorkspacesResponse RebootWorkspaces(RebootWorkspacesRequest request) { var marshaller = RebootWorkspacesRequestMarshaller.Instance; var unmarshaller = RebootWorkspacesResponseUnmarshaller.Instance; return Invoke<RebootWorkspacesRequest,RebootWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the RebootWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebootWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebootWorkspaces">REST API Reference for RebootWorkspaces Operation</seealso> public virtual Task<RebootWorkspacesResponse> RebootWorkspacesAsync(RebootWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = RebootWorkspacesRequestMarshaller.Instance; var unmarshaller = RebootWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<RebootWorkspacesRequest,RebootWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region RebuildWorkspaces internal virtual RebuildWorkspacesResponse RebuildWorkspaces(RebuildWorkspacesRequest request) { var marshaller = RebuildWorkspacesRequestMarshaller.Instance; var unmarshaller = RebuildWorkspacesResponseUnmarshaller.Instance; return Invoke<RebuildWorkspacesRequest,RebuildWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the RebuildWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RebuildWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RebuildWorkspaces">REST API Reference for RebuildWorkspaces Operation</seealso> public virtual Task<RebuildWorkspacesResponse> RebuildWorkspacesAsync(RebuildWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = RebuildWorkspacesRequestMarshaller.Instance; var unmarshaller = RebuildWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<RebuildWorkspacesRequest,RebuildWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region RevokeIpRules internal virtual RevokeIpRulesResponse RevokeIpRules(RevokeIpRulesRequest request) { var marshaller = RevokeIpRulesRequestMarshaller.Instance; var unmarshaller = RevokeIpRulesResponseUnmarshaller.Instance; return Invoke<RevokeIpRulesRequest,RevokeIpRulesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the RevokeIpRules operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RevokeIpRules operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/RevokeIpRules">REST API Reference for RevokeIpRules Operation</seealso> public virtual Task<RevokeIpRulesResponse> RevokeIpRulesAsync(RevokeIpRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = RevokeIpRulesRequestMarshaller.Instance; var unmarshaller = RevokeIpRulesResponseUnmarshaller.Instance; return InvokeAsync<RevokeIpRulesRequest,RevokeIpRulesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region StartWorkspaces internal virtual StartWorkspacesResponse StartWorkspaces(StartWorkspacesRequest request) { var marshaller = StartWorkspacesRequestMarshaller.Instance; var unmarshaller = StartWorkspacesResponseUnmarshaller.Instance; return Invoke<StartWorkspacesRequest,StartWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the StartWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StartWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StartWorkspaces">REST API Reference for StartWorkspaces Operation</seealso> public virtual Task<StartWorkspacesResponse> StartWorkspacesAsync(StartWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = StartWorkspacesRequestMarshaller.Instance; var unmarshaller = StartWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<StartWorkspacesRequest,StartWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region StopWorkspaces internal virtual StopWorkspacesResponse StopWorkspaces(StopWorkspacesRequest request) { var marshaller = StopWorkspacesRequestMarshaller.Instance; var unmarshaller = StopWorkspacesResponseUnmarshaller.Instance; return Invoke<StopWorkspacesRequest,StopWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the StopWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the StopWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/StopWorkspaces">REST API Reference for StopWorkspaces Operation</seealso> public virtual Task<StopWorkspacesResponse> StopWorkspacesAsync(StopWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = StopWorkspacesRequestMarshaller.Instance; var unmarshaller = StopWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<StopWorkspacesRequest,StopWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region TerminateWorkspaces internal virtual TerminateWorkspacesResponse TerminateWorkspaces(TerminateWorkspacesRequest request) { var marshaller = TerminateWorkspacesRequestMarshaller.Instance; var unmarshaller = TerminateWorkspacesResponseUnmarshaller.Instance; return Invoke<TerminateWorkspacesRequest,TerminateWorkspacesResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the TerminateWorkspaces operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the TerminateWorkspaces operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/TerminateWorkspaces">REST API Reference for TerminateWorkspaces Operation</seealso> public virtual Task<TerminateWorkspacesResponse> TerminateWorkspacesAsync(TerminateWorkspacesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = TerminateWorkspacesRequestMarshaller.Instance; var unmarshaller = TerminateWorkspacesResponseUnmarshaller.Instance; return InvokeAsync<TerminateWorkspacesRequest,TerminateWorkspacesResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion #region UpdateRulesOfIpGroup internal virtual UpdateRulesOfIpGroupResponse UpdateRulesOfIpGroup(UpdateRulesOfIpGroupRequest request) { var marshaller = UpdateRulesOfIpGroupRequestMarshaller.Instance; var unmarshaller = UpdateRulesOfIpGroupResponseUnmarshaller.Instance; return Invoke<UpdateRulesOfIpGroupRequest,UpdateRulesOfIpGroupResponse>(request, marshaller, unmarshaller); } /// <summary> /// Initiates the asynchronous execution of the UpdateRulesOfIpGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateRulesOfIpGroup operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/workspaces-2015-04-08/UpdateRulesOfIpGroup">REST API Reference for UpdateRulesOfIpGroup Operation</seealso> public virtual Task<UpdateRulesOfIpGroupResponse> UpdateRulesOfIpGroupAsync(UpdateRulesOfIpGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = UpdateRulesOfIpGroupRequestMarshaller.Instance; var unmarshaller = UpdateRulesOfIpGroupResponseUnmarshaller.Instance; return InvokeAsync<UpdateRulesOfIpGroupRequest,UpdateRulesOfIpGroupResponse>(request, marshaller, unmarshaller, cancellationToken); } #endregion } }
51.362556
245
0.700307
[ "Apache-2.0" ]
DalavanCloud/aws-sdk-net
sdk/src/Services/WorkSpaces/Generated/_mobile/AmazonWorkSpacesClient.cs
69,134
C#
namespace Kabatra.Common.LabelRetriever.Cultures { /// <summary> /// Sets the culture for the application, used to control translation. /// </summary> /// <seealso href="http://www.lingoes.net/en/translator/langcode.htm"/> public class Languages { public string Value { get; set; } public static Languages EnglishUnitedStates => new Languages("en-US"); public static Languages SpanishSpain => new Languages("es-ES"); /// <summary> /// Constructor. /// </summary> /// <param name="value">The Culture Info that will be used for translation.</param> private Languages(string value) { Value = value; } } }
30.541667
91
0.593452
[ "MIT" ]
kevinkabatra/Kabatra.Common.LabelRetriever
Kabatra.Common.LabelRetriever/Cultures/Languages.cs
735
C#
using Microsoft.AspNetCore.Components; namespace vNext.BlazorComponents.Grid { public partial class Cell<TRow> : ComponentBase { protected internal bool ShouldRenderFlag { get; set; } = true; [CascadingParameter] public Row<TRow> Row { get; set; } = default!; [Parameter] public ColumnDef<TRow> ColumnDef { get; set; } = default!; public TRow Data => Row.Data!; internal void Invalidate() { ShouldRenderFlag = true; //clean all precalculated assets here } public void Refresh() { Invalidate(); StateHasChanged(); } protected override bool ShouldRender() => ShouldRenderFlag; private string ResolveCssClass() { string result = "sg-cell "; if (ColumnDef.IsFrozen) { result += "sg-cell-frozen "; } if (ColumnDef.CellClass != null) { result += ColumnDef.CellClass; } if (ColumnDef.CellClassSelector != null) { result += " " + ColumnDef.CellClassSelector(this); } return result; } } }
26.382979
78
0.521774
[ "MIT" ]
Liero/vNext.BlazorComponents
BlazorComponents/Grid/Cell.razor.cs
1,242
C#
using Metrics; using Metrics.Core; namespace Api.Sample.HealthChecks { public class SampleHealthCheckUnHealthy : HealthCheck { public SampleHealthCheckUnHealthy() : base("Sample UnHealthy") { } protected override HealthCheckResult Check() { return HealthCheckResult.Unhealthy("OOPS"); } } }
21.470588
70
0.635616
[ "Apache-2.0" ]
alhardy/aspnet-metrics
src/Api.Sample/HealthChecks/SampleHealthCheckUnHealthy.cs
367
C#
using System; using System.Collections.Generic; using System.Text; namespace Tizen.NUI { internal static partial class Interop { internal static partial class Stage { static Stage() { ulong ret = Interop.Util.GetNanoSeconds(); Tizen.Log.Error("NUI", "Stage : " + ret); } [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_DEFAULT_BACKGROUND_COLOR_get")] public static extern global::System.IntPtr Stage_DEFAULT_BACKGROUND_COLOR_get(); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_DEBUG_BACKGROUND_COLOR_get")] public static extern global::System.IntPtr Stage_DEBUG_BACKGROUND_COLOR_get(); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Stage__SWIG_0")] public static extern global::System.IntPtr new_Stage__SWIG_0(); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetCurrent")] public static extern global::System.IntPtr Stage_GetCurrent(); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_IsInstalled")] public static extern bool Stage_IsInstalled(); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_Stage")] public static extern void delete_Stage(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Stage__SWIG_1")] public static extern global::System.IntPtr new_Stage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_Assign")] public static extern global::System.IntPtr Stage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_Add")] public static extern void Stage_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_Remove")] public static extern void Stage_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetSize")] public static extern global::System.IntPtr Stage_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetRenderTaskList")] public static extern global::System.IntPtr Stage_GetRenderTaskList(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetLayerCount")] public static extern uint Stage_GetLayerCount(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetLayer")] public static extern global::System.IntPtr Stage_GetLayer(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetRootLayer")] public static extern global::System.IntPtr Stage_GetRootLayer(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_SetBackgroundColor")] public static extern void Stage_SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetBackgroundColor")] public static extern global::System.IntPtr Stage_GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetDpi")] public static extern global::System.IntPtr Stage_GetDpi(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetObjectRegistry")] public static extern global::System.IntPtr Stage_GetObjectRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_KeepRendering")] public static extern void Stage_KeepRendering(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_SetRenderingBehavior")] public static extern void Stage_SetRenderingBehavior(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_GetRenderingBehavior")] public static extern int Stage_GetRenderingBehavior(global::System.Runtime.InteropServices.HandleRef jarg1); [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Stage_SWIGUpcast")] public static extern global::System.IntPtr Stage_SWIGUpcast(global::System.IntPtr jarg1); } } }
71.678161
180
0.753047
[ "Apache-2.0", "MIT" ]
Ali-Alzyoud/TizenFX
src/Tizen.NUI/src/internal/Interop/Interop.Stage.cs
6,238
C#
using MS.Lib.Module.Abstractions; using MS.Lib.Module.AspNetCore; using System.Collections.Generic; using System.Linq; namespace MS.Lib.Host.Swagger.Extensions { internal static class ModuleDescriptorExtensions { public static Dictionary<string, string> GetGroups(this IModuleDescriptor descriptor) { var dictionary = new Dictionary<string, string> { { descriptor.Code, descriptor.Name } }; var moduleAssemblyDescriptor = (ModuleAssemblyDescriptor)descriptor.AssemblyDescriptor; var controllerTypes = (moduleAssemblyDescriptor.Web ?? moduleAssemblyDescriptor.Api).GetTypes() .Where(m => m.Name.EndsWith("Controller")); foreach (var type in controllerTypes) { var array = type.FullName.Split('.'); if (array.Length == 7) { string text = array[5]; var key = descriptor.Code + "_" + text; if (text != "Controllers" && !dictionary.ContainsKey(key)) { dictionary.Add(key, descriptor.Name + "_" + text); } } } return dictionary; } } }
33.8
107
0.524408
[ "MIT" ]
billowliu2/MS
src/Framework/Host/Host.Swagger/Extensions/ModuleDescriptorExtensions.cs
1,354
C#
using System.Collections.Generic; using Sdl.Touch; namespace Sdl { /// <summary> /// A class that represents a haptic effect. /// </summary> public sealed unsafe class Haptic : NativePointerBase<Native.SDL_Haptic, Haptic> { private static ItemCollection<HapticInfo>? s_hapticInfos; /// <summary> /// An infinity value. /// </summary> public const uint Infinity = uint.MaxValue; /// <summary> /// The current haptic effects. /// </summary> public static IReadOnlyCollection<HapticInfo> Haptics => s_hapticInfos ??= new ItemCollection<HapticInfo>( index => Sdl.Native.CheckNotNull(HapticInfo.IndexToInstance(index)), Sdl.Native.SDL_NumHaptics); /// <summary> /// Information about this effect. /// </summary> public HapticInfo Info => HapticInfo.IndexToInstance(Sdl.Native.SDL_HapticIndex(Native)); /// <summary> /// The number of effects that can be stored. /// </summary> public int MaxEffects => Sdl.Native.SDL_HapticNumEffects(Native); /// <summary> /// The effects currently playing. /// </summary> public int EffectsPlaying => Sdl.Native.SDL_HapticNumEffectsPlaying(Native); /// <summary> /// The capabilities of the haptic device. /// </summary> public HapticCapabilities Capabilities => (HapticCapabilities)Sdl.Native.SDL_HapticQuery(Native) & HapticCapabilities.All; /// <summary> /// The number of axes. /// </summary> public int AxisCount => Sdl.Native.SDL_HapticNumAxes(Native); /// <summary> /// Whether rumble is supported. /// </summary> public bool RumbleSupported => Sdl.Native.CheckErrorBool(Sdl.Native.SDL_HapticRumbleSupported(Native)); /// <inheritdoc/> public override void Dispose() { Sdl.Native.SDL_HapticClose(Native); base.Dispose(); } /// <summary> /// Determines whether the effect is supported. /// </summary> /// <param name="effect">The effect.</param> /// <returns>Whether the effect is supported.</returns> public bool EffectSupported(HapticEffect effect) { var nativeEffect = effect.ToNative(); return Sdl.Native.SDL_HapticEffectSupported(Native, in nativeEffect); } /// <summary> /// Creates a new instance of a haptic effect. /// </summary> /// <param name="effect">The effect.</param> /// <returns>The effect instance.</returns> public HapticEffectInstance NewEffect(HapticEffect effect) { var nativeEffect = effect.ToNative(); return HapticEffectInstance.IndexToInstance(Native, Sdl.Native.CheckError(Sdl.Native.SDL_HapticNewEffect(Native, in nativeEffect))); } /// <summary> /// Sets the gain. /// </summary> /// <param name="gain">The gain amount.</param> public void SetGain(int gain) => Sdl.Native.CheckError(Sdl.Native.SDL_HapticSetGain(Native, gain)); /// <summary> /// Sets the global autocenter of the device. /// </summary> /// <param name="autocenter">The autocenter value.</param> public void SetAutocenter(int autocenter) => Sdl.Native.CheckError(Sdl.Native.SDL_HapticSetAutocenter(Native, autocenter)); /// <summary> /// Pauses the effect. /// </summary> public void Pause() => Sdl.Native.CheckError(Sdl.Native.SDL_HapticPause(Native)); /// <summary> /// Unpauses the effect. /// </summary> public void Unpause() => Sdl.Native.CheckError(Sdl.Native.SDL_HapticUnpause(Native)); /// <summary> /// Stops all effect instances. /// </summary> public void StopAll() => Sdl.Native.CheckError(Sdl.Native.SDL_HapticStopAll(Native)); /// <summary> /// Initializes rumble support. /// </summary> public void RumbleInit() => Sdl.Native.CheckError(Sdl.Native.SDL_HapticRumbleInit(Native)); /// <summary> /// Plays a rumble effect. /// </summary> /// <param name="strength">The strength of the effect.</param> /// <param name="length">The length of the effect.</param> public void RumblePlay(float strength, uint length) => Sdl.Native.CheckError(Sdl.Native.SDL_HapticRumblePlay(Native, strength, length)); /// <summary> /// Stops the rumble effect. /// </summary> public void RumbleStop() => Sdl.Native.CheckError(Sdl.Native.SDL_HapticRumbleStop(Native)); } }
34.300699
144
0.584913
[ "MIT" ]
harry-cpp/sdl-sharp
src/Sdl/Touch/Haptic.cs
4,907
C#
using System; using System.Runtime.InteropServices; namespace DeskBandLib.Interop { /// <summary> /// The IOleWindow interface provides methods that allow an application to obtain the handle to the various windows that participate in in-place activation, and also to enter and exit context-sensitive help mode. /// </summary> [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("00000114-0000-0000-C000-000000000046")] public interface IOleWindow { /// <summary> /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). /// </summary> /// <param name="phwnd">A pointer to a variable that receives the window handle.</param> /// <returns>This method returns S_OK on success.</returns> [PreserveSig] int GetWindow(out IntPtr phwnd); /// <summary> /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// </summary> /// <param name="fEnterMode">TRUE if help mode should be entered; FALSE if it should be exited.</param> /// <returns>This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in fEnterMode.</returns> [PreserveSig] int ContextSensitiveHelp(bool fEnterMode); } }
46.096774
216
0.687894
[ "MIT" ]
iodes/DeskBandLib
DeskBandLib/Interop/COM/IOleWindow.cs
1,431
C#
namespace ShowFeed.Models { using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; /// <summary> /// The update. /// </summary> [Table("Update")] public class Update : Entity { /// <summary> /// Initializes a new instance of the <see cref="Update"/> class. /// </summary> public Update() { this.Series = new List<Series>(); this.Episodes = new List<Episode>(); } /// <summary> /// Gets or sets the time when the update started as a unix time stamp. /// </summary> public virtual int Started { get; set; } /// <summary> /// Gets or sets the time when the update finished as a unix time stamp. /// </summary> public virtual int Finished { get; set; } /// <summary> /// Gets or sets the update time as a unix time stamp. /// </summary> public virtual int UpdateTime { get; set; } /// <summary> /// Gets or sets the updated series. /// </summary> public virtual ICollection<Series> Series { get; set; } /// <summary> /// Gets or sets the updated episodes. /// </summary> public virtual ICollection<Episode> Episodes { get; set; } } }
29.021739
80
0.542322
[ "MIT" ]
strayfatty/ShowFeed
src/ShowFeed/Models/Update.cs
1,337
C#
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using NUnit.Framework.Internal.Filters; using UnityEngine; using UnityEngine.TestTools.NUnitExtensions; using UnityEngine.TestTools.TestRunner; using UnityEngine.TestTools; using UnityEngine.TestTools.TestRunner.GUI; using UnityEditor.Callbacks; using UnityEditor.TestTools.TestRunner.Api; using UnityEngine.TestRunner.NUnitExtensions; using UnityEngine.TestRunner.NUnitExtensions.Runner; namespace UnityEditor.TestTools.TestRunner { internal interface IUnityTestAssemblyRunnerFactory { IUnityTestAssemblyRunner Create(TestPlatform testPlatform, WorkItemFactory factory); } internal class UnityTestAssemblyRunnerFactory : IUnityTestAssemblyRunnerFactory { public IUnityTestAssemblyRunner Create(TestPlatform testPlatform, WorkItemFactory factory) { return new UnityTestAssemblyRunner(new UnityTestAssemblyBuilder(), factory); } } [Serializable] internal class EditModeRunner : ScriptableObject, IDisposable { [SerializeField] private Filter[] m_Filters; //The counter from the IEnumerator object [SerializeField] private int m_CurrentPC; [SerializeField] private bool m_ExecuteOnEnable; [SerializeField] private List<string> m_AlreadyStartedTests; [SerializeField] private List<TestResultSerializer> m_ExecutedTests; [SerializeField] private List<ScriptableObject> m_CallbackObjects = new List<ScriptableObject>(); [SerializeField] private TestStartedEvent m_TestStartedEvent = new TestStartedEvent(); [SerializeField] private TestFinishedEvent m_TestFinishedEvent = new TestFinishedEvent(); [SerializeField] private RunStartedEvent m_RunStartedEvent = new RunStartedEvent(); [SerializeField] private RunFinishedEvent m_RunFinishedEvent = new RunFinishedEvent(); [SerializeField] private TestRunnerStateSerializer m_TestRunnerStateSerializer = new TestRunnerStateSerializer(); [SerializeField] private bool m_RunningTests; [SerializeField] private TestPlatform m_TestPlatform; [SerializeField] private object m_CurrentYieldObject; [SerializeField] private BeforeAfterTestCommandState m_SetUpTearDownState; [SerializeField] private BeforeAfterTestCommandState m_OuterUnityTestActionState; [SerializeField] public bool RunFinished = false; public bool RunningSynchronously { get; private set; } internal IUnityTestAssemblyRunner m_Runner; private ConstructDelegator m_ConstructDelegator; private IEnumerator m_RunStep; public IUnityTestAssemblyRunnerFactory UnityTestAssemblyRunnerFactory { get; set; } public void Init(Filter[] filters, TestPlatform platform, bool runningSynchronously) { m_Filters = filters; m_TestPlatform = platform; m_AlreadyStartedTests = new List<string>(); m_ExecutedTests = new List<TestResultSerializer>(); RunningSynchronously = runningSynchronously; InitRunner(); } private void InitRunner() { //We give the EditMode platform here so we dont suddenly create Playmode work items in the test Runner. m_Runner = (UnityTestAssemblyRunnerFactory ?? new UnityTestAssemblyRunnerFactory()).Create(TestPlatform.EditMode, new EditmodeWorkItemFactory()); var testAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy()); var assemblies = testAssemblyProvider.GetAssembliesGroupedByType(m_TestPlatform).Select(x => x.Assembly).ToArray(); var loadedTests = m_Runner.Load(assemblies, TestPlatform.EditMode, UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(m_TestPlatform)); loadedTests.ParseForNameDuplicates(); CallbacksDelegator.instance.TestTreeRebuild(loadedTests); hideFlags |= HideFlags.DontSave; EnumerableSetUpTearDownCommand.ActivePcHelper = new EditModePcHelper(); OuterUnityTestActionCommand.ActivePcHelper = new EditModePcHelper(); } public void OnEnable() { if (m_ExecuteOnEnable) { InitRunner(); m_ExecuteOnEnable = false; foreach (var callback in m_CallbackObjects) { AddListeners(callback as ITestRunnerListener); } m_ConstructDelegator = new ConstructDelegator(m_TestRunnerStateSerializer); EnumeratorStepHelper.SetEnumeratorPC(m_CurrentPC); UnityWorkItemDataHolder.alreadyExecutedTests = m_ExecutedTests.Select(x => x.fullName).ToList(); UnityWorkItemDataHolder.alreadyStartedTests = m_AlreadyStartedTests; Run(); } } public void TestStartedEvent(ITest test) { m_AlreadyStartedTests.Add(test.FullName); } public void TestFinishedEvent(ITestResult testResult) { m_AlreadyStartedTests.Remove(testResult.FullName); m_ExecutedTests.Add(TestResultSerializer.MakeFromTestResult(testResult)); } public void Run() { EditModeTestCallbacks.RestoringTestContext += OnRestoringTest; var context = m_Runner.GetCurrentContext(); if (m_SetUpTearDownState == null) { m_SetUpTearDownState = CreateInstance<BeforeAfterTestCommandState>(); } context.SetUpTearDownState = m_SetUpTearDownState; if (m_OuterUnityTestActionState == null) { m_OuterUnityTestActionState = CreateInstance<BeforeAfterTestCommandState>(); } context.OuterUnityTestActionState = m_OuterUnityTestActionState; if (!m_RunningTests) { m_RunStartedEvent.Invoke(m_Runner.LoadedTest); } if (m_ConstructDelegator == null) m_ConstructDelegator = new ConstructDelegator(m_TestRunnerStateSerializer); Reflect.ConstructorCallWrapper = m_ConstructDelegator.Delegate; m_TestStartedEvent.AddListener(TestStartedEvent); m_TestFinishedEvent.AddListener(TestFinishedEvent); AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload; RunningTests = true; EditorApplication.LockReloadAssemblies(); var testListenerWrapper = new TestListenerWrapper(m_TestStartedEvent, m_TestFinishedEvent); m_RunStep = m_Runner.Run(testListenerWrapper, GetFilter()).GetEnumerator(); m_RunningTests = true; if (!RunningSynchronously) EditorApplication.update += TestConsumer; } public void CompleteSynchronously() { while (!m_Runner.IsTestComplete) TestConsumer(); } private void OnBeforeAssemblyReload() { EditorApplication.update -= TestConsumer; if (m_ExecuteOnEnable) { AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload; return; } if (m_Runner != null && m_Runner.TopLevelWorkItem != null) m_Runner.TopLevelWorkItem.ResultedInDomainReload = true; if (RunningTests) { Debug.LogError("TestRunner: Unexpected assembly reload happened while running tests"); EditorUtility.ClearProgressBar(); if (m_Runner.GetCurrentContext() != null && m_Runner.GetCurrentContext().CurrentResult != null) { m_Runner.GetCurrentContext().CurrentResult.SetResult(ResultState.Cancelled, "Unexpected assembly reload happened"); } OnRunCancel(); } } private bool RunningTests; private Stack<IEnumerator> StepStack = new Stack<IEnumerator>(); private bool MoveNextAndUpdateYieldObject() { var result = m_RunStep.MoveNext(); if (result) { m_CurrentYieldObject = m_RunStep.Current; while (m_CurrentYieldObject is IEnumerator) // going deeper { var currentEnumerator = (IEnumerator)m_CurrentYieldObject; // go deeper and add parent to stack StepStack.Push(m_RunStep); m_RunStep = currentEnumerator; m_CurrentYieldObject = m_RunStep.Current; } if (StepStack.Count > 0 && m_CurrentYieldObject != null) // not null and not IEnumerator, nested { Debug.LogError("EditMode test can only yield null, but not <" + m_CurrentYieldObject.GetType().Name + ">"); } return true; } if (StepStack.Count == 0) // done return false; m_RunStep = StepStack.Pop(); // going up return MoveNextAndUpdateYieldObject(); } private void TestConsumer() { var moveNext = MoveNextAndUpdateYieldObject(); if (m_CurrentYieldObject != null) { InvokeDelegator(); } if (!moveNext && !m_Runner.IsTestComplete) { CompleteTestRun(); throw new IndexOutOfRangeException("There are no more elements to process and IsTestComplete is false"); } if (m_Runner.IsTestComplete) { CompleteTestRun(); } } private void CompleteTestRun() { if (!RunningSynchronously) EditorApplication.update -= TestConsumer; TestLauncherBase.ExecutePostBuildCleanupMethods(this.GetLoadedTests(), this.GetFilter(), Application.platform); m_RunFinishedEvent.Invoke(m_Runner.Result); RunFinished = true; if (m_ConstructDelegator != null) m_ConstructDelegator.DestroyCurrentTestObjectIfExists(); Dispose(); UnityWorkItemDataHolder.alreadyExecutedTests = null; } private void OnRestoringTest() { var item = m_ExecutedTests.Find(t => t.fullName == UnityTestExecutionContext.CurrentContext.CurrentTest.FullName); if (item != null) { item.RestoreTestResult(UnityTestExecutionContext.CurrentContext.CurrentResult); } } private static bool IsCancelled() { return UnityTestExecutionContext.CurrentContext.ExecutionStatus == TestExecutionStatus.AbortRequested || UnityTestExecutionContext.CurrentContext.ExecutionStatus == TestExecutionStatus.StopRequested; } private void InvokeDelegator() { if (m_CurrentYieldObject == null) { return; } if (IsCancelled()) { return; } if (m_CurrentYieldObject is RestoreTestContextAfterDomainReload) { if (m_TestRunnerStateSerializer.ShouldRestore()) { m_TestRunnerStateSerializer.RestoreContext(); } return; } try { if (m_CurrentYieldObject is IEditModeTestYieldInstruction) { var editModeTestYieldInstruction = (IEditModeTestYieldInstruction)m_CurrentYieldObject; if (editModeTestYieldInstruction.ExpectDomainReload) { PrepareForDomainReload(); } return; } } catch (Exception e) { UnityTestExecutionContext.CurrentContext.CurrentResult.RecordException(e); return; } Debug.LogError("EditMode test can only yield null"); } private void CompilationFailureWatch() { if (EditorApplication.isCompiling) return; EditorApplication.update -= CompilationFailureWatch; if (EditorUtility.scriptCompilationFailed) { EditorUtility.ClearProgressBar(); OnRunCancel(); } } private void PrepareForDomainReload() { m_TestRunnerStateSerializer.SaveContext(); m_CurrentPC = EnumeratorStepHelper.GetEnumeratorPC(TestEnumerator.Enumerator); m_ExecuteOnEnable = true; RunningTests = false; } public T AddEventHandler<T>() where T : ScriptableObject, ITestRunnerListener { var eventHandler = CreateInstance<T>(); eventHandler.hideFlags |= HideFlags.DontSave; m_CallbackObjects.Add(eventHandler); AddListeners(eventHandler); return eventHandler; } private void AddListeners(ITestRunnerListener eventHandler) { m_TestStartedEvent.AddListener(eventHandler.TestStarted); m_TestFinishedEvent.AddListener(eventHandler.TestFinished); m_RunStartedEvent.AddListener(eventHandler.RunStarted); m_RunFinishedEvent.AddListener(eventHandler.RunFinished); } public void Dispose() { Reflect.MethodCallWrapper = null; EditorApplication.update -= TestConsumer; DestroyImmediate(this); if (m_CallbackObjects != null) { foreach (var obj in m_CallbackObjects) { DestroyImmediate(obj); } m_CallbackObjects.Clear(); } RunningTests = false; EditorApplication.UnlockReloadAssemblies(); } public void OnRunCancel() { UnityWorkItemDataHolder.alreadyExecutedTests = null; m_ExecuteOnEnable = false; m_Runner.StopRun(); RunFinished = true; } public ITest GetLoadedTests() { return m_Runner.LoadedTest; } public ITestFilter GetFilter() { return new OrFilter(m_Filters.Select(filter => filter.BuildNUnitFilter(RunningSynchronously)).ToArray()); } } }
34.091116
211
0.611519
[ "MIT" ]
16pxdesign/genetic-algorithm-unity
Library/PackageCache/com.unity.test-framework@1.1.9/UnityEditor.TestRunner/TestRunner/EditModeRunner.cs
14,966
C#
/* 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. */ namespace TesteDLLSat { 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.txtCodAtivacao = new System.Windows.Forms.TextBox(); this.lblCodAtivacao = new System.Windows.Forms.Label(); this.btnConsultarSAT = new System.Windows.Forms.Button(); this.txtDllPath = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.btnConsultarStatusOperacional = new System.Windows.Forms.Button(); this.txtUltRetorno = new System.Windows.Forms.RichTextBox(); this.lblUltRetorno = new System.Windows.Forms.Label(); this.SuspendLayout(); // // txtCodAtivacao // this.txtCodAtivacao.Location = new System.Drawing.Point(29, 121); this.txtCodAtivacao.Name = "txtCodAtivacao"; this.txtCodAtivacao.Size = new System.Drawing.Size(155, 20); this.txtCodAtivacao.TabIndex = 0; // // lblCodAtivacao // this.lblCodAtivacao.AutoSize = true; this.lblCodAtivacao.Location = new System.Drawing.Point(26, 105); this.lblCodAtivacao.Name = "lblCodAtivacao"; this.lblCodAtivacao.Size = new System.Drawing.Size(103, 13); this.lblCodAtivacao.TabIndex = 1; this.lblCodAtivacao.Text = "Código de Ativação:"; // // btnConsultarSAT // this.btnConsultarSAT.Location = new System.Drawing.Point(29, 58); this.btnConsultarSAT.Name = "btnConsultarSAT"; this.btnConsultarSAT.Size = new System.Drawing.Size(155, 23); this.btnConsultarSAT.TabIndex = 2; this.btnConsultarSAT.Text = "ConsultarSAT"; this.btnConsultarSAT.UseVisualStyleBackColor = true; this.btnConsultarSAT.Click += new System.EventHandler(this.btnConsultarSAT_Click); // // txtDllPath // this.txtDllPath.Location = new System.Drawing.Point(29, 32); this.txtDllPath.Name = "txtDllPath"; this.txtDllPath.Size = new System.Drawing.Size(155, 20); this.txtDllPath.TabIndex = 3; this.txtDllPath.Text = "dllsat.dll"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(26, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(74, 13); this.label1.TabIndex = 4; this.label1.Text = "Caminho DLL:"; // // btnConsultarStatusOperacional // this.btnConsultarStatusOperacional.Location = new System.Drawing.Point(29, 147); this.btnConsultarStatusOperacional.Name = "btnConsultarStatusOperacional"; this.btnConsultarStatusOperacional.Size = new System.Drawing.Size(155, 23); this.btnConsultarStatusOperacional.TabIndex = 5; this.btnConsultarStatusOperacional.Text = "ConsultarStatusOperacional"; this.btnConsultarStatusOperacional.UseVisualStyleBackColor = true; this.btnConsultarStatusOperacional.Click += new System.EventHandler(this.btnConsultarStatusOperacional_Click); // // txtUltRetorno // this.txtUltRetorno.Location = new System.Drawing.Point(190, 32); this.txtUltRetorno.Name = "txtUltRetorno"; this.txtUltRetorno.Size = new System.Drawing.Size(465, 138); this.txtUltRetorno.TabIndex = 6; this.txtUltRetorno.Text = ""; // // lblUltRetorno // this.lblUltRetorno.AutoSize = true; this.lblUltRetorno.Location = new System.Drawing.Point(187, 16); this.lblUltRetorno.Name = "lblUltRetorno"; this.lblUltRetorno.Size = new System.Drawing.Size(80, 13); this.lblUltRetorno.TabIndex = 7; this.lblUltRetorno.Text = "Último Retorno:"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(684, 195); this.Controls.Add(this.lblUltRetorno); this.Controls.Add(this.txtUltRetorno); this.Controls.Add(this.btnConsultarStatusOperacional); this.Controls.Add(this.label1); this.Controls.Add(this.txtDllPath); this.Controls.Add(this.btnConsultarSAT); this.Controls.Add(this.lblCodAtivacao); this.Controls.Add(this.txtCodAtivacao); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.TextBox txtCodAtivacao; private System.Windows.Forms.Label lblCodAtivacao; private System.Windows.Forms.Button btnConsultarSAT; private System.Windows.Forms.TextBox txtDllPath; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnConsultarStatusOperacional; private System.Windows.Forms.RichTextBox txtUltRetorno; private System.Windows.Forms.Label lblUltRetorno; } }
45.936306
123
0.606212
[ "BSD-3-Clause" ]
carloshenrq/comsat
TesteDLLSat/Form1.Designer.cs
7,218
C#
using UnityEngine; using UnityEngine.Rendering; using System.Collections; using System; #if UNITY_EDITOR using UnityEditor; #endif namespace LlockhamIndustries.Decals { /** * Standard Shader - metallic setup. */ [System.Serializable] public class Metallic : Projection { //Materials public override Material[] Forward { get { if (forwardMaterials == null || forwardMaterials.Length != 1) { forwardMaterials = new Material[1]; } if (forwardMaterials[0] == null) { forwardMaterials[0] = new Material(Shader.Find("Projection/Decal/Metallic/Forward")); forwardMaterials[0].hideFlags = HideFlags.DontSave; Apply(forwardMaterials[0]); } return forwardMaterials; } } public override Material[] DeferredOpaque { get { if (deferredOpaqueMaterials == null || deferredOpaqueMaterials.Length != 1) { deferredOpaqueMaterials = new Material[1]; } if (deferredOpaqueMaterials[0] == null) { deferredOpaqueMaterials[0] = new Material(Shader.Find("Projection/Decal/Metallic/DeferredOpaque")); deferredOpaqueMaterials[0].hideFlags = HideFlags.DontSave; Apply(deferredOpaqueMaterials[0]); } return deferredOpaqueMaterials; } } public override Material[] DeferredTransparent { get { if (deferredTransparentMaterials == null || deferredTransparentMaterials.Length != 2) { deferredTransparentMaterials = new Material[2]; } if (deferredTransparentMaterials[0] == null) { deferredTransparentMaterials[0] = new Material(Shader.Find("Projection/Decal/Metallic/DeferredBaseTransparent")); deferredTransparentMaterials[0].hideFlags = HideFlags.DontSave; Apply(deferredTransparentMaterials[0]); } if (deferredTransparentMaterials[1] == null) { deferredTransparentMaterials[1] = new Material(Shader.Find("Projection/Decal/Metallic/DeferredAddTransparent")); deferredTransparentMaterials[1].hideFlags = HideFlags.DontSave; Apply(deferredTransparentMaterials[1]); } return deferredTransparentMaterials; } } //Instanced Count public override int InstanceLimit { get { return 500; } } protected override void UpdateMaterials() { UpdateMaterialArray(forwardMaterials); UpdateMaterialArray(deferredOpaqueMaterials); UpdateMaterialArray(deferredTransparentMaterials); } protected override void Apply(Material Material) { //Apply base base.Apply(Material); //Apply metallic albedo.Apply(Material); metallic.Apply(Material); normal.Apply(Material); emissive.Apply(Material); } protected override void DestroyMaterials() { if (forwardMaterials != null) { DestroyMaterialArray(forwardMaterials); } if (deferredOpaqueMaterials != null) { DestroyMaterialArray(deferredOpaqueMaterials); } if (deferredTransparentMaterials != null) { DestroyMaterialArray(deferredTransparentMaterials); } } //Static Properties /** * The primary color details of your projection. * The alpha channel of these properties is used to determine the projections transparency. */ public AlbedoPropertyGroup albedo; /** * The metallic texture, with a multiplier. * Determines how metallic the surface of the decal appears. * black will make the decal surface appear like plastic. * white will make the decal surface appear metallic. * Only the R channel of the texture is used. */ public MetallicPropertyGroup metallic; /** * The normal texture of your decal, multiplied by the normal strength. * Normals determine how the surface of your decal interacts with lights. */ public NormalPropertyGroup normal; /** * The emission texture of your projection, multiplied by the emission color and intensity. * Emission allows us to make a decal appear as if it's emitting light. Supports HDR. */ public EmissivePropertyGroup emissive; protected override void OnEnable() { //Initialize our property groups if (albedo == null) albedo = new AlbedoPropertyGroup(this); if (metallic == null) metallic = new MetallicPropertyGroup(this); if (normal == null) normal = new NormalPropertyGroup(this); if (emissive == null) emissive = new EmissivePropertyGroup(this); base.OnEnable(); } protected override void GenerateIDs() { base.GenerateIDs(); albedo.GenerateIDs(); metallic.GenerateIDs(); normal.GenerateIDs(); emissive.GenerateIDs(); } //Instanced Properties public override void UpdateProperties() { //Initialize property array if (properties == null || properties.Length != 2) properties = new ProjectionProperty[2]; //Albedo Color properties[0] = new ProjectionProperty("Albedo", albedo._Color, albedo.Color); //Emission Color properties[1] = new ProjectionProperty("Emission", emissive._EmissionColor, emissive.Color, emissive.Intensity); } //Materials protected Material[] forwardMaterials; protected Material[] deferredOpaqueMaterials; protected Material[] deferredTransparentMaterials; } }
35.530387
133
0.567408
[ "MIT" ]
DavSchwartz/HackNSlashTechDemo
Assets/Dynamic Decals/Scripts/Core/Projections/Metallic.cs
6,433
C#
namespace ClearHl7.Codes.V260 { /// <summary> /// HL7 Version 2 Table 0895 - Present On Admission (POA) Indicator. /// </summary> /// <remarks>https://www.hl7.org/fhir/v2/0895</remarks> public enum CodePresentOnAdmissionIndicator { /// <summary> /// E - Exempt. /// </summary> Exempt, /// <summary> /// N - No. /// </summary> No, /// <summary> /// U - Unknown. /// </summary> Unknown, /// <summary> /// W - Not applicable. /// </summary> NotApplicable, /// <summary> /// Y - Yes. /// </summary> Yes } }
21.382353
72
0.420908
[ "MIT" ]
davebronson/clear-hl7-net
src/ClearHl7.Codes/V260/CodePresentOnAdmissionIndicator.cs
729
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Microsoft.Azure.Devices.Provisioning.Service { /// <summary> /// Representation of a single Device Provisioning Service query response with a JSON deserializer. /// </summary> /// <remarks> /// It is the result of any query for the provisioning service. This class will parse the result and /// return it in a best format possible. For the known formats in <see cref="QueryResultType"/>, you can /// just cast the items. In case of <b>unknown</b> type, the items will contain a list of <c>string</c> /// and you shall parse it by your own. /// /// The provisioning service query result is composed by 2 system properties and a body. This class exposes /// it with 3 getters, <see cref="Type"/>, <see cref="Items"/>, and <see cref="ContinuationToken"/>. /// /// The system properties are: /// <list type="bullet"> /// <item> /// <description><b>type:</b> /// Identify the type of the content in the body. You can use it to cast the objects /// in the items list. See <see cref="QueryResultType"/> for the possible types and classes /// to cast.</description> /// </item> /// <item> /// <description><b>continuationToken:</b> /// Contains the token the uniquely identify the next page of information. The /// service will return the next page of this query when you send a new query with /// this token.</description> /// </item> /// </list> /// /// And the body is a JSON list of the specific <b>type</b>. For instance, if the system /// property type is IndividualEnrollment, the body will look like: /// <c> /// [ /// { /// "registrationId":"validRegistrationId-1", /// "deviceId":"ContosoDevice-1", /// "attestation":{ /// "type":"tpm", /// "tpm":{ /// "endorsementKey":"validEndorsementKey" /// } /// }, /// "iotHubHostName":"ContosoIoTHub.azure-devices.net", /// "provisioningStatus":"enabled" /// }, /// { /// "registrationId":"validRegistrationId-2", /// "deviceId":"ContosoDevice-2", /// "attestation":{ /// "type":"tpm", /// "tpm":{ /// "endorsementKey":"validEndorsementKey" /// } /// }, /// "iotHubHostName":"ContosoIoTHub.azure-devices.net", /// "provisioningStatus":"enabled" /// } /// ] /// </c> /// </remarks> public class QueryResult { /// <summary> /// Getter for the query result Type. /// </summary> public QueryResultType Type { get; private set; } /// <summary> /// Getter for the list of query result Items. /// </summary> public IEnumerable<object> Items { get; private set; } /// <summary> /// Getter for the query result continuationToken. /// </summary> public string ContinuationToken { get; private set; } /// <summary> /// CONSTRUCTOR /// </summary> /// <param name="typeString">The <c>string</c> with type of the content in the body. /// It cannot be <c>null</c>.</param> /// <param name="bodyString">The <c>string</c> with the body in a JSON list format. /// It cannot be <c>null</c>, or empty, if the type is different than `unknown`.</param> /// <param name="continuationToken">The <c>string</c> with the continuation token. /// It can be <c>null</c>.</param> /// <exception cref="ArgumentException">If one of the provided parameters is invalid.</exception> internal QueryResult(string typeString, string bodyString, string continuationToken) { Type = (QueryResultType)Enum.Parse(typeof(QueryResultType), typeString, true); ContinuationToken = string.IsNullOrWhiteSpace(continuationToken) ? null : continuationToken; if (Type != QueryResultType.Unknown && string.IsNullOrWhiteSpace(bodyString)) { if (bodyString == null) { throw new ArgumentNullException(nameof(bodyString)); } throw new ArgumentException("Invalid query body.", nameof(bodyString)); } switch (Type) { case QueryResultType.Enrollment: Items = JsonConvert.DeserializeObject<IEnumerable<IndividualEnrollment>>(bodyString); break; case QueryResultType.EnrollmentGroup: Items = JsonConvert.DeserializeObject<IEnumerable<EnrollmentGroup>>(bodyString); break; case QueryResultType.DeviceRegistration: Items = JsonConvert.DeserializeObject<IEnumerable<DeviceRegistrationState>>(bodyString); break; default: if (bodyString == null) { Items = null; } else { try { Items = JsonConvert.DeserializeObject<IEnumerable<JObject>>(bodyString); } catch (ArgumentException) { try { Items = JsonConvert.DeserializeObject<IEnumerable<object>>(bodyString); } catch (ArgumentException) { Items = new string[] { bodyString }; } } catch (JsonReaderException) { Items = new string[] { bodyString }; } } break; } } /// <summary> /// Convert this object in a pretty print format. /// </summary> /// <returns>The <c>string</c> with the content of this class in a pretty print format.</returns> public override string ToString() { return JsonConvert.SerializeObject(this, Formatting.Indented); } } }
40.408284
112
0.515302
[ "MIT" ]
brycewang-microsoft/azure-iot-sdk-csharp
provisioning/service/src/Config/QueryResult.cs
6,831
C#
/* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for Additional information regarding copyright ownership. The ASF licenses this file to You 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 TestCases.SS.Formula.Functions { using Npoi.Core.HSSF; using Npoi.Core.SS.Formula.Eval; using Npoi.Core.HSSF.UserModel; using Npoi.Core.HSSF.Util; using Npoi.Core.SS.UserModel; using System; using NUnit.Framework; using System.Text; using Npoi.Core.SS.Util; using TestCases.Exceptions; using System.IO; using TestCases.HSSF; using Npoi.Core.Util; /** * Tests lookup functions (VLOOKUP, HLOOKUP, LOOKUP, MATCH) as loaded from a Test data spreadsheet.<p/> * These Tests have been Separated from the common function and operator Tests because the lookup * functions have more complex Test cases and Test data Setup. * * Tests for bug fixes and specific/tricky behaviour can be found in the corresponding Test class * (<c>TestXxxx</c>) of the target (<c>Xxxx</c>) implementor, where execution can be observed * more easily. * * @author Josh Micich */ [TestFixture] public class TestLookupFunctionsFromSpreadsheet:BaseTestFunctionsFromSpreadsheet { protected override string Filename { get { return "LookupFunctionsTestCaseData.xls"; } } } }
38.321429
107
0.665424
[ "Apache-2.0" ]
Arch/Npoi.Core
test/Npoi.Core.TestCases/SS/Formula/Functions/TestLookupFunctionsFromSpreadsheet.cs
2,146
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HangMan { class ScoreBoardPosition : IComparable<ScoreBoardPosition> { private string name; public string Name { get { return name; } set { name = value; } } private int mistakes; public int Mistakes { get { return mistakes; } set { mistakes = value; } } public ScoreBoardPosition(string name, int mistakes) { this.name = name; this.mistakes = mistakes; } public ScoreBoardPosition() : this(string.Empty, 0) { } public int CompareTo(ScoreBoardPosition other) { return this.Mistakes.CompareTo(other.Mistakes); } } }
19.230769
63
0.462
[ "MIT" ]
ElenaStaykova/High-Quality-Code
Teamwork/Hangman/Hangman-4/ScoreBoardPosition.cs
1,002
C#
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel.DataAnnotations; using System.Globalization; using System.Reflection; using System.Runtime.Serialization; using System.Web.Http; using System.Web.Http.Description; using System.Xml.Serialization; using Newtonsoft.Json; namespace QuizAPI.Areas.HelpPage.ModelDescriptions { /// <summary> /// Generates model descriptions for given types. /// </summary> public class ModelDescriptionGenerator { // Modify this to support more data annotation attributes. private readonly IDictionary<Type, Func<object, string>> AnnotationTextGenerator = new Dictionary<Type, Func<object, string>> { { typeof(RequiredAttribute), a => "Required" }, { typeof(RangeAttribute), a => { RangeAttribute range = (RangeAttribute)a; return String.Format(CultureInfo.CurrentCulture, "Range: inclusive between {0} and {1}", range.Minimum, range.Maximum); } }, { typeof(MaxLengthAttribute), a => { MaxLengthAttribute maxLength = (MaxLengthAttribute)a; return String.Format(CultureInfo.CurrentCulture, "Max length: {0}", maxLength.Length); } }, { typeof(MinLengthAttribute), a => { MinLengthAttribute minLength = (MinLengthAttribute)a; return String.Format(CultureInfo.CurrentCulture, "Min length: {0}", minLength.Length); } }, { typeof(StringLengthAttribute), a => { StringLengthAttribute strLength = (StringLengthAttribute)a; return String.Format(CultureInfo.CurrentCulture, "String length: inclusive between {0} and {1}", strLength.MinimumLength, strLength.MaximumLength); } }, { typeof(DataTypeAttribute), a => { DataTypeAttribute dataType = (DataTypeAttribute)a; return String.Format(CultureInfo.CurrentCulture, "Data type: {0}", dataType.CustomDataType ?? dataType.DataType.ToString()); } }, { typeof(RegularExpressionAttribute), a => { RegularExpressionAttribute regularExpression = (RegularExpressionAttribute)a; return String.Format(CultureInfo.CurrentCulture, "Matching regular expression pattern: {0}", regularExpression.Pattern); } }, }; // Modify this to add more default documentations. private readonly IDictionary<Type, string> DefaultTypeDocumentation = new Dictionary<Type, string> { { typeof(Int16), "integer" }, { typeof(Int32), "integer" }, { typeof(Int64), "integer" }, { typeof(UInt16), "unsigned integer" }, { typeof(UInt32), "unsigned integer" }, { typeof(UInt64), "unsigned integer" }, { typeof(Byte), "byte" }, { typeof(Char), "character" }, { typeof(SByte), "signed byte" }, { typeof(Uri), "URI" }, { typeof(Single), "decimal number" }, { typeof(Double), "decimal number" }, { typeof(Decimal), "decimal number" }, { typeof(String), "string" }, { typeof(Guid), "globally unique identifier" }, { typeof(TimeSpan), "time interval" }, { typeof(DateTime), "date" }, { typeof(DateTimeOffset), "date" }, { typeof(Boolean), "boolean" }, }; private Lazy<IModelDocumentationProvider> _documentationProvider; public ModelDescriptionGenerator(HttpConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } _documentationProvider = new Lazy<IModelDocumentationProvider>(() => config.Services.GetDocumentationProvider() as IModelDocumentationProvider); GeneratedModels = new Dictionary<string, ModelDescription>(StringComparer.OrdinalIgnoreCase); } public Dictionary<string, ModelDescription> GeneratedModels { get; private set; } private IModelDocumentationProvider DocumentationProvider { get { return _documentationProvider.Value; } } public ModelDescription GetOrCreateModelDescription(Type modelType) { if (modelType == null) { throw new ArgumentNullException("modelType"); } Type underlyingType = Nullable.GetUnderlyingType(modelType); if (underlyingType != null) { modelType = underlyingType; } ModelDescription modelDescription; string modelName = ModelNameHelper.GetModelName(modelType); if (GeneratedModels.TryGetValue(modelName, out modelDescription)) { if (modelType != modelDescription.ModelType) { throw new InvalidOperationException( String.Format( CultureInfo.CurrentCulture, "A model description could not be created. Duplicate model name '{0}' was found for types '{1}' and '{2}'. " + "Use the [ModelName] attribute to change the model name for at least one of the types so that it has a unique name.", modelName, modelDescription.ModelType.FullName, modelType.FullName)); } return modelDescription; } if (DefaultTypeDocumentation.ContainsKey(modelType)) { return GenerateSimpleTypeModelDescription(modelType); } if (modelType.IsEnum) { return GenerateEnumTypeModelDescription(modelType); } if (modelType.IsGenericType) { Type[] genericArguments = modelType.GetGenericArguments(); if (genericArguments.Length == 1) { Type enumerableType = typeof(IEnumerable<>).MakeGenericType(genericArguments); if (enumerableType.IsAssignableFrom(modelType)) { return GenerateCollectionModelDescription(modelType, genericArguments[0]); } } if (genericArguments.Length == 2) { Type dictionaryType = typeof(IDictionary<,>).MakeGenericType(genericArguments); if (dictionaryType.IsAssignableFrom(modelType)) { return GenerateDictionaryModelDescription(modelType, genericArguments[0], genericArguments[1]); } Type keyValuePairType = typeof(KeyValuePair<,>).MakeGenericType(genericArguments); if (keyValuePairType.IsAssignableFrom(modelType)) { return GenerateKeyValuePairModelDescription(modelType, genericArguments[0], genericArguments[1]); } } } if (modelType.IsArray) { Type elementType = modelType.GetElementType(); return GenerateCollectionModelDescription(modelType, elementType); } if (modelType == typeof(NameValueCollection)) { return GenerateDictionaryModelDescription(modelType, typeof(string), typeof(string)); } if (typeof(IDictionary).IsAssignableFrom(modelType)) { return GenerateDictionaryModelDescription(modelType, typeof(object), typeof(object)); } if (typeof(IEnumerable).IsAssignableFrom(modelType)) { return GenerateCollectionModelDescription(modelType, typeof(object)); } return GenerateComplexTypeModelDescription(modelType); } // Change this to provide different name for the member. private static string GetMemberName(MemberInfo member, bool hasDataContractAttribute) { JsonPropertyAttribute jsonProperty = member.GetCustomAttribute<JsonPropertyAttribute>(); if (jsonProperty != null && !String.IsNullOrEmpty(jsonProperty.PropertyName)) { return jsonProperty.PropertyName; } if (hasDataContractAttribute) { DataMemberAttribute dataMember = member.GetCustomAttribute<DataMemberAttribute>(); if (dataMember != null && !String.IsNullOrEmpty(dataMember.Name)) { return dataMember.Name; } } return member.Name; } private static bool ShouldDisplayMember(MemberInfo member, bool hasDataContractAttribute) { JsonIgnoreAttribute jsonIgnore = member.GetCustomAttribute<JsonIgnoreAttribute>(); XmlIgnoreAttribute xmlIgnore = member.GetCustomAttribute<XmlIgnoreAttribute>(); IgnoreDataMemberAttribute ignoreDataMember = member.GetCustomAttribute<IgnoreDataMemberAttribute>(); NonSerializedAttribute nonSerialized = member.GetCustomAttribute<NonSerializedAttribute>(); ApiExplorerSettingsAttribute apiExplorerSetting = member.GetCustomAttribute<ApiExplorerSettingsAttribute>(); bool hasMemberAttribute = member.DeclaringType.IsEnum ? member.GetCustomAttribute<EnumMemberAttribute>() != null : member.GetCustomAttribute<DataMemberAttribute>() != null; // Display member only if all the followings are true: // no JsonIgnoreAttribute // no XmlIgnoreAttribute // no IgnoreDataMemberAttribute // no NonSerializedAttribute // no ApiExplorerSettingsAttribute with IgnoreApi set to true // no DataContractAttribute without DataMemberAttribute or EnumMemberAttribute return jsonIgnore == null && xmlIgnore == null && ignoreDataMember == null && nonSerialized == null && (apiExplorerSetting == null || !apiExplorerSetting.IgnoreApi) && (!hasDataContractAttribute || hasMemberAttribute); } private string CreateDefaultDocumentation(Type type) { string documentation; if (DefaultTypeDocumentation.TryGetValue(type, out documentation)) { return documentation; } if (DocumentationProvider != null) { documentation = DocumentationProvider.GetDocumentation(type); } return documentation; } private void GenerateAnnotations(MemberInfo property, ParameterDescription propertyModel) { List<ParameterAnnotation> annotations = new List<ParameterAnnotation>(); IEnumerable<Attribute> attributes = property.GetCustomAttributes(); foreach (Attribute attribute in attributes) { Func<object, string> textGenerator; if (AnnotationTextGenerator.TryGetValue(attribute.GetType(), out textGenerator)) { annotations.Add( new ParameterAnnotation { AnnotationAttribute = attribute, Documentation = textGenerator(attribute) }); } } // Rearrange the annotations annotations.Sort((x, y) => { // Special-case RequiredAttribute so that it shows up on top if (x.AnnotationAttribute is RequiredAttribute) { return -1; } if (y.AnnotationAttribute is RequiredAttribute) { return 1; } // Sort the rest based on alphabetic order of the documentation return String.Compare(x.Documentation, y.Documentation, StringComparison.OrdinalIgnoreCase); }); foreach (ParameterAnnotation annotation in annotations) { propertyModel.Annotations.Add(annotation); } } private CollectionModelDescription GenerateCollectionModelDescription(Type modelType, Type elementType) { ModelDescription collectionModelDescription = GetOrCreateModelDescription(elementType); if (collectionModelDescription != null) { return new CollectionModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, ElementDescription = collectionModelDescription }; } return null; } private ModelDescription GenerateComplexTypeModelDescription(Type modelType) { ComplexTypeModelDescription complexModelDescription = new ComplexTypeModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, Documentation = CreateDefaultDocumentation(modelType) }; GeneratedModels.Add(complexModelDescription.Name, complexModelDescription); bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null; PropertyInfo[] properties = modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo property in properties) { if (ShouldDisplayMember(property, hasDataContractAttribute)) { ParameterDescription propertyModel = new ParameterDescription { Name = GetMemberName(property, hasDataContractAttribute) }; if (DocumentationProvider != null) { propertyModel.Documentation = DocumentationProvider.GetDocumentation(property); } GenerateAnnotations(property, propertyModel); complexModelDescription.Properties.Add(propertyModel); propertyModel.TypeDescription = GetOrCreateModelDescription(property.PropertyType); } } FieldInfo[] fields = modelType.GetFields(BindingFlags.Public | BindingFlags.Instance); foreach (FieldInfo field in fields) { if (ShouldDisplayMember(field, hasDataContractAttribute)) { ParameterDescription propertyModel = new ParameterDescription { Name = GetMemberName(field, hasDataContractAttribute) }; if (DocumentationProvider != null) { propertyModel.Documentation = DocumentationProvider.GetDocumentation(field); } complexModelDescription.Properties.Add(propertyModel); propertyModel.TypeDescription = GetOrCreateModelDescription(field.FieldType); } } return complexModelDescription; } private DictionaryModelDescription GenerateDictionaryModelDescription(Type modelType, Type keyType, Type valueType) { ModelDescription keyModelDescription = GetOrCreateModelDescription(keyType); ModelDescription valueModelDescription = GetOrCreateModelDescription(valueType); return new DictionaryModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, KeyModelDescription = keyModelDescription, ValueModelDescription = valueModelDescription }; } private EnumTypeModelDescription GenerateEnumTypeModelDescription(Type modelType) { EnumTypeModelDescription enumDescription = new EnumTypeModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, Documentation = CreateDefaultDocumentation(modelType) }; bool hasDataContractAttribute = modelType.GetCustomAttribute<DataContractAttribute>() != null; foreach (FieldInfo field in modelType.GetFields(BindingFlags.Public | BindingFlags.Static)) { if (ShouldDisplayMember(field, hasDataContractAttribute)) { EnumValueDescription enumValue = new EnumValueDescription { Name = field.Name, Value = field.GetRawConstantValue().ToString() }; if (DocumentationProvider != null) { enumValue.Documentation = DocumentationProvider.GetDocumentation(field); } enumDescription.Values.Add(enumValue); } } GeneratedModels.Add(enumDescription.Name, enumDescription); return enumDescription; } private KeyValuePairModelDescription GenerateKeyValuePairModelDescription(Type modelType, Type keyType, Type valueType) { ModelDescription keyModelDescription = GetOrCreateModelDescription(keyType); ModelDescription valueModelDescription = GetOrCreateModelDescription(valueType); return new KeyValuePairModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, KeyModelDescription = keyModelDescription, ValueModelDescription = valueModelDescription }; } private ModelDescription GenerateSimpleTypeModelDescription(Type modelType) { SimpleTypeModelDescription simpleModelDescription = new SimpleTypeModelDescription { Name = ModelNameHelper.GetModelName(modelType), ModelType = modelType, Documentation = CreateDefaultDocumentation(modelType) }; GeneratedModels.Add(simpleModelDescription.Name, simpleModelDescription); return simpleModelDescription; } } }
42.305987
167
0.578931
[ "MIT" ]
liliankasem/MicrobitQuiz
QuizAPI/QuizAPI/Areas/HelpPage/ModelDescriptions/ModelDescriptionGenerator.cs
19,080
C#