content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Quaver.Server.Client.Handlers; using Quaver.Server.Common.Objects.Multiplayer; using Quaver.Shared.Assets; using Quaver.Shared.Config; using Quaver.Shared.Database.Maps; using Quaver.Shared.Graphics; using Quaver.Shared.Graphics.Backgrounds; using Quaver.Shared.Graphics.Menu; using Quaver.Shared.Online; using Quaver.Shared.Screens.Lobby.UI; using Quaver.Shared.Screens.Lobby.UI.Dialogs; using Quaver.Shared.Screens.Lobby.UI.Dialogs.Create; using Quaver.Shared.Screens.Menu.UI.Jukebox; using Quaver.Shared.Screens.Menu.UI.Visualizer; using Quaver.Shared.Screens.Settings; using Wobble; using Wobble.Bindables; using Wobble.Graphics; using Wobble.Graphics.Animations; using Wobble.Graphics.Sprites; using Wobble.Graphics.UI; using Wobble.Graphics.UI.Buttons; using Wobble.Graphics.UI.Dialogs; using Wobble.Screens; using Wobble.Window; namespace Quaver.Shared.Screens.Lobby { public class LobbyScreenView : ScreenView { /// <summary> /// </summary> private LobbyScreen LobbyScreen { get; } /// <summary> /// </summary> private BackgroundImage Background { get; set; } /// <summary> /// </summary> private MenuHeader Header { get; set; } /// <summary> /// </summary> private MenuFooter Footer { get; set; } /// <summary> /// </summary> public LobbySearchBox Searchbox { get; private set; } /// <summary> /// </summary> public LobbyMatchScrollContainer MatchContainer { get; private set; } /// <summary> /// </summary> private LobbyMatchInfo MatchInfo { get; set; } /// <summary> /// </summary> private Jukebox Jukebox { get; } /// <summary> /// </summary> private MenuAudioVisualizer Visualizer { get; } /// <summary> /// </summary> private Sprite FilterBackground { get; } /// <inheritdoc /> /// <summary> /// </summary> /// <param name="screen"></param> public LobbyScreenView(LobbyScreen screen) : base(screen) { LobbyScreen = screen; CreateBackground(); CreateHeader(); CreateFooter(); Visualizer = new MenuAudioVisualizer((int) WindowManager.Width, 400, 150, 5) { Parent = Container, Alignment = Alignment.BotLeft, Y = -Footer.Height }; Visualizer.Bars.ForEach(x => { x.Alpha = 0.30f; }); CreateSearchBox(); CreateMatchContainer(); Jukebox = new Jukebox(true); FilterBackground = new Sprite() { Parent = Container, Position = new ScalableVector2(-Searchbox.X, Searchbox.Y), Size = new ScalableVector2(762, Searchbox.Height), Tint = Color.Black, Alpha = 0.75f }; FilterBackground.AddBorder(Color.White, 2); const float spacing = 60f; var locked = new LabelledCheckbox("Display Locked", ConfigManager.LobbyFilterHasPassword) { Parent = FilterBackground, Alignment = Alignment.MidLeft, X = 14 }; var full = new LabelledCheckbox("Display Full", ConfigManager.LobbyFilterFullGame) { Parent = FilterBackground, Alignment = Alignment.MidLeft, X = locked.X + locked.Width + spacing }; var owned = new LabelledCheckbox("Map Downloaded", ConfigManager.LobbyFilterOwnsMap) { Parent = FilterBackground, Alignment = Alignment.MidLeft, X = full.X + full.Width + spacing }; var friends = new LabelledCheckbox("Friends In Game", ConfigManager.LobbyFilterHasFriends) { Parent = FilterBackground, Alignment = Alignment.MidLeft, X = owned.X + owned.Width + spacing }; ConfigManager.LobbyFilterHasPassword.ValueChanged += RefilterGames; ConfigManager.LobbyFilterFullGame.ValueChanged += RefilterGames; ConfigManager.LobbyFilterOwnsMap.ValueChanged += RefilterGames; ConfigManager.LobbyFilterHasFriends.ValueChanged += RefilterGames; } /// <summary> /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RefilterGames(object sender, BindableValueChangedEventArgs<bool> e) => MatchContainer.FilterGames(Searchbox.RawText, true); /// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> public override void Update(GameTime gameTime) { Container?.Update(gameTime); Jukebox.Update(gameTime); if (DialogManager.Dialogs.Count != 0) Searchbox.Focused = false; } /// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> public override void Draw(GameTime gameTime) { GameBase.Game.GraphicsDevice.Clear(Color.Black); BackgroundHelper.Draw(gameTime); Container?.Draw(gameTime); } /// <inheritdoc /> /// <summary> /// </summary> public override void Destroy() { // ReSharper disable DelegateSubtraction ConfigManager.LobbyFilterHasPassword.ValueChanged -= RefilterGames; ConfigManager.LobbyFilterFullGame.ValueChanged -= RefilterGames; ConfigManager.LobbyFilterOwnsMap.ValueChanged -= RefilterGames; ConfigManager.LobbyFilterHasFriends.ValueChanged -= RefilterGames; Container?.Destroy(); } /// <summary> /// </summary> private void CreateBackground() => Background = new BackgroundImage(UserInterface.MenuBackgroundRaw, 0, true) { Parent = Container }; /// <summary> /// </summary> private void CreateHeader() { Header = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_group_profile_users), "MULTIPLAYER", "LOBBY", "find or create an online match", Colors.MainAccent) { Parent = Container }; Header.Y = -Header.Height; Header.MoveToY(0, Easing.OutQuint, 600); } /// <summary> /// </summary> private void CreateFooter() { Footer = new MenuFooter(new List<ButtonText> { new ButtonText(FontsBitmap.GothamRegular, "back to menu", 14, (o, e) => LobbyScreen.ExitToMenu()), new ButtonText(FontsBitmap.GothamRegular, "options menu", 14, (o, e) => DialogManager.Show(new SettingsDialog())) }, new List<ButtonText> { new ButtonText(FontsBitmap.GothamRegular, "quick match", 14, (o, e) => { }), new ButtonText(FontsBitmap.GothamRegular, "create match", 14, (o, e) => DialogManager.Show(new CreateGameDialog())), }, Colors.MainAccent) { Parent = Container, Alignment = Alignment.BotLeft }; Footer.Y = Footer.Height; Footer.MoveToY(0, Easing.OutQuint, 600); } /// <summary> /// </summary> private void CreateSearchBox() => Searchbox = new LobbySearchBox(this, new ScalableVector2(450, 36)) { Parent = Container, Alignment = Alignment.TopRight, Y = Header.Height + 20, X = -22 }; /// <summary> /// </summary> private void CreateMatchContainer() => MatchContainer = new LobbyMatchScrollContainer((LobbyScreen) Screen, new List<MultiplayerGame>(), int.MaxValue, 0, new ScalableVector2(1320, 584), new ScalableVector2(1320, 584)) { Parent = Container, Alignment = Alignment.TopCenter, Y = Searchbox.Y + Searchbox.Height + 20 }; /// <summary> /// </summary> private void CreateMatchInfo() => MatchInfo = new LobbyMatchInfo(Screen as LobbyScreen) { Parent = Container, Alignment = Alignment.TopLeft, X = 30, Y = Searchbox.Y }; } }
32.617978
158
0.565966
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
YaLTeR/Quaver
Quaver.Shared/Screens/Lobby/LobbyScreenView.cs
8,711
C#
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using EditorUtils; using Microsoft.VisualStudio; using Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.TextManager.Interop; using Vim; using IServiceProvider = System.IServiceProvider; namespace Vim.VisualStudio.Implementation.Misc { [Export(typeof(ITextManager))] internal sealed class TextManager : ITextManager { private readonly IVsAdapter _vsAdapter; private readonly IVsTextManager _textManager; private readonly IVsRunningDocumentTable _runningDocumentTable; private readonly IServiceProvider _serviceProvider; private readonly ITextDocumentFactoryService _textDocumentFactoryService; private readonly ITextBufferFactoryService _textBufferFactoryService; private readonly ISharedService _sharedService; internal ITextView ActiveTextViewOptional { get { IVsTextView vsTextView; IWpfTextView textView = null; try { ErrorHandler.ThrowOnFailure(_textManager.GetActiveView(0, null, out vsTextView)); textView = _vsAdapter.EditorAdapter.GetWpfTextView(vsTextView); } catch { // Both ThrowOnFailure and GetWpfTextView can throw an exception. The latter will // throw even if a non-null value is passed into it textView = null; } return textView; } } [ImportingConstructor] internal TextManager( IVsAdapter adapter, ITextDocumentFactoryService textDocumentFactoryService, ITextBufferFactoryService textBufferFactoryService, ISharedServiceFactory sharedServiceFactory, SVsServiceProvider serviceProvider) : this(adapter, textDocumentFactoryService, textBufferFactoryService, sharedServiceFactory.Create(), serviceProvider) { } internal TextManager( IVsAdapter adapter, ITextDocumentFactoryService textDocumentFactoryService, ITextBufferFactoryService textBufferFactoryService, ISharedService sharedService, SVsServiceProvider serviceProvider) { _vsAdapter = adapter; _serviceProvider = serviceProvider; _textManager = _serviceProvider.GetService<SVsTextManager, IVsTextManager>(); _textDocumentFactoryService = textDocumentFactoryService; _textBufferFactoryService = textBufferFactoryService; _runningDocumentTable = _serviceProvider.GetService<SVsRunningDocumentTable, IVsRunningDocumentTable>(); _sharedService = sharedService; } private IEnumerable<ITextBuffer> GetDocumentTextBuffers(DocumentLoad documentLoad) { var list = new List<ITextBuffer>(); foreach (var docCookie in _runningDocumentTable.GetRunningDocumentCookies()) { if (documentLoad == DocumentLoad.RespectLazy && _sharedService.IsLazyLoaded(docCookie)) { continue; } ITextBuffer buffer; if (_vsAdapter.GetTextBufferForDocCookie(docCookie).TryGetValue(out buffer)) { list.Add(buffer); } } return list; } private IEnumerable<ITextView> GetDocumentTextViews(DocumentLoad documentLoad) { var list = new List<ITextView>(); foreach (var textBuffer in GetDocumentTextBuffers(documentLoad)) { list.AddRange(GetTextViews(textBuffer)); } return list; } internal bool NavigateTo(VirtualSnapshotPoint point) { var tuple = SnapshotPointUtil.GetLineColumn(point.Position); var line = tuple.Item1; var column = tuple.Item2; var vsBuffer = _vsAdapter.EditorAdapter.GetBufferAdapter(point.Position.Snapshot.TextBuffer); var viewGuid = VSConstants.LOGVIEWID_Code; var hr = _textManager.NavigateToLineAndColumn( vsBuffer, ref viewGuid, line, column, line, column); return ErrorHandler.Succeeded(hr); } internal Result Save(ITextBuffer textBuffer) { // In order to save the ITextBuffer we need to get a document cookie for it. The only way I'm // aware of is to use the path moniker which is available for the accompanying ITextDocment // value. // // In many types of files (.cs, .vb, .cpp) there is usually a 1-1 mapping between ITextBuffer // and the ITextDocument. But in any file type where an IProjectionBuffer is common (.js, // .aspx, etc ...) this mapping breaks down. To get it back we must visit all of the // source buffers for a projection and individually save them var result = Result.Success; foreach (var sourceBuffer in textBuffer.GetSourceBuffersRecursive()) { // The inert buffer doesn't need to be saved. It's used as a fake buffer by web applications // in order to render projected content if (sourceBuffer.ContentType == _textBufferFactoryService.InertContentType) { continue; } var sourceResult = SaveCore(sourceBuffer); if (sourceResult.IsError) { result = sourceResult; } } return result; } internal Result SaveCore(ITextBuffer textBuffer) { ITextDocument textDocument; if (!_textDocumentFactoryService.TryGetTextDocument(textBuffer, out textDocument)) { return Result.Error; } try { var docCookie = _vsAdapter.GetDocCookie(textDocument).Value; var runningDocumentTable = _serviceProvider.GetService<SVsRunningDocumentTable, IVsRunningDocumentTable>(); ErrorHandler.ThrowOnFailure(runningDocumentTable.SaveDocuments((uint)__VSRDTSAVEOPTIONS.RDTSAVEOPT_ForceSave, null, 0, docCookie)); return Result.Success; } catch (Exception e) { return Result.CreateError(e); } } internal bool CloseView(ITextView textView) { IVsCodeWindow vsCodeWindow; if (!_vsAdapter.GetCodeWindow(textView).TryGetValue(out vsCodeWindow)) { return false; } if (vsCodeWindow.IsSplit()) { return SendSplit(vsCodeWindow); } IVsWindowFrame vsWindowFrame; if (!_vsAdapter.GetContainingWindowFrame(textView).TryGetValue(out vsWindowFrame)) { return false; } // It's possible for IVsWindowFrame elements to nest within each other. When closing we want to // close the actual tab in the editor so get the top most item vsWindowFrame = vsWindowFrame.GetTopMost(); var value = __FRAMECLOSE.FRAMECLOSE_NoSave; return ErrorHandler.Succeeded(vsWindowFrame.CloseFrame((uint)value)); } internal bool SplitView(ITextView textView) { IVsCodeWindow codeWindow; if (_vsAdapter.GetCodeWindow(textView).TryGetValue(out codeWindow)) { return SendSplit(codeWindow); } return false; } internal bool MoveViewUp(ITextView textView) { try { var vsCodeWindow = _vsAdapter.GetCodeWindow(textView).Value; var vsTextView = vsCodeWindow.GetSecondaryView().Value; return ErrorHandler.Succeeded(vsTextView.SendExplicitFocus()); } catch { return false; } } internal bool MoveViewDown(ITextView textView) { try { var vsCodeWindow = _vsAdapter.GetCodeWindow(textView).Value; var vsTextView = vsCodeWindow.GetPrimaryView().Value; return ErrorHandler.Succeeded(vsTextView.SendExplicitFocus()); } catch { return false; } } /// <summary> /// Send the split command. This is really a toggle command that will split /// and unsplit the window /// </summary> private static bool SendSplit(IVsCodeWindow codeWindow) { var target = codeWindow as IOleCommandTarget; if (target != null) { var group = VSConstants.GUID_VSStandardCommandSet97; var cmdId = VSConstants.VSStd97CmdID.Split; var result = target.Exec(ref group, (uint)cmdId, (uint)OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, IntPtr.Zero, IntPtr.Zero); return VSConstants.S_OK == result; } return false; } internal IEnumerable<ITextView> GetTextViews(ITextBuffer textBuffer) { return _vsAdapter.GetTextViews(textBuffer) .Select(x => _vsAdapter.EditorAdapter.GetWpfTextView(x)) .Where(x => x != null); } #region ITextManager ITextView ITextManager.ActiveTextViewOptional { get { return ActiveTextViewOptional; } } IEnumerable<ITextView> ITextManager.GetDocumentTextViews(ITextBuffer textBuffer) { return GetTextViews(textBuffer); } IEnumerable<ITextBuffer> ITextManager.GetDocumentTextBuffers(DocumentLoad documentLoad) { return GetDocumentTextBuffers(documentLoad); } IEnumerable<ITextView> ITextManager.GetDocumentTextViews(DocumentLoad documentLoad) { return GetDocumentTextViews(documentLoad); } bool ITextManager.NavigateTo(VirtualSnapshotPoint point) { return NavigateTo(point); } Result ITextManager.Save(ITextBuffer textBuffer) { return Save(textBuffer); } bool ITextManager.CloseView(ITextView textView) { return CloseView(textView); } bool ITextManager.SplitView(ITextView textView) { return SplitView(textView); } bool ITextManager.MoveViewUp(ITextView textView) { return MoveViewUp(textView); } bool ITextManager.MoveViewDown(ITextView textView) { return MoveViewDown(textView); } #endregion } }
36.454829
166
0.577679
[ "Apache-2.0" ]
Kazark/VsVim
Src/VsVimShared/Implementation/Misc/TextManager.cs
11,704
C#
using System.Net; using System.Net.Http; using System.Text; using System.Web.Mvc; using TeaCommerce.Api.Serialization; using TeaCommerce.Api.Services; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; namespace TeaCommerce.Umbraco.Application.Controllers { [PluginController( Constants.Applications.TeaCommerce )] public class ShippingMethodsController : UmbracoAuthorizedApiController { [HttpGet] public HttpResponseMessage GetAll( long storeId ) { HttpResponseMessage response = Request.CreateResponse( HttpStatusCode.OK ); response.Content = new StringContent( ShippingMethodService.Instance.GetAll( storeId ).ToJson(), Encoding.UTF8, "application/json" ); return response; } [HttpGet] public HttpResponseMessage Get( long storeId, long shippingMethodId ) { HttpResponseMessage response = Request.CreateResponse( HttpStatusCode.OK ); response.Content = new StringContent( ShippingMethodService.Instance.Get( storeId, shippingMethodId ).ToJson(), Encoding.UTF8, "application/json" ); return response; } } }
35.966667
154
0.76089
[ "MIT" ]
TeaCommerce/Tea-Commerce-for-Umbraco
Source/TeaCommerce.Umbraco.Application/Controllers/ShippingMethodsController.cs
1,081
C#
using Newtonsoft.Json; namespace Nest { [JsonObject] public class GetStats { [JsonProperty("current")] public long Current { get; set; } [JsonProperty("exists_time")] public string ExistsTime { get; set; } [JsonProperty("exists_time_in_millis")] public long ExistsTimeInMilliseconds { get; set; } [JsonProperty("exists_total")] public long ExistsTotal { get; set; } [JsonProperty("missing_time")] public string MissingTime { get; set; } [JsonProperty("missing_time_in_millis")] public long MissingTimeInMilliseconds { get; set; } [JsonProperty("missing_total")] public long MissingTotal { get; set; } [JsonProperty("time")] public string Time { get; set; } [JsonProperty("time_in_millis")] public long TimeInMilliseconds { get; set; } [JsonProperty("total")] public long Total { get; set; } } }
22.918919
53
0.701651
[ "Apache-2.0" ]
Tchami/elasticsearch-net
src/Nest/CommonOptions/Stats/GetStats.cs
850
C#
using UnityEngine; namespace Amity { #if UNITY_EDITOR [ExecuteAlways] public class EdgeCollider2DDrawer : Collider2DDrawer { public EdgeCollider2D[] targets; private void Awake() { if (targets == null) targets = new EdgeCollider2D[0]; } private void Update() { for (int i = 0; i < targets.Length; i++) { if (targets[i] == null) continue; Vector2[] path = targets[i].points; for (int j = 0; j < path.Length; j++) path[j] += (Vector2) targets[i].transform.position; DrawEdge(path, lineColor); } } private void DrawEdge(Vector2[] edge, Color color) { for (int i = 0; i < edge.Length - 1; i++) { Debug.DrawLine(edge[i], edge[i + 1], color); } } } #endif }
26.4
71
0.481602
[ "MIT" ]
NicknEma/Amity
Assets/Physics/EdgeCollider2DDrawer.cs
924
C#
#pragma checksum "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "42cc32914d4b807e6d7d67fc9bcc0a687a114939" // <auto-generated/> #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(eHealthcare.Pages.Shared.Pages_Shared__LoginPartial), @"mvc.1.0.view", @"/Pages/Shared/_LoginPartial.cshtml")] namespace eHealthcare.Pages.Shared { #line hidden using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; #nullable restore #line 1 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\_ViewImports.cshtml" using eHealthcare; #line default #line hidden #nullable disable #nullable restore #line 1 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" using Microsoft.AspNetCore.Identity; #line default #line hidden #nullable disable [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"42cc32914d4b807e6d7d67fc9bcc0a687a114939", @"/Pages/Shared/_LoginPartial.cshtml")] [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"0bde8f0330710cf3b7559febaece93b202afc9a6", @"/Pages/_ViewImports.cshtml")] public class Pages_Shared__LoginPartial : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic> { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("nav-link text-dark"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-area", "Identity", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-page", "/Account/Manage/Index", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("title", new global::Microsoft.AspNetCore.Html.HtmlString("Manage"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("form-inline"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-page", "/Account/Logout", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-page", "/Account/Register", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("asp-page", "/Account/Login", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext; #pragma warning restore 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); #pragma warning disable 0169 private string __tagHelperStringValueBuffer; #pragma warning restore 0169 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __backed__tagHelperScopeManager = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager { get { if (__backed__tagHelperScopeManager == null) { __backed__tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(StartTagHelperWritingScope, EndTagHelperWritingScope); } return __backed__tagHelperScopeManager; } } private global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper; private global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("<!--"); WriteLiteral("\n<ul class=\"navbar-nav\">\n"); #nullable restore #line 6 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" if (SignInManager.IsSignedIn(User)) { #line default #line hidden #nullable disable WriteLiteral(" <li class=\"nav-item\">\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42cc32914d4b807e6d7d67fc9bcc0a687a1149396400", async() => { WriteLiteral("Hello "); #nullable restore #line 9 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" Write(User.Identity.Name); #line default #line hidden #nullable disable WriteLiteral("!"); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\n </li>\n <li class=\"nav-item\">\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42cc32914d4b807e6d7d67fc9bcc0a687a1149398312", async() => { WriteLiteral("\n <button type=\"submit\" class=\"nav-link btn btn-link text-dark\">Logout</button>\n "); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Page = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); if (__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-returnUrl", "Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #nullable restore #line 12 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" WriteLiteral(Url.Page("/", new { area = "" })); #line default #line hidden #nullable disable __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-returnUrl", __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.RouteValues["returnUrl"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\n </li>\n"); #nullable restore #line 17 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" } else { #line default #line hidden #nullable disable WriteLiteral(" <li class=\"nav-item\">\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42cc32914d4b807e6d7d67fc9bcc0a687a11493911491", async() => { WriteLiteral("Register"); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_6.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_6); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\n </li>\n <li class=\"nav-item\">\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "42cc32914d4b807e6d7d67fc9bcc0a687a11493912976", async() => { WriteLiteral("Login"); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_7.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\n </li>\n"); #nullable restore #line 26 "D:\jasonbranch2\TM1-Tues-4pm-JasonBranch2\builds\ehealthcare\Pages\Shared\_LoginPartial.cshtml" } #line default #line hidden #nullable disable WriteLiteral("</ul>\n -->"); } #pragma warning restore 1998 [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public UserManager<IdentityUser> UserManager { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public SignInManager<IdentityUser> SignInManager { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; } } } #pragma warning restore 1591
72.317972
356
0.748741
[ "MIT" ]
asdsadv/TM1-Tues-4pm
builds/ehealthcare/obj/Debug/netcoreapp3.1/Razor/Pages/Shared/_LoginPartial.cshtml.g.cs
15,693
C#
using System; using System.Reflection; using System.Threading.Tasks; using WebAnchor.RequestFactory; using WebAnchor.ResponseParser; namespace WebAnchor { public class Anchor : IDisposable { private readonly bool _shouldDisposeHttpClient; public Anchor(IHttpClient httpClient, HttpRequestFactory httpRequestBuilder, HttpResponseHandlersList httpResponseParser, bool shouldDisposeHttpClient) { _shouldDisposeHttpClient = shouldDisposeHttpClient; HttpClient = httpClient; HttpRequestBuilder = httpRequestBuilder; HttpResponseParser = httpResponseParser; } public IHttpClient HttpClient { get; set; } public HttpRequestFactory HttpRequestBuilder { get; set; } public HttpResponseHandlersList HttpResponseParser { get; set; } public void Dispose() { if (_shouldDisposeHttpClient) { HttpClient.Dispose(); } } public async Task<T> Intercept<T>(MethodInfo methodInfo, object[] parameters) { var request = HttpRequestBuilder.Create(methodInfo, parameters); var handler = HttpResponseParser.FindHandler(methodInfo); if (handler == null) { throw new WebAnchorException($"Return type of method {methodInfo.Name} in {methodInfo.DeclaringType.FullName} cannot be handled by any of the registered response handlers."); } var httpResponseMessage = await HttpClient.SendAsync(request, handler.HttpCompletionOptions); return await handler.HandleAsync<T>(httpResponseMessage, methodInfo); } } }
36.170213
190
0.667059
[ "MIT" ]
mattiasnordqvist/Web-Anchor
WebAnchor/Anchor.cs
1,702
C#
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.IO; using NUnit.Framework; using OpenTK; using OpenTK.Graphics; using osu.Game.Tests.Resources; using System.Linq; using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; using osu.Game.Skinning; namespace osu.Game.Tests.Beatmaps.Formats { [TestFixture] public class LegacyBeatmapDecoderTest { [Test] public void TestDecodeBeatmapGeneral() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var beatmap = decoder.Decode(stream); var beatmapInfo = beatmap.BeatmapInfo; var metadata = beatmap.Metadata; Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", metadata.AudioFile); Assert.AreEqual(0, beatmapInfo.AudioLeadIn); Assert.AreEqual(164471, metadata.PreviewTime); Assert.IsFalse(beatmapInfo.Countdown); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.IsTrue(beatmapInfo.RulesetID == 0); Assert.IsFalse(beatmapInfo.LetterboxInBreaks); Assert.IsFalse(beatmapInfo.SpecialStyle); Assert.IsFalse(beatmapInfo.WidescreenStoryboard); } } [Test] public void TestDecodeBeatmapEditor() { var decoder = new LegacyBeatmapDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var beatmapInfo = decoder.Decode(stream).BeatmapInfo; int[] expectedBookmarks = { 11505, 22054, 32604, 43153, 53703, 64252, 74802, 85351, 95901, 106450, 116999, 119637, 130186, 140735, 151285, 161834, 164471, 175020, 185570, 196119, 206669, 209306 }; Assert.AreEqual(expectedBookmarks.Length, beatmapInfo.Bookmarks.Length); for (int i = 0; i < expectedBookmarks.Length; i++) Assert.AreEqual(expectedBookmarks[i], beatmapInfo.Bookmarks[i]); Assert.AreEqual(1.8, beatmapInfo.DistanceSpacing); Assert.AreEqual(4, beatmapInfo.BeatDivisor); Assert.AreEqual(4, beatmapInfo.GridSize); Assert.AreEqual(2, beatmapInfo.TimelineZoom); } } [Test] public void TestDecodeBeatmapMetadata() { var decoder = new LegacyBeatmapDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var beatmap = decoder.Decode(stream); var beatmapInfo = beatmap.BeatmapInfo; var metadata = beatmap.Metadata; Assert.AreEqual("Renatus", metadata.Title); Assert.AreEqual("Renatus", metadata.TitleUnicode); Assert.AreEqual("Soleily", metadata.Artist); Assert.AreEqual("Soleily", metadata.ArtistUnicode); Assert.AreEqual("Gamu", metadata.AuthorString); Assert.AreEqual("Insane", beatmapInfo.Version); Assert.AreEqual(string.Empty, metadata.Source); Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags); Assert.AreEqual(557821, beatmapInfo.OnlineBeatmapID); Assert.AreEqual(241526, metadata.OnlineBeatmapSetID); } } [Test] public void TestDecodeBeatmapDifficulty() { var decoder = new LegacyBeatmapDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var difficulty = decoder.Decode(stream).BeatmapInfo.BaseDifficulty; Assert.AreEqual(6.5f, difficulty.DrainRate); Assert.AreEqual(4, difficulty.CircleSize); Assert.AreEqual(8, difficulty.OverallDifficulty); Assert.AreEqual(9, difficulty.ApproachRate); Assert.AreEqual(1.8, difficulty.SliderMultiplier); Assert.AreEqual(2, difficulty.SliderTickRate); } } [Test] public void TestDecodeBeatmapEvents() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var beatmap = decoder.Decode(stream); var metadata = beatmap.Metadata; var breakPoint = beatmap.Breaks[0]; Assert.AreEqual("machinetop_background.jpg", metadata.BackgroundFile); Assert.AreEqual(122474, breakPoint.StartTime); Assert.AreEqual(140135, breakPoint.EndTime); Assert.IsTrue(breakPoint.HasEffect); } } [Test] public void TestDecodeBeatmapTimingPoints() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var beatmap = decoder.Decode(stream); var controlPoints = beatmap.ControlPointInfo; Assert.AreEqual(4, controlPoints.TimingPoints.Count); var timingPoint = controlPoints.TimingPoints[0]; Assert.AreEqual(956, timingPoint.Time); Assert.AreEqual(329.67032967033d, timingPoint.BeatLength); Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature); Assert.AreEqual(5, controlPoints.DifficultyPoints.Count); var difficultyPoint = controlPoints.DifficultyPoints[0]; Assert.AreEqual(116999, difficultyPoint.Time); Assert.AreEqual(0.75000000000000189d, difficultyPoint.SpeedMultiplier); Assert.AreEqual(34, controlPoints.SamplePoints.Count); var soundPoint = controlPoints.SamplePoints[0]; Assert.AreEqual(956, soundPoint.Time); Assert.AreEqual("soft", soundPoint.SampleBank); Assert.AreEqual(60, soundPoint.SampleVolume); Assert.AreEqual(8, controlPoints.EffectPoints.Count); var effectPoint = controlPoints.EffectPoints[0]; Assert.AreEqual(53703, effectPoint.Time); Assert.IsTrue(effectPoint.KiaiMode); Assert.IsFalse(effectPoint.OmitFirstBarLine); } } [Test] public void TestDecodeBeatmapColors() { var decoder = new LegacySkinDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var comboColors = decoder.Decode(stream).ComboColours; Color4[] expectedColors = { new Color4(142, 199, 255, 255), new Color4(255, 128, 128, 255), new Color4(128, 255, 255, 255), new Color4(128, 255, 128, 255), new Color4(255, 187, 255, 255), new Color4(255, 177, 140, 255), }; Assert.AreEqual(expectedColors.Length, comboColors.Count); for (int i = 0; i < expectedColors.Length; i++) Assert.AreEqual(expectedColors[i], comboColors[i]); } } [Test] public void TestDecodeBeatmapHitObjects() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var stream = new StreamReader(resStream)) { var hitObjects = decoder.Decode(stream).HitObjects; var curveData = hitObjects[0] as IHasCurve; var positionData = hitObjects[0] as IHasPosition; Assert.IsNotNull(positionData); Assert.IsNotNull(curveData); Assert.AreEqual(new Vector2(192, 168), positionData.Position); Assert.AreEqual(956, hitObjects[0].StartTime); Assert.IsTrue(hitObjects[0].Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); positionData = hitObjects[1] as IHasPosition; Assert.IsNotNull(positionData); Assert.AreEqual(new Vector2(304, 56), positionData.Position); Assert.AreEqual(1285, hitObjects[1].StartTime); Assert.IsTrue(hitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); } } } }
45.055556
99
0.572133
[ "MIT" ]
EvanD7657/WIP-Clicking-Game
osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs
9,529
C#
using LibraryManagementSystem.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using Unity; namespace LibraryManagementSystem.Views { /// <summary> /// Interaction logic for BookUpdationWindow.xaml /// </summary> public partial class BookUpdationWindow : Window { [Dependency] public BookSearchVM BookSearchVM { set { DataContext = value; } } public BookUpdationWindow() { InitializeComponent(); } private void CancelBtn_Click(object sender, RoutedEventArgs e) { Close(); } } }
22.136364
70
0.647844
[ "MIT" ]
GaneshIT/LibraryManagementWPF
LibraryManagementSystem/Views/BookUpdationWindow.xaml.cs
976
C#
using System; namespace xxAMIDOxx.xxSTACKSxx.CQRS.Commands { public class DeleteCategory : ICategoryCommand { public int OperationCode => (int)Common.Operations.OperationCode.DeleteCategory; public Guid CorrelationId { get; } public Guid MenuId { get; set; } public Guid CategoryId { get; set; } public DeleteCategory(Guid correlationId, Guid menuId, Guid categoryId) { CorrelationId = correlationId; MenuId = menuId; CategoryId = categoryId; } } }
24.26087
88
0.632616
[ "MIT" ]
alexanderwjrussell/stacks-dotnet-cqrs-events
src/api/xxAMIDOxx.xxSTACKSxx.CQRS/Commands/DeleteCategory.cs
558
C#
#region License // The MIT License (MIT) // // Copyright (c) 2014 Emma 'Eniko' Maassen // // 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. #endregion using System; using System.Collections.Generic; using System.Text; namespace TextPlayer.ABC { /// <summary> /// Represents a single field of information in an ABC header. /// </summary> public struct ABCInfo { public char Identifier; public string Text; public ABCInfo(char ident, string text) { Identifier = ident; Text = text; } public static ABCInfo? Parse(string line) { if (line.Length < 2) return null; char id = line.ToUpperInvariant()[0]; if ((int)id < 65 || (int)id > 90 || line.Substring(1, 1) != ":") return null; string text; if (line.Length > 2) text = line.Substring(2); else text = ""; return new ABCInfo(id, text); } } }
34.932203
80
0.649685
[ "MIT" ]
Enichan/textplayer
TextPlayer/ABC/ABCInfo.cs
2,063
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CricketScore { class Score { int CurrentScore; float NumOvers; Display[] displays = new Display[10]; int lastIndex = 0; public void addDisplay(Display display) { displays[lastIndex] = display; lastIndex++; } public void Notify() { foreach(Display d in displays) { if (d != null) { d.Update(CurrentScore, NumOvers); } } } public void change(int CurrentScore, float NumOvers) { this.CurrentScore = CurrentScore; this.NumOvers = NumOvers; Notify(); } } }
20.619048
60
0.501155
[ "MIT" ]
19251A05J0/Hacktoberfest2021
Contributions/CricketScore-ObserverPattern/Score.cs
868
C#
// Decompiled with JetBrains decompiler // Type: BlueStacks.Common.UnknownErrorException // Assembly: HD-Common, Version=4.250.0.1070, Culture=neutral, PublicKeyToken=null // MVID: 7033AB66-5028-4A08-B35C-D9B2B424A68A // Assembly location: C:\Program Files\BlueStacks\HD-Common.dll using System; using System.Runtime.Serialization; namespace BlueStacks.Common { [Serializable] public class UnknownErrorException : Exception { public int ErrorCode { get; set; } = 99; public override string Message { get { return "An exception of an unknown type has occurred."; } } public UnknownErrorException(Exception innerException) : base("", innerException) { } public UnknownErrorException() { } public UnknownErrorException(string message) : base(message) { } public UnknownErrorException(string message, Exception innerException) : base(message, innerException) { } protected UnknownErrorException( SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext) { } } }
22.519231
82
0.691716
[ "MIT" ]
YehudaEi/Bluestacks-source-code
src/HD-Common/BlueStacks/Common/UnknownErrorException.cs
1,173
C#
using System; using Networking.Model.DataLink; namespace Networking.Model.Application { /// <summary> /// VXLAN : RFC7348 /// <see href="https://en.wikipedia.org/wiki/Virtual_Extensible_LAN"/> /// <see href="https://tools.ietf.org/html/rfc7348"/> /// </summary> public partial class VXLAN : Octets { /// <summary> /// 服务端端口号=4789 /// </summary> public const UInt16 ServerPort = 4789; /// <summary> /// I /// </summary> public Boolean I { get { return base.GetBoolean(Layout.TagBegin, Layout.TagIBitIndex); } set { base.SetBoolean(Layout.TagBegin, Layout.TagIBitIndex, value); } } /// <summary> /// VXLAN Network Identifier /// </summary> public UInt32 VNI { get { return base.GetUInt32(Layout.VNIBegin, Layout.VNIBitIndex, Layout.VNIBitLength); } set { base.SetUInt32(Layout.VNIBegin, Layout.VNIBitIndex, Layout.VNIBitLength, value); } } /// <summary> /// 负载信息 /// </summary> public EthernetFrame Payload { get { return new EthernetFrame { Bytes = GetBytes(Layout.HeaderLength) }; } } } }
26.529412
100
0.518108
[ "MIT" ]
heshang233/networking
src/networking.model/Application/VXLAN.cs
1,373
C#
using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; namespace Orleankka.Features.Actor_behaviors { using Behaviors; namespace Hierarchical_state_machine { using System; [TestFixture] class Tests { List<string> events; void AssertEvents(params string[] expected) => CollectionAssert.AreEqual(expected, events); [SetUp] public void SetUp() => events = new List<string>(); [Test] public async Task When_transitioning() { Behavior behavior = new BehaviorTester(events) .State("Initial") .State("A", super: "S") .State("B", super: "SS") .State("S", super: "SS") .State("SS", super: "SSS") .State("SSS") .Initial("Initial"); await behavior.Become("A"); Assert.That(behavior.Current.Name, Is.EqualTo("A")); AssertEvents( "OnDeactivate_Initial", "OnUnbecome_Initial", "OnBecome_SSS", "OnBecome_SS", "OnBecome_S", "OnBecome_A", "OnActivate_SSS", "OnActivate_SS", "OnActivate_S", "OnActivate_A" ); } [Test] public async Task When_transitioning_within_same_super() { Behavior behavior = new BehaviorTester(events) .State("Initial") .State("A", super: "S") .State("B", super: "SS") .State("S", super: "SS") .State("SS") .Initial("A"); await behavior.Become("B"); Assert.That(behavior.Current.Name, Is.EqualTo("B")); AssertEvents( "OnDeactivate_A", "OnDeactivate_S", "OnUnbecome_A", "OnUnbecome_S", "OnBecome_B", "OnActivate_B" ); } [Test] public async Task When_transitioning_different_super() { Behavior behavior = new BehaviorTester(events) .State("Initial") .State("A", super: "S") .State("B", super: "SS") .State("S", super: "SS") .State("SS", super: "SSS") .State("C", super: "SSSS") .State("SSS") .State("SSSS") .Initial("A"); await behavior.Become("C"); Assert.That(behavior.Current.Name, Is.EqualTo("C")); AssertEvents( "OnDeactivate_A", "OnDeactivate_S", "OnDeactivate_SS", "OnDeactivate_SSS", "OnUnbecome_A", "OnUnbecome_S", "OnUnbecome_SS", "OnUnbecome_SSS", "OnBecome_SSSS", "OnBecome_C", "OnActivate_SSSS", "OnActivate_C" ); } [Test] public void When_cyclic_super() { var sm = new StateMachine() .State("A", _ => null, super: "S") .State("S", _ => null, super: "SS") .State("SS", _ => null, super: "A"); var ex = Assert.Throws<InvalidOperationException>(() => sm.Build()); Assert.That(ex.Message, Is.EqualTo("Cycle detected: A -> S -> SS !-> A")); } [Test] public async Task When_receiving_activate_message_initial() { var behavior = new Behavior(new StateMachine() .State("A", _ => TaskResult.Done) .State("B", _ => TaskResult.Done)); behavior.Initial("A"); var result = await behavior.Receive(Activate.Message); Assert.That(result, Is.SameAs(Done.Result)); } [Test] public async Task When_receiving_deactivate_message_initial() { var behavior = new Behavior(new StateMachine() .State("A", _ => TaskResult.Done) .State("B", _ => TaskResult.Done)); behavior.Initial("A"); var result = await behavior.Receive(Deactivate.Message); Assert.That(result, Is.SameAs(Done.Result)); } [Test] public async Task When_receiving_message_should_check_handlers_in_a_chain() { Task<object> AReceive(object message) => message is string ? Task.FromResult<object>("foo") : TaskResult.Unhandled; Task<object> SReceive(object message) => message is int ? Task.FromResult<object>("bar") : TaskResult.Unhandled; var behavior = new Behavior(new StateMachine() .State("A", AReceive, super: "S") .State("S", SReceive)); behavior.Initial("A"); Assert.That(await behavior.Receive("1"), Is.EqualTo("foo")); Assert.That(await behavior.Receive(1), Is.EqualTo("bar")); Assert.That(await behavior.Receive(DateTime.Now), Is.SameAs(ActorGrain.Unhandled)); } [Test] public async Task When_using_fluent_dsl() { Behavior behavior = new BehaviorTester(events) .State("Initial") .State("S1") .Substate("S1A") .Substate("S1B") .State("S2") .Substate("S2A") .Initial("Initial"); await behavior.Become("S1A"); Assert.That(behavior.Current.Name, Is.EqualTo("S1A")); await behavior.Become("S1B"); Assert.That(behavior.Current.Name, Is.EqualTo("S1B")); await behavior.Become("S2A"); Assert.That(behavior.Current.Name, Is.EqualTo("S2A")); Debug.WriteLine(string.Join(",\r\n", events.Select(x => $"\"{x}\""))); AssertEvents( "OnDeactivate_Initial", "OnUnbecome_Initial", "OnBecome_S1", "OnBecome_S1A", "OnActivate_S1", "OnActivate_S1A", "OnDeactivate_S1A", "OnUnbecome_S1A", "OnBecome_S1B", "OnActivate_S1B", "OnDeactivate_S1B", "OnDeactivate_S1", "OnUnbecome_S1B", "OnUnbecome_S1", "OnBecome_S2", "OnBecome_S2A", "OnActivate_S2", "OnActivate_S2A" ); } } } }
35.333333
99
0.415222
[ "Apache-2.0" ]
Jubast/Orleankka
Tests/Orleankka.Tests/Features/Actor_behaviors/Hierarchical_state_machine.cs
7,846
C#
using eIDEAS.Models.Enums; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace eIDEAS.Models { public class ApplicationUserPresentationViewModel { public Guid ID { get; set; } [Display (Name = "First Name")] public string FirstName { get; set; } [Display(Name = "Last Name")] public string LastName { get; set; } [Display(Name = "Email Address")] public string Email { get; set; } public string Division { get; set; } public string Unit { get; set; } [Display(Name = "Idea Points")] public int IdeaPoints { get; set; } [Display(Name = "Participation Points")] public int ParticipationPoints { get; set; } [Display(Name = "User's Roles")] public List<RoleEnum> UserRoles { get; set; } public int Permissions { get; set; } } }
25.081081
53
0.607759
[ "MIT" ]
ShawnClake/IdeaManagementTool
src/eIDEAS/eIDEAS/Models/ApplicationUserPresentationViewModel.cs
930
C#
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyrightD * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using OpenMetaverse; namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintSpring : BSConstraint6Dof { public override ConstraintType Type { get { return ConstraintType.D6_SPRING_CONSTRAINT_TYPE; } } public BSConstraintSpring(BulletWorld world, BulletBody obj1, BulletBody obj2, Vector3 frame1Loc, Quaternion frame1Rot, Vector3 frame2Loc, Quaternion frame2Rot, bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) : base(world, obj1, obj2) { m_constraint = PhysicsScene.PE.Create6DofSpringConstraint(world, obj1, obj2, frame1Loc, frame1Rot, frame2Loc, frame2Rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); m_enabled = true; PhysicsScene.DetailLog("{0},BSConstraintSpring,create,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", obj1.ID, world.worldID, obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); PhysicsScene.DetailLog("{0},BSConstraintSpring,create, f1Loc={1},f1Rot={2},f2Loc={3},f2Rot={4},usefA={5},disCol={6}", m_body1.ID, frame1Loc, frame1Rot, frame2Loc, frame2Rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); } public bool SetAxisEnable(int pIndex, bool pAxisEnable) { PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEnable,obj1ID={1},obj2ID={2},indx={3},enable={4}", m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pAxisEnable); PhysicsScene.PE.SpringEnable(m_constraint, pIndex, BSParam.NumericBool(pAxisEnable)); return true; } public bool SetStiffness(int pIndex, float pStiffness) { PhysicsScene.DetailLog("{0},BSConstraintSpring.SetStiffness,obj1ID={1},obj2ID={2},indx={3},stiff={4}", m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pStiffness); PhysicsScene.PE.SpringSetStiffness(m_constraint, pIndex, pStiffness); return true; } public bool SetDamping(int pIndex, float pDamping) { PhysicsScene.DetailLog("{0},BSConstraintSpring.SetDamping,obj1ID={1},obj2ID={2},indx={3},damp={4}", m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pDamping); PhysicsScene.PE.SpringSetDamping(m_constraint, pIndex, pDamping); return true; } public bool SetEquilibriumPoint(int pIndex, float pEqPoint) { PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEquilibriumPoint,obj1ID={1},obj2ID={2},indx={3},eqPoint={4}", m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pEqPoint); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, pIndex, pEqPoint); return true; } public bool SetEquilibriumPoint(Vector3 linearEq, Vector3 angularEq) { PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEquilibriumPoint,obj1ID={1},obj2ID={2},linearEq={3},angularEq={4}", m_body1.ID, m_body1.ID, m_body2.ID, linearEq, angularEq); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 0, linearEq.X); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 1, linearEq.Y); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 2, linearEq.Z); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 3, angularEq.X); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 4, angularEq.Y); PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, 5, angularEq.Z); return true; } } }
55.59
144
0.659291
[ "BSD-3-Clause" ]
mdickson/opensim
OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs
5,559
C#
// Copyright information can be found in the file named COPYING // located in the root directory of this distribution. // BEGIN: Turret Sequences %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE run", "Turret_run"); %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE sprint", "Turret_sprint"); %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE idle", "Turret_idle"); %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE fire", "Turret_fire"); %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE switch_out", "Turret_switch_out"); %this.addSequence("art/shapes/weapons/Turret/FP_Turret.DAE switch_in", "Turret_switch_in"); %this.setSequenceCyclic("Turret_fire", "0"); %this.setSequenceCyclic("Turret_switch_out", "0"); %this.setSequenceCyclic("Turret_switch_in", "0"); // END: Turret Sequences
55.375
97
0.733634
[ "MIT" ]
fr1tz/alux3d
Templates/Full/game/art/shapes/weapons/Turret/fp_turretAnims.cs
871
C#
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Generated code. DO NOT EDIT! using gagvr = Google.Ads.GoogleAds.V3.Resources; using gax = Google.Api.Gax; using gaxgrpc = Google.Api.Gax.Grpc; using gaxgrpccore = Google.Api.Gax.Grpc.GrpcCore; using proto = Google.Protobuf; using grpccore = Grpc.Core; using grpcinter = Grpc.Core.Interceptors; using sys = System; using scg = System.Collections.Generic; using sco = System.Collections.ObjectModel; using st = System.Threading; using stt = System.Threading.Tasks; namespace Google.Ads.GoogleAds.V3.Services { /// <summary>Settings for <see cref="AdServiceClient"/> instances.</summary> public sealed partial class AdServiceSettings : gaxgrpc::ServiceSettingsBase { /// <summary>Get a new instance of the default <see cref="AdServiceSettings"/>.</summary> /// <returns>A new instance of the default <see cref="AdServiceSettings"/>.</returns> public static AdServiceSettings GetDefault() => new AdServiceSettings(); /// <summary>Constructs a new <see cref="AdServiceSettings"/> object with default settings.</summary> public AdServiceSettings() { } private AdServiceSettings(AdServiceSettings existing) : base(existing) { gax::GaxPreconditions.CheckNotNull(existing, nameof(existing)); GetAdSettings = existing.GetAdSettings; MutateAdsSettings = existing.MutateAdsSettings; OnCopy(existing); } partial void OnCopy(AdServiceSettings existing); /// <summary> /// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to <c>AdServiceClient.GetAd</c> /// and <c>AdServiceClient.GetAdAsync</c>. /// </summary> /// <remarks> /// <list type="bullet"> /// <item><description>This call will not be retried.</description></item> /// <item><description>No timeout is applied.</description></item> /// </list> /// </remarks> public gaxgrpc::CallSettings GetAdSettings { get; set; } = gaxgrpc::CallSettings.FromExpiration(gax::Expiration.None); /// <summary> /// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to <c>AdServiceClient.MutateAds</c> /// and <c>AdServiceClient.MutateAdsAsync</c>. /// </summary> /// <remarks> /// <list type="bullet"> /// <item><description>This call will not be retried.</description></item> /// <item><description>No timeout is applied.</description></item> /// </list> /// </remarks> public gaxgrpc::CallSettings MutateAdsSettings { get; set; } = gaxgrpc::CallSettings.FromExpiration(gax::Expiration.None); /// <summary>Creates a deep clone of this object, with all the same property values.</summary> /// <returns>A deep clone of this <see cref="AdServiceSettings"/> object.</returns> public AdServiceSettings Clone() => new AdServiceSettings(this); } /// <summary> /// Builder class for <see cref="AdServiceClient"/> to provide simple configuration of credentials, endpoint etc. /// </summary> public sealed partial class AdServiceClientBuilder : gaxgrpc::ClientBuilderBase<AdServiceClient> { /// <summary>The settings to use for RPCs, or <c>null</c> for the default settings.</summary> public AdServiceSettings Settings { get; set; } partial void InterceptBuild(ref AdServiceClient client); partial void InterceptBuildAsync(st::CancellationToken cancellationToken, ref stt::Task<AdServiceClient> task); /// <summary>Builds the resulting client.</summary> public override AdServiceClient Build() { AdServiceClient client = null; InterceptBuild(ref client); return client ?? BuildImpl(); } /// <summary>Builds the resulting client asynchronously.</summary> public override stt::Task<AdServiceClient> BuildAsync(st::CancellationToken cancellationToken = default) { stt::Task<AdServiceClient> task = null; InterceptBuildAsync(cancellationToken, ref task); return task ?? BuildAsyncImpl(cancellationToken); } private AdServiceClient BuildImpl() { Validate(); grpccore::CallInvoker callInvoker = CreateCallInvoker(); return AdServiceClient.Create(callInvoker, Settings); } private async stt::Task<AdServiceClient> BuildAsyncImpl(st::CancellationToken cancellationToken) { Validate(); grpccore::CallInvoker callInvoker = await CreateCallInvokerAsync(cancellationToken).ConfigureAwait(false); return AdServiceClient.Create(callInvoker, Settings); } /// <summary>Returns the endpoint for this builder type, used if no endpoint is otherwise specified.</summary> protected override string GetDefaultEndpoint() => AdServiceClient.DefaultEndpoint; /// <summary> /// Returns the default scopes for this builder type, used if no scopes are otherwise specified. /// </summary> protected override scg::IReadOnlyList<string> GetDefaultScopes() => AdServiceClient.DefaultScopes; /// <summary>Returns the channel pool to use when no other options are specified.</summary> protected override gaxgrpc::ChannelPool GetChannelPool() => AdServiceClient.ChannelPool; /// <summary>Returns the default <see cref="gaxgrpc::GrpcAdapter"/>to use if not otherwise specified.</summary> protected override gaxgrpc::GrpcAdapter DefaultGrpcAdapter => gaxgrpccore::GrpcCoreAdapter.Instance; } /// <summary>AdService client wrapper, for convenient use.</summary> /// <remarks> /// Service to manage ads. /// </remarks> public abstract partial class AdServiceClient { /// <summary> /// The default endpoint for the AdService service, which is a host of "googleads.googleapis.com" and a port of /// 443. /// </summary> public static string DefaultEndpoint { get; } = "googleads.googleapis.com:443"; /// <summary>The default AdService scopes.</summary> /// <remarks>The default AdService scopes are:<list type="bullet"></list></remarks> public static scg::IReadOnlyList<string> DefaultScopes { get; } = new sco::ReadOnlyCollection<string>(new string[] { }); internal static gaxgrpc::ChannelPool ChannelPool { get; } = new gaxgrpc::ChannelPool(DefaultScopes); /// <summary> /// Asynchronously creates a <see cref="AdServiceClient"/> using the default credentials, endpoint and settings. /// To specify custom credentials or other settings, use <see cref="AdServiceClientBuilder"/>. /// </summary> /// <param name="cancellationToken"> /// The <see cref="st::CancellationToken"/> to use while creating the client. /// </param> /// <returns>The task representing the created <see cref="AdServiceClient"/>.</returns> public static stt::Task<AdServiceClient> CreateAsync(st::CancellationToken cancellationToken = default) => new AdServiceClientBuilder().BuildAsync(cancellationToken); /// <summary> /// Synchronously creates a <see cref="AdServiceClient"/> using the default credentials, endpoint and settings. /// To specify custom credentials or other settings, use <see cref="AdServiceClientBuilder"/>. /// </summary> /// <returns>The created <see cref="AdServiceClient"/>.</returns> public static AdServiceClient Create() => new AdServiceClientBuilder().Build(); /// <summary> /// Creates a <see cref="AdServiceClient"/> which uses the specified call invoker for remote operations. /// </summary> /// <param name="callInvoker"> /// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null. /// </param> /// <param name="settings">Optional <see cref="AdServiceSettings"/>.</param> /// <returns>The created <see cref="AdServiceClient"/>.</returns> internal static AdServiceClient Create(grpccore::CallInvoker callInvoker, AdServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } AdService.AdServiceClient grpcClient = new AdService.AdServiceClient(callInvoker); return new AdServiceClientImpl(grpcClient, settings); } /// <summary> /// Shuts down any channels automatically created by <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/>. Channels which weren't automatically created are not /// affected. /// </summary> /// <remarks> /// After calling this method, further calls to <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/> will create new channels, which could in turn be shut down /// by another call to this method. /// </remarks> /// <returns>A task representing the asynchronous shutdown operation.</returns> public static stt::Task ShutdownDefaultChannelsAsync() => ChannelPool.ShutdownChannelsAsync(); /// <summary>The underlying gRPC AdService client</summary> public virtual AdService.AdServiceClient GrpcClient => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::Ad GetAd(GetAdRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(GetAdRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(GetAdRequest request, st::CancellationToken cancellationToken) => GetAdAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::Ad GetAd(string resourceName, gaxgrpc::CallSettings callSettings = null) => GetAd(new GetAdRequest { ResourceName = gax::GaxPreconditions.CheckNotNullOrEmpty(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(string resourceName, gaxgrpc::CallSettings callSettings = null) => GetAdAsync(new GetAdRequest { ResourceName = gax::GaxPreconditions.CheckNotNullOrEmpty(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(string resourceName, st::CancellationToken cancellationToken) => GetAdAsync(resourceName, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::Ad GetAd(gagvr::AdName resourceName, gaxgrpc::CallSettings callSettings = null) => GetAd(new GetAdRequest { ResourceNameAsAdName = gax::GaxPreconditions.CheckNotNull(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(gagvr::AdName resourceName, gaxgrpc::CallSettings callSettings = null) => GetAdAsync(new GetAdRequest { ResourceNameAsAdName = gax::GaxPreconditions.CheckNotNull(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="resourceName"> /// Required. The resource name of the ad to fetch. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::Ad> GetAdAsync(gagvr::AdName resourceName, st::CancellationToken cancellationToken) => GetAdAsync(resourceName, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual MutateAdsResponse MutateAds(MutateAdsRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateAdsResponse> MutateAdsAsync(MutateAdsRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateAdsResponse> MutateAdsAsync(MutateAdsRequest request, st::CancellationToken cancellationToken) => MutateAdsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose ads are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual ads. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual MutateAdsResponse MutateAds(string customerId, scg::IEnumerable<AdOperation> operations, gaxgrpc::CallSettings callSettings = null) => MutateAds(new MutateAdsRequest { CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)), Operations = { gax::GaxPreconditions.CheckNotNull(operations, nameof(operations)), }, }, callSettings); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose ads are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual ads. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateAdsResponse> MutateAdsAsync(string customerId, scg::IEnumerable<AdOperation> operations, gaxgrpc::CallSettings callSettings = null) => MutateAdsAsync(new MutateAdsRequest { CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)), Operations = { gax::GaxPreconditions.CheckNotNull(operations, nameof(operations)), }, }, callSettings); /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose ads are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual ads. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateAdsResponse> MutateAdsAsync(string customerId, scg::IEnumerable<AdOperation> operations, st::CancellationToken cancellationToken) => MutateAdsAsync(customerId, operations, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); } /// <summary>AdService client wrapper implementation, for convenient use.</summary> /// <remarks> /// Service to manage ads. /// </remarks> public sealed partial class AdServiceClientImpl : AdServiceClient { private readonly gaxgrpc::ApiCall<GetAdRequest, gagvr::Ad> _callGetAd; private readonly gaxgrpc::ApiCall<MutateAdsRequest, MutateAdsResponse> _callMutateAds; /// <summary> /// Constructs a client wrapper for the AdService service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="AdServiceSettings"/> used within this client.</param> public AdServiceClientImpl(AdService.AdServiceClient grpcClient, AdServiceSettings settings) { GrpcClient = grpcClient; AdServiceSettings effectiveSettings = settings ?? AdServiceSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); _callGetAd = clientHelper.BuildApiCall<GetAdRequest, gagvr::Ad>(grpcClient.GetAdAsync, grpcClient.GetAd, effectiveSettings.GetAdSettings).WithGoogleRequestParam("resource_name", request => request.ResourceName); Modify_ApiCall(ref _callGetAd); Modify_GetAdApiCall(ref _callGetAd); _callMutateAds = clientHelper.BuildApiCall<MutateAdsRequest, MutateAdsResponse>(grpcClient.MutateAdsAsync, grpcClient.MutateAds, effectiveSettings.MutateAdsSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId); Modify_ApiCall(ref _callMutateAds); Modify_MutateAdsApiCall(ref _callMutateAds); OnConstruction(grpcClient, effectiveSettings, clientHelper); } partial void Modify_ApiCall<TRequest, TResponse>(ref gaxgrpc::ApiCall<TRequest, TResponse> call) where TRequest : class, proto::IMessage<TRequest> where TResponse : class, proto::IMessage<TResponse>; partial void Modify_GetAdApiCall(ref gaxgrpc::ApiCall<GetAdRequest, gagvr::Ad> call); partial void Modify_MutateAdsApiCall(ref gaxgrpc::ApiCall<MutateAdsRequest, MutateAdsResponse> call); partial void OnConstruction(AdService.AdServiceClient grpcClient, AdServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper); /// <summary>The underlying gRPC AdService client</summary> public override AdService.AdServiceClient GrpcClient { get; } partial void Modify_GetAdRequest(ref GetAdRequest request, ref gaxgrpc::CallSettings settings); partial void Modify_MutateAdsRequest(ref MutateAdsRequest request, ref gaxgrpc::CallSettings settings); /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override gagvr::Ad GetAd(GetAdRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetAdRequest(ref request, ref callSettings); return _callGetAd.Sync(request, callSettings); } /// <summary> /// Returns the requested ad in full detail. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task<gagvr::Ad> GetAdAsync(GetAdRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetAdRequest(ref request, ref callSettings); return _callGetAd.Async(request, callSettings); } /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override MutateAdsResponse MutateAds(MutateAdsRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MutateAdsRequest(ref request, ref callSettings); return _callMutateAds.Sync(request, callSettings); } /// <summary> /// Updates ads. Operation statuses are returned. Updating ads is not supported /// for TextAd, ExpandedDynamicSearchAd, GmailAd and ImageAd. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task<MutateAdsResponse> MutateAdsAsync(MutateAdsRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MutateAdsRequest(ref request, ref callSettings); return _callMutateAds.Async(request, callSettings); } } }
53.239044
247
0.657786
[ "Apache-2.0" ]
PierrickVoulet/google-ads-dotnet
src/V3/Services/AdServiceClient.g.cs
26,726
C#
using System; using System.Collections.Generic; // Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. // If you have enabled NRTs for your project, then un-comment the following line: // #nullable disable namespace DataSynthesis.Data.EF.models { public partial class DataexistingUpccodes { public long UpccodeId { get; set; } public string UpccodeName { get; set; } public string UpcproductName { get; set; } public DateTime? CreatedDate { get; set; } public short? StatusId { get; set; } public string RegisteredApp { get; set; } public virtual RefdataApplication RegisteredAppNavigation { get; set; } public virtual RefdataStatus Status { get; set; } } }
34.826087
96
0.669164
[ "Apache-2.0" ]
balanscott/DataSynthesis
DataTier-APIs/NetCore-APIs/src/DataSynthesis.Data.EF/models/DataexistingUpccodes.cs
803
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("VulkanCpu")] [assembly: AssemblyDescription("Software Emulator for the Vulkan API")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("VulkanCpu")] [assembly: AssemblyCopyright("Copyright © 2018")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("bcb245d8-e332-4233-9606-4007e770b0da")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
39.540541
85
0.72864
[ "MIT" ]
bazoocaze/VulkanCpu
VulkanCpu/Properties/AssemblyInfo.cs
1,466
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SFA.DAS.AssessorService.EpaoDataSync.Data.Types { public class SubmissionEvent { public long Id { get; set; } public string IlrFileName { get; set; } public DateTime FileDateTime { get; set; } public DateTime SubmittedDateTime { get; set; } public int ComponentVersionNumber { get; set; } public long Ukprn { get; set; } public long Uln { get; set; } public long? StandardCode { get; set; } public int? ProgrammeType { get; set; } public int? FrameworkCode { get; set; } public int? PathwayCode { get; set; } public DateTime? ActualStartDate { get; set; } public DateTime? PlannedEndDate { get; set; } public DateTime? ActualEndDate { get; set; } public decimal? TrainingPrice { get; set; } public decimal? EndpointAssessorPrice { get; set; } public string NiNumber { get; set; } public long? ApprenticeshipId { get; set; } public string AcademicYear { get; set; } public int? EmployerReferenceNumber { get; set; } public string EPAOrgId { get; set; } public string GivenNames { get; set; } public string FamilyName { get; set; } public int? CompStatus { get; set; } } }
37.918919
59
0.628653
[ "MIT" ]
codescene-org/das-assessor-service
src/SFA.DAS.AssessorService.EpaoDataSync/Data/Types/SubmissionEvent.cs
1,405
C#
using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Node.CLI.Services; using Node.Core.Models; namespace Node.CLI.Controllers { [Route("api/[controller]")] public class PeersController { private readonly PeerService _peerService; public PeersController(PeerService peerService) { _peerService = peerService; } [HttpGet] public IEnumerable<Peer> GetPeers() { return _peerService.All(); } [HttpPost] public async Task AddPeer([FromBody] Peer peer) { await _peerService.Add(peer); } } }
23.096774
56
0.589385
[ "MIT" ]
alex687/BlockchainTech
src/Node.CLI/Controllers/PeersController.cs
718
C#
using Shadowsocks.Controller; using Shadowsocks.Properties; using Shadowsocks.Util; using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Text; namespace Shadowsocks.Encryption { public class PolarSSL { const string DLLNAME = "libsscrypto"; public const int AES_CTX_SIZE = 8 + 4 * 68; public const int AES_ENCRYPT = 1; public const int AES_DECRYPT = 0; static PolarSSL() { string tempPath = Utils.GetTempPath(); string dllPath = tempPath + "/libsscrypto.dll"; try { FileManager.UncompressFile(dllPath, Resources.libsscrypto_dll); } catch (IOException) { } catch (Exception e) { Console.WriteLine(e.ToString()); } LoadLibrary(dllPath); } [DllImport("Kernel32.dll")] private static extern IntPtr LoadLibrary(string path); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static void aes_init(IntPtr ctx); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static void aes_free(IntPtr ctx); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static int aes_setkey_enc(IntPtr ctx, byte[] key, int keysize); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static int aes_crypt_cfb128(IntPtr ctx, int mode, int length, ref int iv_off, byte[] iv, byte[] input, byte[] output); public const int ARC4_CTX_SIZE = 264; [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static void arc4_init(IntPtr ctx); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static void arc4_free(IntPtr ctx); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static void arc4_setup(IntPtr ctx, byte[] key, int keysize); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public extern static int arc4_crypt(IntPtr ctx, int length, byte[] input, byte[] output); } }
33.811594
140
0.653665
[ "Apache-2.0" ]
690486439/shadowsocks-windows
shadowsocks-csharp/Encryption/PolarSSL.cs
2,335
C#
// ------------------------------------------------------------------------------ // <auto-generated> // Generated by Xsd2Code. Version 3.4.0.18239 Microsoft Reciprocal License (Ms-RL) // <NameSpace>Mim.V6301</NameSpace><Collection>Array</Collection><codeType>CSharp</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>True</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>True</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net35</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>True</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>True</ExcludeIncludedTypes><EnableInitializeFields>False</EnableInitializeFields> // </auto-generated> // ------------------------------------------------------------------------------ namespace Mim.V6301 { using System; using System.Diagnostics; using System.Xml.Serialization; using System.Collections; using System.Xml.Schema; using System.ComponentModel; using System.IO; using System.Text; [System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.4.0.18239")] [System.SerializableAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(TypeName="UKCT_MT121001UK01.SystemSDS", Namespace="urn:hl7-org:v3")] [System.Xml.Serialization.XmlRootAttribute("UKCT_MT121001UK01.SystemSDS", Namespace="urn:hl7-org:v3")] public partial class UKCT_MT121001UK01SystemSDS { private II idField; private string typeField; private string classCodeField; private string determinerCodeField; private string[] typeIDField; private string[] realmCodeField; private string nullFlavorField; private static System.Xml.Serialization.XmlSerializer serializer; public UKCT_MT121001UK01SystemSDS() { this.typeField = "Device"; this.classCodeField = "DEV"; this.determinerCodeField = "INSTANCE"; } public II id { get { return this.idField; } set { this.idField = value; } } [System.Xml.Serialization.XmlAttributeAttribute(DataType="token")] public string type { get { return this.typeField; } set { this.typeField = value; } } [System.Xml.Serialization.XmlAttributeAttribute()] public string classCode { get { return this.classCodeField; } set { this.classCodeField = value; } } [System.Xml.Serialization.XmlAttributeAttribute()] public string determinerCode { get { return this.determinerCodeField; } set { this.determinerCodeField = value; } } [System.Xml.Serialization.XmlAttributeAttribute()] public string[] typeID { get { return this.typeIDField; } set { this.typeIDField = value; } } [System.Xml.Serialization.XmlAttributeAttribute(DataType="token")] public string[] realmCode { get { return this.realmCodeField; } set { this.realmCodeField = value; } } [System.Xml.Serialization.XmlAttributeAttribute(DataType="token")] public string nullFlavor { get { return this.nullFlavorField; } set { this.nullFlavorField = value; } } private static System.Xml.Serialization.XmlSerializer Serializer { get { if ((serializer == null)) { serializer = new System.Xml.Serialization.XmlSerializer(typeof(UKCT_MT121001UK01SystemSDS)); } return serializer; } } #region Serialize/Deserialize /// <summary> /// Serializes current UKCT_MT121001UK01SystemSDS object into an XML document /// </summary> /// <returns>string XML value</returns> public virtual string Serialize() { System.IO.StreamReader streamReader = null; System.IO.MemoryStream memoryStream = null; try { memoryStream = new System.IO.MemoryStream(); Serializer.Serialize(memoryStream, this); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); streamReader = new System.IO.StreamReader(memoryStream); return streamReader.ReadToEnd(); } finally { if ((streamReader != null)) { streamReader.Dispose(); } if ((memoryStream != null)) { memoryStream.Dispose(); } } } /// <summary> /// Deserializes workflow markup into an UKCT_MT121001UK01SystemSDS object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output UKCT_MT121001UK01SystemSDS object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out UKCT_MT121001UK01SystemSDS obj, out System.Exception exception) { exception = null; obj = default(UKCT_MT121001UK01SystemSDS); try { obj = Deserialize(xml); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool Deserialize(string xml, out UKCT_MT121001UK01SystemSDS obj) { System.Exception exception = null; return Deserialize(xml, out obj, out exception); } public static UKCT_MT121001UK01SystemSDS Deserialize(string xml) { System.IO.StringReader stringReader = null; try { stringReader = new System.IO.StringReader(xml); return ((UKCT_MT121001UK01SystemSDS)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)))); } finally { if ((stringReader != null)) { stringReader.Dispose(); } } } /// <summary> /// Serializes current UKCT_MT121001UK01SystemSDS object into file /// </summary> /// <param name="fileName">full path of outupt xml file</param> /// <param name="exception">output Exception value if failed</param> /// <returns>true if can serialize and save into file; otherwise, false</returns> public virtual bool SaveToFile(string fileName, out System.Exception exception) { exception = null; try { SaveToFile(fileName); return true; } catch (System.Exception e) { exception = e; return false; } } public virtual void SaveToFile(string fileName) { System.IO.StreamWriter streamWriter = null; try { string xmlString = Serialize(); System.IO.FileInfo xmlFile = new System.IO.FileInfo(fileName); streamWriter = xmlFile.CreateText(); streamWriter.WriteLine(xmlString); streamWriter.Close(); } finally { if ((streamWriter != null)) { streamWriter.Dispose(); } } } /// <summary> /// Deserializes xml markup from file into an UKCT_MT121001UK01SystemSDS object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output UKCT_MT121001UK01SystemSDS object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out UKCT_MT121001UK01SystemSDS obj, out System.Exception exception) { exception = null; obj = default(UKCT_MT121001UK01SystemSDS); try { obj = LoadFromFile(fileName); return true; } catch (System.Exception ex) { exception = ex; return false; } } public static bool LoadFromFile(string fileName, out UKCT_MT121001UK01SystemSDS obj) { System.Exception exception = null; return LoadFromFile(fileName, out obj, out exception); } public static UKCT_MT121001UK01SystemSDS LoadFromFile(string fileName) { System.IO.FileStream file = null; System.IO.StreamReader sr = null; try { file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read); sr = new System.IO.StreamReader(file); string xmlString = sr.ReadToEnd(); sr.Close(); file.Close(); return Deserialize(xmlString); } finally { if ((file != null)) { file.Dispose(); } if ((sr != null)) { sr.Dispose(); } } } #endregion #region Clone method /// <summary> /// Create a clone of this UKCT_MT121001UK01SystemSDS object /// </summary> public virtual UKCT_MT121001UK01SystemSDS Clone() { return ((UKCT_MT121001UK01SystemSDS)(this.MemberwiseClone())); } #endregion } }
40.491039
1,358
0.568381
[ "MIT" ]
Kusnaditjung/MimDms
src/Mim.V6301/Generated/UKCT_MT121001UK01SystemSDS.cs
11,297
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace UsingSpeech.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UsingSpeech.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
38.597222
177
0.603095
[ "MIT" ]
21pages/WPF-Samples
Speech and Media/UsingSpeech/Properties/Resources.Designer.cs
2,781
C#
using System.Threading.Tasks; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Refit; namespace Appmilla.Moneyhub.Refit.Identity { /// <summary> /// Response16 /// </summary> public class StandingOrdersGetResponse { /// <summary> /// Data /// </summary> [AliasAs("data")] public StandingOrderRequest Data { get; set; } /// <summary> /// Meta /// </summary> [AliasAs("meta")] public object Meta { get; set; } } }
19.448276
54
0.56383
[ "MIT" ]
Appmilla/moneyhub-api-client
Moneyhub.ApiClient/Moneyhub.ApiClient/Identity/Models/StandingOrdersGetResponse.cs
566
C#
// TODO: Parallelize block-swap algorithm to speedup in-place merge, possibly using SSE with instruction to reverse order within an SSE Vector // Or, maybe SSE rotation/reverse order can be avoided, knowing that we'll be rotating it back in the following pass. // TODO: Parallelize block-swap algorithms to see if there is a benefit, now that unit testing and benchmarking in C# is in place // Try simple things first like scalar parallelism of reversal algorithms middle stage of reversal by running the two portions reversal // in parallel to see if it speeds up at all. // TODO: Consider implementing in-place array rotation, such as possibly this (https://www.geeksforgeeks.org/block-swap-algorithm-for-array-rotation/) // and do a parallel version as well. // TODO: Add another termination condition to Gries-Mills block swap algorithm of one of the array portions being a single element, and handle that case // with a simple array rotation (if it's worthwhile). // TODO: Combine Reversal and Gries-Mills algorithms, to eliminate rotation of the smaller half of the array, when it pays off, since now the other // half has to be "fixed". There may be certain ratios between halves that work well using one algorithm versus another. // TODO: Fix a bug with Bentley's Juggling algorithm when the starting index is non-zero. // TODO: Use Array.Copy to copy 3X faster for those algorithms that don't reverse, which is as fast as SSE copy. using System; using System.Collections.Generic; using System.Text; namespace HPCsharp { static public partial class Algorithm { public static void Swap<T>(this T[] array, int indexA, int indexB) { T temp = array[indexA]; array[indexA] = array[indexB]; array[indexB] = temp; } public static void Swap<T>(this T[] array, int indexA, int indexB, int length, bool reverse = false) { if (!reverse) { while (length-- > 0) { T temp = array[indexA]; // inlining Swap() increases performance by 25% array[indexA++] = array[indexB]; array[indexB++] = temp; } } else { int currIndexB = indexB + length - 1; while (length-- > 0) { T temp = array[indexA]; // inlining Swap() increases performance by 25% array[indexA++] = array[currIndexB]; array[currIndexB--] = temp; } } } public static void SwapArray<T>(this T[] array, int indexA, int indexB, int length, bool reverse = false, int tempBufferSize = 1024) { T[] tempBuffer = new T[tempBufferSize]; if (!reverse) { while ((length - tempBufferSize) > 0) { Array.Copy(array, indexA, tempBuffer, 0, tempBufferSize); Array.Copy(array, indexB, array, indexA, tempBufferSize); Array.Copy(tempBuffer, 0, array, indexB, tempBufferSize); length -= tempBufferSize; } while (length-- > 0) { T temp = array[indexA]; // inlining Swap() increases performance by 25% array[indexA++] = array[indexB]; array[indexB++] = temp; } } else { int currIndexB = indexB + length - 1; while (length-- > 0) { T temp = array[indexA]; // inlining Swap() increases performance by 25% array[indexA++] = array[currIndexB]; array[currIndexB--] = temp; } } } public static void Swap<T>(ref T B, T[] array, int indexA) { T temp = array[indexA]; array[indexA] = B; B = temp; } public static void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; } // reverse/mirror a range from l to r, inclusively, in-place public static void Reversal<T>(this T[] array, int l, int r) { for(; l < r; l++, r--) { T temp = array[l]; array[l] = array[r]; array[r] = temp; } } // Swaps two sequential subarrays ranges a[ l .. m ] and a[ m + 1 .. r ] public static void BlockSwapReversal<T>(T[] array, int l, int m, int r) { //array.Reversal(l, m); //array.Reversal(m + 1, r); //array.Reversal(l, r); Array.Reverse(array, l, m - l + 1); Array.Reverse(array, m + 1, r - m ); Array.Reverse(array, l, r - l + 1); } public static void BlockSwapReversalReverseOrder<T>(T[] array, int l, int m, int r) { array.Reversal(l, r); int mInDestination = r - (m - l + 1); array.Reversal(l, mInDestination); array.Reversal(mInDestination + 1, r); } public static void BlockSwapGriesMills<T>(T[] array, int l, int m, int r) { int rotdist = m - l + 1; int n = r - l + 1; if (rotdist == 0 || rotdist == n) return; int p, i = p = rotdist; int j = n - p; p += l; while (i != j) { if (i > j) { array.SwapArray(p - i, p, j); i -= j; } else { array.SwapArray(p - i, p + j - i, i); j -= i; } } array.Swap(p - i, p, i); } // Greatest Common Divisor. Assumes that neither input is zero public static int GreatestCommonDivisor(int i, int j) { if (i == 0) return j; if (j == 0) return i; while (i != j) { if (i > j) i -= j; else j -= i; } return i; } public static void BlockSwapJugglingBentley<T>(T[] array, int l, int m, int r) { int uLength = m - l + 1; int vLength = r - m; if (uLength <= 0 || vLength <= 0) return; int rotdist = m - l + 1; int n = r - l + 1; int gcdRotdistN = GreatestCommonDivisor(rotdist, n); for (int i = 0; i < gcdRotdistN; i++) { // move i-th values of blocks T t = array[i]; int j = i; while (true) { int k = j + rotdist; if (k >= n) k -= n; if (k == i) break; array[j] = array[k]; j = k; } array[j] = t; } } } }
38.463542
152
0.465267
[ "Apache-2.0" ]
DragonSpit/HPCsharp
HPCsharp/BlockSwap.cs
7,387
C#
namespace WSE.Bff.Compras.Models { public class EnderecoDTO { public string Logradouro { get; set; } public string Numero { get; set; } public string Complemento { get; set; } public string Bairro { get; set; } public string Cep { get; set; } public string Cidade { get; set; } public string Estado { get; set; } } }
27.571429
47
0.580311
[ "MIT" ]
stanleydevbr/WebStoreEnterprise
src/api gateways/WSE.Bff.Compras/Models/EnderecoDTO.cs
388
C#
namespace CollectIt.Database.Abstractions.Account.Exceptions; public class UserAlreadyAcquiredResourceException : UserException { public UserAlreadyAcquiredResourceException(int resourceId, int userId, string message = "") : base(userId, message) { ResourceId = resourceId; } public int ResourceId { get; } }
28.5
96
0.733918
[ "Apache-2.0" ]
Reb1azzze/collect-it
src/CollectIt.Database/CollectIt.Database.Abstractions/Account/Exceptions/UserAlreadyAcquiredResourceException.cs
342
C#
using System; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("ServerDataTEST")] namespace ServerData { internal class Smartphone: IProduct { public Smartphone(string name, float price, int count, ProductType type, int battery, int camera) { Name = name; Type = type; Price = price; Count = count; ID = Guid.NewGuid(); Battery = battery; Camera = camera; Description = GenerateDescription(); } public string Name { get; } public float Price { get; } public string Description { get; } public int Count { get; set; } public int Battery { get; } public int Camera { get; } public ProductType Type { get; } public Guid ID { get; } public string GenerateDescription() { return "Battery: " + Battery + "mAh\nCamera Resolution: " + Camera + "MP"; } } }
28.657143
105
0.555334
[ "Apache-2.0" ]
WDobies/TPUM
ServerData/Smartphone.cs
1,005
C#
// Plato.Core // Copyright (c) 2020 ReflectSoftware Inc. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Plato.Cache; using Plato.Miscellaneous; using Plato.Messaging.AMQ.Interfaces; using Plato.Messaging.Interfaces; using System; namespace Plato.Messaging.AMQ.Pool { /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <seealso cref="Plato.Messaging.AMQ.Interfaces.IAMQPoolContainer{T}" /> public class AMQPoolContainerAsync<T> : IAMQPoolContainer<T> where T : IMessageReceiverSender { private readonly PoolInstanceAsync<AMQObjectPoolData, object> _container; private bool _disposed; /// <summary> /// Initializes a new instance of the <see cref="AMQPoolContainerAsync{T}"/> class. /// </summary> /// <param name="container">The container.</param> public AMQPoolContainerAsync(PoolInstanceAsync<AMQObjectPoolData, object> container) { Guard.AgainstNull(() => container); _container = container; } /// <summary> /// Gets the pool identifier. /// </summary> /// <value> /// The pool identifier. /// </value> public Guid PoolId { get { return _container.Pool.Id; } } /// <summary> /// Gets the instance. /// </summary> /// <value> /// The instance. /// </value> public T Instance { get { return (T)_container.Instance.Instance; } } #region Dispose /// <summary> /// Finalizes an instance of the <see cref="AMQPoolContainerAsync{T}"/> class. /// </summary> ~AMQPoolContainerAsync() { Dispose(false); } /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected void Dispose(bool disposing) { lock (this) { if (!_disposed) { _disposed = true; GC.SuppressFinalize(this); _container?.Dispose(); } } } /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { Dispose(true); } #endregion Dispose } }
28.30303
154
0.534975
[ "Apache-2.0" ]
fntc/Plato.Core
src/Plato.Messaging.AMQ/Pool/AMQPoolContainerAsync.cs
2,804
C#
namespace PwnedClient.Tests { using FluentAssertions; using System; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class WhenGettingMatchesRaw { private PwnedClient passwordChecker; [TestInitialize] public void Setup() { this.passwordChecker = new PwnedClient(); } [TestMethod] public void BreachedPassword_IsInRange() { var password = "password123"; var hashedPassword = password.ToSha1Hash(); var firstFive = hashedPassword.Substring(0, 5); var suffix = hashedPassword.Substring(5, hashedPassword.Length - 5); var result = this.passwordChecker.GetMatchesRaw(firstFive); result.Should().Contain(suffix); } [TestMethod] public void RandomPassword_IsNotInRange() { var password = Guid.NewGuid().ToString(); var hashedPassword = password.ToSha1Hash(); var firstFive = hashedPassword.Substring(0, 5); var suffix = hashedPassword.Substring(5, hashedPassword.Length - 5); var result = this.passwordChecker.GetMatchesRaw(firstFive); result.Should().NotContain(suffix); } [TestMethod] public void CompleteBreachedPassword_IsInRange() { var password = "password123"; var hashedPassword = password.ToSha1Hash(); var suffix = hashedPassword.Substring(5, hashedPassword.Length - 5); var result = this.passwordChecker.GetMatchesRaw(hashedPassword); result.Should().Contain(suffix); } [TestMethod] public void ShortPassword_ThrowsException() { var password = "1234"; Action act = () => this.passwordChecker.GetMatchesRaw(password); act.Should().ThrowExactly<ArgumentException>(); } [TestMethod] public void NullPassword_ThrowsException() { string password = null; Action act = () => this.passwordChecker.GetMatchesRaw(password); act.Should().ThrowExactly<ArgumentNullException>(); } } }
33.164179
80
0.60396
[ "Unlicense" ]
mjashton/PwnedClient
src/PwnedClient.Tests/WhenGettingMatchesRaw.cs
2,224
C#
// Copyright (c) Microsoft Corporation. All rights reserved. using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Azure.KeyVault.Models; using NLog; namespace DeviceBridge.Providers { public interface ISecretsProvider { Task PutSecretAsync(Logger logger, string secretName, string secretValue); Task<string> GetIdScopeAsync(Logger logger); Task<string> GetIotcSasKeyAsync(Logger logger); Task<string> GetSqlPasswordAsync(Logger logger); Task<string> GetSqlUsernameAsync(Logger logger); Task<string> GetSqlServerAsync(Logger logger); Task<string> GetSqlDatabaseAsync(Logger logger); Task<string> GetApiKey(Logger logger); Task<SecretBundle> GetEncryptionKey(Logger logger, string version = null); Task PutEncryptionKey(Logger logger, string value); Task<IDictionary<string, SecretBundle>> GetEncryptionKeyVersions(Logger logger); } }
28.588235
88
0.730453
[ "MIT" ]
Azure/iot-central-bidirectional-device-bridge
DeviceBridge/Providers/ISecretsProvider.cs
974
C#
/* SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. * * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. * * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. 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. */ using OpenSearch.Client; namespace Tests.Mapping.Types.Core.SearchAsYouType { public class SearchAsYouTypeTest { [SearchAsYouType( MaxShingleSize = 4, Analyzer = "myanalyzer", Index = true, IndexOptions = IndexOptions.Offsets, SearchAnalyzer = "mysearchanalyzer", SearchQuoteAnalyzer = "mysearchquoteanalyzer", Similarity = "classic", Store = true, Norms = false, TermVector = TermVectorOption.WithPositionsOffsets)] public string Full { get; set; } [SearchAsYouType(MaxShingleSize = 1)] public string MaxShingleSize { get; set; } [SearchAsYouType] public string Minimal { get; set; } } public class SearchAsYouTypeAttributeTests : AttributeTestsBase<SearchAsYouTypeTest> { protected override object ExpectJson => new { properties = new { full = new { type = "search_as_you_type", max_shingle_size = 4, analyzer = "myanalyzer", index = true, index_options = "offsets", search_analyzer = "mysearchanalyzer", search_quote_analyzer = "mysearchquoteanalyzer", similarity = "classic", store = true, norms = false, term_vector = "with_positions_offsets" }, maxShingleSize = new { type = "search_as_you_type", max_shingle_size = 1 }, minimal = new { type = "search_as_you_type" } } }; } }
29.9625
85
0.722153
[ "Apache-2.0" ]
opensearch-project/opensearch-net
tests/Tests/Mapping/Types/Core/SearchAsYouType/SearchAsYouTypeAttributeTests.cs
2,397
C#
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using System.Threading.Tasks; // ReSharper disable CheckNamespace namespace OmniSharp.Extensions.LanguageServer.Protocol.Server { using static WorkspaceNames; public static class WorkspaceFoldersExtensions { public static Task<Container<WorkspaceFolder>> WorkspaceFolders(this ILanguageServerWorkspace mediator) { return mediator.SendRequest<Container<WorkspaceFolder>>(WorkspaceNames.WorkspaceFolders); } } }
31.368421
111
0.781879
[ "MIT" ]
Bia10/csharp-language-server-protocol
src/Protocol/Workspace/Server/WorkspaceFoldersExtensions.cs
596
C#
using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Xml.Serialization; namespace Workday.HumanResources { [GeneratedCode("System.Xml", "4.6.1590.0"), DesignerCategory("code"), DebuggerStepThrough, XmlType(Namespace = "urn:com.workday/bsvc")] [Serializable] public class Annual_Income_DataType : INotifyPropertyChanged { private DateTime effective_DateField; private bool effective_DateFieldSpecified; private CurrencyObjectType currency_ReferenceField; private decimal annual_IncomeField; private bool annual_IncomeFieldSpecified; [method: CompilerGenerated] [CompilerGenerated] public event PropertyChangedEventHandler PropertyChanged; [XmlElement(DataType = "date", Order = 0)] public DateTime Effective_Date { get { return this.effective_DateField; } set { this.effective_DateField = value; this.RaisePropertyChanged("Effective_Date"); } } [XmlIgnore] public bool Effective_DateSpecified { get { return this.effective_DateFieldSpecified; } set { this.effective_DateFieldSpecified = value; this.RaisePropertyChanged("Effective_DateSpecified"); } } [XmlElement(Order = 1)] public CurrencyObjectType Currency_Reference { get { return this.currency_ReferenceField; } set { this.currency_ReferenceField = value; this.RaisePropertyChanged("Currency_Reference"); } } [XmlElement(Order = 2)] public decimal Annual_Income { get { return this.annual_IncomeField; } set { this.annual_IncomeField = value; this.RaisePropertyChanged("Annual_Income"); } } [XmlIgnore] public bool Annual_IncomeSpecified { get { return this.annual_IncomeFieldSpecified; } set { this.annual_IncomeFieldSpecified = value; this.RaisePropertyChanged("Annual_IncomeSpecified"); } } protected void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged != null) { propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } }
20.611111
136
0.728661
[ "MIT" ]
matteofabbri/Workday.WebServices
Workday.HumanResources/Annual_Income_DataType.cs
2,226
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace ShapesWPF.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if ((resourceMan == null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShapesWPF.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
38.541667
175
0.602523
[ "MIT" ]
CNinnovation/WPFOct2018
StylesAndResources/StylesAndResourcesWPF/ShapesWPF/Properties/Resources.Designer.cs
2,777
C#
using System; namespace Xrpl.Client.Model.Transaction.Interfaces { public interface IPaymentChannelCreateTransaction : ITransactionCommon { string Amount { get; set; } DateTime? CancelAfter { get; set; } string Destination { get; set; } uint? DestinationTag { get; set; } string PublicKey { get; set; } uint SettleDelay { get; set; } uint? SourceTag { get; set; } } }
29.133333
74
0.622426
[ "Apache-2.0" ]
CASL-AE/Xrpl.C
Xrpl.C/Xrpl/Client/Model/Transaction/Interfaces/IPaymentChannelCreateTransaction.cs
439
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; 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; using Windows.UI.Core; namespace ImageApp { /// <summary> /// Provides application-specific behavior to supplement the default Application class. /// </summary> sealed partial class App : Application { /// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } /// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // App-Initialisierung nicht wiederholen, wenn das Fenster bereits Inhalte enthält. // Nur sicherstellen, dass das Fenster aktiv ist. if (rootFrame == null) { // Frame erstellen, der als Navigationskontext fungiert und zum Parameter der ersten Seite navigieren rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Zustand von zuvor angehaltener Anwendung laden } // Den Frame im aktuellen Fenster platzieren Window.Current.Content = rootFrame; // Register a handler for BackRequested events and set the // visibility of the Back button rootFrame.Navigated += OnNavigated; SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = rootFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // Wenn der Navigationsstapel nicht wiederhergestellt wird, zur ersten Seite navigieren // und die neue Seite konfigurieren, indem die erforderlichen Informationen als Navigationsparameter // übergeben werden rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Sicherstellen, dass das aktuelle Fenster aktiv ist Window.Current.Activate(); } } void OnNavigated(object sender, NavigationEventArgs e) { // Each time a navigation event occurs, update the Back button's visibility SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = ((Frame)sender).CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; } void OnBackRequested(object sender, BackRequestedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame.CanGoBack) { e.Handled = true; rootFrame.GoBack(); } } /// <summary> /// Invoked when Navigation to a certain page fails /// </summary> /// <param name="sender">The Frame which failed navigation</param> /// <param name="e">Details about the navigation failure</param> void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } /// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Save application state and stop any background activity deferral.Complete(); } } }
39.631579
120
0.618099
[ "MIT" ]
danielbeckmann/DotNETJumpStart
06. Universal Windows Platform/01. Projektsetup/Quellcode/ImageApp/App.xaml.cs
5,275
C#
using System.Collections.Generic; namespace Wasm.Instructions { /// <summary> /// A collection of operator definitions. /// </summary> public static class Operators { static Operators() { opsByOpCode = new Dictionary<byte, Operator>(); Unreachable = Register<NullaryOperator>(new NullaryOperator(0x00, WasmType.Empty, "unreachable")); Nop = Register<NullaryOperator>(new NullaryOperator(0x01, WasmType.Empty, "nop")); Block = Register<BlockOperator>(new BlockOperator(0x02, WasmType.Empty, "block")); Loop = Register<BlockOperator>(new BlockOperator(0x03, WasmType.Empty, "loop")); If = Register<IfElseOperator>(new IfElseOperator(0x04, WasmType.Empty, "if")); Br = Register<VarUInt32Operator>(new VarUInt32Operator(0x0c, WasmType.Empty, "br")); BrIf = Register<VarUInt32Operator>(new VarUInt32Operator(0x0d, WasmType.Empty, "br_if")); BrTable = Register<BrTableOperator>(new BrTableOperator(0x0e, WasmType.Empty, "br_table")); Return = Register<NullaryOperator>(new NullaryOperator(0x0f, WasmType.Empty, "return")); Drop = Register<NullaryOperator>(new NullaryOperator(0x1a, WasmType.Empty, "drop")); Select = Register<NullaryOperator>(new NullaryOperator(0x1b, WasmType.Empty, "select")); Call = Register<VarUInt32Operator>(new VarUInt32Operator(0x10, WasmType.Empty, "call")); CallIndirect = Register<CallIndirectOperator>(new CallIndirectOperator(0x11, WasmType.Empty, "call_indirect")); GetLocal = Register<VarUInt32Operator>(new VarUInt32Operator(0x20, WasmType.Empty, "get_local")); SetLocal = Register<VarUInt32Operator>(new VarUInt32Operator(0x21, WasmType.Empty, "set_local")); TeeLocal = Register<VarUInt32Operator>(new VarUInt32Operator(0x22, WasmType.Empty, "tee_local")); GetGlobal = Register<VarUInt32Operator>(new VarUInt32Operator(0x23, WasmType.Empty, "get_global")); SetGlobal = Register<VarUInt32Operator>(new VarUInt32Operator(0x24, WasmType.Empty, "set_global")); Int32Const = Register<VarInt32Operator>(new VarInt32Operator(0x41, WasmType.Int32, "const")); Int64Const = Register<VarInt64Operator>(new VarInt64Operator(0x42, WasmType.Int64, "const")); Float32Const = Register<Float32Operator>(new Float32Operator(0x43, WasmType.Float32, "const")); Float64Const = Register<Float64Operator>(new Float64Operator(0x44, WasmType.Float64, "const")); Int32Load = Register<MemoryOperator>(new MemoryOperator(0x28, WasmType.Int32, "load")); Int64Load = Register<MemoryOperator>(new MemoryOperator(0x29, WasmType.Int64, "load")); Float32Load = Register<MemoryOperator>(new MemoryOperator(0x2a, WasmType.Float32, "load")); Float64Load = Register<MemoryOperator>(new MemoryOperator(0x2b, WasmType.Float64, "load")); Int32Load8S = Register<MemoryOperator>(new MemoryOperator(0x2c, WasmType.Int32, "load8_s")); Int32Load8U = Register<MemoryOperator>(new MemoryOperator(0x2d, WasmType.Int32, "load8_u")); Int32Load16S = Register<MemoryOperator>(new MemoryOperator(0x2e, WasmType.Int32, "load16_s")); Int32Load16U = Register<MemoryOperator>(new MemoryOperator(0x2f, WasmType.Int32, "load16_u")); Int64Load8S = Register<MemoryOperator>(new MemoryOperator(0x30, WasmType.Int64, "load8_s")); Int64Load8U = Register<MemoryOperator>(new MemoryOperator(0x31, WasmType.Int64, "load8_u")); Int64Load16S = Register<MemoryOperator>(new MemoryOperator(0x32, WasmType.Int64, "load16_s")); Int64Load16U = Register<MemoryOperator>(new MemoryOperator(0x33, WasmType.Int64, "load16_u")); Int64Load32S = Register<MemoryOperator>(new MemoryOperator(0x34, WasmType.Int64, "load32_s")); Int64Load32U = Register<MemoryOperator>(new MemoryOperator(0x35, WasmType.Int64, "load32_u")); Int32Store = Register<MemoryOperator>(new MemoryOperator(0x36, WasmType.Int32, "store")); Int64Store = Register<MemoryOperator>(new MemoryOperator(0x37, WasmType.Int64, "store")); Float32Store = Register<MemoryOperator>(new MemoryOperator(0x38, WasmType.Float32, "store")); Float64Store = Register<MemoryOperator>(new MemoryOperator(0x39, WasmType.Float64, "store")); Int32Store8 = Register<MemoryOperator>(new MemoryOperator(0x3a, WasmType.Int32, "store8")); Int32Store16 = Register<MemoryOperator>(new MemoryOperator(0x3b, WasmType.Int32, "store16")); Int64Store8 = Register<MemoryOperator>(new MemoryOperator(0x3c, WasmType.Int64, "store8")); Int64Store16 = Register<MemoryOperator>(new MemoryOperator(0x3d, WasmType.Int64, "store16")); Int64Store32 = Register<MemoryOperator>(new MemoryOperator(0x3e, WasmType.Int64, "store32")); CurrentMemory = Register<VarUInt32Operator>(new VarUInt32Operator(0x3f, WasmType.Empty, "current_memory")); GrowMemory = Register<VarUInt32Operator>(new VarUInt32Operator(0x40, WasmType.Empty, "grow_memory")); // The code below has been auto-generated by nullary-opcode-generator. Int32Eqz = Register<NullaryOperator>(new NullaryOperator(0x45, WasmType.Int32, "eqz")); Int32Eq = Register<NullaryOperator>(new NullaryOperator(0x46, WasmType.Int32, "eq")); Int32Ne = Register<NullaryOperator>(new NullaryOperator(0x47, WasmType.Int32, "ne")); Int32LtS = Register<NullaryOperator>(new NullaryOperator(0x48, WasmType.Int32, "lt_s")); Int32LtU = Register<NullaryOperator>(new NullaryOperator(0x49, WasmType.Int32, "lt_u")); Int32GtS = Register<NullaryOperator>(new NullaryOperator(0x4a, WasmType.Int32, "gt_s")); Int32GtU = Register<NullaryOperator>(new NullaryOperator(0x4b, WasmType.Int32, "gt_u")); Int32LeS = Register<NullaryOperator>(new NullaryOperator(0x4c, WasmType.Int32, "le_s")); Int32LeU = Register<NullaryOperator>(new NullaryOperator(0x4d, WasmType.Int32, "le_u")); Int32GeS = Register<NullaryOperator>(new NullaryOperator(0x4e, WasmType.Int32, "ge_s")); Int32GeU = Register<NullaryOperator>(new NullaryOperator(0x4f, WasmType.Int32, "ge_u")); Int64Eqz = Register<NullaryOperator>(new NullaryOperator(0x50, WasmType.Int64, "eqz")); Int64Eq = Register<NullaryOperator>(new NullaryOperator(0x51, WasmType.Int64, "eq")); Int64Ne = Register<NullaryOperator>(new NullaryOperator(0x52, WasmType.Int64, "ne")); Int64LtS = Register<NullaryOperator>(new NullaryOperator(0x53, WasmType.Int64, "lt_s")); Int64LtU = Register<NullaryOperator>(new NullaryOperator(0x54, WasmType.Int64, "lt_u")); Int64GtS = Register<NullaryOperator>(new NullaryOperator(0x55, WasmType.Int64, "gt_s")); Int64GtU = Register<NullaryOperator>(new NullaryOperator(0x56, WasmType.Int64, "gt_u")); Int64LeS = Register<NullaryOperator>(new NullaryOperator(0x57, WasmType.Int64, "le_s")); Int64LeU = Register<NullaryOperator>(new NullaryOperator(0x58, WasmType.Int64, "le_u")); Int64GeS = Register<NullaryOperator>(new NullaryOperator(0x59, WasmType.Int64, "ge_s")); Int64GeU = Register<NullaryOperator>(new NullaryOperator(0x5a, WasmType.Int64, "ge_u")); Float32Eq = Register<NullaryOperator>(new NullaryOperator(0x5b, WasmType.Float32, "eq")); Float32Ne = Register<NullaryOperator>(new NullaryOperator(0x5c, WasmType.Float32, "ne")); Float32Lt = Register<NullaryOperator>(new NullaryOperator(0x5d, WasmType.Float32, "lt")); Float32Gt = Register<NullaryOperator>(new NullaryOperator(0x5e, WasmType.Float32, "gt")); Float32Le = Register<NullaryOperator>(new NullaryOperator(0x5f, WasmType.Float32, "le")); Float32Ge = Register<NullaryOperator>(new NullaryOperator(0x60, WasmType.Float32, "ge")); Float64Eq = Register<NullaryOperator>(new NullaryOperator(0x61, WasmType.Float64, "eq")); Float64Ne = Register<NullaryOperator>(new NullaryOperator(0x62, WasmType.Float64, "ne")); Float64Lt = Register<NullaryOperator>(new NullaryOperator(0x63, WasmType.Float64, "lt")); Float64Gt = Register<NullaryOperator>(new NullaryOperator(0x64, WasmType.Float64, "gt")); Float64Le = Register<NullaryOperator>(new NullaryOperator(0x65, WasmType.Float64, "le")); Float64Ge = Register<NullaryOperator>(new NullaryOperator(0x66, WasmType.Float64, "ge")); Int32Clz = Register<NullaryOperator>(new NullaryOperator(0x67, WasmType.Int32, "clz")); Int32Ctz = Register<NullaryOperator>(new NullaryOperator(0x68, WasmType.Int32, "ctz")); Int32Popcnt = Register<NullaryOperator>(new NullaryOperator(0x69, WasmType.Int32, "popcnt")); Int32Add = Register<NullaryOperator>(new NullaryOperator(0x6a, WasmType.Int32, "add")); Int32Sub = Register<NullaryOperator>(new NullaryOperator(0x6b, WasmType.Int32, "sub")); Int32Mul = Register<NullaryOperator>(new NullaryOperator(0x6c, WasmType.Int32, "mul")); Int32DivS = Register<NullaryOperator>(new NullaryOperator(0x6d, WasmType.Int32, "div_s")); Int32DivU = Register<NullaryOperator>(new NullaryOperator(0x6e, WasmType.Int32, "div_u")); Int32RemS = Register<NullaryOperator>(new NullaryOperator(0x6f, WasmType.Int32, "rem_s")); Int32RemU = Register<NullaryOperator>(new NullaryOperator(0x70, WasmType.Int32, "rem_u")); Int32And = Register<NullaryOperator>(new NullaryOperator(0x71, WasmType.Int32, "and")); Int32Or = Register<NullaryOperator>(new NullaryOperator(0x72, WasmType.Int32, "or")); Int32Xor = Register<NullaryOperator>(new NullaryOperator(0x73, WasmType.Int32, "xor")); Int32Shl = Register<NullaryOperator>(new NullaryOperator(0x74, WasmType.Int32, "shl")); Int32ShrS = Register<NullaryOperator>(new NullaryOperator(0x75, WasmType.Int32, "shr_s")); Int32ShrU = Register<NullaryOperator>(new NullaryOperator(0x76, WasmType.Int32, "shr_u")); Int32Rotl = Register<NullaryOperator>(new NullaryOperator(0x77, WasmType.Int32, "rotl")); Int32Rotr = Register<NullaryOperator>(new NullaryOperator(0x78, WasmType.Int32, "rotr")); Int64Clz = Register<NullaryOperator>(new NullaryOperator(0x79, WasmType.Int64, "clz")); Int64Ctz = Register<NullaryOperator>(new NullaryOperator(0x7a, WasmType.Int64, "ctz")); Int64Popcnt = Register<NullaryOperator>(new NullaryOperator(0x7b, WasmType.Int64, "popcnt")); Int64Add = Register<NullaryOperator>(new NullaryOperator(0x7c, WasmType.Int64, "add")); Int64Sub = Register<NullaryOperator>(new NullaryOperator(0x7d, WasmType.Int64, "sub")); Int64Mul = Register<NullaryOperator>(new NullaryOperator(0x7e, WasmType.Int64, "mul")); Int64DivS = Register<NullaryOperator>(new NullaryOperator(0x7f, WasmType.Int64, "div_s")); Int64DivU = Register<NullaryOperator>(new NullaryOperator(0x80, WasmType.Int64, "div_u")); Int64RemS = Register<NullaryOperator>(new NullaryOperator(0x81, WasmType.Int64, "rem_s")); Int64RemU = Register<NullaryOperator>(new NullaryOperator(0x82, WasmType.Int64, "rem_u")); Int64And = Register<NullaryOperator>(new NullaryOperator(0x83, WasmType.Int64, "and")); Int64Or = Register<NullaryOperator>(new NullaryOperator(0x84, WasmType.Int64, "or")); Int64Xor = Register<NullaryOperator>(new NullaryOperator(0x85, WasmType.Int64, "xor")); Int64Shl = Register<NullaryOperator>(new NullaryOperator(0x86, WasmType.Int64, "shl")); Int64ShrS = Register<NullaryOperator>(new NullaryOperator(0x87, WasmType.Int64, "shr_s")); Int64ShrU = Register<NullaryOperator>(new NullaryOperator(0x88, WasmType.Int64, "shr_u")); Int64Rotl = Register<NullaryOperator>(new NullaryOperator(0x89, WasmType.Int64, "rotl")); Int64Rotr = Register<NullaryOperator>(new NullaryOperator(0x8a, WasmType.Int64, "rotr")); Float32Abs = Register<NullaryOperator>(new NullaryOperator(0x8b, WasmType.Float32, "abs")); Float32Neg = Register<NullaryOperator>(new NullaryOperator(0x8c, WasmType.Float32, "neg")); Float32Ceil = Register<NullaryOperator>(new NullaryOperator(0x8d, WasmType.Float32, "ceil")); Float32Floor = Register<NullaryOperator>(new NullaryOperator(0x8e, WasmType.Float32, "floor")); Float32Trunc = Register<NullaryOperator>(new NullaryOperator(0x8f, WasmType.Float32, "trunc")); Float32Nearest = Register<NullaryOperator>(new NullaryOperator(0x90, WasmType.Float32, "nearest")); Float32Sqrt = Register<NullaryOperator>(new NullaryOperator(0x91, WasmType.Float32, "sqrt")); Float32Add = Register<NullaryOperator>(new NullaryOperator(0x92, WasmType.Float32, "add")); Float32Sub = Register<NullaryOperator>(new NullaryOperator(0x93, WasmType.Float32, "sub")); Float32Mul = Register<NullaryOperator>(new NullaryOperator(0x94, WasmType.Float32, "mul")); Float32Div = Register<NullaryOperator>(new NullaryOperator(0x95, WasmType.Float32, "div")); Float32Min = Register<NullaryOperator>(new NullaryOperator(0x96, WasmType.Float32, "min")); Float32Max = Register<NullaryOperator>(new NullaryOperator(0x97, WasmType.Float32, "max")); Float32Copysign = Register<NullaryOperator>(new NullaryOperator(0x98, WasmType.Float32, "copysign")); Float64Abs = Register<NullaryOperator>(new NullaryOperator(0x99, WasmType.Float64, "abs")); Float64Neg = Register<NullaryOperator>(new NullaryOperator(0x9a, WasmType.Float64, "neg")); Float64Ceil = Register<NullaryOperator>(new NullaryOperator(0x9b, WasmType.Float64, "ceil")); Float64Floor = Register<NullaryOperator>(new NullaryOperator(0x9c, WasmType.Float64, "floor")); Float64Trunc = Register<NullaryOperator>(new NullaryOperator(0x9d, WasmType.Float64, "trunc")); Float64Nearest = Register<NullaryOperator>(new NullaryOperator(0x9e, WasmType.Float64, "nearest")); Float64Sqrt = Register<NullaryOperator>(new NullaryOperator(0x9f, WasmType.Float64, "sqrt")); Float64Add = Register<NullaryOperator>(new NullaryOperator(0xa0, WasmType.Float64, "add")); Float64Sub = Register<NullaryOperator>(new NullaryOperator(0xa1, WasmType.Float64, "sub")); Float64Mul = Register<NullaryOperator>(new NullaryOperator(0xa2, WasmType.Float64, "mul")); Float64Div = Register<NullaryOperator>(new NullaryOperator(0xa3, WasmType.Float64, "div")); Float64Min = Register<NullaryOperator>(new NullaryOperator(0xa4, WasmType.Float64, "min")); Float64Max = Register<NullaryOperator>(new NullaryOperator(0xa5, WasmType.Float64, "max")); Float64Copysign = Register<NullaryOperator>(new NullaryOperator(0xa6, WasmType.Float64, "copysign")); Int32WrapInt64 = Register<NullaryOperator>(new NullaryOperator(0xa7, WasmType.Int32, "wrap/i64")); Int32TruncSFloat32 = Register<NullaryOperator>(new NullaryOperator(0xa8, WasmType.Int32, "trunc_s/f32")); Int32TruncUFloat32 = Register<NullaryOperator>(new NullaryOperator(0xa9, WasmType.Int32, "trunc_u/f32")); Int32TruncSFloat64 = Register<NullaryOperator>(new NullaryOperator(0xaa, WasmType.Int32, "trunc_s/f64")); Int32TruncUFloat64 = Register<NullaryOperator>(new NullaryOperator(0xab, WasmType.Int32, "trunc_u/f64")); Int64ExtendSInt32 = Register<NullaryOperator>(new NullaryOperator(0xac, WasmType.Int64, "extend_s/i32")); Int64ExtendUInt32 = Register<NullaryOperator>(new NullaryOperator(0xad, WasmType.Int64, "extend_u/i32")); Int64TruncSFloat32 = Register<NullaryOperator>(new NullaryOperator(0xae, WasmType.Int64, "trunc_s/f32")); Int64TruncUFloat32 = Register<NullaryOperator>(new NullaryOperator(0xaf, WasmType.Int64, "trunc_u/f32")); Int64TruncSFloat64 = Register<NullaryOperator>(new NullaryOperator(0xb0, WasmType.Int64, "trunc_s/f64")); Int64TruncUFloat64 = Register<NullaryOperator>(new NullaryOperator(0xb1, WasmType.Int64, "trunc_u/f64")); Float32ConvertSInt32 = Register<NullaryOperator>(new NullaryOperator(0xb2, WasmType.Float32, "convert_s/i32")); Float32ConvertUInt32 = Register<NullaryOperator>(new NullaryOperator(0xb3, WasmType.Float32, "convert_u/i32")); Float32ConvertSInt64 = Register<NullaryOperator>(new NullaryOperator(0xb4, WasmType.Float32, "convert_s/i64")); Float32ConvertUInt64 = Register<NullaryOperator>(new NullaryOperator(0xb5, WasmType.Float32, "convert_u/i64")); Float32DemoteFloat64 = Register<NullaryOperator>(new NullaryOperator(0xb6, WasmType.Float32, "demote/f64")); Float64ConvertSInt32 = Register<NullaryOperator>(new NullaryOperator(0xb7, WasmType.Float64, "convert_s/i32")); Float64ConvertUInt32 = Register<NullaryOperator>(new NullaryOperator(0xb8, WasmType.Float64, "convert_u/i32")); Float64ConvertSInt64 = Register<NullaryOperator>(new NullaryOperator(0xb9, WasmType.Float64, "convert_s/i64")); Float64ConvertUInt64 = Register<NullaryOperator>(new NullaryOperator(0xba, WasmType.Float64, "convert_u/i64")); Float64PromoteFloat32 = Register<NullaryOperator>(new NullaryOperator(0xbb, WasmType.Float64, "promote/f32")); Int32ReinterpretFloat32 = Register<NullaryOperator>(new NullaryOperator(0xbc, WasmType.Int32, "reinterpret/f32")); Int64ReinterpretFloat64 = Register<NullaryOperator>(new NullaryOperator(0xbd, WasmType.Int64, "reinterpret/f64")); Float32ReinterpretInt32 = Register<NullaryOperator>(new NullaryOperator(0xbe, WasmType.Float32, "reinterpret/i32")); Float64ReinterpretInt64 = Register<NullaryOperator>(new NullaryOperator(0xbf, WasmType.Float64, "reinterpret/i64")); } /// <summary> /// A map of opcodes to the operators that define them. /// </summary> private static Dictionary<byte, Operator> opsByOpCode; /// <summary> /// Gets a map of opcodes to the operators that define them. /// </summary> public static IReadOnlyDictionary<byte, Operator> OperatorsByOpCode => opsByOpCode; /// <summary> /// Gets a sequence that contains all WebAssembly operators defined by this class. /// </summary> public static IEnumerable<Operator> AllOperators => opsByOpCode.Values; /// <summary> /// Registers the given operator. /// </summary> /// <param name="op">The operator to register.</param> /// <returns>The operator.</returns> private static T Register<T>(T op) where T : Operator { opsByOpCode.Add(op.OpCode, op); return op; } /// <summary> /// Gets the operator with the given opcode. /// </summary> /// <param name="opCode">The opcode to find an operator for.</param> /// <returns>The operator with the given opcode.</returns> public static Operator GetOperatorByOpCode(byte opCode) { Operator result; if (OperatorsByOpCode.TryGetValue(opCode, out result)) { return result; } else { throw new WasmException( string.Format("Unknown opcode: {0}", DumpHelpers.FormatHex(opCode))); } } /// <summary> /// The 'unreachable' operator, which traps immediately. /// </summary> public static readonly NullaryOperator Unreachable; /// <summary> /// The 'nop' operator, which does nothing. /// </summary> public static readonly NullaryOperator Nop; /// <summary> /// The 'block' operator, which begins a sequence of expressions, yielding 0 or 1 values. /// </summary> public static readonly BlockOperator Block; /// <summary> /// The 'loop' operator, which begins a block which can also form control flow loops /// </summary> public static readonly BlockOperator Loop; /// <summary> /// The 'if' operator, which runs one of two sequences of expressions. /// </summary> public static readonly IfElseOperator If; /// <summary> /// The 'br' operator: a break that targets an outer nested block. /// </summary> public static readonly VarUInt32Operator Br; /// <summary> /// The 'br_if' operator: a conditional break that targets an outer nested block. /// </summary> public static readonly VarUInt32Operator BrIf; /// <summary> /// The 'br_table' operator, which begins a break table. /// </summary> public static readonly BrTableOperator BrTable; /// <summary> /// The 'return' operator, which returns zero or one value from a function. /// </summary> public static readonly NullaryOperator Return; /// <summary> /// The 'drop' operator, which pops the top-of-stack value and ignores it. /// </summary> public static readonly NullaryOperator Drop; /// <summary> /// The 'select' operator, which selects one of two values based on a condition. /// </summary> public static readonly NullaryOperator Select; /// <summary> /// The 'call' operator, which calls a function by its index. /// </summary> public static readonly VarUInt32Operator Call; /// <summary> /// The 'call_indirect' operator, which calls a function pointer. /// </summary> public static readonly CallIndirectOperator CallIndirect; /// <summary> /// The 'get_local' operator, which reads a local variable or parameter. /// </summary> public static readonly VarUInt32Operator GetLocal; /// <summary> /// The 'set_local' operator, which writes a value to a local variable or parameter. /// </summary> public static readonly VarUInt32Operator SetLocal; /// <summary> /// The 'tee_local' operator, which writes a value to a local variable or parameter /// and then returns the same value. /// </summary> public static readonly VarUInt32Operator TeeLocal; /// <summary> /// The 'get_global' operator, which reads a global variable. /// </summary> public static readonly VarUInt32Operator GetGlobal; /// <summary> /// The 'set_global' operator, which writes a value to a global variable. /// </summary> public static readonly VarUInt32Operator SetGlobal; /// <summary> /// The 'i32.load' operator, which loads a 32-bit integer from linear memory. /// </summary> public static readonly MemoryOperator Int32Load; /// <summary> /// The 'i64.load' operator, which loads a 64-bit integer from linear memory. /// </summary> public static readonly MemoryOperator Int64Load; /// <summary> /// The 'f32.load' operator, which loads a 32-bit floating-point number from linear memory. /// </summary> public static readonly MemoryOperator Float32Load; /// <summary> /// The 'f64.load' operator, which loads a 64-bit floating-point number from linear memory. /// </summary> public static readonly MemoryOperator Float64Load; /// <summary> /// The 'i32.load8_s' operator, which loads a byte from memory and sign-extends it to /// a 32-bit integer. /// </summary> public static readonly MemoryOperator Int32Load8S; /// <summary> /// The 'i32.load8_u' operator, which loads a byte from memory and zero-extends it to /// a 32-bit integer. /// </summary> public static readonly MemoryOperator Int32Load8U; /// <summary> /// The 'i32.load16_s' operator, which loads a 16-bit integer from memory and /// sign-extends it to a 32-bit integer. /// </summary> public static readonly MemoryOperator Int32Load16S; /// <summary> /// The 'i32.load16_u' operator, which loads a 16-bit integer from memory and /// zero-extends it to a 32-bit integer. /// </summary> public static readonly MemoryOperator Int32Load16U; /// <summary> /// The 'i64.load8_s' operator, which loads a byte from memory and sign-extends it to /// a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load8S; /// <summary> /// The 'i64.load8_u' operator, which loads a byte from memory and zero-extends it to /// a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load8U; /// <summary> /// The 'i64.load16_s' operator, which loads a 16-bit integer from memory and /// sign-extends it to a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load16S; /// <summary> /// The 'i64.load16_u' operator, which loads a 16-bit integer from memory and /// zero-extends it to a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load16U; /// <summary> /// The 'i64.load32_s' operator, which loads a 32-bit integer from memory and /// sign-extends it to a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load32S; /// <summary> /// The 'i64.load32_u' operator, which loads a 32-bit integer from memory and /// zero-extends it to a 64-bit integer. /// </summary> public static readonly MemoryOperator Int64Load32U; /// <summary> /// The 'i32.store' operator, which stores a 32-bit integer in linear memory. /// </summary> public static readonly MemoryOperator Int32Store; /// <summary> /// The 'i64.store' operator, which stores a 64-bit integer in linear memory. /// </summary> public static readonly MemoryOperator Int64Store; /// <summary> /// The 'f32.store' operator, which stores a 32-bit floating-point number in /// linear memory. /// </summary> public static readonly MemoryOperator Float32Store; /// <summary> /// The 'f64.store' operator, which stores a 64-bit floating-point number in /// linear memory. /// </summary> public static readonly MemoryOperator Float64Store; /// <summary> /// The 'i32.store' operator, which truncates a 32-bit integer to a byte and stores /// it in linear memory. /// </summary> public static readonly MemoryOperator Int32Store8; /// <summary> /// The 'i32.store' operator, which truncates a 32-bit integer to a 16-bit integer /// and stores it in linear memory. /// </summary> public static readonly MemoryOperator Int32Store16; /// <summary> /// The 'i64.store' operator, which truncates a 64-bit integer to a byte and stores /// it in linear memory. /// </summary> public static readonly MemoryOperator Int64Store8; /// <summary> /// The 'i64.store' operator, which truncates a 64-bit integer to a 16-bit integer /// and stores it in linear memory. /// </summary> public static readonly MemoryOperator Int64Store16; /// <summary> /// The 'i64.store' operator, which truncates a 64-bit integer to a 32-bit integer /// and stores it in linear memory. /// </summary> public static readonly MemoryOperator Int64Store32; /// <summary> /// The 'current_memory' operator, which queries the memory size. /// </summary> public static readonly VarUInt32Operator CurrentMemory; /// <summary> /// The 'grow_memory' operator, which grows the memory size. /// </summary> public static readonly VarUInt32Operator GrowMemory; /// <summary> /// The 'i32.const' operator, which loads a constant 32-bit integer onto the stack. /// </summary> public static readonly VarInt32Operator Int32Const; /// <summary> /// The 'i64.const' operator, which loads a constant 64-bit integer onto the stack. /// </summary> public static readonly VarInt64Operator Int64Const; /// <summary> /// The 'f32.const' operator, which loads a constant 32-bit floating-point number onto the stack. /// </summary> public static readonly Float32Operator Float32Const; /// <summary> /// The 'f64.const' operator, which loads a constant 64-bit floating-point number onto the stack. /// </summary> public static readonly Float64Operator Float64Const; /// <summary> /// The 'else' opcode, which begins an 'if' expression's 'else' block. /// </summary> public const byte ElseOpCode = 0x05; /// <summary> /// The 'end' opcode, which ends a block, loop or if. /// </summary> public const byte EndOpCode = 0x0b; #region Auto-generated nullaries // This region was auto-generated by nullary-opcode-generator. Please don't make any // manual changes. /// <summary> /// The 'i32.eqz' operator: compare equal to zero (return 1 if operand is zero, 0 otherwise). /// </summary> public static readonly NullaryOperator Int32Eqz; /// <summary> /// The 'i32.eq' operator: sign-agnostic compare equal. /// </summary> public static readonly NullaryOperator Int32Eq; /// <summary> /// The 'i32.ne' operator: sign-agnostic compare unequal. /// </summary> public static readonly NullaryOperator Int32Ne; /// <summary> /// The 'i32.lt_s' operator: signed less than. /// </summary> public static readonly NullaryOperator Int32LtS; /// <summary> /// The 'i32.lt_u' operator: unsigned less than. /// </summary> public static readonly NullaryOperator Int32LtU; /// <summary> /// The 'i32.gt_s' operator: signed greater than. /// </summary> public static readonly NullaryOperator Int32GtS; /// <summary> /// The 'i32.gt_u' operator: unsigned greater than. /// </summary> public static readonly NullaryOperator Int32GtU; /// <summary> /// The 'i32.le_s' operator: signed less than or equal. /// </summary> public static readonly NullaryOperator Int32LeS; /// <summary> /// The 'i32.le_u' operator: unsigned less than or equal. /// </summary> public static readonly NullaryOperator Int32LeU; /// <summary> /// The 'i32.ge_s' operator: signed greater than or equal. /// </summary> public static readonly NullaryOperator Int32GeS; /// <summary> /// The 'i32.ge_u' operator: unsigned greater than or equal. /// </summary> public static readonly NullaryOperator Int32GeU; /// <summary> /// The 'i64.eqz' operator: compare equal to zero (return 1 if operand is zero, 0 otherwise). /// </summary> public static readonly NullaryOperator Int64Eqz; /// <summary> /// The 'i64.eq' operator: sign-agnostic compare equal. /// </summary> public static readonly NullaryOperator Int64Eq; /// <summary> /// The 'i64.ne' operator: sign-agnostic compare unequal. /// </summary> public static readonly NullaryOperator Int64Ne; /// <summary> /// The 'i64.lt_s' operator: signed less than. /// </summary> public static readonly NullaryOperator Int64LtS; /// <summary> /// The 'i64.lt_u' operator: unsigned less than. /// </summary> public static readonly NullaryOperator Int64LtU; /// <summary> /// The 'i64.gt_s' operator: signed greater than. /// </summary> public static readonly NullaryOperator Int64GtS; /// <summary> /// The 'i64.gt_u' operator: unsigned greater than. /// </summary> public static readonly NullaryOperator Int64GtU; /// <summary> /// The 'i64.le_s' operator: signed less than or equal. /// </summary> public static readonly NullaryOperator Int64LeS; /// <summary> /// The 'i64.le_u' operator: unsigned less than or equal. /// </summary> public static readonly NullaryOperator Int64LeU; /// <summary> /// The 'i64.ge_s' operator: signed greater than or equal. /// </summary> public static readonly NullaryOperator Int64GeS; /// <summary> /// The 'i64.ge_u' operator: unsigned greater than or equal. /// </summary> public static readonly NullaryOperator Int64GeU; /// <summary> /// The 'f32.eq' operator: compare ordered and equal. /// </summary> public static readonly NullaryOperator Float32Eq; /// <summary> /// The 'f32.ne' operator: compare unordered or unequal. /// </summary> public static readonly NullaryOperator Float32Ne; /// <summary> /// The 'f32.lt' operator: compare ordered and less than. /// </summary> public static readonly NullaryOperator Float32Lt; /// <summary> /// The 'f32.gt' operator: compare ordered and greater than. /// </summary> public static readonly NullaryOperator Float32Gt; /// <summary> /// The 'f32.le' operator: compare ordered and less than or equal. /// </summary> public static readonly NullaryOperator Float32Le; /// <summary> /// The 'f32.ge' operator: compare ordered and greater than or equal. /// </summary> public static readonly NullaryOperator Float32Ge; /// <summary> /// The 'f64.eq' operator: compare ordered and equal. /// </summary> public static readonly NullaryOperator Float64Eq; /// <summary> /// The 'f64.ne' operator: compare unordered or unequal. /// </summary> public static readonly NullaryOperator Float64Ne; /// <summary> /// The 'f64.lt' operator: compare ordered and less than. /// </summary> public static readonly NullaryOperator Float64Lt; /// <summary> /// The 'f64.gt' operator: compare ordered and greater than. /// </summary> public static readonly NullaryOperator Float64Gt; /// <summary> /// The 'f64.le' operator: compare ordered and less than or equal. /// </summary> public static readonly NullaryOperator Float64Le; /// <summary> /// The 'f64.ge' operator: compare ordered and greater than or equal. /// </summary> public static readonly NullaryOperator Float64Ge; /// <summary> /// The 'i32.clz' operator: sign-agnostic count leading zero bits (All zero bits are considered leading if the value is zero). /// </summary> public static readonly NullaryOperator Int32Clz; /// <summary> /// The 'i32.ctz' operator: sign-agnostic count trailing zero bits (All zero bits are considered trailing if the value is zero). /// </summary> public static readonly NullaryOperator Int32Ctz; /// <summary> /// The 'i32.popcnt' operator: sign-agnostic count number of one bits. /// </summary> public static readonly NullaryOperator Int32Popcnt; /// <summary> /// The 'i32.add' operator: sign-agnostic addition. /// </summary> public static readonly NullaryOperator Int32Add; /// <summary> /// The 'i32.sub' operator: sign-agnostic subtraction. /// </summary> public static readonly NullaryOperator Int32Sub; /// <summary> /// The 'i32.mul' operator: sign-agnostic multiplication (lower 32-bits). /// </summary> public static readonly NullaryOperator Int32Mul; /// <summary> /// The 'i32.div_s' operator: signed division (result is truncated toward zero). /// </summary> public static readonly NullaryOperator Int32DivS; /// <summary> /// The 'i32.div_u' operator: unsigned division (result is floored). /// </summary> public static readonly NullaryOperator Int32DivU; /// <summary> /// The 'i32.rem_s' operator: signed remainder (result has the sign of the dividend). /// </summary> public static readonly NullaryOperator Int32RemS; /// <summary> /// The 'i32.rem_u' operator: unsigned remainder. /// </summary> public static readonly NullaryOperator Int32RemU; /// <summary> /// The 'i32.and' operator: sign-agnostic bitwise and. /// </summary> public static readonly NullaryOperator Int32And; /// <summary> /// The 'i32.or' operator: sign-agnostic bitwise inclusive or. /// </summary> public static readonly NullaryOperator Int32Or; /// <summary> /// The 'i32.xor' operator: sign-agnostic bitwise exclusive or. /// </summary> public static readonly NullaryOperator Int32Xor; /// <summary> /// The 'i32.shl' operator: sign-agnostic shift left. /// </summary> public static readonly NullaryOperator Int32Shl; /// <summary> /// The 'i32.shr_s' operator: sign-replicating (arithmetic) shift right. /// </summary> public static readonly NullaryOperator Int32ShrS; /// <summary> /// The 'i32.shr_u' operator: zero-replicating (logical) shift right. /// </summary> public static readonly NullaryOperator Int32ShrU; /// <summary> /// The 'i32.rotl' operator: sign-agnostic rotate left. /// </summary> public static readonly NullaryOperator Int32Rotl; /// <summary> /// The 'i32.rotr' operator: sign-agnostic rotate right. /// </summary> public static readonly NullaryOperator Int32Rotr; /// <summary> /// The 'i64.clz' operator: sign-agnostic count leading zero bits (All zero bits are considered leading if the value is zero). /// </summary> public static readonly NullaryOperator Int64Clz; /// <summary> /// The 'i64.ctz' operator: sign-agnostic count trailing zero bits (All zero bits are considered trailing if the value is zero). /// </summary> public static readonly NullaryOperator Int64Ctz; /// <summary> /// The 'i64.popcnt' operator: sign-agnostic count number of one bits. /// </summary> public static readonly NullaryOperator Int64Popcnt; /// <summary> /// The 'i64.add' operator: sign-agnostic addition. /// </summary> public static readonly NullaryOperator Int64Add; /// <summary> /// The 'i64.sub' operator: sign-agnostic subtraction. /// </summary> public static readonly NullaryOperator Int64Sub; /// <summary> /// The 'i64.mul' operator: sign-agnostic multiplication (lower 32-bits). /// </summary> public static readonly NullaryOperator Int64Mul; /// <summary> /// The 'i64.div_s' operator: signed division (result is truncated toward zero). /// </summary> public static readonly NullaryOperator Int64DivS; /// <summary> /// The 'i64.div_u' operator: unsigned division (result is floored). /// </summary> public static readonly NullaryOperator Int64DivU; /// <summary> /// The 'i64.rem_s' operator: signed remainder (result has the sign of the dividend). /// </summary> public static readonly NullaryOperator Int64RemS; /// <summary> /// The 'i64.rem_u' operator: unsigned remainder. /// </summary> public static readonly NullaryOperator Int64RemU; /// <summary> /// The 'i64.and' operator: sign-agnostic bitwise and. /// </summary> public static readonly NullaryOperator Int64And; /// <summary> /// The 'i64.or' operator: sign-agnostic bitwise inclusive or. /// </summary> public static readonly NullaryOperator Int64Or; /// <summary> /// The 'i64.xor' operator: sign-agnostic bitwise exclusive or. /// </summary> public static readonly NullaryOperator Int64Xor; /// <summary> /// The 'i64.shl' operator: sign-agnostic shift left. /// </summary> public static readonly NullaryOperator Int64Shl; /// <summary> /// The 'i64.shr_s' operator: sign-replicating (arithmetic) shift right. /// </summary> public static readonly NullaryOperator Int64ShrS; /// <summary> /// The 'i64.shr_u' operator: zero-replicating (logical) shift right. /// </summary> public static readonly NullaryOperator Int64ShrU; /// <summary> /// The 'i64.rotl' operator: sign-agnostic rotate left. /// </summary> public static readonly NullaryOperator Int64Rotl; /// <summary> /// The 'i64.rotr' operator: sign-agnostic rotate right. /// </summary> public static readonly NullaryOperator Int64Rotr; /// <summary> /// The 'f32.abs' operator: absolute value. /// </summary> public static readonly NullaryOperator Float32Abs; /// <summary> /// The 'f32.neg' operator: negation. /// </summary> public static readonly NullaryOperator Float32Neg; /// <summary> /// The 'f32.ceil' operator: ceiling operator. /// </summary> public static readonly NullaryOperator Float32Ceil; /// <summary> /// The 'f32.floor' operator: floor operator. /// </summary> public static readonly NullaryOperator Float32Floor; /// <summary> /// The 'f32.trunc' operator: round to nearest integer towards zero. /// </summary> public static readonly NullaryOperator Float32Trunc; /// <summary> /// The 'f32.nearest' operator: round to nearest integer, ties to even. /// </summary> public static readonly NullaryOperator Float32Nearest; /// <summary> /// The 'f32.sqrt' operator: square root. /// </summary> public static readonly NullaryOperator Float32Sqrt; /// <summary> /// The 'f32.add' operator: addition. /// </summary> public static readonly NullaryOperator Float32Add; /// <summary> /// The 'f32.sub' operator: subtraction. /// </summary> public static readonly NullaryOperator Float32Sub; /// <summary> /// The 'f32.mul' operator: multiplication. /// </summary> public static readonly NullaryOperator Float32Mul; /// <summary> /// The 'f32.div' operator: division. /// </summary> public static readonly NullaryOperator Float32Div; /// <summary> /// The 'f32.min' operator: minimum (binary operator); if either operand is NaN, returns NaN. /// </summary> public static readonly NullaryOperator Float32Min; /// <summary> /// The 'f32.max' operator: maximum (binary operator); if either operand is NaN, returns NaN. /// </summary> public static readonly NullaryOperator Float32Max; /// <summary> /// The 'f32.copysign' operator: copysign. /// </summary> public static readonly NullaryOperator Float32Copysign; /// <summary> /// The 'f64.abs' operator: absolute value. /// </summary> public static readonly NullaryOperator Float64Abs; /// <summary> /// The 'f64.neg' operator: negation. /// </summary> public static readonly NullaryOperator Float64Neg; /// <summary> /// The 'f64.ceil' operator: ceiling operator. /// </summary> public static readonly NullaryOperator Float64Ceil; /// <summary> /// The 'f64.floor' operator: floor operator. /// </summary> public static readonly NullaryOperator Float64Floor; /// <summary> /// The 'f64.trunc' operator: round to nearest integer towards zero. /// </summary> public static readonly NullaryOperator Float64Trunc; /// <summary> /// The 'f64.nearest' operator: round to nearest integer, ties to even. /// </summary> public static readonly NullaryOperator Float64Nearest; /// <summary> /// The 'f64.sqrt' operator: square root. /// </summary> public static readonly NullaryOperator Float64Sqrt; /// <summary> /// The 'f64.add' operator: addition. /// </summary> public static readonly NullaryOperator Float64Add; /// <summary> /// The 'f64.sub' operator: subtraction. /// </summary> public static readonly NullaryOperator Float64Sub; /// <summary> /// The 'f64.mul' operator: multiplication. /// </summary> public static readonly NullaryOperator Float64Mul; /// <summary> /// The 'f64.div' operator: division. /// </summary> public static readonly NullaryOperator Float64Div; /// <summary> /// The 'f64.min' operator: minimum (binary operator); if either operand is NaN, returns NaN. /// </summary> public static readonly NullaryOperator Float64Min; /// <summary> /// The 'f64.max' operator: maximum (binary operator); if either operand is NaN, returns NaN. /// </summary> public static readonly NullaryOperator Float64Max; /// <summary> /// The 'f64.copysign' operator: copysign. /// </summary> public static readonly NullaryOperator Float64Copysign; /// <summary> /// The 'i32.wrap/i64' operator: wrap a 64-bit integer to a 32-bit integer. /// </summary> public static readonly NullaryOperator Int32WrapInt64; /// <summary> /// The 'i32.trunc_s/f32' operator: truncate a 32-bit float to a signed 32-bit integer. /// </summary> public static readonly NullaryOperator Int32TruncSFloat32; /// <summary> /// The 'i32.trunc_u/f32' operator: truncate a 32-bit float to an unsigned 32-bit integer. /// </summary> public static readonly NullaryOperator Int32TruncUFloat32; /// <summary> /// The 'i32.trunc_s/f64' operator: truncate a 64-bit float to a signed 32-bit integer. /// </summary> public static readonly NullaryOperator Int32TruncSFloat64; /// <summary> /// The 'i32.trunc_u/f64' operator: truncate a 64-bit float to an unsigned 32-bit integer. /// </summary> public static readonly NullaryOperator Int32TruncUFloat64; /// <summary> /// The 'i64.extend_s/i32' operator: extend a signed 32-bit integer to a 64-bit integer. /// </summary> public static readonly NullaryOperator Int64ExtendSInt32; /// <summary> /// The 'i64.extend_u/i32' operator: extend an unsigned 32-bit integer to a 64-bit integer. /// </summary> public static readonly NullaryOperator Int64ExtendUInt32; /// <summary> /// The 'i64.trunc_s/f32' operator: truncate a 32-bit float to a signed 64-bit integer. /// </summary> public static readonly NullaryOperator Int64TruncSFloat32; /// <summary> /// The 'i64.trunc_u/f32' operator: truncate a 32-bit float to an unsigned 64-bit integer. /// </summary> public static readonly NullaryOperator Int64TruncUFloat32; /// <summary> /// The 'i64.trunc_s/f64' operator: truncate a 64-bit float to a signed 64-bit integer. /// </summary> public static readonly NullaryOperator Int64TruncSFloat64; /// <summary> /// The 'i64.trunc_u/f64' operator: truncate a 64-bit float to an unsigned 64-bit integer. /// </summary> public static readonly NullaryOperator Int64TruncUFloat64; /// <summary> /// The 'f32.convert_s/i32' operator: convert a signed 32-bit integer to a 32-bit float. /// </summary> public static readonly NullaryOperator Float32ConvertSInt32; /// <summary> /// The 'f32.convert_u/i32' operator: convert an unsigned 32-bit integer to a 32-bit float. /// </summary> public static readonly NullaryOperator Float32ConvertUInt32; /// <summary> /// The 'f32.convert_s/i64' operator: convert a signed 64-bit integer to a 32-bit float. /// </summary> public static readonly NullaryOperator Float32ConvertSInt64; /// <summary> /// The 'f32.convert_u/i64' operator: convert an unsigned 64-bit integer to a 32-bit float. /// </summary> public static readonly NullaryOperator Float32ConvertUInt64; /// <summary> /// The 'f32.demote/f64' operator: demote a 64-bit float to a 32-bit float. /// </summary> public static readonly NullaryOperator Float32DemoteFloat64; /// <summary> /// The 'f64.convert_s/i32' operator: convert a signed 32-bit integer to a 64-bit float. /// </summary> public static readonly NullaryOperator Float64ConvertSInt32; /// <summary> /// The 'f64.convert_u/i32' operator: convert an unsigned 32-bit integer to a 64-bit float. /// </summary> public static readonly NullaryOperator Float64ConvertUInt32; /// <summary> /// The 'f64.convert_s/i64' operator: convert a signed 64-bit integer to a 64-bit float. /// </summary> public static readonly NullaryOperator Float64ConvertSInt64; /// <summary> /// The 'f64.convert_u/i64' operator: convert an unsigned 64-bit integer to a 64-bit float. /// </summary> public static readonly NullaryOperator Float64ConvertUInt64; /// <summary> /// The 'f64.promote/f32' operator: promote a 32-bit float to a 64-bit float. /// </summary> public static readonly NullaryOperator Float64PromoteFloat32; /// <summary> /// The 'i32.reinterpret/f32' operator: reinterpret the bits of a 32-bit float as a 32-bit integer. /// </summary> public static readonly NullaryOperator Int32ReinterpretFloat32; /// <summary> /// The 'i64.reinterpret/f64' operator: reinterpret the bits of a 64-bit float as a 64-bit integer. /// </summary> public static readonly NullaryOperator Int64ReinterpretFloat64; /// <summary> /// The 'f32.reinterpret/i32' operator: reinterpret the bits of a 32-bit integer as a 32-bit float. /// </summary> public static readonly NullaryOperator Float32ReinterpretInt32; /// <summary> /// The 'f64.reinterpret/i64' operator: reinterpret the bits of a 64-bit integer as a 64-bit float. /// </summary> public static readonly NullaryOperator Float64ReinterpretInt64; #endregion } }
46.862745
136
0.635032
[ "MIT" ]
jonathanvdc/cs-wasm
libwasm/Instructions/Operators.cs
52,580
C#
using Azure.Core; using Azure.Identity; using Azure.Sdk.Tools.CheckEnforcer.Configuration; using Azure.Sdk.Tools.CheckEnforcer.Integrations.GitHub; using Azure.Security.KeyVault.Keys; using Azure.Security.KeyVault.Keys.Cryptography; using Azure.Security.KeyVault.Secrets; using Microsoft.Extensions.Caching.Memory; using Microsoft.IdentityModel.Tokens; using Octokit; using System; using System.Collections.Concurrent; using System.IdentityModel.Tokens.Jwt; using System.Security.Cryptography; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Azure.Sdk.Tools.CheckEnforcer { public class GitHubClientProvider : IGitHubClientProvider { public GitHubClientProvider(IGlobalConfigurationProvider globalConfigurationProvider, IMemoryCache cache, CryptographyClient cryptographyClient, GitHubRateLimiter limiter) { this.globalConfigurationProvider = globalConfigurationProvider; this.cache = cache; this.cryptographyClient = cryptographyClient; this.limiter = limiter; } private IGlobalConfigurationProvider globalConfigurationProvider; private IMemoryCache cache; private async Task<string> GetTokenAsync(CancellationToken cancellationToken) { var cachedApplicationToken = await cache.GetOrCreateAsync<string>("applicationTokenCacheKey", async (entry) => { entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(Constants.ApplicationTokenLifetimeInMinutes - 1); var headerAndPayloadString = GenerateJwtTokenHeaderAndPayload(); var digest = ComputeHeaderAndPayloadDigest(headerAndPayloadString); var encodedSignature = await SignHeaderAndPayloadDigestWithGitHubApplicationKey(digest, cancellationToken); var applicationToken = AppendSignatureToHeaderAndPayload(headerAndPayloadString, encodedSignature); return applicationToken; }); return cachedApplicationToken; } private string AppendSignatureToHeaderAndPayload(string headerAndPayloadString, string encodedSignature) { return $"{headerAndPayloadString}.{encodedSignature}"; } private async Task<string> SignHeaderAndPayloadDigestWithGitHubApplicationKey(byte[] digest, CancellationToken cancellationToken) { var signResult = await cryptographyClient.SignAsync( SignatureAlgorithm.RS256, digest, cancellationToken ); var encodedSignature = Base64UrlEncoder.Encode(signResult.Signature); return encodedSignature; } private byte[] ComputeHeaderAndPayloadDigest(string headerAndPayloadString) { var headerAndPayloadBytes = Encoding.UTF8.GetBytes(headerAndPayloadString); var sha256 = new SHA256CryptoServiceProvider(); var digest = sha256.ComputeHash(headerAndPayloadBytes); return digest; } private string GenerateJwtTokenHeaderAndPayload() { var jwtHeader = new JwtHeader(); jwtHeader["alg"] = "RS256"; var jwtPayload = new JwtPayload( issuer: globalConfigurationProvider.GetApplicationID(), audience: null, claims: null, notBefore: DateTime.UtcNow, expires: DateTime.UtcNow.AddMinutes(Constants.ApplicationTokenLifetimeInMinutes), issuedAt: DateTime.UtcNow ); var jwtToken = new JwtSecurityToken(jwtHeader, jwtPayload); var headerAndPayloadString = $"{jwtToken.EncodedHeader}.{jwtToken.EncodedPayload}"; return headerAndPayloadString; } private CryptographyClient cryptographyClient; private GitHubRateLimiter limiter; public async Task<GitHubClient> GetApplicationClientAsync(CancellationToken cancellationToken) { var token = await GetTokenAsync(cancellationToken); var appClient = new GitHubClient(new ProductHeaderValue(globalConfigurationProvider.GetApplicationName())) { Credentials = new Credentials(token, AuthenticationType.Bearer) }; return appClient; } private ConcurrentDictionary<long, Octokit.AccessToken> cachedInstallationTokens = new ConcurrentDictionary<long, Octokit.AccessToken>(); private async Task<string> GetInstallationTokenAsync(long installationId, CancellationToken cancellationToken) { var installationTokenCacheKey = $"{installationId}_installationTokenCacheKey"; var cachedInstallationToken = await cache.GetOrCreateAsync<Octokit.AccessToken>(installationTokenCacheKey, async (entry) => { var appClient = await GetApplicationClientAsync(cancellationToken); await limiter.WaitForGitHubCapacityAsync(); var installationToken = await appClient.GitHubApps.CreateInstallationToken(installationId); return installationToken; }); return cachedInstallationToken.Token; } public async Task<GitHubClient> GetInstallationClientAsync(long installationId, CancellationToken cancellationToken) { var installationToken = await GetInstallationTokenAsync(installationId, cancellationToken); var installationClient = new GitHubClient(new ProductHeaderValue($"{globalConfigurationProvider.GetApplicationName()}-{installationId}")) { Credentials = new Credentials(installationToken) }; return installationClient; } } }
41.877698
179
0.690088
[ "MIT" ]
AlexGhiondea/azure-sdk-tools
tools/check-enforcer/Azure.Sdk.Tools.CheckEnforcer/Integrations/GitHub/GitHubClientProvider.cs
5,823
C#
using Jil; using System; using System.Net.Http; using System.Threading.Tasks; using Xunit; namespace JsonHttpContentConverter.Jil.Tests { public class JilHttpContentConverterTests { [Fact] public void Constructor_Tests() { Assert.Throws<ArgumentNullException>(() => new JilHttpContentConverter(null)); { var converter = new JilHttpContentConverter(); Assert.NotNull(converter); } { var converter = new JilHttpContentConverter(Options.Default); Assert.NotNull(converter); } } [Fact] public async Task ToHttpContent_Tests() { var converter = new JilHttpContentConverter(); { const int value = 1; var content = converter.ToJsonHttpContent(value); Assert.IsType<StringContent>(content); Assert.Equal(value.ToString(), await content.ReadAsStringAsync()); } { var value = new Foo { Bar = "AAA", Baz = 1 }; var json = JSON.Serialize(value); var content = converter.ToJsonHttpContent(value); Assert.IsType<StringContent>(content); Assert.Equal(json, await content.ReadAsStringAsync()); } } [Fact] public async Task FromHttpContent_Tests() { var converter = new JilHttpContentConverter(); { const int value = 1; var json = value.ToString(); var content = new StringContent(json); var result = await converter.FromJsonHttpContent<int>(content); Assert.Equal(value, result); } { var value = new Foo { Bar = "AAA", Baz = 1 }; var json = JSON.Serialize(value); var content = new StringContent(json); var result = await converter.FromJsonHttpContent<Foo>(content); Assert.Equal(value.Bar, result.Bar); Assert.Equal(value.Baz, result.Baz); } } } public class Foo { public string Bar { get; set; } public int Baz { get; set; } } }
25.080808
90
0.490536
[ "MIT" ]
ttakahari/JsonHttpContentConverter
test/JsonHttpContentConverter.Jil.Tests/JilHttpContentConverterTests.cs
2,485
C#
namespace VinylExchange.Services.Data.HelperServices.Releases { using System; using System.Collections.Generic; using System.Threading.Tasks; using VinylExchange.Data.Models; public interface IReleaseFilesService { Task<List<ReleaseFile>> AddFilesForRelease(Guid? releaseId, Guid formSessionId); Task<TModel> GetReleaseCoverArt<TModel>(Guid? releaseId); Task<List<TModel>> GetReleaseImages<TModel>(Guid? releaseId); Task<List<TModel>> GetReleaseTracks<TModel>(Guid? releaseId); } }
30.333333
88
0.725275
[ "MIT" ]
HeLted/vinyl-exchange
Services/VinylExchange.Services.Data/HelperServices/Releases/IReleaseFilesService.cs
548
C#
using FluentAssertions; using Microsoft.VisualStudio.TestTools.UnitTesting; using Rhinobyte.Extensions.Reflection.IntermediateLanguage; using Rhinobyte.Extensions.Reflection.Tests.Setup; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; using static FluentAssertions.FluentActions; namespace Rhinobyte.Extensions.Reflection.Tests.IntermediateLanguage; [TestClass] public class OpCodeHelperUnitTests { [TestMethod] public void GetOperandSize_should_throw_for_unknown_operand_type_values() { Invoking(() => OpCodeHelper.GetOperandSize((OperandType)250)) .Should() .Throw<System.NotSupportedException>() .WithMessage("OpCodeHelper.GetOperandSize(..) is not supported for an OperandType value of 250"); } [TestMethod] public void LocalVariableOpcodeValues_should_match_the_values_found_using_reflection() { var variableOpcodes = new List<OpCode>(); foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; if (opcode.OperandType == OperandType.InlineVar || opcode.OperandType == OperandType.ShortInlineVar) { variableOpcodes.Add(opcode); } } var localVariableOpcodes = variableOpcodes.Where(opcode => opcode.Name?.Contains("loc") == true).Select(opcode => opcode.Value).ToArray(); OpCodeHelper.LocalVariableOpcodeValues.Should().BeEquivalentTo(localVariableOpcodes); } [TestMethod] public void LongDescriptionLookup_should_contain_entries_for_all_of_the_opcodes_found_using_reflection() { foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; OpCodeHelper.LongDescriptionLookup.ContainsKey(opcode.Value).Should().BeTrue(); } } [TestMethod] public void NameLookup_should_contain_entries_for_all_of_the_opcodes_found_using_reflection() { foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; OpCodeHelper.NameLookup[opcode.Value].Should().Be(opcodeField.Name); } } [TestMethod] public void ShortDescriptionLookup_should_contain_entries_for_all_of_the_opcodes_found_using_reflection() { foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; OpCodeHelper.ShortDescriptionLookup.ContainsKey(opcode.Value).Should().BeTrue(); } } [TestMethod] public void SingleByteOpCodeLookup_should_match_the_values_found_using_reflection() { // Build the array of single byte opcodes using reflection var singleByteOpcodes = new OpCode[256]; foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; if (opcode.Size == 1) { singleByteOpcodes[opcode.Value] = opcode; } } OpCodeHelper.SingleByteOpCodeLookup.Should().BeEquivalentTo(singleByteOpcodes); } [TestMethod] public void TwoByteOpCodeLookup_should_match_the_values_found_using_reflection() { // Build the array of two byte opcodes using reflection var twoByteOpcodes = new OpCode[31]; foreach (var opcodeField in OpCodeTestHelper.OpcodeStaticFields) { var opcode = (OpCode)opcodeField.GetValue(null)!; if (opcode.Size == 1) { continue; } twoByteOpcodes[opcode.Value & 0xff] = opcode; } OpCodeHelper.TwoByteOpCodeLookup.Should().BeEquivalentTo(twoByteOpcodes); } }
31.601852
140
0.783768
[ "MIT" ]
RhinobyteSoftware/DependencyInjectionExtensions
tests/Rhinobyte.Extensions.Reflection.Tests/IntermediateLanguage/OpCodeHelperUnitTests.cs
3,415
C#
using System; using System.Text; using System.Linq; public class MatrixShuffle { public static char[] punctuationSigns = new char[] { ' ', '.', '!', '?', ',', '\'' }; public static void Main() { int n = int.Parse(Console.ReadLine()); var input = Console.ReadLine(); char[,] spiralMatrix = new char[n, n]; int index = 0; int manipulateMoves = 0; int globalCol = 0; int globalRow = 0; while (index < n * n) { for (int col = 0; col < spiralMatrix.GetLength(1) - manipulateMoves; globalCol++, col++, index++) { spiralMatrix[globalRow, globalCol] = input[index]; } manipulateMoves++; for (int row = 0; row < spiralMatrix.GetLength(0) - manipulateMoves; globalRow++, row++, index++) { spiralMatrix[globalRow + 1, globalCol - 1] = input[index]; } globalCol--; for (int col = 0; col < spiralMatrix.GetLength(1) - manipulateMoves; globalCol--, col++, index++) { spiralMatrix[globalRow, globalCol - 1] = input[index]; } manipulateMoves++; for (int row = 0; row < spiralMatrix.GetLength(0) - manipulateMoves; globalRow--, row++, index++) { spiralMatrix[globalRow - 1, globalCol] = input[index]; } globalCol++; } var formedString = new StringBuilder(); ChessboardPattern(formedString, spiralMatrix); if (IsPalindrome(formedString)) { Console.WriteLine($"<div style='background-color:#4FE000'>{formedString.ToString()}</div>"); } else { Console.WriteLine($"<div style='background-color:#E0000F'>{formedString.ToString()}</div>"); } } private static bool IsPalindrome(StringBuilder formedString) { var formedStringWithoutSpaces = RemoveSpaces(formedString); int n = formedStringWithoutSpaces.Length; for (int i = 0; i < (n / 2); ++i) { if (char.ToLower(formedStringWithoutSpaces[i]) != char.ToLower(formedStringWithoutSpaces[n - i - 1])) { return false; } } return true; } private static string RemoveSpaces(StringBuilder formedString) { var stringWithoutSpaces = new StringBuilder(); for (int i = 0; i < formedString.Length; i++) { if (!punctuationSigns.Contains(formedString[i])) { stringWithoutSpaces.Append(formedString[i]); } } return stringWithoutSpaces.ToString(); } private static void ChessboardPattern(StringBuilder formedString, char[,] spiralMatrix) { int manipulateCol = 0; char currentChar = ' '; for (int row = 0; row < spiralMatrix.GetLength(0); row++) { for (int col = manipulateCol; col < spiralMatrix.GetLength(1); col += 2) { currentChar = spiralMatrix[row, col]; if (char.IsLetter(currentChar) || punctuationSigns.Contains(currentChar)) { formedString.Append(currentChar); } } if (manipulateCol == 0) { manipulateCol = 1; } else { manipulateCol = 0; } } manipulateCol = 1; for (int row = 0; row < spiralMatrix.GetLength(0); row++) { for (int col = manipulateCol; col < spiralMatrix.GetLength(1); col += 2) { currentChar = spiralMatrix[row, col]; if (char.IsLetter(currentChar) || punctuationSigns.Contains(currentChar)) { formedString.Append(spiralMatrix[row, col]); } } if (manipulateCol == 0) { manipulateCol = 1; } else { manipulateCol = 0; } } } }
30.188406
113
0.505281
[ "MIT" ]
sevdalin/Software-University-SoftUni
C-sharp-Web-Developer/C# Advanced/Exams/Exam Problems Practice - 21 Problems/14. Matrix Shuffle/MatrixShuffle.cs
4,168
C#
// Copyright (c) 2022 AccelByte Inc. All Rights Reserved. // This is licensed software from AccelByte Inc, for limitations // and restrictions contact your company contract manager. // This code is generated by tool. DO NOT EDIT. using System.Text.Json.Serialization; namespace AccelByte.Sdk.Api.Platform.Model { public class TicketAcquireResult : AccelByte.Sdk.Core.Model { [JsonPropertyName("values")] public List<string>? Values { get; set; } } }
30
64
0.722917
[ "MIT" ]
AccelByte/accelbyte-csharp-sdk
AccelByte.Sdk/Api/Platform/Model/TicketAcquireResult.cs
480
C#
using System.Runtime.CompilerServices; namespace DotNext.Threading; /// <summary> /// Various atomic operations for <see cref="int"/> data type /// accessible as extension methods. /// </summary> /// <remarks> /// Methods exposed by this class provide volatile read/write /// of the field even if it is not declared as volatile field. /// </remarks> /// <seealso cref="Interlocked"/> public static class AtomicInt32 { /// <summary> /// Reads the value of the specified field. On systems that require it, inserts a /// memory barrier that prevents the processor from reordering memory operations /// as follows: If a read or write appears after this method in the code, the processor /// cannot move it before this method. /// </summary> /// <param name="value">The field to read.</param> /// <returns> /// The value that was read. This value is the latest written by any processor in /// the computer, regardless of the number of processors or the state of processor /// cache. /// </returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int VolatileRead(in this int value) => Volatile.Read(ref Unsafe.AsRef(in value)); /// <summary> /// Writes the specified value to the specified field. On systems that require it, /// inserts a memory barrier that prevents the processor from reordering memory operations /// as follows: If a read or write appears before this method in the code, the processor /// cannot move it after this method. /// </summary> /// <param name="value">The field where the value is written.</param> /// <param name="newValue"> /// The value to write. The value is written immediately so that it is visible to /// all processors in the computer. /// </param> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void VolatileWrite(ref this int value, int newValue) => Volatile.Write(ref value, newValue); /// <summary> /// Atomically increments the referenced value by one. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <returns>Incremented value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int IncrementAndGet(ref this int value) => Interlocked.Increment(ref value); /// <summary> /// Atomically decrements the referenced value by one. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <returns>Decremented value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int DecrementAndGet(ref this int value) => Interlocked.Decrement(ref value); /// <summary> /// Atomically sets the referenced value to the given updated value if the current value == the expected value. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="expected">The expected value.</param> /// <param name="update">The new value.</param> /// <returns><see langword="true"/> if successful. <see langword="false"/> return indicates that the actual value was not equal to the expected value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool CompareAndSet(ref this int value, int expected, int update) => Interlocked.CompareExchange(ref value, update, expected) == expected; /// <summary> /// Adds two 32-bit integers and replaces referenced integer with the sum, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be added to the currently stored integer.</param> /// <returns>Result of sum operation.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int AddAndGet(ref this int value, int operand) => Interlocked.Add(ref value, operand); /// <summary> /// Adds two 32-bit integers and replaces referenced integer with the sum, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be added to the currently stored integer.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndAdd(ref this int value, int operand) => Accumulate(ref value, operand, new Adder()).OldValue; /// <summary> /// Bitwise "ands" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndBitwiseAnd(ref this int value, int operand) => Interlocked.And(ref value, operand); /// <summary> /// Bitwise "ands" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The modified value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BitwiseAndAndGet(ref this int value, int operand) => Interlocked.And(ref value, operand) & operand; /// <summary> /// Bitwise "ors" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndBitwiseOr(ref this int value, int operand) => Interlocked.Or(ref value, operand); /// <summary> /// Bitwise "ors" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The modified value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BitwiseOrAndGet(ref this int value, int operand) => Interlocked.Or(ref value, operand) | operand; /// <summary> /// Bitwise "xors" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndBitwiseXor(ref this int value, int operand) => Accumulate(ref value, operand, new BitwiseXor()).OldValue; /// <summary> /// Bitwise "xors" two 32-bit integers and replaces referenced integer with the result, /// as an atomic operation. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="operand">The value to be combined with the currently stored integer.</param> /// <returns>The modified value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BitwiseXorAndGet(ref this int value, int operand) => Accumulate(ref value, operand, new BitwiseXor()).NewValue; /// <summary> /// Modifies the referenced value atomically. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="update">A new value to be stored into managed pointer.</param> /// <returns>Original value before modification.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndSet(ref this int value, int update) => Interlocked.Exchange(ref value, update); /// <summary> /// Modifies the referenced value atomically. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="update">A new value to be stored into managed pointer.</param> /// <returns>A new value passed as argument.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int SetAndGet(ref this int value, int update) { VolatileWrite(ref value, update); return update; } [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static (int OldValue, int NewValue) Update<TUpdater>(ref int value, TUpdater updater) where TUpdater : struct, ISupplier<int, int> { int oldValue, newValue; do { newValue = updater.Invoke(oldValue = VolatileRead(in value)); } while (!CompareAndSet(ref value, oldValue, newValue)); return (oldValue, newValue); } [MethodImpl(MethodImplOptions.AggressiveOptimization)] private static (int OldValue, int NewValue) Accumulate<TAccumulator>(ref int value, int x, TAccumulator accumulator) where TAccumulator : struct, ISupplier<int, int, int> { int oldValue, newValue; do { newValue = accumulator.Invoke(oldValue = VolatileRead(in value), x); } while (!CompareAndSet(ref value, oldValue, newValue)); return (oldValue, newValue); } /// <summary> /// Atomically updates the current value with the results of applying the given function /// to the current and given values, returning the updated value. /// </summary> /// <remarks> /// The function is applied with the current value as its first argument, and the given update as the second argument. /// </remarks> /// <param name="value">Reference to a value to be modified.</param> /// <param name="x">Accumulator operand.</param> /// <param name="accumulator">A side-effect-free function of two arguments.</param> /// <returns>The updated value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int AccumulateAndGet(ref this int value, int x, Func<int, int, int> accumulator) => Accumulate<DelegatingSupplier<int, int, int>>(ref value, x, accumulator).NewValue; /// <summary> /// Atomically updates the current value with the results of applying the given function /// to the current and given values, returning the updated value. /// </summary> /// <remarks> /// The function is applied with the current value as its first argument, and the given update as the second argument. /// </remarks> /// <param name="value">Reference to a value to be modified.</param> /// <param name="x">Accumulator operand.</param> /// <param name="accumulator">A side-effect-free function of two arguments.</param> /// <returns>The updated value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe int AccumulateAndGet(ref this int value, int x, delegate*<int, int, int> accumulator) => Accumulate<Supplier<int, int, int>>(ref value, x, accumulator).NewValue; /// <summary> /// Atomically updates the current value with the results of applying the given function /// to the current and given values, returning the original value. /// </summary> /// <remarks> /// The function is applied with the current value as its first argument, and the given update as the second argument. /// </remarks> /// <param name="value">Reference to a value to be modified.</param> /// <param name="x">Accumulator operand.</param> /// <param name="accumulator">A side-effect-free function of two arguments.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndAccumulate(ref this int value, int x, Func<int, int, int> accumulator) => Accumulate<DelegatingSupplier<int, int, int>>(ref value, x, accumulator).OldValue; /// <summary> /// Atomically updates the current value with the results of applying the given function /// to the current and given values, returning the original value. /// </summary> /// <remarks> /// The function is applied with the current value as its first argument, and the given update as the second argument. /// </remarks> /// <param name="value">Reference to a value to be modified.</param> /// <param name="x">Accumulator operand.</param> /// <param name="accumulator">A side-effect-free function of two arguments.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe int GetAndAccumulate(ref this int value, int x, delegate*<int, int, int> accumulator) => Accumulate<Supplier<int, int, int>>(ref value, x, accumulator).OldValue; /// <summary> /// Atomically updates the stored value with the results /// of applying the given function, returning the updated value. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="updater">A side-effect-free function.</param> /// <returns>The updated value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int UpdateAndGet(ref this int value, Func<int, int> updater) => Update<DelegatingSupplier<int, int>>(ref value, updater).NewValue; /// <summary> /// Atomically updates the stored value with the results /// of applying the given function, returning the updated value. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="updater">A side-effect-free function.</param> /// <returns>The updated value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe int UpdateAndGet(ref this int value, delegate*<int, int> updater) => Update<Supplier<int, int>>(ref value, updater).NewValue; /// <summary> /// Atomically updates the stored value with the results /// of applying the given function, returning the original value. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="updater">A side-effect-free function.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int GetAndUpdate(ref this int value, Func<int, int> updater) => Update<DelegatingSupplier<int, int>>(ref value, updater).OldValue; /// <summary> /// Atomically updates the stored value with the results /// of applying the given function, returning the original value. /// </summary> /// <param name="value">Reference to a value to be modified.</param> /// <param name="updater">A side-effect-free function.</param> /// <returns>The original value.</returns> [MethodImpl(MethodImplOptions.AggressiveInlining)] [CLSCompliant(false)] public static unsafe int GetAndUpdate(ref this int value, delegate*<int, int> updater) => Update<Supplier<int, int>>(ref value, updater).OldValue; }
49.396226
164
0.682073
[ "MIT" ]
dotnet/dotNext
src/DotNext/Threading/AtomicInt32.cs
15,710
C#
// Copyright (c) Converter Systems LLC. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Globalization; namespace RobotApp.Views { /// <summary> /// Converts DateTime from UTC to LocalTime /// </summary> public class UtcToLocalStringConverter : ValueConverter<DateTime, string> { protected override string Convert(DateTime value, object parameter, CultureInfo cultureInfo) { var format = parameter as string; if (format != null) { return value.ToLocalTime().ToString(format, cultureInfo); } return value.ToLocalTime().ToString(cultureInfo); } } }
29.846154
101
0.646907
[ "MIT" ]
SteffenLab/opc-ua-samples
RobotApp/Helpers/UtcToLocalStringConverter.cs
778
C#
// Copyright (c) 2019-2021 Buchelnikov Igor Vladimirovich. All rights reserved // Buchelnikov Igor Vladimirovich licenses this file to you under the MIT license. // The LICENSE file is located at https://github.com/IgorBuchelnikov/ObservableComputations/blob/master/LICENSE using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Linq.Expressions; namespace ObservableComputations { public class TakingWhile<TSourceItem> : Selecting<ZipPair<int, TSourceItem>, TSourceItem>, IHasSources { public override IReadScalar<INotifyCollectionChanged> SourceScalar => _sourceScalarTakingWhile; // ReSharper disable once MemberCanBePrivate.Global public override INotifyCollectionChanged Source => _sourceTakingWhile; // ReSharper disable once MemberCanBePrivate.Global public Expression<Func<TSourceItem, bool>> PredicateExpression => _predicateExpression; public Expression<Func<TSourceItem, int, bool>> IndexedPredicateExpression => _indexedPredicateExpression; public override ReadOnlyCollection<object> Sources => new ReadOnlyCollection<object>(new object[]{Source, SourceScalar}); public override int InitialCapacity => ((IHasInitialCapacity)_source).InitialCapacity; private readonly IReadScalar<INotifyCollectionChanged> _sourceScalarTakingWhile; private readonly INotifyCollectionChanged _sourceTakingWhile; private readonly Expression<Func<TSourceItem, bool>> _predicateExpression; private readonly Expression<Func<TSourceItem, int, bool>> _indexedPredicateExpression; // ReSharper disable once MemberCanBePrivate.Global [ObservableComputationsCall] public TakingWhile( IReadScalar<INotifyCollectionChanged> sourceScalar, Expression<Func<TSourceItem, int, bool>> indexedPredicateExpression, int initialCapacity = 0) : base( getSource(sourceScalar, indexedPredicateExpression, initialCapacity), zipPair => zipPair.RightItem) { _sourceScalarTakingWhile = sourceScalar; _indexedPredicateExpression = indexedPredicateExpression; } [ObservableComputationsCall] public TakingWhile( INotifyCollectionChanged source, Expression<Func<TSourceItem, int, bool>> indexedPredicateExpression, int initialCapacity = 0) : base( getSource(source, indexedPredicateExpression, initialCapacity), zipPair => zipPair.RightItem) { _sourceTakingWhile = source; _indexedPredicateExpression = indexedPredicateExpression; } [ObservableComputationsCall] public TakingWhile( IReadScalar<INotifyCollectionChanged> sourceScalar, Expression<Func<TSourceItem, bool>> predicateExpression, int initialCapacity = 0) : this(sourceScalar, predicateExpression.getIndexedPredicate(), initialCapacity) { _sourceScalarTakingWhile = sourceScalar; _predicateExpression = predicateExpression; } [ObservableComputationsCall] public TakingWhile( INotifyCollectionChanged source, Expression<Func<TSourceItem, bool>> predicateExpression, int initialCapacity = 0) : this(source, predicateExpression.getIndexedPredicate(), initialCapacity) { _sourceTakingWhile = source; _predicateExpression = predicateExpression; } private static INotifyCollectionChanged getSource( IReadScalar<INotifyCollectionChanged> sourceScalar, Expression<Func<TSourceItem, int, bool>> predicateExpression, int initialCapacity) { Expression<Func<ZipPair<int, TSourceItem>, bool>> zipPairNotPredicateExpression = getZipPairNotPredicateExpression(predicateExpression); Computing<int> countComputing = Expr.Is(() => sourceScalar.Value != null ? ((IList) sourceScalar.Value).Count : 0).Computing(); Zipping<int, TSourceItem> zipping = countComputing.SequenceComputing() .Zipping<int, TSourceItem>(sourceScalar); return getFiltering(zipping, zipPairNotPredicateExpression, countComputing, initialCapacity); //return () => (INotifyCollectionChanged)Expr.Is(() => (INotifyCollectionChanged)getSource.Computing().Using(sc => // Expr.Is(() => ((IList)sc.Value).Count).SequenceComputing() // .Zipping<int, TSourceItem>(() => sc.Value)).Value).Computing().Using(zipping => zipping.Value.Filtering<ZipPair<int, TSourceItem>>(zp => zp.ItemLeft < zipping.Value.Filtering(zipPairNotPredicateExpression).Selecting(zp1 => zp1.ItemLeft).Minimazing(() => (((IList)zipping.Value).Count)).Value)).Value; } private static Filtering<ZipPair<int, TSourceItem>> getFiltering( Zipping<int, TSourceItem> zipping, Expression<Func<ZipPair<int, TSourceItem>, bool>> zipPairNotPredicateExpression, Computing<int> countComputing, int initialCapacity) { return zipping.Filtering(zp => zp.LeftItem < zipping .Filtering(zipPairNotPredicateExpression, initialCapacity) .Selecting(zp1 => zp1.LeftItem) .Using(ic => ic.Count > 0 ? ic.Minimazing().Value : countComputing.Value) .Value, initialCapacity); } private static INotifyCollectionChanged getSource( INotifyCollectionChanged source, Expression<Func<TSourceItem, int, bool>> predicateExpression, int initialCapacity) { Expression<Func<ZipPair<int, TSourceItem>, bool>> zipPairNotPredicateExpression = getZipPairNotPredicateExpression(predicateExpression); Computing<int> countComputing = Expr.Is(() => source != null ? ((IList)source).Count : 0).Computing(); Zipping<int, TSourceItem> zipping = countComputing.SequenceComputing() .Zipping<int, TSourceItem>(source); return getFiltering(zipping, zipPairNotPredicateExpression, countComputing, initialCapacity); } private static Expression<Func<ZipPair<int, TSourceItem>, bool>> getZipPairNotPredicateExpression(Expression<Func<TSourceItem, int, bool>> predicateExpression) { ParameterExpression zipPairParameterExpression = Expression.Parameter(typeof(ZipPair<int, TSourceItem>), "zipPair"); Expression zipPairIndexExpression = Expression.PropertyOrField( zipPairParameterExpression, nameof(ZipPair<int, TSourceItem>.LeftItem)); Expression zipPairItemExpression = Expression.PropertyOrField( zipPairParameterExpression, nameof(ZipPair<int, TSourceItem>.RightItem)); ReplaceParameterVisitor replaceParameterVisitor = new ReplaceParameterVisitor( predicateExpression.Parameters, new[] {zipPairItemExpression, zipPairIndexExpression}); Expression<Func<ZipPair<int, TSourceItem>, bool>> zipPairNotPredicateExpression = Expression.Lambda<Func<ZipPair<int, TSourceItem>, bool>>( // ReSharper disable once AssignNullToNotNullAttribute Expression.Not(replaceParameterVisitor.Visit(predicateExpression.Body)), zipPairParameterExpression); return zipPairNotPredicateExpression; } [ExcludeFromCodeCoverage] internal new void ValidateInternalConsistency() { IList<TSourceItem> source = _sourceScalarTakingWhile.getValue(_sourceTakingWhile, new ObservableCollection<TSourceItem>()) as IList<TSourceItem>; OcConsumer ocConsumer = new OcConsumer(); // ReSharper disable once AssignNullToNotNullAttribute if (!this.SequenceEqual(source.TakeWhile((si, i) => new Computing<bool>(_indexedPredicateExpression.ApplyParameters(si, i)).For(ocConsumer).Value))) { throw new ValidateInternalConsistencyException("Consistency violation: TakingWhile.1"); } } } }
43.156977
309
0.780143
[ "MIT" ]
IgorBuchelnikov/ObservableCalculations
src/ObservableComputations/Collections/TakingWhile.cs
7,425
C#
using System; namespace BlueOrigin { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } } }
13.692308
46
0.516854
[ "MIT" ]
A-Manev/SoftUni-CSharp-Advanced-january-2020
CSharp OOP/CSharp OOP - Exams/05. CSharp OOP Exam - 11 Aug 2019/BlueOrigin/StartUp.cs
180
C#
using System; using System.Collections.Generic; using System.Linq; using DFlow.Base; using DFlow.Base.Aggregate; using DFlow.Base.Events; using DFlow.Base.Exceptions; using DFlow.Interfaces; using DFlow.Example.Aggregates; using DFlow.Example.Commands; using DFlow.Example.Events; namespace DFlow.Example.Handlers { public class ProductServiceCommandHandler : Handler { private readonly IEventStore<Guid> _eventStore; private readonly AggregateFactory _factory; public ProductServiceCommandHandler(IEventStore<Guid> eventStore, AggregateFactory factory) : base(eventStore) { _eventStore = eventStore; _factory = factory; } public CommandEvent When(CreateProductCatalog cmd) { var productCatalog = _factory.Create<ProductCatalogAggregate>(cmd.Id); try { _eventStore.AppendToStream<ProductCatalogAggregate>(cmd.Id, productCatalog.Version, productCatalog.Changes, productCatalog.DomainEvents.ToArray()); return new CommandEvent(OperationStatus.Success); } catch (EventStoreConcurrencyException ex) { HandleConcurrencyException(ex, productCatalog); return new CommandEvent(OperationStatus.Success); } catch(Exception) { throw; } } public CommandEvent When(CreateProductCommand cmd) { var productCatalog = _factory.Load<ProductCatalogAggregate>(cmd.RootId); productCatalog.CreateProduct(cmd); try { _eventStore.AppendToStream<ProductCatalogAggregate>(cmd.RootId, productCatalog.Version, productCatalog.Changes, productCatalog.DomainEvents.ToArray()); //_publisher.Publish(arry<IDomainEvent> event) return new CommandEvent(OperationStatus.Success); } catch (EventStoreConcurrencyException ex) { HandleConcurrencyException(ex, productCatalog); return new CommandEvent(OperationStatus.Success); } catch(Exception) { throw; } } public CommandEvent When(ChangeProductNameCommand cmd) { var productCatalog = _factory.Load<ProductCatalogAggregate>(cmd.RootId); productCatalog.ChangeProductName(cmd); try { _eventStore.AppendToStream<ProductCatalogAggregate>(cmd.RootId, productCatalog.Version, productCatalog.Changes, productCatalog.DomainEvents.ToArray()); return new CommandEvent(OperationStatus.Success); } catch (EventStoreConcurrencyException ex) { HandleConcurrencyException(ex, productCatalog); return new CommandEvent(OperationStatus.Success); } catch(Exception) { throw; } } } }
34.115789
103
0.584079
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
roadtoagility/dflow
samples/DFlow.Example/Handlers/ProductServiceCommandHandler.cs
3,241
C#
using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Threading.Tasks; namespace HttpReports.Web.Models { public class HttpReportsConfig { public HttpReportsConfig(IConfiguration configuration) { this.UserName = configuration["HttpReportsConfig:UserName"]; this.Password = configuration["HttpReportsConfig:Password"]; } public string UserName { get; set; } public string Password { get; set; } } }
24.32
75
0.689145
[ "MIT" ]
MoFei12138/HttpReportsWeb
HttpReports.Web/Models/HttpReportsConfig.cs
610
C#
// Copyright Epic Games, Inc. All Rights Reserved. using UnrealBuildTool; public class GGPOUE4 : ModuleRules { public GGPOUE4(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange(new string[] { "Core" }); PrivateDependencyModuleNames.AddRange(new string[] { "CoreUObject", "Engine", "InputCore" }); if (Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Win32) { PublicDefinitions.Add("_WINDOWS"); } else if (Target.Platform == UnrealTargetPlatform.Mac) { PublicDefinitions.Add("MACOS"); } else if (Target.Platform == UnrealTargetPlatform.Linux || Target.Platform == UnrealTargetPlatform.LinuxAArch64) { PublicDefinitions.Add("__GNUC__"); } else if (Target.Platform == UnrealTargetPlatform.PS4) { PublicDefinitions.Add("_PS4"); } else if (Target.Platform == UnrealTargetPlatform.XboxOne) { PublicDefinitions.Add("_XBOX_ONE"); } // Uncomment if you are using Slate UI // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); // Uncomment if you are using online features // PrivateDependencyModuleNames.Add("OnlineSubsystem"); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } }
25.923077
113
0.676558
[ "MIT" ]
erebuswolf/ggpo
Source/GGPOUE4/GGPOUE4.Build.cs
1,685
C#
using System; namespace App.Models.Exceptions.Application { public class DocenteNotFoundException : Exception { public DocenteNotFoundException(string idDocente) : base($"Docente {idDocente} non trovato") { IdDocente = idDocente; } public string IdDocente { get; } } }
23.285714
100
0.647239
[ "MIT" ]
AepServerNet/AspNetCore-CentroFormazione
src/App/Models/Exceptions/Application/DocenteNotFoundException.cs
326
C#
namespace KnapsackProblem { public class Product { public Product(string name, int weigth, int cost) { this.Name = name; this.Weight = weigth; this.Cost = cost; } public string Name { get; private set; } public int Weight { get; private set; } public int Cost { get; private set; } public override string ToString() { return string.Format("Name: {0,7} | Weight: {1,2} | Cost: {2,2}", this.Name, this.Weight, this.Cost); } } }
23.458333
113
0.525755
[ "MIT" ]
danisio/DataStructuresAndAlgorithms-Homeworks
10.DynamicProgramming/01.KnapsackProblem/Product.cs
565
C#
using System; using System.Collections.Generic; using Newtonsoft.Json; using Comformation.IntrinsicFunctions; namespace Comformation.AppIntegrations.EventIntegration { /// <summary> /// AWS::AppIntegrations::EventIntegration EventIntegrationAssociation /// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appintegrations-eventintegration-eventintegrationassociation.html /// </summary> public class EventIntegrationAssociation { /// <summary> /// ClientAssociationMetadata /// The metadata associated with the client. /// Required: No /// Type: List of Metadata /// Update requires: No interruption /// </summary> [JsonProperty("ClientAssociationMetadata")] public List<Metadata> ClientAssociationMetadata { get; set; } /// <summary> /// ClientId /// The identifier for the client that is associated with the event integration. /// Required: No /// Type: String /// Update requires: No interruption /// </summary> [JsonProperty("ClientId")] public Union<string, IntrinsicFunction> ClientId { get; set; } /// <summary> /// EventBridgeRuleName /// The name of the EventBridge rule. /// Required: No /// Type: String /// Update requires: No interruption /// </summary> [JsonProperty("EventBridgeRuleName")] public Union<string, IntrinsicFunction> EventBridgeRuleName { get; set; } /// <summary> /// EventIntegrationAssociationArn /// The Amazon Resource Name (ARN) for the event integration association. /// Required: No /// Type: String /// Update requires: No interruption /// </summary> [JsonProperty("EventIntegrationAssociationArn")] public Union<string, IntrinsicFunction> EventIntegrationAssociationArn { get; set; } /// <summary> /// EventIntegrationAssociationId /// The identifier for the event integration association. /// Required: No /// Type: String /// Update requires: No interruption /// </summary> [JsonProperty("EventIntegrationAssociationId")] public Union<string, IntrinsicFunction> EventIntegrationAssociationId { get; set; } } }
35.432836
151
0.636057
[ "MIT" ]
stanb/Comformation
src/Comformation/Generated/AppIntegrations/EventIntegration/EventIntegrationAssociation.cs
2,374
C#
namespace NGUnityVersioner { public interface ISharedTable { int RegisterString(string content); string FetchString(int index); int RegisterAssembly(AssemblyMeta meta); AssemblyMeta FetchAssembly(int index); int RegisterType(TypeMeta meta); TypeMeta FetchType(int index); int RegisterEvent(EventMeta meta); EventMeta FetchEvent(int index); int RegisterField(FieldMeta meta); FieldMeta FetchField(int index); int RegisterProperty(PropertyMeta meta); PropertyMeta FetchProperty(int index); int RegisterMethod(MethodMeta meta); MethodMeta FetchMethod(int index); } }
24.153846
45
0.743631
[ "MIT" ]
Mikilo/NG-Unity-Versioner
Editor/Misc/ISharedTable.cs
630
C#
using Newtonsoft.Json; using System; using System.Collections.Generic; namespace VkApi.Wrapper.Objects { public class GroupsTokenPermissionSetting { [JsonProperty("name")] public String Name { get; set; } [JsonProperty("setting")] public int Setting { get; set; } } }
22.285714
45
0.657051
[ "MIT" ]
FrediKats/VkLibrary
VkApi.Wrapper/Objects/Groups/GroupsTokenPermissionSetting.cs
312
C#
#region Apache License // // 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. // #endregion using System; #if !NETCF && !NETSTANDARD1_3 using System.Runtime.Serialization; #endif namespace log4net.Util.TypeConverters { /// <summary> /// Exception base type for conversion errors. /// </summary> /// <remarks> /// <para> /// This type extends <see cref="ApplicationException"/>. It /// does not add any new functionality but does differentiate the /// type of exception being thrown. /// </para> /// </remarks> /// <author>Nicko Cadell</author> /// <author>Gert Driesen</author> #if !NETCF [Serializable] #endif #if NETSTANDARD1_3 public class ConversionNotSupportedException : Exception #else public class ConversionNotSupportedException : ApplicationException #endif { #region Public Instance Constructors /// <summary> /// Constructor /// </summary> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ConversionNotSupportedException" /> class. /// </para> /// </remarks> public ConversionNotSupportedException() { } /// <summary> /// Constructor /// </summary> /// <param name="message">A message to include with the exception.</param> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ConversionNotSupportedException" /> class /// with the specified message. /// </para> /// </remarks> public ConversionNotSupportedException(String message) : base(message) { } /// <summary> /// Constructor /// </summary> /// <param name="message">A message to include with the exception.</param> /// <param name="innerException">A nested exception to include.</param> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ConversionNotSupportedException" /> class /// with the specified message and inner exception. /// </para> /// </remarks> public ConversionNotSupportedException(String message, Exception innerException) : base(message, innerException) { } #endregion Public Instance Constructors #region Protected Instance Constructors #if !NETCF && !NETSTANDARD1_3 /// <summary> /// Serialization constructor /// </summary> /// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="ConversionNotSupportedException" /> class /// with serialized data. /// </para> /// </remarks> protected ConversionNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif #endregion Protected Instance Constructors #region Public Static Methods /// <summary> /// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class. /// </summary> /// <param name="destinationType">The conversion destination type.</param> /// <param name="sourceValue">The value to convert.</param> /// <returns>An instance of the <see cref="ConversionNotSupportedException" />.</returns> /// <remarks> /// <para> /// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class. /// </para> /// </remarks> public static ConversionNotSupportedException Create(Type destinationType, object sourceValue) { return Create(destinationType, sourceValue, null); } /// <summary> /// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class. /// </summary> /// <param name="destinationType">The conversion destination type.</param> /// <param name="sourceValue">The value to convert.</param> /// <param name="innerException">A nested exception to include.</param> /// <returns>An instance of the <see cref="ConversionNotSupportedException" />.</returns> /// <remarks> /// <para> /// Creates a new instance of the <see cref="ConversionNotSupportedException" /> class. /// </para> /// </remarks> public static ConversionNotSupportedException Create(Type destinationType, object sourceValue, Exception innerException) { if (sourceValue == null) { return new ConversionNotSupportedException("Cannot convert value [null] to type ["+destinationType+"]", innerException); } else { return new ConversionNotSupportedException("Cannot convert from type ["+sourceValue.GetType()+"] value ["+sourceValue+"] to type ["+destinationType+"]", innerException); } } #endregion Public Static Methods } }
33.836478
173
0.70632
[ "Apache-2.0" ]
kyllix/logging-log4net
src/log4net/Util/TypeConverters/ConversionNotSupportedException.cs
5,380
C#
using System; using Mono.Linker.Tests.Cases.Expectations.Assertions; namespace Mono.Linker.Tests.Cases.Attributes { [Foo (Val = typeof (A))] [KeptAttributeAttribute (typeof (FooAttribute))] class AttributeOnPreservedTypeWithTypeUsedInFieldIsKept { public static void Main () { } [KeptMember (".ctor()")] [KeptBaseType (typeof (System.Attribute))] class FooAttribute : Attribute { [Kept] public Type Val; } [Kept] class A { public A () { } } } }
16.4
56
0.672764
[ "MIT" ]
AlexanderSemenyak/linker
test/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs
494
C#
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // Ogólne informacje o zestawie są kontrolowane poprzez następujący // zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje // powiązane z zestawem. [assembly: AssemblyTitle("AdiSample")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AdiSample")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne // dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z // COM, ustaw wartość true dla atrybutu ComVisible tego typu. [assembly: ComVisible(false)] //Aby rozpocząć kompilację aplikacji możliwych do zlokalizowania, ustaw //<UICulture>Kultura_używana_podczas_kodowania</UICulture> w pliku csproj //w grupie <PropertyGroup>. Jeśli na przykład jest używany język angielski (USA) //w plikach źródłowych ustaw dla elementu <UICulture> wartość en-US. Następnie usuń komentarz dla //poniższego atrybutu NeutralResourceLanguage. Zaktualizuj wartość „en-US” w //poniższej linii tak, aby dopasować ustawienie UICulture w pliku projektu. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //gdzie znajdują się słowniki zasobów specyficznych dla motywów //(używane, jeśli nie można odnaleźć zasobu na stronie, // lub słowniki zasobów aplikacji) ResourceDictionaryLocation.SourceAssembly //gdzie znajduje się słownik zasobów ogólnych //(używane, jeśli nie można odnaleźć zasobu na stronie, // aplikacji lub słowników zasobów specyficznych dla motywów) )] // Informacje o wersji zestawu zawierają następujące cztery wartości: // // Wersja główna // Wersja pomocnicza // Numer kompilacji // Poprawka // // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki // przy użyciu symbolu „*”, tak jak pokazano poniżej: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
45.5
108
0.714286
[ "MIT" ]
edenlandpl/SampleWPF
Properties/AssemblyInfo.cs
2,641
C#
using System; using Windows.Foundation; using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Shapes; namespace Neumann.TouchControls { public class Arrow : ContentControl { #region Private Fields private Path _path; #endregion #region Constructors public Arrow() { _path = new Path() { VerticalAlignment = VerticalAlignment.Center }; this.Content = _path; _path.Fill = new SolidColorBrush(Colors.Gray); this.SizeChanged += OnSizeChanged; this.RegisterPropertyChangedCallback( Arrow.BackgroundProperty, new DependencyPropertyChangedCallback((d, p) => _path.Fill = this.Background)); this.RegisterPropertyChangedCallback( Arrow.BorderBrushProperty, new DependencyPropertyChangedCallback((d, p) => _path.Stroke = this.BorderBrush)); this.RegisterPropertyChangedCallback( Arrow.BorderThicknessProperty, new DependencyPropertyChangedCallback((d, p) => _path.StrokeThickness = this.BorderThickness.Left)); this.RegisterPropertyChangedCallback( Arrow.OpacityProperty, new DependencyPropertyChangedCallback((d, p) => this.UpdateLayout())); this.RegisterPropertyChangedCallback( Arrow.VisibilityProperty, new DependencyPropertyChangedCallback((d, p) => this.UpdateLayout())); } #endregion #region Properties #region ArrowLength public double ArrowLength { get { return (double)GetValue(ArrowLengthProperty); } set { SetValue(ArrowLengthProperty, value); } } public static readonly DependencyProperty ArrowLengthProperty = DependencyProperty.Register("ArrowLength", typeof(double), typeof(Arrow), new PropertyMetadata(20d, OnArrowLengthPropertyChanged)); private static void OnArrowLengthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var element = d as Arrow; element.UpdatePath(element.DesiredSize); } #endregion #endregion #region Private Methods private void UpdatePath(Size size) { size = new Size(size.Width - (this.BorderThickness.Left * 1), size.Height - (this.BorderThickness.Top * 1)); var strokeOffset = Math.Max(0, _path.StrokeThickness / 2); var triangleWidth = this.ArrowLength; var triangleCenterY = size.Height / 2; var rectWidth = size.Width - triangleWidth; var triangleStartX = rectWidth; var figure = new PathFigure { StartPoint = new Point(strokeOffset, strokeOffset), IsClosed = true }; var recLine1 = new LineSegment(); recLine1.Point = new Point(rectWidth, strokeOffset); figure.Segments.Add(recLine1); var triangleLine1 = new LineSegment(); triangleLine1.Point = new Point(triangleStartX + triangleWidth, triangleCenterY); figure.Segments.Add(triangleLine1); var triangleLine2 = new LineSegment(); triangleLine2.Point = new Point(triangleStartX, size.Height); figure.Segments.Add(triangleLine2); var recLine2 = new LineSegment(); recLine2.Point = new Point(strokeOffset, size.Height); figure.Segments.Add(recLine2); var recLine3 = new LineSegment(); recLine3.Point = new Point(strokeOffset, strokeOffset); figure.Segments.Add(recLine3); _path.Data = new PathGeometry { Figures = new PathFigureCollection { figure } }; this.UpdateLayout(); } #endregion #region Event Handling private void OnSizeChanged(object sender, SizeChangedEventArgs e) { this.UpdatePath(e.NewSize); } #endregion } }
33.637097
147
0.614481
[ "MIT" ]
JoergNeumann/TouchControls
Neumann.TouchControls/Arrow.cs
4,173
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace GroupDocs.Merger.Live.Demos.UI { public partial class Default { /// <summary> /// UpdatePanel1 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.UpdatePanel UpdatePanel1; /// <summary> /// hheading control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl hheading; /// <summary> /// hdescription control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl hdescription; /// <summary> /// ConvertPlaceHolder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.PlaceHolder ConvertPlaceHolder; /// <summary> /// pMessage control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl pMessage; /// <summary> /// hfToFormat control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.HiddenField hfToFormat; /// <summary> /// FileDropPlaceHolder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.PlaceHolder FileDropPlaceHolder; /// <summary> /// UploadFile control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputFile UploadFile; /// <summary> /// ValidateFileType control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.RegularExpressionValidator ValidateFileType; /// <summary> /// PreviewPlaceHolder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.PlaceHolder PreviewPlaceHolder; /// <summary> /// divPreview control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl divPreview; /// <summary> /// fileupload control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputFile fileupload; /// <summary> /// btnUpload2 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Button btnUpload2; /// <summary> /// btnMerge control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Button btnMerge; /// <summary> /// txtSortOrder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputHidden txtSortOrder; /// <summary> /// txtFolderId control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputHidden txtFolderId; /// <summary> /// txtFileName control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputHidden txtFileName; /// <summary> /// txtDivCount control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputHidden txtDivCount; /// <summary> /// btnUpload control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Button btnUpload; /// <summary> /// UpdateProgress1 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.UpdateProgress UpdateProgress1; /// <summary> /// DownloadPlaceHolder control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.PlaceHolder DownloadPlaceHolder; /// <summary> /// litDownloadNow control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.Literal litDownloadNow; /// <summary> /// emailTo control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputGenericControl emailTo; /// <summary> /// downloadUrl control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlInputHidden downloadUrl; /// <summary> /// btnSend control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.WebControls.LinkButton btnSend; /// <summary> /// UpdateProgress2 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.UpdateProgress UpdateProgress2; /// <summary> /// pMessage2 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl pMessage2; /// <summary> /// dvAllFormats control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvAllFormats; /// <summary> /// dvFormatSection control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl dvFormatSection; /// <summary> /// hExtension1 control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl hExtension1; /// <summary> /// hExtension1Description control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlGenericControl hExtension1Description; /// <summary> /// aPoweredBy control. /// </summary> /// <remarks> /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// </remarks> protected global::System.Web.UI.HtmlControls.HtmlAnchor aPoweredBy; } }
36.542763
96
0.558646
[ "MIT" ]
groupdocs-merger/GroupDocs.Merger-for-.NET
Demos/LiveDemos/src/GroupDocs.Merger.Live.Demos.UI/Default.aspx.designer.cs
11,111
C#
namespace UrbanSketchers { /// <summary> /// App Constants /// </summary> public static class Constants { /// <summary> /// Azure Mobile App application URL /// </summary> public static string ApplicationUrl = @"https://urbansketchers.azurewebsites.net"; } }
24.846154
90
0.569659
[ "MIT" ]
mscherotter/UrbanSketchers
UrbanSketchers/UrbanSketchers/Constants.cs
325
C#
using clubweb.shared.interfaces; using System; using System.Collections.Generic; using System.Text; namespace clubweb.shared.models.user { public class UserRepository : IUserRepository { List<userModel> _users; public UserRepository() { _users = new List<userModel>(); // for testing seedData(); } private void seedData() { var u = new userModel(); u.FirstName = "Steve"; u.LastName = "Fabian"; u.Email = "sfabian@gooddogs.com"; AddUser(u); } public userModel AddUser(userModel user) { int nxtId = _users.Count > 0 ? _users[_users.Count - 1].Id + 1 : 1; user.Id = nxtId; _users.Add(user); return user; } public bool DeleteUser(int id) { var result =_users.RemoveAll(x => x.Id == id); return result > 0; } public bool DeleteUser(userModel user) { return _users.Remove(user); } public userModel GetUserById(int id) { return _users.Find(x => x.Id == id); } public IEnumerable<userModel> GetUsers(userModel criteria) { return _users; } public userModel UpdateUser(userModel user) { var u = _users.FindIndex(x => x.Id == user.Id); if (u != -1) { _users[u] = user; return user; } return null; } } }
22.71831
79
0.485431
[ "MIT" ]
stevefabian/N3UG.ClubWeb
clubweb.server/Repositories/user/UserRepository.cs
1,615
C#
using System.Threading.Tasks; namespace Essensoft.AspNetCore.Payment.WeChatPay { public interface IWeChatPayClient { /// <summary> /// 执行 WeChatPay API请求。 /// </summary> /// <param name="request">具体的WeChatPay API请求</param> /// <param name="options">配置选项</param> /// <returns>领域对象</returns> Task<T> ExecuteAsync<T>(IWeChatPayRequest<T> request, WeChatPayOptions options) where T : WeChatPayResponse; /// <summary> /// 执行 WeChatPay API请求。 /// </summary> /// <param name="request">具体的WeChatPay API请求</param> /// <param name="options">配置选项</param> /// <returns>领域对象</returns> Task<T> PageExecuteAsync<T>(IWeChatPayRequest<T> request, WeChatPayOptions options) where T : WeChatPayResponse; /// <summary> /// 执行 WeChatPay API证书请求。 /// </summary> /// <param name="request">具体的WeChatPay API证书请求</param> /// <param name="options">配置选项</param> /// <returns>领域对象</returns> Task<T> ExecuteAsync<T>(IWeChatPayCertRequest<T> request, WeChatPayOptions options) where T : WeChatPayResponse; /// <summary> /// 执行 WeChatPay Sdk请求。 /// </summary> /// <param name="request">具体的WeChatPay Sdk请求</param> /// <param name="options">配置选项</param> Task<WeChatPayDictionary> ExecuteAsync(IWeChatPaySdkRequest request, WeChatPayOptions options); } }
37.25641
120
0.612526
[ "MIT" ]
ekolios/payment
src/Essensoft.AspNetCore.Payment.WeChatPay/IWeChatPayClient.cs
1,599
C#
using ServerMonitor.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.Mvc; using Humanizer; namespace ServerMonitor.Web.Controllers.Base { public abstract class RepositoryControllerBase : Controller { private ICacheRepository _Repository; /// <summary> /// Gets the repository to access data on the server. /// </summary> public ICacheRepository Repository { get { return _Repository; } } /// <summary> /// Initializes a new instance of the <see cref="RepositoryControllerBase"/> class. /// </summary> /// <param name="repository"> /// The repository to access data on the server. /// </param> public RepositoryControllerBase(ICacheRepository repository) : base() { this._Repository = repository; } protected void ProcessException(Exception ex) { //Do something useful with the exception } /// <summary> /// This is a helper method to work out a sensible string from a RepositoryResult /// </summary> internal string ResolveStatusCodeMessage(IRepositoryResult result) { // the load failed - report this to the user if (result.StatusCode == RepositoryStatusCode.UnknownError) { // this is a special case, if we have the exception, return it if (result.HasException) { return result.Exception.Message; } else { return result.StatusCode.ToString().Humanize(); } } else { return result.StatusCode.ToString().Humanize(); } } } }
29.19697
91
0.552673
[ "MIT" ]
RedgumTechnologies/servermonitor
ServerMonitor.Web/Controllers/Base/RepositoryControllerBase.cs
1,929
C#
// Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information using Elastic.Elasticsearch.Xunit.XunitPlumbing; using Nest; using System.ComponentModel; namespace Examples.Cat { public class IndicesPage : ExampleBase { [U(Skip = "Example not implemented")] [Description("cat/indices.asciidoc:94")] public void Line94() { // tag::073539a7e38be3cdf13008330b6a536a[] var response0 = new SearchResponse<object>(); // end::073539a7e38be3cdf13008330b6a536a[] response0.MatchesExample(@"GET /_cat/indices/twi*?v&s=index"); } } }
27.68
76
0.742775
[ "Apache-2.0" ]
JTOne123/elasticsearch-net
tests/Examples/Cat/IndicesPage.cs
692
C#
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace KnowledgeBase.Areas.Admin { [Area("admin")] public class HomeController : Controller { public IActionResult Index() { return View(); } } }
17.894737
44
0.638235
[ "MIT" ]
lic0914/KnowledgeBase
KnowledgeBase/Areas/Admin/Controllers/HomeController.cs
342
C#
using SharpDX; using SharpDX.Direct3D; using SharpDX.Direct3D11; using SharpDX.DXGI; //using _sc_core_systems.SC_Graphics.SC_Textures.SC_VR_Touch_Textures; using System.Linq; using System; using Jitter.Collision; using Jitter; using Jitter.Dynamics; using Jitter.DataStructures; using Jitter.Collision.Shapes; using System.Runtime.InteropServices; using _sc_core_systems.SC_Graphics; namespace _sc_core_systems.SC_Graphics { public class SC_modL_rght_upper_arm : ITransform, IComponent { public ITransform transform { get; private set; } IComponent ITransform.Component { get => component; } IComponent component; RigidBody IComponent.rigidbody { get; set; } SoftBody IComponent.softbody { get; set; } public Matrix _POSITION { get; set; } public float RotationY { get; set; } public float RotationX { get; set; } public float RotationZ { get; set; } /*struct Spatial { vec4 pos, rot; }; //rotate */ /*Vector3 qrot(Vector4 q, Vector3 v) { return v + 2.0f * Vector3.Cross(new Vector3(q.X,q.Y,q.Z), Vector3.Cross(new Vector3(q.X, q.Y, q.Z), v) + q.W * v); }*/ /*Vector3 rotate_vertex_position(Vector3 position, Vector3 axis, float angle) { Vector4 q = quat_from_axis_angle(axis, angle); Vector3 v = position.xyz; return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); }*/ // Properties private SharpDX.Direct3D11.Buffer VertexBuffer { get; set; } private SharpDX.Direct3D11.Buffer IndexBuffer { get; set; } private int VertexCount { get; set; } public int IndexCount { get; set; } private float _touchSize = 1f; //public SharpDX.Vector3 Position { get; set; } public SharpDX.Quaternion Rotation { get; set; } public SharpDX.Vector3 Forward { get; set; } public DVertex[] Vertices { get; set; } /*[StructLayout(LayoutKind.Sequential)] public struct DVertex { public static int AppendAlignedElement = 12; public Vector3 position; public Vector4 color; public Vector3 normal; }*/ [StructLayout(LayoutKind.Sequential)] public struct DVertex { public Vector3 position; public Vector2 texture; public Vector4 color; public Vector3 normal; }; [StructLayout(LayoutKind.Sequential)] public struct DMatrixBuffer { public Matrix world; public Matrix view; public Matrix projection; } [StructLayout(LayoutKind.Sequential)] public struct DInstanceType { public Vector4 position; }; [StructLayout(LayoutKind.Sequential)] public struct DInstanceData { public Vector4 rotation; } [StructLayout(LayoutKind.Sequential)] public struct DInstanceDataMatrixRotter { //public Matrix rotationMatrix; public Vector4 instanceRot0; public Vector4 instanceRot1; public Vector4 instanceRot2; public Vector4 instanceRot3; } public int InstanceCount { get; private set; } public SharpDX.Direct3D11.Buffer InstanceBuffer { get; set; } public SharpDX.Direct3D11.Buffer InstanceRotationBuffer { get; set; } public SharpDX.Direct3D11.Buffer InstanceRotationBufferRIGHT { get; set; } public SharpDX.Direct3D11.Buffer InstanceRotationBufferUP { get; set; } public SharpDX.Direct3D11.Buffer InstanceRotationMatrixBuffer { get; set; } float _tileSize = 0; int _divX; int _divY; float _a; float _r; float _g; float _b; // Variables private int m_TerrainWidth, m_TerrainHeight; public Vector4 _color; //LIGHTS [StructLayout(LayoutKind.Explicit)] public struct DLightBuffer { [FieldOffset(0)] public Vector4 ambientColor; //16 [FieldOffset(16)] public Vector4 diffuseColor; //16 [FieldOffset(32)] public Vector3 lightDirection; //12 [FieldOffset(44)] public float padding0; [FieldOffset(48)] public Vector3 lightPosition; //12 [FieldOffset(60)] public float padding1; } //[FieldOffset(44)] //public Vector3 lightPosition; DLightBuffer[] _DLightBuffer = new DLightBuffer[1]; SC_cube_instances[] _arrayOfInstances;// = new SC_cube_instances[]; public DInstanceType[] instances; public DInstanceData[] instancesData; public DInstanceDataMatrixRotter[] instancesDataRotter; public int _instX; public int _instY; public int _instZ; public Matrix _ORIGINPOSITION { get; set; } public SC_cube_instances _singleObjectOnly;// = new SC_cube_instances(); public SC_sdr_upper_right_arm _this_object_texture_shader { get; set; } //public Vector3 _y_top_pivot; //public Vector3 _y_bottom_pivot; public float _total_torso_height = -1; public float _total_torso_depth = -1; public float _total_torso_width = -1; //int _isTerrain; // Constructor public SC_modL_rght_upper_arm() { } public bool Initialize(SC_console_directx D3D, int width, int height, float tileSize, int divX, int divY, float _sizeX, float _sizeY, float _sizeZ, Vector4 color, int instX, int instY, int instZ, IntPtr windowsHandle, Matrix matroxer, int isTerrain, float offsetPosX, float offsetPosY, float offsetPosZ, float offsetVertX, float offsetVertY, float offsetVertZ) { _ORIGINPOSITION = matroxer; _POSITION = matroxer; transform = this; component = this; //_isTerrain = isTerrain; this._color = color; this._sizeX = _sizeX; this._sizeY = _sizeY; this._sizeZ = _sizeZ; _tileSize = tileSize; // Manually set the width and height of the terrain. m_TerrainWidth = width; m_TerrainHeight = height; this._divX = divX; this._divY = divY; this._a = color.W; this._r = color.X; this._g = color.Y; this._b = color.Z; this._instX = instX; this._instX = instY; this._instX = instZ; // Initialize the vertex and index buffer that hold the geometry for the terrain. if (!InitializeBuffer(D3D, _sizeX, _sizeY, _sizeZ, tileSize, instX, instY, instZ, windowsHandle, matroxer, isTerrain, offsetPosX, offsetPosY, offsetPosZ, offsetVertX, offsetVertY, offsetVertZ)) return false; return true; } SharpDX.Direct3D11.Buffer ConstantLightBuffer; /*public bool _initTexture(SharpDX.Direct3D11.Device device, IntPtr windowsHandle) { Vector4 ambientColor = new Vector4(0.15f, 0.15f, 0.15f, 1.0f); Vector4 diffuseColour = new Vector4(1, 1, 1, 1); Vector3 lightDirection = new Vector3(1, 0, 0); Vector3 lightPosition = new Vector3(0, 0, 0); _DLightBuffer[0] = new DLightBuffer() { ambientColor = ambientColor, diffuseColor = diffuseColour, lightDirection = lightDirection, padding0 = 0, lightPosition = lightPosition, padding1 = 0 }; _this_object_texture_shader = new SC_sdr_upper_right_arm(); BufferDescription lightBufferDesc = new BufferDescription() { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<DLightBuffer>(), BindFlags = BindFlags.ConstantBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }; ConstantLightBuffer = new SharpDX.Direct3D11.Buffer(device, lightBufferDesc); _this_object_texture_shader.Initialize(device, windowsHandle, ConstantLightBuffer, _DLightBuffer); // Initialize the texture shader object. if (!_this_object_texture_shader.Initialize(device, windowsHandle, ConstantLightBuffer, _DLightBuffer)) { return false; } return true; }*/ /*public bool RenderInstancedObject(DeviceContext deviceContext, int VertexCount, int InstanceCount, Matrix worldMatrix, Matrix viewMatrix, Matrix projectionMatrix, ShaderResourceView texture, Matrix[] worldMatrix_instances, DLightBuffer[] _DLightBuffer_, Vector3 oculusRiftDir) { /*Vector4 ambientColor = new Vector4(0.15f, 0.15f, 0.15f, 1.0f); Vector4 diffuseColour = new Vector4(1, 1, 1, 1); Vector3 lightDirection = new Vector3(1, 0, 0); _DLightBuffer[0] = new DLightBuffer() { ambientColor = ambientColor, diffuseColor = diffuseColour, lightDirection = lightDirection, padding = 0 }; // Render the model using the texture shader. _this_object_texture_shader.Render(deviceContext, VertexCount, InstanceCount, worldMatrix, viewMatrix, projectionMatrix, texture, instances, instancesData, instancesDataRotter, InstanceBuffer, InstanceRotationBuffer, InstanceRotationMatrixBuffer, worldMatrix_instances, _instX, _instY, _instZ, _DLightBuffer_, oculusRiftDir, InstanceRotationBufferRIGHT, InstanceRotationBufferUP); return true; }*/ private float _sizeX = 0; private float _sizeY = 0; private float _sizeZ = 0; public void ShutDown() { // Release the vertex and index buffers. ShutDownBuffers(); } private bool InitializeBuffer(SC_console_directx D3D, float _sizeX, float _sizeY, float _sizeZ, float tileSize, int instX, int instY, int instZ, IntPtr windowsHandle, Matrix matroxer, int isTerrain, float offsetPosX, float offsetPosY, float offsetPosZ, float offsetVertX, float offsetVertY, float offsetVertZ) { try { int sizeWidther = (int)(m_TerrainWidth * 0.5f); int sizeHeighter = (int)(m_TerrainHeight * 0.5f); sizeWidther /= 10; sizeHeighter /= 10; // Set number of vertices in the vertex array. //VertexCount = 8; // Set number of vertices in the index array. //IndexCount = 36; // Create the vertex array and load it with data. var someOffsetPos = new Vector3(offsetPosX, offsetPosY, offsetPosZ); Vertices = new[] { //TOP new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 1), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 1), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)), normal = new Vector3(0, 1, 1), color = _color, }, //BOTTOM new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 1), color = _color, }, //FACE NEAR new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 0, 0), color = _color, }, //FACE FAR new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)), normal = new Vector3(0, 1, 0), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 1, 0), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)), normal = new Vector3(0, 1, 0), color = _color, }, //FACE LEFT new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)), normal = new Vector3(0, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)), normal = new Vector3(0, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) - (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 0, 1), color = _color, }, new DVertex() { position = new Vector3(-(1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(0, 0, 1), color = _color, }, //FACE RIGHT new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), (1*_sizeY) + (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), (1*_sizeZ) + (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, new DVertex() { position = new Vector3((1*_sizeX) + (offsetVertX * _sizeX), -(1*_sizeY) - (offsetVertY * _sizeY), -(1*_sizeZ) - (offsetVertZ * _sizeZ)) , normal = new Vector3(1, 1, 0), color = _color, }, }; Vector3[] sorterList = new Vector3[Vertices.Length]; for (int i = 0; i < Vertices.Length; i++) { sorterList[i] = Vertices[i].position; } var lowestX = sorterList.OrderBy(x => x.X).FirstOrDefault(); var highestX = sorterList.OrderBy(x => x.X).Last(); var lowestY = sorterList.OrderBy(y => y.X).FirstOrDefault(); var highestY = sorterList.OrderBy(y => y.X).Last(); var lowestZ = sorterList.OrderBy(z => z.X).FirstOrDefault(); var highestZ = sorterList.OrderBy(z => z.X).Last(); //_total_torso_width = highestX.X - lowestX.X; //_total_torso_height = highestY.Y - lowestY.Y; //_total_torso_depth = highestZ.Z - lowestZ.Z; //_y_top_pivot = highestY; //_y_bottom_pivot = lowestY; _total_torso_width = ((1 * _sizeX) + (offsetVertX * _sizeX) * 2); _total_torso_height = ((1 * _sizeY) + (offsetVertY * _sizeY) * 2); _total_torso_depth = ((1 * _sizeZ) + (offsetVertZ * _sizeZ) * 2); int[] triangles = new int[] { 5,4,3,2,1,0, 11,10,9,8,7,6, 17,16,15,14,13,12, 23,22,21,20,19,18, 29,28,27,26,25,24, 35,34,33,32,31,30, }; int count = 0; IndexCount = triangles.Length; VertexCount = Vertices.Length; instancesDataRotter = new DInstanceDataMatrixRotter[instX * instY * instZ]; instancesData = new DInstanceData[instX * instY * instZ]; instances = new DInstanceType[instX * instY * instZ]; _arrayOfInstances = new SC_cube_instances[instX * instY * instZ]; count = 0; for (int x = 0; x < instX; x++) { for (int y = 0; y < instY; y++) { for (int z = 0; z < instZ; z++) { Vector3 position = new Vector3(x * offsetPosX, y * offsetPosY, z * offsetPosZ); Matrix _tempMatrix = matroxer; position.X += matroxer.M41; position.Y += matroxer.M42; position.Z += matroxer.M43; instances[count] = new DInstanceType() { position = new Vector4(position.X, position.Y, position.Z, 1) }; instancesData[count] = new DInstanceData() { rotation = new Vector4(0, 0, 0, 1) }; _tempMatrix.M41 = position.X; _tempMatrix.M42 = position.Y; _tempMatrix.M43 = position.Z; SC_cube_instances _cube = new SC_cube_instances(); _cube.transform.Component.rigidbody = new RigidBody(new BoxShape(_sizeX * 2, _sizeY * 2, _sizeZ * 2)); _cube.transform.Component.rigidbody.Position = new Jitter.LinearMath.JVector(_tempMatrix.M41, _tempMatrix.M42, _tempMatrix.M43); _cube.transform.Component.rigidbody.Orientation = Conversion.ToJitterMatrix(_tempMatrix); _cube.transform.Component.rigidbody.LinearVelocity = new Jitter.LinearMath.JVector(0, 0, 0); _cube.transform.Component.rigidbody.IsStatic = true; _cube.transform.Component.rigidbody.Tag = SC_console_directx.BodyTag.PlayerTorso; _cube.transform.Component.rigidbody.Material.Restitution = 0.25f; _cube.transform.Component.rigidbody.Material.StaticFriction = 0.45f; //_cube.transform.Component.rigidbody.Material.KineticFriction = 0.45f; _cube.transform.Component.rigidbody.Mass = 100; SC_Console_GRAPHICS.World.AddBody(_cube.transform.Component.rigidbody); //_cube._POSITION = _tempMatrix; _singleObjectOnly = _cube; } } } InstanceCount = instances.Length; // Create the vertex buffer. VertexBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, Vertices); IndexBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.IndexBuffer, triangles); // Create the Instance instead of an Index Buffer. InstanceBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, instances); InstanceRotationBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, instancesData); InstanceRotationBufferRIGHT = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, instancesData); InstanceRotationBufferUP = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, instancesData); InstanceRotationMatrixBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, instancesData); //SC_Console_GRAPHICS.MessageBox((IntPtr)0, InstanceBuffer.Description.Usage + "", "Oculus Error", 0); // Setup the description of the dynamic matrix constant Matrix buffer that is in the vertex shader. BufferDescription matrixBufferDescription = new BufferDescription() { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<DInstanceType>() * instances.Length, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }; // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. InstanceBuffer = new SharpDX.Direct3D11.Buffer(D3D.device, matrixBufferDescription); matrixBufferDescription = new BufferDescription() { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<DInstanceData>() * instancesData.Length, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }; // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. InstanceRotationBuffer = new SharpDX.Direct3D11.Buffer(D3D.device, matrixBufferDescription); matrixBufferDescription = new BufferDescription() { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<DInstanceData>() * instancesData.Length, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }; // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. InstanceRotationBufferRIGHT = new SharpDX.Direct3D11.Buffer(D3D.device, matrixBufferDescription); matrixBufferDescription = new BufferDescription() { Usage = ResourceUsage.Dynamic, SizeInBytes = Utilities.SizeOf<DInstanceData>() * instancesData.Length, BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.Write, OptionFlags = ResourceOptionFlags.None, StructureByteStride = 0 }; // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. InstanceRotationBufferUP = new SharpDX.Direct3D11.Buffer(D3D.device, matrixBufferDescription); //_initTexture(D3D.device, windowsHandle); // Create the vertex buffer. //VertexBuffer = SharpDX.Direct3D11.Buffer.Create(D3D.device, BindFlags.VertexBuffer, Vertices); // Delete arrays now that they are in their respective vertex and index buffers. //Vertices = null; //indices = null; // Set the vertex buffer to active in the input assembler so it can be rendered. //device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<SC_Desk_Screen_Shader.DVertex>(), 0)); // Set the index buffer to active in the input assembler so it can be rendered. //device.ImmediateContext.InputAssembler.SetIndexBuffer(IndexBuffer, SharpDX.DXGI.Format.R32_UInt, 0); // Set the type of the primitive that should be rendered from this vertex buffer, in this case triangles. //device.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; return true; } catch { return false; } } private void ShutDownBuffers() { // Release the index buffer. IndexBuffer?.Dispose(); IndexBuffer = null; // Release the vertex buffer. VertexBuffer?.Dispose(); VertexBuffer = null; } public void Render(DeviceContext deviceContext) { // Put the vertex and index buffers on the graphics pipeline to prepare for drawings. RenderBuffers(deviceContext); } private void RenderBuffers(DeviceContext deviceContext) { deviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<DVertex>(), 0)); //, new VertexBufferBinding(InstanceBuffer, Utilities.SizeOf<DInstanceType>(), 0) ////// , new VertexBufferBinding(InstanceBuffer, Utilities.SizeOf<DInstanceType>(), 0), new VertexBufferBinding(InstanceRotationBuffer, Utilities.SizeOf<DInstanceData>(), 0) //deviceContext.InputAssembler.SetVertexBuffers(1, new VertexBufferBinding(InstanceBuffer, Utilities.SizeOf<DInstanceType>(), 0)); deviceContext.InputAssembler.SetVertexBuffers(1, new[] { new VertexBufferBinding(InstanceBuffer, Marshal.SizeOf(typeof(DInstanceType)),0), }); deviceContext.InputAssembler.SetVertexBuffers(2, new[] { new VertexBufferBinding(InstanceRotationBuffer, Marshal.SizeOf(typeof(DInstanceData)),0), }); deviceContext.InputAssembler.SetVertexBuffers(3, new[] { new VertexBufferBinding(InstanceRotationBufferRIGHT, Marshal.SizeOf(typeof(DInstanceData)),0), }); deviceContext.InputAssembler.SetVertexBuffers(4, new[] { new VertexBufferBinding(InstanceRotationBufferUP, Marshal.SizeOf(typeof(DInstanceData)),0), }); /*deviceContext.InputAssembler.SetVertexBuffers(3, new[] { new VertexBufferBinding(InstanceRotationMatrixBuffer, Marshal.SizeOf(typeof(DInstanceDataMatrixRotter)),0), });*/ deviceContext.InputAssembler.SetIndexBuffer(IndexBuffer, SharpDX.DXGI.Format.R32_UInt, 0); deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; // Set the vertex buffer to active in the input assembler so it can be rendered. //deviceContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<DVertex>(), 0), new VertexBufferBinding(InstanceBuffer, Utilities.SizeOf<DInstanceType>(), 0)); //deviceContext.InputAssembler.SetIndexBuffer(IndexBuffer, SharpDX.DXGI.Format.R32_UInt, 0); // Set the type of the primitive that should be rendered from this vertex buffer, in this case triangles. //deviceContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; } } } /*new DVertex() { position = new Vector3(-1*_sizeX, -1*_sizeY, 1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(-1*_sizeX, 1*_sizeY, 1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(1*_sizeX, -1*_sizeY, 1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(1*_sizeX, 1*_sizeY, 1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(-1*_sizeX, -1*_sizeY, -1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(-1*_sizeX, 1*_sizeY, -1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(1*_sizeX, -1*_sizeY, -1*_sizeZ), color = _color, }, new DVertex() { position = new Vector3(1*_sizeX, 1*_sizeY, -1*_sizeZ), color = _color, },*/
40.789809
392
0.505726
[ "MIT" ]
ninekorn/SCCoreSystems-rerelease
sccsv10/_sc_graphics/_sc_models/human_rig/SC_modL_rght_upper_arm.cs
38,426
C#
using System; using System.IO; using System.Linq; using FluentAssertions; using LiteDB.Engine; using Xunit; namespace LiteDB.Issue1585 { public class PlayerDto { [BsonId] public Guid Id { get; } public string Name { get; } public PlayerDto(Guid id, string name) { Id = id; Name = name; } } public class Issue1585a_Tests { [Fact] public void Dto_Read() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } [Fact] public void Dto_Read1() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } [Fact] public void Dto_Read2() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } } public class Issue1585b_Tests { [Fact] public void Dto_Read3() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } [Fact] public void Dto_Read4() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } [Fact] public void Dto_Read5() { using (var db = new LiteDatabase(new MemoryStream())) { var id = Guid.NewGuid(); var col = db.GetCollection<PlayerDto>(); col.Insert(new PlayerDto(id, "Bob")); var player = col.FindOne(x => x.Id == id); Assert.NotNull(player); } } } }
27.551402
65
0.454885
[ "MIT" ]
Protiguous/LiteDB
LiteDB.Tests/Issue1585.cs
2,950
C#
using System; using System.IO; using System.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Mono.Cecil; namespace MonoDevelop.Addins.Tasks { public class ResolveMonoDevelopInstance : Task { //use a custom user profile, typically set by $MONODEVELOP_TEST_PROFILE public string ProfilePath { get; set; } [Output] //the bin directory of the target instance. if a value is not provided, //it will be resolved from the global installation. public string BinDir { get; set; } [Output] //the app directory of the target instance. this is a convenience //to compute an BinDir value. public string AppDir { get; set; } [Output] //the profile version of the target version. if a value is not provided, //it will be determined from the target instance public string ProfileVersion { get; set; } [Output] // the moniker of the framework targeted by the target instance public string TargetFrameworkMoniker { get; set; } [Output] // the version of the framework targeted by the target instance public string TargetFrameworkVersion { get; set; } [Output] // the config directory of the target user profile public string ConfigDir { get; set; } [Output] // the addins directory of the target user profile public string AddinsDir { get; set; } [Output] // the database directory of the target user profile public string DatabaseDir { get; set; } // Based on logic in MonoDevelop.Core.UserProfile public override bool Execute () { if (!ResolveBinDir ()) { return false; } string targetFrameworkMoniker, compatVersion; using (var asm = AssemblyDefinition.ReadAssembly (Path.Combine (BinDir, "MonoDevelop.Core.dll"))) { GetAttributes (asm, out targetFrameworkMoniker, out compatVersion); } if (targetFrameworkMoniker == null || !ParseTargetFrameworkMoniker (targetFrameworkMoniker, out string fxIdentifier, out string fxVersion, out string fxProfile)) { Log.LogError ("TargetFrameworkAttribute is missing or invalid in MonoDevelop.Core.dll"); return false; } if (compatVersion == null) { Log.LogError ("AddinRootAttribute.CompatValue is missing or invalid in MonoDevelop.Core.dll"); return false; } if (!string.Equals (ProfileVersion, compatVersion)) { Log.LogWarning ($"The provided ProfileVersion '{ProfileVersion}' does not match the target instance. Overriding with '{compatVersion}'."); } if (!string.Equals (TargetFrameworkVersion, fxVersion)) { Log.LogWarning ($"The TargetFrameworkVersion '{TargetFrameworkVersion}' does not the target instance. Overriding with '{fxVersion}'."); } ProfileVersion = compatVersion; TargetFrameworkVersion = fxVersion; TargetFrameworkMoniker = targetFrameworkMoniker; ResolveProfile (); return true; } bool ResolveBinDir () { bool MDCoreExists() => File.Exists (Path.Combine (BinDir, "MonoDevelop.Core.dll")); if (!string.IsNullOrEmpty (AppDir)) { BinDir = Path.Combine (AppDir, "Contents", "Resources", "lib", "monodevelop", "bin"); if (!MDCoreExists ()) { Log.LogError ("The provided MDAppDir value does not point to a valid instance of instance of Visual Studio for Mac or MonoDevelop."); return false; } return true; } if (!string.IsNullOrEmpty (BinDir)) { if (!MDCoreExists ()) { Log.LogError ("The provided MDBinDir value does not point to a valid instance of instance of Visual Studio for Mac or MonoDevelop."); return false; } return true; } if (Platform.IsWindows) { BinDir = Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86), "Xamarin Studio", "bin" ); } else if (Platform.IsMac) { string appName = "Visual Studio"; BinDir = $"/Applications/{appName}.app/Contents/Resources/lib/monodevelop/bin"; //fall back to old pre-Yosemite location if (!Directory.Exists (BinDir)) { BinDir = $"/Applications/{appName}.app/Contents/MacOS/lib/monodevelop/bin"; } } else { BinDir = "/usr/lib/monodevelop/bin"; } if (!MDCoreExists ()) { Log.LogError ("Could not find a global instance of Visual Studio for Mac or MonoDevelop. Try providing an explicit value with MDBinDir."); return false; } return true; } void ResolveProfile () { string profileID = Platform.IsMac ? "VisualStudio" : "MonoDevelop"; profileID = Path.Combine (profileID, ProfileVersion); if (!string.IsNullOrEmpty (ProfilePath)) { ConfigDir = Path.Combine (ProfilePath, profileID, "Config"); AddinsDir = Path.Combine (ProfilePath, profileID, "LocalInstall", "Addins"); DatabaseDir = Path.Combine (ProfilePath, profileID, "Cache"); } else if (Platform.IsWindows) { string local = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData); string roaming = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); ConfigDir = Path.Combine (roaming, profileID, "Config"); AddinsDir = Path.Combine (local, profileID, "LocalInstall", "Addins"); DatabaseDir = Path.Combine (local, profileID, "Cache"); } else if (Platform.IsMac) { string home = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string library = Path.Combine (home, "Library"); ConfigDir = Path.Combine (library, "Preferences", profileID); AddinsDir = Path.Combine (library, "Application Support", profileID, "LocalInstall", "Addins"); DatabaseDir = Path.Combine (library, "Caches", profileID); } else { string home = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string xdgDataHome = Environment.GetEnvironmentVariable ("XDG_DATA_HOME"); if (string.IsNullOrEmpty (xdgDataHome)) xdgDataHome = Path.Combine (home, ".local", "share"); string xdgConfigHome = Environment.GetEnvironmentVariable ("XDG_CONFIG_HOME"); if (string.IsNullOrEmpty (xdgConfigHome)) xdgConfigHome = Path.Combine (home, ".config"); string xdgCacheHome = Environment.GetEnvironmentVariable ("XDG_CACHE_HOME"); if (string.IsNullOrEmpty (xdgCacheHome)) xdgCacheHome = Path.Combine (home, ".cache"); ConfigDir = Path.Combine (xdgConfigHome, profileID); AddinsDir = Path.Combine (xdgDataHome, profileID, "LocalInstall"); DatabaseDir = Path.Combine (xdgCacheHome, profileID); } } static void GetAttributes (AssemblyDefinition asm, out string targetFramework, out string compatVersion) { targetFramework = compatVersion = null; foreach (var att in asm.MainModule.GetCustomAttributes ()) { switch (att.AttributeType.FullName) { case "System.Runtime.Versioning.TargetFrameworkAttribute": targetFramework = (string)att.ConstructorArguments [0].Value; break; case "Mono.Addins.AddinRootAttribute": compatVersion = (string)att.Properties.FirstOrDefault (f => f.Name == "CompatVersion").Argument.Value; break; } } } //Based on MonoDevelop's TargetFrameworkMoniker class static bool ParseTargetFrameworkMoniker (string tfm, out string identifier, out string version, out string profile) { const string versionSeparator = ",Version="; const string profileSeparator = ",Profile="; profile = null; version = null; int versionIdx = tfm.IndexOf (','); identifier = tfm.Substring (0, versionIdx); if (tfm.IndexOf (versionSeparator, versionIdx, versionSeparator.Length, StringComparison.Ordinal) != versionIdx) { return false; } versionIdx += versionSeparator.Length; int profileIdx = tfm.IndexOf (',', versionIdx); if (profileIdx < 0) { version = tfm.Substring (versionIdx); } else { version = tfm.Substring (versionIdx, profileIdx - versionIdx); profile = tfm.Substring (profileIdx + profileSeparator.Length); } return Version.TryParse (version [0] == 'v' ? version.Substring (1) : version, out Version v); } } }
36.502304
166
0.710769
[ "MIT" ]
nosami/MonoDevelop.AddinMaker
MonoDevelop.Addins.Tasks/ResolveMonoDevelopInstance.cs
7,923
C#
using System.Runtime.InteropServices; namespace VFXEditor.Structs { [StructLayout( LayoutKind.Sequential )] public struct Quat { public float X; public float Z; public float Y; public float W; public static implicit operator System.Numerics.Vector4( Quat pos ) => new( pos.X, pos.Y, pos.Z, pos.W ); public static implicit operator SharpDX.Vector4( Quat pos ) => new( pos.X, pos.Z, pos.Y, pos.W ); } }
27.352941
113
0.63871
[ "MIT" ]
0ceal0t/Dalamud-VFXEditor
VFXEditor/Structs/Quat.cs
465
C#
using System.Collections.Generic; using System.Collections.Specialized; namespace Excalibur.Shared.Collections { /// <summary> /// Interface for an Observable Collection /// </summary> /// <typeparam name="T">The type used within the collection</typeparam> public interface IObservableCollection<T> : IList<T>, INotifyCollectionChanged { } }
26.571429
82
0.712366
[ "Apache-2.0" ]
AbhayChandel/my-thai-star
net/xamarin/Excalibur/Excalibur.Shared/Collections/IObservableCollection.cs
374
C#
// copyright Runette Software Ltd, 2020. All rights reserved using System.Collections.Generic; using UnityEngine; using g3; using System.Linq; namespace Virgis { /// <summary> /// Controls an instance of a Polygon ViRGIS component /// </summary> public class Dataplane : Datashape { public string gisId; public Dictionary<string, object> gisProperties; public override void MoveAxis(MoveArgs args) { // Do nothing } public override void MoveTo(MoveArgs args) { throw new System.NotImplementedException(); } /// <summary> /// Called to draw the Polygon based upon the /// </summary> /// <param name="perimeter">LineString defining the perimter of the polygon</param> /// <param name="mat"> Material to be used</param> /// <returns></returns> public GameObject Draw( Vector3[] top, Vector3[] bottom, Material mat = null) { Polygon = new List<DCurve3>(); lines = new List<Dataline>(); Polygon.Add(new DCurve3(top.ToList<Vector3>().ConvertAll(item => (Vector3d)item), true)); for (int i = 0; i < bottom.Length; i++) { Polygon[0].AppendVertex(bottom[bottom.Length - i - 1]); } Shape = Instantiate(shapePrefab, transform); MeshRenderer mr = Shape.GetComponent<MeshRenderer>(); mr.material = mat; // call the generic polygon draw function from DataShape _redraw(); return gameObject; } public override Dictionary<string, object> GetMetadata() { Dictionary<string, object> temp = new Dictionary<string, object>(gisProperties); temp.Add("ID", gisId); return temp; } public override void SetMetadata(Dictionary<string, object> meta) { throw new System.NotImplementedException(); } } }
32.209677
101
0.584877
[ "Apache-2.0" ]
ViRGIS-Team/ViRGiS_v2
Runtime/Scripts/Geometries/Dataplane.cs
1,997
C#
using System.Collections.Generic; using UnityEditor; namespace UnityEngine.Seqence { public class XResources { class Asset : ISharedObject<Asset> { public Object asset; public uint refence; public Asset next { get; set; } public Asset() { this.refence = 1; } public void Dispose() { refence = 0; next = null; } } private static Dictionary<string, Asset> goPool = new Dictionary<string, Asset>(); private static Dictionary<string, Asset> sharedPool = new Dictionary<string, Asset>(); public static void Clean() { sharedPool.Clear(); goPool.Clear(); SharedPool<Asset>.Clean(); Resources.UnloadUnusedAssets(); } public static GameObject LoadGameObject(string path) { #if UNITY_EDITOR if (goPool.ContainsKey(path)) { return Object.Instantiate((GameObject) goPool[path].asset); } else { var obj = AssetDatabase.LoadAssetAtPath<GameObject>(path); if (obj) { var tmp = SharedPool<Asset>.Get(); tmp.asset = obj; goPool.Add(path, tmp); return Object.Instantiate(obj); } return null; } #else // assetbundle implements #endif } public static void DestroyGameObject(string path, GameObject go) { if (Application.isPlaying) { Object.Destroy(go); } else { Object.DestroyImmediate(go); } if (goPool.ContainsKey(path)) { var it = goPool[path]; it.refence--; if (it.refence <= 0) { goPool.Remove(path); SharedPool<Asset>.Return(it); } } } public static T LoadSharedAsset<T>(string path) where T : Object { #if UNITY_EDITOR if (sharedPool.ContainsKey(path)) { return sharedPool[path].asset as T; } else { var asset = AssetDatabase.LoadAssetAtPath<T>(path); var tmp = SharedPool<Asset>.Get(); tmp.asset = asset; sharedPool.Add(path, tmp); return asset; } #else // assetbundle implements #endif } public static void DestroySharedAsset(string path) { if (sharedPool.ContainsKey(path)) { var asset = sharedPool[path]; asset.refence--; if (asset.refence <= 0) { #if !UNITY_EDITOR Resources.UnloadAsset(asset.asset); #endif SharedPool<Asset>.Return(asset); } } } } }
25.869919
94
0.452231
[ "MIT" ]
Hengle/seqence
client/Assets/seqence/Runtime/help/XResources.cs
3,182
C#
using System.Linq; using Xunit; namespace FastInsert.Tests { public class EnumerableExtensionsTests { [Fact] public void EnumerableShouldBeProperlyPartitioned() { var list = new[] {1, 2, 3, 4, 5}; var partitioned = EnumerableExtensions.GetPartitions(list, partitionSize: 2); var traversed = partitioned.SelectMany(p => p); Assert.Equal(list, traversed); } } }
22.52381
89
0.581395
[ "Apache-2.0" ]
klym1/DapperFastInsert
src/FastInsert.Tests/EnumerableExtensionsTests.cs
475
C#
using System; using Content.Client.UserInterface.Stylesheets; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.Input; using Robust.Shared.Maths; namespace Content.Client.UserInterface { public class ItemSlotButton : Control { private const string HighlightShader = "SelectionOutlineInrange"; public TextureRect Button { get; } public SpriteView SpriteView { get; } public SpriteView HoverSpriteView { get; } public BaseButton StorageButton { get; } public CooldownGraphic CooldownDisplay { get; } public Action<GUIBoundKeyEventArgs>? OnPressed { get; set; } public Action<GUIBoundKeyEventArgs>? OnStoragePressed { get; set; } public Action<GUIMouseHoverEventArgs>? OnHover { get; set; } public bool EntityHover => HoverSpriteView.Sprite != null; public bool MouseIsHovering; private readonly PanelContainer _highlightRect; public ItemSlotButton(Texture texture, Texture storageTexture) { MinSize = (64, 64); AddChild(Button = new TextureRect { Texture = texture, TextureScale = (2, 2), MouseFilter = MouseFilterMode.Stop }); AddChild(_highlightRect = new PanelContainer { StyleClasses = { StyleNano.StyleClassHandSlotHighlight }, MinSize = (32, 32), Visible = false }); Button.OnKeyBindDown += OnButtonPressed; AddChild(SpriteView = new SpriteView { Scale = (2, 2), OverrideDirection = Direction.South }); AddChild(HoverSpriteView = new SpriteView { Scale = (2, 2), OverrideDirection = Direction.South }); AddChild(StorageButton = new TextureButton { TextureNormal = storageTexture, Scale = (0.75f, 0.75f), HorizontalAlignment = HAlignment.Right, VerticalAlignment = VAlignment.Bottom, Visible = false, }); StorageButton.OnKeyBindDown += args => { if (args.Function != EngineKeyFunctions.UIClick) { OnButtonPressed(args); } }; StorageButton.OnPressed += OnStorageButtonPressed; Button.OnMouseEntered += _ => { MouseIsHovering = true; }; Button.OnMouseEntered += OnButtonHover; Button.OnMouseExited += _ => { MouseIsHovering = false; ClearHover(); }; AddChild(CooldownDisplay = new CooldownGraphic { Visible = false, }); } public void ClearHover() { if (EntityHover) { HoverSpriteView.Sprite?.Owner.Delete(); HoverSpriteView.Sprite = null; } } public virtual void Highlight(bool highlight) { if (highlight) { _highlightRect.Visible = true; } else { _highlightRect.Visible = false; } } private void OnButtonPressed(GUIBoundKeyEventArgs args) { OnPressed?.Invoke(args); } private void OnStorageButtonPressed(BaseButton.ButtonEventArgs args) { if (args.Event.Function == EngineKeyFunctions.UIClick) { OnStoragePressed?.Invoke(args.Event); } else { OnPressed?.Invoke(args.Event); } } private void OnButtonHover(GUIMouseHoverEventArgs args) { OnHover?.Invoke(args); } } }
28.426573
76
0.524969
[ "MIT" ]
BulletGrade/space-station-14
Content.Client/UserInterface/ItemSlotButton.cs
4,067
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; namespace System.Net.Sockets.Tests { public abstract class ReceiveMessageFrom<T> : SocketTestHelperBase<T> where T : SocketHelperBase, new() { protected static IPEndPoint GetGetDummyTestEndpoint(AddressFamily addressFamily = AddressFamily.InterNetwork) => addressFamily == AddressFamily.InterNetwork ? new IPEndPoint(IPAddress.Parse("1.2.3.4"), 1234) : new IPEndPoint(IPAddress.Parse("1:2:3::4"), 1234); protected static readonly TimeSpan CancellationTestTimeout = TimeSpan.FromSeconds(30); protected ReceiveMessageFrom(ITestOutputHelper output) : base(output) { } [PlatformSpecific(TestPlatforms.AnyUnix)] [Theory] [InlineData(false)] [InlineData(true)] public async Task ReceiveSent_TCP_Success(bool ipv6) { if (ipv6 && PlatformDetection.IsOSX) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/47335")] // accept() will create a (seemingly) DualMode socket on Mac, // but since recvmsg() does not work with DualMode on that OS, we throw PNSE CheckDualModeReceiveSupport(). // Weirdly, the flag is readable, but an attempt to write it leads to EINVAL. // The best option seems to be to skip this test for the Mac+IPV6 case return; } (Socket sender, Socket receiver) = SocketTestExtensions.CreateConnectedSocketPair(ipv6); using (sender) using (receiver) { byte[] sendBuffer = { 1, 2, 3 }; sender.Send(sendBuffer); byte[] receiveBuffer = new byte[3]; var r = await ReceiveMessageFromAsync(receiver, receiveBuffer, sender.LocalEndPoint); Assert.Equal(3, r.ReceivedBytes); AssertExtensions.SequenceEqual(sendBuffer, receiveBuffer); } } [Theory] [InlineData(false)] [InlineData(true)] public async Task ReceiveSent_UDP_Success(bool ipv4) { const int Offset = 10; const int DatagramSize = 256; const int DatagramsToSend = 16; IPAddress address = ipv4 ? IPAddress.Loopback : IPAddress.IPv6Loopback; using Socket receiver = new Socket(address.AddressFamily, SocketType.Dgram, ProtocolType.Udp); using Socket sender = new Socket(address.AddressFamily, SocketType.Dgram, ProtocolType.Udp); receiver.SetSocketOption(ipv4 ? SocketOptionLevel.IP : SocketOptionLevel.IPv6, SocketOptionName.PacketInformation, true); ConfigureNonBlocking(sender); ConfigureNonBlocking(receiver); receiver.BindToAnonymousPort(address); sender.BindToAnonymousPort(address); byte[] sendBuffer = new byte[DatagramSize]; var receiveInternalBuffer = new byte[DatagramSize + Offset]; var emptyBuffer = new byte[Offset]; ArraySegment<byte> receiveBuffer = new ArraySegment<byte>(receiveInternalBuffer, Offset, DatagramSize); Random rnd = new Random(0); IPEndPoint remoteEp = new IPEndPoint(ipv4 ? IPAddress.Any : IPAddress.IPv6Any, 0); for (int i = 0; i < DatagramsToSend; i++) { rnd.NextBytes(sendBuffer); sender.SendTo(sendBuffer, receiver.LocalEndPoint); SocketReceiveMessageFromResult result = await ReceiveMessageFromAsync(receiver, receiveBuffer, remoteEp); IPPacketInformation packetInformation = result.PacketInformation; Assert.Equal(DatagramSize, result.ReceivedBytes); AssertExtensions.SequenceEqual(emptyBuffer, new ReadOnlySpan<byte>(receiveInternalBuffer, 0, Offset)); AssertExtensions.SequenceEqual(sendBuffer, new ReadOnlySpan<byte>(receiveInternalBuffer, Offset, DatagramSize)); Assert.Equal(sender.LocalEndPoint, result.RemoteEndPoint); Assert.Equal(((IPEndPoint)sender.LocalEndPoint).Address, packetInformation.Address); } } [Theory] [InlineData(true)] [InlineData(false)] public async Task ClosedBeforeOperation_Throws_ObjectDisposedException(bool closeOrDispose) { using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.BindToAnonymousPort(IPAddress.Any); if (closeOrDispose) socket.Close(); else socket.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => ReceiveMessageFromAsync(socket, new byte[1], GetGetDummyTestEndpoint())); } [Theory] [InlineData(true)] [InlineData(false)] public async Task ClosedDuringOperation_Throws_ObjectDisposedExceptionOrSocketException(bool closeOrDispose) { if (UsesSync && PlatformDetection.IsOSX) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/47342")] // On Mac, Close/Dispose hangs when invoked concurrently with a blocking UDP receive. return; } int msDelay = 100; if (UsesSync) { // In sync case Dispose may happen before the operation is started, // in that case we would see an ObjectDisposedException instead of a SocketException. // We may need to try the run a couple of times to deal with the timing race. await RetryHelper.ExecuteAsync(() => RunTestAsync(), maxAttempts: 10, retryWhen: e => e is XunitException); } else { await RunTestAsync(); } async Task RunTestAsync() { using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.BindToAnonymousPort(IPAddress.Any); Task receiveTask = ReceiveMessageFromAsync(socket, new byte[1], GetGetDummyTestEndpoint()); await Task.Delay(msDelay); msDelay *= 2; if (closeOrDispose) socket.Close(); else socket.Dispose(); if (DisposeDuringOperationResultsInDisposedException) { await Assert.ThrowsAsync<ObjectDisposedException>(() => receiveTask) .TimeoutAfter(CancellationTestTimeout); } else { SocketException ex = await Assert.ThrowsAsync<SocketException>(() => receiveTask) .TimeoutAfter(CancellationTestTimeout); SocketError expectedError = UsesSync ? SocketError.Interrupted : SocketError.OperationAborted; Assert.Equal(expectedError, ex.SocketErrorCode); } } } [PlatformSpecific(TestPlatforms.Windows)] // It's allowed to shutdown() UDP sockets on Windows, however on Unix this will lead to ENOTCONN [Theory] [InlineData(SocketShutdown.Both)] [InlineData(SocketShutdown.Receive)] public async Task ShutdownReceiveBeforeOperation_ThrowsSocketException(SocketShutdown shutdown) { using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); socket.BindToAnonymousPort(IPAddress.Any); socket.Shutdown(shutdown); // [ActiveIssue("https://github.com/dotnet/runtime/issues/47469")] // Shutdown(Both) does not seem to take immediate effect for Receive(Message)From in a consistent manner, trying to workaround with a delay: if (shutdown == SocketShutdown.Both) await Task.Delay(50); SocketException exception = await Assert.ThrowsAnyAsync<SocketException>(() => ReceiveMessageFromAsync(socket, new byte[1], GetGetDummyTestEndpoint())) .TimeoutAfter(CancellationTestTimeout); Assert.Equal(SocketError.Shutdown, exception.SocketErrorCode); } [PlatformSpecific(TestPlatforms.Windows)] // It's allowed to shutdown() UDP sockets on Windows, however on Unix this will lead to ENOTCONN [Fact] public async Task ShutdownSend_ReceiveFromShouldSucceed() { using var receiver = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); receiver.BindToAnonymousPort(IPAddress.Loopback); receiver.Shutdown(SocketShutdown.Send); using var sender = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sender.BindToAnonymousPort(IPAddress.Loopback); sender.SendTo(new byte[1], receiver.LocalEndPoint); var r = await ReceiveMessageFromAsync(receiver, new byte[1], sender.LocalEndPoint); Assert.Equal(1, r.ReceivedBytes); } } public sealed class ReceiveMessageFrom_Sync : ReceiveMessageFrom<SocketHelperArraySync> { public ReceiveMessageFrom_Sync(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_SyncForceNonBlocking : ReceiveMessageFrom<SocketHelperSyncForceNonBlocking> { public ReceiveMessageFrom_SyncForceNonBlocking(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_Apm : ReceiveMessageFrom<SocketHelperApm> { public ReceiveMessageFrom_Apm(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_Task : ReceiveMessageFrom<SocketHelperTask> { public ReceiveMessageFrom_Task(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_CancellableTask : ReceiveMessageFrom<SocketHelperCancellableTask> { public ReceiveMessageFrom_CancellableTask(ITestOutputHelper output) : base(output) { } [Theory] [MemberData(nameof(LoopbacksAndBuffers))] public async Task WhenCanceled_Throws(IPAddress loopback, bool precanceled) { using var socket = new Socket(loopback.AddressFamily, SocketType.Dgram, ProtocolType.Udp); using var dummy = new Socket(loopback.AddressFamily, SocketType.Dgram, ProtocolType.Udp); socket.BindToAnonymousPort(loopback); dummy.BindToAnonymousPort(loopback); Memory<byte> buffer = new byte[1]; CancellationTokenSource cts = new CancellationTokenSource(); if (precanceled) cts.Cancel(); else cts.CancelAfter(100); OperationCanceledException ex = await Assert.ThrowsAnyAsync<OperationCanceledException>( () => socket.ReceiveMessageFromAsync(buffer, SocketFlags.None, dummy.LocalEndPoint, cts.Token).AsTask()) .TimeoutAfter(CancellationTestTimeout); Assert.Equal(cts.Token, ex.CancellationToken); } } public sealed class ReceiveMessageFrom_Eap : ReceiveMessageFrom<SocketHelperEap> { public ReceiveMessageFrom_Eap(ITestOutputHelper output) : base(output) { } [Theory] [InlineData(false, 0)] [InlineData(false, 1)] [InlineData(false, 2)] [InlineData(true, 0)] [InlineData(true, 1)] [InlineData(true, 2)] public void ReceiveSentMessages_ReuseEventArgs_Success(bool ipv4, int bufferMode) { const int DatagramsToSend = 5; const int TimeoutMs = 30_000; AddressFamily family; IPAddress loopback, any; SocketOptionLevel level; if (ipv4) { family = AddressFamily.InterNetwork; loopback = IPAddress.Loopback; any = IPAddress.Any; level = SocketOptionLevel.IP; } else { family = AddressFamily.InterNetworkV6; loopback = IPAddress.IPv6Loopback; any = IPAddress.IPv6Any; level = SocketOptionLevel.IPv6; } using var receiver = new Socket(family, SocketType.Dgram, ProtocolType.Udp); using var sender = new Socket(family, SocketType.Dgram, ProtocolType.Udp); using var saea = new SocketAsyncEventArgs(); var completed = new ManualResetEventSlim(); saea.Completed += delegate { completed.Set(); }; int port = receiver.BindToAnonymousPort(loopback); receiver.SetSocketOption(level, SocketOptionName.PacketInformation, true); sender.Bind(new IPEndPoint(loopback, 0)); saea.RemoteEndPoint = new IPEndPoint(any, 0); Random random = new Random(0); byte[] sendBuffer = new byte[1024]; random.NextBytes(sendBuffer); for (int i = 0; i < DatagramsToSend; i++) { byte[] receiveBuffer = new byte[1024]; switch (bufferMode) { case 0: // single buffer saea.SetBuffer(receiveBuffer, 0, 1024); break; case 1: // single buffer in buffer list saea.BufferList = new List<ArraySegment<byte>> { new ArraySegment<byte>(receiveBuffer) }; break; case 2: // multiple buffers in buffer list saea.BufferList = new List<ArraySegment<byte>> { new ArraySegment<byte>(receiveBuffer, 0, 512), new ArraySegment<byte>(receiveBuffer, 512, 512) }; break; } bool pending = receiver.ReceiveMessageFromAsync(saea); sender.SendTo(sendBuffer, new IPEndPoint(loopback, port)); if (pending) Assert.True(completed.Wait(TimeoutMs), "Expected operation to complete within timeout"); completed.Reset(); Assert.Equal(1024, saea.BytesTransferred); AssertExtensions.SequenceEqual(sendBuffer, receiveBuffer); Assert.Equal(sender.LocalEndPoint, saea.RemoteEndPoint); Assert.Equal(((IPEndPoint)sender.LocalEndPoint).Address, saea.ReceiveMessageFromPacketInfo.Address); } } } public sealed class ReceiveMessageFrom_SpanSync : ReceiveMessageFrom<SocketHelperSpanSync> { public ReceiveMessageFrom_SpanSync(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_SpanSyncForceNonBlocking : ReceiveMessageFrom<SocketHelperSpanSyncForceNonBlocking> { public ReceiveMessageFrom_SpanSyncForceNonBlocking(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_MemoryArrayTask : ReceiveMessageFrom<SocketHelperMemoryArrayTask> { public ReceiveMessageFrom_MemoryArrayTask(ITestOutputHelper output) : base(output) { } } public sealed class ReceiveMessageFrom_MemoryNativeTask : ReceiveMessageFrom<SocketHelperMemoryNativeTask> { public ReceiveMessageFrom_MemoryNativeTask(ITestOutputHelper output) : base(output) { } } }
45.120344
163
0.629898
[ "MIT" ]
AndyAyersMS/runtime
src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveMessageFrom.cs
15,747
C#
#if CSHotFix using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; using CSHotFix.CLR.TypeSystem; using CSHotFix.CLR.Method; using CSHotFix.Runtime.Enviorment; using CSHotFix.Runtime.Intepreter; using CSHotFix.Runtime.Stack; using CSHotFix.Reflection; using CSHotFix.CLR.Utils; using System.Linq; namespace CSHotFix.Runtime.Generated { unsafe class UnityUI_SetPropertyAttribute_Binding { public static void Register(CSHotFix.Runtime.Enviorment.AppDomain app) { BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; MethodBase method; Type[] args; Type type = typeof(UnityUI.SetPropertyAttribute); args = new Type[]{}; method = type.GetMethod("get_Name", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_Name_0); args = new Type[]{}; method = type.GetMethod("get_IsDirty", flag, null, args, null); app.RegisterCLRMethodRedirection(method, get_IsDirty_1); args = new Type[]{typeof(System.Boolean)}; method = type.GetMethod("set_IsDirty", flag, null, args, null); app.RegisterCLRMethodRedirection(method, set_IsDirty_2); app.RegisterCLRCreateArrayInstance(type, s => new UnityUI.SetPropertyAttribute[s]); args = new Type[]{typeof(System.String)}; method = type.GetConstructor(flag, null, args, null); app.RegisterCLRMethodRedirection(method, Ctor_0); } static StackObject* get_Name_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityUI.SetPropertyAttribute instance_of_this_method = (UnityUI.SetPropertyAttribute)typeof(UnityUI.SetPropertyAttribute).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.Name; return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } static StackObject* get_IsDirty_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityUI.SetPropertyAttribute instance_of_this_method = (UnityUI.SetPropertyAttribute)typeof(UnityUI.SetPropertyAttribute).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.IsDirty; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return __ret + 1; } static StackObject* set_IsDirty_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityUI.SetPropertyAttribute instance_of_this_method = (UnityUI.SetPropertyAttribute)typeof(UnityUI.SetPropertyAttribute).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.IsDirty = value; return __ret; } static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject* ptr_of_this_method; StackObject* __ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.String @name = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = new UnityUI.SetPropertyAttribute(@name); return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method); } } } #endif
43.109244
211
0.675634
[ "MIT" ]
591094733/cshotfix
CSHotFix_SimpleFramework/Assets/CSHotFixLibaray/Generated/CLRGen1/UnityUI_SetPropertyAttribute_Binding.cs
5,130
C#
// Copyright (c) 2019 Lykke Corp. // See the LICENSE file in the project root for more information. using System; namespace MarginTrading.AccountsManagement.AccountHistoryBroker.Models { public class AccountHistory : IAccountHistory { public AccountHistory(string id, DateTime changeTimestamp, string accountId, string clientId, decimal changeAmount, decimal balance, decimal withdrawTransferLimit, string comment, AccountBalanceChangeReasonType reasonType, string eventSourceId, string legalEntity, string auditLog, string instrument, DateTime tradingDate, string correlationId) { Id = id; ChangeTimestamp = changeTimestamp; AccountId = accountId; ClientId = clientId; ChangeAmount = changeAmount; Balance = balance; WithdrawTransferLimit = withdrawTransferLimit; Comment = comment; ReasonType = reasonType; EventSourceId = eventSourceId; LegalEntity = legalEntity; AuditLog = auditLog; Instrument = instrument; TradingDate = tradingDate; CorrelationId = correlationId; } public string Id { get; } public DateTime ChangeTimestamp { get; } public string AccountId { get; } public string ClientId { get; } public decimal ChangeAmount { get; } public decimal Balance { get; } public decimal WithdrawTransferLimit { get; } public string Comment { get; } public AccountBalanceChangeReasonType ReasonType { get; } public string EventSourceId { get; } public string LegalEntity { get; } public string AuditLog { get; } public string Instrument { get; } public DateTime TradingDate { get; } public string CorrelationId { get; } } }
38.04
113
0.639327
[ "MIT-0" ]
LykkeBusiness/MarginTrading.AccountsManagement
src/MarginTrading.AccountsManagement.AccountHistoryBroker/Models/AccountHistory.cs
1,904
C#
using MenuPlanner.Business.Repositories; using System; using System.Collections.Generic; using System.Linq; using System.Text; using MenuPlanner.Business.BusinessObjects; using AutoMapper; using MenuPlanner.DataAccess.EntityFramework.Domain; using MenuPlanner.Utils.Helpers; using Profile = MenuPlanner.Business.BusinessObjects.Profile; using MenuPlanner.Utils.Transverse; namespace MenuPlanner.DataAccess.EntityFramework.Repositories { public class EntityProfileRepository : IProfileRepository { public void CreateProfile(Profile toCreate) { var dto = Mapper.Map<ProfileDto>(toCreate); using (var context = new MenuPlannerContext()) { context.Profiles.Add(dto); context.SaveChanges(); } } public void UpdateProfile(Profile toUpdate, string oldName) { using (var context = new MenuPlannerContext()) { var profile = context.Profiles.First(p => p.Name == oldName); profile.Name = toUpdate.Name; profile.SelectedTimes = (int)EnumUtils.TimeSlotMaskFromList(toUpdate.SelectedTimes); context.SaveChanges(); } } public IEnumerable<Profile> GetAllProfiles() { using (var context = new MenuPlannerContext()) { return Mapper.Map<List<Profile>>(context.Profiles.ToList()); } } public void DeleteProfile(Profile toDelete) { using (var context = new MenuPlannerContext()) { var profile = context.Profiles.First(p => p.Name == toDelete.Name); context.Profiles.Remove(profile); context.SaveChanges(); } } } }
29.95082
100
0.605911
[ "MIT" ]
TomCortinovis/MenuPlanner
MenuPlanner.DataAccess/EntityFramework/Repositories/EntityProfileRepository.cs
1,829
C#
using UnityEngine; public class GameComplete : MonoBehaviour { public GameObject win; }
15.333333
41
0.771739
[ "MIT" ]
MetalBreaker/BGJ-Game
Assets/Scripts/GameComplete.cs
92
C#
// Copyright 2004-2011 Castle Project - http://www.castleproject.org/ // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. namespace Castle.Core { /// <summary> /// Represents a concern that will be applied to a component instance /// during decommission phase (right before component instance is destroyed). /// </summary> public interface IDecommissionConcern { /// <summary> /// Implementors should act on the instance in response to /// a decommission phase. /// </summary> /// <param name = "model">The model.</param> /// <param name = "component">The component.</param> void Apply(ComponentModel model, object component); } }
38.741935
81
0.696919
[ "Apache-2.0" ]
castleproject-deprecated/Castle.Windsor-READONLY
src/Castle.Windsor/Core/IDecommissionConcern.cs
1,203
C#
using System; using EntityFramework.VersionedSoftDeletable; using Microsoft.AspNet.Identity; namespace EntityFramework.VersionedIdentitySoftDeletable { public class VersionedIdentitySoftDeletable<TUserId, TVersionedUserDeleted> : VersionedUserSoftDeletable<TUserId, TVersionedUserDeleted> where TUserId : IConvertible { public sealed override TUserId GetCurrentUserId() { return System.Web.HttpContext.Current.User.Identity.GetUserId<TUserId>(); } } }
37.692308
172
0.787755
[ "MIT" ]
NickStrupat/EntityFramework.SoftDeletable
EntityFramework.VersionedIdentitySoftDeletable/VersionedIdentitySoftDeletable.cs
492
C#
/** * Copyright 2013 Canada Health Infoway, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Author: $LastChangedBy: gng $ * Last modified: $LastChangedDate: 2015-11-19 18:20:12 -0500 (Fri, 30 Jan 2015) $ * Revision: $LastChangedRevision: 9755 $ */ /* This class was auto-generated by the message builder generator tools. */ using Ca.Infoway.Messagebuilder; namespace Ca.Infoway.Messagebuilder.Model.Ab_r02_04_03_shr.Domainvalue { public interface PerianalRoute : Code { } }
36.172414
83
0.708294
[ "ECL-2.0", "Apache-2.0" ]
CanadaHealthInfoway/message-builder-dotnet
message-builder-release-ab_r02_04_03_shr/Main/Ca/Infoway/Messagebuilder/Model/Ab_r02_04_03_shr/Domainvalue/PerianalRoute.cs
1,049
C#
using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Text.RegularExpressions; using Microsoft.Recognizers.Definitions.Italian; namespace Microsoft.Recognizers.Text.Number.Italian { public class OrdinalExtractor : BaseNumberExtractor { internal sealed override ImmutableDictionary<Regex, TypeTag> Regexes { get; } protected sealed override string ExtractType { get; } = Constants.SYS_NUM_ORDINAL; // "Ordinal"; private static readonly ConcurrentDictionary<string, OrdinalExtractor> Instances = new ConcurrentDictionary<string, OrdinalExtractor>(); public static OrdinalExtractor GetInstance(string placeholder = "") { if (!Instances.ContainsKey(placeholder)) { var instance = new OrdinalExtractor(); Instances.TryAdd(placeholder, instance); } return Instances[placeholder]; } private OrdinalExtractor() { this.Regexes = new Dictionary<Regex, TypeTag> { { new Regex(NumbersDefinitions.OrdinalSuffixRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.ORDINAL_PREFIX, Constants.NUMBER_SUFFIX) }, { new Regex(NumbersDefinitions.OrdinalItalianRegex, RegexOptions.IgnoreCase | RegexOptions.Singleline), RegexTagGenerator.GenerateRegexTag(Constants.ORDINAL_PREFIX, Constants.ITALIAN) } }.ToImmutableDictionary(); } } }
36.06383
121
0.648968
[ "MIT" ]
ZeroInfinite/Recognizers-Text
.NET/Microsoft.Recognizers.Text.Number/Italian/Extractors/OrdinalExtractor.cs
1,697
C#
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. // Licensed under the Apache License, Version 2.0. using System.Collections.Generic; using ImageMagick.Defines; namespace ImageMagick.Formats { /// <summary> /// Class for defines that are used when a <see cref="MagickFormat.Jxl"/> image is written. /// </summary> public sealed class JxlWriteDefines : WriteDefinesCreator { /// <summary> /// Initializes a new instance of the <see cref="JxlWriteDefines"/> class. /// </summary> public JxlWriteDefines() : base(MagickFormat.Jxl) { } /// <summary> /// Gets or sets the jpeg-xl encoding effort. Valid values are in the range of 3 (falcon) to 9 (tortois) (jxl:dct-method). /// </summary> public int? Effort { get; set; } /// <summary> /// Gets the defines that should be set as a define on an image. /// </summary> public override IEnumerable<IDefine> Defines { get { if (Effort.HasValue) yield return CreateDefine("effort", Effort.Value); } } } }
30.74359
130
0.576314
[ "Apache-2.0" ]
brianpopow/Magick.NET
src/Magick.NET/Formats/Jxl/JxlWriteDefines.cs
1,201
C#
using System; namespace PterodactylEngine { public class HorizontalLine { public string Create() { string reportPart = ""; string linePart = new string('-', 6); reportPart = Environment.NewLine + linePart + Environment.NewLine; return reportPart; } } }
18.944444
78
0.557185
[ "MIT" ]
dilomo/Pterodactyl
PterodactylEngine/HorizontalLine.cs
343
C#
/* * Copyright (c) 2022 ETH Zürich, Educational Development and Technology (LET) * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.SystemComponents.Contracts.PowerSupply; using SafeExamBrowser.UserInterface.Contracts.Shell; namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter { internal partial class PowerSupplyControl : UserControl, ISystemControl { private Brush initialBrush; private bool infoShown, warningShown; private double maxWidth; private IPowerSupply powerSupply; private IText text; internal PowerSupplyControl(IPowerSupply powerSupply, IText text) { this.powerSupply = powerSupply; this.text = text; InitializeComponent(); InitializePowerSupplyControl(); } public void Close() { } public void SetInformation(string text) { Dispatcher.InvokeAsync(() => Text.Text = text); } private void InitializePowerSupplyControl() { initialBrush = BatteryCharge.Fill; maxWidth = BatteryCharge.Width; powerSupply.StatusChanged += PowerSupply_StatusChanged; UpdateStatus(powerSupply.GetStatus()); } private void PowerSupply_StatusChanged(IPowerSupplyStatus status) { Dispatcher.InvokeAsync(() => UpdateStatus(status)); } private void UpdateStatus(IPowerSupplyStatus status) { var percentage = Math.Round(status.BatteryCharge * 100); var tooltip = string.Empty; RenderCharge(status.BatteryCharge, status.BatteryChargeStatus); if (status.IsOnline) { infoShown = false; warningShown = false; tooltip = text.Get(percentage == 100 ? TextKey.SystemControl_BatteryCharged : TextKey.SystemControl_BatteryCharging); tooltip = tooltip.Replace("%%CHARGE%%", percentage.ToString()); } else { tooltip = text.Get(TextKey.SystemControl_BatteryRemainingCharge); tooltip = tooltip.Replace("%%CHARGE%%", percentage.ToString()); tooltip = tooltip.Replace("%%HOURS%%", status.BatteryTimeRemaining.Hours.ToString()); tooltip = tooltip.Replace("%%MINUTES%%", status.BatteryTimeRemaining.Minutes.ToString()); HandleBatteryStatus(status.BatteryChargeStatus); } if (!infoShown && !warningShown) { Button.ToolTip = tooltip; } PowerPlug.Visibility = status.IsOnline ? Visibility.Visible : Visibility.Collapsed; Text.Text = tooltip; Warning.Visibility = status.BatteryChargeStatus == BatteryChargeStatus.Critical ? Visibility.Visible : Visibility.Collapsed; this.SetValue(System.Windows.Automation.AutomationProperties.HelpTextProperty, tooltip); } private void RenderCharge(double charge, BatteryChargeStatus status) { var width = maxWidth * charge; BatteryCharge.Width = width > maxWidth ? maxWidth : (width < 0 ? 0 : width); switch (status) { case BatteryChargeStatus.Critical: BatteryCharge.Fill = Brushes.Red; break; case BatteryChargeStatus.Low: BatteryCharge.Fill = Brushes.Orange; break; default: BatteryCharge.Fill = initialBrush; break; } } private void HandleBatteryStatus(BatteryChargeStatus chargeStatus) { if (chargeStatus == BatteryChargeStatus.Low && !infoShown) { Button.ToolTip = text.Get(TextKey.SystemControl_BatteryChargeLowInfo); infoShown = true; } if (chargeStatus == BatteryChargeStatus.Critical && !warningShown) { Button.ToolTip = text.Get(TextKey.SystemControl_BatteryChargeCriticalWarning); warningShown = true; } } } }
29.015504
127
0.73417
[ "MPL-2.0", "MPL-2.0-no-copyleft-exception" ]
yolpsoftware/seb-win-refactoring
SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/PowerSupplyControl.xaml.cs
3,746
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. #nullable disable using System; using System.IO; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.PersistentStorage; namespace Microsoft.CodeAnalysis.Host { internal interface IChecksummedPersistentStorage : IPersistentStorage { /// <summary> /// <see langword="true"/> if the data we have for the solution with the given <paramref name="name"/> has the /// provided <paramref name="checksum"/>. /// </summary> Task<bool> ChecksumMatchesAsync(string name, Checksum checksum, CancellationToken cancellationToken = default); /// <summary> /// <see langword="true"/> if the data we have for the given <paramref name="project"/> with the given <paramref /// name="name"/> has the provided <paramref name="checksum"/>. /// </summary> Task<bool> ChecksumMatchesAsync(Project project, string name, Checksum checksum, CancellationToken cancellationToken = default); /// <summary> /// <see langword="true"/> if the data we have for the given <paramref name="document"/> with the given <paramref /// name="name"/> has the provided <paramref name="checksum"/>. /// </summary> Task<bool> ChecksumMatchesAsync(Document document, string name, Checksum checksum, CancellationToken cancellationToken = default); Task<bool> ChecksumMatchesAsync(ProjectKey project, string name, Checksum checksum, CancellationToken cancellationToken = default); Task<bool> ChecksumMatchesAsync(DocumentKey document, string name, Checksum checksum, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the solution with the given <paramref name="name"/>. If <paramref name="checksum"/> /// is provided, the persisted checksum must match it. If there is no such stream with that name, or the /// checksums do not match, then <see langword="null"/> will be returned. /// </summary> Task<Stream> ReadStreamAsync(string name, Checksum checksum = null, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the <paramref name="project"/> with the given <paramref name="name"/>. If <paramref name="checksum"/> /// is provided, the persisted checksum must match it. If there is no such stream with that name, or the /// checksums do not match, then <see langword="null"/> will be returned. /// </summary> Task<Stream> ReadStreamAsync(Project project, string name, Checksum checksum = null, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the <paramref name="document"/> with the given <paramref name="name"/>. If <paramref name="checksum"/> /// is provided, the persisted checksum must match it. If there is no such stream with that name, or the /// checksums do not match, then <see langword="null"/> will be returned. /// </summary> Task<Stream> ReadStreamAsync(Document document, string name, Checksum checksum = null, CancellationToken cancellationToken = default); Task<Stream> ReadStreamAsync(ProjectKey project, string name, Checksum checksum = null, CancellationToken cancellationToken = default); Task<Stream> ReadStreamAsync(DocumentKey document, string name, Checksum checksum = null, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the solution with the given <paramref name="name"/>. An optional <paramref name="checksum"/> /// can be provided to store along with the data. This can be used along with ReadStreamAsync with future /// reads to ensure the data is only read back if it matches that checksum. /// </summary> Task<bool> WriteStreamAsync(string name, Stream stream, Checksum checksum = null, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the <paramref name="project"/> with the given <paramref name="name"/>. An optional <paramref name="checksum"/> /// can be provided to store along with the data. This can be used along with ReadStreamAsync with future /// reads to ensure the data is only read back if it matches that checksum. /// </summary> Task<bool> WriteStreamAsync(Project project, string name, Stream stream, Checksum checksum = null, CancellationToken cancellationToken = default); /// <summary> /// Reads the stream for the <paramref name="document"/> with the given <paramref name="name"/>. An optional <paramref name="checksum"/> /// can be provided to store along with the data. This can be used along with ReadStreamAsync with future /// reads to ensure the data is only read back if it matches that checksum. /// </summary> Task<bool> WriteStreamAsync(Document document, string name, Stream stream, Checksum checksum = null, CancellationToken cancellationToken = default); } }
62.857143
156
0.69072
[ "MIT" ]
Cosifne/roslyn
src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/IChecksummedPersistentStorage.cs
5,282
C#
//this source code was auto-generated by tolua#, do not modify it using System; using LuaInterface; public class UnityEngine_Texture2DWrap { public static void Register(LuaState L) { L.BeginClass(typeof(UnityEngine.Texture2D), typeof(UnityEngine.Texture)); L.RegFunction("CreateExternalTexture", CreateExternalTexture); L.RegFunction("UpdateExternalTexture", UpdateExternalTexture); L.RegFunction("SetPixel", SetPixel); L.RegFunction("GetPixel", GetPixel); L.RegFunction("GetPixelBilinear", GetPixelBilinear); L.RegFunction("SetPixels", SetPixels); L.RegFunction("SetPixels32", SetPixels32); L.RegFunction("LoadRawTextureData", LoadRawTextureData); L.RegFunction("GetRawTextureData", GetRawTextureData); L.RegFunction("GetPixels", GetPixels); L.RegFunction("GetPixels32", GetPixels32); L.RegFunction("Apply", Apply); L.RegFunction("Resize", Resize); L.RegFunction("Compress", Compress); L.RegFunction("PackTextures", PackTextures); L.RegFunction("GenerateAtlas", GenerateAtlas); L.RegFunction("ReadPixels", ReadPixels); L.RegFunction("New", _CreateUnityEngine_Texture2D); L.RegFunction("__eq", op_Equality); L.RegFunction("__tostring", ToLua.op_ToString); L.RegVar("mipmapCount", get_mipmapCount, null); L.RegVar("format", get_format, null); L.RegVar("whiteTexture", get_whiteTexture, null); L.RegVar("blackTexture", get_blackTexture, null); L.EndClass(); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _CreateUnityEngine_Texture2D(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1); ToLua.PushSealed(L, obj); return 1; } else if (count == 4) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 3, typeof(UnityEngine.TextureFormat)); bool arg3 = LuaDLL.luaL_checkboolean(L, 4); UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3); ToLua.PushSealed(L, obj); return 1; } else if (count == 5) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 3, typeof(UnityEngine.TextureFormat)); bool arg3 = LuaDLL.luaL_checkboolean(L, 4); bool arg4 = LuaDLL.luaL_checkboolean(L, 5); UnityEngine.Texture2D obj = new UnityEngine.Texture2D(arg0, arg1, arg2, arg3, arg4); ToLua.PushSealed(L, obj); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Texture2D.New"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int CreateExternalTexture(IntPtr L) { try { ToLua.CheckArgsCount(L, 6); int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 3, typeof(UnityEngine.TextureFormat)); bool arg3 = LuaDLL.luaL_checkboolean(L, 4); bool arg4 = LuaDLL.luaL_checkboolean(L, 5); System.IntPtr arg5 = ToLua.CheckIntPtr(L, 6); UnityEngine.Texture2D o = UnityEngine.Texture2D.CreateExternalTexture(arg0, arg1, arg2, arg3, arg4, arg5); ToLua.PushSealed(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int UpdateExternalTexture(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); System.IntPtr arg0 = ToLua.CheckIntPtr(L, 2); obj.UpdateExternalTexture(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int SetPixel(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Color arg2 = ToLua.ToColor(L, 4); obj.SetPixel(arg0, arg1, arg2); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetPixel(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Color o = obj.GetPixel(arg0, arg1); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetPixelBilinear(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Color o = obj.GetPixelBilinear(arg0, arg1); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int SetPixels(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color[] arg0 = ToLua.CheckStructArray<UnityEngine.Color>(L, 2); obj.SetPixels(arg0); return 0; } else if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color[] arg0 = ToLua.CheckStructArray<UnityEngine.Color>(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); obj.SetPixels(arg0, arg1); return 0; } else if (count == 6) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); UnityEngine.Color[] arg4 = ToLua.CheckStructArray<UnityEngine.Color>(L, 6); obj.SetPixels(arg0, arg1, arg2, arg3, arg4); return 0; } else if (count == 7) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); UnityEngine.Color[] arg4 = ToLua.CheckStructArray<UnityEngine.Color>(L, 6); int arg5 = (int)LuaDLL.luaL_checknumber(L, 7); obj.SetPixels(arg0, arg1, arg2, arg3, arg4, arg5); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.SetPixels"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int SetPixels32(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color32[] arg0 = ToLua.CheckStructArray<UnityEngine.Color32>(L, 2); obj.SetPixels32(arg0); return 0; } else if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color32[] arg0 = ToLua.CheckStructArray<UnityEngine.Color32>(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); obj.SetPixels32(arg0, arg1); return 0; } else if (count == 6) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); UnityEngine.Color32[] arg4 = ToLua.CheckStructArray<UnityEngine.Color32>(L, 6); obj.SetPixels32(arg0, arg1, arg2, arg3, arg4); return 0; } else if (count == 7) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); UnityEngine.Color32[] arg4 = ToLua.CheckStructArray<UnityEngine.Color32>(L, 6); int arg5 = (int)LuaDLL.luaL_checknumber(L, 7); obj.SetPixels32(arg0, arg1, arg2, arg3, arg4, arg5); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.SetPixels32"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int LoadRawTextureData(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.LoadRawTextureData(arg0); return 0; } else if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); System.IntPtr arg0 = ToLua.CheckIntPtr(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); obj.LoadRawTextureData(arg0, arg1); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.LoadRawTextureData"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetRawTextureData(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); byte[] o = obj.GetRawTextureData(); ToLua.Push(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetPixels(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color[] o = obj.GetPixels(); ToLua.Push(L, o); return 1; } else if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Color[] o = obj.GetPixels(arg0); ToLua.Push(L, o); return 1; } else if (count == 5) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); UnityEngine.Color[] o = obj.GetPixels(arg0, arg1, arg2, arg3); ToLua.Push(L, o); return 1; } else if (count == 6) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); int arg4 = (int)LuaDLL.luaL_checknumber(L, 6); UnityEngine.Color[] o = obj.GetPixels(arg0, arg1, arg2, arg3, arg4); ToLua.Push(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixels"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GetPixels32(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Color32[] o = obj.GetPixels32(); ToLua.Push(L, o); return 1; } else if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Color32[] o = obj.GetPixels32(arg0); ToLua.Push(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.GetPixels32"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Apply(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); obj.Apply(); return 0; } else if (count == 2) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.Apply(arg0); return 0; } else if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); bool arg1 = LuaDLL.luaL_checkboolean(L, 3); obj.Apply(arg0, arg1); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.Apply"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Resize(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); bool o = obj.Resize(arg0, arg1); LuaDLL.lua_pushboolean(L, o); return 1; } else if (count == 5) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); UnityEngine.TextureFormat arg2 = (UnityEngine.TextureFormat)ToLua.CheckObject(L, 4, typeof(UnityEngine.TextureFormat)); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); bool o = obj.Resize(arg0, arg1, arg2, arg3); LuaDLL.lua_pushboolean(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.Resize"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int Compress(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.Compress(arg0); return 0; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int PackTextures(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray<UnityEngine.Texture2D>(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1); ToLua.Push(L, o); return 1; } else if (count == 4) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray<UnityEngine.Texture2D>(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1, arg2); ToLua.Push(L, o); return 1; } else if (count == 5) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Texture2D[] arg0 = ToLua.CheckObjectArray<UnityEngine.Texture2D>(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); UnityEngine.Rect[] o = obj.PackTextures(arg0, arg1, arg2, arg3); ToLua.Push(L, o); return 1; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.PackTextures"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int GenerateAtlas(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); UnityEngine.Vector2[] arg0 = ToLua.CheckStructArray<UnityEngine.Vector2>(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); System.Collections.Generic.List<UnityEngine.Rect> arg3 = (System.Collections.Generic.List<UnityEngine.Rect>)ToLua.CheckObject(L, 4, typeof(System.Collections.Generic.List<UnityEngine.Rect>)); bool o = UnityEngine.Texture2D.GenerateAtlas(arg0, arg1, arg2, arg3); LuaDLL.lua_pushboolean(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int ReadPixels(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 4) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Rect arg0 = StackTraits<UnityEngine.Rect>.Check(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); obj.ReadPixels(arg0, arg1, arg2); return 0; } else if (count == 5) { UnityEngine.Texture2D obj = (UnityEngine.Texture2D)ToLua.CheckObject(L, 1, typeof(UnityEngine.Texture2D)); UnityEngine.Rect arg0 = StackTraits<UnityEngine.Rect>.Check(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); bool arg3 = LuaDLL.luaL_checkboolean(L, 5); obj.ReadPixels(arg0, arg1, arg2, arg3); return 0; } else { return LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Texture2D.ReadPixels"); } } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int op_Equality(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.ToObject(L, 1); UnityEngine.Object arg1 = (UnityEngine.Object)ToLua.ToObject(L, 2); bool o = arg0 == arg1; LuaDLL.lua_pushboolean(L, o); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_mipmapCount(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; int ret = obj.mipmapCount; LuaDLL.lua_pushinteger(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index mipmapCount on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_format(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.Texture2D obj = (UnityEngine.Texture2D)o; UnityEngine.TextureFormat ret = obj.format; ToLua.Push(L, ret); return 1; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index format on a nil value"); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_whiteTexture(IntPtr L) { try { ToLua.PushSealed(L, UnityEngine.Texture2D.whiteTexture); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int get_blackTexture(IntPtr L) { try { ToLua.PushSealed(L, UnityEngine.Texture2D.blackTexture); return 1; } catch (Exception e) { return LuaDLL.toluaL_exception(L, e); } } }
29.834965
194
0.688965
[ "Apache-2.0" ]
871041532/LuaProfiler-For-Unity
ToLuaClient/Assets/Source/Generate/UnityEngine_Texture2DWrap.cs
21,334
C#
using AutoMapper; namespace MudBlazorTemplate.Extended.Profiles { public class ModelProfile : Profile { } }
15.125
45
0.719008
[ "Apache-2.0" ]
ProgrammingGoldflash/mud-blazor-project-template
MudBlazorTemplate.Extended/MudBlazorTemplate.Extended/Profiles/ModelProfile.cs
123
C#
using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using WebHDFS.Kitty.DataModels; using WebHDFS.Kitty.DataModels.RequestParams; using WebHDFS.Kitty.DataModels.Responses; namespace WebHDFS.Kitty { public interface IWebHdfsClient { Task<Stream> OpenStream(string path, OpenParams requestParams); Task<FileStatus> GetFileStatus(string path); Task<IReadOnlyCollection<FileStatus>> ListStatus(string path); Task<ContentSummaryResponse> GetContentSummary(string path); Task<FileChecksum> GetFileChecksum(string path); Task<string> GetHomeDirectory(); Task<bool> MakeDirectory(string path, string permission); Task UploadFile(string path, Stream fileStream, bool Overwrite = false, int Permission = 755, short? Replication = null, long? BufferSize = null, long? BlockSize = null); Task Delete(string path, bool Recursive = false); Task Append(string path, Stream fileStream, int? buffersize = null); Task<bool> Rename(string path, string destination); Task<bool> SetReplicationFactor(string path, short replication); Task SetPermission(string path, int permission); Task<string> CreateSnapshot(string path, string name = null); Task SetOwner(string path, string owner, string group = null); Task SetTimes(string path, int modificationtime = -1, int acesstime = -1); } }
31.73913
178
0.709589
[ "MIT" ]
KasperskyLab/WebHDFS.Kitty
WebHDFS.Kitty/IWebHDFSClient.cs
1,462
C#
using System; using System.Drawing; using System.Media; using System.Windows.Forms; using KeePass.App; using KeePass.UI; using KeePassLib.Security; namespace KeePassPasswordPractice { public partial class PasswordPracticeForm : Form { public PasswordPracticeForm(ProtectedString password) { this.InitializeComponent(); this._Password = password; this.PeekTextBox.UseSystemPasswordChar = false; this.PeekTextBox.TextEx = password; this.PeekTextBox.Select(password.Length, 0); this.Icon = AppIcons.Default; BannerFactory.CreateBannerEx(this, this.BannerImage, Properties.Resources.icon_48x48, "Password Practice", "Practice the password of the entry."); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.F1) { this.PeekButton.Checked ^= true; this.PeekTextBox.Focus(); this.PasswordTextBox.Focus(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void PasswordTextBox_TextChanged(object sender, EventArgs e) { this.PasswordTextBox.BackColor = this.CorrectPassword ? _GreenBack : SystemColors.Window; } private void PasswordTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) { this.PasswordAsteriskButton.Checked ^= true; } } private void PasswordAsteriskButton_CheckedChanged(object sender, EventArgs e) { this.PasswordTextBox.UseSystemPasswordChar = this.PasswordAsteriskButton.Checked; var selectionStart = this.PasswordTextBox.SelectionStart; var selectionLength = this.PasswordTextBox.SelectionLength; this.PasswordTextBox.TextEx = this.PasswordTextBox.TextEx; this.PasswordTextBox.Select(selectionStart, selectionLength); } private void PeekButton_CheckedChanged(object sender, EventArgs e) { this.PeekPanel.Visible = this.PeekButton.Checked; this.PasswordPanel.Visible = !this.PeekButton.Checked; } private void OkButton_Click(object sender, EventArgs e) { if (!this.CorrectPassword) { SystemSounds.Exclamation.Play(); } else { this.DialogResult = DialogResult.OK; this.Close(); } } public ProtectedString EnteredPassword { get { return this.PasswordTextBox.TextEx; } } public bool CorrectPassword { get { return this.EnteredPassword.Equals(this._Password, false); } } private readonly ProtectedString _Password; private static readonly Color _GreenBack = Color.FromArgb(192, 255, 192); } }
29.932692
158
0.592997
[ "MIT" ]
Shayan-To/KeePassPasswordPractice
PasswordPracticeForm.cs
3,113
C#
using System; namespace Vertical.ConsoleApplications.Routing { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public class CommandAttribute : Attribute { /// <summary> /// Creates a new instance of this type. /// </summary> /// <param name="route">The route for the handler.</param> public CommandAttribute(string route) { Route = route ?? throw new ArgumentNullException(nameof(route)); if (string.IsNullOrWhiteSpace(route)) { throw new ArgumentException("Route cannot be whitespace"); } } /// <summary> /// Gets the command route. /// </summary> public string Route { get; } /// <inheritdoc /> public override string ToString() => Route; } }
28.366667
76
0.573443
[ "MIT" ]
verticalsoftware/vertical-consoleapps
src/Routing/CommandAttribute.cs
851
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/amvideo.h in the Windows SDK for Windows 10.0.19041.0 // Original source is Copyright © Microsoft. All rights reserved. namespace TerraFX.Interop { public partial struct VIDEOINFOHEADER { public RECT rcSource; public RECT rcTarget; [NativeTypeName("DWORD")] public uint dwBitRate; [NativeTypeName("DWORD")] public uint dwBitErrorRate; [NativeTypeName("REFERENCE_TIME")] public long AvgTimePerFrame; public BITMAPINFOHEADER bmiHeader; } }
26.653846
145
0.689755
[ "MIT" ]
Ethereal77/terrafx.interop.windows
sources/Interop/Windows/um/amvideo/VIDEOINFOHEADER.cs
695
C#
using System; using System.Collections.Generic; using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; using SixLabors.ImageSharp; using static QRCoder.QRCodeGenerator; /* This renderer is inspired by RemusVasii: https://github.com/codebude/QRCoder/issues/223 */ /* namespace QRCoder { // ReSharper disable once InconsistentNaming public class PdfByteQRCode : AbstractQRCode, IDisposable { private readonly byte[] pdfBinaryComment = new byte[] { 0x25, 0xe2, 0xe3, 0xcf, 0xd3 }; /// <summary> /// Constructor without params to be used in COM Objects connections /// </summary> public PdfByteQRCode() { } public PdfByteQRCode(QRCodeData data) : base(data) { } /// <summary> /// Creates a PDF document with a black & white QR code /// </summary> /// <param name="pixelsPerModule"></param> /// <returns></returns> public byte[] GetGraphic(int pixelsPerModule) { return GetGraphic(pixelsPerModule, "#000000", "#ffffff"); } /// <summary> /// Takes hexadecimal color string #000000 and returns byte[]{ 0, 0, 0 } /// </summary> /// <param name="colorString">Color in HEX format like #ffffff</param> /// <returns></returns> private byte[] HexColorToByteArray(string colorString) { if (colorString.StartsWith("#")) colorString = colorString.Substring(1); byte[] byteColor = new byte[colorString.Length / 2]; for (int i = 0; i < byteColor.Length; i++) byteColor[i] = byte.Parse(colorString.Substring(i * 2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture); return byteColor; } /// <summary> /// Creates a PDF document with given colors DPI and quality /// </summary> /// <param name="pixelsPerModule"></param> /// <param name="darkColorHtmlHex"></param> /// <param name="lightColorHtmlHex"></param> /// <param name="dpi"></param> /// <param name="jpgQuality"></param> /// <returns></returns> public byte[] GetGraphic(int pixelsPerModule, string darkColorHtmlHex, string lightColorHtmlHex, int dpi = 150, long jpgQuality = 85) { byte[] jpgArray = null, pngArray = null; var imgSize = QrCodeData.ModuleMatrix.Count * pixelsPerModule; var pdfMediaSize = (imgSize * 72 / dpi).ToString(CultureInfo.InvariantCulture); //Get QR code image using (var qrCode = new PngByteQRCode(QrCodeData)) { pngArray = qrCode.GetGraphic(pixelsPerModule, HexColorToByteArray(darkColorHtmlHex), HexColorToByteArray(lightColorHtmlHex)); } //Create image and transofrm to JPG using (var msPng = new MemoryStream()) { msPng.Write(pngArray, 0, pngArray.Length); var img = Image.FromStream(msPng); using (var msJpeg = new MemoryStream()) { // Create JPEG with specified quality var jpgImageCodecInfo = ImageCodecInfo.GetImageEncoders().First(x => x.MimeType == "image/jpeg"); var jpgEncoderParameters = new EncoderParameters(1) { Param = new EncoderParameter[]{ new EncoderParameter(Encoder.Quality, jpgQuality) } }; img.Save(msJpeg, jpgImageCodecInfo, jpgEncoderParameters); jpgArray = msJpeg.ToArray(); } } //Create PDF document using (var stream = new MemoryStream()) { var writer = new StreamWriter(stream, System.Text.Encoding.GetEncoding("ASCII")); var xrefs = new List<long>(); writer.Write("%PDF-1.5\r\n"); writer.Flush(); stream.Write(pdfBinaryComment, 0, pdfBinaryComment.Length); writer.WriteLine(); writer.Flush(); xrefs.Add(stream.Position); writer.Write( xrefs.Count.ToString() + " 0 obj\r\n" + "<<\r\n" + "/Type /Catalog\r\n" + "/Pages 2 0 R\r\n" + ">>\r\n" + "endobj\r\n" ); writer.Flush(); xrefs.Add(stream.Position); writer.Write( xrefs.Count.ToString() + " 0 obj\r\n" + "<<\r\n" + "/Count 1\r\n" + "/Kids [ <<\r\n" + "/Type /Page\r\n" + "/Parent 2 0 R\r\n" + "/MediaBox [0 0 " + pdfMediaSize + " " + pdfMediaSize + "]\r\n" + "/Resources << /ProcSet [ /PDF /ImageC ]\r\n" + "/XObject << /Im1 4 0 R >> >>\r\n" + "/Contents 3 0 R\r\n" + ">> ]\r\n" + ">>\r\n" + "endobj\r\n" ); var X = "q\r\n" + pdfMediaSize + " 0 0 " + pdfMediaSize + " 0 0 cm\r\n" + "/Im1 Do\r\n" + "Q"; writer.Flush(); xrefs.Add(stream.Position); writer.Write( xrefs.Count.ToString() + " 0 obj\r\n" + "<< /Length " + X.Length.ToString() + " >>\r\n" + "stream\r\n" + X + "endstream\r\n" + "endobj\r\n" ); writer.Flush(); xrefs.Add(stream.Position); writer.Write( xrefs.Count.ToString() + " 0 obj\r\n" + "<<\r\n" + "/Name /Im1\r\n" + "/Type /XObject\r\n" + "/Subtype /Image\r\n" + "/Width " + imgSize.ToString() + "/Height " + imgSize.ToString() + "/Length 5 0 R\r\n" + "/Filter /DCTDecode\r\n" + "/ColorSpace /DeviceRGB\r\n" + "/BitsPerComponent 8\r\n" + ">>\r\n" + "stream\r\n" ); writer.Flush(); stream.Write(jpgArray, 0, jpgArray.Length); writer.Write( "\r\n" + "endstream\r\n" + "endobj\r\n" ); writer.Flush(); xrefs.Add(stream.Position); writer.Write( xrefs.Count.ToString() + " 0 obj\r\n" + jpgArray.Length.ToString() + " endobj\r\n" ); writer.Flush(); var startxref = stream.Position; writer.Write( "xref\r\n" + "0 " + (xrefs.Count + 1).ToString() + "\r\n" + "0000000000 65535 f\r\n" ); foreach (var refValue in xrefs) writer.Write(refValue.ToString("0000000000") + " 00000 n\r\n"); writer.Write( "trailer\r\n" + "<<\r\n" + "/Size " + (xrefs.Count + 1).ToString() + "\r\n" + "/Root 1 0 R\r\n" + ">>\r\n" + "startxref\r\n" + startxref.ToString() + "\r\n" + "%%EOF" ); writer.Flush(); stream.Position = 0; return stream.ToArray(); } } } public static class PdfByteQRCodeHelper { public static byte[] GetQRCode(string plainText, int pixelsPerModule, string darkColorHtmlHex, string lightColorHtmlHex, ECCLevel eccLevel, bool forceUtf8 = false, bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1) { using (var qrGenerator = new QRCodeGenerator()) using ( var qrCodeData = qrGenerator.CreateQrCode(plainText, eccLevel, forceUtf8, utf8BOM, eciMode, requestedVersion)) using (var qrCode = new PdfByteQRCode(qrCodeData)) return qrCode.GetGraphic(pixelsPerModule, darkColorHtmlHex, lightColorHtmlHex); } public static byte[] GetQRCode(string txt, ECCLevel eccLevel, int size) { using (var qrGen = new QRCodeGenerator()) using (var qrCode = qrGen.CreateQrCode(txt, eccLevel)) using (var qrBmp = new PdfByteQRCode(qrCode)) return qrBmp.GetGraphic(size); } } } */
37.64135
141
0.475059
[ "MIT" ]
Haarhoff/QRCoder
QRCoder/PdfByteQRCode.cs
8,923
C#
// ======================================== // Project Name : WodiLib // File Name : CommonEventName.cs // // MIT License Copyright(c) 2019 kameske // see LICENSE file // ======================================== using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using WodiLib.Sys; namespace WodiLib.Common { /// <summary> /// コモンイベント名 /// </summary> [Serializable] public class CommonEventName : IEquatable<CommonEventName> { // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Public Property // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /// <summary>コモンイベント名</summary> private string Value { get; } // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Constructor // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /// <summary> /// コンストラクタ /// </summary> /// <param name="value">[NotNewLine] コモンイベント名</param> /// <exception cref="ArgumentNullException">valueがnullの場合</exception> /// <exception cref="ArgumentNewLineException">valueに改行を含む場合</exception> public CommonEventName(string value) { if (value is null) throw new ArgumentNullException( ErrorMessage.NotNull(nameof(value))); if (value.HasNewLine()) throw new ArgumentNewLineException( ErrorMessage.NotNewLine(nameof(value), value)); Value = value; } // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Public Override Method // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /// <summary> /// string に変換する。 /// </summary> /// <returns>string値</returns> public override string ToString() => Value; /// <inheritdoc /> public override bool Equals(object? obj) { return obj is CommonEventName other && Equals(other); } /// <inheritdoc /> public override int GetHashCode() { return Value.GetHashCode(); } // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Public Method // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /// <summary> /// ウディタ文字列のbyte配列に変換する。 /// </summary> /// <returns>ウディタ文字列のbyte配列</returns> public IEnumerable<byte> ToWoditorStringBytes() { var woditorStr = new WoditorString(Value); return woditorStr.StringByte; } /// <summary> /// 値を比較する。 /// </summary> /// <param name="other">比較対象</param> /// <returns>一致する場合、true</returns> public bool Equals(CommonEventName? other) { if (other is null) return false; return Value.Equals(other.Value); } // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Implicit // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #nullable disable /// <summary> /// string -> CommonEventName への暗黙的な型変換 /// </summary> /// <param name="src">変換元</param> /// <returns>変換したインスタンス</returns> [return: NotNullIfNotNull("src")] public static implicit operator CommonEventName(string src) { if (src is null) return null; var result = new CommonEventName(src); return result; } /// <summary> /// CommonEventName -> string への暗黙的な型変換 /// </summary> /// <param name="src">変換元</param> /// <returns>変換したインスタンス</returns> [return: NotNullIfNotNull("src")] public static implicit operator string(CommonEventName src) { return src?.Value; } #nullable restore // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // Operator // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ /// <summary> /// == /// </summary> /// <param name="left">左辺</param> /// <param name="right">右辺</param> /// <returns>左辺==右辺の場合true</returns> public static bool operator ==(CommonEventName? left, CommonEventName? right) { if (ReferenceEquals(left, right)) return true; if (left is null || right is null) return false; return left.Value == right.Value; } /// <summary> /// != /// </summary> /// <param name="left">左辺</param> /// <param name="right">右辺</param> /// <returns>左辺!=右辺の場合true</returns> public static bool operator !=(CommonEventName? left, CommonEventName? right) { return !(left == right); } } }
32.424051
86
0.489362
[ "MIT" ]
kameske/WodiLib
WodiLib/WodiLib/Common/ValueObject/CommonEventName.cs
5,443
C#